agentplane 0.2.6 → 0.2.13

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 (166) hide show
  1. package/README.md +11 -0
  2. package/assets/AGENTS.md +35 -0
  3. package/assets/agents/CODER.json +0 -1
  4. package/assets/agents/INTEGRATOR.json +0 -1
  5. package/assets/agents/ORCHESTRATOR.json +1 -2
  6. package/assets/agents/PLANNER.json +1 -3
  7. package/assets/agents/TESTER.json +0 -1
  8. package/assets/agents/UPGRADER.json +17 -15
  9. package/dist/cli/archive.d.ts.map +1 -1
  10. package/dist/cli/archive.js +61 -36
  11. package/dist/cli/command-guide.d.ts.map +1 -1
  12. package/dist/cli/command-guide.js +5 -3
  13. package/dist/cli/run-cli/command-catalog.d.ts +4 -1
  14. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  15. package/dist/cli/run-cli/command-catalog.js +44 -26
  16. package/dist/cli/run-cli/commands/config.d.ts +5 -4
  17. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  18. package/dist/cli/run-cli/commands/config.js +47 -58
  19. package/dist/cli/run-cli/commands/core.d.ts +2 -1
  20. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  21. package/dist/cli/run-cli/commands/core.js +187 -51
  22. package/dist/cli/run-cli/commands/ide.d.ts +3 -1
  23. package/dist/cli/run-cli/commands/ide.d.ts.map +1 -1
  24. package/dist/cli/run-cli/commands/ide.js +7 -12
  25. package/dist/cli/run-cli/commands/init/ide-sync.d.ts.map +1 -1
  26. package/dist/cli/run-cli/commands/init/ide-sync.js +10 -1
  27. package/dist/cli/run-cli/commands/init/write-agents.d.ts.map +1 -1
  28. package/dist/cli/run-cli/commands/init/write-agents.js +4 -24
  29. package/dist/cli/run-cli/commands/init/write-gitignore.d.ts +5 -0
  30. package/dist/cli/run-cli/commands/init/write-gitignore.d.ts.map +1 -0
  31. package/dist/cli/run-cli/commands/init/write-gitignore.js +48 -0
  32. package/dist/cli/run-cli/commands/init.d.ts +1 -0
  33. package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
  34. package/dist/cli/run-cli/commands/init.js +34 -8
  35. package/dist/cli/run-cli/commands/wrap-command.d.ts +6 -0
  36. package/dist/cli/run-cli/commands/wrap-command.d.ts.map +1 -0
  37. package/dist/cli/run-cli/commands/wrap-command.js +17 -0
  38. package/dist/cli/run-cli/registry.run.d.ts +6 -2
  39. package/dist/cli/run-cli/registry.run.d.ts.map +1 -1
  40. package/dist/cli/run-cli/registry.run.js +7 -2
  41. package/dist/cli/run-cli.d.ts.map +1 -1
  42. package/dist/cli/run-cli.js +96 -75
  43. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  44. package/dist/cli/run-cli.test-helpers.js +99 -3
  45. package/dist/cli/spec/parse-utils.d.ts +11 -0
  46. package/dist/cli/spec/parse-utils.d.ts.map +1 -0
  47. package/dist/cli/spec/parse-utils.js +28 -0
  48. package/dist/commands/block.command.d.ts +3 -18
  49. package/dist/commands/block.command.d.ts.map +1 -1
  50. package/dist/commands/block.command.js +2 -143
  51. package/dist/commands/block.run.d.ts +5 -0
  52. package/dist/commands/block.run.d.ts.map +1 -0
  53. package/dist/commands/block.run.js +22 -0
  54. package/dist/commands/block.spec.d.ts +17 -0
  55. package/dist/commands/block.spec.d.ts.map +1 -0
  56. package/dist/commands/block.spec.js +115 -0
  57. package/dist/commands/doctor.command.d.ts +2 -7
  58. package/dist/commands/doctor.command.d.ts.map +1 -1
  59. package/dist/commands/doctor.command.js +2 -137
  60. package/dist/commands/doctor.run.d.ts +4 -0
  61. package/dist/commands/doctor.run.d.ts.map +1 -0
  62. package/dist/commands/doctor.run.js +174 -0
  63. package/dist/commands/doctor.spec.d.ts +7 -0
  64. package/dist/commands/doctor.spec.d.ts.map +1 -0
  65. package/dist/commands/doctor.spec.js +20 -0
  66. package/dist/commands/finish.command.d.ts +3 -27
  67. package/dist/commands/finish.command.d.ts.map +1 -1
  68. package/dist/commands/finish.command.js +2 -237
  69. package/dist/commands/finish.run.d.ts +5 -0
  70. package/dist/commands/finish.run.d.ts.map +1 -0
  71. package/dist/commands/finish.run.js +40 -0
  72. package/dist/commands/finish.spec.d.ts +26 -0
  73. package/dist/commands/finish.spec.d.ts.map +1 -0
  74. package/dist/commands/finish.spec.js +193 -0
  75. package/dist/commands/recipes/install.command.d.ts +2 -11
  76. package/dist/commands/recipes/install.command.d.ts.map +1 -1
  77. package/dist/commands/recipes/install.command.js +2 -161
  78. package/dist/commands/recipes/install.run.d.ts +4 -0
  79. package/dist/commands/recipes/install.run.d.ts.map +1 -0
  80. package/dist/commands/recipes/install.run.js +23 -0
  81. package/dist/commands/recipes/install.spec.d.ts +11 -0
  82. package/dist/commands/recipes/install.spec.d.ts.map +1 -0
  83. package/dist/commands/recipes/install.spec.js +140 -0
  84. package/dist/commands/release/apply.command.d.ts +11 -0
  85. package/dist/commands/release/apply.command.d.ts.map +1 -0
  86. package/dist/commands/release/apply.command.js +343 -0
  87. package/dist/commands/release/plan.command.d.ts +12 -0
  88. package/dist/commands/release/plan.command.d.ts.map +1 -0
  89. package/dist/commands/release/plan.command.js +206 -0
  90. package/dist/commands/release/release.command.d.ts +5 -0
  91. package/dist/commands/release/release.command.d.ts.map +1 -0
  92. package/dist/commands/release/release.command.js +18 -0
  93. package/dist/commands/shared/git-context.d.ts +3 -0
  94. package/dist/commands/shared/git-context.d.ts.map +1 -1
  95. package/dist/commands/shared/git-context.js +10 -0
  96. package/dist/commands/shared/task-backend.d.ts +1 -0
  97. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  98. package/dist/commands/start.command.d.ts +3 -18
  99. package/dist/commands/start.command.d.ts.map +1 -1
  100. package/dist/commands/start.command.js +2 -143
  101. package/dist/commands/start.run.d.ts +5 -0
  102. package/dist/commands/start.run.d.ts.map +1 -0
  103. package/dist/commands/start.run.js +22 -0
  104. package/dist/commands/start.spec.d.ts +17 -0
  105. package/dist/commands/start.spec.d.ts.map +1 -0
  106. package/dist/commands/start.spec.js +115 -0
  107. package/dist/commands/task/add.command.d.ts.map +1 -1
  108. package/dist/commands/task/add.command.js +1 -7
  109. package/dist/commands/task/derive.command.d.ts.map +1 -1
  110. package/dist/commands/task/derive.command.js +1 -7
  111. package/dist/commands/task/finish.d.ts.map +1 -1
  112. package/dist/commands/task/finish.js +34 -2
  113. package/dist/commands/task/list.command.d.ts +3 -8
  114. package/dist/commands/task/list.command.d.ts.map +1 -1
  115. package/dist/commands/task/list.command.js +2 -67
  116. package/dist/commands/task/list.run.d.ts +5 -0
  117. package/dist/commands/task/list.run.d.ts.map +1 -0
  118. package/dist/commands/task/list.run.js +10 -0
  119. package/dist/commands/task/list.spec.d.ts +7 -0
  120. package/dist/commands/task/list.spec.d.ts.map +1 -0
  121. package/dist/commands/task/list.spec.js +51 -0
  122. package/dist/commands/task/next.command.d.ts +3 -8
  123. package/dist/commands/task/next.command.d.ts.map +1 -1
  124. package/dist/commands/task/next.command.js +2 -89
  125. package/dist/commands/task/next.run.d.ts +5 -0
  126. package/dist/commands/task/next.run.d.ts.map +1 -0
  127. package/dist/commands/task/next.run.js +11 -0
  128. package/dist/commands/task/next.spec.d.ts +7 -0
  129. package/dist/commands/task/next.spec.d.ts.map +1 -0
  130. package/dist/commands/task/next.spec.js +69 -0
  131. package/dist/commands/task/search.command.d.ts +3 -10
  132. package/dist/commands/task/search.command.d.ts.map +1 -1
  133. package/dist/commands/task/search.command.js +2 -101
  134. package/dist/commands/task/search.run.d.ts +5 -0
  135. package/dist/commands/task/search.run.d.ts.map +1 -0
  136. package/dist/commands/task/search.run.js +13 -0
  137. package/dist/commands/task/search.spec.d.ts +9 -0
  138. package/dist/commands/task/search.spec.d.ts.map +1 -0
  139. package/dist/commands/task/search.spec.js +79 -0
  140. package/dist/commands/task/set-status.command.d.ts.map +1 -1
  141. package/dist/commands/task/set-status.command.js +1 -7
  142. package/dist/commands/task/shared.d.ts.map +1 -1
  143. package/dist/commands/task/shared.js +15 -8
  144. package/dist/commands/task/show.command.d.ts +3 -7
  145. package/dist/commands/task/show.command.d.ts.map +1 -1
  146. package/dist/commands/task/show.command.js +2 -19
  147. package/dist/commands/task/show.run.d.ts +5 -0
  148. package/dist/commands/task/show.run.d.ts.map +1 -0
  149. package/dist/commands/task/show.run.js +11 -0
  150. package/dist/commands/task/show.spec.d.ts +6 -0
  151. package/dist/commands/task/show.spec.d.ts.map +1 -0
  152. package/dist/commands/task/show.spec.js +8 -0
  153. package/dist/commands/task/update.command.d.ts.map +1 -1
  154. package/dist/commands/task/update.command.js +1 -7
  155. package/dist/commands/upgrade.d.ts.map +1 -1
  156. package/dist/commands/upgrade.js +171 -32
  157. package/dist/commands/verify.command.d.ts +3 -15
  158. package/dist/commands/verify.command.d.ts.map +1 -1
  159. package/dist/commands/verify.command.js +2 -113
  160. package/dist/commands/verify.run.d.ts +5 -0
  161. package/dist/commands/verify.run.d.ts.map +1 -0
  162. package/dist/commands/verify.run.js +17 -0
  163. package/dist/commands/verify.spec.d.ts +14 -0
  164. package/dist/commands/verify.spec.d.ts.map +1 -0
  165. package/dist/commands/verify.spec.js +96 -0
  166. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import path from "node:path";
2
- import { loadConfig, resolveProject, saveConfig, setByDottedKey } from "@agentplaneorg/core";
3
- import { mapCoreError } from "../../error-map.js";
2
+ import { saveConfig, setByDottedKey } from "@agentplaneorg/core";
4
3
  import { usageError } from "../../spec/errors.js";
4
+ import { wrapCommand } from "./wrap-command.js";
5
5
  export const configShowSpec = {
6
6
  id: ["config", "show"],
7
7
  group: "Config",
@@ -10,20 +10,15 @@ export const configShowSpec = {
10
10
  parse: () => ({}),
11
11
  };
12
12
  async function cmdConfigShow(opts) {
13
- try {
14
- const resolved = await resolveProject({
15
- cwd: opts.cwd,
16
- rootOverride: opts.rootOverride ?? null,
17
- });
18
- const loaded = await loadConfig(resolved.agentplaneDir);
13
+ return wrapCommand({ command: "config show", rootOverride: opts.rootOverride }, async () => {
14
+ const loaded = await opts.deps.getLoadedConfig("config show");
19
15
  process.stdout.write(`${JSON.stringify(loaded.raw, null, 2)}\n`);
20
16
  return 0;
21
- }
22
- catch (err) {
23
- throw mapCoreError(err, { command: "config show", root: opts.rootOverride ?? null });
24
- }
17
+ });
18
+ }
19
+ export function makeRunConfigShowHandler(deps) {
20
+ return (ctx) => cmdConfigShow({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, deps });
25
21
  }
26
- export const runConfigShow = (ctx) => cmdConfigShow({ cwd: ctx.cwd, rootOverride: ctx.rootOverride });
27
22
  export const configSetSpec = {
28
23
  id: ["config", "set"],
29
24
  group: "Config",
@@ -42,27 +37,29 @@ export const configSetSpec = {
42
37
  parse: (raw) => ({ key: String(raw.args.key ?? ""), value: String(raw.args.value ?? "") }),
43
38
  };
44
39
  async function cmdConfigSet(opts) {
45
- try {
46
- const resolved = await resolveProject({
47
- cwd: opts.cwd,
48
- rootOverride: opts.rootOverride ?? null,
49
- });
50
- const loaded = await loadConfig(resolved.agentplaneDir);
40
+ return wrapCommand({
41
+ command: "config set",
42
+ rootOverride: opts.rootOverride,
43
+ context: { key: opts.key },
44
+ }, async () => {
45
+ const resolved = await opts.deps.getResolvedProject("config set");
46
+ const loaded = await opts.deps.getLoadedConfig("config set");
51
47
  const raw = { ...loaded.raw };
52
48
  setByDottedKey(raw, opts.key, opts.value);
53
49
  await saveConfig(resolved.agentplaneDir, raw);
54
50
  process.stdout.write(`${path.relative(resolved.gitRoot, path.join(resolved.agentplaneDir, "config.json"))}\n`);
55
51
  return 0;
56
- }
57
- catch (err) {
58
- throw mapCoreError(err, {
59
- command: "config set",
60
- key: opts.key,
61
- root: opts.rootOverride ?? null,
62
- });
63
- }
52
+ });
53
+ }
54
+ export function makeRunConfigSetHandler(deps) {
55
+ return (ctx, p) => cmdConfigSet({
56
+ cwd: ctx.cwd,
57
+ rootOverride: ctx.rootOverride,
58
+ key: p.key,
59
+ value: p.value,
60
+ deps,
61
+ });
64
62
  }
65
- export const runConfigSet = (ctx, p) => cmdConfigSet({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, key: p.key, value: p.value });
66
63
  export const modeGetSpec = {
67
64
  id: ["mode", "get"],
68
65
  group: "Config",
@@ -71,20 +68,15 @@ export const modeGetSpec = {
71
68
  parse: () => ({}),
72
69
  };
73
70
  async function cmdModeGet(opts) {
74
- try {
75
- const resolved = await resolveProject({
76
- cwd: opts.cwd,
77
- rootOverride: opts.rootOverride ?? null,
78
- });
79
- const loaded = await loadConfig(resolved.agentplaneDir);
71
+ return wrapCommand({ command: "mode get", rootOverride: opts.rootOverride }, async () => {
72
+ const loaded = await opts.deps.getLoadedConfig("mode get");
80
73
  process.stdout.write(`${loaded.config.workflow_mode}\n`);
81
74
  return 0;
82
- }
83
- catch (err) {
84
- throw mapCoreError(err, { command: "mode get", root: opts.rootOverride ?? null });
85
- }
75
+ });
76
+ }
77
+ export function makeRunModeGetHandler(deps) {
78
+ return (ctx) => cmdModeGet({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, deps });
86
79
  }
87
- export const runModeGet = (ctx) => cmdModeGet({ cwd: ctx.cwd, rootOverride: ctx.rootOverride });
88
80
  export const modeSetSpec = {
89
81
  id: ["mode", "set"],
90
82
  group: "Config",
@@ -103,28 +95,25 @@ export const modeSetSpec = {
103
95
  },
104
96
  };
105
97
  async function cmdModeSet(opts) {
106
- try {
107
- const resolved = await resolveProject({
108
- cwd: opts.cwd,
109
- rootOverride: opts.rootOverride ?? null,
110
- });
111
- const loaded = await loadConfig(resolved.agentplaneDir);
98
+ return wrapCommand({
99
+ command: "mode set",
100
+ rootOverride: opts.rootOverride,
101
+ context: { mode: opts.mode },
102
+ }, async () => {
103
+ const resolved = await opts.deps.getResolvedProject("mode set");
104
+ const loaded = await opts.deps.getLoadedConfig("mode set");
112
105
  const raw = { ...loaded.raw };
113
106
  setByDottedKey(raw, "workflow_mode", opts.mode);
114
107
  await saveConfig(resolved.agentplaneDir, raw);
115
108
  process.stdout.write(`${opts.mode}\n`);
116
109
  return 0;
117
- }
118
- catch (err) {
119
- throw mapCoreError(err, {
120
- command: "mode set",
121
- root: opts.rootOverride ?? null,
122
- mode: opts.mode,
123
- });
124
- }
110
+ });
111
+ }
112
+ export function makeRunModeSetHandler(deps) {
113
+ return (ctx, p) => cmdModeSet({
114
+ cwd: ctx.cwd,
115
+ rootOverride: ctx.rootOverride,
116
+ mode: p.mode,
117
+ deps,
118
+ });
125
119
  }
126
- export const runModeSet = (ctx, p) => cmdModeSet({
127
- cwd: ctx.cwd,
128
- rootOverride: ctx.rootOverride,
129
- mode: p.mode,
130
- });
@@ -1,4 +1,5 @@
1
1
  import type { CommandHandler, CommandSpec } from "../../spec/spec.js";
2
+ import type { RunDeps } from "../command-catalog.js";
2
3
  type QuickstartParsed = Record<string, never>;
3
4
  export declare const quickstartSpec: CommandSpec<QuickstartParsed>;
4
5
  export declare const runQuickstart: CommandHandler<QuickstartParsed>;
@@ -9,6 +10,6 @@ export declare const roleSpec: CommandSpec<RoleParsed>;
9
10
  export declare const runRole: CommandHandler<RoleParsed>;
10
11
  type AgentsParsed = Record<string, never>;
11
12
  export declare const agentsSpec: CommandSpec<AgentsParsed>;
12
- export declare const runAgents: CommandHandler<AgentsParsed>;
13
+ export declare function makeRunAgentsHandler(deps: RunDeps): CommandHandler<AgentsParsed>;
13
14
  export {};
14
15
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/core.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtE,KAAK,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE9C,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAOxD,CAAC;AAYF,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,gBAAgB,CAG1D,CAAC;AAEF,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CAO5C,CAAC;AA8BF,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,UAAU,CAG9C,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CAMhD,CAAC;AAkEF,eAAO,MAAM,SAAS,EAAE,cAAc,CAAC,YAAY,CACU,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/core.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIrD,KAAK,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE9C,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAOxD,CAAC;AASF,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,gBAAgB,CAE1D,CAAC;AAEF,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CAO5C,CAAC;AAkMF,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"}
@@ -1,12 +1,13 @@
1
1
  import { readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { resolveProject } from "@agentplaneorg/core";
4
- import { mapCoreError } from "../../error-map.js";
5
4
  import { fileExists } from "../../fs-utils.js";
6
5
  import { CliError } from "../../../shared/errors.js";
7
6
  import { dedupeStrings } from "../../../shared/strings.js";
8
7
  import { usageError } from "../../spec/errors.js";
9
8
  import { listRoles, renderQuickstart, renderRole } from "../../command-guide.js";
9
+ import { toStringList } from "../../spec/parse-utils.js";
10
+ import { wrapCommand } from "./wrap-command.js";
10
11
  export const quickstartSpec = {
11
12
  id: ["quickstart"],
12
13
  group: "Core",
@@ -15,20 +16,14 @@ export const quickstartSpec = {
15
16
  examples: [{ cmd: "agentplane quickstart", why: "Show quickstart." }],
16
17
  parse: () => ({}),
17
18
  };
18
- function cmdQuickstart(opts) {
19
- try {
19
+ async function cmdQuickstart(opts) {
20
+ return wrapCommand({ command: "quickstart", rootOverride: opts.rootOverride }, () => {
20
21
  process.stdout.write(`${renderQuickstart()}\n`);
21
22
  return 0;
22
- }
23
- catch (err) {
24
- if (err instanceof CliError)
25
- throw err;
26
- throw mapCoreError(err, { command: "quickstart", root: opts.rootOverride ?? null });
27
- }
23
+ });
28
24
  }
29
25
  export const runQuickstart = (ctx) => {
30
- cmdQuickstart({ cwd: ctx.cwd, rootOverride: ctx.rootOverride });
31
- return Promise.resolve(0);
26
+ return cmdQuickstart({ cwd: ctx.cwd, rootOverride: ctx.rootOverride });
32
27
  };
33
28
  export const roleSpec = {
34
29
  id: ["role"],
@@ -38,8 +33,101 @@ export const roleSpec = {
38
33
  examples: [{ cmd: "agentplane role ORCHESTRATOR", why: "Show ORCHESTRATOR guide." }],
39
34
  parse: (raw) => ({ role: String(raw.args.role ?? "") }),
40
35
  };
41
- function cmdRole(opts) {
36
+ function parseAgentProfileJson(filePath, text) {
37
+ let parsed;
38
+ try {
39
+ parsed = JSON.parse(text);
40
+ }
41
+ catch {
42
+ throw new CliError({
43
+ exitCode: 3,
44
+ code: "E_VALIDATION",
45
+ message: `Invalid agent profile JSON: ${filePath} (malformed JSON)`,
46
+ });
47
+ }
48
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
49
+ throw new CliError({
50
+ exitCode: 3,
51
+ code: "E_VALIDATION",
52
+ message: `Invalid agent profile JSON: ${filePath} (expected object)`,
53
+ });
54
+ }
55
+ return parsed;
56
+ }
57
+ function normalizeRoleId(roleRaw) {
58
+ return roleRaw.trim().toUpperCase();
59
+ }
60
+ async function listAgentProfileIds(opts) {
42
61
  try {
62
+ const resolved = await resolveProject({
63
+ cwd: opts.cwd,
64
+ rootOverride: opts.rootOverride ?? null,
65
+ });
66
+ const agentsDir = path.join(resolved.agentplaneDir, "agents");
67
+ if (!(await fileExists(agentsDir)))
68
+ return null;
69
+ const entriesRaw = await readdir(agentsDir);
70
+ const entries = entriesRaw.filter((n) => n.endsWith(".json")).toSorted();
71
+ const ids = entries.map((n) => n.replace(/\.json$/i, ""));
72
+ return { agentplaneDir: resolved.agentplaneDir, ids };
73
+ }
74
+ catch {
75
+ // Best-effort: role should not fail if we're not in an agentplane project.
76
+ return null;
77
+ }
78
+ }
79
+ async function readAgentProfile(opts) {
80
+ const listing = await listAgentProfileIds({ cwd: opts.cwd, rootOverride: opts.rootOverride });
81
+ if (!listing)
82
+ return null;
83
+ const roleId = normalizeRoleId(opts.roleId);
84
+ const candidates = [roleId, opts.roleId.trim()].filter(Boolean);
85
+ const idsLower = new Map();
86
+ for (const id of listing.ids)
87
+ idsLower.set(id.toLowerCase(), id);
88
+ let foundId = null;
89
+ for (const c of candidates) {
90
+ const exact = listing.ids.find((id) => id === c);
91
+ if (exact) {
92
+ foundId = exact;
93
+ break;
94
+ }
95
+ const ci = idsLower.get(c.toLowerCase());
96
+ if (ci) {
97
+ foundId = ci;
98
+ break;
99
+ }
100
+ }
101
+ if (!foundId)
102
+ return null;
103
+ const filename = `${foundId}.json`;
104
+ const filePath = path.join(listing.agentplaneDir, "agents", filename);
105
+ const raw = parseAgentProfileJson(filePath, await readFile(filePath, "utf8"));
106
+ return { agentplaneDir: listing.agentplaneDir, filename, profile: raw };
107
+ }
108
+ function renderAgentProfileBlock(opts) {
109
+ const id = (typeof opts.profile.id === "string" ? opts.profile.id : "").trim() || opts.roleId;
110
+ const role = (typeof opts.profile.role === "string" ? opts.profile.role : "").trim();
111
+ const description = (typeof opts.profile.description === "string" ? opts.profile.description : "").trim();
112
+ const inputs = toStringList(opts.profile.inputs);
113
+ const outputs = toStringList(opts.profile.outputs);
114
+ const permissions = toStringList(opts.profile.permissions);
115
+ const workflow = toStringList(opts.profile.workflow);
116
+ const lines = [
117
+ `### ${id}`,
118
+ ...(role ? [`Role: ${role}`] : []),
119
+ ...(description ? [`Description: ${description}`] : []),
120
+ ...(inputs.length > 0 ? ["", "Inputs:", ...inputs.map((s) => `- ${s}`)] : []),
121
+ ...(outputs.length > 0 ? ["", "Outputs:", ...outputs.map((s) => `- ${s}`)] : []),
122
+ ...(permissions.length > 0 ? ["", "Permissions:", ...permissions.map((s) => `- ${s}`)] : []),
123
+ ...(workflow.length > 0 ? ["", "Workflow:", ...workflow.map((s) => `- ${s}`)] : []),
124
+ "",
125
+ `Source: .agentplane/agents/${opts.filename} (lower priority; see AGENTS.md)`,
126
+ ];
127
+ return lines.join("\n").trimEnd();
128
+ }
129
+ async function cmdRole(opts) {
130
+ return wrapCommand({ command: "role", rootOverride: opts.rootOverride }, async () => {
43
131
  const roleRaw = opts.role.trim();
44
132
  if (!roleRaw) {
45
133
  throw usageError({
@@ -48,28 +136,59 @@ function cmdRole(opts) {
48
136
  message: "Missing required argument: role",
49
137
  });
50
138
  }
51
- const guide = renderRole(roleRaw);
52
- if (!guide) {
53
- const roles = listRoles();
54
- const available = roles.length > 0 ? `\nAvailable roles: ${roles.join(", ")}` : "";
139
+ const normalizedRole = normalizeRoleId(roleRaw);
140
+ const guide = renderRole(normalizedRole);
141
+ const agentProfile = await readAgentProfile({
142
+ cwd: opts.cwd,
143
+ rootOverride: opts.rootOverride,
144
+ roleId: normalizedRole,
145
+ });
146
+ if (!guide && !agentProfile) {
147
+ const builtin = listRoles();
148
+ const agentIds = await listAgentProfileIds({
149
+ cwd: opts.cwd,
150
+ rootOverride: opts.rootOverride,
151
+ });
152
+ const discovered = agentIds ? agentIds.ids : [];
153
+ const availableList = dedupeStrings([...builtin, ...discovered]).toSorted();
154
+ const available = availableList.length > 0 ? `\nAvailable roles: ${availableList.join(", ")}` : "";
55
155
  throw usageError({
56
156
  spec: roleSpec,
57
157
  command: "role",
58
158
  message: `Unknown role: ${roleRaw}.${available}`,
59
159
  });
60
160
  }
61
- process.stdout.write(`${guide}\n`);
161
+ if (guide) {
162
+ process.stdout.write(`${guide}\n`);
163
+ if (agentProfile) {
164
+ const block = renderAgentProfileBlock({
165
+ filename: agentProfile.filename,
166
+ roleId: normalizedRole,
167
+ profile: agentProfile.profile,
168
+ });
169
+ process.stdout.write(`\n## Agent profile\n\n${block}\n`);
170
+ }
171
+ return 0;
172
+ }
173
+ if (!agentProfile) {
174
+ // Defensive: this should be unreachable due to the earlier guard.
175
+ throw usageError({
176
+ spec: roleSpec,
177
+ command: "role",
178
+ message: `Unknown role: ${roleRaw}.`,
179
+ });
180
+ }
181
+ const block = renderAgentProfileBlock({
182
+ filename: agentProfile.filename,
183
+ roleId: normalizedRole,
184
+ profile: agentProfile.profile,
185
+ });
186
+ process.stdout.write(`${block}\n`);
62
187
  return 0;
63
- }
64
- catch (err) {
65
- if (err instanceof CliError)
66
- throw err;
67
- throw mapCoreError(err, { command: "role", root: opts.rootOverride ?? null });
68
- }
188
+ });
69
189
  }
70
190
  export const runRole = (ctx, p) => {
71
- cmdRole({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, role: p.role });
72
- return Promise.resolve(0);
191
+ return cmdRole({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, role: p.role });
73
192
  };
74
193
  export const agentsSpec = {
75
194
  id: ["agents"],
@@ -78,12 +197,9 @@ export const agentsSpec = {
78
197
  examples: [{ cmd: "agentplane agents", why: "Print available agent ids and roles." }],
79
198
  parse: () => ({}),
80
199
  };
81
- async function cmdAgents(opts) {
82
- try {
83
- const resolved = await resolveProject({
84
- cwd: opts.cwd,
85
- rootOverride: opts.rootOverride ?? null,
86
- });
200
+ export function makeRunAgentsHandler(deps) {
201
+ return async (ctx) => wrapCommand({ command: "agents", rootOverride: ctx.rootOverride }, async () => {
202
+ const resolved = await deps.getResolvedProject("agents");
87
203
  const agentsDir = path.join(resolved.agentplaneDir, "agents");
88
204
  if (!(await fileExists(agentsDir))) {
89
205
  throw new CliError({
@@ -104,41 +220,61 @@ async function cmdAgents(opts) {
104
220
  const rows = [];
105
221
  const seen = new Set();
106
222
  const duplicates = [];
223
+ const mismatches = [];
107
224
  for (const entry of entries) {
225
+ const canonicalId = entry.replace(/\.json$/i, "");
108
226
  const filePath = path.join(agentsDir, entry);
109
- const raw = JSON.parse(await readFile(filePath, "utf8"));
227
+ const raw = parseAgentProfileJson(filePath, await readFile(filePath, "utf8"));
110
228
  const rawId = typeof raw.id === "string" ? raw.id : "";
111
229
  const rawRole = typeof raw.role === "string" ? raw.role : "";
112
- const agentId = rawId.trim() || "<missing-id>";
230
+ const normalizedRawId = rawId.trim();
113
231
  const role = rawRole.trim() || "-";
114
- if (seen.has(agentId)) {
115
- duplicates.push(agentId);
232
+ if (seen.has(canonicalId)) {
233
+ duplicates.push(canonicalId);
116
234
  }
117
235
  else {
118
- seen.add(agentId);
236
+ seen.add(canonicalId);
119
237
  }
120
- rows.push([agentId, role, entry]);
238
+ if (normalizedRawId.length > 0 && normalizedRawId !== canonicalId) {
239
+ mismatches.push({ filename: entry, canonicalId, rawId: normalizedRawId });
240
+ }
241
+ rows.push({ canonicalId, role, filename: entry, rawId: normalizedRawId });
121
242
  }
122
- const widthId = Math.max(...rows.map((row) => row[0].length), "ID".length);
123
- const widthFile = Math.max(...rows.map((row) => row[2].length), "FILE".length);
124
- process.stdout.write(`${"ID".padEnd(widthId)} ${"FILE".padEnd(widthFile)} ROLE\n`);
125
- process.stdout.write(`${"-".repeat(widthId)} ${"-".repeat(widthFile)} ----\n`);
126
- for (const [agentId, role, filename] of rows) {
127
- process.stdout.write(`${agentId.padEnd(widthId)} ${filename.padEnd(widthFile)} ${role}\n`);
243
+ const showRawIdColumn = mismatches.length > 0;
244
+ const widthId = Math.max(...rows.map((row) => row.canonicalId.length), "ID".length);
245
+ const widthFile = Math.max(...rows.map((row) => row.filename.length), "FILE".length);
246
+ if (showRawIdColumn) {
247
+ const widthRawId = Math.max(...rows.map((row) => row.rawId.length), "RAW_ID".length);
248
+ process.stdout.write(`${"ID".padEnd(widthId)} ${"FILE".padEnd(widthFile)} ${"RAW_ID".padEnd(widthRawId)} ROLE\n`);
249
+ process.stdout.write(`${"-".repeat(widthId)} ${"-".repeat(widthFile)} ${"-".repeat(widthRawId)} ----\n`);
250
+ for (const row of rows) {
251
+ process.stdout.write(`${row.canonicalId.padEnd(widthId)} ${row.filename.padEnd(widthFile)} ${row.rawId.padEnd(widthRawId)} ${row.role}\n`);
252
+ }
253
+ }
254
+ else {
255
+ process.stdout.write(`${"ID".padEnd(widthId)} ${"FILE".padEnd(widthFile)} ROLE\n`);
256
+ process.stdout.write(`${"-".repeat(widthId)} ${"-".repeat(widthFile)} ----\n`);
257
+ for (const row of rows) {
258
+ process.stdout.write(`${row.canonicalId.padEnd(widthId)} ${row.filename.padEnd(widthFile)} ${row.role}\n`);
259
+ }
128
260
  }
129
261
  if (duplicates.length > 0) {
130
262
  throw new CliError({
131
263
  exitCode: 2,
132
264
  code: "E_USAGE",
133
- message: `Duplicate agent ids: ${dedupeStrings(duplicates).toSorted().join(", ")}`,
265
+ message: `Duplicate canonical agent ids: ${dedupeStrings(duplicates).toSorted().join(", ")}`,
266
+ });
267
+ }
268
+ if (mismatches.length > 0) {
269
+ const details = mismatches
270
+ .map((m) => `${m.filename}: raw id "${m.rawId}" != canonical "${m.canonicalId}"`)
271
+ .join("; ");
272
+ throw new CliError({
273
+ exitCode: 2,
274
+ code: "E_USAGE",
275
+ message: `Agent profile id mismatch: ${details}`,
134
276
  });
135
277
  }
136
278
  return 0;
137
- }
138
- catch (err) {
139
- if (err instanceof CliError)
140
- throw err;
141
- throw mapCoreError(err, { command: "agents", root: opts.rootOverride ?? null });
142
- }
279
+ });
143
280
  }
144
- export const runAgents = (ctx) => cmdAgents({ cwd: ctx.cwd, rootOverride: ctx.rootOverride });
@@ -1,4 +1,5 @@
1
1
  import type { CommandHandler, CommandSpec } from "../../spec/spec.js";
2
+ import type { RunDeps } from "../command-catalog.js";
2
3
  type IdeSyncParsed = {
3
4
  ide?: "cursor" | "windsurf";
4
5
  };
@@ -7,7 +8,8 @@ export declare function cmdIdeSync(opts: {
7
8
  cwd: string;
8
9
  rootOverride?: string;
9
10
  ide?: "cursor" | "windsurf";
11
+ deps: RunDeps;
10
12
  }): Promise<number>;
11
- export declare const runIdeSync: CommandHandler<IdeSyncParsed>;
13
+ export declare function makeRunIdeSyncHandler(deps: RunDeps): CommandHandler<IdeSyncParsed>;
12
14
  export {};
13
15
  //# sourceMappingURL=ide.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ide.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/ide.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtE,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;CAC7B,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ClB;AAED,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,aAAa,CACqB,CAAC"}
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,8 +1,7 @@
1
1
  import { mkdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { resolveProject } from "@agentplaneorg/core";
4
- import { mapCoreError } from "../../error-map.js";
5
3
  import { writeTextIfChanged } from "../../../shared/write-if-changed.js";
4
+ import { wrapCommand } from "./wrap-command.js";
6
5
  export const ideSyncSpec = {
7
6
  id: ["ide", "sync"],
8
7
  group: "IDE",
@@ -23,11 +22,8 @@ export const ideSyncSpec = {
23
22
  parse: (raw) => ({ ide: raw.opts.ide }),
24
23
  };
25
24
  export async function cmdIdeSync(opts) {
26
- try {
27
- const resolved = await resolveProject({
28
- cwd: opts.cwd,
29
- rootOverride: opts.rootOverride ?? null,
30
- });
25
+ return wrapCommand({ command: "ide sync", rootOverride: opts.rootOverride }, async () => {
26
+ const resolved = await opts.deps.getResolvedProject("ide sync");
31
27
  const agentsPath = path.join(resolved.gitRoot, "AGENTS.md");
32
28
  const agentsText = await readFile(agentsPath, "utf8");
33
29
  const header = [
@@ -59,9 +55,8 @@ export async function cmdIdeSync(opts) {
59
55
  process.stdout.write(`${path.relative(resolved.gitRoot, windsurfPath)}\n`);
60
56
  }
61
57
  return 0;
62
- }
63
- catch (err) {
64
- throw mapCoreError(err, { command: "ide sync", root: opts.rootOverride ?? null });
65
- }
58
+ });
59
+ }
60
+ export function makeRunIdeSyncHandler(deps) {
61
+ return (ctx, p) => cmdIdeSync({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, ide: p.ide, deps });
66
62
  }
67
- export const runIdeSync = (ctx, p) => cmdIdeSync({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, ide: p.ide });
@@ -1 +1 @@
1
- {"version":3,"file":"ide-sync.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/ide-sync.ts"],"names":[],"mappings":"AAMA,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAetC"}
1
+ {"version":3,"file":"ide-sync.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/ide-sync.ts"],"names":[],"mappings":"AAOA,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA0BtC"}
@@ -4,7 +4,16 @@ import { cmdIdeSync } from "../ide.js";
4
4
  export async function maybeSyncIde(opts) {
5
5
  if (opts.ide === "codex")
6
6
  return { installPaths: [] };
7
- await cmdIdeSync({ cwd: opts.cwd, rootOverride: opts.rootOverride, ide: opts.ide });
7
+ const deps = {
8
+ getCtx: (_cmd) => Promise.reject(new Error("getCtx is not available during init")),
9
+ getResolvedProject: (_cmd) => Promise.resolve({
10
+ gitRoot: opts.gitRoot,
11
+ agentplaneDir: path.join(opts.gitRoot, ".agentplane"),
12
+ }),
13
+ getLoadedConfig: (_cmd) => Promise.reject(new Error("getLoadedConfig is not available during init")),
14
+ getHelpJsonForDocs: () => [],
15
+ };
16
+ await cmdIdeSync({ cwd: opts.cwd, rootOverride: opts.rootOverride, ide: opts.ide, deps });
8
17
  const installPaths = [];
9
18
  const cursorPath = path.join(opts.gitRoot, ".cursor", "rules", "agentplane.mdc");
10
19
  const windsurfPath = path.join(opts.gitRoot, ".windsurf", "rules", "agentplane.md");
@@ -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;AAQ1E,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,CA+CtC"}
1
+ {"version":3,"file":"write-agents.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-agents.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAQ1E,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,CA6BtC"}
@@ -1,45 +1,25 @@
1
- import { lstat, symlink } from "node:fs/promises";
2
1
  import path from "node:path";
3
2
  import { atomicWriteFile } from "@agentplaneorg/core";
4
3
  import { filterAgentsByWorkflow, loadAgentTemplates, loadAgentsTemplate, } from "../../../../agents/agents-template.js";
5
4
  import { fileExists } from "../../../fs-utils.js";
6
5
  export async function ensureAgentsFiles(opts) {
7
- const agentsLinkPath = path.join(opts.gitRoot, "AGENTS.md");
8
- const agentsManagedPath = path.join(opts.agentplaneDir, "AGENTS.md");
6
+ const agentsPath = path.join(opts.gitRoot, "AGENTS.md");
9
7
  const installPaths = [
10
8
  path.relative(opts.gitRoot, opts.configPathAbs),
11
9
  path.relative(opts.gitRoot, opts.backendPathAbs),
12
10
  ];
13
11
  let wroteAgents = false;
14
- if (await fileExists(agentsManagedPath)) {
12
+ if (await fileExists(agentsPath)) {
15
13
  // nothing
16
14
  }
17
15
  else {
18
16
  const template = await loadAgentsTemplate();
19
17
  const filtered = filterAgentsByWorkflow(template, opts.workflow);
20
- await atomicWriteFile(agentsManagedPath, filtered, "utf8");
18
+ await atomicWriteFile(agentsPath, filtered, "utf8");
21
19
  wroteAgents = true;
22
20
  }
23
21
  if (wroteAgents) {
24
- installPaths.push(path.relative(opts.gitRoot, agentsManagedPath));
25
- }
26
- // The workspace-root AGENTS.md is a symlink to the managed copy under .agentplane/.
27
- // This keeps the root policy path stable while making upgrades deterministic.
28
- if (await fileExists(agentsLinkPath)) {
29
- try {
30
- const st = await lstat(agentsLinkPath);
31
- if (!st.isSymbolicLink()) {
32
- // Do not overwrite user-owned AGENTS.md in init; upgrade handles migration.
33
- }
34
- }
35
- catch {
36
- // ignore
37
- }
38
- }
39
- else {
40
- const relTarget = path.relative(opts.gitRoot, agentsManagedPath);
41
- await symlink(relTarget, agentsLinkPath);
42
- installPaths.push(path.relative(opts.gitRoot, agentsLinkPath));
22
+ installPaths.push(path.relative(opts.gitRoot, agentsPath));
43
23
  }
44
24
  const agentTemplates = await loadAgentTemplates();
45
25
  for (const agent of agentTemplates) {
@@ -0,0 +1,5 @@
1
+ export declare function ensureInitGitignore(opts: {
2
+ gitRoot: string;
3
+ includeAgentPromptFiles: boolean;
4
+ }): Promise<void>;
5
+ //# sourceMappingURL=write-gitignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-gitignore.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-gitignore.ts"],"names":[],"mappings":"AAgCA,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB,EAAE,OAAO,CAAC;CAClC,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBhB"}