@cchistory/lite 0.9.0 → 0.9.1
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/INSTALL.md +1 -1
- package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
- package/apps/lite-cli/dist/agent-contract.js +41 -2
- package/apps/lite-cli/dist/agent-contract.js.map +1 -1
- package/apps/lite-cli/dist/help.js +5 -5
- package/apps/lite-cli/dist/index.d.ts.map +1 -1
- package/apps/lite-cli/dist/index.js +148 -17
- package/apps/lite-cli/dist/index.js.map +1 -1
- package/apps/lite-cli/dist/index.test.js +114 -95
- package/apps/lite-cli/dist/index.test.js.map +1 -1
- package/apps/lite-cli/dist/inventory-and-git.test.d.ts +7 -0
- package/apps/lite-cli/dist/inventory-and-git.test.d.ts.map +1 -0
- package/apps/lite-cli/dist/inventory-and-git.test.js +776 -0
- package/apps/lite-cli/dist/inventory-and-git.test.js.map +1 -0
- package/apps/lite-cli/dist/inventory-command.d.ts +30 -0
- package/apps/lite-cli/dist/inventory-command.d.ts.map +1 -0
- package/apps/lite-cli/dist/inventory-command.js +265 -0
- package/apps/lite-cli/dist/inventory-command.js.map +1 -0
- package/apps/lite-cli/dist/json-v2.d.ts +2 -2
- package/apps/lite-cli/dist/json-v2.d.ts.map +1 -1
- package/apps/lite-cli/dist/json-v2.js +9 -3
- package/apps/lite-cli/dist/json-v2.js.map +1 -1
- package/apps/lite-cli/dist/project-git-command.d.ts +28 -0
- package/apps/lite-cli/dist/project-git-command.d.ts.map +1 -0
- package/apps/lite-cli/dist/project-git-command.js +288 -0
- package/apps/lite-cli/dist/project-git-command.js.map +1 -0
- package/apps/lite-cli/dist/startup-render.d.ts +10 -0
- package/apps/lite-cli/dist/startup-render.d.ts.map +1 -0
- package/apps/lite-cli/dist/startup-render.js +335 -0
- package/apps/lite-cli/dist/startup-render.js.map +1 -0
- package/apps/lite-cli/dist/version.d.ts +1 -1
- package/apps/lite-cli/dist/version.js +1 -1
- package/apps/lite-tui/dist/render.d.ts +1 -1
- package/apps/lite-tui/dist/version.d.ts +1 -1
- package/apps/lite-tui/dist/version.js +1 -1
- package/docs/guide/for-agents.md +14 -0
- package/docs/guide/lite.md +53 -2
- package/node_modules/@cchistory/canonical/dist/agent-inventory.d.ts +25 -0
- package/node_modules/@cchistory/canonical/dist/agent-inventory.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/agent-inventory.js +345 -0
- package/node_modules/@cchistory/canonical/dist/agent-inventory.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/agent-inventory.test.d.ts +7 -0
- package/node_modules/@cchistory/canonical/dist/agent-inventory.test.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/agent-inventory.test.js +231 -0
- package/node_modules/@cchistory/canonical/dist/agent-inventory.test.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/directory-scope.js +4 -1
- package/node_modules/@cchistory/canonical/dist/directory-scope.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts +2 -0
- package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.js +2 -0
- package/node_modules/@cchistory/canonical/dist/index.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/project-merge.d.ts +42 -0
- package/node_modules/@cchistory/canonical/dist/project-merge.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/project-merge.js +396 -0
- package/node_modules/@cchistory/canonical/dist/project-merge.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/project-merge.test.d.ts +7 -0
- package/node_modules/@cchistory/canonical/dist/project-merge.test.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/project-merge.test.js +319 -0
- package/node_modules/@cchistory/canonical/dist/project-merge.test.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js +38 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/tool-call-summary.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/tool-call-summary.js +8 -0
- package/node_modules/@cchistory/canonical/dist/tool-call-summary.js.map +1 -1
- package/node_modules/@cchistory/canonical/package.json +1 -1
- package/node_modules/@cchistory/domain/dist/agent-inventory.d.ts +146 -0
- package/node_modules/@cchistory/domain/dist/agent-inventory.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/agent-inventory.js +9 -0
- package/node_modules/@cchistory/domain/dist/agent-inventory.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/agent-startup.d.ts +362 -0
- package/node_modules/@cchistory/domain/dist/agent-startup.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/agent-startup.js +8 -0
- package/node_modules/@cchistory/domain/dist/agent-startup.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts +5 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/domain/dist/index.js +3 -0
- package/node_modules/@cchistory/domain/dist/index.js.map +1 -1
- package/node_modules/@cchistory/domain/dist/index.test.js +18 -1
- package/node_modules/@cchistory/domain/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/domain/dist/project-git.d.ts +121 -0
- package/node_modules/@cchistory/domain/dist/project-git.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/project-git.js +93 -0
- package/node_modules/@cchistory/domain/dist/project-git.js.map +1 -0
- package/node_modules/@cchistory/domain/package.json +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts +2 -1
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.js +2 -1
- package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/inventory-and-git.d.ts +35 -0
- package/node_modules/@cchistory/live-runtime/dist/inventory-and-git.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/inventory-and-git.js +68 -0
- package/node_modules/@cchistory/live-runtime/dist/inventory-and-git.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/package.json +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts +9 -0
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.js +130 -7
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.d.ts +5 -0
- package/node_modules/@cchistory/source-adapters/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.js +5 -0
- package/node_modules/@cchistory/source-adapters/dist/index.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.js +2 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/inventory/agent-config-reader.d.ts +14 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/agent-config-reader.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/agent-config-reader.js +397 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/agent-config-reader.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/agent-config-reader.test.d.ts +6 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/agent-config-reader.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/agent-config-reader.test.js +106 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/agent-config-reader.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/config-io.d.ts +42 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/config-io.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/config-io.js +368 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/config-io.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/redaction.d.ts +22 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/redaction.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/redaction.js +195 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/redaction.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/antigravity-helpers.d.ts +23 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/antigravity-helpers.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/antigravity-helpers.js +147 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/antigravity-helpers.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/antigravity.d.ts +11 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/antigravity.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/antigravity.js +339 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/antigravity.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/claude-code-helpers.d.ts +70 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/claude-code-helpers.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/claude-code-helpers.js +257 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/claude-code-helpers.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/claude-code.d.ts +11 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/claude-code.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/claude-code.js +321 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/claude-code.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/codex.d.ts +12 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/codex.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/codex.js +363 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/codex.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/deepseek-harness.d.ts +20 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/deepseek-harness.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/deepseek-harness.js +408 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/deepseek-harness.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/index.d.ts +24 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/index.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/index.js +225 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/index.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/opencode.d.ts +12 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/opencode.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/opencode.js +372 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/opencode.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/shared.d.ts +62 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/shared.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/shared.js +428 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/shared.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/startup.test.d.ts +7 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/startup.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/startup.test.js +399 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/startup/startup.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/toml.d.ts +16 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/toml.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/toml.js +478 -0
- package/node_modules/@cchistory/source-adapters/dist/inventory/toml.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/package.json +1 -1
- package/package.json +5 -5
- package/schemas/cchistory-lite-agent-v1.schema.json +3 -1
- package/schemas/cchistory-lite-envelope-v1.schema.json +33 -0
- package/schemas/cchistory-lite-inventory-v1.schema.json +94 -0
- package/schemas/cchistory-lite-merged-projects-v1.schema.json +44 -0
- package/schemas/cchistory-lite-v2.schema.json +22 -1
- package/skills/using-cchistory-lite/SKILL.md +17 -0
|
@@ -1434,7 +1434,7 @@ test("Lite CLI agent prints the machine-readable contract without scanning", asy
|
|
|
1434
1434
|
assert.equal(contract.kind, "agent_contract");
|
|
1435
1435
|
assert.equal(contract.cli.name, "cchistory-lite");
|
|
1436
1436
|
assert.match(contract.cli.version, /^\d+\.\d+\.\d+/u);
|
|
1437
|
-
const commandNames = ["sources", "ls", "latest", "sample", "tree", "search", "show", "stats", "trace", "query", "shell", "export", "tui", "help", "agent"];
|
|
1437
|
+
const commandNames = ["sources", "ls", "latest", "sample", "tree", "search", "show", "stats", "trace", "inventory", "merge-projects", "query", "shell", "export", "tui", "help", "agent"];
|
|
1438
1438
|
assert.deepEqual(Object.keys(contract.commands).sort(), [...commandNames].sort());
|
|
1439
1439
|
for (const name of commandNames) {
|
|
1440
1440
|
const command = contract.commands[name];
|
|
@@ -1543,107 +1543,126 @@ test("Lite CLI agent contract flags match the parser in both directions", async
|
|
|
1543
1543
|
"--model", "--from", "--to", "--since", "--tz", "--week-mode", "--sort",
|
|
1544
1544
|
"--pricing", "--alias", "--multiplier", "--cache-read-multiplier", "--cache-write-multiplier",
|
|
1545
1545
|
"--quota", "--export-pricing", "--explain-pricing",
|
|
1546
|
-
"--format", "--out", "--dir", "--
|
|
1546
|
+
"--format", "--out", "--dir", "--home", "--agent", "--host-id", "--no-activity", "--envelope", "--with-git",
|
|
1547
|
+
"--request", "--safe", "--json", "--all", "--no-dir",
|
|
1547
1548
|
"--help", "--version", "--sql", "--sql-file", "--params", "--complete", "--idle-timeout", "--diagnostics",
|
|
1548
1549
|
];
|
|
1549
1550
|
assert.deepEqual([...universe].sort(), [...parserFlags].sort());
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
return runLiteCli(argv, captured.io);
|
|
1616
|
-
};
|
|
1617
|
-
for (const [name, command] of Object.entries(contract.commands)) {
|
|
1618
|
-
const tail = tails[name];
|
|
1619
|
-
if (name === "help") {
|
|
1620
|
-
// help renders before option validation, so every known flag is accepted
|
|
1621
|
-
// and ignored; the rejection direction does not apply to it.
|
|
1622
|
-
for (const flag of universe) {
|
|
1623
|
-
assert.equal(await run([name, ...tail, ...flagArgs(flag)]), 0, `help must accept ${flag}`);
|
|
1624
|
-
}
|
|
1625
|
-
assert.equal(await run([name, ...tail, "--json=canonical"]), 0, "help must accept --json=canonical");
|
|
1626
|
-
continue;
|
|
1627
|
-
}
|
|
1628
|
-
const accepted = new Set([...globalFlags, ...command.flags.map((flag) => flag.name)]);
|
|
1629
|
-
for (const flag of universe) {
|
|
1630
|
-
let argv = tail.includes(flag) ? [name, ...tail] : [name, ...tail, ...flagArgs(flag)];
|
|
1631
|
-
if (name === "query" && ["--sql", "--sql-file", "--params", "--complete"].includes(flag)) {
|
|
1632
|
-
argv = [name, ...(["--sql", "--sql-file"].includes(flag) ? [] : ["--sql", "SELECT id FROM sessions LIMIT 1"]), ...flagArgs(flag)];
|
|
1551
|
+
const tempMergeDir = await mkdtemp(path.join(os.tmpdir(), "cchistory-contract-merge-"));
|
|
1552
|
+
const tempMergeFile = path.join(tempMergeDir, "host-a.json");
|
|
1553
|
+
await writeFile(tempMergeFile, JSON.stringify({ host_id: "host-a", projects: [] }), "utf8");
|
|
1554
|
+
const emptyHomeDir = path.join(tempMergeDir, "empty-home");
|
|
1555
|
+
await mkdir(emptyHomeDir, { recursive: true });
|
|
1556
|
+
try {
|
|
1557
|
+
const tails = {
|
|
1558
|
+
sources: [],
|
|
1559
|
+
ls: ["sessions"],
|
|
1560
|
+
latest: ["sessions", "1"],
|
|
1561
|
+
sample: ["1"],
|
|
1562
|
+
tree: ["projects"],
|
|
1563
|
+
search: ["mock"],
|
|
1564
|
+
show: ["session", session.id],
|
|
1565
|
+
stats: [],
|
|
1566
|
+
trace: [session.id],
|
|
1567
|
+
inventory: ["--home", emptyHomeDir],
|
|
1568
|
+
"merge-projects": [tempMergeFile],
|
|
1569
|
+
query: ["--request", "-"],
|
|
1570
|
+
shell: [],
|
|
1571
|
+
export: ["--format", "jsonl", "--out", "-"],
|
|
1572
|
+
tui: [],
|
|
1573
|
+
help: [],
|
|
1574
|
+
agent: [],
|
|
1575
|
+
};
|
|
1576
|
+
const flagArgs = (name) => {
|
|
1577
|
+
switch (name) {
|
|
1578
|
+
case "--source-root": return [name, `codex=${codexRoot}`];
|
|
1579
|
+
case "--source": return [name, "codex"];
|
|
1580
|
+
case "--limit-files": return [name, "4"];
|
|
1581
|
+
case "--limit": return [name, "1"];
|
|
1582
|
+
case "--offset": return [name, "0"];
|
|
1583
|
+
case "--project": return [name, project.project_id];
|
|
1584
|
+
case "--session": return [name, session.id];
|
|
1585
|
+
case "--turn": return [name, snapshot.listResolvedTurns()[0].id];
|
|
1586
|
+
case "--search": return [name, "mock"];
|
|
1587
|
+
case "--content": return [name, "conversation"];
|
|
1588
|
+
case "--group-by": return [name, "session"];
|
|
1589
|
+
case "--by": return [name, "source"];
|
|
1590
|
+
case "--model": return [name, "gpt"];
|
|
1591
|
+
case "--from": return [name, "2026-01-01"];
|
|
1592
|
+
case "--to": return [name, "2026-12-31"];
|
|
1593
|
+
case "--since": return [name, "all"];
|
|
1594
|
+
case "--tz": return [name, "UTC"];
|
|
1595
|
+
case "--week-mode": return [name, "rolling_7d"];
|
|
1596
|
+
case "--sort": return [name, "adjusted_cost"];
|
|
1597
|
+
case "--pricing": return [name, path.join(repoRoot, "docs/guide/pricing.example.json")];
|
|
1598
|
+
case "--alias": return [name, "gemini-pro=gemini-4-carbon"];
|
|
1599
|
+
case "--multiplier": return [name, "gpt-5=1"];
|
|
1600
|
+
case "--cache-read-multiplier": return [name, "gpt-5=1"];
|
|
1601
|
+
case "--cache-write-multiplier": return [name, "gpt-5=1"];
|
|
1602
|
+
case "--quota": return [name, "100"];
|
|
1603
|
+
case "--export-pricing": return [name, "-"];
|
|
1604
|
+
case "--format": return [name, "jsonl"];
|
|
1605
|
+
case "--out": return [name, "-"];
|
|
1606
|
+
case "--dir": return [name, repoRoot];
|
|
1607
|
+
case "--home": return [name, emptyHomeDir];
|
|
1608
|
+
case "--agent": return [name, "codex"];
|
|
1609
|
+
case "--host-id": return [name, "test-host"];
|
|
1610
|
+
case "--request": return [name, "-"];
|
|
1611
|
+
case "--sql": return [name, "SELECT id FROM sessions LIMIT 1"];
|
|
1612
|
+
case "--sql-file": return [name, path.join(repoRoot, "docs/guide/queries/latest-turns.sql")];
|
|
1613
|
+
case "--params": return [name, "[]"];
|
|
1614
|
+
case "--idle-timeout": return [name, "0"];
|
|
1615
|
+
default: return [name];
|
|
1633
1616
|
}
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1638
|
-
|
|
1617
|
+
};
|
|
1618
|
+
const run = async (argv) => {
|
|
1619
|
+
const captured = captureIo(repoRoot, async () => 0, {
|
|
1620
|
+
scan: async () => snapshot,
|
|
1621
|
+
readStdin: async () => `${JSON.stringify({
|
|
1622
|
+
schema: "cchistory-lite-query/v2",
|
|
1623
|
+
operations: [{ id: "s", kind: "list", collection: "sessions", limit: 1 }],
|
|
1624
|
+
})}\n`,
|
|
1625
|
+
readLine: async () => null,
|
|
1626
|
+
});
|
|
1627
|
+
return runLiteCli(argv, captured.io);
|
|
1628
|
+
};
|
|
1629
|
+
for (const [name, command] of Object.entries(contract.commands)) {
|
|
1630
|
+
const tail = tails[name];
|
|
1631
|
+
if (name === "help") {
|
|
1632
|
+
// help renders before option validation, so every known flag is accepted
|
|
1633
|
+
// and ignored; the rejection direction does not apply to it.
|
|
1634
|
+
for (const flag of universe) {
|
|
1635
|
+
assert.equal(await run([name, ...tail, ...flagArgs(flag)]), 0, `help must accept ${flag}`);
|
|
1636
|
+
}
|
|
1637
|
+
assert.equal(await run([name, ...tail, "--json=canonical"]), 0, "help must accept --json=canonical");
|
|
1638
|
+
continue;
|
|
1639
1639
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1640
|
+
const accepted = new Set([...globalFlags, ...command.flags.map((flag) => flag.name)]);
|
|
1641
|
+
for (const flag of universe) {
|
|
1642
|
+
let argv = tail.includes(flag) ? [name, ...tail] : [name, ...tail, ...flagArgs(flag)];
|
|
1643
|
+
if (name === "query" && ["--sql", "--sql-file", "--params", "--complete"].includes(flag)) {
|
|
1644
|
+
argv = [name, ...(["--sql", "--sql-file"].includes(flag) ? [] : ["--sql", "SELECT id FROM sessions LIMIT 1"]), ...flagArgs(flag)];
|
|
1645
|
+
}
|
|
1646
|
+
if (name === "ls" && flag === "--complete")
|
|
1647
|
+
argv = ["ls", "sources", "--complete"];
|
|
1648
|
+
if (name === "ls" && ["--with-git", "--envelope", "--host-id"].includes(flag)) {
|
|
1649
|
+
argv = ["ls", "projects", ...flagArgs(flag)];
|
|
1650
|
+
}
|
|
1651
|
+
const code = await run(argv);
|
|
1652
|
+
if (accepted.has(flag)) {
|
|
1653
|
+
assert.equal(code, 0, `${name} must accept ${flag} (argv: ${argv.join(" ")})`);
|
|
1654
|
+
}
|
|
1655
|
+
else {
|
|
1656
|
+
assert.equal(code, 2, `${name} must reject ${flag} (argv: ${argv.join(" ")})`);
|
|
1657
|
+
}
|
|
1642
1658
|
}
|
|
1659
|
+
const canonicalAccepted = command.flags.some((flag) => flag.name === "--json" && flag.values?.includes("canonical"));
|
|
1660
|
+
const canonicalArgv = [name, ...tail, "--json=canonical"];
|
|
1661
|
+
assert.equal(await run(canonicalArgv), canonicalAccepted ? 0 : 2, `${name} ${canonicalAccepted ? "must accept" : "must reject"} --json=canonical`);
|
|
1643
1662
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1663
|
+
}
|
|
1664
|
+
finally {
|
|
1665
|
+
await rm(tempMergeDir, { recursive: true, force: true });
|
|
1647
1666
|
}
|
|
1648
1667
|
});
|
|
1649
1668
|
test("Lite CLI agent skill and guide print the shipped docs", async () => {
|