agentplane 0.3.2 → 0.3.3

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 (190) hide show
  1. package/assets/AGENTS.md +1 -1
  2. package/assets/agents/CODER.json +4 -3
  3. package/assets/agents/DOCS.json +1 -1
  4. package/assets/agents/INTEGRATOR.json +1 -1
  5. package/assets/agents/ORCHESTRATOR.json +1 -0
  6. package/assets/agents/PLANNER.json +1 -0
  7. package/assets/agents/TESTER.json +3 -1
  8. package/assets/policy/dod.code.md +2 -2
  9. package/assets/policy/dod.core.md +16 -2
  10. package/assets/policy/dod.docs.md +2 -2
  11. package/assets/policy/incidents.md +44 -1
  12. package/assets/policy/workflow.direct.md +8 -4
  13. package/bin/agentplane.js +59 -9
  14. package/bin/dist-guard.js +78 -10
  15. package/bin/runtime-context.d.ts +3 -0
  16. package/bin/runtime-context.js +13 -0
  17. package/bin/runtime-watch.d.ts +26 -0
  18. package/bin/runtime-watch.js +116 -0
  19. package/bin/stale-dist-policy.d.ts +6 -0
  20. package/bin/stale-dist-policy.js +44 -0
  21. package/dist/.build-manifest.json +2480 -5
  22. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  23. package/dist/backends/task-backend/local-backend.js +9 -12
  24. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  25. package/dist/backends/task-backend/redmine-backend.js +23 -18
  26. package/dist/backends/task-backend/shared/constants.d.ts +1 -0
  27. package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
  28. package/dist/backends/task-backend/shared/constants.js +1 -0
  29. package/dist/backends/task-backend/shared/doc.d.ts +1 -0
  30. package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
  31. package/dist/backends/task-backend/shared/doc.js +4 -1
  32. package/dist/backends/task-backend/shared/export.js +3 -3
  33. package/dist/cli/bootstrap-guide.d.ts +1 -3
  34. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  35. package/dist/cli/bootstrap-guide.js +13 -33
  36. package/dist/cli/command-guide.d.ts.map +1 -1
  37. package/dist/cli/command-guide.js +27 -34
  38. package/dist/cli/run-cli/catalog.d.ts +7 -0
  39. package/dist/cli/run-cli/catalog.d.ts.map +1 -0
  40. package/dist/cli/run-cli/catalog.js +22 -0
  41. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  42. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  43. package/dist/cli/run-cli/command-catalog.js +11 -0
  44. package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
  45. package/dist/cli/run-cli/commands/init/write-config.js +2 -0
  46. package/dist/cli/run-cli/commands/init.js +5 -14
  47. package/dist/cli/run-cli/error-guidance.d.ts +9 -0
  48. package/dist/cli/run-cli/error-guidance.d.ts.map +1 -0
  49. package/dist/cli/run-cli/error-guidance.js +180 -0
  50. package/dist/cli/run-cli/globals.d.ts +22 -0
  51. package/dist/cli/run-cli/globals.d.ts.map +1 -0
  52. package/dist/cli/run-cli/globals.js +197 -0
  53. package/dist/cli/run-cli/update-warning.d.ts +6 -0
  54. package/dist/cli/run-cli/update-warning.d.ts.map +1 -0
  55. package/dist/cli/run-cli/update-warning.js +64 -0
  56. package/dist/cli/run-cli.d.ts.map +1 -1
  57. package/dist/cli/run-cli.js +5 -476
  58. package/dist/cli/spec/docs-render.d.ts.map +1 -1
  59. package/dist/cli/spec/docs-render.js +14 -1
  60. package/dist/commands/doctor/archive.d.ts +4 -0
  61. package/dist/commands/doctor/archive.d.ts.map +1 -0
  62. package/dist/commands/doctor/archive.js +211 -0
  63. package/dist/commands/doctor/fixes.d.ts +9 -0
  64. package/dist/commands/doctor/fixes.d.ts.map +1 -0
  65. package/dist/commands/doctor/fixes.js +40 -0
  66. package/dist/commands/doctor/layering.d.ts +2 -0
  67. package/dist/commands/doctor/layering.d.ts.map +1 -0
  68. package/dist/commands/doctor/layering.js +87 -0
  69. package/dist/commands/doctor/runtime.d.ts +4 -0
  70. package/dist/commands/doctor/runtime.d.ts.map +1 -0
  71. package/dist/commands/doctor/runtime.js +56 -0
  72. package/dist/commands/doctor/workflow.d.ts +6 -0
  73. package/dist/commands/doctor/workflow.d.ts.map +1 -0
  74. package/dist/commands/doctor/workflow.js +62 -0
  75. package/dist/commands/doctor/workspace.d.ts +2 -0
  76. package/dist/commands/doctor/workspace.d.ts.map +1 -0
  77. package/dist/commands/doctor/workspace.js +165 -0
  78. package/dist/commands/doctor.run.d.ts.map +1 -1
  79. package/dist/commands/doctor.run.js +16 -342
  80. package/dist/commands/doctor.spec.d.ts +1 -0
  81. package/dist/commands/doctor.spec.d.ts.map +1 -1
  82. package/dist/commands/doctor.spec.js +15 -1
  83. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  84. package/dist/commands/guard/impl/commands.js +19 -0
  85. package/dist/commands/release/apply.command.d.ts +2 -8
  86. package/dist/commands/release/apply.command.d.ts.map +1 -1
  87. package/dist/commands/release/apply.command.js +158 -387
  88. package/dist/commands/release/apply.mutation.d.ts +7 -0
  89. package/dist/commands/release/apply.mutation.d.ts.map +1 -0
  90. package/dist/commands/release/apply.mutation.js +107 -0
  91. package/dist/commands/release/apply.preflight.d.ts +25 -0
  92. package/dist/commands/release/apply.preflight.d.ts.map +1 -0
  93. package/dist/commands/release/apply.preflight.js +338 -0
  94. package/dist/commands/release/apply.reporting.d.ts +4 -0
  95. package/dist/commands/release/apply.reporting.d.ts.map +1 -0
  96. package/dist/commands/release/apply.reporting.js +24 -0
  97. package/dist/commands/release/apply.types.d.ts +46 -0
  98. package/dist/commands/release/apply.types.d.ts.map +1 -0
  99. package/dist/commands/release/apply.types.js +1 -0
  100. package/dist/commands/runtime.command.d.ts +28 -0
  101. package/dist/commands/runtime.command.d.ts.map +1 -0
  102. package/dist/commands/runtime.command.js +169 -0
  103. package/dist/commands/shared/task-store.d.ts.map +1 -1
  104. package/dist/commands/shared/task-store.js +7 -3
  105. package/dist/commands/task/add.d.ts.map +1 -1
  106. package/dist/commands/task/add.js +3 -33
  107. package/dist/commands/task/block.d.ts.map +1 -1
  108. package/dist/commands/task/block.js +2 -2
  109. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  110. package/dist/commands/task/close-duplicate.js +2 -2
  111. package/dist/commands/task/close-noop.d.ts.map +1 -1
  112. package/dist/commands/task/close-noop.js +2 -2
  113. package/dist/commands/task/comment.js +2 -2
  114. package/dist/commands/task/derive.d.ts.map +1 -1
  115. package/dist/commands/task/derive.js +3 -3
  116. package/dist/commands/task/doc-template.d.ts +10 -0
  117. package/dist/commands/task/doc-template.d.ts.map +1 -0
  118. package/dist/commands/task/doc-template.js +104 -0
  119. package/dist/commands/task/doc.d.ts.map +1 -1
  120. package/dist/commands/task/doc.js +36 -1
  121. package/dist/commands/task/finish.d.ts.map +1 -1
  122. package/dist/commands/task/finish.js +7 -4
  123. package/dist/commands/task/migrate-doc.command.d.ts.map +1 -1
  124. package/dist/commands/task/migrate-doc.command.js +5 -1
  125. package/dist/commands/task/migrate-doc.d.ts.map +1 -1
  126. package/dist/commands/task/migrate-doc.js +136 -2
  127. package/dist/commands/task/new.d.ts.map +1 -1
  128. package/dist/commands/task/new.js +4 -110
  129. package/dist/commands/task/new.spec.js +3 -3
  130. package/dist/commands/task/plan.d.ts.map +1 -1
  131. package/dist/commands/task/plan.js +5 -4
  132. package/dist/commands/task/scaffold.d.ts.map +1 -1
  133. package/dist/commands/task/scaffold.js +7 -52
  134. package/dist/commands/task/set-status.d.ts.map +1 -1
  135. package/dist/commands/task/set-status.js +2 -2
  136. package/dist/commands/task/shared/dependencies.d.ts +15 -0
  137. package/dist/commands/task/shared/dependencies.d.ts.map +1 -0
  138. package/dist/commands/task/shared/dependencies.js +143 -0
  139. package/dist/commands/task/shared/docs.d.ts +21 -0
  140. package/dist/commands/task/shared/docs.d.ts.map +1 -0
  141. package/dist/commands/task/shared/docs.js +121 -0
  142. package/dist/commands/task/shared/listing.d.ts +20 -0
  143. package/dist/commands/task/shared/listing.d.ts.map +1 -0
  144. package/dist/commands/task/shared/listing.js +127 -0
  145. package/dist/commands/task/shared/tags.d.ts +24 -0
  146. package/dist/commands/task/shared/tags.d.ts.map +1 -0
  147. package/dist/commands/task/shared/tags.js +177 -0
  148. package/dist/commands/task/shared/transitions.d.ts +42 -0
  149. package/dist/commands/task/shared/transitions.d.ts.map +1 -0
  150. package/dist/commands/task/shared/transitions.js +175 -0
  151. package/dist/commands/task/shared.d.ts +5 -106
  152. package/dist/commands/task/shared.d.ts.map +1 -1
  153. package/dist/commands/task/shared.js +5 -681
  154. package/dist/commands/task/start.d.ts.map +1 -1
  155. package/dist/commands/task/start.js +7 -5
  156. package/dist/commands/task/verify-record.d.ts.map +1 -1
  157. package/dist/commands/task/verify-record.js +9 -25
  158. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  159. package/dist/commands/task/verify-show.command.js +5 -1
  160. package/dist/commands/upgrade/apply.d.ts +44 -0
  161. package/dist/commands/upgrade/apply.d.ts.map +1 -0
  162. package/dist/commands/upgrade/apply.js +180 -0
  163. package/dist/commands/upgrade/report.d.ts +21 -0
  164. package/dist/commands/upgrade/report.d.ts.map +1 -0
  165. package/dist/commands/upgrade/report.js +81 -0
  166. package/dist/commands/upgrade/source.d.ts +35 -0
  167. package/dist/commands/upgrade/source.d.ts.map +1 -0
  168. package/dist/commands/upgrade/source.js +109 -0
  169. package/dist/commands/upgrade/types.d.ts +31 -0
  170. package/dist/commands/upgrade/types.d.ts.map +1 -0
  171. package/dist/commands/upgrade/types.js +1 -0
  172. package/dist/commands/upgrade.d.ts +1 -35
  173. package/dist/commands/upgrade.d.ts.map +1 -1
  174. package/dist/commands/upgrade.js +46 -331
  175. package/dist/shared/diagnostics.d.ts +23 -0
  176. package/dist/shared/diagnostics.d.ts.map +1 -0
  177. package/dist/shared/diagnostics.js +57 -0
  178. package/dist/shared/errors.d.ts +2 -0
  179. package/dist/shared/errors.d.ts.map +1 -1
  180. package/dist/shared/errors.js +2 -0
  181. package/dist/shared/repo-cli-version.d.ts +13 -0
  182. package/dist/shared/repo-cli-version.d.ts.map +1 -0
  183. package/dist/shared/repo-cli-version.js +63 -0
  184. package/dist/shared/runtime-source.d.ts +33 -0
  185. package/dist/shared/runtime-source.d.ts.map +1 -0
  186. package/dist/shared/runtime-source.js +156 -0
  187. package/dist/shared/version-compare.d.ts +7 -0
  188. package/dist/shared/version-compare.d.ts.map +1 -0
  189. package/dist/shared/version-compare.js +30 -0
  190. package/package.json +2 -2
@@ -0,0 +1,63 @@
1
+ import { compareVersions } from "./version-compare.js";
2
+ export function getRepoExpectedCliVersion(config) {
3
+ const raw = config.framework.cli.expected_version;
4
+ if (typeof raw !== "string")
5
+ return null;
6
+ const trimmed = raw.trim();
7
+ return trimmed.length > 0 ? trimmed : null;
8
+ }
9
+ function buildRecovery(runtime, expectedVersion) {
10
+ switch (runtime.mode) {
11
+ case "global-installed": {
12
+ return `Run: npm i -g agentplane@${expectedVersion}`;
13
+ }
14
+ case "global-in-framework":
15
+ case "global-forced-in-framework": {
16
+ return "Run: scripts/reinstall-global-agentplane.sh";
17
+ }
18
+ case "repo-local":
19
+ case "repo-local-handoff": {
20
+ return (`Sync this framework checkout to agentplane ${expectedVersion} or lower ` +
21
+ "framework.cli.expected_version if the repository intentionally targets an older CLI.");
22
+ }
23
+ }
24
+ }
25
+ export function evaluateRepoCliVersionExpectation(config, runtime) {
26
+ const expectedVersion = getRepoExpectedCliVersion(config);
27
+ const activeVersion = runtime.agentplane.version?.trim() ?? null;
28
+ if (!expectedVersion) {
29
+ return {
30
+ expectedVersion: null,
31
+ activeVersion,
32
+ state: "unconfigured",
33
+ summary: null,
34
+ recovery: null,
35
+ };
36
+ }
37
+ if (!activeVersion) {
38
+ return {
39
+ expectedVersion,
40
+ activeVersion: null,
41
+ state: "active_version_unresolved",
42
+ summary: `Repository expects agentplane ${expectedVersion}, but the active runtime version could not be resolved.`,
43
+ recovery: buildRecovery(runtime, expectedVersion),
44
+ };
45
+ }
46
+ if (compareVersions(activeVersion, expectedVersion) < 0) {
47
+ return {
48
+ expectedVersion,
49
+ activeVersion,
50
+ state: "older_than_expected",
51
+ summary: `Repository expects agentplane ${expectedVersion}, but the active runtime resolves ${activeVersion}.`,
52
+ recovery: buildRecovery(runtime, expectedVersion),
53
+ };
54
+ }
55
+ const relation = compareVersions(activeVersion, expectedVersion) === 0 ? "matches" : "is newer than";
56
+ return {
57
+ expectedVersion,
58
+ activeVersion,
59
+ state: "satisfied",
60
+ summary: `Active runtime ${activeVersion} ${relation} the repository expectation ${expectedVersion}.`,
61
+ recovery: null,
62
+ };
63
+ }
@@ -0,0 +1,33 @@
1
+ import { type FrameworkBinaryContext } from "../../bin/runtime-context.js";
2
+ export type RuntimeMode = "global-installed" | "global-in-framework" | "global-forced-in-framework" | "repo-local" | "repo-local-handoff";
3
+ export type ResolvedPackageInfo = {
4
+ name: string;
5
+ version: string | null;
6
+ packageRoot: string | null;
7
+ packageJsonPath: string | null;
8
+ };
9
+ export type RuntimeSourceInfo = {
10
+ cwd: string;
11
+ activeBinaryPath: string | null;
12
+ handoffFromBinaryPath: string | null;
13
+ mode: RuntimeMode;
14
+ framework: FrameworkBinaryContext;
15
+ frameworkSources: {
16
+ repoRoot: string | null;
17
+ agentplaneRoot: string | null;
18
+ coreRoot: string | null;
19
+ };
20
+ agentplane: ResolvedPackageInfo;
21
+ core: ResolvedPackageInfo;
22
+ };
23
+ export type ResolveRuntimeSourceInfoOptions = {
24
+ cwd?: string;
25
+ env?: NodeJS.ProcessEnv;
26
+ activeBinaryPath?: string | null;
27
+ entryModuleUrl?: string;
28
+ agentplanePackageRoot?: string | null;
29
+ corePackageJsonPath?: string | null;
30
+ };
31
+ export declare function describeRuntimeMode(mode: RuntimeMode): string;
32
+ export declare function resolveRuntimeSourceInfo(options?: ResolveRuntimeSourceInfoOptions): RuntimeSourceInfo;
33
+ //# sourceMappingURL=runtime-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-source.d.ts","sourceRoot":"","sources":["../../src/shared/runtime-source.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;AAOtC,MAAM,MAAM,WAAW,GACnB,kBAAkB,GAClB,qBAAqB,GACrB,4BAA4B,GAC5B,YAAY,GACZ,oBAAoB,CAAC;AAEzB,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,sBAAsB,CAAC;IAClC,gBAAgB,EAAE;QAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,UAAU,EAAE,mBAAmB,CAAC;IAChC,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC,CAAC;AAuHF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAQ7D;AAED,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,+BAAoC,GAC5C,iBAAiB,CAiCnB"}
@@ -0,0 +1,156 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { createRequire } from "node:module";
4
+ import { fileURLToPath } from "node:url";
5
+ import { resolveFrameworkBinaryContext, } from "../../bin/runtime-context.js";
6
+ const ACTIVE_BIN_ENV = "AGENTPLANE_RUNTIME_ACTIVE_BIN";
7
+ const HANDOFF_FROM_ENV = "AGENTPLANE_RUNTIME_HANDOFF_FROM";
8
+ const HANDOFF_FLAG_ENV = "AGENTPLANE_REPO_LOCAL_HANDOFF";
9
+ const FORCE_GLOBAL_ENV = "AGENTPLANE_USE_GLOBAL_IN_FRAMEWORK";
10
+ function pathExists(absPath) {
11
+ try {
12
+ fs.accessSync(absPath);
13
+ return true;
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ }
19
+ function readJsonFile(absPath) {
20
+ try {
21
+ return JSON.parse(fs.readFileSync(absPath, "utf8"));
22
+ }
23
+ catch {
24
+ return null;
25
+ }
26
+ }
27
+ function resolvePackageInfo(packageJsonPath) {
28
+ if (!packageJsonPath) {
29
+ return {
30
+ name: "unknown",
31
+ version: null,
32
+ packageRoot: null,
33
+ packageJsonPath: null,
34
+ };
35
+ }
36
+ const parsed = readJsonFile(packageJsonPath);
37
+ return {
38
+ name: typeof parsed?.name === "string" ? parsed.name : path.basename(path.dirname(packageJsonPath)),
39
+ version: typeof parsed?.version === "string" ? parsed.version : null,
40
+ packageRoot: path.dirname(packageJsonPath),
41
+ packageJsonPath,
42
+ };
43
+ }
44
+ function findPackageRoot(startPath, expectedName) {
45
+ let dir = path.resolve(startPath);
46
+ if (path.extname(dir))
47
+ dir = path.dirname(dir);
48
+ for (;;) {
49
+ const packageJsonPath = path.join(dir, "package.json");
50
+ if (pathExists(packageJsonPath)) {
51
+ if (!expectedName)
52
+ return dir;
53
+ const parsed = readJsonFile(packageJsonPath);
54
+ if (parsed?.name === expectedName)
55
+ return dir;
56
+ }
57
+ const parent = path.dirname(dir);
58
+ if (parent === dir)
59
+ return null;
60
+ dir = parent;
61
+ }
62
+ }
63
+ function resolveAgentplanePackageInfo(options) {
64
+ const explicitRoot = options.agentplanePackageRoot
65
+ ? path.resolve(options.agentplanePackageRoot)
66
+ : null;
67
+ const entryModuleUrl = options.entryModuleUrl ?? import.meta.url;
68
+ const inferredRoot = explicitRoot ??
69
+ findPackageRoot(fileURLToPath(entryModuleUrl), "agentplane") ??
70
+ findPackageRoot(fileURLToPath(entryModuleUrl));
71
+ if (!inferredRoot) {
72
+ return { name: "agentplane", version: null, packageRoot: null, packageJsonPath: null };
73
+ }
74
+ return resolvePackageInfo(path.join(inferredRoot, "package.json"));
75
+ }
76
+ function resolveCorePackageInfo(options) {
77
+ if (options.corePackageJsonPath) {
78
+ return resolvePackageInfo(path.resolve(options.corePackageJsonPath));
79
+ }
80
+ try {
81
+ const req = createRequire(options.entryModuleUrl ?? import.meta.url);
82
+ const entryPath = req.resolve("@agentplaneorg/core");
83
+ const packageRoot = findPackageRoot(entryPath, "@agentplaneorg/core");
84
+ return resolvePackageInfo(packageRoot ? path.join(packageRoot, "package.json") : null);
85
+ }
86
+ catch {
87
+ return { name: "@agentplaneorg/core", version: null, packageRoot: null, packageJsonPath: null };
88
+ }
89
+ }
90
+ function normalizePath(value) {
91
+ const trimmed = String(value ?? "").trim();
92
+ return trimmed.length > 0 ? path.resolve(trimmed) : null;
93
+ }
94
+ function inferRuntimeMode(context, env) {
95
+ const handoff = (env[HANDOFF_FLAG_ENV] ?? "").trim() === "1";
96
+ const handoffFrom = normalizePath(env[HANDOFF_FROM_ENV]);
97
+ if (handoff && handoffFrom && context.inFrameworkCheckout && context.isRepoLocalRuntime) {
98
+ return "repo-local-handoff";
99
+ }
100
+ if (context.inFrameworkCheckout && context.isRepoLocalRuntime) {
101
+ return "repo-local";
102
+ }
103
+ if (context.inFrameworkCheckout && (env[FORCE_GLOBAL_ENV] ?? "").trim() === "1") {
104
+ return "global-forced-in-framework";
105
+ }
106
+ if (context.inFrameworkCheckout) {
107
+ return "global-in-framework";
108
+ }
109
+ return "global-installed";
110
+ }
111
+ function resolveFrameworkCoreRoot(repoRoot) {
112
+ if (!repoRoot)
113
+ return null;
114
+ const coreRoot = path.join(repoRoot, "packages", "core");
115
+ return pathExists(path.join(coreRoot, "package.json")) ? coreRoot : null;
116
+ }
117
+ export function describeRuntimeMode(mode) {
118
+ return {
119
+ "repo-local-handoff": "repo-local binary reached via handoff from a global install",
120
+ "repo-local": "repo-local framework binary",
121
+ "global-forced-in-framework": "global installed binary forced inside a framework checkout",
122
+ "global-in-framework": "global installed binary running inside a framework checkout",
123
+ "global-installed": "global installed binary",
124
+ }[mode];
125
+ }
126
+ export function resolveRuntimeSourceInfo(options = {}) {
127
+ const cwd = path.resolve(options.cwd ?? process.cwd());
128
+ const env = options.env ?? process.env;
129
+ const agentplane = resolveAgentplanePackageInfo(options);
130
+ const core = resolveCorePackageInfo(options);
131
+ const fallbackBin = agentplane.packageRoot === null
132
+ ? null
133
+ : path.join(agentplane.packageRoot, "bin", "agentplane.js");
134
+ const activeBinaryPath = normalizePath(options.activeBinaryPath) ??
135
+ normalizePath(env[ACTIVE_BIN_ENV]) ??
136
+ normalizePath(process.argv[1]) ??
137
+ normalizePath(fallbackBin);
138
+ const framework = resolveFrameworkBinaryContext({
139
+ cwd,
140
+ thisBin: activeBinaryPath ?? fallbackBin ?? cwd,
141
+ });
142
+ return {
143
+ cwd,
144
+ activeBinaryPath,
145
+ handoffFromBinaryPath: normalizePath(env[HANDOFF_FROM_ENV]),
146
+ mode: inferRuntimeMode(framework, env),
147
+ framework,
148
+ frameworkSources: {
149
+ repoRoot: framework.checkout?.repoRoot ?? null,
150
+ agentplaneRoot: framework.checkout?.packageRoot ?? agentplane.packageRoot,
151
+ coreRoot: resolveFrameworkCoreRoot(framework.checkout?.repoRoot ?? null),
152
+ },
153
+ agentplane,
154
+ core,
155
+ };
156
+ }
@@ -0,0 +1,7 @@
1
+ export type ParsedVersionParts = {
2
+ main: number[];
3
+ prerelease: string | null;
4
+ };
5
+ export declare function parseVersionParts(version: string): ParsedVersionParts;
6
+ export declare function compareVersions(left: string, right: string): number;
7
+ //# sourceMappingURL=version-compare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-compare.d.ts","sourceRoot":"","sources":["../../src/shared/version-compare.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAWrE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAanE"}
@@ -0,0 +1,30 @@
1
+ export function parseVersionParts(version) {
2
+ const cleaned = version.trim().replace(/^v/i, "").split("+")[0] ?? "";
3
+ const [mainRaw, prereleaseRaw] = cleaned.split("-", 2);
4
+ const main = (mainRaw ?? "")
5
+ .split(".")
6
+ .filter((part) => part.length > 0)
7
+ .map((part) => {
8
+ const parsed = Number.parseInt(part, 10);
9
+ return Number.isFinite(parsed) ? parsed : 0;
10
+ });
11
+ return { main, prerelease: prereleaseRaw ? prereleaseRaw.trim() : null };
12
+ }
13
+ export function compareVersions(left, right) {
14
+ const a = parseVersionParts(left);
15
+ const b = parseVersionParts(right);
16
+ const length = Math.max(a.main.length, b.main.length);
17
+ for (let i = 0; i < length; i++) {
18
+ const partA = a.main[i] ?? 0;
19
+ const partB = b.main[i] ?? 0;
20
+ if (partA !== partB)
21
+ return partA > partB ? 1 : -1;
22
+ }
23
+ if (a.prerelease === b.prerelease)
24
+ return 0;
25
+ if (a.prerelease === null)
26
+ return 1;
27
+ if (b.prerelease === null)
28
+ return -1;
29
+ return a.prerelease.localeCompare(b.prerelease);
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentplane",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Agent Plane CLI for task workflows, recipes, and project automation.",
5
5
  "keywords": [
6
6
  "agentplane",
@@ -55,7 +55,7 @@
55
55
  "prepublishOnly": "node ../../scripts/enforce-github-publish.mjs && npm run prepack"
56
56
  },
57
57
  "dependencies": {
58
- "@agentplaneorg/core": "0.3.2",
58
+ "@agentplaneorg/core": "0.3.3",
59
59
  "yauzl": "^2.10.0"
60
60
  },
61
61
  "devDependencies": {