agentplane 0.2.12 → 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 (43) hide show
  1. package/dist/cli/command-guide.js +1 -1
  2. package/dist/cli/run-cli/command-catalog.js +4 -4
  3. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  4. package/dist/cli/run-cli/commands/config.js +17 -38
  5. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  6. package/dist/cli/run-cli/commands/core.js +100 -71
  7. package/dist/cli/run-cli/commands/ide.d.ts.map +1 -1
  8. package/dist/cli/run-cli/commands/ide.js +3 -9
  9. package/dist/cli/run-cli/commands/init/write-gitignore.d.ts +2 -1
  10. package/dist/cli/run-cli/commands/init/write-gitignore.d.ts.map +1 -1
  11. package/dist/cli/run-cli/commands/init/write-gitignore.js +19 -6
  12. package/dist/cli/run-cli/commands/init.js +5 -2
  13. package/dist/cli/run-cli/commands/wrap-command.d.ts +6 -0
  14. package/dist/cli/run-cli/commands/wrap-command.d.ts.map +1 -0
  15. package/dist/cli/run-cli/commands/wrap-command.js +17 -0
  16. package/dist/cli/run-cli.d.ts.map +1 -1
  17. package/dist/cli/run-cli.js +5 -3
  18. package/dist/commands/doctor.command.d.ts +2 -7
  19. package/dist/commands/doctor.command.d.ts.map +1 -1
  20. package/dist/commands/doctor.command.js +2 -137
  21. package/dist/commands/doctor.run.d.ts +4 -0
  22. package/dist/commands/doctor.run.d.ts.map +1 -0
  23. package/dist/commands/doctor.run.js +174 -0
  24. package/dist/commands/doctor.spec.d.ts +7 -0
  25. package/dist/commands/doctor.spec.d.ts.map +1 -0
  26. package/dist/commands/doctor.spec.js +20 -0
  27. package/dist/commands/recipes/install.command.d.ts +2 -11
  28. package/dist/commands/recipes/install.command.d.ts.map +1 -1
  29. package/dist/commands/recipes/install.command.js +2 -161
  30. package/dist/commands/recipes/install.run.d.ts +4 -0
  31. package/dist/commands/recipes/install.run.d.ts.map +1 -0
  32. package/dist/commands/recipes/install.run.js +23 -0
  33. package/dist/commands/recipes/install.spec.d.ts +11 -0
  34. package/dist/commands/recipes/install.spec.d.ts.map +1 -0
  35. package/dist/commands/recipes/install.spec.js +140 -0
  36. package/dist/commands/shared/git-context.d.ts +3 -0
  37. package/dist/commands/shared/git-context.d.ts.map +1 -1
  38. package/dist/commands/shared/git-context.js +10 -0
  39. package/dist/commands/task/finish.d.ts.map +1 -1
  40. package/dist/commands/task/finish.js +34 -2
  41. package/dist/commands/upgrade.d.ts.map +1 -1
  42. package/dist/commands/upgrade.js +23 -2
  43. package/package.json +1 -1
@@ -0,0 +1,140 @@
1
+ import { usageError } from "../../cli/spec/errors.js";
2
+ export const recipesInstallSpec = {
3
+ id: ["recipes", "install"],
4
+ group: "Recipes",
5
+ summary: "Install a recipe from remote index, local archive, or URL.",
6
+ synopsis: [
7
+ "agentplane recipes install <id|path|url> [--index <path|url>] [--refresh] [--yes] [--on-conflict <fail|rename|overwrite>]",
8
+ "agentplane recipes install --name <id> [--index <path|url>] [--refresh] [--yes] [--on-conflict <fail|rename|overwrite>]",
9
+ "agentplane recipes install --path <path> [--yes] [--on-conflict <fail|rename|overwrite>]",
10
+ "agentplane recipes install --url <url> [--yes] [--on-conflict <fail|rename|overwrite>]",
11
+ ],
12
+ args: [
13
+ {
14
+ name: "source",
15
+ required: false,
16
+ valueHint: "<id|path|url>",
17
+ description: "Auto mode: URL if http(s); else PATH if file exists; else NAME (remote index id).",
18
+ },
19
+ ],
20
+ options: [
21
+ {
22
+ kind: "string",
23
+ name: "name",
24
+ valueHint: "<id>",
25
+ description: "Install from remote index by recipe id.",
26
+ },
27
+ {
28
+ kind: "string",
29
+ name: "path",
30
+ valueHint: "<path>",
31
+ description: "Install from local recipe archive path.",
32
+ },
33
+ {
34
+ kind: "string",
35
+ name: "url",
36
+ valueHint: "<url>",
37
+ description: "Install from recipe archive URL.",
38
+ },
39
+ {
40
+ kind: "string",
41
+ name: "index",
42
+ valueHint: "<path|url>",
43
+ description: "Override recipes index location (used when installing by name / auto-name).",
44
+ },
45
+ {
46
+ kind: "boolean",
47
+ name: "refresh",
48
+ default: false,
49
+ description: "Refresh remote index cache before installing.",
50
+ },
51
+ {
52
+ kind: "boolean",
53
+ name: "yes",
54
+ default: false,
55
+ description: "Auto-approve network prompts when allowed by config.",
56
+ },
57
+ {
58
+ kind: "string",
59
+ name: "on-conflict",
60
+ valueHint: "<fail|rename|overwrite>",
61
+ choices: ["fail", "rename", "overwrite"],
62
+ default: "fail",
63
+ description: "How to handle conflicts when applying recipe agents.",
64
+ },
65
+ ],
66
+ validateRaw: (raw) => {
67
+ const explicit = [raw.opts.name, raw.opts.path, raw.opts.url].filter(Boolean).length;
68
+ const hasPositional = Boolean(raw.args.source);
69
+ if (explicit + (hasPositional ? 1 : 0) !== 1) {
70
+ throw usageError({
71
+ spec: recipesInstallSpec,
72
+ message: "Exactly one source is required: <source> OR --name OR --path OR --url",
73
+ command: "recipes install",
74
+ });
75
+ }
76
+ },
77
+ parse: (raw) => {
78
+ const onConflict = (raw.opts["on-conflict"] ?? "fail");
79
+ const refresh = raw.opts.refresh === true;
80
+ const yes = raw.opts.yes === true;
81
+ const index = typeof raw.opts.index === "string" ? raw.opts.index : undefined;
82
+ if (raw.opts.name) {
83
+ return {
84
+ source: { type: "name", value: raw.opts.name },
85
+ index,
86
+ refresh,
87
+ yes,
88
+ onConflict,
89
+ };
90
+ }
91
+ if (raw.opts.path) {
92
+ return {
93
+ source: { type: "path", value: raw.opts.path },
94
+ index,
95
+ refresh,
96
+ yes,
97
+ onConflict,
98
+ };
99
+ }
100
+ if (raw.opts.url) {
101
+ return {
102
+ source: { type: "url", value: raw.opts.url },
103
+ index,
104
+ refresh,
105
+ yes,
106
+ onConflict,
107
+ };
108
+ }
109
+ const source = raw.args.source;
110
+ if (typeof source !== "string") {
111
+ throw usageError({
112
+ spec: recipesInstallSpec,
113
+ command: "recipes install",
114
+ message: "Missing source argument",
115
+ });
116
+ }
117
+ return {
118
+ source: { type: "auto", value: source },
119
+ index,
120
+ refresh,
121
+ yes,
122
+ onConflict,
123
+ };
124
+ },
125
+ examples: [
126
+ { cmd: "agentplane recipes install viewer", why: "Auto: install by id from remote index." },
127
+ {
128
+ cmd: "agentplane recipes install --name viewer --refresh",
129
+ why: "Install by id, forcing index refresh.",
130
+ },
131
+ {
132
+ cmd: "agentplane recipes install viewer --on-conflict overwrite",
133
+ why: "Apply recipe agents, overwriting conflicts.",
134
+ },
135
+ ],
136
+ notes: [
137
+ "Auto mode resolution matches v0.1.9: URL if http(s); else PATH if file exists; else NAME (remote index).",
138
+ "Network operations may require approval; use --yes to auto-approve when allowed by config.",
139
+ ],
140
+ };
@@ -15,6 +15,9 @@ export declare class GitContext {
15
15
  body?: string;
16
16
  env?: NodeJS.ProcessEnv;
17
17
  }): Promise<void>;
18
+ commitAmendNoEdit(opts?: {
19
+ env?: NodeJS.ProcessEnv;
20
+ }): Promise<void>;
18
21
  headHashSubject(): Promise<{
19
22
  hash: string;
20
23
  subject: string;
@@ -1 +1 @@
1
- {"version":3,"file":"git-context.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-context.ts"],"names":[],"mappings":"AAyEA,qBAAa,UAAU;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,IAAI,CAGL;gBAEK,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;YAIvB,gBAAgB;IAmBxB,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKvC,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKtC,0BAA0B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKrD,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAWvB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxF,eAAe,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAWpE"}
1
+ {"version":3,"file":"git-context.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-context.ts"],"names":[],"mappings":"AAyEA,qBAAa,UAAU;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,IAAI,CAGL;gBAEK,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;YAIvB,gBAAgB;IAmBxB,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKvC,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKtC,0BAA0B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKrD,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAWvB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxF,iBAAiB,CAAC,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpE,eAAe,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAWpE"}
@@ -126,6 +126,16 @@ export class GitContext {
126
126
  this.memo.status = undefined;
127
127
  this.memo.headCommit = undefined;
128
128
  }
129
+ async commitAmendNoEdit(opts) {
130
+ await execFileAsync("git", ["commit", "--amend", "--no-edit"], {
131
+ cwd: this.gitRoot,
132
+ env: opts?.env ?? gitEnv(),
133
+ // Amend triggers hooks too; keep buffer aligned with regular commit.
134
+ maxBuffer: 50 * 1024 * 1024,
135
+ });
136
+ this.memo.status = undefined;
137
+ this.memo.headCommit = undefined;
138
+ }
129
139
  async headHashSubject() {
130
140
  const { stdout } = await execFileAsync("git", ["log", "-1", "--pretty=%H%x00%s"], {
131
141
  cwd: this.gitRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"finish.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAiCnC,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAA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@@ -4,7 +4,7 @@ import { formatCommentBodyForCommit } from "../../shared/comment-format.js";
4
4
  import { CliError } from "../../shared/errors.js";
5
5
  import { readFile, rm } from "node:fs/promises";
6
6
  import path from "node:path";
7
- import { commitFromComment } from "../guard/index.js";
7
+ import { buildGitCommitEnv, commitFromComment } from "../guard/index.js";
8
8
  import { loadCommandContext, loadTaskFromContext, } from "../shared/task-backend.js";
9
9
  import { backendIsLocalFileBackend, getTaskStore } from "../shared/task-store.js";
10
10
  import { readDirectWorkLock } from "../../shared/direct-work-lock.js";
@@ -160,7 +160,7 @@ export async function cmdFinish(opts) {
160
160
  message: invalidValueMessage("--commit-emoji", opts.commitEmoji, "✅ (finish commits must use a checkmark)"),
161
161
  });
162
162
  }
163
- await commitFromComment({
163
+ const committed = await commitFromComment({
164
164
  ctx,
165
165
  cwd: opts.cwd,
166
166
  rootOverride: opts.rootOverride,
@@ -179,6 +179,38 @@ export async function cmdFinish(opts) {
179
179
  quiet: opts.quiet,
180
180
  config: ctx.config,
181
181
  });
182
+ // commitFromComment creates the git commit and returns the actual head hash/subject.
183
+ // Refresh task commit metadata to this hash and amend the same commit in local mode so
184
+ // "task done" metadata does not require a manual follow-up close commit.
185
+ const taskAfterCommit = useStore
186
+ ? await store.get(primaryTaskId)
187
+ : await loadTaskFromContext({ ctx, taskId: primaryTaskId });
188
+ const updatedAfterCommit = {
189
+ ...taskAfterCommit,
190
+ commit: { hash: committed.hash, message: committed.message },
191
+ doc_version: 2,
192
+ doc_updated_at: nowIso(),
193
+ doc_updated_by: opts.author,
194
+ };
195
+ await (useStore
196
+ ? store.update(primaryTaskId, () => updatedAfterCommit)
197
+ : ctx.taskBackend.writeTask(updatedAfterCommit));
198
+ if (useStore) {
199
+ const workflowReadmeRelPath = path.join(ctx.config.paths.workflow_dir, primaryTaskId, "README.md");
200
+ await ctx.git.stage([workflowReadmeRelPath]);
201
+ const env = buildGitCommitEnv({
202
+ taskId: primaryTaskId,
203
+ agentId: executorAgent ?? undefined,
204
+ statusTo: "DONE",
205
+ allowTasks: true,
206
+ allowBase: false,
207
+ allowPolicy: false,
208
+ allowConfig: false,
209
+ allowHooks: false,
210
+ allowCI: false,
211
+ });
212
+ await ctx.git.commitAmendNoEdit({ env });
213
+ }
182
214
  }
183
215
  if (opts.statusCommit) {
184
216
  if (typeof opts.statusCommitEmoji === "string" && opts.statusCommitEmoji.trim() !== "✅") {
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAmCA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AA4EF,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,MAAM,GAAG;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAWA;AAED,wBAAgB,iCAAiC,CAAC,IAAI,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entplane-upgrade.tar.gz";
15
15
  const DEFAULT_UPGRADE_CHECKSUM_ASSET = "agentplane-upgrade.tar.gz.sha256";
16
16
  const UPGRADE_DOWNLOAD_TIMEOUT_MS = 60_000;
17
17
  const UPGRADE_RELEASE_METADATA_TIMEOUT_MS = 15_000;
18
+ async function safeRemovePath(targetPath) {
19
+ try {
20
+ await rm(targetPath, { recursive: true, force: true });
21
+ }
22
+ catch {
23
+ // best-effort cleanup
24
+ }
25
+ }
26
+ async function cleanupAutoUpgradeArtifacts(opts) {
27
+ for (const backupPath of opts.createdBackups) {
28
+ await safeRemovePath(backupPath);
29
+ }
30
+ // Keep durable state files at .upgrade root; remove transient per-run agent artifacts.
31
+ await safeRemovePath(path.join(opts.upgradeStateDir, "agent"));
32
+ }
18
33
  const ASSETS_DIR_URL = new URL("../../assets/", import.meta.url);
19
34
  async function loadFrameworkManifestFromPath(manifestPath) {
20
35
  const text = await readFile(manifestPath, "utf8");
@@ -415,6 +430,7 @@ export async function cmdUpgradeParsed(opts) {
415
430
  const useRemote = flags.remote === true || hasRemoteHints;
416
431
  let tempRoot = null;
417
432
  let extractRoot = null;
433
+ const createdBackups = [];
418
434
  try {
419
435
  tempRoot = await mkdtemp(path.join(os.tmpdir(), "agentplane-upgrade-"));
420
436
  let bundlePath = "";
@@ -684,7 +700,9 @@ export async function cmdUpgradeParsed(opts) {
684
700
  });
685
701
  const baselineConflict = baselineText === null
686
702
  ? false
687
- : Boolean(changedCurrentVsBaseline) && Boolean(changedIncomingVsBaseline);
703
+ : currentDiffersFromIncoming &&
704
+ Boolean(changedCurrentVsBaseline) &&
705
+ Boolean(changedIncomingVsBaseline);
688
706
  const noBaselineConflict = baselineText === null ? currentDiffersFromIncoming : false;
689
707
  const mergeNotAppliedConflict = mergeApplied ? false : currentDiffersFromIncoming;
690
708
  const needsSemanticReview = baselineConflict || noBaselineConflict || mergeNotAppliedConflict;
@@ -694,6 +712,7 @@ export async function cmdUpgradeParsed(opts) {
694
712
  hasBaseline,
695
713
  changedCurrentVsBaseline,
696
714
  changedIncomingVsBaseline,
715
+ currentDiffersFromIncoming,
697
716
  needsSemanticReview,
698
717
  mergeApplied,
699
718
  mergePath,
@@ -824,7 +843,8 @@ export async function cmdUpgradeParsed(opts) {
824
843
  for (const rel of [...additions, ...updates]) {
825
844
  const destPath = path.join(resolved.gitRoot, rel);
826
845
  if (flags.backup && (await fileExists(destPath))) {
827
- await backupPath(destPath);
846
+ const backup = await backupPath(destPath);
847
+ createdBackups.push(backup);
828
848
  }
829
849
  await mkdir(path.dirname(destPath), { recursive: true });
830
850
  const data = fileContents.get(rel);
@@ -884,6 +904,7 @@ export async function cmdUpgradeParsed(opts) {
884
904
  },
885
905
  files: reviewRecords,
886
906
  }, null, 2) + "\n", "utf8");
907
+ await cleanupAutoUpgradeArtifacts({ upgradeStateDir, createdBackups });
887
908
  process.stdout.write(`Upgrade applied: ${additions.length} add, ${updates.length} update, ${skipped.length} unchanged\n`);
888
909
  return 0;
889
910
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentplane",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Agent Plane CLI for task workflows, recipes, and project automation.",
5
5
  "keywords": [
6
6
  "agentplane",