fix: 根 files 改为子包运行时白名单,并删除过期提示词快照

整目录列入子包时,pi-subagents 上游 .npmignore 覆盖 .gitignore,导致
嵌套 node_modules(含第二套 Pi runtime)与 dist 被打包:64.9MB/19,570
文件降至 1.2MB/471 文件。新增 tests/package-files.test.ts 守护:无嵌套
node_modules/dist、扩展入口与 file: 依赖清单在包内、包内源码相对引用闭包。
同时删除无引用的 pi-default-system-prompt.md 旧快照(可用 /dump-system-prompt)。

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
云服务部-叶林立
2026-10-21 19:16:47 -07:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent e996f59469
commit a254d4fd68
6 changed files with 185 additions and 52 deletions
+11 -8
View File
@@ -10,13 +10,16 @@ import test from "node:test";
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const hasPi = spawnSync("pi", ["--version"], { encoding: "utf8" }).status === 0;
const filesIncludePackageDir = (files: string[], packageDir: string): boolean =>
files.some((entry) => entry === packageDir || entry.startsWith(`${packageDir}/`));
test("enabled subagents wrapper loads with its bundle-owned mandatory permission entry", { skip: !hasPi }, async () => {
const packageJson = JSON.parse(await readFile(join(repositoryRoot, "package.json"), "utf8")) as {
dependencies: Record<string, string>;
files: string[];
pi: { extensions: string[] };
};
assert.ok(packageJson.files.includes("pi-subagents"));
assert.ok(filesIncludePackageDir(packageJson.files, "pi-subagents"));
assert.equal(packageJson.dependencies["@tintinweb/pi-subagents"], "file:./pi-subagents");
assert.ok(
packageJson.pi.extensions.includes("./extensions/subagents.ts"),
@@ -74,7 +77,7 @@ test("all package extensions load together without global registration conflicts
"the bundle must load the locally maintained minimal footer",
);
assert.equal(packageJson.dependencies["pi-compaction"], "file:./pi-compaction");
assert.ok(packageJson.files.includes("pi-compaction"), "the packed bundle must include maintained pi-compaction source");
assert.ok(filesIncludePackageDir(packageJson.files, "pi-compaction"), "the packed bundle must include maintained pi-compaction source");
assert.ok(
packageJson.pi.extensions.includes("./pi-compaction/index.ts"),
"the bundle must load the unified pi-compaction authority",
@@ -97,20 +100,20 @@ test("all package extensions load together without global registration conflicts
assert.equal(packageJson.dependencies["pi-ssh"], "file:./pi-ssh");
assert.match(packageJson.dependencies.ssh2 ?? "", /^\d+\.\d+\.\d+$/, "the packed bundle must install pi-ssh's runtime transport at an exact version");
assert.match(packageJson.dependencies.jiti ?? "", /^\d+\.\d+\.\d+$/, "the packed helper must load local TypeScript outside Pi at an exact version");
assert.ok(packageJson.files.includes("pi-ssh"), "the packed bundle must include the locally maintained SSH source");
assert.ok(filesIncludePackageDir(packageJson.files, "pi-ssh"), "the packed bundle must include the locally maintained SSH source");
assert.ok(packageJson.files.includes("configure.sh"), "the packed bundle must include the search/SSH config helper");
assert.ok(packageJson.pi.extensions.includes("./pi-ask-user/index.ts"), "the bundle must load pi-ask-user");
assert.equal(packageJson.dependencies["pi-ask-user"], "file:./pi-ask-user");
assert.ok(packageJson.files.includes("pi-ask-user"), "the packed bundle must include pi-ask-user source");
assert.ok(filesIncludePackageDir(packageJson.files, "pi-ask-user"), "the packed bundle must include pi-ask-user source");
assert.ok(
packageJson.pi.extensions.includes("./pi-worktree/index.ts"),
"the bundle must load the locally maintained worktree commands",
);
assert.equal(packageJson.dependencies["pi-worktree"], "file:./pi-worktree");
assert.ok(packageJson.files.includes("pi-worktree"), "the packed bundle must include pi-worktree source");
assert.ok(filesIncludePackageDir(packageJson.files, "pi-worktree"), "the packed bundle must include pi-worktree source");
const chromeExtension = "./pi-chrome/extensions/chrome-profile-bridge/index.ts";
assert.equal(packageJson.dependencies["pi-chrome"], "file:./pi-chrome", "the browser bridge must use the locally maintained source");
assert.ok(packageJson.files.includes("pi-chrome"), "the packed bundle must include the locally maintained pi-chrome source");
assert.ok(filesIncludePackageDir(packageJson.files, "pi-chrome"), "the packed bundle must include the locally maintained pi-chrome source");
assert.ok(packageJson.pi.extensions.includes(chromeExtension), "the bundle must load the local Chrome profile bridge directly");
assert.ok(
packageJson.pi.extensions.indexOf(chromeExtension) <
@@ -167,7 +170,7 @@ test("all package extensions load together without global registration conflicts
);
assert.equal(packageJson.dependencies["@smoose/pi-notify"], "file:./pi-notify");
assert.ok(
packageJson.files.includes("pi-notify"),
filesIncludePackageDir(packageJson.files, "pi-notify"),
"the packed bundle must include the locally maintained notification source",
);
assert.equal(packageJson.dependencies["@ogulcancelik/pi-minimal-footer"], "file:./pi-minimal-footer");
@@ -227,7 +230,7 @@ test("all package extensions load together without global registration conflicts
}
assert.equal(packageJson.dependencies["pi-hermes-memory"], "file:./pi-hermes-memory");
assert.ok(
packageJson.files.includes("pi-hermes-memory"),
filesIncludePackageDir(packageJson.files, "pi-hermes-memory"),
"the packed bundle must include the locally maintained Hermes memory source",
);
assert.ok(