@lnilluv/pi-ralph-loop 0.3.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +8 -39
- package/README.md +50 -160
- package/package.json +2 -2
- package/scripts/version-helper.ts +210 -0
- package/src/index.ts +1085 -188
- package/src/ralph-draft-context.ts +618 -0
- package/src/ralph-draft-llm.ts +297 -0
- package/src/ralph-draft.ts +33 -0
- package/src/ralph.ts +917 -102
- package/src/runner-rpc.ts +434 -0
- package/src/runner-state.ts +822 -0
- package/src/runner.ts +957 -0
- package/src/secret-paths.ts +66 -0
- package/src/shims.d.ts +0 -3
- package/tests/fixtures/parity/migrate/OPEN_QUESTIONS.md +3 -0
- package/tests/fixtures/parity/migrate/RALPH.md +27 -0
- package/tests/fixtures/parity/migrate/golden/MIGRATED.md +15 -0
- package/tests/fixtures/parity/migrate/legacy/source.md +6 -0
- package/tests/fixtures/parity/migrate/legacy/source.yaml +3 -0
- package/tests/fixtures/parity/migrate/scripts/show-legacy.sh +10 -0
- package/tests/fixtures/parity/migrate/scripts/verify.sh +15 -0
- package/tests/fixtures/parity/research/OPEN_QUESTIONS.md +3 -0
- package/tests/fixtures/parity/research/RALPH.md +45 -0
- package/tests/fixtures/parity/research/claim-evidence-checklist.md +15 -0
- package/tests/fixtures/parity/research/expected-outputs.md +22 -0
- package/tests/fixtures/parity/research/scripts/show-snapshots.sh +13 -0
- package/tests/fixtures/parity/research/scripts/verify.sh +55 -0
- package/tests/fixtures/parity/research/snapshots/app-factory-ai-cli.md +11 -0
- package/tests/fixtures/parity/research/snapshots/docs-factory-ai-cli-features-missions.md +11 -0
- package/tests/fixtures/parity/research/snapshots/factory-ai-news-missions.md +11 -0
- package/tests/fixtures/parity/research/source-manifest.md +20 -0
- package/tests/index.test.ts +3529 -0
- package/tests/parity/README.md +9 -0
- package/tests/parity/harness.py +526 -0
- package/tests/parity-harness.test.ts +42 -0
- package/tests/parity-research-fixture.test.ts +34 -0
- package/tests/ralph-draft-context.test.ts +672 -0
- package/tests/ralph-draft-llm.test.ts +434 -0
- package/tests/ralph-draft.test.ts +168 -0
- package/tests/ralph.test.ts +1389 -19
- package/tests/runner-event-contract.test.ts +235 -0
- package/tests/runner-rpc.test.ts +358 -0
- package/tests/runner-state.test.ts +553 -0
- package/tests/runner.test.ts +1347 -0
- package/tests/secret-paths.test.ts +55 -0
- package/tests/version-helper.test.ts +75 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { SECRET_PATH_POLICY_TOKEN, isSecretBearingPath, matchesProtectedPath } from "../src/secret-paths.ts";
|
|
4
|
+
|
|
5
|
+
test("secret-bearing path detection uses exact rules and ignores similarly named public files", () => {
|
|
6
|
+
for (const path of [
|
|
7
|
+
".env",
|
|
8
|
+
".env.local",
|
|
9
|
+
".npmrc",
|
|
10
|
+
".pypirc",
|
|
11
|
+
".netrc",
|
|
12
|
+
".aws/config",
|
|
13
|
+
".ssh/id_rsa",
|
|
14
|
+
"config/secrets/prod.json",
|
|
15
|
+
"config/credentials/service.json",
|
|
16
|
+
"ops-secrets/config.json",
|
|
17
|
+
"credentials-prod/token.txt",
|
|
18
|
+
"keys/server.pem",
|
|
19
|
+
"keys/private.key",
|
|
20
|
+
"keys/release.asc",
|
|
21
|
+
]) {
|
|
22
|
+
assert.equal(isSecretBearingPath(path), true, path);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (const path of ["src/secretary.ts", "src/credential-form.tsx"]) {
|
|
26
|
+
assert.equal(isSecretBearingPath(path), false, path);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("policy token protects secret-bearing paths and ignores a non-secret control", () => {
|
|
31
|
+
const protectedFiles = [SECRET_PATH_POLICY_TOKEN];
|
|
32
|
+
|
|
33
|
+
for (const filePath of [
|
|
34
|
+
"credentials/api.json",
|
|
35
|
+
"credentials/payments/service-account.json",
|
|
36
|
+
".ssh/config",
|
|
37
|
+
".npmrc",
|
|
38
|
+
"releases/signing-key.asc",
|
|
39
|
+
".env",
|
|
40
|
+
".env.local",
|
|
41
|
+
]) {
|
|
42
|
+
assert.equal(matchesProtectedPath(filePath, protectedFiles), true, filePath);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
assert.equal(matchesProtectedPath("src/app.ts", protectedFiles), false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("matchesProtectedPath checks repo-relative globs against absolute and relative inputs when cwd is known", () => {
|
|
49
|
+
const cwd = "/repo/project";
|
|
50
|
+
const protectedFiles = ["src/generated/**"];
|
|
51
|
+
|
|
52
|
+
assert.equal(matchesProtectedPath("src/generated/output.ts", protectedFiles, cwd), true);
|
|
53
|
+
assert.equal(matchesProtectedPath("/repo/project/src/generated/output.ts", protectedFiles, cwd), true);
|
|
54
|
+
assert.equal(matchesProtectedPath("/repo/project/src/app.ts", protectedFiles, cwd), false);
|
|
55
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
|
|
6
|
+
const scriptPath = fileURLToPath(new URL("../scripts/version-helper.ts", import.meta.url));
|
|
7
|
+
|
|
8
|
+
function runVersionHelper(
|
|
9
|
+
branch: "main" | "dev",
|
|
10
|
+
bump: "major" | "minor" | "patch",
|
|
11
|
+
npmVersions: string[] | string,
|
|
12
|
+
gitTags: string[] | string,
|
|
13
|
+
): string {
|
|
14
|
+
const result = spawnSync(
|
|
15
|
+
process.execPath,
|
|
16
|
+
["--experimental-strip-types", scriptPath, branch, bump, encodeInput(npmVersions), encodeInput(gitTags)],
|
|
17
|
+
{ encoding: "utf8" },
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
assert.equal(result.status, 0, result.stderr || result.stdout);
|
|
21
|
+
return result.stdout.trim();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function encodeInput(input: string[] | string): string {
|
|
25
|
+
return Array.isArray(input) ? JSON.stringify(input) : input;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
test("highest stable npm beats stale package line assumptions", () => {
|
|
29
|
+
assert.equal(
|
|
30
|
+
runVersionHelper(
|
|
31
|
+
"main",
|
|
32
|
+
"patch",
|
|
33
|
+
["0.1.4-dev.1", "1.2.3", "1.2.3-dev.0"],
|
|
34
|
+
["v1.1.9"],
|
|
35
|
+
),
|
|
36
|
+
"1.2.4",
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("highest stable git tag beats stale package line assumptions", () => {
|
|
41
|
+
assert.equal(
|
|
42
|
+
runVersionHelper(
|
|
43
|
+
"main",
|
|
44
|
+
"patch",
|
|
45
|
+
["0.1.4-dev.1", "1.1.9"],
|
|
46
|
+
["v1.2.5", "v1.2.4-dev.0"],
|
|
47
|
+
),
|
|
48
|
+
"1.2.6",
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("before any stable >= 1.0.0 exists, the next stable floors to 1.0.0", () => {
|
|
53
|
+
assert.equal(runVersionHelper("main", "patch", ["0.9.9"], ["v0.9.8"]), "1.0.0");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("main returns exact 1.0.0 in the current-style stale prerelease scenario", () => {
|
|
57
|
+
assert.equal(
|
|
58
|
+
runVersionHelper("main", "patch", ["0.1.4-dev.1", "1.0.0-dev.0"], ["v0.1.4-dev.1"]),
|
|
59
|
+
"1.0.0",
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("dev returns exact 1.0.0-dev.1 when prior prereleases exist on that line", () => {
|
|
64
|
+
assert.equal(
|
|
65
|
+
runVersionHelper("dev", "patch", "0.1.4-dev.1\n1.0.0-dev.0", ["v0.1.4-dev.1"]),
|
|
66
|
+
"1.0.0-dev.1",
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("once 1.0.0 exists, bumping resumes normally from the highest stable version", () => {
|
|
71
|
+
assert.equal(
|
|
72
|
+
runVersionHelper("main", "patch", ["1.0.0", "1.2.3"], ["v1.1.9"]),
|
|
73
|
+
"1.2.4",
|
|
74
|
+
);
|
|
75
|
+
});
|