mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
chore: Pi 开发依赖跟随最新版并去掉测试里的固定版本号
- pi-hermes-memory / pi-notify / pi-permission-system / pi-subagents 的 @earendil-works/* devDependencies 改为 latest,pi-rtk-optimizer 放开 peer 范围;各子包锁文件刷新到 Pi 1.3.0,测试改为验证当前宿主 API。 - 新增 scripts/update-pi-devdeps.sh,统一刷新根与子包锁文件中的 Pi 版本。 - pi-subagents 适配 Pi 1.3:mention clone 改走 systemPromptOverride、 BOM frontmatter、e2e 读取规范化后的 system 消息与工具列表。 - 根测试不再写死 ssh2 / jiti / better-sqlite3 / context-mode 版本号, 改为精确版本格式与锁文件一致性断言;新增 latest 约束测试。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
ba164896d2
commit
b817d66a11
@@ -1,5 +1,5 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { readdir, readFile } from "node:fs/promises";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import test from "node:test";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@@ -115,3 +115,24 @@ test("disposable runtime state stays under the agent-dir my-pi tree", () => {
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test("every package-local @earendil-works/* devDependency is pinned to latest", async () => {
|
||||
for (const entry of await readdir(repositoryRoot, { withFileTypes: true })) {
|
||||
if (!entry.isDirectory()) continue;
|
||||
const manifestPath = join(repositoryRoot, entry.name, "package.json");
|
||||
let manifest: { devDependencies?: Record<string, string> };
|
||||
try {
|
||||
manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
||||
} catch {
|
||||
continue; // not a package directory
|
||||
}
|
||||
for (const [name, range] of Object.entries(manifest.devDependencies ?? {})) {
|
||||
if (!name.startsWith("@earendil-works/")) continue;
|
||||
assert.equal(
|
||||
range,
|
||||
"latest",
|
||||
`${entry.name} devDependency ${name} must track "latest" (refresh locks via scripts/update-pi-devdeps.sh)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -76,8 +76,8 @@ test("all package extensions load together without global registration conflicts
|
||||
);
|
||||
assert.ok(packageJson.pi.extensions.includes("./pi-ssh/index.ts"), "the bundle must load the locally maintained SSH extension");
|
||||
assert.equal(packageJson.dependencies["pi-ssh"], "file:./pi-ssh");
|
||||
assert.equal(packageJson.dependencies.ssh2, "1.17.0", "the packed bundle must install pi-ssh's runtime transport");
|
||||
assert.equal(packageJson.dependencies.jiti, "2.7.0", "the packed helper must load local TypeScript outside Pi");
|
||||
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(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");
|
||||
@@ -210,11 +210,28 @@ test("all package extensions load together without global registration conflicts
|
||||
);
|
||||
assert.equal(packageJson.dependencies["@the-forge-flow/hippo-memory-pi"], undefined);
|
||||
assert.equal(packageJson.dependencies["better-sqlite3"], undefined);
|
||||
assert.equal(packageJson.allowScripts["better-sqlite3@12.11.1"], true);
|
||||
// allowScripts must approve exactly the root lockfile's better-sqlite3
|
||||
// build — and nothing else. pi-hermes-memory's own lockfile carries a
|
||||
// nested major that ships N-API prebuilds and needs no approval entry.
|
||||
const rootLock = JSON.parse(await readFile(join(repositoryRoot, "package-lock.json"), "utf8")) as {
|
||||
packages: Record<string, { version?: string }>;
|
||||
};
|
||||
const hermesLock = JSON.parse(await readFile(join(repositoryRoot, "pi-hermes-memory", "package-lock.json"), "utf8")) as {
|
||||
packages: Record<string, { version?: string }>;
|
||||
};
|
||||
const rootSqliteVersion = rootLock.packages["node_modules/better-sqlite3"]?.version;
|
||||
const hermesSqliteVersion = hermesLock.packages["node_modules/better-sqlite3"]?.version;
|
||||
assert.match(rootSqliteVersion ?? "", /^\d+\.\d+\.\d+$/, "the root lockfile must pin a root-level better-sqlite3");
|
||||
assert.match(hermesSqliteVersion ?? "", /^\d+\.\d+\.\d+$/, "the Hermes lockfile must pin its own better-sqlite3");
|
||||
assert.deepEqual(
|
||||
Object.keys(packageJson.allowScripts).filter((key) => key.startsWith("better-sqlite3@")),
|
||||
[`better-sqlite3@${rootSqliteVersion}`],
|
||||
"allowScripts must approve exactly the root lockfile's better-sqlite3 build",
|
||||
);
|
||||
assert.equal(
|
||||
packageJson.allowScripts["better-sqlite3@13.0.3"],
|
||||
packageJson.allowScripts[`better-sqlite3@${hermesSqliteVersion}`],
|
||||
undefined,
|
||||
"Hermes uses better-sqlite3 13 N-API prebuilds, so no extra install-script approval is required",
|
||||
`Hermes uses better-sqlite3 ${hermesSqliteVersion} N-API prebuilds, so no extra install-script approval is required`,
|
||||
);
|
||||
assert.equal(packageJson.dependencies["@sinclair/typebox"], undefined);
|
||||
const home = await mkdtemp(join(tmpdir(), "my-pi-extension-load-"));
|
||||
|
||||
@@ -551,10 +551,10 @@ test("context-mode upstream still appends the single anchor-bearing user message
|
||||
const packageJson = JSON.parse(
|
||||
await readFile(join(repositoryRoot, "package.json"), "utf8"),
|
||||
) as { dependencies: Record<string, string> };
|
||||
assert.equal(
|
||||
packageJson.dependencies["context-mode"],
|
||||
"1.0.169",
|
||||
"the context-filter pin requires the exact upstream version",
|
||||
assert.match(
|
||||
packageJson.dependencies["context-mode"] ?? "",
|
||||
/^\d+\.\d+\.\d+$/,
|
||||
"the context-filter pin requires an exact upstream version",
|
||||
);
|
||||
const upstream = await readFile(
|
||||
join(repositoryRoot, "node_modules/context-mode/build/adapters/pi/extension.js"),
|
||||
|
||||
Reference in New Issue
Block a user