agentplane 0.3.10 → 0.3.11
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/policy/governance.md +3 -4
- package/assets/policy/incidents.md +19 -88
- package/assets/policy/workflow.branch_pr.md +1 -1
- package/assets/policy/workflow.direct.md +2 -2
- package/bin/agentplane.js +56 -1
- package/bin/runtime-watch.js +1 -0
- package/bin/stale-dist-policy.d.ts +1 -1
- package/bin/stale-dist-policy.js +13 -0
- package/dist/.build-manifest.json +219 -154
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +3 -2
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +2 -1
- package/dist/cli/command-invocations.d.ts.map +1 -1
- package/dist/cli/command-invocations.js +4 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +3 -1
- package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +10 -0
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core/preflight.js +44 -1
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +12 -0
- package/dist/commands/branch/cleanup-merged.d.ts +2 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +132 -28
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +60 -1
- package/dist/commands/cleanup/merged.command.d.ts +2 -0
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
- package/dist/commands/cleanup/merged.command.js +24 -0
- package/dist/commands/doctor/branch-pr.d.ts +4 -0
- package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
- package/dist/commands/doctor/branch-pr.js +96 -0
- package/dist/commands/doctor/fixes.d.ts +5 -0
- package/dist/commands/doctor/fixes.d.ts.map +1 -1
- package/dist/commands/doctor/fixes.js +70 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +6 -1
- package/dist/commands/finish.run.d.ts.map +1 -1
- package/dist/commands/finish.run.js +11 -0
- package/dist/commands/finish.spec.d.ts +11 -0
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +51 -0
- package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
- package/dist/commands/guard/impl/close-message.js +23 -6
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +24 -2
- package/dist/commands/guard/impl/env.d.ts +1 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -1
- package/dist/commands/guard/impl/env.js +1 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +98 -1
- package/dist/commands/incidents/collect.command.d.ts.map +1 -1
- package/dist/commands/incidents/collect.command.js +12 -7
- package/dist/commands/incidents/incidents.command.js +1 -1
- package/dist/commands/incidents/shared.d.ts +34 -0
- package/dist/commands/incidents/shared.d.ts.map +1 -1
- package/dist/commands/incidents/shared.js +166 -12
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +238 -135
- package/dist/commands/pr/close-superseded.d.ts +9 -0
- package/dist/commands/pr/close-superseded.d.ts.map +1 -0
- package/dist/commands/pr/close-superseded.js +129 -0
- package/dist/commands/pr/close.d.ts +11 -0
- package/dist/commands/pr/close.d.ts.map +1 -0
- package/dist/commands/pr/close.js +116 -0
- package/dist/commands/pr/index.d.ts +2 -0
- package/dist/commands/pr/index.d.ts.map +1 -1
- package/dist/commands/pr/index.js +2 -0
- package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
- package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
- package/dist/commands/pr/integrate/artifacts.js +66 -1
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +16 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +40 -12
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/merge.js +36 -13
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +101 -38
- package/dist/commands/pr/internal/freshness.d.ts +20 -0
- package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
- package/dist/commands/pr/internal/freshness.js +50 -0
- package/dist/commands/pr/internal/gh-api.d.ts +6 -0
- package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
- package/dist/commands/pr/internal/gh-api.js +80 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +10 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
- package/dist/commands/pr/internal/pr-paths.js +10 -0
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
- package/dist/commands/pr/internal/review-template.js +37 -4
- package/dist/commands/pr/internal/sync.d.ts +9 -0
- package/dist/commands/pr/internal/sync.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync.js +462 -122
- package/dist/commands/pr/open.d.ts +1 -0
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +13 -2
- package/dist/commands/pr/pr.command.d.ts +15 -0
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +118 -2
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +59 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +3 -17
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +1 -1
- package/dist/commands/shared/gh-transport.d.ts +16 -0
- package/dist/commands/shared/gh-transport.d.ts.map +1 -0
- package/dist/commands/shared/gh-transport.js +71 -0
- package/dist/commands/shared/git-diff.d.ts +3 -1
- package/dist/commands/shared/git-diff.d.ts.map +1 -1
- package/dist/commands/shared/git-diff.js +10 -2
- package/dist/commands/shared/git-ops.d.ts +1 -0
- package/dist/commands/shared/git-ops.d.ts.map +1 -1
- package/dist/commands/shared/git-ops.js +15 -0
- package/dist/commands/shared/git-worktree.d.ts +2 -0
- package/dist/commands/shared/git-worktree.d.ts.map +1 -1
- package/dist/commands/shared/git-worktree.js +22 -2
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
- package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
- package/dist/commands/shared/pr-meta.d.ts +20 -0
- package/dist/commands/shared/pr-meta.d.ts.map +1 -1
- package/dist/commands/shared/pr-meta.js +125 -0
- package/dist/commands/shared/task-backend.d.ts +7 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +34 -22
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +34 -1
- package/dist/commands/task/derive.js +1 -1
- package/dist/commands/task/doc-template.d.ts.map +1 -1
- package/dist/commands/task/doc-template.js +7 -11
- package/dist/commands/task/findings-add.command.d.ts +20 -0
- package/dist/commands/task/findings-add.command.d.ts.map +1 -0
- package/dist/commands/task/findings-add.command.js +165 -0
- package/dist/commands/task/findings.command.d.ts +7 -0
- package/dist/commands/task/findings.command.d.ts.map +1 -0
- package/dist/commands/task/findings.command.js +20 -0
- package/dist/commands/task/findings.d.ts +63 -0
- package/dist/commands/task/findings.d.ts.map +1 -0
- package/dist/commands/task/findings.js +188 -0
- package/dist/commands/task/finish-shared.d.ts +1 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +55 -1
- package/dist/commands/task/finish.d.ts +10 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +125 -6
- package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.command.js +414 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +49 -1
- package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +249 -17
- package/dist/commands/task/index.d.ts +1 -0
- package/dist/commands/task/index.d.ts.map +1 -1
- package/dist/commands/task/index.js +1 -0
- package/dist/commands/task/new.d.ts +1 -0
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +71 -1
- package/dist/commands/task/new.spec.d.ts.map +1 -1
- package/dist/commands/task/new.spec.js +7 -0
- package/dist/commands/task/normalize.command.d.ts +2 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -1
- package/dist/commands/task/normalize.command.js +45 -0
- package/dist/commands/task/normalize.d.ts +2 -0
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +85 -8
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +7 -10
- package/dist/commands/task/shared/docs.d.ts +6 -0
- package/dist/commands/task/shared/docs.d.ts.map +1 -1
- package/dist/commands/task/shared/docs.js +14 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +11 -1
- package/dist/commands/task/shared.d.ts +1 -1
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +1 -1
- package/dist/commands/task/start-ready.d.ts.map +1 -1
- package/dist/commands/task/start-ready.js +86 -0
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +7 -10
- package/dist/commands/task/task.command.d.ts.map +1 -1
- package/dist/commands/task/task.command.js +4 -0
- package/dist/commands/task/verify-command-shared.d.ts +19 -0
- package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
- package/dist/commands/task/verify-command-shared.js +152 -1
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
- package/dist/commands/task/verify-ok.command.js +15 -2
- package/dist/commands/task/verify-record.d.ts +36 -0
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +166 -11
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
- package/dist/commands/task/verify-rework.command.js +15 -2
- package/dist/commands/task/verify-show.command.d.ts +1 -1
- package/dist/commands/task/verify-show.command.d.ts.map +1 -1
- package/dist/commands/task/verify-show.command.js +28 -1
- package/dist/commands/verify.run.d.ts.map +1 -1
- package/dist/commands/verify.run.js +12 -0
- package/dist/commands/verify.spec.d.ts +2 -6
- package/dist/commands/verify.spec.d.ts.map +1 -1
- package/dist/commands/verify.spec.js +30 -3
- package/dist/runtime/incidents/index.d.ts +1 -1
- package/dist/runtime/incidents/index.d.ts.map +1 -1
- package/dist/runtime/incidents/resolve.d.ts.map +1 -1
- package/dist/runtime/incidents/resolve.js +319 -73
- package/dist/runtime/incidents/types.d.ts +14 -2
- package/dist/runtime/incidents/types.d.ts.map +1 -1
- package/dist/shared/env.d.ts +1 -0
- package/dist/shared/env.d.ts.map +1 -1
- package/dist/shared/env.js +22 -1
- package/dist/shared/protected-paths.d.ts +1 -1
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { warnMessage } from "../../cli/output.js";
|
|
2
|
+
import { normalizeGhTransportError } from "../shared/gh-transport.js";
|
|
3
|
+
import { ensurePrArtifactsSynced } from "../pr/internal/sync.js";
|
|
4
|
+
export async function refreshBranchPrArtifactsAfterTaskCommit(opts) {
|
|
5
|
+
if (opts.ctx.config.workflow_mode !== "branch_pr")
|
|
6
|
+
return;
|
|
7
|
+
try {
|
|
8
|
+
await ensurePrArtifactsSynced({
|
|
9
|
+
ctx: opts.ctx,
|
|
10
|
+
cwd: opts.cwd,
|
|
11
|
+
rootOverride: opts.rootOverride,
|
|
12
|
+
taskId: opts.taskId,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
if (opts.quiet)
|
|
17
|
+
return;
|
|
18
|
+
const detail = normalizeGhTransportError(err).trim();
|
|
19
|
+
const suffix = detail ? ` (${detail})` : "";
|
|
20
|
+
process.stderr.write(`${warnMessage(`task commit succeeded but PR artifacts refresh failed for ${opts.taskId}; run \`agentplane pr update ${opts.taskId}\`${suffix}`)}\n`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { type TaskPrMeta } from "@agentplaneorg/core";
|
|
2
2
|
export type PrMeta = TaskPrMeta;
|
|
3
|
+
export type ObservedGithubPrState = {
|
|
4
|
+
prNumber: number;
|
|
5
|
+
prUrl: string | null;
|
|
6
|
+
status: "OPEN" | "CLOSED" | "MERGED";
|
|
7
|
+
mergedAt?: string | null;
|
|
8
|
+
mergeCommit?: string | null;
|
|
9
|
+
base?: string | null;
|
|
10
|
+
headSha?: string | null;
|
|
11
|
+
};
|
|
3
12
|
export type PrArtifactTextState = {
|
|
4
13
|
diffstatText: string | null;
|
|
5
14
|
verifyLogText: string | null;
|
|
@@ -23,6 +32,16 @@ export declare function buildUpdatedPrMeta(opts: {
|
|
|
23
32
|
base?: string | null;
|
|
24
33
|
headSha?: string | null;
|
|
25
34
|
}): PrMeta;
|
|
35
|
+
export declare function resolvePrArtifactHeadSha(opts: {
|
|
36
|
+
previousHeadSha?: string | null;
|
|
37
|
+
currentHeadSha?: string | null;
|
|
38
|
+
preservePrevious: boolean;
|
|
39
|
+
}): string | undefined;
|
|
40
|
+
export declare function buildObservedGithubPrMeta(opts: {
|
|
41
|
+
meta: PrMeta;
|
|
42
|
+
observed: ObservedGithubPrState;
|
|
43
|
+
at: string;
|
|
44
|
+
}): PrMeta;
|
|
26
45
|
export declare function buildVerifiedPrMeta(opts: {
|
|
27
46
|
meta: PrMeta;
|
|
28
47
|
at: string;
|
|
@@ -46,6 +65,7 @@ export type ShellInvocation = {
|
|
|
46
65
|
};
|
|
47
66
|
export declare function resolveShellInvocation(command: string): ShellInvocation;
|
|
48
67
|
export declare function parsePrMeta(raw: string, taskId: string): PrMeta;
|
|
68
|
+
export declare function parsePrMetaForwardCompatible(raw: string, taskId: string): PrMeta;
|
|
49
69
|
export declare function extractLastVerifiedSha(logText: string): string | null;
|
|
50
70
|
export declare function appendVerifyLog(logPath: string, header: string, content: string): Promise<void>;
|
|
51
71
|
export declare function runShellCommand(command: string, cwd: string): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-meta.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/pr-meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAI1E,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAA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AC7C,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,GAAG,MAAM,CAsBT;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAQvE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAW/D;AAqFD,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAiBhF;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrE;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAqBD"}
|
|
@@ -18,8 +18,14 @@ export function buildOpenedPrMeta(opts) {
|
|
|
18
18
|
schema_version: 1,
|
|
19
19
|
task_id: opts.taskId,
|
|
20
20
|
branch: opts.branch,
|
|
21
|
+
pr_number: opts.previousMeta?.pr_number,
|
|
22
|
+
pr_url: opts.previousMeta?.pr_url,
|
|
21
23
|
created_at: opts.previousMeta?.created_at ?? opts.at,
|
|
22
24
|
updated_at: changed ? opts.at : (opts.previousMeta?.updated_at ?? opts.at),
|
|
25
|
+
status: opts.previousMeta?.status,
|
|
26
|
+
merge_strategy: opts.previousMeta?.merge_strategy,
|
|
27
|
+
merged_at: opts.previousMeta?.merged_at,
|
|
28
|
+
merge_commit: opts.previousMeta?.merge_commit,
|
|
23
29
|
last_verified_sha: opts.previousMeta?.last_verified_sha ?? null,
|
|
24
30
|
last_verified_at: opts.previousMeta?.last_verified_at ?? null,
|
|
25
31
|
verify: opts.previousMeta?.verify ?? { status: "skipped" },
|
|
@@ -43,6 +49,46 @@ export function buildUpdatedPrMeta(opts) {
|
|
|
43
49
|
last_verified_at: opts.meta.last_verified_at ?? null,
|
|
44
50
|
};
|
|
45
51
|
}
|
|
52
|
+
export function resolvePrArtifactHeadSha(opts) {
|
|
53
|
+
const previousHeadSha = asNonEmptyString(opts.previousHeadSha);
|
|
54
|
+
const currentHeadSha = asNonEmptyString(opts.currentHeadSha);
|
|
55
|
+
if (opts.preservePrevious && previousHeadSha)
|
|
56
|
+
return previousHeadSha;
|
|
57
|
+
return currentHeadSha ?? previousHeadSha;
|
|
58
|
+
}
|
|
59
|
+
export function buildObservedGithubPrMeta(opts) {
|
|
60
|
+
const nextStatus = opts.observed.status;
|
|
61
|
+
const nextHeadSha = opts.meta.head_sha ?? opts.observed.headSha ?? undefined;
|
|
62
|
+
const nextMeta = {
|
|
63
|
+
...opts.meta,
|
|
64
|
+
pr_number: opts.observed.prNumber,
|
|
65
|
+
pr_url: opts.observed.prUrl ?? opts.meta.pr_url,
|
|
66
|
+
status: nextStatus,
|
|
67
|
+
base: opts.observed.base ?? opts.meta.base,
|
|
68
|
+
head_sha: nextHeadSha,
|
|
69
|
+
updated_at: opts.meta.updated_at,
|
|
70
|
+
};
|
|
71
|
+
if (nextStatus === "MERGED") {
|
|
72
|
+
nextMeta.merged_at = opts.observed.mergedAt ?? opts.meta.merged_at;
|
|
73
|
+
nextMeta.merge_commit = opts.observed.mergeCommit ?? opts.meta.merge_commit;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
delete nextMeta.merged_at;
|
|
77
|
+
delete nextMeta.merge_commit;
|
|
78
|
+
delete nextMeta.merge_strategy;
|
|
79
|
+
}
|
|
80
|
+
const changed = nextMeta.pr_number !== opts.meta.pr_number ||
|
|
81
|
+
(nextMeta.pr_url ?? null) !== (opts.meta.pr_url ?? null) ||
|
|
82
|
+
nextMeta.status !== opts.meta.status ||
|
|
83
|
+
(nextMeta.base ?? null) !== (opts.meta.base ?? null) ||
|
|
84
|
+
(nextMeta.head_sha ?? null) !== (opts.meta.head_sha ?? null) ||
|
|
85
|
+
(nextMeta.merged_at ?? null) !== (opts.meta.merged_at ?? null) ||
|
|
86
|
+
(nextMeta.merge_commit ?? null) !== (opts.meta.merge_commit ?? null);
|
|
87
|
+
if (changed) {
|
|
88
|
+
nextMeta.updated_at = opts.at;
|
|
89
|
+
}
|
|
90
|
+
return nextMeta;
|
|
91
|
+
}
|
|
46
92
|
export function buildVerifiedPrMeta(opts) {
|
|
47
93
|
const verifiedSha = opts.meta.head_sha ?? null;
|
|
48
94
|
return {
|
|
@@ -96,6 +142,85 @@ export function parsePrMeta(raw, taskId) {
|
|
|
96
142
|
throw new Error("pr/meta.json task_id mismatch");
|
|
97
143
|
return meta;
|
|
98
144
|
}
|
|
145
|
+
function asNonEmptyString(value) {
|
|
146
|
+
if (typeof value !== "string")
|
|
147
|
+
return undefined;
|
|
148
|
+
const trimmed = value.trim();
|
|
149
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
150
|
+
}
|
|
151
|
+
function asOptionalInteger(value) {
|
|
152
|
+
return Number.isInteger(value) && Number(value) > 0 ? Number(value) : undefined;
|
|
153
|
+
}
|
|
154
|
+
function asVerifyStatus(value) {
|
|
155
|
+
if (!value || typeof value !== "object")
|
|
156
|
+
return undefined;
|
|
157
|
+
const status = asNonEmptyString(value.status);
|
|
158
|
+
if (status !== "pass" && status !== "fail" && status !== "skipped")
|
|
159
|
+
return undefined;
|
|
160
|
+
const command = asNonEmptyString(value.command);
|
|
161
|
+
return command ? { status, command } : { status };
|
|
162
|
+
}
|
|
163
|
+
function asMergeStrategy(value) {
|
|
164
|
+
const strategy = asNonEmptyString(value);
|
|
165
|
+
return strategy === "squash" || strategy === "merge" || strategy === "rebase"
|
|
166
|
+
? strategy
|
|
167
|
+
: undefined;
|
|
168
|
+
}
|
|
169
|
+
function buildForwardCompatiblePrMeta(parsed, taskId) {
|
|
170
|
+
if (parsed.schema_version !== 1)
|
|
171
|
+
return null;
|
|
172
|
+
if (asNonEmptyString(parsed.task_id) !== taskId)
|
|
173
|
+
return null;
|
|
174
|
+
const branch = asNonEmptyString(parsed.branch);
|
|
175
|
+
const createdAt = asNonEmptyString(parsed.created_at);
|
|
176
|
+
const updatedAt = asNonEmptyString(parsed.updated_at);
|
|
177
|
+
if (!branch || !createdAt || !updatedAt)
|
|
178
|
+
return null;
|
|
179
|
+
const statusCandidate = asNonEmptyString(parsed.status);
|
|
180
|
+
const status = statusCandidate === "OPEN" || statusCandidate === "CLOSED" || statusCandidate === "MERGED"
|
|
181
|
+
? statusCandidate
|
|
182
|
+
: undefined;
|
|
183
|
+
return {
|
|
184
|
+
schema_version: 1,
|
|
185
|
+
task_id: taskId,
|
|
186
|
+
branch,
|
|
187
|
+
pr_number: asOptionalInteger(parsed.pr_number),
|
|
188
|
+
pr_url: asNonEmptyString(parsed.pr_url),
|
|
189
|
+
created_at: createdAt,
|
|
190
|
+
updated_at: updatedAt,
|
|
191
|
+
status,
|
|
192
|
+
merge_strategy: asMergeStrategy(parsed.merge_strategy),
|
|
193
|
+
merged_at: asNonEmptyString(parsed.merged_at),
|
|
194
|
+
merge_commit: asNonEmptyString(parsed.merge_commit),
|
|
195
|
+
last_verified_sha: asNonEmptyString(parsed.last_verified_sha),
|
|
196
|
+
last_verified_at: asNonEmptyString(parsed.last_verified_at),
|
|
197
|
+
verify: asVerifyStatus(parsed.verify) ?? { status: "skipped" },
|
|
198
|
+
base: asNonEmptyString(parsed.base),
|
|
199
|
+
head_sha: asNonEmptyString(parsed.head_sha),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export function parsePrMetaForwardCompatible(raw, taskId) {
|
|
203
|
+
let parsed;
|
|
204
|
+
try {
|
|
205
|
+
parsed = JSON.parse(raw);
|
|
206
|
+
}
|
|
207
|
+
catch (err) {
|
|
208
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
209
|
+
throw new Error(`JSON Parse error: ${message}`);
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
const meta = validateTaskPrMeta(parsed);
|
|
213
|
+
if (meta.task_id !== taskId)
|
|
214
|
+
throw new Error("pr/meta.json task_id mismatch");
|
|
215
|
+
return meta;
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
const compat = buildForwardCompatiblePrMeta(parsed, taskId);
|
|
219
|
+
if (compat)
|
|
220
|
+
return compat;
|
|
221
|
+
throw err;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
99
224
|
export function extractLastVerifiedSha(logText) {
|
|
100
225
|
const regex = /verified_sha=([0-9a-f]{7,40})/gi;
|
|
101
226
|
let match = null;
|
|
@@ -29,11 +29,18 @@ export declare function loadCommandContext(opts: {
|
|
|
29
29
|
export declare function loadTaskFromContext(opts: {
|
|
30
30
|
ctx: CommandContext;
|
|
31
31
|
taskId: string;
|
|
32
|
+
preferBranchSnapshot?: boolean;
|
|
33
|
+
branchSnapshotBranch?: string | null;
|
|
32
34
|
}): Promise<TaskData>;
|
|
35
|
+
export declare function resolveTaskBranchFromContext(opts: {
|
|
36
|
+
ctx: CommandContext;
|
|
37
|
+
taskId: string;
|
|
38
|
+
}): Promise<string | null>;
|
|
33
39
|
export declare function loadTaskFromBranchSnapshot(opts: {
|
|
34
40
|
ctx: CommandContext;
|
|
35
41
|
taskId: string;
|
|
36
42
|
readmePath: string;
|
|
43
|
+
branch?: string | null;
|
|
37
44
|
}): Promise<TaskData | null>;
|
|
38
45
|
export declare function loadBackendTask(opts: {
|
|
39
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}
|
|
@@ -79,29 +79,56 @@ export async function loadCommandContext(opts) {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
export async function loadTaskFromContext(opts) {
|
|
82
|
-
const task = await opts.ctx.taskBackend.getTask(opts.taskId);
|
|
83
|
-
if (task)
|
|
84
|
-
return task;
|
|
85
82
|
const tasksDir = path.join(opts.ctx.resolvedProject.gitRoot, opts.ctx.config.paths.workflow_dir);
|
|
86
83
|
const readmePath = path.join(tasksDir, opts.taskId, "README.md");
|
|
87
|
-
const branchFallback =
|
|
84
|
+
const branchFallback = () => loadTaskFromBranchSnapshot({
|
|
88
85
|
ctx: opts.ctx,
|
|
89
86
|
taskId: opts.taskId,
|
|
90
87
|
readmePath,
|
|
88
|
+
branch: opts.branchSnapshotBranch ?? null,
|
|
91
89
|
});
|
|
92
|
-
if (
|
|
93
|
-
|
|
90
|
+
if (opts.preferBranchSnapshot) {
|
|
91
|
+
const preferredBranchTask = await branchFallback();
|
|
92
|
+
if (preferredBranchTask)
|
|
93
|
+
return preferredBranchTask;
|
|
94
|
+
}
|
|
95
|
+
const task = await opts.ctx.taskBackend.getTask(opts.taskId);
|
|
96
|
+
if (task)
|
|
97
|
+
return task;
|
|
98
|
+
const fallbackTask = await branchFallback();
|
|
99
|
+
if (fallbackTask)
|
|
100
|
+
return fallbackTask;
|
|
94
101
|
throw new CliError({
|
|
95
102
|
exitCode: 4,
|
|
96
103
|
code: "E_IO",
|
|
97
104
|
message: `ENOENT: no such file or directory, open '${readmePath}'`,
|
|
98
105
|
});
|
|
99
106
|
}
|
|
107
|
+
export async function resolveTaskBranchFromContext(opts) {
|
|
108
|
+
if (opts.ctx.backendId !== "local") {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const prefix = opts.ctx.config.branch.task_prefix;
|
|
112
|
+
const branches = await gitListTaskBranches(opts.ctx.resolvedProject.gitRoot, prefix);
|
|
113
|
+
const matches = branches.filter((branch) => parseTaskIdFromBranch(prefix, branch) === opts.taskId);
|
|
114
|
+
if (matches.length === 1)
|
|
115
|
+
return matches[0] ?? null;
|
|
116
|
+
if (matches.length > 1) {
|
|
117
|
+
throw new CliError({
|
|
118
|
+
exitCode: 3,
|
|
119
|
+
code: "E_VALIDATION",
|
|
120
|
+
message: `Multiple task branches match ${opts.taskId}: ${matches.join(", ")}`,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
100
125
|
export async function loadTaskFromBranchSnapshot(opts) {
|
|
101
126
|
if (opts.ctx.backendId !== "local") {
|
|
102
127
|
return null;
|
|
103
128
|
}
|
|
104
|
-
const branch =
|
|
129
|
+
const branch = typeof opts.branch === "string" && opts.branch.trim().length > 0
|
|
130
|
+
? opts.branch.trim()
|
|
131
|
+
: await resolveTaskBranchFromContext({ ctx: opts.ctx, taskId: opts.taskId });
|
|
105
132
|
if (!branch)
|
|
106
133
|
return null;
|
|
107
134
|
const relReadmePath = toGitPath(path.relative(opts.ctx.resolvedProject.gitRoot, opts.readmePath));
|
|
@@ -126,21 +153,6 @@ export async function loadTaskFromBranchSnapshot(opts) {
|
|
|
126
153
|
readmePath: opts.readmePath,
|
|
127
154
|
});
|
|
128
155
|
}
|
|
129
|
-
async function resolveSingleTaskBranch(ctx, taskId) {
|
|
130
|
-
const prefix = ctx.config.branch.task_prefix;
|
|
131
|
-
const branches = await gitListTaskBranches(ctx.resolvedProject.gitRoot, prefix);
|
|
132
|
-
const matches = branches.filter((branch) => parseTaskIdFromBranch(prefix, branch) === taskId);
|
|
133
|
-
if (matches.length === 1)
|
|
134
|
-
return matches[0] ?? null;
|
|
135
|
-
if (matches.length > 1) {
|
|
136
|
-
throw new CliError({
|
|
137
|
-
exitCode: 3,
|
|
138
|
-
code: "E_VALIDATION",
|
|
139
|
-
message: `Multiple task branches match ${taskId}: ${matches.join(", ")}`,
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
156
|
export async function loadBackendTask(opts) {
|
|
145
157
|
const ctx = opts.ctx ??
|
|
146
158
|
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close-duplicate.d.ts","sourceRoot":"","sources":["../../../src/commands/task/close-duplicate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"close-duplicate.d.ts","sourceRoot":"","sources":["../../../src/commands/task/close-duplicate.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgDnC,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqDlB"}
|
|
@@ -1,8 +1,40 @@
|
|
|
1
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { renderTaskReadme } from "@agentplaneorg/core";
|
|
1
4
|
import { mapBackendError } from "../../cli/error-map.js";
|
|
5
|
+
import { fileExists } from "../../cli/fs-utils.js";
|
|
2
6
|
import { CliError } from "../../shared/errors.js";
|
|
7
|
+
import { writeTextIfChanged } from "../../shared/write-if-changed.js";
|
|
3
8
|
import { ensureActionApproved } from "../shared/approval-requirements.js";
|
|
4
|
-
import { loadTaskFromContext } from "../shared/task-backend.js";
|
|
9
|
+
import { loadTaskFromContext, taskDataToFrontmatter, } from "../shared/task-backend.js";
|
|
10
|
+
import { listWorktrees, parseTaskIdFromBranch } from "../shared/git-worktree.js";
|
|
5
11
|
import { recordVerifiedNoopClosure } from "./close-shared.js";
|
|
12
|
+
async function ensureLocalTaskReadmeHydrated(opts) {
|
|
13
|
+
const workflowDir = opts.ctx.config.paths.workflow_dir;
|
|
14
|
+
const targetReadmePath = path.join(opts.ctx.resolvedProject.gitRoot, workflowDir, opts.taskId, "README.md");
|
|
15
|
+
if (await fileExists(targetReadmePath))
|
|
16
|
+
return;
|
|
17
|
+
const worktrees = await listWorktrees(opts.ctx.resolvedProject.gitRoot).catch(() => []);
|
|
18
|
+
const matchingTaskWorktrees = worktrees.filter((entry) => typeof entry.branch === "string" &&
|
|
19
|
+
parseTaskIdFromBranch(opts.ctx.config.branch.task_prefix, entry.branch) === opts.taskId);
|
|
20
|
+
if (matchingTaskWorktrees.length === 1) {
|
|
21
|
+
const sourceReadmePath = path.join(matchingTaskWorktrees[0].path, workflowDir, opts.taskId, "README.md");
|
|
22
|
+
if (await fileExists(sourceReadmePath)) {
|
|
23
|
+
const text = await readFile(sourceReadmePath, "utf8");
|
|
24
|
+
await mkdir(path.dirname(targetReadmePath), { recursive: true });
|
|
25
|
+
await writeTextIfChanged(targetReadmePath, text);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const task = await loadTaskFromContext({
|
|
30
|
+
ctx: opts.ctx,
|
|
31
|
+
taskId: opts.taskId,
|
|
32
|
+
preferBranchSnapshot: true,
|
|
33
|
+
});
|
|
34
|
+
const rendered = renderTaskReadme(taskDataToFrontmatter(task), task.doc ?? "");
|
|
35
|
+
await mkdir(path.dirname(targetReadmePath), { recursive: true });
|
|
36
|
+
await writeTextIfChanged(targetReadmePath, rendered);
|
|
37
|
+
}
|
|
6
38
|
export async function cmdTaskCloseDuplicate(opts) {
|
|
7
39
|
try {
|
|
8
40
|
const sourceId = opts.taskId.trim();
|
|
@@ -30,6 +62,7 @@ export async function cmdTaskCloseDuplicate(opts) {
|
|
|
30
62
|
});
|
|
31
63
|
}
|
|
32
64
|
const canonical = await loadTaskFromContext({ ctx: opts.ctx, taskId: duplicateOf });
|
|
65
|
+
await ensureLocalTaskReadmeHydrated({ ctx: opts.ctx, taskId: sourceId });
|
|
33
66
|
const reason = opts.note?.trim();
|
|
34
67
|
const canonicalTitle = canonical.title?.trim() ? ` (${canonical.title.trim()})` : "";
|
|
35
68
|
const baseBody = `Verified: ${sourceId} is a bookkeeping duplicate of ${duplicateOf}${canonicalTitle}; ` +
|
|
@@ -61,7 +61,7 @@ export async function cmdTaskDerive(opts) {
|
|
|
61
61
|
primary: primary.primary,
|
|
62
62
|
verifyCommands: opts.verify,
|
|
63
63
|
}));
|
|
64
|
-
process.stderr.write(`${warnMessage("task requires Verify Steps by primary tag; seeded a
|
|
64
|
+
process.stderr.write(`${warnMessage("task requires Verify Steps by primary tag; seeded a concrete ## Verify Steps section in README (refine it only if the task needs stricter acceptance coverage)")}\n`);
|
|
65
65
|
}
|
|
66
66
|
const hasSpike = opts.tags.some((tag) => tag.trim().toLowerCase() === spikeTag);
|
|
67
67
|
if (hasSpike && requiresVerifySteps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-template.d.ts","sourceRoot":"","sources":["../../../src/commands/task/doc-template.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"doc-template.d.ts","sourceRoot":"","sources":["../../../src/commands/task/doc-template.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAyDrC,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAsCrF;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,GAAG,MAAM,CAyBT"}
|
|
@@ -31,13 +31,11 @@ function buildDefaultPlan(opts) {
|
|
|
31
31
|
"3. Finalize task findings and finish with traceable commit metadata.",
|
|
32
32
|
].join("\n");
|
|
33
33
|
}
|
|
34
|
-
function buildDefaultVerifyStepsTemplate() {
|
|
34
|
+
function buildDefaultVerifyStepsTemplate(opts) {
|
|
35
35
|
return [
|
|
36
|
-
"
|
|
37
|
-
"",
|
|
38
|
-
"
|
|
39
|
-
"2. <Action>. Expected: <observable result>.",
|
|
40
|
-
"3. <Action>. Expected: <observable result>.",
|
|
36
|
+
`1. Review the requested outcome for "${opts.title}". Expected: the visible result matches ## Summary and stays inside approved scope.`,
|
|
37
|
+
"2. Run the most relevant validation step for this task. Expected: it succeeds without unexpected regressions in touched behavior.",
|
|
38
|
+
"3. Compare the final result against ## Scope and record any residual follow-up in ## Findings. Expected: open edges are explicit rather than implicit.",
|
|
41
39
|
].join("\n");
|
|
42
40
|
}
|
|
43
41
|
function buildDefaultVerificationTemplate() {
|
|
@@ -69,7 +67,7 @@ export function defaultTaskDocV3(opts) {
|
|
|
69
67
|
body = setMarkdownSection(body, "Summary", buildDefaultSummary({ title: opts.title, description: opts.description }));
|
|
70
68
|
body = setMarkdownSection(body, "Scope", buildDefaultScope({ title: opts.title, description: opts.description }));
|
|
71
69
|
body = setMarkdownSection(body, "Plan", buildDefaultPlan({ title: opts.title }));
|
|
72
|
-
body = setMarkdownSection(body, "Verify Steps", buildDefaultVerifyStepsTemplate());
|
|
70
|
+
body = setMarkdownSection(body, "Verify Steps", buildDefaultVerifyStepsTemplate({ title: opts.title }));
|
|
73
71
|
body = setMarkdownSection(body, "Verification", buildDefaultVerificationTemplate());
|
|
74
72
|
body = setMarkdownSection(body, "Rollback Plan", buildDefaultRollbackPlan());
|
|
75
73
|
body = setMarkdownSection(body, "Findings", "");
|
|
@@ -85,10 +83,8 @@ export function buildDefaultVerifyStepsSection(opts) {
|
|
|
85
83
|
];
|
|
86
84
|
if (commandSteps.length === 0) {
|
|
87
85
|
return [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"1. Review the changed artifact or behavior. Expected: the requested outcome is visible and matches the approved scope.",
|
|
91
|
-
"2. Run the most relevant validation step for this task. Expected: it succeeds without unexpected regressions in touched scope.",
|
|
86
|
+
`1. Review the changed artifact or behavior for the \`${opts.primary}\` task. Expected: the requested outcome is visible and matches the approved scope.`,
|
|
87
|
+
`2. Run the most relevant validation step for the \`${opts.primary}\` task. Expected: it succeeds without unexpected regressions in touched scope.`,
|
|
92
88
|
"3. Compare the final result against the task summary and scope. Expected: any remaining follow-up is explicit in ## Findings.",
|
|
93
89
|
].join("\n");
|
|
94
90
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CommandCtx, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
import type { CommandContext } from "../shared/task-backend.js";
|
|
3
|
+
export type TaskFindingsAddParsed = {
|
|
4
|
+
taskId: string;
|
|
5
|
+
observation: string;
|
|
6
|
+
impact: string;
|
|
7
|
+
resolution: string;
|
|
8
|
+
promote: boolean;
|
|
9
|
+
external: boolean;
|
|
10
|
+
fixability: "external" | "repo-fixable" | null;
|
|
11
|
+
incidentScope?: string;
|
|
12
|
+
incidentTags: string[];
|
|
13
|
+
incidentMatch: string[];
|
|
14
|
+
incidentAdvice?: string;
|
|
15
|
+
incidentRule?: string;
|
|
16
|
+
updatedBy?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const taskFindingsAddSpec: CommandSpec<TaskFindingsAddParsed>;
|
|
19
|
+
export declare function makeRunTaskFindingsAddHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: TaskFindingsAddParsed) => Promise<number>;
|
|
20
|
+
//# sourceMappingURL=findings-add.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings-add.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/findings-add.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAqJlE,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC9E,KAAK,UAAU,EAAE,GAAG,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAAC,CAoB1E"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { usageError } from "../../cli/spec/errors.js";
|
|
2
|
+
import { cmdTaskFindingsAdd } from "./findings.js";
|
|
3
|
+
export const taskFindingsAddSpec = {
|
|
4
|
+
id: ["task", "findings", "add"],
|
|
5
|
+
group: "Task",
|
|
6
|
+
summary: "Append a structured Findings/Notes block; incident promotion is default unless --local-only.",
|
|
7
|
+
synopsis: [
|
|
8
|
+
"agentplane task findings add <task-id> --observation <text> --impact <text> --resolution <text> [--local-only] [--repo-fixable] [--incident-scope <text>] [--incident-tag <tag>] [--incident-match <term>] [--incident-advice <text>] [--incident-rule <text>] [--updated-by <id>]",
|
|
9
|
+
],
|
|
10
|
+
args: [{ name: "task-id", required: true, valueHint: "<task-id>" }],
|
|
11
|
+
options: [
|
|
12
|
+
{
|
|
13
|
+
kind: "string",
|
|
14
|
+
name: "observation",
|
|
15
|
+
valueHint: "<text>",
|
|
16
|
+
description: "Required. Observation field.",
|
|
17
|
+
},
|
|
18
|
+
{ kind: "string", name: "impact", valueHint: "<text>", description: "Required. Impact field." },
|
|
19
|
+
{
|
|
20
|
+
kind: "string",
|
|
21
|
+
name: "resolution",
|
|
22
|
+
valueHint: "<text>",
|
|
23
|
+
description: "Required. Resolution field.",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
kind: "boolean",
|
|
27
|
+
name: "promote",
|
|
28
|
+
description: "Compatibility flag. Promotion is the default unless `--local-only` is set.",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
kind: "boolean",
|
|
32
|
+
name: "external",
|
|
33
|
+
description: "Compatibility flag. External incident metadata is the default unless `--local-only` is set.",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
kind: "boolean",
|
|
37
|
+
name: "repo-fixable",
|
|
38
|
+
description: "Mark the structured finding as repo-fixable so it can promote into incidents.md.",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
kind: "boolean",
|
|
42
|
+
name: "local-only",
|
|
43
|
+
default: false,
|
|
44
|
+
description: "Keep the entry task-local only; omit `Promotion: incident-candidate` and any explicit fixability marker.",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
kind: "string",
|
|
48
|
+
name: "incident-scope",
|
|
49
|
+
valueHint: "<text>",
|
|
50
|
+
description: "Optional. IncidentScope override.",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
kind: "string",
|
|
54
|
+
name: "incident-tag",
|
|
55
|
+
valueHint: "<tag>",
|
|
56
|
+
repeatable: true,
|
|
57
|
+
description: "Repeatable. IncidentTags entry.",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
kind: "string",
|
|
61
|
+
name: "incident-match",
|
|
62
|
+
valueHint: "<term>",
|
|
63
|
+
repeatable: true,
|
|
64
|
+
description: "Repeatable. IncidentMatch entry.",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
kind: "string",
|
|
68
|
+
name: "incident-advice",
|
|
69
|
+
valueHint: "<text>",
|
|
70
|
+
description: "Optional. IncidentAdvice field.",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
kind: "string",
|
|
74
|
+
name: "incident-rule",
|
|
75
|
+
valueHint: "<text>",
|
|
76
|
+
description: "Optional. IncidentRule field.",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
kind: "string",
|
|
80
|
+
name: "updated-by",
|
|
81
|
+
valueHint: "<id>",
|
|
82
|
+
description: "Optional. Override doc_updated_by metadata (must be non-empty).",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
examples: [
|
|
86
|
+
{
|
|
87
|
+
cmd: 'agentplane task findings add 202602030608-F1Q8AB --observation "GitHub API EOF retries were manual." --impact "Operators repeated the reconcile loop." --resolution "Switch the retry path to REST polling." --incident-scope "GitHub PR reconciliation" --incident-tag workflow --incident-tag github',
|
|
88
|
+
why: "Append a promotable external incident candidate without hand-editing the README or remembering hidden flags.",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
cmd: 'agentplane task findings add 202602030608-F1Q8AB --observation "One manual follow-up remains." --impact "Task notes should stay local." --resolution "Track it in Findings only." --local-only',
|
|
92
|
+
why: "Keep an observation task-local when it should not feed incidents collection.",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
validateRaw: (raw) => {
|
|
96
|
+
for (const key of ["observation", "impact", "resolution"]) {
|
|
97
|
+
const value = raw.opts[key];
|
|
98
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
99
|
+
throw usageError({
|
|
100
|
+
spec: taskFindingsAddSpec,
|
|
101
|
+
message: `Missing required option: --${key}.`,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const updatedBy = raw.opts["updated-by"];
|
|
106
|
+
if (typeof updatedBy === "string" && updatedBy.trim() === "") {
|
|
107
|
+
throw usageError({ spec: taskFindingsAddSpec, message: "--updated-by must be non-empty." });
|
|
108
|
+
}
|
|
109
|
+
if (raw.opts["local-only"] === true &&
|
|
110
|
+
(raw.opts.promote === true || raw.opts.external === true || raw.opts["repo-fixable"] === true)) {
|
|
111
|
+
throw usageError({
|
|
112
|
+
spec: taskFindingsAddSpec,
|
|
113
|
+
message: "--local-only cannot be combined with --promote, --external, or --repo-fixable.",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (raw.opts.external === true && raw.opts["repo-fixable"] === true) {
|
|
117
|
+
throw usageError({
|
|
118
|
+
spec: taskFindingsAddSpec,
|
|
119
|
+
message: "--external and --repo-fixable are mutually exclusive.",
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
parse: (raw) => {
|
|
124
|
+
const localOnly = raw.opts["local-only"] === true;
|
|
125
|
+
const repoFixable = raw.opts["repo-fixable"] === true;
|
|
126
|
+
const fixability = localOnly ? null : repoFixable ? "repo-fixable" : "external";
|
|
127
|
+
return {
|
|
128
|
+
taskId: String(raw.args["task-id"]),
|
|
129
|
+
observation: String(raw.opts.observation),
|
|
130
|
+
impact: String(raw.opts.impact),
|
|
131
|
+
resolution: String(raw.opts.resolution),
|
|
132
|
+
promote: !localOnly,
|
|
133
|
+
external: !localOnly,
|
|
134
|
+
fixability,
|
|
135
|
+
incidentScope: typeof raw.opts["incident-scope"] === "string" ? raw.opts["incident-scope"] : undefined,
|
|
136
|
+
incidentTags: raw.opts["incident-tag"] ?? [],
|
|
137
|
+
incidentMatch: raw.opts["incident-match"] ?? [],
|
|
138
|
+
incidentAdvice: typeof raw.opts["incident-advice"] === "string" ? raw.opts["incident-advice"] : undefined,
|
|
139
|
+
incidentRule: typeof raw.opts["incident-rule"] === "string" ? raw.opts["incident-rule"] : undefined,
|
|
140
|
+
updatedBy: typeof raw.opts["updated-by"] === "string" ? raw.opts["updated-by"] : undefined,
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
export function makeRunTaskFindingsAddHandler(getCtx) {
|
|
145
|
+
return async (ctx, p) => {
|
|
146
|
+
return await cmdTaskFindingsAdd({
|
|
147
|
+
ctx: await getCtx("task findings add"),
|
|
148
|
+
cwd: ctx.cwd,
|
|
149
|
+
rootOverride: ctx.rootOverride,
|
|
150
|
+
taskId: p.taskId,
|
|
151
|
+
observation: p.observation,
|
|
152
|
+
impact: p.impact,
|
|
153
|
+
resolution: p.resolution,
|
|
154
|
+
promote: p.promote,
|
|
155
|
+
external: p.external,
|
|
156
|
+
fixability: p.fixability === "repo-fixable" ? "repo-fixable" : null,
|
|
157
|
+
incidentScope: p.incidentScope,
|
|
158
|
+
incidentTags: p.incidentTags,
|
|
159
|
+
incidentMatch: p.incidentMatch,
|
|
160
|
+
incidentAdvice: p.incidentAdvice,
|
|
161
|
+
incidentRule: p.incidentRule,
|
|
162
|
+
updatedBy: p.updatedBy,
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CommandCtx, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
export type TaskFindingsParsed = {
|
|
3
|
+
subcommand?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const taskFindingsSpec: CommandSpec<TaskFindingsParsed>;
|
|
6
|
+
export declare function runTaskFindings(_ctx: CommandCtx, p: TaskFindingsParsed): Promise<number>;
|
|
7
|
+
//# sourceMappingURL=findings.command.d.ts.map
|