@staix/agent-research 0.3.0 → 0.4.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/CHANGELOG.md +70 -0
- package/README.md +93 -22
- package/package.json +4 -1
- package/src/cli-output.ts +446 -0
- package/src/cli.ts +208 -66
- package/src/commands-table.ts +213 -93
- package/src/commands.ts +86 -17
- package/src/exp/artifacts.ts +20 -2
- package/src/exp/attempts.ts +26 -9
- package/src/exp/calibrate.ts +125 -0
- package/src/exp/executor.ts +130 -21
- package/src/exp/final.ts +12 -3
- package/src/exp/idea-report.ts +97 -0
- package/src/exp/ideas.ts +90 -6
- package/src/exp/investigate.ts +25 -22
- package/src/exp/metrics.ts +3 -5
- package/src/exp/protocol.ts +28 -3
- package/src/exp/reuse-admission.ts +3 -1
- package/src/exp/reuse-runtime.ts +5 -1
- package/src/exp/screen.ts +83 -0
- package/src/exp/selection.ts +110 -4
- package/src/exp/snapshot.ts +28 -8
- package/src/exp/stages.ts +3 -1
- package/src/harness/transitions.ts +37 -5
- package/src/manifest.ts +13 -5
- package/src/mcp-tools.ts +67 -14
- package/src/memory/archive.ts +8 -3
- package/src/paper/build.ts +39 -25
- package/src/paper/check.ts +46 -15
- package/src/paper/dependencies.ts +47 -0
- package/src/paper/document.ts +19 -0
- package/src/paper/figures.ts +152 -0
- package/src/paper/hygiene.ts +16 -5
- package/src/paper/plan.ts +71 -29
- package/src/paper/point-evidence.ts +27 -12
- package/src/paper/render.ts +113 -0
- package/src/paper/renderer.ts +128 -0
- package/src/paper/review.ts +41 -5
- package/src/plan/definition.ts +6 -1
- package/src/playbook.ts +21 -11
- package/src/provenance.ts +4 -3
- package/src/study-export.ts +7 -4
- package/src/study.ts +9 -4
- package/src/ui/plugin.ts +3 -1
package/src/commands-table.ts
CHANGED
|
@@ -1,97 +1,105 @@
|
|
|
1
1
|
/** The single source of the CLI surface: help text is rendered from it and the parser reads its options. */
|
|
2
|
-
export interface CommandSpec { name: string; usage: string; mutates: boolean | "network"; options: Record<string, "flag" | "value"
|
|
2
|
+
export interface CommandSpec { name: string; usage: string; mutates: boolean | "network"; options: Record<string, "flag" | "value">; summary: string; example?: string }
|
|
3
3
|
const json = { "--json": "flag" } as const;
|
|
4
4
|
export const COMMANDS: readonly CommandSpec[] = [
|
|
5
|
-
{ name: "retention inspect", usage: "retention inspect <dir> [--offset N] [--limit N] [--json]", mutates: "network", options: { "--offset": "value", "--limit": "value", ...json } },
|
|
6
|
-
{ name: "retention prune", usage: "retention prune <dir> --file PATH|- [--confirm FINGERPRINT] [--json]", mutates: "network", options: { "--file": "value", "--confirm": "value", ...json } },
|
|
7
|
-
{ name: "skill check", usage: "skill check <dir> <name> [--json]", mutates: "network", options: json },
|
|
8
|
-
{ name: "harness close", usage: "harness close <dir> <round> --file PATH|- [--confirm FINGERPRINT] [--json]", mutates: true, options: { "--file": "value", "--confirm": "value", ...json } },
|
|
9
|
-
{ name: "harness contrast", usage: "harness contrast <dir> <round> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
10
|
-
{ name: "harness compose", usage: "harness compose <dir> <round> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
11
|
-
{ name: "harness adopt", usage: "harness adopt <dir> <round> --file PATH|- [--confirm FINGERPRINT] [--json]", mutates: true, options: { "--file": "value", "--confirm": "value", ...json } },
|
|
12
|
-
{ name: "harness stream set", usage: "harness stream set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
13
|
-
{ name: "harness stream show", usage: "harness stream show <dir> [--json]", mutates: false, options: json },
|
|
14
|
-
{ name: "experience select", usage: "experience select <dir> --file PATH|- [--json]", mutates: "network", options: { "--file": "value", ...json } },
|
|
15
|
-
{ name: "experience freeze", usage: "experience freeze <dir> --file PATH|- [--json]", mutates: "network", options: { "--file": "value", ...json } },
|
|
16
|
-
{ name: "experience check", usage: "experience check <dir> <round> --model MODEL --runtime VERSION [--toolset-sha256 HASH] [--json]", mutates: "network", options: { "--model": "value", "--runtime": "value", "--toolset-sha256": "value", ...json } },
|
|
17
|
-
{ name: "harness set", usage: "harness set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
18
|
-
{ name: "harness show", usage: "harness show <dir> [--round ID] [--json]", mutates: false, options: { "--round": "value", ...json } },
|
|
19
|
-
{ name: "harness import", usage: "harness import <dir> <round> --file FIXTURE_PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
20
|
-
{ name: "lineage show", usage: "lineage show <dir> [--root KIND --id ID --revision REV --sha256 HASH] [--cursor CURSOR] [--json]", mutates: false, options: { "--root": "value", "--id": "value", "--revision": "value", "--sha256": "value", "--cursor": "value", ...json } },
|
|
21
|
-
{ name: "lineage compare", usage: "lineage compare <dir> (--attempts ID,... | --candidates COMMIT,...) [--json]", mutates: false, options: { "--attempts": "value", "--candidates": "value", ...json } },
|
|
22
|
-
{ name: "autonomy show", usage: "autonomy show <dir> [--json]", mutates: false, options: json },
|
|
23
|
-
{ name: "autonomy set", usage: "autonomy set <dir> <auto|gates|copilot|step> [--phase PHASE] [--json]", mutates: true, options: { "--phase": "value", ...json } },
|
|
24
|
-
{name: "lesson propose", usage: "lesson propose <dir> --file PATH|- [--json]", mutates: "network", options: {"--file": "value", ...json}},
|
|
25
|
-
{name: "lesson list", usage: "lesson list <dir> [--json]", mutates: false, options: {...json}},
|
|
26
|
-
{name: "lesson check", usage: "lesson check <dir> <name> [--json]", mutates: "network", options: {...json}},
|
|
27
|
-
{name: "lesson decide", usage: "lesson decide <dir> <name> --file PATH|- [--json]", mutates: "network", options: {"--file": "value", ...json}},
|
|
28
|
-
{ name: "skill propose", usage: "skill propose <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
29
|
-
{ name: "skill decide", usage: "skill decide <dir> <name> <accept|reject|withdraw> --reason TEXT [--pr URL] [--json]", mutates: true, options: { "--reason": "value", "--pr": "value", ...json } },
|
|
30
|
-
{ name: "skill list", usage: "skill list <dir> [--json]", mutates: false, options: json },
|
|
31
|
-
{ name: "lessons", usage: "lessons <dir> [--for TEXT] [--half-life DAYS] [--limit N] [--json]", mutates: false, options: { "--for": "value", "--half-life": "value", "--limit": "value", ...json } },
|
|
32
|
-
{ name: "archive", usage: "archive <dir> [--confirm FINGERPRINT] [--json]", mutates: "network", options: { "--confirm": "value", ...json } },
|
|
33
|
-
{ name: "setup", usage: "setup <claude|codex|kimi|pi|qwen|jcode|agy|all|console> [--apply|--undo] [--root ABS] [--json]", mutates: true, options: { "--apply": "flag", "--undo": "flag", "--root": "value", ...json } },
|
|
34
|
-
{ name: "watch set", usage: "watch set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
35
|
-
{ name: "watch run", usage: "watch run <dir> [--json]", mutates: "network", options: json },
|
|
36
|
-
{ name: "watch show", usage: "watch show <dir> [--json]", mutates: false, options: json },
|
|
37
|
-
{ name: "console add", usage: "console add <dir> [--json]", mutates: true, options: json },
|
|
38
|
-
{ name: "console remove", usage: "console remove <dir> [--json]", mutates: true, options: json },
|
|
39
|
-
{ name: "console list", usage: "console list [--json]", mutates: false, options: json },
|
|
40
|
-
{ name: "manifest", usage: "manifest [--json]", mutates: false, options: json },
|
|
41
|
-
{ name: "init", usage: "init <dir> --question TEXT [--mode survey|experiment] [--autonomy auto|gates|copilot|step] [--json]", mutates: true, options: { "--question": "value", "--mode": "value", "--autonomy": "value", ...json } },
|
|
42
|
-
{ name: "run", usage: "run <dir> [--parallel 1..8] [--json]", mutates: "network", options: { "--parallel": "value", ...json } },
|
|
43
|
-
{ name: "plan set", usage: "plan set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
44
|
-
{ name: "plan control", usage: "plan control <dir> <pause|resume|retry|cancel|skip> [node] --command-id ID --expected-revision N [--json]", mutates: "network", options: { "--command-id": "value", "--expected-revision": "value", ...json } },
|
|
45
|
-
{ name: "plan show", usage: "plan show <dir> [--json]", mutates: false, options: json },
|
|
46
|
-
{ name: "status", usage: "status <dir> [--json]", mutates: false, options: json },
|
|
47
|
-
{ name: "study export", usage: "study export <dir> --bundle DIR [--list] [--json]", mutates: true, options: { "--bundle": "value", "--list": "flag", ...json } },
|
|
48
|
-
{ name: "scope", usage: "scope <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
49
|
-
{ name: "idea add", usage: "idea add <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
50
|
-
{ name: "idea
|
|
51
|
-
{ name: "
|
|
52
|
-
{ name: "
|
|
53
|
-
{ name: "
|
|
54
|
-
{ name: "
|
|
55
|
-
{ name: "ablate
|
|
56
|
-
{ name: "
|
|
57
|
-
{ name: "
|
|
58
|
-
{ name: "
|
|
59
|
-
{ name: "
|
|
60
|
-
{ name: "
|
|
61
|
-
{ name: "
|
|
62
|
-
{ name: "
|
|
63
|
-
{ name: "
|
|
64
|
-
{ name: "
|
|
65
|
-
{ name: "
|
|
66
|
-
{ name: "
|
|
67
|
-
{ name: "
|
|
68
|
-
{ name: "
|
|
69
|
-
{ name: "
|
|
70
|
-
{ name: "attempt
|
|
71
|
-
{ name: "attempt
|
|
72
|
-
{ name: "attempt
|
|
73
|
-
{ name: "
|
|
74
|
-
{ name: "
|
|
75
|
-
{ name: "
|
|
76
|
-
{ name: "lit
|
|
77
|
-
{ name: "lit
|
|
78
|
-
{ name: "lit
|
|
79
|
-
{ name: "lit
|
|
80
|
-
{ name: "lit
|
|
81
|
-
{ name: "lit card
|
|
82
|
-
{ name: "lit
|
|
83
|
-
{ name: "lit
|
|
84
|
-
{ name: "
|
|
85
|
-
{ name: "
|
|
86
|
-
{ name: "
|
|
87
|
-
{ name: "review
|
|
88
|
-
{ name: "
|
|
89
|
-
{ name: "paper
|
|
90
|
-
{ name: "paper
|
|
91
|
-
{ name: "paper
|
|
92
|
-
{ name: "
|
|
93
|
-
{ name: "
|
|
94
|
-
{ name: "
|
|
5
|
+
{ name: "retention inspect", summary: "Inspect storage use and retention records", example: "study", usage: "retention inspect <dir> [--offset N] [--limit N] [--json]", mutates: "network", options: { "--offset": "value", "--limit": "value", ...json } },
|
|
6
|
+
{ name: "retention prune", summary: "Preview or confirm removal of retained evidence", example: "study --file refs.json", usage: "retention prune <dir> --file PATH|- [--confirm FINGERPRINT] [--json]", mutates: "network", options: { "--file": "value", "--confirm": "value", ...json } },
|
|
7
|
+
{ name: "skill check", summary: "Check a skill against its supporting evidence", example: "study review-skill", usage: "skill check <dir> <name> [--json]", mutates: "network", options: json },
|
|
8
|
+
{ name: "harness close", summary: "Preview or confirm closing a harness round", example: "study round-one --file close.json", usage: "harness close <dir> <round> --file PATH|- [--confirm FINGERPRINT] [--json]", mutates: true, options: { "--file": "value", "--confirm": "value", ...json } },
|
|
9
|
+
{ name: "harness contrast", summary: "Record a controlled harness contrast", example: "study round-one --file contrast.json", usage: "harness contrast <dir> <round> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
10
|
+
{ name: "harness compose", summary: "Record a composed harness candidate", example: "study round-one --file composition.json", usage: "harness compose <dir> <round> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
11
|
+
{ name: "harness adopt", summary: "Preview or confirm adopting a harness candidate", example: "study round-one --file adoption.json", usage: "harness adopt <dir> <round> --file PATH|- [--confirm FINGERPRINT] [--json]", mutates: true, options: { "--file": "value", "--confirm": "value", ...json } },
|
|
12
|
+
{ name: "harness stream set", summary: "Set the harness experience stream", example: "study --file stream.json", usage: "harness stream set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
13
|
+
{ name: "harness stream show", summary: "Show the harness experience stream", example: "study", usage: "harness stream show <dir> [--json]", mutates: false, options: json },
|
|
14
|
+
{ name: "experience select", summary: "Select experiences for a harness round", example: "study --file selection.json", usage: "experience select <dir> --file PATH|- [--json]", mutates: "network", options: { "--file": "value", ...json } },
|
|
15
|
+
{ name: "experience freeze", summary: "Freeze the experience context for a round", example: "study --file freeze.json", usage: "experience freeze <dir> --file PATH|- [--json]", mutates: "network", options: { "--file": "value", ...json } },
|
|
16
|
+
{ name: "experience check", summary: "Check experience context for a model and runtime", example: "study round-one --model sample --runtime 1.0", usage: "experience check <dir> <round> --model MODEL --runtime VERSION [--toolset-sha256 HASH] [--json]", mutates: "network", options: { "--model": "value", "--runtime": "value", "--toolset-sha256": "value", ...json } },
|
|
17
|
+
{ name: "harness set", summary: "Define a harness round", example: "study --file round.json", usage: "harness set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
18
|
+
{ name: "harness show", summary: "Show harness rounds and evidence", example: "study", usage: "harness show <dir> [--round ID] [--json]", mutates: false, options: { "--round": "value", ...json } },
|
|
19
|
+
{ name: "harness import", summary: "Import fixture evidence for a harness round", example: "study round-one --file fixture.json", usage: "harness import <dir> <round> --file FIXTURE_PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
20
|
+
{ name: "lineage show", summary: "Show the provenance of study evidence", example: "study", usage: "lineage show <dir> [--root KIND --id ID --revision REV --sha256 HASH] [--cursor CURSOR] [--json]", mutates: false, options: { "--root": "value", "--id": "value", "--revision": "value", "--sha256": "value", "--cursor": "value", ...json } },
|
|
21
|
+
{ name: "lineage compare", summary: "Compare the provenance of selected attempts", example: "study --attempts attempt-a,attempt-b", usage: "lineage compare <dir> (--attempts ID,... | --candidates COMMIT,...) [--json]", mutates: false, options: { "--attempts": "value", "--candidates": "value", ...json } },
|
|
22
|
+
{ name: "autonomy show", summary: "Show the study autonomy policy", example: "study", usage: "autonomy show <dir> [--json]", mutates: false, options: json },
|
|
23
|
+
{ name: "autonomy set", summary: "Set autonomy for a study or phase", example: "study gates", usage: "autonomy set <dir> <auto|gates|copilot|step> [--phase PHASE] [--json]", mutates: true, options: { "--phase": "value", ...json } },
|
|
24
|
+
{name: "lesson propose", summary: "Propose a lesson from study evidence", example: "study --file lesson.json", usage: "lesson propose <dir> --file PATH|- [--json]", mutates: "network", options: {"--file": "value", ...json}},
|
|
25
|
+
{name: "lesson list", summary: "List proposed and decided lessons", example: "study", usage: "lesson list <dir> [--json]", mutates: false, options: {...json}},
|
|
26
|
+
{name: "lesson check", summary: "Check a lesson proposal against current evidence", example: "study lesson-one", usage: "lesson check <dir> <name> [--json]", mutates: "network", options: {...json}},
|
|
27
|
+
{name: "lesson decide", summary: "Record a decision on a lesson proposal", example: "study lesson-one --file decision.json", usage: "lesson decide <dir> <name> --file PATH|- [--json]", mutates: "network", options: {"--file": "value", ...json}},
|
|
28
|
+
{ name: "skill propose", summary: "Propose a skill from study evidence", example: "study --file skill.json", usage: "skill propose <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
29
|
+
{ name: "skill decide", summary: "Accept, reject or withdraw a skill proposal", example: "study review-skill reject --reason superseded", usage: "skill decide <dir> <name> <accept|reject|withdraw> --reason TEXT [--pr URL] [--json]", mutates: true, options: { "--reason": "value", "--pr": "value", ...json } },
|
|
30
|
+
{ name: "skill list", summary: "List proposed and decided skills", example: "study", usage: "skill list <dir> [--json]", mutates: false, options: json },
|
|
31
|
+
{ name: "lessons", summary: "Rank lessons relevant to the study", example: "study", usage: "lessons <dir> [--for TEXT] [--half-life DAYS] [--limit N] [--json]", mutates: false, options: { "--for": "value", "--half-life": "value", "--limit": "value", ...json } },
|
|
32
|
+
{ name: "archive", summary: "Preview or confirm publishing lessons", example: "study", usage: "archive <dir> [--confirm FINGERPRINT] [--json]", mutates: "network", options: { "--confirm": "value", ...json } },
|
|
33
|
+
{ name: "setup", summary: "Preview or change agent integration registration", example: "codex", usage: "setup <claude|codex|kimi|pi|qwen|jcode|agy|all|console> [--apply|--undo] [--root ABS] [--json]", mutates: true, options: { "--apply": "flag", "--undo": "flag", "--root": "value", ...json } },
|
|
34
|
+
{ name: "watch set", summary: "Set the literature watch configuration", example: "study --file watch.json", usage: "watch set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
35
|
+
{ name: "watch run", summary: "Run one literature watch pass", example: "study", usage: "watch run <dir> [--json]", mutates: "network", options: json },
|
|
36
|
+
{ name: "watch show", summary: "Show the watch configuration and last pass", example: "study", usage: "watch show <dir> [--json]", mutates: false, options: json },
|
|
37
|
+
{ name: "console add", summary: "Register a study with the console", example: "study", usage: "console add <dir> [--json]", mutates: true, options: json },
|
|
38
|
+
{ name: "console remove", summary: "Remove a study from the console registry", example: "study", usage: "console remove <dir> [--json]", mutates: true, options: json },
|
|
39
|
+
{ name: "console list", summary: "List studies registered with the console", usage: "console list [--json]", mutates: false, options: json },
|
|
40
|
+
{ name: "manifest", summary: "Show the CLI and MCP interfaces", usage: "manifest [--json]", mutates: false, options: json },
|
|
41
|
+
{ name: "init", summary: "Create a study", example: "study --question Question", usage: "init <dir> --question TEXT [--mode survey|experiment] [--autonomy auto|gates|copilot|step] [--json]", mutates: true, options: { "--question": "value", "--mode": "value", "--autonomy": "value", ...json } },
|
|
42
|
+
{ name: "run", summary: "Execute the study plan", example: "study", usage: "run <dir> [--parallel 1..8] [--json]", mutates: "network", options: { "--parallel": "value", ...json } },
|
|
43
|
+
{ name: "plan set", summary: "Set the study plan", example: "study --file plan.json", usage: "plan set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
44
|
+
{ name: "plan control", summary: "Pause, resume or control a plan node", example: "study pause --command-id pause-one --expected-revision 1", usage: "plan control <dir> <pause|resume|retry|cancel|skip> [node] --command-id ID --expected-revision N [--json]", mutates: "network", options: { "--command-id": "value", "--expected-revision": "value", ...json } },
|
|
45
|
+
{ name: "plan show", summary: "Show the plan, nodes and execution state", example: "study", usage: "plan show <dir> [--json]", mutates: false, options: json },
|
|
46
|
+
{ name: "status", summary: "Show study readiness and progress", example: "study", usage: "status <dir> [--json]", mutates: false, options: json },
|
|
47
|
+
{ name: "study export", summary: "Export a study bundle or preview its files", example: "study --bundle bundle --list", usage: "study export <dir> --bundle DIR [--list] [--json]", mutates: true, options: { "--bundle": "value", "--list": "flag", ...json } },
|
|
48
|
+
{ name: "scope", summary: "Set the study scope", example: "study --file scope.json", usage: "scope <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
49
|
+
{ name: "idea add", summary: "Record a research idea", example: "study --file idea.json", usage: "idea add <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
50
|
+
{ name: "idea categories", summary: "Declare the idea category vocabulary", example: "study --file categories.json", usage: "idea categories <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
51
|
+
{ name: "idea report", summary: "Report idea predictions and search state", example: "study --window 5", usage: "idea report <dir> [--run RUN] [--window N] [--json]", mutates: false, options: { "--run": "value", "--window": "value", ...json } },
|
|
52
|
+
{ name: "idea decide", summary: "Record an idea refinement or pivot", example: "study idea-one pivot --reason evidence", usage: "idea decide <dir> <id> <refine|pivot> --reason TEXT [--attempts ID[,ID...]] [--commit SHA] [--cause TEXT] [--retry-when TEXT] [--json]", mutates: true, options: { "--cause": "value", "--retry-when": "value", "--reason": "value", "--attempts": "value", "--commit": "value", ...json } },
|
|
53
|
+
{ name: "investigate show", summary: "Show the investigation and selected evidence", example: "study", usage: "investigate show <dir> [--json]", mutates: false, options: json },
|
|
54
|
+
{ name: "investigate close", summary: "Close the investigation with current evidence", example: "study", usage: "investigate close <dir> [--json]", mutates: true, options: json },
|
|
55
|
+
{ name: "ablate add", summary: "Record evidence for an ablation case", example: "study --file ablation.json", usage: "ablate add <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
56
|
+
{ name: "ablate show", summary: "Show the ablation cases and their evidence", example: "study", usage: "ablate show <dir> [--json]", mutates: false, options: json },
|
|
57
|
+
{ name: "ablate close", summary: "Close the ablation phase", example: "study", usage: "ablate close <dir> [--json]", mutates: true, options: json },
|
|
58
|
+
{ name: "posthoc show", summary: "Show posthoc investigation evidence", example: "study", usage: "posthoc show <dir> [--json]", mutates: false, options: json },
|
|
59
|
+
{ name: "final close", summary: "Close the final experiment phase", example: "study", usage: "final close <dir> [--json]", mutates: true, options: json },
|
|
60
|
+
{ name: "final seeds", summary: "Record the final experiment seeds", example: "study --file seeds.json", usage: "final seeds <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
61
|
+
{ name: "selection", summary: "Set the investigation selection rule", example: "study --file selection.json", usage: "selection <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
62
|
+
{ name: "selection calibrate", summary: "Recommend a minimum delta from baseline attempts", example: "study --from-run baseline", usage: "selection calibrate <dir> --from-run RUN [--null COMMIT] [--z NUMBER] [--json]", mutates: true, options: { "--from-run": "value", "--null": "value", "--z": "value", ...json } },
|
|
63
|
+
{ name: "protocol", summary: "Set the experiment protocol", example: "study --file protocol.json", usage: "protocol <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
64
|
+
{ name: "executor set", summary: "Configure an experiment executor", example: "study --kind local --workdir /tmp/ares", usage: "executor set <dir> --kind local|ssh [--host ALIAS] --workdir PATH [--retention-cap-bytes BYTES] [--gpu-devices IDS --gpu-min-free-memory-mb MB --gpu-max-load-ratio RATIO] [--json]", mutates: true, options: { "--kind": "value", "--host": "value", "--workdir": "value", "--retention-cap-bytes": "value", "--gpu-devices": "value", "--gpu-min-free-memory-mb": "value", "--gpu-max-load-ratio": "value", ...json } },
|
|
65
|
+
{ name: "executor inputs hash", summary: "Hash an input directory on the executor", example: "study /data/inputs", usage: "executor inputs hash <dir> <path> [--json]", mutates: "network", options: json },
|
|
66
|
+
{ name: "executor check", summary: "Check executor readiness", example: "study", usage: "executor check <dir> [--json]", mutates: "network", options: json },
|
|
67
|
+
{ name: "gate list", summary: "List gates and their current decisions", example: "study", usage: "gate list <dir> [--json]", mutates: false, options: json },
|
|
68
|
+
{ name: "gate approve", summary: "Approve the current gate binding", example: "study scope", usage: "gate approve <dir> <scope|screen|design|final|review|plan:node-id|accept:artifact|harness:round-id> [--reason TEXT] [--json]", mutates: true, options: { "--reason": "value", ...json } },
|
|
69
|
+
{ name: "gate reject", summary: "Reject the current gate binding", example: "study scope --reason incomplete", usage: "gate reject <dir> <scope|screen|design|final|review|plan:node-id|accept:artifact|harness:round-id> --reason TEXT [--json]", mutates: true, options: { "--reason": "value", ...json } },
|
|
70
|
+
{ name: "attempt run", summary: "Start or resume an experiment attempt", example: "study --repo /repo --commit abcdef0123456789abcdef0123456789abcdef01", usage: "attempt run <dir> --repo PATH --commit SHA [--seed N] [--run NAME] [--label TEXT] [--retry ID] [--reuse off|eligible] [--force-fresh] [--detach] [--json]", mutates: "network", options: { "--repo": "value", "--commit": "value", "--seed": "value", "--run": "value", "--label": "value", "--retry": "value", "--reuse": "value", "--force-fresh": "flag", "--detach": "flag", ...json } },
|
|
71
|
+
{ name: "attempt list", summary: "List experiment attempts and states", example: "study", usage: "attempt list <dir> [--run NAME] [--status running|succeeded|failed|cancelled|unknown] [--limit N] [--offset N] [--json]", mutates: false, options: { "--run": "value", "--status": "value", "--limit": "value", "--offset": "value", ...json } },
|
|
72
|
+
{ name: "attempt show", summary: "Show one experiment attempt", example: "study attempt-id", usage: "attempt show <dir> <id> [--json]", mutates: false, options: json },
|
|
73
|
+
{ name: "attempt cancel", summary: "Cancel a running experiment attempt", example: "study attempt-id", usage: "attempt cancel <dir> <id> [--reason TEXT] [--json]", mutates: "network", options: { "--reason": "value", ...json } },
|
|
74
|
+
{ name: "attempt reconcile", summary: "Reconcile recorded attempts with the executor", example: "study", usage: "attempt reconcile <dir> [--json]", mutates: "network", options: json },
|
|
75
|
+
{ name: "attempt logs", summary: "Read collected attempt logs", example: "study attempt-id", usage: "attempt logs <dir> <id> [--stage candidate|evaluator] [--candidate-stage NAME] [--stream stdout|stderr] [--tail BYTES] [--json]", mutates: false, options: { "--stage": "value", "--candidate-stage": "value", "--stream": "value", "--tail": "value", ...json } },
|
|
76
|
+
{ name: "lit search", summary: "Search literature sources for candidates", example: "study reproducibility", usage: "lit search <dir> <query> [--source openalex|s2|arxiv|all] [--limit 1..50] [--year-from YYYY] [--intent lexical|semantic|background] [--json]", mutates: "network", options: { "--source": "value", "--limit": "value", "--year-from": "value", "--intent": "value", ...json } },
|
|
77
|
+
{ name: "lit queries", summary: "List literature searches and their yield", example: "study", usage: "lit queries <dir> [--json]", mutates: false, options: json },
|
|
78
|
+
{ name: "lit flow", summary: "Show the literature screening flow", example: "study", usage: "lit flow <dir> [--markdown] [--json]", mutates: false, options: { "--markdown": "flag", ...json } },
|
|
79
|
+
{ name: "lit list", summary: "List literature candidates", example: "study", usage: "lit list <dir> [--status new|included|excluded] [--limit 1..500] [--json]", mutates: false, options: { "--status": "value", "--limit": "value", ...json } },
|
|
80
|
+
{ name: "lit screen", summary: "Include or exclude literature candidates", example: "study doi:10.0000/example --include", usage: "lit screen <dir> <id>... --include|--exclude [--code CODE] [--reason TEXT] [--json]", mutates: true, options: { "--include": "flag", "--exclude": "flag", "--code": "value", "--reason": "value", ...json } },
|
|
81
|
+
{ name: "lit card", summary: "Record an extraction card for a candidate", example: "study doi:10.0000/example --file card.json", usage: "lit card <dir> <id> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
82
|
+
{ name: "lit card export", summary: "Preview or confirm exporting extraction cards", example: "study doi:10.0000/example --vault research", usage: "lit card export <dir> <id>... --vault ID [--model-family NAME] [--confirm FINGERPRINT] [--json]", mutates: "network", options: { "--vault": "value", "--model-family": "value", "--confirm": "value", ...json } },
|
|
83
|
+
{ name: "lit card import", summary: "Import prior extraction cards as planning aids", example: "study doi:10.0000/example --vault research", usage: "lit card import <dir> <id>... --vault ID [--json]", mutates: "network", options: { "--vault": "value", ...json } },
|
|
84
|
+
{ name: "lit card list", summary: "List extraction cards", example: "study", usage: "lit card list <dir> [--json]", mutates: false, options: json },
|
|
85
|
+
{ name: "lit verify", summary: "Verify candidate identifiers and metadata", example: "study", usage: "lit verify <dir> [<id>...] [--json]", mutates: "network", options: json },
|
|
86
|
+
{ name: "lit bib", summary: "Build the verified study bibliography", example: "study", usage: "lit bib <dir> [--json]", mutates: true, options: json },
|
|
87
|
+
{ name: "review add", summary: "Record a review for the current paper build", example: "study --file review.json", usage: "review add <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
88
|
+
{ name: "review resolve", summary: "Record a resolution for a review finding", example: "study review-one/finding-one --reason revised", usage: "review resolve <dir> <review-id>/<finding-id> --reason TEXT [--json]", mutates: true, options: { "--reason": "value", ...json } },
|
|
89
|
+
{ name: "review show", summary: "Show paper reviews and open findings", example: "study", usage: "review show <dir> [--json]", mutates: false, options: json },
|
|
90
|
+
{ name: "review checklist", summary: "Show the paper review checklist", usage: "review checklist [--json]", mutates: false, options: json },
|
|
91
|
+
{ name: "paper build", summary: "Build the checked paper manuscript", example: "study", usage: "paper build <dir> [--doc manuscript|slides] [--json]", mutates: true, options: { "--doc": "value", ...json } },
|
|
92
|
+
{ name: "paper render record", summary: "Record an external render of the current build", example: "study --file paper.pdf --receipt receipt.json", usage: "paper render record <dir> --file PATH --receipt PATH [--doc manuscript|slides] [--json]", mutates: true, options: { "--doc": "value", "--file": "value", "--receipt": "value", ...json } },
|
|
93
|
+
{ name: "paper render show", summary: "Show whether a render matches the current build", example: "study", usage: "paper render show <dir> [--doc manuscript|slides] [--json]", mutates: false, options: { "--doc": "value", ...json } },
|
|
94
|
+
{ name: "renderer set", summary: "Set the local renderer for this study", example: "study --command '[\"atex\",\"ares\",\"build\",\"{study}\",\"{out}\"]'", usage: "renderer set <dir> --command JSON [--timeout-s N] [--json]", mutates: true, options: { "--command": "value", "--timeout-s": "value", ...json } },
|
|
95
|
+
{ name: "renderer show", summary: "Show the local renderer for this study", example: "study", usage: "renderer show <dir> [--json]", mutates: false, options: json },
|
|
96
|
+
{ name: "renderer check", summary: "Check the renderer without running it", example: "study", usage: "renderer check <dir> [--json]", mutates: false, options: json },
|
|
97
|
+
{ name: "paper plan set", summary: "Set the paper plan", example: "study --file paper-plan.json", usage: "paper plan set <dir> --file PATH|- [--json]", mutates: true, options: { "--file": "value", ...json } },
|
|
98
|
+
{ name: "paper plan show", summary: "Show the current paper plan", example: "study", usage: "paper plan show <dir> [--json]", mutates: false, options: json },
|
|
99
|
+
{ name: "paper check", summary: "Check paper claims and cited evidence", example: "study", usage: "paper check <dir> [--doc manuscript|slides] [--json]", mutates: false, options: { "--doc": "value", ...json } },
|
|
100
|
+
{ name: "cite check", summary: "Check draft citations against verified references", example: "study draft.md", usage: "cite check <dir> <draft> [--json]", mutates: false, options: json },
|
|
101
|
+
{ name: "playbook", summary: "Print the research workflow and reference rules", usage: "playbook", mutates: false, options: {} },
|
|
102
|
+
{ name: "mcp", summary: "Start the MCP server on standard streams", usage: "mcp", mutates: false, options: {} },
|
|
95
103
|
];
|
|
96
104
|
export function findCommand(args: string[]): { spec: CommandSpec; rest: string[] } | undefined {
|
|
97
105
|
const longest = Math.max(...COMMANDS.map(command => command.name.split(" ").length));
|
|
@@ -101,6 +109,118 @@ export function findCommand(args: string[]): { spec: CommandSpec; rest: string[]
|
|
|
101
109
|
}
|
|
102
110
|
return undefined;
|
|
103
111
|
}
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
|
|
113
|
+
export const GLOBAL_HELP_FLAGS = {
|
|
114
|
+
"--json": "Print the result as compact JSON when supported",
|
|
115
|
+
"--color": "Set color to auto, always or never",
|
|
116
|
+
"--ascii": "Use ASCII markers",
|
|
117
|
+
"--help": "Show command help",
|
|
118
|
+
} as const;
|
|
119
|
+
|
|
120
|
+
export const FLAG_DESCRIPTIONS: Readonly<Record<string, string>> = {
|
|
121
|
+
"--apply": "Apply the integration changes",
|
|
122
|
+
"--attempts": "Select attempt IDs as ID[,ID...]",
|
|
123
|
+
"--autonomy": "Set the initial autonomy policy",
|
|
124
|
+
"--bundle": "Set the export directory",
|
|
125
|
+
"--candidate-stage": "Select a named candidate pipeline stage",
|
|
126
|
+
"--candidates": "Select candidate commits as SHA[,SHA...]",
|
|
127
|
+
"--cause": "Describe the cause of the decision",
|
|
128
|
+
"--code": "Set the declared exclusion code",
|
|
129
|
+
"--command-id": "Set the idempotency key",
|
|
130
|
+
"--command": "Set the renderer argv as a JSON array",
|
|
131
|
+
"--commit": "Select the candidate commit",
|
|
132
|
+
"--confirm": "Confirm with the preview fingerprint",
|
|
133
|
+
"--cursor": "Continue from a lineage cursor",
|
|
134
|
+
"--doc": "Select the manuscript or slides",
|
|
135
|
+
"--detach": "Return after starting the attempt",
|
|
136
|
+
"--exclude": "Exclude the selected candidates",
|
|
137
|
+
"--expected-revision": "Require this plan revision",
|
|
138
|
+
"--file": "Read the input file or use - for stdin",
|
|
139
|
+
"--for": "Set the intent for ranking lessons",
|
|
140
|
+
"--force-fresh": "Require fresh execution",
|
|
141
|
+
"--from-run": "Read baseline attempts from this run",
|
|
142
|
+
"--gpu-devices": "Select GPU IDs as ID[,ID...]",
|
|
143
|
+
"--gpu-max-load-ratio": "Set the maximum GPU load ratio",
|
|
144
|
+
"--gpu-min-free-memory-mb": "Set minimum free GPU memory in MB",
|
|
145
|
+
"--half-life": "Set the recency half-life in days",
|
|
146
|
+
"--host": "Select the SSH host alias",
|
|
147
|
+
"--id": "Select the root reference ID",
|
|
148
|
+
"--include": "Include the selected candidates",
|
|
149
|
+
"--intent": "Label the search intent",
|
|
150
|
+
"--kind": "Select a local or SSH executor",
|
|
151
|
+
"--label": "Label the attempt",
|
|
152
|
+
"--limit": "Cap the number of results",
|
|
153
|
+
"--list": "Preview the files without exporting",
|
|
154
|
+
"--markdown": "Print the screening flow as Markdown",
|
|
155
|
+
"--mode": "Choose a survey or experiment study",
|
|
156
|
+
"--model": "Select the model used for the check",
|
|
157
|
+
"--model-family": "Record the model family",
|
|
158
|
+
"--null": "Pair with an identical-tree A/A commit",
|
|
159
|
+
"--offset": "Skip this many records",
|
|
160
|
+
"--parallel": "Set concurrency from 1 to 8",
|
|
161
|
+
"--phase": "Limit the policy to one phase",
|
|
162
|
+
"--pr": "Link the pull request for acceptance",
|
|
163
|
+
"--question": "Set the research question",
|
|
164
|
+
"--reason": "Record the reason for the decision",
|
|
165
|
+
"--receipt": "Read the renderer receipt JSON",
|
|
166
|
+
"--repo": "Select the candidate repository",
|
|
167
|
+
"--retention-cap-bytes": "Set the study storage cap in bytes",
|
|
168
|
+
"--retry": "Retry the selected attempt ID",
|
|
169
|
+
"--retry-when": "Describe when to retry this idea",
|
|
170
|
+
"--reuse": "Choose off or eligible reuse",
|
|
171
|
+
"--revision": "Select the root reference revision",
|
|
172
|
+
"--root": "Select the root reference kind",
|
|
173
|
+
"--round": "Select a harness round",
|
|
174
|
+
"--run": "Select or name an experiment run",
|
|
175
|
+
"--runtime": "Select the runtime version",
|
|
176
|
+
"--seed": "Select a declared protocol seed",
|
|
177
|
+
"--sha256": "Match the root reference digest",
|
|
178
|
+
"--source": "Select the literature provider",
|
|
179
|
+
"--stage": "Select candidate or evaluator logs",
|
|
180
|
+
"--status": "Filter by recorded status",
|
|
181
|
+
"--stream": "Select stdout or stderr logs",
|
|
182
|
+
"--tail": "Limit the collected tail in bytes",
|
|
183
|
+
"--timeout-s": "Set the renderer wall time in seconds",
|
|
184
|
+
"--toolset-sha256": "Require a toolset digest",
|
|
185
|
+
"--undo": "Remove the integration registration",
|
|
186
|
+
"--vault": "Select the registered vault ID",
|
|
187
|
+
"--workdir": "Set the executor working directory",
|
|
188
|
+
"--year-from": "Set the earliest publication year",
|
|
189
|
+
"--window": "Count this many recent measured ideas",
|
|
190
|
+
"--z": "Set the positive noise multiplier (default 2)",
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export const FLAG_OVERRIDES: Readonly<Record<string, string>> = {
|
|
194
|
+
"setup --root": "Pin an absolute release directory",
|
|
195
|
+
"lit search --limit": "Return 1 to 50 candidates",
|
|
196
|
+
"lit list --limit": "Return 1 to 500 candidates",
|
|
197
|
+
"lit card --file": "Read the extraction card JSON",
|
|
198
|
+
"harness import --file": "Read fixture JSON from a file or stdin",
|
|
199
|
+
"paper render record --file": "Read the rendered document file",
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export function flagDescription(spec: CommandSpec, flag: string): string | undefined {
|
|
203
|
+
return FLAG_OVERRIDES[`${spec.name} ${flag}`] ?? FLAG_DESCRIPTIONS[flag];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Keep published manifest usages byte-stable while normalizing human help. */
|
|
207
|
+
export function helpUsage(spec: CommandSpec): string {
|
|
208
|
+
return spec.usage.replace(/ \[--json\]$/, "")
|
|
209
|
+
.replace("[node]", "[<node>]")
|
|
210
|
+
.replace("--gpu-devices IDS", "--gpu-devices ID[,ID...]")
|
|
211
|
+
.replace(/--(parallel|limit) 1\.\.\d+/g, "--$1 N")
|
|
212
|
+
.replace(/<scope\|screen\|design\|final\|review\|plan:node-id\|accept:artifact\|harness:round-id>/, "<gate>")
|
|
213
|
+
.replace("--root KIND --id ID --revision REV --sha256 HASH", "--root KIND --id ID [--revision REV] [--sha256 HASH]")
|
|
214
|
+
.replace("(--attempts ID,... | --candidates COMMIT,...)", "[--attempts ID[,ID...]|--candidates SHA[,SHA...]]");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Prefer the usage's value notation while keeping each flag's description on one row. */
|
|
218
|
+
export function helpFlagLabel(spec: CommandSpec, flag: string): string {
|
|
219
|
+
if (spec.options[flag] !== "value") return flag;
|
|
220
|
+
const after = helpUsage(spec).split(`${flag} `)[1];
|
|
221
|
+
const token = after?.split(/ |\|--/, 1)[0];
|
|
222
|
+
const value = token?.endsWith("]") && (!token.includes("[") || token.endsWith("]]")) ? token.slice(0, -1) : token;
|
|
223
|
+
if (!value) return flag;
|
|
224
|
+
const label = `${flag} ${value}`;
|
|
225
|
+
return label.length <= 28 ? label : `${flag} VALUE`;
|
|
106
226
|
}
|