agentplane 0.3.5 → 0.3.7
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.
- package/README.md +103 -75
- package/assets/AGENTS.md +4 -2
- package/bin/dist-guard.js +13 -3
- package/bin/runtime-watch.d.ts +1 -0
- package/bin/runtime-watch.js +22 -5
- package/bin/stale-dist-policy.js +9 -2
- package/dist/.build-manifest.json +251 -821
- package/dist/adapters/task-backend/task-backend-adapter.d.ts +2 -2
- package/dist/adapters/task-backend/task-backend-adapter.d.ts.map +1 -1
- package/dist/adapters/task-backend/task-backend-adapter.js +2 -2
- package/dist/backends/task-backend/local-backend.d.ts +7 -5
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend.js +79 -7
- package/dist/backends/task-backend/redmine/env.d.ts +1 -1
- package/dist/backends/task-backend/redmine/env.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/env.js +3 -0
- package/dist/backends/task-backend/redmine/inspect.d.ts +11 -0
- package/dist/backends/task-backend/redmine/inspect.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/inspect.js +75 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/mapping.js +21 -2
- package/dist/backends/task-backend/redmine/state.d.ts +17 -0
- package/dist/backends/task-backend/redmine/state.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/state.js +95 -0
- package/dist/backends/task-backend/redmine-backend.d.ts +10 -16
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +205 -15
- package/dist/backends/task-backend/shared/constants.d.ts +1 -1
- package/dist/backends/task-backend/shared/constants.js +1 -1
- package/dist/backends/task-backend/shared/record.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/record.js +20 -1
- package/dist/backends/task-backend/shared/types.d.ts +42 -4
- package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
- package/dist/backends/task-backend/shared.d.ts +1 -1
- package/dist/backends/task-backend/shared.d.ts.map +1 -1
- package/dist/backends/task-backend.d.ts +1 -1
- package/dist/backends/task-backend.d.ts.map +1 -1
- package/dist/backends/task-backend.test-helpers.d.ts +4 -0
- package/dist/backends/task-backend.test-helpers.d.ts.map +1 -0
- package/dist/backends/task-backend.test-helpers.js +33 -0
- package/dist/backends/task-index.d.ts.map +1 -1
- package/dist/backends/task-index.js +1 -0
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +1 -0
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +3 -2
- package/dist/cli/reason-codes.d.ts.map +1 -1
- package/dist/cli/reason-codes.js +30 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts +3 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -0
- package/dist/cli/run-cli/command-catalog/core.js +137 -0
- package/dist/cli/run-cli/command-catalog/lifecycle.d.ts +3 -0
- package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -0
- package/dist/cli/run-cli/command-catalog/lifecycle.js +52 -0
- package/dist/cli/run-cli/command-catalog/project.d.ts +3 -0
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -0
- package/dist/cli/run-cli/command-catalog/project.js +80 -0
- package/dist/cli/run-cli/command-catalog/shared.d.ts +19 -0
- package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -0
- package/dist/cli/run-cli/command-catalog/shared.js +9 -0
- package/dist/cli/run-cli/command-catalog/task.d.ts +3 -0
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -0
- package/dist/cli/run-cli/command-catalog/task.js +85 -0
- package/dist/cli/run-cli/command-catalog.d.ts +3 -18
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog.js +8 -337
- package/dist/cli/run-cli/commands/ide.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/ide.js +64 -2
- package/dist/cli/run-cli/commands/init/ui.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/ui.js +33 -13
- package/dist/cli/run-cli/commands/init/write-env.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/write-env.js +12 -0
- package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts +3 -0
- package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts.map +1 -0
- package/dist/cli/run-cli.core.pr-flow.test-helpers.js +41 -0
- package/dist/cli/run-cli.core.tasks.test-helpers.d.ts +2 -0
- package/dist/cli/run-cli.core.tasks.test-helpers.d.ts.map +1 -0
- package/dist/cli/run-cli.core.tasks.test-helpers.js +6 -0
- package/dist/cli/run-cli.test-helpers.d.ts +3 -0
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +140 -6
- package/dist/commands/backend/sync.command.d.ts +5 -1
- package/dist/commands/backend/sync.command.d.ts.map +1 -1
- package/dist/commands/backend/sync.command.js +67 -3
- package/dist/commands/backend.d.ts +22 -0
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +110 -1
- package/dist/commands/commit.spec.d.ts.map +1 -1
- package/dist/commands/commit.spec.js +31 -7
- package/dist/commands/doctor/runtime.d.ts.map +1 -1
- package/dist/commands/doctor/runtime.js +3 -6
- package/dist/commands/doctor/workspace.d.ts +8 -0
- package/dist/commands/doctor/workspace.d.ts.map +1 -1
- package/dist/commands/doctor/workspace.js +127 -3
- package/dist/commands/guard/commit.command.d.ts.map +1 -1
- package/dist/commands/guard/commit.command.js +30 -6
- package/dist/commands/guard/impl/allow.d.ts +9 -0
- package/dist/commands/guard/impl/allow.d.ts.map +1 -1
- package/dist/commands/guard/impl/allow.js +26 -10
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +146 -18
- package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -1
- package/dist/commands/guard/impl/comment-commit.js +2 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +8 -35
- package/dist/commands/recipes/impl/apply.d.ts +4 -0
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
- package/dist/commands/recipes/impl/apply.js +34 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/explain.js +70 -11
- package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/info.js +24 -12
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +32 -36
- package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list.js +7 -4
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/remove.js +9 -11
- package/dist/commands/recipes/impl/constants.d.ts +2 -0
- package/dist/commands/recipes/impl/constants.d.ts.map +1 -1
- package/dist/commands/recipes/impl/constants.js +2 -0
- package/dist/commands/recipes/impl/manifest.d.ts.map +1 -1
- package/dist/commands/recipes/impl/manifest.js +219 -23
- package/dist/commands/recipes/impl/normalize.d.ts +3 -0
- package/dist/commands/recipes/impl/normalize.d.ts.map +1 -1
- package/dist/commands/recipes/impl/normalize.js +28 -24
- package/dist/commands/recipes/impl/paths.d.ts +9 -0
- package/dist/commands/recipes/impl/paths.d.ts.map +1 -1
- package/dist/commands/recipes/impl/paths.js +10 -1
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts +7 -0
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project-installed-recipes.js +102 -0
- package/dist/commands/recipes/impl/resolver.d.ts +20 -0
- package/dist/commands/recipes/impl/resolver.d.ts.map +1 -0
- package/dist/commands/recipes/impl/resolver.js +220 -0
- package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
- package/dist/commands/recipes/impl/scenario.js +40 -11
- package/dist/commands/recipes/impl/types.d.ts +145 -16
- package/dist/commands/recipes/impl/types.d.ts.map +1 -1
- package/dist/commands/recipes/install.spec.d.ts.map +1 -1
- package/dist/commands/recipes/install.spec.js +3 -2
- package/dist/commands/recipes.d.ts +6 -4
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +5 -3
- package/dist/commands/recipes.test-helpers.d.ts +185 -0
- package/dist/commands/recipes.test-helpers.d.ts.map +1 -0
- package/dist/commands/recipes.test-helpers.js +339 -0
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
- package/dist/commands/scenario/impl/commands.js +192 -336
- package/dist/commands/scenario/info.command.d.ts.map +1 -1
- package/dist/commands/scenario/info.command.js +7 -2
- package/dist/commands/scenario/list.command.js +2 -2
- package/dist/commands/scenario/run.command.d.ts.map +1 -1
- package/dist/commands/scenario/run.command.js +7 -2
- package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
- package/dist/commands/shared/reconcile-check.js +77 -2
- package/dist/commands/shared/task-backend.d.ts +1 -1
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +9 -0
- package/dist/commands/shared/task-store.d.ts +92 -2
- package/dist/commands/shared/task-store.d.ts.map +1 -1
- package/dist/commands/shared/task-store.js +405 -43
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +84 -46
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +12 -37
- package/dist/commands/task/close-noop.d.ts.map +1 -1
- package/dist/commands/task/close-noop.js +12 -30
- package/dist/commands/task/close-shared.d.ts +14 -0
- package/dist/commands/task/close-shared.d.ts.map +1 -0
- package/dist/commands/task/close-shared.js +73 -0
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +34 -21
- package/dist/commands/task/derive.command.d.ts +1 -0
- package/dist/commands/task/derive.command.d.ts.map +1 -1
- package/dist/commands/task/derive.command.js +15 -2
- package/dist/commands/task/derive.d.ts +1 -0
- package/dist/commands/task/derive.d.ts.map +1 -1
- package/dist/commands/task/derive.js +27 -4
- package/dist/commands/task/doc-set.command.d.ts +2 -1
- package/dist/commands/task/doc-set.command.d.ts.map +1 -1
- package/dist/commands/task/doc-set.command.js +36 -4
- package/dist/commands/task/doc-template.d.ts.map +1 -1
- package/dist/commands/task/doc-template.js +2 -7
- package/dist/commands/task/doc.command.js +1 -1
- package/dist/commands/task/doc.d.ts +2 -1
- package/dist/commands/task/doc.d.ts.map +1 -1
- package/dist/commands/task/doc.js +139 -76
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +142 -80
- package/dist/commands/task/migrate-doc.d.ts +15 -0
- package/dist/commands/task/migrate-doc.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.js +128 -43
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +3 -1
- package/dist/commands/task/plan-set.command.js +1 -1
- package/dist/commands/task/plan.command.d.ts +8 -0
- package/dist/commands/task/plan.command.d.ts.map +1 -0
- package/dist/commands/task/plan.command.js +37 -0
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +198 -101
- package/dist/commands/task/set-status.command.d.ts.map +1 -1
- package/dist/commands/task/set-status.command.js +1 -1
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +115 -35
- package/dist/commands/task/shared/dependencies.d.ts +1 -0
- package/dist/commands/task/shared/dependencies.d.ts.map +1 -1
- package/dist/commands/task/shared/dependencies.js +10 -0
- package/dist/commands/task/shared/docs.d.ts +1 -0
- package/dist/commands/task/shared/docs.d.ts.map +1 -1
- package/dist/commands/task/shared/docs.js +8 -1
- package/dist/commands/task/shared/transitions.d.ts +17 -2
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +20 -13
- package/dist/commands/task/shared.d.ts +3 -3
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +3 -3
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +101 -71
- package/dist/commands/task/task.command.d.ts +8 -0
- package/dist/commands/task/task.command.d.ts.map +1 -0
- package/dist/commands/task/task.command.js +71 -0
- package/dist/commands/task/verify-command-shared.d.ts +16 -0
- package/dist/commands/task/verify-command-shared.d.ts.map +1 -0
- package/dist/commands/task/verify-command-shared.js +53 -0
- package/dist/commands/task/verify-ok.command.d.ts +2 -6
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
- package/dist/commands/task/verify-ok.command.js +8 -50
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +124 -145
- package/dist/commands/task/verify-rework.command.d.ts +2 -6
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
- package/dist/commands/task/verify-rework.command.js +8 -50
- package/dist/commands/upgrade/apply.d.ts +2 -0
- package/dist/commands/upgrade/apply.d.ts.map +1 -1
- package/dist/commands/upgrade/apply.js +33 -1
- package/dist/commands/upgrade.command.d.ts.map +1 -1
- package/dist/commands/upgrade.command.js +25 -0
- package/dist/commands/upgrade.d.ts +1 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +34 -0
- package/dist/commands/verify.spec.d.ts.map +1 -1
- package/dist/commands/verify.spec.js +3 -12
- package/dist/policy/rules/allowlist.d.ts.map +1 -1
- package/dist/policy/rules/allowlist.js +16 -4
- package/dist/policy/rules/protected-paths.d.ts.map +1 -1
- package/dist/policy/rules/protected-paths.js +6 -1
- package/dist/ports/task-backend-port.d.ts +2 -2
- package/dist/ports/task-backend-port.d.ts.map +1 -1
- package/dist/shared/agent-emoji.d.ts.map +1 -1
- package/dist/shared/protected-paths.d.ts +17 -0
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +59 -10
- package/dist/shared/repo-cli-version.d.ts.map +1 -1
- package/dist/shared/repo-cli-version.js +9 -3
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
2
|
+
import { withDiagnosticContext } from "../../shared/diagnostics.js";
|
|
2
3
|
import { CliError } from "../../shared/errors.js";
|
|
3
4
|
import { listTasksMemo } from "./task-backend.js";
|
|
4
5
|
function compactError(err) {
|
|
@@ -8,11 +9,85 @@ function compactError(err) {
|
|
|
8
9
|
}
|
|
9
10
|
return String(err);
|
|
10
11
|
}
|
|
12
|
+
function parseTaskScanWarning(raw) {
|
|
13
|
+
const trimmed = raw.trim();
|
|
14
|
+
const match = /^skip:([^:]+):\s*(.+)$/.exec(trimmed);
|
|
15
|
+
if (!match) {
|
|
16
|
+
return { raw: trimmed, taskId: null, kind: null };
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
raw: trimmed,
|
|
20
|
+
taskId: match[1]?.trim() || null,
|
|
21
|
+
kind: match[2]?.trim() || null,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function describePrimaryWarning(warning) {
|
|
25
|
+
const subject = warning.taskId ? `task README for ${warning.taskId}` : "a task README";
|
|
26
|
+
switch (warning.kind) {
|
|
27
|
+
case "invalid_readme_frontmatter": {
|
|
28
|
+
return {
|
|
29
|
+
summary: `${subject} has invalid frontmatter and could not be parsed`,
|
|
30
|
+
likelyCause: `${subject} has invalid frontmatter, so reconcile skipped it before the mutating command could run`,
|
|
31
|
+
hint: "Fix the malformed task README frontmatter, then rerun the mutating command.",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
case "empty_or_invalid_frontmatter": {
|
|
35
|
+
return {
|
|
36
|
+
summary: `${subject} has empty or invalid frontmatter and could not be parsed`,
|
|
37
|
+
likelyCause: `${subject} is missing required frontmatter fields, so reconcile skipped it before the mutating command could run`,
|
|
38
|
+
hint: "Restore valid task README frontmatter, then rerun the mutating command.",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
case "unreadable_readme":
|
|
42
|
+
case "missing_or_unreadable_readme": {
|
|
43
|
+
return {
|
|
44
|
+
summary: `${subject} could not be read during task scan`,
|
|
45
|
+
likelyCause: `${subject} is missing or unreadable, so reconcile skipped it before the mutating command could run`,
|
|
46
|
+
hint: "Restore or fix the task README file, then rerun the mutating command.",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
default: {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
11
54
|
function summarizeWarnings(warnings) {
|
|
55
|
+
const primary = describePrimaryWarning(parseTaskScanWarning(warnings[0] ?? ""));
|
|
56
|
+
if (primary) {
|
|
57
|
+
const extra = warnings.length - 1;
|
|
58
|
+
if (extra <= 0)
|
|
59
|
+
return primary.summary;
|
|
60
|
+
return `${primary.summary}; +${extra} more task scan warning${extra === 1 ? "" : "s"}`;
|
|
61
|
+
}
|
|
12
62
|
const preview = warnings.slice(0, 3).join("; ");
|
|
13
63
|
const suffix = warnings.length > 3 ? `; +${warnings.length - 3} more` : "";
|
|
14
64
|
return `skipped ${warnings.length} task files during scan (${preview}${suffix})`;
|
|
15
65
|
}
|
|
66
|
+
function buildWarningDiagnostic(warnings) {
|
|
67
|
+
const primary = describePrimaryWarning(parseTaskScanWarning(warnings[0] ?? ""));
|
|
68
|
+
if (primary) {
|
|
69
|
+
return {
|
|
70
|
+
state: "mutation preflight cannot reconcile task artifacts",
|
|
71
|
+
likelyCause: primary.likelyCause,
|
|
72
|
+
hint: primary.hint,
|
|
73
|
+
nextAction: {
|
|
74
|
+
command: "agentplane task list --strict-read",
|
|
75
|
+
reason: "surface the malformed or unreadable task README before retrying mutating commands",
|
|
76
|
+
reasonCode: "reconcile_task_scan_incomplete",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
state: "mutation preflight found skipped task artifacts",
|
|
82
|
+
likelyCause: "task scan skipped one or more task artifacts due to parse/read warnings, so the mutating command stopped before touching git state",
|
|
83
|
+
hint: "Reconcile check failed due to task scan drift or parse/read errors.",
|
|
84
|
+
nextAction: {
|
|
85
|
+
command: "agentplane task list --strict-read",
|
|
86
|
+
reason: "surface task scan/read failures before retrying mutating commands",
|
|
87
|
+
reasonCode: "reconcile_task_scan_incomplete",
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
16
91
|
export async function ensureReconciledBeforeMutation(opts) {
|
|
17
92
|
try {
|
|
18
93
|
await opts.ctx.git.statusChangedPaths();
|
|
@@ -51,10 +126,10 @@ export async function ensureReconciledBeforeMutation(opts) {
|
|
|
51
126
|
exitCode: exitCodeForError("E_VALIDATION"),
|
|
52
127
|
code: "E_VALIDATION",
|
|
53
128
|
message: `reconcile check failed: ${summarizeWarnings(warnings)}`,
|
|
54
|
-
context: {
|
|
129
|
+
context: withDiagnosticContext({
|
|
55
130
|
command: opts.command,
|
|
56
131
|
reason_code: "reconcile_task_scan_incomplete",
|
|
57
132
|
warning_count: warnings.length,
|
|
58
|
-
},
|
|
133
|
+
}, buildWarningDiagnostic(warnings)),
|
|
59
134
|
});
|
|
60
135
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AgentplaneConfig, type ResolvedProject } from "@agentplaneorg/core";
|
|
2
2
|
import { loadTaskBackend, type TaskData } from "../../backends/task-backend.js";
|
|
3
3
|
import { GitContext } from "./git-context.js";
|
|
4
4
|
export type CommandMemo = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-backend.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-backend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"task-backend.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-backend.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAA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,CAAC,EAAE,gBAAgB,CAAC;CAC3B,GAAG,OAAO,CAAC,cAAc,CAAC,CAmB1B;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAepB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAC5C,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC,CAaD;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAG5E;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAQxF;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE;IACvD,GAAG,EAAE,cAAc,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAchB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { taskDocToSectionMap, } from "@agentplaneorg/core";
|
|
2
3
|
import { CliError } from "../../shared/errors.js";
|
|
3
4
|
import { loadTaskBackend } from "../../backends/task-backend.js";
|
|
4
5
|
import { GitContext } from "./git-context.js";
|
|
@@ -24,6 +25,12 @@ export function taskDataToFrontmatter(task) {
|
|
|
24
25
|
{ state: "pending", updated_at: null, updated_by: null, note: null };
|
|
25
26
|
const verification = task.verification ??
|
|
26
27
|
{ state: "pending", updated_at: null, updated_by: null, note: null };
|
|
28
|
+
const revision = Number.isInteger(task.revision) && Number(task.revision) > 0 ? Number(task.revision) : 1;
|
|
29
|
+
const sections = task.doc === undefined
|
|
30
|
+
? task.sections && Object.keys(task.sections).length > 0
|
|
31
|
+
? task.sections
|
|
32
|
+
: undefined
|
|
33
|
+
: taskDocToSectionMap(task.doc);
|
|
27
34
|
return {
|
|
28
35
|
id: task.id,
|
|
29
36
|
title: task.title,
|
|
@@ -33,6 +40,7 @@ export function taskDataToFrontmatter(task) {
|
|
|
33
40
|
status: task.status,
|
|
34
41
|
priority: task.priority,
|
|
35
42
|
owner: task.owner,
|
|
43
|
+
revision,
|
|
36
44
|
depends_on: task.depends_on ?? [],
|
|
37
45
|
tags: task.tags ?? [],
|
|
38
46
|
verify: task.verify ?? [],
|
|
@@ -45,6 +53,7 @@ export function taskDataToFrontmatter(task) {
|
|
|
45
53
|
doc_updated_at: task.doc_updated_at,
|
|
46
54
|
doc_updated_by: task.doc_updated_by,
|
|
47
55
|
description: task.description ?? "",
|
|
56
|
+
sections,
|
|
48
57
|
id_source: task.id_source,
|
|
49
58
|
dirty: task.dirty,
|
|
50
59
|
};
|
|
@@ -1,16 +1,106 @@
|
|
|
1
|
-
import { type TaskData } from "../../backends/task-backend.js";
|
|
1
|
+
import { type TaskData, type TaskEvent } from "../../backends/task-backend.js";
|
|
2
2
|
import { type CommandContext } from "./task-backend.js";
|
|
3
|
+
type TaskComment = NonNullable<TaskData["comments"]>[number];
|
|
4
|
+
export type TaskStoreTaskPatch = Partial<Omit<TaskData, "doc" | "comments" | "events" | "doc_version" | "doc_updated_at" | "doc_updated_by">>;
|
|
5
|
+
export type TaskStoreDocPatch = {
|
|
6
|
+
kind: "replace-doc";
|
|
7
|
+
doc: string;
|
|
8
|
+
expectedCurrentDoc?: string | null;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "set-section";
|
|
11
|
+
section: string;
|
|
12
|
+
text: string;
|
|
13
|
+
requiredSections: string[];
|
|
14
|
+
expectedCurrentText?: string | null;
|
|
15
|
+
};
|
|
16
|
+
export type TaskStorePatch = {
|
|
17
|
+
task?: TaskStoreTaskPatch;
|
|
18
|
+
appendComments?: TaskComment[];
|
|
19
|
+
appendEvents?: TaskEvent[];
|
|
20
|
+
doc?: TaskStoreDocPatch;
|
|
21
|
+
docMeta?: {
|
|
22
|
+
touch?: boolean;
|
|
23
|
+
updatedBy?: string;
|
|
24
|
+
version?: 2 | 3;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type TaskStoreIntent = {
|
|
28
|
+
kind: "set-task-fields";
|
|
29
|
+
task: TaskStoreTaskPatch;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "append-comments";
|
|
32
|
+
comments: TaskComment[];
|
|
33
|
+
} | {
|
|
34
|
+
kind: "append-events";
|
|
35
|
+
events: TaskEvent[];
|
|
36
|
+
} | {
|
|
37
|
+
kind: "replace-doc";
|
|
38
|
+
doc: string;
|
|
39
|
+
expectedCurrentDoc?: string | null;
|
|
40
|
+
} | {
|
|
41
|
+
kind: "set-section";
|
|
42
|
+
section: string;
|
|
43
|
+
text: string;
|
|
44
|
+
requiredSections: string[];
|
|
45
|
+
expectedCurrentText?: string | null;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "touch-doc-meta";
|
|
48
|
+
updatedBy?: string;
|
|
49
|
+
version?: 2 | 3;
|
|
50
|
+
};
|
|
51
|
+
type TaskStoreIntentResult = TaskStoreIntent | readonly TaskStoreIntent[] | null | undefined;
|
|
52
|
+
export type TaskStoreMutationOptions = {
|
|
53
|
+
expectedRevision?: number;
|
|
54
|
+
};
|
|
55
|
+
export type TaskStoreLike = Pick<TaskStore, "patch"> & {
|
|
56
|
+
mutate?: TaskStore["mutate"];
|
|
57
|
+
};
|
|
58
|
+
export declare function setTaskFieldsIntent(task: TaskStoreTaskPatch): TaskStoreIntent;
|
|
59
|
+
export declare function appendTaskCommentsIntent(comments: TaskComment[]): TaskStoreIntent;
|
|
60
|
+
export declare function appendTaskCommentIntent(comment: TaskComment): TaskStoreIntent;
|
|
61
|
+
export declare function appendTaskEventsIntent(events: TaskEvent[]): TaskStoreIntent;
|
|
62
|
+
export declare function appendTaskEventIntent(event: TaskEvent): TaskStoreIntent;
|
|
63
|
+
export declare function replaceTaskDocIntent(opts: {
|
|
64
|
+
doc: string;
|
|
65
|
+
expectedCurrentDoc?: string | null;
|
|
66
|
+
}): TaskStoreIntent;
|
|
67
|
+
export declare function setTaskSectionIntent(opts: {
|
|
68
|
+
section: string;
|
|
69
|
+
text: string;
|
|
70
|
+
requiredSections: string[];
|
|
71
|
+
expectedCurrentText?: string | null;
|
|
72
|
+
}): TaskStoreIntent;
|
|
73
|
+
export declare function touchTaskDocMetaIntent(opts?: {
|
|
74
|
+
updatedBy?: string;
|
|
75
|
+
version?: 2 | 3;
|
|
76
|
+
}): TaskStoreIntent;
|
|
77
|
+
export declare function taskStorePatchFromIntents(intents: TaskStoreIntentResult): TaskStorePatch | null | undefined;
|
|
78
|
+
export declare function mutateTaskStore(store: TaskStoreLike, taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
|
|
79
|
+
changed: boolean;
|
|
80
|
+
task: TaskData;
|
|
81
|
+
}>;
|
|
3
82
|
export declare class TaskStore {
|
|
4
83
|
private ctx;
|
|
5
84
|
private cache;
|
|
6
85
|
constructor(ctx: CommandContext);
|
|
7
86
|
get(taskId: string): Promise<TaskData>;
|
|
8
87
|
private getCached;
|
|
9
|
-
update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData): Promise<{
|
|
88
|
+
update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData, opts?: TaskStoreMutationOptions): Promise<{
|
|
10
89
|
changed: boolean;
|
|
11
90
|
task: TaskData;
|
|
12
91
|
}>;
|
|
92
|
+
patch(taskId: string, builder: (current: TaskData) => Promise<TaskStorePatch | null | undefined> | TaskStorePatch | null | undefined, opts?: TaskStoreMutationOptions): Promise<{
|
|
93
|
+
changed: boolean;
|
|
94
|
+
task: TaskData;
|
|
95
|
+
}>;
|
|
96
|
+
mutate(taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
|
|
97
|
+
changed: boolean;
|
|
98
|
+
task: TaskData;
|
|
99
|
+
}>;
|
|
100
|
+
private runWithRetry;
|
|
101
|
+
private writeNextTask;
|
|
13
102
|
}
|
|
14
103
|
export declare function getTaskStore(ctx: CommandContext): TaskStore;
|
|
15
104
|
export declare function backendIsLocalFileBackend(ctx: CommandContext): boolean;
|
|
105
|
+
export {};
|
|
16
106
|
//# sourceMappingURL=task-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAC;AAIxC,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAUpG,KAAK,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,IAAI,CACF,QAAQ,EACR,KAAK,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,CACpF,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,aAAa,CA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