agentplane 0.2.26 → 0.3.2

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.
Files changed (97) hide show
  1. package/README.md +3 -1
  2. package/assets/AGENTS.md +124 -526
  3. package/assets/agents/UPGRADER.json +10 -9
  4. package/assets/framework.manifest.json +112 -7
  5. package/assets/policy/check-routing.mjs +180 -0
  6. package/assets/policy/dod.code.md +25 -0
  7. package/assets/policy/dod.core.md +32 -0
  8. package/assets/policy/dod.docs.md +32 -0
  9. package/assets/policy/examples/migration-note.md +6 -0
  10. package/assets/policy/examples/pr-note.md +16 -0
  11. package/assets/policy/examples/unit-test-pattern.md +19 -0
  12. package/assets/policy/governance.md +37 -0
  13. package/assets/policy/incidents.md +36 -0
  14. package/assets/policy/security.must.md +7 -0
  15. package/assets/policy/workflow.branch_pr.md +34 -0
  16. package/assets/policy/workflow.direct.md +47 -0
  17. package/assets/policy/workflow.md +9 -0
  18. package/assets/policy/workflow.release.md +31 -0
  19. package/assets/policy/workflow.upgrade.md +20 -0
  20. package/bin/agentplane.js +88 -87
  21. package/bin/dist-guard.js +124 -0
  22. package/bin/runtime-context.d.ts +20 -0
  23. package/bin/runtime-context.js +81 -0
  24. package/dist/.build-manifest.json +5 -5
  25. package/dist/agents/agents-template.d.ts +7 -0
  26. package/dist/agents/agents-template.d.ts.map +1 -1
  27. package/dist/agents/agents-template.js +41 -2
  28. package/dist/cli/bootstrap-guide.d.ts +18 -0
  29. package/dist/cli/bootstrap-guide.d.ts.map +1 -0
  30. package/dist/cli/bootstrap-guide.js +132 -0
  31. package/dist/cli/command-guide.d.ts.map +1 -1
  32. package/dist/cli/command-guide.js +58 -183
  33. package/dist/cli/command-snippets.d.ts +3 -3
  34. package/dist/cli/command-snippets.js +3 -3
  35. package/dist/cli/run-cli/commands/core.js +3 -3
  36. package/dist/cli/run-cli/commands/ide.d.ts.map +1 -1
  37. package/dist/cli/run-cli/commands/ide.js +8 -3
  38. package/dist/cli/run-cli/commands/init/ui.d.ts.map +1 -1
  39. package/dist/cli/run-cli/commands/init/ui.js +1 -2
  40. package/dist/cli/run-cli/commands/init/write-agents.d.ts +2 -0
  41. package/dist/cli/run-cli/commands/init/write-agents.d.ts.map +1 -1
  42. package/dist/cli/run-cli/commands/init/write-agents.js +24 -5
  43. package/dist/cli/run-cli/commands/init/write-workflow.d.ts +5 -0
  44. package/dist/cli/run-cli/commands/init/write-workflow.d.ts.map +1 -1
  45. package/dist/cli/run-cli/commands/init/write-workflow.js +6 -0
  46. package/dist/cli/run-cli/commands/init.d.ts +2 -0
  47. package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
  48. package/dist/cli/run-cli/commands/init.js +47 -19
  49. package/dist/cli/run-cli.d.ts.map +1 -1
  50. package/dist/cli/run-cli.js +125 -7
  51. package/dist/commands/doctor.run.d.ts.map +1 -1
  52. package/dist/commands/doctor.run.js +48 -6
  53. package/dist/commands/finish.run.d.ts.map +1 -1
  54. package/dist/commands/finish.run.js +1 -0
  55. package/dist/commands/finish.spec.d.ts +1 -0
  56. package/dist/commands/finish.spec.d.ts.map +1 -1
  57. package/dist/commands/finish.spec.js +23 -2
  58. package/dist/commands/release/apply.command.d.ts +1 -0
  59. package/dist/commands/release/apply.command.d.ts.map +1 -1
  60. package/dist/commands/release/apply.command.js +20 -9
  61. package/dist/commands/release/plan.command.d.ts.map +1 -1
  62. package/dist/commands/release/plan.command.js +9 -3
  63. package/dist/commands/task/add.d.ts.map +1 -1
  64. package/dist/commands/task/add.js +32 -0
  65. package/dist/commands/task/doc.command.d.ts.map +1 -1
  66. package/dist/commands/task/doc.command.js +1 -0
  67. package/dist/commands/task/finish.d.ts +1 -0
  68. package/dist/commands/task/finish.d.ts.map +1 -1
  69. package/dist/commands/task/finish.js +28 -7
  70. package/dist/commands/task/new.d.ts.map +1 -1
  71. package/dist/commands/task/new.js +41 -4
  72. package/dist/commands/task/plan.d.ts.map +1 -1
  73. package/dist/commands/task/plan.js +7 -1
  74. package/dist/commands/task/shared.d.ts +7 -0
  75. package/dist/commands/task/shared.d.ts.map +1 -1
  76. package/dist/commands/task/shared.js +37 -0
  77. package/dist/commands/task/start-ready.js +1 -1
  78. package/dist/commands/upgrade.command.d.ts.map +1 -1
  79. package/dist/commands/upgrade.command.js +11 -7
  80. package/dist/commands/upgrade.d.ts.map +1 -1
  81. package/dist/commands/upgrade.js +284 -296
  82. package/dist/commands/workflow-build.command.d.ts.map +1 -1
  83. package/dist/commands/workflow-build.command.js +7 -0
  84. package/dist/commands/workflow-playbook.command.d.ts.map +1 -1
  85. package/dist/commands/workflow-playbook.command.js +0 -1
  86. package/dist/shared/policy-gateway.d.ts +15 -0
  87. package/dist/shared/policy-gateway.d.ts.map +1 -0
  88. package/dist/shared/policy-gateway.js +49 -0
  89. package/dist/shared/protected-paths.d.ts.map +1 -1
  90. package/dist/shared/protected-paths.js +1 -0
  91. package/dist/shared/runtime-artifacts.d.ts +2 -2
  92. package/dist/shared/runtime-artifacts.d.ts.map +1 -1
  93. package/dist/shared/runtime-artifacts.js +4 -0
  94. package/dist/workflow-runtime/build.d.ts +1 -1
  95. package/dist/workflow-runtime/build.d.ts.map +1 -1
  96. package/dist/workflow-runtime/build.js +14 -2
  97. package/package.json +2 -2
@@ -0,0 +1,132 @@
1
+ import { COMMAND_SNIPPETS } from "./command-snippets.js";
2
+ export const AGENT_BOOTSTRAP_DOC_PATH = "docs/user/agent-bootstrap.generated.mdx";
3
+ export const BOOTSTRAP_PREFLIGHT_COMMANDS = [
4
+ "agentplane config show",
5
+ "agentplane quickstart",
6
+ "agentplane task list",
7
+ "git status --short --untracked-files=no",
8
+ "git rev-parse --abbrev-ref HEAD",
9
+ ];
10
+ export const BOOTSTRAP_TASK_PREP_COMMANDS = [
11
+ COMMAND_SNIPPETS.core.taskNew,
12
+ 'agentplane task plan set <task-id> --text "..." --updated-by <ROLE>',
13
+ "agentplane task plan approve <task-id> --by ORCHESTRATOR",
14
+ ];
15
+ export const BOOTSTRAP_TASK_LIFECYCLE_COMMANDS = [
16
+ ...BOOTSTRAP_TASK_PREP_COMMANDS,
17
+ COMMAND_SNIPPETS.core.startTask,
18
+ COMMAND_SNIPPETS.core.verifyTask,
19
+ 'agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev>',
20
+ ];
21
+ export const BOOTSTRAP_VERIFY_AND_FINISH_COMMANDS = [
22
+ "agentplane task verify-show <task-id>",
23
+ COMMAND_SNIPPETS.core.verifyTask,
24
+ 'agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev>',
25
+ ];
26
+ export const BOOTSTRAP_VERIFICATION_COMMANDS = [
27
+ "agentplane task verify-show <task-id>",
28
+ COMMAND_SNIPPETS.core.verifyTask,
29
+ "agentplane doctor",
30
+ "node .agentplane/policy/check-routing.mjs",
31
+ ];
32
+ export const BOOTSTRAP_RECOVERY_COMMANDS = [
33
+ "agentplane doctor",
34
+ "agentplane upgrade --dry-run",
35
+ "agentplane upgrade",
36
+ ];
37
+ export const BOOTSTRAP_SECTIONS = [
38
+ {
39
+ heading: "1. Preflight",
40
+ summary: "Establish workflow mode, current branch, current task state, and tracked working-tree state.",
41
+ commands: BOOTSTRAP_PREFLIGHT_COMMANDS,
42
+ notes: [
43
+ "Run this before any mutation.",
44
+ "If the project is not initialized, stop and use `agentplane init` first.",
45
+ ],
46
+ },
47
+ {
48
+ heading: "2. Prepare executable task scope",
49
+ summary: "Work only through executable task ids. Create the task, fill plan/docs, then approve the plan.",
50
+ commands: BOOTSTRAP_TASK_PREP_COMMANDS,
51
+ notes: [
52
+ "Use `task doc set` to fill required README sections before approval.",
53
+ "For dependent tasks, wait until upstream tasks are DONE before `task start-ready`.",
54
+ ],
55
+ },
56
+ {
57
+ heading: "3. Start work deterministically",
58
+ summary: "Move the task to DOING only after plan approval succeeds.",
59
+ commands: [COMMAND_SNIPPETS.core.startTask],
60
+ notes: ["`task plan approve` and `task start-ready` must run sequentially, never in parallel."],
61
+ },
62
+ {
63
+ heading: "4. Verify and finish",
64
+ summary: "Treat Verify Steps as the contract, then record verification and close with traceable metadata.",
65
+ commands: BOOTSTRAP_VERIFY_AND_FINISH_COMMANDS,
66
+ notes: [
67
+ "In `direct`, `finish` creates the deterministic close commit by default.",
68
+ "Use `--no-close-commit` only for explicit manual close handling.",
69
+ ],
70
+ },
71
+ {
72
+ heading: "5. Recover mixed or broken state",
73
+ summary: "Use diagnostics before manual repair, especially after framework upgrades or partial edits.",
74
+ commands: BOOTSTRAP_RECOVERY_COMMANDS,
75
+ notes: [
76
+ "Run `doctor` before touching managed policy files by hand.",
77
+ "`upgrade` applies the managed framework files from the installed CLI bundle.",
78
+ ],
79
+ },
80
+ ];
81
+ export function renderBootstrapReferenceLine() {
82
+ return `Canonical bootstrap doc: \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`;
83
+ }
84
+ export function renderBootstrapSectionLines(sections) {
85
+ const lines = [];
86
+ for (const section of sections) {
87
+ lines.push(`## ${section.heading}`, "", section.summary, "");
88
+ for (const command of section.commands) {
89
+ lines.push(`- \`${command}\``);
90
+ }
91
+ if (section.notes && section.notes.length > 0) {
92
+ lines.push("");
93
+ for (const note of section.notes) {
94
+ lines.push(`- ${note}`);
95
+ }
96
+ }
97
+ lines.push("");
98
+ }
99
+ if (lines.at(-1) === "")
100
+ lines.pop();
101
+ return lines;
102
+ }
103
+ function renderCommandBlock(commands) {
104
+ return ["```bash", ...commands, "```"];
105
+ }
106
+ export function renderBootstrapDoc() {
107
+ const lines = [
108
+ "---",
109
+ 'title: "Agent bootstrap"',
110
+ 'description: "The shortest canonical startup path for agent work in an Agent Plane repository."',
111
+ "---",
112
+ "",
113
+ "This page is generated from `packages/agentplane/src/cli/bootstrap-guide.ts`.",
114
+ "",
115
+ "Use it as the single startup path for agents. `AGENTS.md`, `agentplane quickstart`, and `agentplane role <ROLE>` should point here instead of restating lifecycle prose.",
116
+ "",
117
+ "## Copy-paste start block",
118
+ "",
119
+ ...renderCommandBlock(BOOTSTRAP_PREFLIGHT_COMMANDS),
120
+ "",
121
+ "After preflight, continue with the smallest task flow that matches your mode and role.",
122
+ "",
123
+ ...renderBootstrapSectionLines(BOOTSTRAP_SECTIONS),
124
+ "",
125
+ "## Direct vs branch_pr",
126
+ "",
127
+ "- `direct`: work in the current checkout and finish the task yourself.",
128
+ "- `branch_pr`: start a task branch/worktree, maintain PR artifacts, and let INTEGRATOR close on base.",
129
+ "",
130
+ ];
131
+ return `${lines.join("\n")}\n`;
132
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"command-guide.d.ts","sourceRoot":"","sources":["../../src/cli/command-guide.ts"],"names":[],"mappings":"AAkMA,wBAAgB,SAAS,IAAI,MAAM,EAAE,CAEpC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOzD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CA2FzC"}
1
+ {"version":3,"file":"command-guide.d.ts","sourceRoot":"","sources":["../../src/cli/command-guide.ts"],"names":[],"mappings":"AA+GA,wBAAgB,SAAS,IAAI,MAAM,EAAE,CAEpC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOzD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAsCzC"}
@@ -1,176 +1,103 @@
1
1
  import { COMMAND_SNIPPETS } from "./command-snippets.js";
2
- const CHEAT_SHEET_ROWS = [
3
- {
4
- operation: "PLANNER: list/show tasks",
5
- command: "`agentplane task list` / `agentplane task show <task-id>`",
6
- },
7
- {
8
- operation: "PLANNER: set/approve/reject plan",
9
- command: '`agentplane task plan set <task-id> --text "..." --updated-by <id>` / `agentplane task plan approve <task-id> --by <id> --note "OK"`',
10
- },
11
- {
12
- operation: "PLANNER: create task (auto ID)",
13
- command: '`agentplane task new --title "..." --description "..." --priority med --owner CODER --tag <tag> [--depends-on <task-id|json>]`',
14
- },
15
- {
16
- operation: "PLANNER: add/update task",
17
- command: "`agentplane task add <task-id> ...` / `agentplane task update <task-id> ...`",
18
- },
19
- {
20
- operation: "PLANNER: backfill/repair scaffold",
21
- command: "`agentplane task scaffold <task-id>` (backfill/import/manual repair only)",
22
- },
23
- {
24
- operation: "PLANNER: derive implementation from spike",
25
- command: '`agentplane task derive <spike-id> --title "..." --description "..." --priority med --owner CODER --tag code`',
26
- },
27
- {
28
- operation: "Config: show/set",
29
- command: "`agentplane config show` / `agentplane config set <key> <value>`",
30
- },
31
- {
32
- operation: "CODER/TESTER/DOCS: start checkout (branch_pr)",
33
- command: "`agentplane work start <task-id> --agent <ROLE> --slug <slug> --worktree`",
34
- },
35
- {
36
- operation: "CODER/TESTER/DOCS: update PR artifacts",
37
- command: "`agentplane pr update <task-id>`",
38
- },
39
- {
40
- operation: "CODER/TESTER/DOCS/REVIEWER: add handoff note",
41
- command: '`agentplane pr note <task-id> --author <ROLE> --body "..."`',
42
- },
43
- {
44
- operation: "CODER/TESTER: verify task",
45
- command: '`agentplane verify <task-id> --ok|--rework --by <id> --note "..."` (record-only; appends to README)',
46
- },
47
- {
48
- operation: "CODER/TESTER: print Verify Steps",
49
- command: "`agentplane task verify-show <task-id>`",
50
- },
51
- {
52
- operation: "REVIEWER: check PR artifacts",
53
- command: "`agentplane pr check <task-id>`",
54
- },
55
- {
56
- operation: "INTEGRATOR: integrate task",
57
- command: "`agentplane integrate <task-id> --branch task/<task-id>/<slug> --merge-strategy squash --run-verify`",
58
- },
59
- {
60
- operation: "INTEGRATOR: finish task(s)",
61
- command: '`agentplane finish <task-id> [<task-id> ...] --commit <git-rev> --author INTEGRATOR --body "Verified: ..." [--result "<one line>"] [--close-commit] [--close-unstage-others]`',
62
- },
63
- {
64
- operation: "INTEGRATOR: commit closure",
65
- command: "Preferred: `agentplane finish <task-id> --close-commit` (single command). Legacy/manual: `agentplane commit <task-id> --close [--check-only] [--unstage-others]` / duplicate no-op close: `agentplane task close-duplicate <task-id> --of <canonical-task-id> --author <ROLE>`",
66
- },
67
- ];
2
+ import { AGENT_BOOTSTRAP_DOC_PATH, BOOTSTRAP_SECTIONS, renderBootstrapReferenceLine, } from "./bootstrap-guide.js";
3
+ function renderBootstrapOverview() {
4
+ const lines = [];
5
+ for (const section of BOOTSTRAP_SECTIONS) {
6
+ lines.push(`## ${section.heading}`, "", section.summary, "");
7
+ for (const command of section.commands) {
8
+ lines.push(`- \`${command}\``);
9
+ }
10
+ lines.push("");
11
+ }
12
+ if (lines.at(-1) === "")
13
+ lines.pop();
14
+ return lines;
15
+ }
68
16
  const ROLE_GUIDES = [
69
17
  {
70
18
  role: "ORCHESTRATOR",
71
19
  lines: [
72
- "- Plan intake: `agentplane task list` / `agentplane task show <task-id>`",
73
- "- After plan approval: ask PLANNER to create executable tasks directly from the approved task graph.",
74
- "- If task graph has exactly one work item, create exactly one executable task.",
75
- "- Two-stage verification: `## Verify Steps` is the ex-ante contract; `agentplane verify ...` appends an ex-post entry into `## Verification`.",
20
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
21
+ "- Owns preflight, plan summaries, approvals, and scope checkpoints.",
22
+ "- Does not create non-executable tasks or bypass lifecycle guardrails.",
76
23
  ],
77
24
  },
78
25
  {
79
26
  role: "PLANNER",
80
27
  lines: [
81
- '- TODO scan: `agentplane task list` / `agentplane task search "..."` / `agentplane task next`',
82
- '- Create tasks: `agentplane task new --title "..." --description "..." --priority med --owner <ROLE> --depends-on "[]" --tag <tag>` (tags are required; use `task add` only for imported IDs)',
83
- '- Update tasks: `agentplane task update <task-id> --title "..." --description "..." --priority med --owner <ROLE> --depends-on <task-id>`',
84
- "- `task new` auto-seeds README sections; use `task scaffold` only for backfill/import/manual repair.",
85
- '- Plan lifecycle: `agentplane task plan set <task-id> --text "..." --updated-by <ROLE>` -> `agentplane task plan approve <task-id> --by <id>`',
86
- "- Verify Steps discipline: if a task primary tag is verify-required (default: code/data/ops), fill `## Verify Steps` before plan approval.",
87
- '- Task docs (when planning needs it): `agentplane task doc set <task-id> --section Summary --text "..."`',
28
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
29
+ '- Create executable tasks with `agentplane task new --title "..." --description "..." --priority med --owner <ROLE> --tag <tag>`.',
30
+ '- Fill docs with `agentplane task doc set <task-id> --section <name> --text "..."` and set plan text with `agentplane task plan set <task-id> --text "..." --updated-by <ROLE>`.',
31
+ "- Approve plan only after required sections and Verify Steps are ready.",
88
32
  ],
89
33
  },
90
34
  {
91
35
  role: "CODER",
92
36
  lines: [
93
- "- direct mode: single-stream in the current checkout; `agentplane work start <task-id> --agent <ROLE> --slug <slug>` records the active task and keeps the current branch (no task branches). Use `task doc set` / `task plan set` for normal docs updates.",
94
- "- branch_pr: `agentplane work start <task-id> --agent <ROLE> --slug <slug> --worktree`",
95
- '- Status updates: `agentplane start <task-id> --author <ROLE> --body "Start: ..."` / `agentplane block <task-id> --author <ROLE> --body "Blocked: ..."`',
96
- "- Verify Steps: `agentplane task verify-show <task-id>` (use as the verification contract before recording results).",
97
- '- Verify: `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`',
98
- '- PR artifacts (branch_pr): `agentplane pr open <task-id> --branch task/<task-id>/<slug> --author <ROLE>` / `agentplane pr update <task-id>` / `agentplane pr note <task-id> --author <ROLE> --body "..."`',
99
- '- Commit: `agentplane guard commit <task-id> -m "<emoji> <suffix> <scope>: <summary>"` / `agentplane commit <task-id> -m "<emoji> <suffix> <scope>: <summary>" --allow <path-prefix>` / preferred close path: `agentplane finish <task-id> --close-commit [--close-unstage-others]`',
37
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
38
+ "- direct: stay in the current checkout; branch_pr: start a task branch/worktree first.",
39
+ `- Start deterministically with \`${COMMAND_SNIPPETS.core.startTask}\` after plan approval.`,
40
+ '- Treat `agentplane task verify-show <task-id>` as the verification contract, then record `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`.',
41
+ `- Preferred direct close path: \`${COMMAND_SNIPPETS.core.finishTask}\` with \`--result "..." \`; add \`--no-close-commit\` only for explicit manual close handling.`,
100
42
  ],
101
43
  },
102
44
  {
103
45
  role: "TESTER",
104
46
  lines: [
105
- "- direct mode: single-stream in the current checkout; `agentplane work start <task-id> --agent <ROLE> --slug <slug>` records the active task and keeps the current branch (no task branches). Use `task doc set` / `task plan set` for normal docs updates.",
106
- "- branch_pr: `agentplane work start <task-id> --agent <ROLE> --slug <slug> --worktree`",
107
- '- Status updates: `agentplane start <task-id> --author <ROLE> --body "Start: ..."` / `agentplane block <task-id> --author <ROLE> --body "Blocked: ..."`',
108
- "- Verify Steps: `agentplane task verify-show <task-id>` (treat as the verification contract).",
109
- '- Verify: `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`',
110
- '- PR artifacts (branch_pr): `agentplane pr open <task-id> --branch task/<task-id>/<slug> --author <ROLE>` / `agentplane pr update <task-id>` / `agentplane pr note <task-id> --author <ROLE> --body "..."`',
111
- '- Commit: `agentplane guard commit <task-id> -m "<emoji> <suffix> <scope>: <summary>"` / `agentplane commit <task-id> -m "<emoji> <suffix> <scope>: <summary>" --allow <path-prefix>` / preferred close path: `agentplane finish <task-id> --close-commit [--close-unstage-others]`',
47
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
48
+ "- Start only after plan approval and explicit Verify Steps exist.",
49
+ '- Use `agentplane task verify-show <task-id>` before running checks, then record `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`.',
50
+ `- In direct mode, close with \`${COMMAND_SNIPPETS.core.finishTask}\` plus \`--result "..." \` when you own final verification.`,
112
51
  ],
113
52
  },
114
53
  {
115
54
  role: "DOCS",
116
55
  lines: [
117
- '- Task docs: `agentplane task doc set <task-id> --section Summary --text "..."` (repeat per section or use `--file`)',
118
- '- PR notes: `agentplane pr note <task-id> --author DOCS --body "..."`',
119
- '- Commit: `agentplane guard commit <task-id> -m "<emoji> <suffix> <scope>: <summary>"` / `agentplane commit <task-id> -m "<emoji> <suffix> <scope>: <summary>" --allow <path-prefix>` / preferred close path: `agentplane finish <task-id> --close-commit [--close-unstage-others]`',
56
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
57
+ '- Keep task docs and user docs aligned with runtime behavior via `agentplane task doc set <task-id> --section <name> --text "..."`.',
58
+ "- For implementation tasks, verify generated/help surfaces after changing CLI-facing text.",
120
59
  ],
121
60
  },
122
61
  {
123
62
  role: "REVIEWER",
124
63
  lines: [
125
- "- Review artifacts: `agentplane pr check <task-id>` / `agentplane task show <task-id>`",
126
- '- Handoff notes: `agentplane pr note <task-id> --author REVIEWER --body "..."`',
64
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
65
+ "- Review artifacts with `agentplane task show <task-id>` and `agentplane pr check <task-id>` when relevant.",
66
+ "- Focus on regressions, lifecycle drift, and missing verification evidence.",
127
67
  ],
128
68
  },
129
69
  {
130
70
  role: "INTEGRATOR",
131
71
  lines: [
132
- '- branch_pr: `agentplane pr check <task-id>` -> `agentplane integrate <task-id> --branch task/<task-id>/<slug> --merge-strategy squash --run-verify` -> `agentplane finish <task-id> --commit <git-rev> --author INTEGRATOR --body "Verified: ..." --close-commit`',
133
- '- direct: task owner uses `agentplane finish <task-id> --commit <git-rev> --author <OWNER> --body "Verified: ..." --close-commit` after the implementation commit',
134
- "- Optional cleanup: `agentplane cleanup merged --yes`",
72
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
73
+ '- branch_pr: `agentplane pr check <task-id>` -> `agentplane integrate <task-id> --branch task/<task-id>/<slug> --merge-strategy squash --run-verify` -> `agentplane finish <task-id> --commit <git-rev> --author INTEGRATOR --body "Verified: ..." --result "..." --close-commit`.',
74
+ `- direct: the task owner normally closes with \`${COMMAND_SNIPPETS.core.finishTask}\` plus \`--result "..." \`.`,
135
75
  ],
136
76
  },
137
77
  {
138
78
  role: "CREATOR",
139
79
  lines: [
140
- '- Task bookkeeping: `agentplane task update <task-id> ...` / `agentplane start <task-id> --author CREATOR --body "Start: ..."`',
141
- '- Commits: `agentplane guard commit <task-id> -m "<emoji> <suffix> <scope>: <summary>"` / `agentplane commit <task-id> -m "<emoji> <suffix> <scope>: <summary>" --allow <path-prefix>`',
80
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
81
+ `- Use \`${COMMAND_SNIPPETS.core.startTask}\` only when the new-agent creation task is approved and ready.`,
82
+ "- Keep commits scoped to the created agent artifacts and task docs.",
142
83
  ],
143
84
  },
144
85
  {
145
86
  role: "REDMINE",
146
87
  lines: [
147
- `- Sync before/after updates: \`${COMMAND_SNIPPETS.sync.pullRedmineExplicit}\` / \`${COMMAND_SNIPPETS.sync.pushRedmineExplicitWithYes}\``,
148
- "- Then use normal task/doc commands (`agentplane task list` / `agentplane task show` / `agentplane task update` / `agentplane task doc set`) as needed.",
88
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
89
+ `- Sync explicitly with \`${COMMAND_SNIPPETS.sync.pullRedmineExplicit}\` / \`${COMMAND_SNIPPETS.sync.pushRedmineExplicitWithYes}\`.`,
90
+ "- After sync, follow the same task/bootstrap lifecycle as local backends.",
149
91
  ],
150
92
  },
151
93
  {
152
94
  role: "UPDATER",
153
95
  lines: [
154
- '- Read-only audit: `agentplane task list` / `agentplane task show` / `agentplane task search "..."` / `agentplane task next` (no write commands).',
96
+ `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
97
+ "- Read-only role: inspect state, do not mutate task or workflow artifacts.",
155
98
  ],
156
99
  },
157
100
  ];
158
- function renderCheatSheet(rows) {
159
- const lines = ["Operation | Command", "--- | ---"];
160
- for (const row of rows) {
161
- lines.push(`${row.operation} | ${row.command}`);
162
- }
163
- return lines;
164
- }
165
- function renderRoleSection() {
166
- const lines = [];
167
- for (const guide of ROLE_GUIDES) {
168
- lines.push(`### ${guide.role}`, ...guide.lines, "");
169
- }
170
- if (lines.at(-1) === "")
171
- lines.pop();
172
- return lines;
173
- }
174
101
  export function listRoles() {
175
102
  return ROLE_GUIDES.map((guide) => guide.role);
176
103
  }
@@ -188,82 +115,30 @@ export function renderQuickstart() {
188
115
  return [
189
116
  "# agentplane quickstart",
190
117
  "",
191
- "AGENTS.md is the source of truth for the workflow/process policy; quickstart and role output are the source of truth for CLI syntax and artifacts.",
118
+ "The policy gateway file (AGENTS.md or CLAUDE.md) is the source of truth for workflow/process policy. CLI syntax lives in quickstart and `agentplane role <ROLE>`.",
192
119
  "Do not edit `.agentplane/tasks.json` by hand.",
120
+ "If the repository is not initialized yet, stop and run `agentplane init` first.",
193
121
  "",
194
- "- See AGENTS.md for the canonical workflow policy and approval gates.",
195
- "",
196
- "## Project setup",
122
+ renderBootstrapReferenceLine(),
197
123
  "",
198
- "- `agentplane init` (bootstrap `.agentplane/`)",
199
- "- `agentplane config show` / `agentplane config set <key> <value>`",
200
- "- `agentplane mode get` / `agentplane mode set <direct|branch_pr>`",
201
- "- `agentplane ide sync` (regenerate IDE entrypoints)",
124
+ ...renderBootstrapOverview(),
202
125
  "",
203
- "## Daily task workflow",
126
+ "## Role-specific deltas",
204
127
  "",
205
- `- \`${COMMAND_SNIPPETS.core.taskList}\` / \`${COMMAND_SNIPPETS.core.taskShow}\``,
206
- `- \`${COMMAND_SNIPPETS.core.taskNew}\``,
207
- `- \`${COMMAND_SNIPPETS.core.startTask}\``,
208
- `- \`${COMMAND_SNIPPETS.core.verifyTask}\``,
209
- `- \`${COMMAND_SNIPPETS.core.finishTask}\``,
128
+ `- Use \`${COMMAND_SNIPPETS.core.role}\` for role-specific constraints after you understand the shared bootstrap path.`,
129
+ "- Role output should add deltas, not replace the canonical bootstrap flow.",
210
130
  "",
211
- "## Harness engeneering loop",
212
- "",
213
- "- Constrain: policy + workflow contract first.",
214
- "- Execute: small explicit transitions.",
215
- "- Observe: structured artifacts and diagnostics.",
216
- "- Recover: deterministic fallback before manual repair.",
217
- "",
218
- "## Branch workflow (branch_pr)",
131
+ "## Branch workflow extras",
219
132
  "",
220
133
  "- `agentplane work start <task-id> --agent <ROLE> --slug <slug> --worktree`",
221
134
  "- `agentplane pr open <task-id>` / `agentplane pr update <task-id>` / `agentplane pr check <task-id>`",
222
135
  "- `agentplane integrate <task-id> --branch task/<task-id>/<slug> --run-verify`",
223
136
  "",
224
- "## Workflow operations (core)",
225
- "- `agentplane workflow debug`",
226
- "- `agentplane workflow sync`",
227
- "- `agentplane workflow land`",
228
- "",
229
- "## Recipes and scenarios (extensions)",
230
- "",
231
- "- `agentplane recipes list`",
232
- "- `agentplane recipes list --tag <tag>`",
233
- "- `agentplane recipes explain <id>`",
234
- "- `agentplane scenario list`",
235
- "- `agentplane scenario run <recipe:scenario>`",
236
- "",
237
137
  "## More guidance",
238
138
  "",
239
- `- \`${COMMAND_SNIPPETS.core.quickstart}\` and \`${COMMAND_SNIPPETS.core.role}\` show command guidance.`,
240
- "",
241
- "## Agent cheat sheet",
242
- "",
243
- ...renderCheatSheet(CHEAT_SHEET_ROWS),
244
- "",
245
- "## Config management",
246
- "",
247
- "- Show the current config: `agentplane config show`",
248
- "- Set a value by dotted key: `agentplane config set workflow_mode branch_pr`",
249
- '- Set JSON values (lists/objects): `agentplane config set tasks.verify.require_steps_for_primary \'["code","data","ops"]\'`',
250
- "",
251
- "## Role/phase command guide (when to use what)",
252
- "",
253
- "Use `agentplane role <ROLE>` to print a single block from this section.",
254
- "",
255
- ...renderRoleSection(),
256
- "",
257
- "## Global flags",
258
- "",
259
- "- `--root <path>`: treat <path> as project root",
260
- "- `--json-errors`: emit JSON-formatted errors",
261
- "- `--help` / `-h`: show help",
262
- "- `--version`: show version",
263
- "- `--no-update-check`: skip checking npm for a newer CLI version",
264
- "",
265
- "Notes:",
266
- "- `.env` at the repo root is loaded automatically (without overwriting existing environment variables).",
139
+ "- `agentplane help <command>` for command-level flags and examples.",
140
+ `- \`${COMMAND_SNIPPETS.core.role}\` for role-specific deltas.`,
141
+ `- \`${AGENT_BOOTSTRAP_DOC_PATH}\` for the canonical startup path in repository docs.`,
267
142
  "",
268
143
  "## Commit message format",
269
144
  "",
@@ -2,10 +2,10 @@ export declare const COMMAND_SNIPPETS: {
2
2
  readonly core: {
3
3
  readonly taskList: "agentplane task list";
4
4
  readonly taskShow: "agentplane task show <task-id>";
5
- readonly taskNew: "agentplane task new --title \"...\" --description \"...\" --priority med --owner CODER --tag <tag>";
6
- readonly startTask: "agentplane start <task-id> --author <ROLE> --body \"Start: ...\"";
5
+ readonly taskNew: "agentplane task new --title \"...\" --description \"...\" --priority med --owner <ROLE> --tag <tag>";
6
+ readonly startTask: "agentplane task start-ready <task-id> --author <ROLE> --body \"Start: ...\"";
7
7
  readonly verifyTask: "agentplane verify <task-id> --ok|--rework --by <ROLE> --note \"...\"";
8
- readonly finishTask: "agentplane finish <task-id> --author <ROLE> --body \"Verified: ...\" --commit <git-rev> --close-commit";
8
+ readonly finishTask: "agentplane finish <task-id> --author <ROLE> --body \"Verified: ...\" --commit <git-rev>";
9
9
  readonly quickstart: "agentplane quickstart";
10
10
  readonly role: "agentplane role <ROLE>";
11
11
  };
@@ -2,10 +2,10 @@ export const COMMAND_SNIPPETS = {
2
2
  core: {
3
3
  taskList: "agentplane task list",
4
4
  taskShow: "agentplane task show <task-id>",
5
- taskNew: 'agentplane task new --title "..." --description "..." --priority med --owner CODER --tag <tag>',
6
- startTask: 'agentplane start <task-id> --author <ROLE> --body "Start: ..."',
5
+ taskNew: 'agentplane task new --title "..." --description "..." --priority med --owner <ROLE> --tag <tag>',
6
+ startTask: 'agentplane task start-ready <task-id> --author <ROLE> --body "Start: ..."',
7
7
  verifyTask: 'agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."',
8
- finishTask: 'agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --commit <git-rev> --close-commit',
8
+ finishTask: 'agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --commit <git-rev>',
9
9
  quickstart: "agentplane quickstart",
10
10
  role: "agentplane role <ROLE>",
11
11
  },
@@ -15,7 +15,7 @@ import { wrapCommand } from "./wrap-command.js";
15
15
  export const quickstartSpec = {
16
16
  id: ["quickstart"],
17
17
  group: "Core",
18
- summary: "Print CLI quickstart and command cheat sheet.",
18
+ summary: "Print the canonical agent bootstrap path and startup guidance.",
19
19
  options: [
20
20
  {
21
21
  kind: "boolean",
@@ -37,7 +37,7 @@ async function cmdQuickstart(opts) {
37
37
  .filter((line) => line.length > 0);
38
38
  const payload = {
39
39
  source_of_truth: {
40
- workflow_policy: "AGENTS.md",
40
+ workflow_policy: "AGENTS.md|CLAUDE.md",
41
41
  cli_syntax: "quickstart/role output",
42
42
  },
43
43
  lines,
@@ -437,7 +437,7 @@ function renderAgentProfileBlock(opts) {
437
437
  ...(permissions.length > 0 ? ["", "Permissions:", ...permissions.map((s) => `- ${s}`)] : []),
438
438
  ...(workflow.length > 0 ? ["", "Workflow:", ...workflow.map((s) => `- ${s}`)] : []),
439
439
  "",
440
- `Source: .agentplane/agents/${opts.filename} (lower priority; see AGENTS.md)`,
440
+ `Source: .agentplane/agents/${opts.filename} (lower priority; see policy gateway file AGENTS.md or CLAUDE.md)`,
441
441
  ];
442
442
  return lines.join("\n").trimEnd();
443
443
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ide.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/ide.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,KAAK,aAAa,GAAG;IAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;CAAE,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CAkBlD,CAAC;AAEF,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClB;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAElF"}
1
+ {"version":3,"file":"ide.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/ide.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,KAAK,aAAa,GAAG;IAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;CAAE,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CAkBlD,CAAC;AAEF,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CA4ClB;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAElF"}
@@ -1,11 +1,12 @@
1
1
  import { mkdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { writeTextIfChanged } from "../../../shared/write-if-changed.js";
4
+ import { resolvePolicyGatewayForRepo } from "../../../shared/policy-gateway.js";
4
5
  import { wrapCommand } from "./wrap-command.js";
5
6
  export const ideSyncSpec = {
6
7
  id: ["ide", "sync"],
7
8
  group: "IDE",
8
- summary: "Generate IDE entrypoints from AGENTS.md.",
9
+ summary: "Generate IDE entrypoints from policy gateway file (AGENTS.md or CLAUDE.md).",
9
10
  options: [
10
11
  {
11
12
  kind: "string",
@@ -24,13 +25,17 @@ export const ideSyncSpec = {
24
25
  export async function cmdIdeSync(opts) {
25
26
  return wrapCommand({ command: "ide sync", rootOverride: opts.rootOverride }, async () => {
26
27
  const resolved = await opts.deps.getResolvedProject("ide sync");
27
- const agentsPath = path.join(resolved.gitRoot, "AGENTS.md");
28
+ const gateway = await resolvePolicyGatewayForRepo({
29
+ gitRoot: resolved.gitRoot,
30
+ fallbackFlavor: "codex",
31
+ });
32
+ const agentsPath = gateway.absPath;
28
33
  const agentsText = await readFile(agentsPath, "utf8");
29
34
  const header = [
30
35
  "<!--",
31
36
  " AUTOGENERATED by agentplane ide sync.",
32
37
  " DO NOT EDIT MANUALLY.",
33
- " Source: AGENTS.md",
38
+ ` Source: ${gateway.fileName}`,
34
39
  "-->",
35
40
  "",
36
41
  ].join("\n");
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/ui.ts"],"names":[],"mappings":"AAyBA,wBAAgB,iBAAiB,IAAI,MAAM,CAY1C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAG5E"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/ui.ts"],"names":[],"mappings":"AAyBA,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAG5E"}
@@ -26,12 +26,11 @@ export function renderInitWelcome() {
26
26
  "░█▀█░█░█░█▀▀░█░█░░█░░▄▀░░█▀▀░█░░░█▀█░█░█░█▀▀",
27
27
  "░▀░▀░▀▀▀░▀▀▀░▀░▀░░▀░░▀░░░▀░░░▀▀▀░▀░▀░▀░▀░▀▀▀",
28
28
  ].map((line) => color(line, "36"));
29
- const subtitle = color("agent/plane", "36");
30
29
  const intro = [
31
30
  color("Bootstrap an agent-first workflow in this repository.", "1"),
32
31
  "This interactive setup runs once; daily work is executed by agents.",
33
32
  ];
34
- return `${logo.join("\n")}\n${subtitle}\n\n${box(intro)}\n\n`;
33
+ return `${logo.join("\n")}\n\n${box(intro)}\n\n`;
35
34
  }
36
35
  export function renderInitSection(title, description) {
37
36
  const header = color(`[${title}]`, "33");
@@ -1,8 +1,10 @@
1
1
  import type { WorkflowMode } from "../../../../agents/agents-template.js";
2
+ import { type PolicyGatewayFlavor } from "../../../../shared/policy-gateway.js";
2
3
  export declare function ensureAgentsFiles(opts: {
3
4
  gitRoot: string;
4
5
  agentplaneDir: string;
5
6
  workflow: WorkflowMode;
7
+ policyGateway: PolicyGatewayFlavor;
6
8
  configPathAbs: string;
7
9
  backendPathAbs: string;
8
10
  }): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"write-agents.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-agents.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAkC1E,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAuCtC"}
1
+ {"version":3,"file":"write-agents.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-agents.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAQ1E,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,sCAAsC,CAAC;AA6B9C,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,mBAAmB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwDtC"}