agentplane 0.3.3 → 0.3.4

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.
@@ -1,5 +1,6 @@
1
1
  import { COMMAND_SNIPPETS } from "./command-snippets.js";
2
2
  export const AGENT_BOOTSTRAP_DOC_PATH = "docs/user/agent-bootstrap.generated.mdx";
3
+ export const AGENT_BOOTSTRAP_RUNTIME_SURFACE = "agentplane quickstart";
3
4
  export const BOOTSTRAP_PREFLIGHT_COMMANDS = [
4
5
  "agentplane config show",
5
6
  "agentplane quickstart",
@@ -58,7 +59,7 @@ export const BOOTSTRAP_SECTIONS = [
58
59
  },
59
60
  ];
60
61
  export function renderBootstrapReferenceLine() {
61
- return `Canonical bootstrap doc: \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`;
62
+ return `Canonical installed startup surface: \`${AGENT_BOOTSTRAP_RUNTIME_SURFACE}\`.`;
62
63
  }
63
64
  export function renderBootstrapSectionLines(sections) {
64
65
  const lines = [];
@@ -91,7 +92,7 @@ export function renderBootstrapDoc() {
91
92
  "",
92
93
  "This page is generated from `packages/agentplane/src/cli/bootstrap-guide.ts`.",
93
94
  "",
94
- "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.",
95
+ "This is the docs-site rendering of the CLI bootstrap model. Installed repositories should rely on `agentplane quickstart` and `agentplane role <ROLE>` instead of requiring this file to exist locally.",
95
96
  "",
96
97
  "## Copy-paste start block",
97
98
  "",
@@ -1,4 +1,17 @@
1
+ export type RoleProfileGuide = {
2
+ filename?: string;
3
+ id?: string;
4
+ role?: string;
5
+ description?: string;
6
+ inputs?: readonly string[];
7
+ outputs?: readonly string[];
8
+ permissions?: readonly string[];
9
+ workflow?: readonly string[];
10
+ };
1
11
  export declare function listRoles(): string[];
2
- export declare function renderRole(roleRaw: string): string | null;
12
+ export declare function getRoleSupplementLines(roleRaw: string): string[] | null;
13
+ export declare function renderRole(roleRaw: string, opts?: {
14
+ profile?: RoleProfileGuide | null;
15
+ }): string | null;
3
16
  export declare function renderQuickstart(): string;
4
17
  //# sourceMappingURL=command-guide.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-guide.d.ts","sourceRoot":"","sources":["../../src/cli/command-guide.ts"],"names":[],"mappings":"AA4GA,wBAAgB,SAAS,IAAI,MAAM,EAAE,CAEpC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOzD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAoCzC"}
1
+ {"version":3,"file":"command-guide.d.ts","sourceRoot":"","sources":["../../src/cli/command-guide.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B,CAAC;AAkGF,wBAAgB,SAAS,IAAI,MAAM,EAAE,CAEpC;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAMvE;AAMD,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAAO,GAC/C,MAAM,GAAG,IAAI,CA6Bf;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAoCzC"}
@@ -1,6 +1,6 @@
1
1
  import { COMMAND_SNIPPETS } from "./command-snippets.js";
2
- import { AGENT_BOOTSTRAP_DOC_PATH, BOOTSTRAP_PREFLIGHT_COMMANDS, BOOTSTRAP_TASK_PREP_COMMANDS, } from "./bootstrap-guide.js";
3
- const CLI_REFERENCE_DOC_PATH = "docs/user/cli-reference.generated.mdx";
2
+ import { BOOTSTRAP_PREFLIGHT_COMMANDS, BOOTSTRAP_TASK_PREP_COMMANDS } from "./bootstrap-guide.js";
3
+ const SHARED_STARTUP_NOTE = `- Shared startup path: \`${COMMAND_SNIPPETS.core.quickstart}\` is the canonical installed bootstrap; use \`${COMMAND_SNIPPETS.core.role}\` only for role-specific deltas.`;
4
4
  function renderQuickstartCommandBlock(commands) {
5
5
  return ["```bash", ...commands, "```"];
6
6
  }
@@ -8,7 +8,7 @@ const ROLE_GUIDES = [
8
8
  {
9
9
  role: "ORCHESTRATOR",
10
10
  lines: [
11
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
11
+ SHARED_STARTUP_NOTE,
12
12
  "- Owns preflight, plan summaries, approvals, and scope checkpoints.",
13
13
  "- Does not create non-executable tasks or bypass lifecycle guardrails.",
14
14
  ],
@@ -16,7 +16,7 @@ const ROLE_GUIDES = [
16
16
  {
17
17
  role: "PLANNER",
18
18
  lines: [
19
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
19
+ SHARED_STARTUP_NOTE,
20
20
  '- Create executable tasks with `agentplane task new --title "..." --description "..." --priority med --owner <ROLE> --tag <tag>`.',
21
21
  '- 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>`.',
22
22
  "- Approve plan only after required sections and Verify Steps are ready.",
@@ -25,7 +25,7 @@ const ROLE_GUIDES = [
25
25
  {
26
26
  role: "CODER",
27
27
  lines: [
28
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
28
+ SHARED_STARTUP_NOTE,
29
29
  "- direct: stay in the current checkout; branch_pr: start a task branch/worktree first.",
30
30
  `- Start deterministically with \`${COMMAND_SNIPPETS.core.startTask}\` after plan approval.`,
31
31
  '- Treat `agentplane task verify-show <task-id>` as the verification contract, then record `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`.',
@@ -36,7 +36,7 @@ const ROLE_GUIDES = [
36
36
  {
37
37
  role: "TESTER",
38
38
  lines: [
39
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
39
+ SHARED_STARTUP_NOTE,
40
40
  "- Start only after plan approval and explicit Verify Steps exist.",
41
41
  '- Use `agentplane task verify-show <task-id>` before running checks, then record `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`.',
42
42
  `- In direct mode, close with \`${COMMAND_SNIPPETS.core.finishTask}\` plus \`--result "..." \` when you own final verification.`,
@@ -46,16 +46,16 @@ const ROLE_GUIDES = [
46
46
  {
47
47
  role: "DOCS",
48
48
  lines: [
49
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
49
+ SHARED_STARTUP_NOTE,
50
50
  '- Keep task docs and user docs aligned with runtime behavior via `agentplane task doc set <task-id> --section <name> --text "..."`.',
51
51
  "- For implementation tasks, verify generated/help surfaces after changing CLI-facing text.",
52
- `- Treat \`${CLI_REFERENCE_DOC_PATH}\` as the deep reference surface; keep first-screen help intentionally shorter.`,
52
+ "- The docs site may expand CLI behavior, but installed runtime guidance must stay self-contained and must not depend on repo-only docs paths.",
53
53
  ],
54
54
  },
55
55
  {
56
56
  role: "REVIEWER",
57
57
  lines: [
58
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
58
+ SHARED_STARTUP_NOTE,
59
59
  "- Review artifacts with `agentplane task show <task-id>` and `agentplane pr check <task-id>` when relevant.",
60
60
  "- Focus on regressions, lifecycle drift, and missing verification evidence.",
61
61
  ],
@@ -63,7 +63,7 @@ const ROLE_GUIDES = [
63
63
  {
64
64
  role: "INTEGRATOR",
65
65
  lines: [
66
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
66
+ SHARED_STARTUP_NOTE,
67
67
  '- 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`.',
68
68
  `- direct: the task owner normally closes with \`${COMMAND_SNIPPETS.core.finishTask}\` plus \`--result "..." \`.`,
69
69
  "- For branch-level flags and branch/base diagnostics, use `agentplane help work start`, `agentplane help integrate`, and `agentplane help branch base`.",
@@ -72,7 +72,7 @@ const ROLE_GUIDES = [
72
72
  {
73
73
  role: "CREATOR",
74
74
  lines: [
75
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
75
+ SHARED_STARTUP_NOTE,
76
76
  `- Use \`${COMMAND_SNIPPETS.core.startTask}\` only when the new-agent creation task is approved and ready.`,
77
77
  "- Keep commits scoped to the created agent artifacts and task docs.",
78
78
  ],
@@ -80,7 +80,7 @@ const ROLE_GUIDES = [
80
80
  {
81
81
  role: "REDMINE",
82
82
  lines: [
83
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
83
+ SHARED_STARTUP_NOTE,
84
84
  `- Sync explicitly with \`${COMMAND_SNIPPETS.sync.pullRedmineExplicit}\` / \`${COMMAND_SNIPPETS.sync.pushRedmineExplicitWithYes}\`.`,
85
85
  "- After sync, follow the same task/bootstrap lifecycle as local backends.",
86
86
  ],
@@ -88,7 +88,7 @@ const ROLE_GUIDES = [
88
88
  {
89
89
  role: "UPDATER",
90
90
  lines: [
91
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
91
+ SHARED_STARTUP_NOTE,
92
92
  "- Read-only role: inspect state, do not mutate task or workflow artifacts.",
93
93
  ],
94
94
  },
@@ -96,15 +96,46 @@ const ROLE_GUIDES = [
96
96
  export function listRoles() {
97
97
  return ROLE_GUIDES.map((guide) => guide.role);
98
98
  }
99
- export function renderRole(roleRaw) {
99
+ export function getRoleSupplementLines(roleRaw) {
100
100
  const trimmed = roleRaw.trim();
101
101
  if (!trimmed)
102
102
  return null;
103
103
  const normalized = trimmed.toUpperCase();
104
104
  const guide = ROLE_GUIDES.find((entry) => entry.role.toUpperCase() === normalized);
105
- if (!guide)
105
+ return guide ? guide.lines : null;
106
+ }
107
+ function renderRoleList(title, items) {
108
+ return items && items.length > 0 ? ["", `${title}:`, ...items.map((item) => `- ${item}`)] : [];
109
+ }
110
+ export function renderRole(roleRaw, opts = {}) {
111
+ const trimmed = roleRaw.trim();
112
+ if (!trimmed)
113
+ return null;
114
+ const normalized = trimmed.toUpperCase();
115
+ const supplementLines = getRoleSupplementLines(normalized);
116
+ const profile = opts.profile ?? null;
117
+ if (!supplementLines && !profile)
106
118
  return null;
107
- return [`### ${guide.role}`, ...guide.lines].join("\n").trimEnd();
119
+ const heading = (typeof profile?.id === "string" && profile.id.trim()) || normalized;
120
+ const role = typeof profile?.role === "string" ? profile.role.trim() : "";
121
+ const description = typeof profile?.description === "string" ? profile.description.trim() : "";
122
+ const lines = [
123
+ `### ${heading}`,
124
+ ...(role ? [`Role: ${role}`] : []),
125
+ ...(description ? [`Description: ${description}`] : []),
126
+ ...renderRoleList("Inputs", profile?.inputs),
127
+ ...renderRoleList("Outputs", profile?.outputs),
128
+ ...renderRoleList("Permissions", profile?.permissions),
129
+ ...renderRoleList("Workflow", profile?.workflow),
130
+ ...(supplementLines ? ["", "CLI/runtime notes:", ...supplementLines] : []),
131
+ ...(profile?.filename
132
+ ? [
133
+ "",
134
+ `Source: .agentplane/agents/${profile.filename} (role-specific content); policy gateway files still have higher priority.`,
135
+ ]
136
+ : []),
137
+ ];
138
+ return lines.join("\n").trimEnd();
108
139
  }
109
140
  export function renderQuickstart() {
110
141
  return [
@@ -115,7 +146,7 @@ export function renderQuickstart() {
115
146
  "Do not edit `.agentplane/tasks.json` by hand.",
116
147
  "If the repository is not initialized yet, stop and run `agentplane init` first.",
117
148
  "",
118
- `Canonical bootstrap doc: \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
149
+ `Canonical installed startup surface: \`${COMMAND_SNIPPETS.core.quickstart}\`.`,
119
150
  "",
120
151
  "## First screen",
121
152
  "",
@@ -133,8 +164,8 @@ export function renderQuickstart() {
133
164
  "",
134
165
  `- \`${COMMAND_SNIPPETS.core.role}\` for role-specific deltas and mode-specific ownership rules.`,
135
166
  "- `agentplane help <command>` for flags, examples, and exceptional/manual flows.",
136
- `- \`${AGENT_BOOTSTRAP_DOC_PATH}\` for the full startup path instead of repeating it on the first screen.`,
137
- `- \`${CLI_REFERENCE_DOC_PATH}\` for the generated full command reference.`,
167
+ "- Keep installed runtime guidance self-contained; do not depend on repo-only docs files.",
168
+ "- If you need the docs site, treat it as a public reference surface rather than a required local file.",
138
169
  "",
139
170
  "## Non-default",
140
171
  "",
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/core.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIrD,KAAK,gBAAgB,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1C,eAAO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;AAEF,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AACtC,KAAK,eAAe,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAkP9D,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAuCtD,CAAC;AAiDF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,eAAe,CAExD,CAAC;AAEF,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAElD,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CAe5C,CAAC;AA4OF,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,UAAU,CAE9C,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CAMhD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,YAAY,CAAC,CA0FhF"}
@@ -8,7 +8,7 @@ import { fileExists } from "../../fs-utils.js";
8
8
  import { CliError } from "../../../shared/errors.js";
9
9
  import { dedupeStrings } from "../../../shared/strings.js";
10
10
  import { usageError } from "../../spec/errors.js";
11
- import { listRoles, renderQuickstart, renderRole } from "../../command-guide.js";
11
+ import { getRoleSupplementLines, listRoles, renderQuickstart, renderRole, } from "../../command-guide.js";
12
12
  import { isWorkflowEnforcementDisabled, validateWorkflowAtPath, workflowEnforcementEnvHint, } from "../../../workflow-runtime/index.js";
13
13
  import { toStringList } from "../../spec/parse-utils.js";
14
14
  import { wrapCommand } from "./wrap-command.js";
@@ -420,7 +420,7 @@ async function readAgentProfile(opts) {
420
420
  const raw = parseAgentProfileJson(filePath, await readFile(filePath, "utf8"));
421
421
  return { agentplaneDir: listing.agentplaneDir, filename, profile: raw };
422
422
  }
423
- function renderAgentProfileBlock(opts) {
423
+ function toRoleProfileGuide(opts) {
424
424
  const id = (typeof opts.profile.id === "string" ? opts.profile.id : "").trim() || opts.roleId;
425
425
  const role = (typeof opts.profile.role === "string" ? opts.profile.role : "").trim();
426
426
  const description = (typeof opts.profile.description === "string" ? opts.profile.description : "").trim();
@@ -428,18 +428,16 @@ function renderAgentProfileBlock(opts) {
428
428
  const outputs = toStringList(opts.profile.outputs);
429
429
  const permissions = toStringList(opts.profile.permissions);
430
430
  const workflow = toStringList(opts.profile.workflow);
431
- const lines = [
432
- `### ${id}`,
433
- ...(role ? [`Role: ${role}`] : []),
434
- ...(description ? [`Description: ${description}`] : []),
435
- ...(inputs.length > 0 ? ["", "Inputs:", ...inputs.map((s) => `- ${s}`)] : []),
436
- ...(outputs.length > 0 ? ["", "Outputs:", ...outputs.map((s) => `- ${s}`)] : []),
437
- ...(permissions.length > 0 ? ["", "Permissions:", ...permissions.map((s) => `- ${s}`)] : []),
438
- ...(workflow.length > 0 ? ["", "Workflow:", ...workflow.map((s) => `- ${s}`)] : []),
439
- "",
440
- `Source: .agentplane/agents/${opts.filename} (lower priority; see policy gateway file AGENTS.md or CLAUDE.md)`,
441
- ];
442
- return lines.join("\n").trimEnd();
431
+ return {
432
+ filename: opts.filename,
433
+ id,
434
+ role,
435
+ description,
436
+ inputs,
437
+ outputs,
438
+ permissions,
439
+ workflow,
440
+ };
443
441
  }
444
442
  async function cmdRole(opts) {
445
443
  return wrapCommand({ command: "role", rootOverride: opts.rootOverride }, async () => {
@@ -452,12 +450,19 @@ async function cmdRole(opts) {
452
450
  });
453
451
  }
454
452
  const normalizedRole = normalizeRoleId(roleRaw);
455
- const guide = renderRole(normalizedRole);
456
453
  const agentProfile = await readAgentProfile({
457
454
  cwd: opts.cwd,
458
455
  rootOverride: opts.rootOverride,
459
456
  roleId: normalizedRole,
460
457
  });
458
+ const normalizedProfile = agentProfile
459
+ ? toRoleProfileGuide({
460
+ filename: agentProfile.filename,
461
+ roleId: normalizedRole,
462
+ profile: agentProfile.profile,
463
+ })
464
+ : null;
465
+ const guide = renderRole(normalizedRole, { profile: normalizedProfile });
461
466
  if (!guide && !agentProfile) {
462
467
  const builtin = listRoles();
463
468
  const agentIds = await listAgentProfileIds({
@@ -477,11 +482,15 @@ async function cmdRole(opts) {
477
482
  if (opts.json) {
478
483
  const payload = {
479
484
  role: normalizedRole,
480
- builtin_guide: guide
485
+ guide: guide
481
486
  .split("\n")
482
487
  .map((line) => line.trim())
483
488
  .filter((line) => line.length > 0),
484
489
  };
490
+ const supplementLines = getRoleSupplementLines(normalizedRole);
491
+ if (supplementLines) {
492
+ payload.builtin_guide = supplementLines;
493
+ }
485
494
  if (agentProfile) {
486
495
  payload.agent_profile = {
487
496
  filename: agentProfile.filename,
@@ -492,14 +501,6 @@ async function cmdRole(opts) {
492
501
  return 0;
493
502
  }
494
503
  process.stdout.write(`${guide}\n`);
495
- if (agentProfile) {
496
- const block = renderAgentProfileBlock({
497
- filename: agentProfile.filename,
498
- roleId: normalizedRole,
499
- profile: agentProfile.profile,
500
- });
501
- process.stdout.write(`\n## Agent profile\n\n${block}\n`);
502
- }
503
504
  return 0;
504
505
  }
505
506
  if (!agentProfile) {
@@ -510,14 +511,21 @@ async function cmdRole(opts) {
510
511
  message: `Unknown role: ${roleRaw}.`,
511
512
  });
512
513
  }
513
- const block = renderAgentProfileBlock({
514
- filename: agentProfile.filename,
515
- roleId: normalizedRole,
516
- profile: agentProfile.profile,
517
- });
514
+ const block = renderRole(normalizedRole, { profile: normalizedProfile });
515
+ if (!block) {
516
+ throw usageError({
517
+ spec: roleSpec,
518
+ command: "role",
519
+ message: `Unknown role: ${roleRaw}.`,
520
+ });
521
+ }
518
522
  if (opts.json) {
519
523
  process.stdout.write(`${JSON.stringify({
520
524
  role: normalizedRole,
525
+ guide: block
526
+ .split("\n")
527
+ .map((line) => line.trim())
528
+ .filter((line) => line.length > 0),
521
529
  agent_profile: {
522
530
  filename: agentProfile.filename,
523
531
  profile: agentProfile.profile,
@@ -1 +1 @@
1
- {"version":3,"file":"write-workflow.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-workflow.ts"],"names":[],"mappings":"AASA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,GAAG,WAAW,CAAC;IACrC,SAAS,EAAE;QACT,mBAAmB,EAAE,OAAO,CAAC;QAC7B,qBAAqB,EAAE,OAAO,CAAC;QAC/B,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;CACH,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA2DtC"}
1
+ {"version":3,"file":"write-workflow.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-workflow.ts"],"names":[],"mappings":"AAEA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,GAAG,WAAW,CAAC;IACrC,SAAS,EAAE;QACT,mBAAmB,EAAE,OAAO,CAAC;QAC7B,qBAAqB,EAAE,OAAO,CAAC;QAC/B,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;CACH,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAOtC"}
@@ -1,58 +1,9 @@
1
- import { CliError } from "../../../../shared/errors.js";
2
- import { DEFAULT_WORKFLOW_TEMPLATE, buildWorkflowFromTemplates, diagnosticsSummary, publishWorkflowCandidate, resolveWorkflowPaths, } from "../../../../workflow-runtime/index.js";
1
+ import { ensureWorkflowArtifacts } from "../../../../shared/workflow-artifacts.js";
3
2
  export async function ensureInitWorkflow(opts) {
4
- const built = buildWorkflowFromTemplates({
5
- baseTemplate: DEFAULT_WORKFLOW_TEMPLATE,
6
- runtimeContext: {
7
- workflow: {
8
- mode: opts.workflowMode,
9
- version: 1,
10
- approvals: {
11
- require_plan: opts.approvals.requirePlanApproval,
12
- require_verify: opts.approvals.requireVerifyApproval,
13
- require_network: opts.approvals.requireNetworkApproval,
14
- },
15
- },
16
- runtime: {
17
- repo_name: opts.gitRoot.split(/[/\\\\]/).findLast((segment) => segment.length > 0) ?? "repo",
18
- repo_root: opts.gitRoot,
19
- timestamp: new Date().toISOString(),
20
- },
21
- },
3
+ const ensured = await ensureWorkflowArtifacts({
4
+ gitRoot: opts.gitRoot,
5
+ workflowMode: opts.workflowMode,
6
+ approvals: opts.approvals,
22
7
  });
23
- if (built.diagnostics.some((d) => d.severity === "ERROR")) {
24
- throw new CliError({
25
- exitCode: 3,
26
- code: "E_VALIDATION",
27
- message: `Failed to generate WORKFLOW.md: ${diagnosticsSummary(built.diagnostics)}`,
28
- context: {
29
- diagnostics: built.diagnostics.map((d) => ({
30
- severity: d.severity,
31
- code: d.code,
32
- path: d.path,
33
- message: d.message,
34
- })),
35
- },
36
- });
37
- }
38
- const published = await publishWorkflowCandidate(opts.gitRoot, built.text);
39
- if (!published.ok) {
40
- throw new CliError({
41
- exitCode: 3,
42
- code: "E_VALIDATION",
43
- message: `Failed to publish WORKFLOW.md: ${diagnosticsSummary(published.diagnostics)}`,
44
- context: {
45
- diagnostics: published.diagnostics.map((d) => ({
46
- severity: d.severity,
47
- code: d.code,
48
- path: d.path,
49
- message: d.message,
50
- })),
51
- },
52
- });
53
- }
54
- const workflowPaths = resolveWorkflowPaths(opts.gitRoot);
55
- return {
56
- installPaths: [workflowPaths.workflowPath, workflowPaths.lastKnownGoodPath],
57
- };
8
+ return { installPaths: ensured.installPaths };
58
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AA2CA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAA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AK,EAAE,YAAY,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsiBlB;AAED,OAAO,EACL,kCAAkC,EAClC,qBAAqB,EACrB,iCAAiC,GAClC,MAAM,qBAAqB,CAAC"}
@@ -10,6 +10,7 @@ import { extractArchive } from "../cli/archive.js";
10
10
  import { exitCodeForError } from "../cli/exit-codes.js";
11
11
  import { warnMessage } from "../cli/output.js";
12
12
  import { CliError } from "../shared/errors.js";
13
+ import { ensureWorkflowArtifacts } from "../shared/workflow-artifacts.js";
13
14
  import { ensureNetworkApproved } from "./shared/network-approval.js";
14
15
  import { getVersion } from "../meta/version.js";
15
16
  import { applyManagedFiles, cleanupAutoUpgradeArtifacts, createUpgradeCommit, ensureCleanTrackedTreeForUpgrade, persistUpgradeState, } from "./upgrade/apply.js";
@@ -638,8 +639,25 @@ export async function cmdUpgradeParsed(opts) {
638
639
  updates: updates.length,
639
640
  skipped: skipped.length,
640
641
  });
642
+ const orchestratorProfilePath = path.join(resolved.agentplaneDir, "agents", "ORCHESTRATOR.json");
643
+ const workflowArtifacts = (await fileExists(orchestratorProfilePath))
644
+ ? await ensureWorkflowArtifacts({
645
+ gitRoot: resolved.gitRoot,
646
+ workflowMode: loaded.config.workflow_mode,
647
+ approvals: {
648
+ requirePlanApproval: loaded.config.agents?.approvals?.require_plan ?? true,
649
+ requireVerifyApproval: loaded.config.agents?.approvals?.require_verify ?? true,
650
+ requireNetworkApproval: loaded.config.agents?.approvals?.require_network ?? true,
651
+ },
652
+ })
653
+ : { installPaths: [], commitPaths: [], changedPaths: [] };
641
654
  const commitPaths = [
642
- ...new Set([...additions, ...updates, ...(shouldMutateConfig ? [CONFIG_REL_PATH] : [])]),
655
+ ...new Set([
656
+ ...additions,
657
+ ...updates,
658
+ ...workflowArtifacts.commitPaths,
659
+ ...(shouldMutateConfig ? [CONFIG_REL_PATH] : []),
660
+ ]),
643
661
  ];
644
662
  const commit = await createUpgradeCommit({
645
663
  gitRoot: resolved.gitRoot,
@@ -653,6 +671,9 @@ export async function cmdUpgradeParsed(opts) {
653
671
  });
654
672
  await cleanupAutoUpgradeArtifacts({ upgradeStateDir, createdBackups });
655
673
  process.stdout.write(`Upgrade applied: ${additions.length} add, ${updates.length} update, ${skipped.length} unchanged\n`);
674
+ if (workflowArtifacts.changedPaths.length > 0) {
675
+ process.stdout.write(`Workflow artifacts refreshed: ${workflowArtifacts.commitPaths.join(", ")}\n`);
676
+ }
656
677
  if (commit) {
657
678
  process.stdout.write(`Upgrade commit: ${commit.hash.slice(0, 12)} ${commit.subject}\n`);
658
679
  }
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-build.command.d.ts","sourceRoot":"","sources":["../../src/commands/workflow-build.command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAWvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,mBAAmB,CAgC9D,CAAC;AAWF,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,mBAAmB,CA2EhE,CAAC"}
1
+ {"version":3,"file":"workflow-build.command.d.ts","sourceRoot":"","sources":["../../src/commands/workflow-build.command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,mBAAmB,CAgC9D,CAAC;AAWF,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,mBAAmB,CAoEhE,CAAC"}
@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { loadConfig, resolveProject } from "@agentplaneorg/core";
4
4
  import { successMessage, warnMessage } from "../cli/output.js";
5
+ import { buildWorkflowRuntimeContext } from "../shared/workflow-artifacts.js";
5
6
  import { DEFAULT_WORKFLOW_TEMPLATE, buildWorkflowFromTemplates, diagnosticsSummary, publishWorkflowCandidate, resolveWorkflowPaths, validateWorkflowText, } from "../workflow-runtime/index.js";
6
7
  export const workflowBuildSpec = {
7
8
  id: ["workflow", "build"],
@@ -50,22 +51,15 @@ export const runWorkflowBuild = async (ctx, flags) => {
50
51
  const configLoaded = await loadConfig(resolved.agentplaneDir);
51
52
  const workflowPaths = resolveWorkflowPaths(resolved.gitRoot);
52
53
  const configApprovals = configLoaded.config.agents?.approvals;
53
- const runtimeContext = {
54
- workflow: {
55
- mode: configLoaded.config.workflow_mode,
56
- version: 1,
57
- approvals: {
58
- require_plan: configApprovals?.require_plan ?? true,
59
- require_verify: configApprovals?.require_verify ?? true,
60
- require_network: configApprovals?.require_network ?? true,
61
- },
54
+ const runtimeContext = buildWorkflowRuntimeContext({
55
+ gitRoot: resolved.gitRoot,
56
+ workflowMode: configLoaded.config.workflow_mode,
57
+ approvals: {
58
+ requirePlanApproval: configApprovals?.require_plan ?? true,
59
+ requireVerifyApproval: configApprovals?.require_verify ?? true,
60
+ requireNetworkApproval: configApprovals?.require_network ?? true,
62
61
  },
63
- runtime: {
64
- repo_name: path.basename(resolved.gitRoot),
65
- repo_root: resolved.gitRoot,
66
- timestamp: new Date().toISOString(),
67
- },
68
- };
62
+ });
69
63
  const overrideTemplate = await maybeReadOverride(workflowPaths);
70
64
  const built = buildWorkflowFromTemplates({
71
65
  baseTemplate: DEFAULT_WORKFLOW_TEMPLATE,
@@ -0,0 +1,37 @@
1
+ export type WorkflowArtifactApprovals = {
2
+ requirePlanApproval: boolean;
3
+ requireVerifyApproval: boolean;
4
+ requireNetworkApproval: boolean;
5
+ };
6
+ export declare function buildWorkflowRuntimeContext(opts: {
7
+ gitRoot: string;
8
+ workflowMode: "direct" | "branch_pr";
9
+ approvals: WorkflowArtifactApprovals;
10
+ timestamp?: string;
11
+ }): {
12
+ workflow: {
13
+ mode: "direct" | "branch_pr";
14
+ version: number;
15
+ approvals: {
16
+ require_plan: boolean;
17
+ require_verify: boolean;
18
+ require_network: boolean;
19
+ };
20
+ };
21
+ runtime: {
22
+ repo_name: string;
23
+ repo_root: string;
24
+ timestamp: string;
25
+ };
26
+ };
27
+ export declare function ensureWorkflowArtifacts(opts: {
28
+ gitRoot: string;
29
+ workflowMode: "direct" | "branch_pr";
30
+ approvals: WorkflowArtifactApprovals;
31
+ projectOverrideTemplate?: string;
32
+ }): Promise<{
33
+ installPaths: string[];
34
+ commitPaths: string[];
35
+ changedPaths: string[];
36
+ }>;
37
+ //# sourceMappingURL=workflow-artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-artifacts.d.ts","sourceRoot":"","sources":["../../src/shared/workflow-artifacts.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,yBAAyB,GAAG;IACtC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,GAAG,WAAW,CAAC;IACrC,SAAS,EAAE,yBAAyB,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;;;;;;;;;;;;;;EAiBA;AAUD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,GAAG,WAAW,CAAC;IACrC,SAAS,EAAE,yBAAyB,CAAC;IACrC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwErF"}