chore: tidy package manifest and docs (drop .pi artifact in history)
This commit is contained in:
2
src/.npmignore
Normal file
2
src/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
||||
*.test.ts
|
||||
**/*.test.ts
|
||||
@@ -1,5 +1,6 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@@ -7,6 +8,17 @@ import { fileURLToPath } from "node:url";
|
||||
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const pkg = JSON.parse(readFileSync(resolve(packageRoot, "package.json"), "utf8"));
|
||||
|
||||
function getPackedPaths() {
|
||||
const output = execFileSync("npm", ["pack", "--dry-run", "--json"], {
|
||||
cwd: packageRoot,
|
||||
encoding: "utf8",
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
timeout: 30_000,
|
||||
});
|
||||
const [packResult] = JSON.parse(output) as Array<{ files: Array<{ path: string }> }>;
|
||||
return packResult.files.map((file) => file.path);
|
||||
}
|
||||
|
||||
test("package.json exposes pi-subagents as a standalone pi package", () => {
|
||||
assert.equal(pkg.name, "pi-subagents");
|
||||
assert.equal(pkg.type, "module");
|
||||
@@ -31,3 +43,21 @@ test("package.json exposes pi-subagents as a standalone pi package", () => {
|
||||
assert.ok(existsSync(resolve(packageRoot, "prompts/implement-and-review.md")));
|
||||
assert.ok(existsSync(resolve(packageRoot, "prompts/scout-and-plan.md")));
|
||||
});
|
||||
|
||||
test("README documents local install, git install, and tmux PATH requirement", () => {
|
||||
const readme = readFileSync(resolve(packageRoot, "README.md"), "utf8");
|
||||
assert.match(readme, /pi install \/absolute\/path\/to\/subagents/);
|
||||
assert.match(readme, /pi install https:\/\/gitea\.rwiesner\.com\/pi\/pi-subagents/);
|
||||
assert.match(readme, /tmux.*PATH/i);
|
||||
});
|
||||
|
||||
test("npm pack includes runtime package assets", () => {
|
||||
const packedPaths = getPackedPaths();
|
||||
|
||||
assert.ok(packedPaths.includes("index.ts"));
|
||||
assert.ok(packedPaths.includes("prompts/implement.md"));
|
||||
assert.ok(packedPaths.includes("prompts/implement-and-review.md"));
|
||||
assert.ok(packedPaths.includes("prompts/scout-and-plan.md"));
|
||||
assert.ok(packedPaths.includes("src/wrapper/cli.mjs"));
|
||||
assert.deepEqual(packedPaths.filter((p) => p.endsWith(".test.ts")), []);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user