agentplane 0.1.6 → 0.1.8
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/assets/AGENTS.md +1 -1
- package/assets/agents/ORCHESTRATOR.json +1 -1
- package/assets/agents/UPGRADER.json +1 -1
- package/dist/backends/task-backend.d.ts +16 -0
- package/dist/backends/task-backend.d.ts.map +1 -1
- package/dist/backends/task-backend.js +44 -0
- package/dist/backends/task-index.d.ts.map +1 -1
- package/dist/backends/task-index.js +3 -6
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +4 -4
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +7 -5
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +39 -78
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +17 -2
- package/dist/commands/branch/index.d.ts +60 -0
- package/dist/commands/branch/index.d.ts.map +1 -0
- package/dist/commands/branch/index.js +513 -0
- package/dist/commands/guard/index.d.ts +67 -0
- package/dist/commands/guard/index.d.ts.map +1 -0
- package/dist/commands/guard/index.js +367 -0
- package/dist/commands/hooks/index.d.ts +18 -0
- package/dist/commands/hooks/index.d.ts.map +1 -0
- package/dist/commands/hooks/index.js +290 -0
- package/dist/commands/pr/index.d.ts +46 -0
- package/dist/commands/pr/index.d.ts.map +1 -0
- package/dist/commands/pr/index.js +857 -0
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +67 -23
- package/dist/commands/shared/git-diff.d.ts +9 -0
- package/dist/commands/shared/git-diff.d.ts.map +1 -0
- package/dist/commands/shared/git-diff.js +41 -0
- package/dist/commands/shared/git-ops.d.ts +24 -0
- package/dist/commands/shared/git-ops.d.ts.map +1 -0
- package/dist/commands/shared/git-ops.js +181 -0
- package/dist/commands/shared/git-worktree.d.ts +8 -0
- package/dist/commands/shared/git-worktree.d.ts.map +1 -0
- package/dist/commands/shared/git-worktree.js +48 -0
- package/dist/commands/shared/git.d.ts +4 -0
- package/dist/commands/shared/git.d.ts.map +1 -0
- package/dist/commands/shared/git.js +14 -0
- package/dist/commands/shared/network-approval.d.ts +8 -0
- package/dist/commands/shared/network-approval.d.ts.map +1 -0
- package/dist/commands/shared/network-approval.js +25 -0
- package/dist/commands/shared/path.d.ts +3 -0
- package/dist/commands/shared/path.d.ts.map +1 -0
- package/dist/commands/shared/path.js +14 -0
- package/dist/commands/shared/pr-meta.d.ts +21 -0
- package/dist/commands/shared/pr-meta.d.ts.map +1 -0
- package/dist/commands/shared/pr-meta.js +72 -0
- package/dist/commands/shared/task-backend.d.ts +15 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -0
- package/dist/commands/shared/task-backend.js +61 -0
- package/dist/commands/task/add.d.ts +8 -0
- package/dist/commands/task/add.d.ts.map +1 -0
- package/dist/commands/task/add.js +164 -0
- package/dist/commands/task/block.d.ts +19 -0
- package/dist/commands/task/block.d.ts.map +1 -0
- package/dist/commands/task/block.js +86 -0
- package/dist/commands/task/comment.d.ts +8 -0
- package/dist/commands/task/comment.d.ts.map +1 -0
- package/dist/commands/task/comment.js +29 -0
- package/dist/commands/task/doc.d.ts +17 -0
- package/dist/commands/task/doc.d.ts.map +1 -0
- package/dist/commands/task/doc.js +220 -0
- package/dist/commands/task/export.d.ts +5 -0
- package/dist/commands/task/export.d.ts.map +1 -0
- package/dist/commands/task/export.js +27 -0
- package/dist/commands/task/finish.d.ts +27 -0
- package/dist/commands/task/finish.d.ts.map +1 -0
- package/dist/commands/task/finish.js +132 -0
- package/dist/commands/task/index.d.ts +26 -0
- package/dist/commands/task/index.d.ts.map +1 -0
- package/dist/commands/task/index.js +25 -0
- package/dist/commands/task/lint.d.ts +5 -0
- package/dist/commands/task/lint.d.ts.map +1 -0
- package/dist/commands/task/lint.js +22 -0
- package/dist/commands/task/list.d.ts +11 -0
- package/dist/commands/task/list.d.ts.map +1 -0
- package/dist/commands/task/list.js +54 -0
- package/dist/commands/task/migrate-doc.d.ts +8 -0
- package/dist/commands/task/migrate-doc.d.ts.map +1 -0
- package/dist/commands/task/migrate-doc.js +147 -0
- package/dist/commands/task/migrate.d.ts +6 -0
- package/dist/commands/task/migrate.d.ts.map +1 -0
- package/dist/commands/task/migrate.js +70 -0
- package/dist/commands/task/new.d.ts +8 -0
- package/dist/commands/task/new.d.ts.map +1 -0
- package/dist/commands/task/new.js +117 -0
- package/dist/commands/task/next.d.ts +6 -0
- package/dist/commands/task/next.d.ts.map +1 -0
- package/dist/commands/task/next.js +45 -0
- package/dist/commands/task/normalize.d.ts +6 -0
- package/dist/commands/task/normalize.d.ts.map +1 -0
- package/dist/commands/task/normalize.js +46 -0
- package/dist/commands/task/plan.d.ts +14 -0
- package/dist/commands/task/plan.d.ts.map +1 -0
- package/dist/commands/task/plan.js +217 -0
- package/dist/commands/task/ready.d.ts +6 -0
- package/dist/commands/task/ready.d.ts.map +1 -0
- package/dist/commands/task/ready.js +57 -0
- package/dist/commands/task/scaffold.d.ts +8 -0
- package/dist/commands/task/scaffold.d.ts.map +1 -0
- package/dist/commands/task/scaffold.js +142 -0
- package/dist/commands/task/scrub.d.ts +8 -0
- package/dist/commands/task/scrub.d.ts.map +1 -0
- package/dist/commands/task/scrub.js +121 -0
- package/dist/commands/task/search.d.ts +7 -0
- package/dist/commands/task/search.d.ts.map +1 -0
- package/dist/commands/task/search.js +79 -0
- package/dist/commands/task/set-status.d.ts +19 -0
- package/dist/commands/task/set-status.d.ts.map +1 -0
- package/dist/commands/task/set-status.js +123 -0
- package/dist/commands/task/shared.d.ts +48 -0
- package/dist/commands/task/shared.d.ts.map +1 -0
- package/dist/commands/task/shared.js +312 -0
- package/dist/commands/task/show.d.ts +6 -0
- package/dist/commands/task/show.d.ts.map +1 -0
- package/dist/commands/task/show.js +35 -0
- package/dist/commands/task/start.d.ts +19 -0
- package/dist/commands/task/start.d.ts.map +1 -0
- package/dist/commands/task/start.js +110 -0
- package/dist/commands/task/update.d.ts +8 -0
- package/dist/commands/task/update.d.ts.map +1 -0
- package/dist/commands/task/update.js +144 -0
- package/dist/commands/task/verify-record.d.ts +16 -0
- package/dist/commands/task/verify-record.d.ts.map +1 -0
- package/dist/commands/task/verify-record.js +277 -0
- package/dist/commands/task/verify.d.ts +2 -0
- package/dist/commands/task/verify.d.ts.map +1 -0
- package/dist/commands/task/verify.js +1 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +17 -2
- package/dist/commands/workflow.d.ts +5 -364
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +6 -4617
- package/package.json +2 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { atomicWriteFile, ensureDocSections, extractTaskDoc, loadConfig, mergeTaskDoc, normalizeTaskDoc, parseTaskReadme, renderTaskReadme, resolveProject, } from "@agentplaneorg/core";
|
|
4
|
+
import { mapCoreError } from "../../cli/error-map.js";
|
|
5
|
+
import { fileExists, getPathKind } from "../../cli/fs-utils.js";
|
|
6
|
+
import { successMessage, usageMessage } from "../../cli/output.js";
|
|
7
|
+
import { CliError } from "../../shared/errors.js";
|
|
8
|
+
export const TASK_MIGRATE_DOC_USAGE = "Usage: agentplane task migrate-doc [<task-id> ...] [--all] [--quiet]";
|
|
9
|
+
export const TASK_MIGRATE_DOC_USAGE_EXAMPLE = "agentplane task migrate-doc --all";
|
|
10
|
+
function parseTaskMigrateDocFlags(args) {
|
|
11
|
+
const out = { all: false, quiet: false, taskIds: [] };
|
|
12
|
+
for (const arg of args) {
|
|
13
|
+
if (!arg)
|
|
14
|
+
continue;
|
|
15
|
+
if (arg === "--all") {
|
|
16
|
+
out.all = true;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (arg === "--quiet") {
|
|
20
|
+
out.quiet = true;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (arg.startsWith("--")) {
|
|
24
|
+
throw new CliError({
|
|
25
|
+
exitCode: 2,
|
|
26
|
+
code: "E_USAGE",
|
|
27
|
+
message: usageMessage(TASK_MIGRATE_DOC_USAGE, TASK_MIGRATE_DOC_USAGE_EXAMPLE),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
out.taskIds.push(arg);
|
|
31
|
+
}
|
|
32
|
+
if (!out.all && out.taskIds.length === 0) {
|
|
33
|
+
throw new CliError({
|
|
34
|
+
exitCode: 2,
|
|
35
|
+
code: "E_USAGE",
|
|
36
|
+
message: usageMessage(TASK_MIGRATE_DOC_USAGE, TASK_MIGRATE_DOC_USAGE_EXAMPLE),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (out.all && out.taskIds.length > 0) {
|
|
40
|
+
throw new CliError({
|
|
41
|
+
exitCode: 2,
|
|
42
|
+
code: "E_USAGE",
|
|
43
|
+
message: usageMessage(TASK_MIGRATE_DOC_USAGE, TASK_MIGRATE_DOC_USAGE_EXAMPLE),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
function isRecord(value) {
|
|
49
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
50
|
+
}
|
|
51
|
+
function ensurePlanApprovalFrontmatter(frontmatter) {
|
|
52
|
+
const raw = frontmatter.plan_approval;
|
|
53
|
+
if (isRecord(raw) && typeof raw.state === "string")
|
|
54
|
+
return;
|
|
55
|
+
frontmatter.plan_approval = {
|
|
56
|
+
state: "pending",
|
|
57
|
+
updated_at: null,
|
|
58
|
+
updated_by: null,
|
|
59
|
+
note: null,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function ensureVerificationFrontmatter(frontmatter) {
|
|
63
|
+
const raw = frontmatter.verification;
|
|
64
|
+
if (isRecord(raw) && typeof raw.state === "string")
|
|
65
|
+
return;
|
|
66
|
+
frontmatter.verification = {
|
|
67
|
+
state: "pending",
|
|
68
|
+
updated_at: null,
|
|
69
|
+
updated_by: null,
|
|
70
|
+
note: null,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
async function migrateTaskReadmeDoc(opts) {
|
|
74
|
+
const originalRaw = await readFile(opts.readmePath, "utf8");
|
|
75
|
+
const original = originalRaw.endsWith("\n") ? originalRaw : `${originalRaw}\n`;
|
|
76
|
+
const parsed = parseTaskReadme(original);
|
|
77
|
+
const frontmatter = { ...parsed.frontmatter };
|
|
78
|
+
ensurePlanApprovalFrontmatter(frontmatter);
|
|
79
|
+
ensureVerificationFrontmatter(frontmatter);
|
|
80
|
+
const required = opts.config.tasks.doc.required_sections;
|
|
81
|
+
const extracted = extractTaskDoc(parsed.body);
|
|
82
|
+
const baseDoc = extracted || parsed.body;
|
|
83
|
+
const nextDoc = normalizeTaskDoc(ensureDocSections(baseDoc, required));
|
|
84
|
+
const nextBody = extracted ? mergeTaskDoc(parsed.body, nextDoc) : nextDoc;
|
|
85
|
+
const rendered = renderTaskReadme(frontmatter, nextBody);
|
|
86
|
+
const next = rendered.endsWith("\n") ? rendered : `${rendered}\n`;
|
|
87
|
+
if (next === original)
|
|
88
|
+
return { changed: false };
|
|
89
|
+
await atomicWriteFile(opts.readmePath, next, "utf8");
|
|
90
|
+
return { changed: true };
|
|
91
|
+
}
|
|
92
|
+
async function resolveReadmePaths(opts) {
|
|
93
|
+
if (!opts.flags.all) {
|
|
94
|
+
return opts.flags.taskIds.map((taskId) => path.join(opts.tasksDir, taskId, "README.md"));
|
|
95
|
+
}
|
|
96
|
+
if ((await getPathKind(opts.tasksDir)) !== "dir")
|
|
97
|
+
return [];
|
|
98
|
+
const entries = await readdir(opts.tasksDir, { withFileTypes: true });
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const entry of entries) {
|
|
101
|
+
if (!entry.isDirectory())
|
|
102
|
+
continue;
|
|
103
|
+
const readmePath = path.join(opts.tasksDir, entry.name, "README.md");
|
|
104
|
+
if (await fileExists(readmePath))
|
|
105
|
+
out.push(readmePath);
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
export async function cmdTaskMigrateDoc(opts) {
|
|
110
|
+
const flags = parseTaskMigrateDocFlags(opts.args);
|
|
111
|
+
try {
|
|
112
|
+
const resolved = await resolveProject({
|
|
113
|
+
cwd: opts.cwd,
|
|
114
|
+
rootOverride: opts.rootOverride ?? null,
|
|
115
|
+
});
|
|
116
|
+
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
117
|
+
const tasksDir = path.join(resolved.gitRoot, loaded.config.paths.workflow_dir);
|
|
118
|
+
const readmePaths = await resolveReadmePaths({ tasksDir, flags });
|
|
119
|
+
if (!flags.all) {
|
|
120
|
+
for (const readmePath of readmePaths) {
|
|
121
|
+
if (!(await fileExists(readmePath))) {
|
|
122
|
+
const taskId = path.basename(path.dirname(readmePath));
|
|
123
|
+
throw new CliError({
|
|
124
|
+
exitCode: 5,
|
|
125
|
+
code: "E_IO",
|
|
126
|
+
message: `Task README not found: ${taskId}`,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
let changed = 0;
|
|
132
|
+
for (const readmePath of readmePaths) {
|
|
133
|
+
const res = await migrateTaskReadmeDoc({ readmePath, config: loaded.config });
|
|
134
|
+
if (res.changed)
|
|
135
|
+
changed += 1;
|
|
136
|
+
}
|
|
137
|
+
if (!flags.quiet) {
|
|
138
|
+
process.stdout.write(`${successMessage("migrated task docs", undefined, `changed=${changed}`)}\n`);
|
|
139
|
+
}
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
if (err instanceof CliError)
|
|
144
|
+
throw err;
|
|
145
|
+
throw mapCoreError(err, { command: "task migrate-doc", root: opts.rootOverride ?? null });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/commands/task/migrate.ts"],"names":[],"mappings":"AA2CA,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BlB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { loadTaskBackend } from "../../backends/task-backend.js";
|
|
4
|
+
import { mapBackendError } from "../../cli/error-map.js";
|
|
5
|
+
import { missingValueMessage, successMessage } from "../../cli/output.js";
|
|
6
|
+
import { CliError } from "../../shared/errors.js";
|
|
7
|
+
function parseTaskMigrateFlags(args) {
|
|
8
|
+
const out = { quiet: false, force: false };
|
|
9
|
+
for (let i = 0; i < args.length; i++) {
|
|
10
|
+
const arg = args[i];
|
|
11
|
+
if (!arg)
|
|
12
|
+
continue;
|
|
13
|
+
if (arg === "--quiet") {
|
|
14
|
+
out.quiet = true;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (arg === "--force") {
|
|
18
|
+
out.force = true;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (arg === "--source") {
|
|
22
|
+
const next = args[i + 1];
|
|
23
|
+
if (!next) {
|
|
24
|
+
throw new CliError({
|
|
25
|
+
exitCode: 2,
|
|
26
|
+
code: "E_USAGE",
|
|
27
|
+
message: missingValueMessage("--source"),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
out.source = next;
|
|
31
|
+
i++;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (arg.startsWith("--")) {
|
|
35
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: `Unknown flag: ${arg}` });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
export async function cmdTaskMigrate(opts) {
|
|
41
|
+
const flags = parseTaskMigrateFlags(opts.args);
|
|
42
|
+
if (flags.force) {
|
|
43
|
+
// Force is accepted for parity; no additional checks in node CLI.
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const { backend, resolved, config } = await loadTaskBackend({
|
|
47
|
+
cwd: opts.cwd,
|
|
48
|
+
rootOverride: opts.rootOverride ?? null,
|
|
49
|
+
});
|
|
50
|
+
const source = flags.source ?? config.paths.tasks_path;
|
|
51
|
+
const sourcePath = path.join(resolved.gitRoot, source);
|
|
52
|
+
const raw = await readFile(sourcePath, "utf8");
|
|
53
|
+
const parsed = JSON.parse(raw);
|
|
54
|
+
const tasks = Array.isArray(parsed.tasks) ? parsed.tasks : [];
|
|
55
|
+
if (backend.writeTasks) {
|
|
56
|
+
await backend.writeTasks(tasks);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
for (const task of tasks)
|
|
60
|
+
await backend.writeTask(task);
|
|
61
|
+
}
|
|
62
|
+
if (!flags.quiet) {
|
|
63
|
+
process.stdout.write(`${successMessage("migrated tasks into backend", undefined, `count=${tasks.length}`)}\n`);
|
|
64
|
+
}
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
throw mapBackendError(err, { command: "task migrate", root: opts.rootOverride ?? null });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const TASK_NEW_USAGE = "Usage: agentplane task new --title <text> --description <text> --priority <low|normal|med|high> --owner <id> --tag <tag> [--tag <tag>...]";
|
|
2
|
+
export declare const TASK_NEW_USAGE_EXAMPLE = "agentplane task new --title \"Refactor CLI\" --description \"Improve CLI output\" --priority med --owner CODER --tag cli";
|
|
3
|
+
export declare function cmdTaskNew(opts: {
|
|
4
|
+
cwd: string;
|
|
5
|
+
rootOverride?: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
}): Promise<number>;
|
|
8
|
+
//# sourceMappingURL=new.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,cAAc,8IACkH,CAAC;AAC9I,eAAO,MAAM,sBAAsB,6HACqF,CAAC;AA6DzH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0DlB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { loadTaskBackend } from "../../backends/task-backend.js";
|
|
2
|
+
import { mapBackendError } from "../../cli/error-map.js";
|
|
3
|
+
import { missingValueMessage, usageMessage, backendNotSupportedMessage } from "../../cli/output.js";
|
|
4
|
+
import { CliError } from "../../shared/errors.js";
|
|
5
|
+
import { normalizeDependsOnInput, nowIso, requiresVerify } from "./shared.js";
|
|
6
|
+
export const TASK_NEW_USAGE = "Usage: agentplane task new --title <text> --description <text> --priority <low|normal|med|high> --owner <id> --tag <tag> [--tag <tag>...]";
|
|
7
|
+
export const TASK_NEW_USAGE_EXAMPLE = 'agentplane task new --title "Refactor CLI" --description "Improve CLI output" --priority med --owner CODER --tag cli';
|
|
8
|
+
function parseTaskNewFlags(args) {
|
|
9
|
+
const out = { tags: [], dependsOn: [], verify: [] };
|
|
10
|
+
for (let i = 0; i < args.length; i++) {
|
|
11
|
+
const arg = args[i];
|
|
12
|
+
if (!arg)
|
|
13
|
+
continue;
|
|
14
|
+
if (!arg.startsWith("--")) {
|
|
15
|
+
throw new CliError({
|
|
16
|
+
exitCode: 2,
|
|
17
|
+
code: "E_USAGE",
|
|
18
|
+
message: `Unexpected argument: ${arg}`,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const next = args[i + 1];
|
|
22
|
+
if (!next) {
|
|
23
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: missingValueMessage(arg) });
|
|
24
|
+
}
|
|
25
|
+
switch (arg) {
|
|
26
|
+
case "--title": {
|
|
27
|
+
out.title = next;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case "--description": {
|
|
31
|
+
out.description = next;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "--owner": {
|
|
35
|
+
out.owner = next;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case "--priority": {
|
|
39
|
+
out.priority = next;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case "--tag": {
|
|
43
|
+
out.tags.push(next);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case "--depends-on": {
|
|
47
|
+
out.dependsOn.push(...normalizeDependsOnInput(next));
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case "--verify": {
|
|
51
|
+
out.verify.push(next);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
default: {
|
|
55
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: `Unknown flag: ${arg}` });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
i++;
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
export async function cmdTaskNew(opts) {
|
|
63
|
+
const flags = parseTaskNewFlags(opts.args);
|
|
64
|
+
const priority = flags.priority ?? "med";
|
|
65
|
+
if (!flags.title || !flags.description || !flags.owner || flags.tags.length === 0) {
|
|
66
|
+
throw new CliError({
|
|
67
|
+
exitCode: 2,
|
|
68
|
+
code: "E_USAGE",
|
|
69
|
+
message: usageMessage(TASK_NEW_USAGE, TASK_NEW_USAGE_EXAMPLE),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const { backend, config } = await loadTaskBackend({
|
|
74
|
+
cwd: opts.cwd,
|
|
75
|
+
rootOverride: opts.rootOverride ?? null,
|
|
76
|
+
});
|
|
77
|
+
const suffixLength = config.tasks.id_suffix_length_default;
|
|
78
|
+
if (!backend.generateTaskId) {
|
|
79
|
+
throw new CliError({
|
|
80
|
+
exitCode: 3,
|
|
81
|
+
code: "E_VALIDATION",
|
|
82
|
+
message: backendNotSupportedMessage("generateTaskId()"),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const taskId = await backend.generateTaskId({ length: suffixLength, attempts: 1000 });
|
|
86
|
+
const task = {
|
|
87
|
+
id: taskId,
|
|
88
|
+
title: flags.title,
|
|
89
|
+
description: flags.description,
|
|
90
|
+
status: "TODO",
|
|
91
|
+
priority,
|
|
92
|
+
owner: flags.owner,
|
|
93
|
+
tags: flags.tags,
|
|
94
|
+
depends_on: flags.dependsOn,
|
|
95
|
+
verify: flags.verify,
|
|
96
|
+
comments: [],
|
|
97
|
+
doc_version: 2,
|
|
98
|
+
doc_updated_at: nowIso(),
|
|
99
|
+
doc_updated_by: flags.owner,
|
|
100
|
+
id_source: "generated",
|
|
101
|
+
};
|
|
102
|
+
if (requiresVerify(flags.tags, config.tasks.verify.required_tags) &&
|
|
103
|
+
flags.verify.length === 0) {
|
|
104
|
+
throw new CliError({
|
|
105
|
+
exitCode: 2,
|
|
106
|
+
code: "E_USAGE",
|
|
107
|
+
message: "Missing verify commands for tasks with code/backend/frontend tags (use --verify)",
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
await backend.writeTask(task);
|
|
111
|
+
process.stdout.write(`${taskId}\n`);
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
throw mapBackendError(err, { command: "task new", root: opts.rootOverride ?? null });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../src/commands/task/next.ts"],"names":[],"mappings":"AAWA,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4ClB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { loadTaskBackend } from "../../backends/task-backend.js";
|
|
2
|
+
import { mapBackendError } from "../../cli/error-map.js";
|
|
3
|
+
import { buildDependencyState, dedupeStrings, formatTaskLine, parseTaskListFilters, toStringArray, } from "./shared.js";
|
|
4
|
+
export async function cmdTaskNext(opts) {
|
|
5
|
+
const filters = parseTaskListFilters(opts.args, { allowLimit: true });
|
|
6
|
+
try {
|
|
7
|
+
const { backend } = await loadTaskBackend({
|
|
8
|
+
cwd: opts.cwd,
|
|
9
|
+
rootOverride: opts.rootOverride ?? null,
|
|
10
|
+
});
|
|
11
|
+
const tasks = await backend.listTasks();
|
|
12
|
+
const depState = buildDependencyState(tasks);
|
|
13
|
+
const statuses = filters.status.length > 0
|
|
14
|
+
? new Set(filters.status.map((s) => s.trim().toUpperCase()))
|
|
15
|
+
: new Set(["TODO"]);
|
|
16
|
+
let filtered = tasks.filter((task) => statuses.has(String(task.status || "TODO").toUpperCase()));
|
|
17
|
+
if (filters.owner.length > 0) {
|
|
18
|
+
const wanted = new Set(filters.owner.map((o) => o.trim().toUpperCase()));
|
|
19
|
+
filtered = filtered.filter((task) => wanted.has(String(task.owner || "").toUpperCase()));
|
|
20
|
+
}
|
|
21
|
+
if (filters.tag.length > 0) {
|
|
22
|
+
const wanted = new Set(filters.tag.map((t) => t.trim()).filter(Boolean));
|
|
23
|
+
filtered = filtered.filter((task) => {
|
|
24
|
+
const tags = dedupeStrings(toStringArray(task.tags));
|
|
25
|
+
return tags.some((tag) => wanted.has(tag));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const sorted = filtered.toSorted((a, b) => a.id.localeCompare(b.id));
|
|
29
|
+
const ready = sorted.filter((task) => {
|
|
30
|
+
const dep = depState.get(task.id);
|
|
31
|
+
return !dep || (dep.missing.length === 0 && dep.incomplete.length === 0);
|
|
32
|
+
});
|
|
33
|
+
const limited = filters.limit !== undefined && filters.limit >= 0 ? ready.slice(0, filters.limit) : ready;
|
|
34
|
+
for (const task of limited) {
|
|
35
|
+
process.stdout.write(`${formatTaskLine(task, depState.get(task.id))}\n`);
|
|
36
|
+
}
|
|
37
|
+
if (!filters.quiet) {
|
|
38
|
+
process.stdout.write(`Ready: ${limited.length} / ${filtered.length}\n`);
|
|
39
|
+
}
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw mapBackendError(err, { command: "task next", root: opts.rootOverride ?? null });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/commands/task/normalize.ts"],"names":[],"mappings":"AAoBA,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { loadTaskBackend } from "../../backends/task-backend.js";
|
|
2
|
+
import { mapBackendError } from "../../cli/error-map.js";
|
|
3
|
+
import { successMessage } from "../../cli/output.js";
|
|
4
|
+
import { CliError } from "../../shared/errors.js";
|
|
5
|
+
function parseTaskNormalizeFlags(args) {
|
|
6
|
+
const out = { quiet: false, force: false };
|
|
7
|
+
for (const arg of args) {
|
|
8
|
+
if (!arg)
|
|
9
|
+
continue;
|
|
10
|
+
if (arg === "--quiet")
|
|
11
|
+
out.quiet = true;
|
|
12
|
+
else if (arg === "--force")
|
|
13
|
+
out.force = true;
|
|
14
|
+
else if (arg.startsWith("--")) {
|
|
15
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: `Unknown flag: ${arg}` });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
export async function cmdTaskNormalize(opts) {
|
|
21
|
+
const flags = parseTaskNormalizeFlags(opts.args);
|
|
22
|
+
if (flags.force) {
|
|
23
|
+
// Force is accepted for parity; no additional checks in node CLI.
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const { backend } = await loadTaskBackend({
|
|
27
|
+
cwd: opts.cwd,
|
|
28
|
+
rootOverride: opts.rootOverride ?? null,
|
|
29
|
+
});
|
|
30
|
+
const tasks = await backend.listTasks();
|
|
31
|
+
if (backend.writeTasks) {
|
|
32
|
+
await backend.writeTasks(tasks);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
for (const task of tasks)
|
|
36
|
+
await backend.writeTask(task);
|
|
37
|
+
}
|
|
38
|
+
if (!flags.quiet) {
|
|
39
|
+
process.stdout.write(`${successMessage("normalized tasks", undefined, `count=${tasks.length}`)}\n`);
|
|
40
|
+
}
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
throw mapBackendError(err, { command: "task normalize", root: opts.rootOverride ?? null });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const TASK_PLAN_USAGE = "Usage: agentplane task plan <set|approve|reject> <task-id> [flags]";
|
|
2
|
+
export declare const TASK_PLAN_USAGE_EXAMPLE = "agentplane task plan set 202602030608-F1Q8AB --text \"...\"";
|
|
3
|
+
export declare const TASK_PLAN_SET_USAGE = "Usage: agentplane task plan set <task-id> (--text <text> | --file <path>) [--updated-by <id>]";
|
|
4
|
+
export declare const TASK_PLAN_SET_USAGE_EXAMPLE: string;
|
|
5
|
+
export declare const TASK_PLAN_APPROVE_USAGE = "Usage: agentplane task plan approve <task-id> --by <id> [--note <text>]";
|
|
6
|
+
export declare const TASK_PLAN_APPROVE_USAGE_EXAMPLE = "agentplane task plan approve 202602030608-F1Q8AB --by USER --note \"OK\"";
|
|
7
|
+
export declare const TASK_PLAN_REJECT_USAGE = "Usage: agentplane task plan reject <task-id> --by <id> --note <text>";
|
|
8
|
+
export declare const TASK_PLAN_REJECT_USAGE_EXAMPLE = "agentplane task plan reject 202602030608-F1Q8AB --by USER --note \"Need clarification\"";
|
|
9
|
+
export declare function cmdTaskPlan(opts: {
|
|
10
|
+
cwd: string;
|
|
11
|
+
rootOverride?: string;
|
|
12
|
+
args: string[];
|
|
13
|
+
}): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/task/plan.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,eAAe,uEAAuE,CAAC;AACpG,eAAO,MAAM,uBAAuB,gEAA8D,CAAC;AAEnG,eAAO,MAAM,mBAAmB,kGACiE,CAAC;AAClG,eAAO,MAAM,2BAA2B,QAA6G,CAAC;AAEtJ,eAAO,MAAM,uBAAuB,4EACuC,CAAC;AAC5E,eAAO,MAAM,+BAA+B,6EAC8B,CAAC;AAE3E,eAAO,MAAM,sBAAsB,yEACqC,CAAC;AACzE,eAAO,MAAM,8BAA8B,4FAC8C,CAAC;AAoG1F,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwIlB"}
|