agentplane 0.3.8 → 0.3.10
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 +4 -2
- package/assets/agents/CODER.json +1 -1
- package/assets/policy/dod.core.md +1 -1
- package/assets/policy/governance.md +3 -0
- package/assets/policy/incidents.md +22 -11
- package/assets/policy/workflow.branch_pr.md +2 -0
- package/assets/policy/workflow.direct.md +3 -1
- package/dist/.build-manifest.json +323 -128
- package/dist/cli/bootstrap-guide.d.ts +1 -0
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +19 -1
- package/dist/cli/command-invocations.d.ts.map +1 -1
- package/dist/cli/command-invocations.js +2 -0
- package/dist/cli/command-snippets.d.ts +2 -0
- package/dist/cli/command-snippets.d.ts.map +1 -1
- package/dist/cli/command-snippets.js +2 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.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/config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.js +13 -0
- package/dist/cli/run-cli.js +2 -2
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +34 -8
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +4 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +8 -4
- package/dist/commands/incidents/advise.command.d.ts +15 -0
- package/dist/commands/incidents/advise.command.d.ts.map +1 -0
- package/dist/commands/incidents/advise.command.js +139 -0
- package/dist/commands/incidents/collect.command.d.ts +11 -0
- package/dist/commands/incidents/collect.command.d.ts.map +1 -0
- package/dist/commands/incidents/collect.command.js +67 -0
- package/dist/commands/incidents/incidents.command.d.ts +5 -0
- package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
- package/dist/commands/incidents/incidents.command.js +21 -0
- package/dist/commands/incidents/shared.d.ts +42 -0
- package/dist/commands/incidents/shared.d.ts.map +1 -0
- package/dist/commands/incidents/shared.js +107 -0
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +73 -2
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +4 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/merge.js +23 -2
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +26 -1
- package/dist/commands/pr/internal/note-store.d.ts +18 -0
- package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
- package/dist/commands/pr/internal/note-store.js +66 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +3 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
- package/dist/commands/pr/internal/pr-paths.js +3 -0
- package/dist/commands/pr/internal/review-template.d.ts +24 -4
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
- package/dist/commands/pr/internal/review-template.js +188 -33
- package/dist/commands/pr/internal/sync.d.ts +32 -0
- package/dist/commands/pr/internal/sync.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync.js +258 -0
- package/dist/commands/pr/note.d.ts.map +1 -1
- package/dist/commands/pr/note.js +37 -4
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +7 -54
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +6 -3
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +5 -79
- package/dist/commands/recipes/impl/apply.d.ts +1 -1
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
- package/dist/commands/recipes/impl/apply.js +1 -1
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
- package/dist/commands/recipes/impl/commands/explain.js +1 -1
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +3 -2
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/remove.js +9 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.js +2 -1
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.js +2 -1
- package/dist/commands/recipes/impl/resolver.d.ts +1 -1
- package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
- package/dist/commands/recipes/impl/resolver.js +1 -1
- package/dist/commands/recipes.d.ts +4 -4
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +3 -3
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +9 -0
- package/dist/commands/release.test-helpers.d.ts +14 -0
- package/dist/commands/release.test-helpers.d.ts.map +1 -1
- package/dist/commands/release.test-helpers.js +14 -3
- package/dist/commands/shared/approval-requirements.d.ts +5 -7
- package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
- package/dist/commands/shared/approval-requirements.js +3 -73
- package/dist/commands/shared/network-approval.d.ts +2 -0
- package/dist/commands/shared/network-approval.d.ts.map +1 -1
- package/dist/commands/shared/network-approval.js +1 -1
- package/dist/commands/shared/pr-meta.d.ts +9 -0
- package/dist/commands/shared/pr-meta.d.ts.map +1 -1
- package/dist/commands/shared/pr-meta.js +27 -3
- package/dist/commands/shared/task-backend.d.ts +2 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-local-freshness.d.ts +13 -0
- package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
- package/dist/commands/shared/task-local-freshness.js +20 -0
- package/dist/commands/shared/task-mutation.d.ts +2 -0
- package/dist/commands/shared/task-mutation.d.ts.map +1 -1
- package/dist/commands/shared/task-mutation.js +7 -0
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +1 -0
- package/dist/commands/task/close-shared.d.ts.map +1 -1
- package/dist/commands/task/close-shared.js +1 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +5 -2
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +24 -0
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +69 -29
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +1 -0
- package/dist/commands/task/shared/transition-command.d.ts +2 -0
- package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
- package/dist/commands/task/shared/transition-command.js +1 -0
- package/dist/commands/task/start-ready.d.ts.map +1 -1
- package/dist/commands/task/start-ready.js +12 -1
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +11 -0
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +27 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +6 -1
- package/dist/policy/engine.d.ts +3 -1
- package/dist/policy/engine.d.ts.map +1 -1
- package/dist/policy/engine.js +5 -6
- package/dist/policy/taxonomy.d.ts +17 -0
- package/dist/policy/taxonomy.d.ts.map +1 -0
- package/dist/policy/taxonomy.js +302 -0
- package/dist/policy/types.d.ts +2 -1
- package/dist/policy/types.d.ts.map +1 -1
- package/dist/runner/artifacts.d.ts.map +1 -1
- package/dist/runner/artifacts.js +2 -0
- package/dist/runner/context/base-prompts.d.ts +25 -0
- package/dist/runner/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +182 -54
- package/dist/runner/context/recipe-context.d.ts.map +1 -1
- package/dist/runner/context/recipe-context.js +5 -0
- package/dist/runner/types.d.ts +12 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.js +81 -11
- package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
- package/dist/runner/usecases/task-run-inspect.js +9 -7
- package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
- package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
- package/dist/runner/usecases/task-run.d.ts.map +1 -1
- package/dist/runner/usecases/task-run.js +59 -12
- package/dist/runtime/approvals/index.d.ts +3 -0
- package/dist/runtime/approvals/index.d.ts.map +1 -0
- package/dist/runtime/approvals/index.js +1 -0
- package/dist/runtime/approvals/runtime.d.ts +12 -0
- package/dist/runtime/approvals/runtime.d.ts.map +1 -0
- package/dist/runtime/approvals/runtime.js +154 -0
- package/dist/runtime/approvals/types.d.ts +31 -0
- package/dist/runtime/approvals/types.d.ts.map +1 -0
- package/dist/runtime/approvals/types.js +1 -0
- package/dist/runtime/behavior/index.d.ts +3 -0
- package/dist/runtime/behavior/index.d.ts.map +1 -0
- package/dist/runtime/behavior/index.js +1 -0
- package/dist/runtime/behavior/resolve.d.ts +7 -0
- package/dist/runtime/behavior/resolve.d.ts.map +1 -0
- package/dist/runtime/behavior/resolve.js +66 -0
- package/dist/runtime/behavior/types.d.ts +25 -0
- package/dist/runtime/behavior/types.d.ts.map +1 -0
- package/dist/runtime/behavior/types.js +1 -0
- package/dist/runtime/capabilities/backend.d.ts +7 -0
- package/dist/runtime/capabilities/backend.d.ts.map +1 -0
- package/dist/runtime/capabilities/backend.js +104 -0
- package/dist/runtime/capabilities/index.d.ts +6 -0
- package/dist/runtime/capabilities/index.d.ts.map +1 -0
- package/dist/runtime/capabilities/index.js +4 -0
- package/dist/runtime/capabilities/recipe.d.ts +10 -0
- package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
- package/dist/runtime/capabilities/recipe.js +123 -0
- package/dist/runtime/capabilities/registry.d.ts +6 -0
- package/dist/runtime/capabilities/registry.d.ts.map +1 -0
- package/dist/runtime/capabilities/registry.js +69 -0
- package/dist/runtime/capabilities/runner.d.ts +8 -0
- package/dist/runtime/capabilities/runner.d.ts.map +1 -0
- package/dist/runtime/capabilities/runner.js +73 -0
- package/dist/runtime/capabilities/types.d.ts +28 -0
- package/dist/runtime/capabilities/types.d.ts.map +1 -0
- package/dist/runtime/capabilities/types.js +1 -0
- package/dist/runtime/execution-profile/index.d.ts +3 -0
- package/dist/runtime/execution-profile/index.d.ts.map +1 -0
- package/dist/runtime/execution-profile/index.js +1 -0
- package/dist/runtime/execution-profile/resolve.d.ts +9 -0
- package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
- package/dist/runtime/execution-profile/resolve.js +80 -0
- package/dist/runtime/execution-profile/types.d.ts +27 -0
- package/dist/runtime/execution-profile/types.d.ts.map +1 -0
- package/dist/runtime/execution-profile/types.js +1 -0
- package/dist/runtime/explain/index.d.ts +3 -0
- package/dist/runtime/explain/index.d.ts.map +1 -0
- package/dist/runtime/explain/index.js +1 -0
- package/dist/runtime/explain/resolve.d.ts +14 -0
- package/dist/runtime/explain/resolve.d.ts.map +1 -0
- package/dist/runtime/explain/resolve.js +50 -0
- package/dist/runtime/explain/types.d.ts +28 -0
- package/dist/runtime/explain/types.d.ts.map +1 -0
- package/dist/runtime/explain/types.js +1 -0
- package/dist/runtime/harness/index.d.ts +4 -0
- package/dist/runtime/harness/index.d.ts.map +1 -0
- package/dist/runtime/harness/index.js +2 -0
- package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
- package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
- package/dist/runtime/harness/resolve-from-command-context.js +11 -0
- package/dist/runtime/harness/resolve.d.ts +13 -0
- package/dist/runtime/harness/resolve.d.ts.map +1 -0
- package/dist/runtime/harness/resolve.js +146 -0
- package/dist/runtime/harness/types.d.ts +65 -0
- package/dist/runtime/harness/types.d.ts.map +1 -0
- package/dist/runtime/harness/types.js +1 -0
- package/dist/runtime/incidents/index.d.ts +3 -0
- package/dist/runtime/incidents/index.d.ts.map +1 -0
- package/dist/runtime/incidents/index.js +1 -0
- package/dist/runtime/incidents/resolve.d.ts +26 -0
- package/dist/runtime/incidents/resolve.d.ts.map +1 -0
- package/dist/runtime/incidents/resolve.js +437 -0
- package/dist/runtime/incidents/types.d.ts +72 -0
- package/dist/runtime/incidents/types.d.ts.map +1 -0
- package/dist/runtime/incidents/types.js +1 -0
- package/dist/runtime/protocol/index.d.ts +3 -0
- package/dist/runtime/protocol/index.d.ts.map +1 -0
- package/dist/runtime/protocol/index.js +2 -0
- package/dist/runtime/protocol/resolve.d.ts +16 -0
- package/dist/runtime/protocol/resolve.d.ts.map +1 -0
- package/dist/runtime/protocol/resolve.js +36 -0
- package/dist/runtime/protocol/types.d.ts +36 -0
- package/dist/runtime/protocol/types.d.ts.map +1 -0
- package/dist/runtime/protocol/types.js +1 -0
- package/dist/runtime/task-intake/index.d.ts +3 -0
- package/dist/runtime/task-intake/index.d.ts.map +1 -0
- package/dist/runtime/task-intake/index.js +1 -0
- package/dist/runtime/task-intake/resolve.d.ts +48 -0
- package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
- package/dist/runtime/task-intake/resolve.js +316 -0
- package/dist/runtime/task-intake/types.d.ts +117 -0
- package/dist/runtime/task-intake/types.d.ts.map +1 -0
- package/dist/runtime/task-intake/types.js +1 -0
- package/dist/shared/protected-paths.d.ts +4 -0
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +4 -4
- package/dist/usecases/context/resolve-context.d.ts +55 -6
- package/dist/usecases/context/resolve-context.d.ts.map +1 -1
- package/dist/usecases/context/resolve-context.js +96 -6
- package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
- package/dist/usecases/task/task-list-usecase.js +8 -2
- package/dist/usecases/task/task-new-usecase.js +4 -4
- package/package.json +2 -3
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { setMarkdownSection } from "@agentplaneorg/core";
|
|
2
2
|
import { mapBackendError } from "../../cli/error-map.js";
|
|
3
3
|
import { backendNotSupportedMessage, warnMessage } from "../../cli/output.js";
|
|
4
|
+
import { createClarificationContract, createTaskGraphDraft, createTaskIntakeContext, materializeTaskGraphDraft, } from "../../runtime/task-intake/index.js";
|
|
4
5
|
import { CliError } from "../../shared/errors.js";
|
|
5
6
|
import { buildTaskDocState } from "../../shared/task-doc-state.js";
|
|
7
|
+
import { makeReadOnlyUsecaseContext } from "../../usecases/context/resolve-context.js";
|
|
6
8
|
import { loadCommandContext } from "../shared/task-backend.js";
|
|
7
9
|
import { ensureTaskDependsOnGraphIsAcyclic, nowIso, requiresVerifyStepsByPrimary, resolvePrimaryTag, warnIfUnknownOwner, } from "./shared.js";
|
|
8
10
|
import { buildDefaultVerifyStepsSection, defaultTaskDocV3, TASK_DOC_VERSION_V3, } from "./doc-template.js";
|
|
@@ -67,32 +69,16 @@ export async function runTaskNewParsed(opts) {
|
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
const taskId = await ctx.taskBackend.generateTaskId({ length: suffixLength, attempts: 1000 });
|
|
72
|
+
const executionContext = await makeReadOnlyUsecaseContext(ctx);
|
|
73
|
+
const createdAt = nowIso();
|
|
70
74
|
const docState = buildTaskDocState({
|
|
71
75
|
doc: defaultTaskDocV3({ title: p.title, description: p.description }),
|
|
72
76
|
owner: p.owner,
|
|
73
77
|
updatedBy: p.owner,
|
|
74
78
|
version: TASK_DOC_VERSION_V3,
|
|
75
|
-
updatedAt:
|
|
79
|
+
updatedAt: createdAt,
|
|
76
80
|
});
|
|
77
|
-
|
|
78
|
-
id: taskId,
|
|
79
|
-
title: p.title,
|
|
80
|
-
description: p.description,
|
|
81
|
-
status: "TODO",
|
|
82
|
-
priority: p.priority,
|
|
83
|
-
owner: p.owner,
|
|
84
|
-
revision: 1,
|
|
85
|
-
origin: { system: "manual" },
|
|
86
|
-
tags: p.tags,
|
|
87
|
-
depends_on: p.dependsOn,
|
|
88
|
-
verify: p.verify,
|
|
89
|
-
comments: [],
|
|
90
|
-
doc_version: docState.doc_version,
|
|
91
|
-
doc_updated_at: docState.doc_updated_at,
|
|
92
|
-
doc_updated_by: docState.doc_updated_by,
|
|
93
|
-
id_source: "generated",
|
|
94
|
-
doc: docState.doc,
|
|
95
|
-
};
|
|
81
|
+
let taskDoc = docState.doc;
|
|
96
82
|
const spikeTag = (ctx.config.tasks.verify.spike_tag ?? "spike").trim().toLowerCase();
|
|
97
83
|
const primary = resolvePrimaryTag(p.tags, ctx);
|
|
98
84
|
if (primary.usedFallback) {
|
|
@@ -106,7 +92,7 @@ export async function runTaskNewParsed(opts) {
|
|
|
106
92
|
dependsOn: p.dependsOn,
|
|
107
93
|
});
|
|
108
94
|
if (requiresVerifySteps) {
|
|
109
|
-
|
|
95
|
+
taskDoc = setMarkdownSection(taskDoc, "Verify Steps", buildDefaultVerifyStepsSection({
|
|
110
96
|
primary: primary.primary,
|
|
111
97
|
verifyCommands: p.verify,
|
|
112
98
|
}));
|
|
@@ -118,17 +104,71 @@ export async function runTaskNewParsed(opts) {
|
|
|
118
104
|
process.stderr.write(`${warnMessage("spike is combined with a primary tag that requires verify steps; consider splitting spike vs implementation tasks")}\n`);
|
|
119
105
|
}
|
|
120
106
|
const normalizedDoc = buildTaskDocState({
|
|
121
|
-
doc:
|
|
107
|
+
doc: taskDoc,
|
|
122
108
|
owner: p.owner,
|
|
123
|
-
updatedBy:
|
|
109
|
+
updatedBy: p.owner,
|
|
124
110
|
version: TASK_DOC_VERSION_V3,
|
|
125
|
-
updatedAt:
|
|
111
|
+
updatedAt: createdAt,
|
|
112
|
+
});
|
|
113
|
+
const intakeContext = createTaskIntakeContext({
|
|
114
|
+
runtime: executionContext.taskIntake,
|
|
115
|
+
source: {
|
|
116
|
+
id: "task_new",
|
|
117
|
+
detail: "task new",
|
|
118
|
+
},
|
|
119
|
+
requested_outcome: p.title,
|
|
120
|
+
requested_owner: p.owner,
|
|
121
|
+
requested_tags: p.tags,
|
|
122
|
+
requested_verify: p.verify,
|
|
123
|
+
requested_dependencies: p.dependsOn,
|
|
124
|
+
inputs: [
|
|
125
|
+
{
|
|
126
|
+
kind: "text",
|
|
127
|
+
label: "description",
|
|
128
|
+
value: p.description,
|
|
129
|
+
required: true,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
const clarification = createClarificationContract({
|
|
134
|
+
context: intakeContext,
|
|
135
|
+
});
|
|
136
|
+
const draft = createTaskGraphDraft({
|
|
137
|
+
context: intakeContext,
|
|
138
|
+
clarification,
|
|
139
|
+
summary: p.title,
|
|
140
|
+
tasks: [
|
|
141
|
+
{
|
|
142
|
+
draft_id: "task_1",
|
|
143
|
+
title: p.title,
|
|
144
|
+
description: p.description,
|
|
145
|
+
owner: p.owner,
|
|
146
|
+
priority: p.priority,
|
|
147
|
+
origin: { system: "manual" },
|
|
148
|
+
tags: p.tags,
|
|
149
|
+
depends_on: p.dependsOn,
|
|
150
|
+
verify: p.verify,
|
|
151
|
+
doc: normalizedDoc.doc,
|
|
152
|
+
doc_version: normalizedDoc.doc_version,
|
|
153
|
+
id_source: "generated",
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
});
|
|
157
|
+
const materialization = await materializeTaskGraphDraft({
|
|
158
|
+
draft,
|
|
159
|
+
task_ids: {
|
|
160
|
+
task_1: taskId,
|
|
161
|
+
},
|
|
162
|
+
created_at: createdAt,
|
|
126
163
|
});
|
|
127
|
-
task
|
|
128
|
-
task
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
164
|
+
const task = materialization.tasks[0]?.task;
|
|
165
|
+
if (!task) {
|
|
166
|
+
throw new CliError({
|
|
167
|
+
exitCode: 3,
|
|
168
|
+
code: "E_VALIDATION",
|
|
169
|
+
message: "Task intake materialization unexpectedly produced no tasks.",
|
|
170
|
+
});
|
|
171
|
+
}
|
|
132
172
|
await ctx.taskBackend.writeTask(task);
|
|
133
173
|
process.stdout.write(`${taskId}\n`);
|
|
134
174
|
return 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-status.d.ts","sourceRoot":"","sources":["../../../src/commands/task/set-status.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAYnC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"set-status.d.ts","sourceRoot":"","sources":["../../../src/commands/task/set-status.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAYnC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoHlB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TaskData } from "../../../backends/task-backend.js";
|
|
2
|
+
import type { PolicyActionId } from "../../../policy/taxonomy.js";
|
|
2
3
|
import type { CommandContext } from "../../shared/task-backend.js";
|
|
3
4
|
import { type ExecuteTaskStatusTransitionRequest, type TaskStatusTransitionExecution } from "./workflow-transition-service.js";
|
|
4
5
|
type TaskStatusTransitionCommandRequest = Omit<ExecuteTaskStatusTransitionRequest, "task" | "backend" | "config">;
|
|
@@ -6,6 +7,7 @@ export declare function applyTaskStatusTransitionCommand(opts: {
|
|
|
6
7
|
ctx: CommandContext;
|
|
7
8
|
taskId: string;
|
|
8
9
|
quiet: boolean;
|
|
10
|
+
policyAction?: PolicyActionId;
|
|
9
11
|
build: (current: TaskData) => TaskStatusTransitionCommandRequest | Promise<TaskStatusTransitionCommandRequest>;
|
|
10
12
|
}): Promise<{
|
|
11
13
|
execution: TaskStatusTransitionExecution;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-command.d.ts","sourceRoot":"","sources":["../../../../src/commands/task/shared/transition-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,EAGL,KAAK,kCAAkC,EACvC,KAAK,6BAA6B,EACnC,MAAM,kCAAkC,CAAC;AAE1C,KAAK,kCAAkC,GAAG,IAAI,CAC5C,kCAAkC,EAClC,MAAM,GAAG,SAAS,GAAG,QAAQ,CAC9B,CAAC;AAEF,wBAAsB,gCAAgC,CAAC,IAAI,EAAE;IAC3D,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,CACL,OAAO,EAAE,QAAQ,KACd,kCAAkC,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;CACvF,GAAG,OAAO,CAAC;IACV,SAAS,EAAE,6BAA6B,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,
|
|
1
|
+
{"version":3,"file":"transition-command.d.ts","sourceRoot":"","sources":["../../../../src/commands/task/shared/transition-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,EAGL,KAAK,kCAAkC,EACvC,KAAK,6BAA6B,EACnC,MAAM,kCAAkC,CAAC;AAE1C,KAAK,kCAAkC,GAAG,IAAI,CAC5C,kCAAkC,EAClC,MAAM,GAAG,SAAS,GAAG,QAAQ,CAC9B,CAAC;AAEF,wBAAsB,gCAAgC,CAAC,IAAI,EAAE;IAC3D,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,KAAK,EAAE,CACL,OAAO,EAAE,QAAQ,KACd,kCAAkC,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;CACvF,GAAG,OAAO,CAAC;IACV,SAAS,EAAE,6BAA6B,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAyCD"}
|
|
@@ -11,6 +11,7 @@ export async function applyTaskStatusTransitionCommand(opts) {
|
|
|
11
11
|
await applyTaskMutation({
|
|
12
12
|
ctx: opts.ctx,
|
|
13
13
|
taskId: opts.taskId,
|
|
14
|
+
policyAction: opts.policyAction ?? "task_status_transition",
|
|
14
15
|
build: async (current) => {
|
|
15
16
|
const request = await opts.build(current);
|
|
16
17
|
execution = await executeTaskStatusTransitionRequest({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-ready.d.ts","sourceRoot":"","sources":["../../../src/commands/task/start-ready.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start-ready.d.ts","sourceRoot":"","sources":["../../../src/commands/task/start-ready.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKpF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuClB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { mapBackendError } from "../../cli/error-map.js";
|
|
2
|
-
import { successMessage } from "../../cli/output.js";
|
|
2
|
+
import { infoMessage, successMessage } from "../../cli/output.js";
|
|
3
3
|
import { CliError } from "../../shared/errors.js";
|
|
4
|
+
import { renderIncidentAdvice } from "../../runtime/incidents/index.js";
|
|
4
5
|
import { loadCommandContext } from "../shared/task-backend.js";
|
|
6
|
+
import { adviseTaskIncidents } from "../incidents/shared.js";
|
|
5
7
|
import { cmdStart } from "./start.js";
|
|
6
8
|
export async function cmdTaskStartReady(opts) {
|
|
7
9
|
try {
|
|
@@ -26,6 +28,15 @@ export async function cmdTaskStartReady(opts) {
|
|
|
26
28
|
});
|
|
27
29
|
if (!opts.quiet) {
|
|
28
30
|
process.stdout.write(`${successMessage("ready", opts.taskId)}\n`);
|
|
31
|
+
const advice = await adviseTaskIncidents({
|
|
32
|
+
ctx,
|
|
33
|
+
taskId: opts.taskId,
|
|
34
|
+
limit: 3,
|
|
35
|
+
});
|
|
36
|
+
if (advice.matches.length > 0) {
|
|
37
|
+
process.stdout.write(`${infoMessage("incident advice for analogous tasks")}\n`);
|
|
38
|
+
process.stdout.write(`${renderIncidentAdvice(advice.matches)}\n`);
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
41
|
return result;
|
|
31
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/task/start.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/task/start.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA6DpF,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACnC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+FlB"}
|
|
@@ -3,6 +3,7 @@ import { successMessage } from "../../cli/output.js";
|
|
|
3
3
|
import { CliError } from "../../shared/errors.js";
|
|
4
4
|
import { ensureActionApproved } from "../shared/approval-requirements.js";
|
|
5
5
|
import { loadCommandContext } from "../shared/task-backend.js";
|
|
6
|
+
import { ensurePrArtifactsSynced } from "../pr/internal/sync.js";
|
|
6
7
|
import { applyTaskStatusTransitionCommand, ensurePlanApprovedIfRequired, extractTaskObservationSection, defaultCommitEmojiForStatus, extractDocSection, isVerifyStepsFilled, normalizeTaskDocVersion, nowIso, prepareTaskTransitionComment, requiresVerifyStepsByPrimary, requireStructuredComment, runTaskTransitionCommentCommit, taskObservationSectionName, toStringArray, } from "./shared.js";
|
|
7
8
|
function assertStartDocRequirements(task, config) {
|
|
8
9
|
if (config.agents?.approvals?.require_plan === true)
|
|
@@ -65,6 +66,7 @@ export async function cmdStart(opts) {
|
|
|
65
66
|
ctx,
|
|
66
67
|
taskId: opts.taskId,
|
|
67
68
|
quiet: opts.quiet,
|
|
69
|
+
policyAction: "task_start",
|
|
68
70
|
build: (current) => {
|
|
69
71
|
assertStartDocRequirements(current, ctx.config);
|
|
70
72
|
ensurePlanApprovedIfRequired(current, ctx.config);
|
|
@@ -109,6 +111,15 @@ export async function cmdStart(opts) {
|
|
|
109
111
|
resolveExecutorAgent: true,
|
|
110
112
|
});
|
|
111
113
|
}
|
|
114
|
+
if (ctx.config.workflow_mode === "branch_pr") {
|
|
115
|
+
await ensurePrArtifactsSynced({
|
|
116
|
+
ctx,
|
|
117
|
+
cwd: opts.cwd,
|
|
118
|
+
rootOverride: opts.rootOverride,
|
|
119
|
+
taskId: opts.taskId,
|
|
120
|
+
author: opts.author,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
112
123
|
if (!opts.quiet) {
|
|
113
124
|
const suffix = commitInfo ? ` (commit=${commitInfo.hash.slice(0, 12)})` : "";
|
|
114
125
|
process.stdout.write(`${successMessage("started", `${opts.taskId}${suffix}`)}\n`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-record.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-record.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify-record.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-record.ts"],"names":[],"mappings":"AAQA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAYpF,KAAK,WAAW,GAAG,IAAI,GAAG,cAAc,CAAC;AA0KzC,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAMlB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB"}
|
|
@@ -3,9 +3,13 @@ import path from "node:path";
|
|
|
3
3
|
import { mapBackendError, mapCoreError } from "../../cli/error-map.js";
|
|
4
4
|
import { backendNotSupportedMessage, successMessage } from "../../cli/output.js";
|
|
5
5
|
import { CliError } from "../../shared/errors.js";
|
|
6
|
+
import { writeJsonStableIfChanged } from "../../shared/write-if-changed.js";
|
|
6
7
|
import { ensureReconciledBeforeMutation } from "../shared/reconcile-check.js";
|
|
7
8
|
import { loadCommandContext } from "../shared/task-backend.js";
|
|
8
9
|
import { applyTaskMutation } from "../shared/task-mutation.js";
|
|
10
|
+
import { ensurePrArtifactsSynced } from "../pr/internal/sync.js";
|
|
11
|
+
import { resolvePrPaths } from "../pr/internal/pr-paths.js";
|
|
12
|
+
import { buildVerifiedPrMeta, parsePrMeta } from "../shared/pr-meta.js";
|
|
9
13
|
import { decodeEscapedTaskTextNewlines, executeTaskVerificationTransitionRequest, nowIso, } from "./shared.js";
|
|
10
14
|
async function recordVerificationResult(opts) {
|
|
11
15
|
const ctx = opts.ctx ??
|
|
@@ -40,6 +44,29 @@ async function recordVerificationResult(opts) {
|
|
|
40
44
|
return { intents: execution.intents };
|
|
41
45
|
},
|
|
42
46
|
});
|
|
47
|
+
if (config.workflow_mode === "branch_pr") {
|
|
48
|
+
const syncResult = await ensurePrArtifactsSynced({
|
|
49
|
+
ctx,
|
|
50
|
+
cwd: opts.cwd,
|
|
51
|
+
rootOverride: opts.rootOverride,
|
|
52
|
+
taskId: opts.taskId,
|
|
53
|
+
author: opts.by,
|
|
54
|
+
});
|
|
55
|
+
if (syncResult) {
|
|
56
|
+
const { metaPath } = await resolvePrPaths({
|
|
57
|
+
ctx,
|
|
58
|
+
cwd: opts.cwd,
|
|
59
|
+
rootOverride: opts.rootOverride,
|
|
60
|
+
taskId: opts.taskId,
|
|
61
|
+
});
|
|
62
|
+
const meta = parsePrMeta(await readFile(metaPath, "utf8"), opts.taskId);
|
|
63
|
+
await writeJsonStableIfChanged(metaPath, buildVerifiedPrMeta({
|
|
64
|
+
meta,
|
|
65
|
+
at,
|
|
66
|
+
state: opts.state === "ok" ? "pass" : "fail",
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
43
70
|
if (!opts.quiet) {
|
|
44
71
|
const readmePath = path.join(resolved.gitRoot, config.paths.workflow_dir, opts.taskId, "README.md");
|
|
45
72
|
const relReadmePath = path.relative(resolved.gitRoot, readmePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAgCA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAA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B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyQlB;AAED,OAAO,EACL,kCAAkC,EAClC,qBAAqB,EACrB,iCAAiC,GAClC,MAAM,qBAAqB,CAAC"}
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -62,7 +62,12 @@ export async function cmdUpgradeParsed(opts) {
|
|
|
62
62
|
const ensureApproved = async (reason) => {
|
|
63
63
|
if (networkApproved)
|
|
64
64
|
return;
|
|
65
|
-
await ensureNetworkApproved({
|
|
65
|
+
await ensureNetworkApproved({
|
|
66
|
+
action: "upgrade_apply",
|
|
67
|
+
config: loaded.config,
|
|
68
|
+
yes: flags.yes,
|
|
69
|
+
reason,
|
|
70
|
+
});
|
|
66
71
|
networkApproved = true;
|
|
67
72
|
};
|
|
68
73
|
const hasBundle = Boolean(flags.bundle);
|
package/dist/policy/engine.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { AgentplaneConfig } from "@agentplaneorg/core";
|
|
2
|
+
import { type PolicyActionDescriptor } from "./taxonomy.js";
|
|
2
3
|
import type { PolicyAction, PolicyContext, PolicyProblem } from "./types.js";
|
|
3
4
|
export type PolicyDecision = {
|
|
4
5
|
ok: boolean;
|
|
6
|
+
action: PolicyActionDescriptor;
|
|
5
7
|
violations: PolicyViolation[];
|
|
6
8
|
};
|
|
7
9
|
export type PolicyViolation = {
|
|
@@ -10,7 +12,7 @@ export type PolicyViolation = {
|
|
|
10
12
|
exitCode: number;
|
|
11
13
|
message: string;
|
|
12
14
|
};
|
|
13
|
-
export type ActionId = PolicyAction |
|
|
15
|
+
export type ActionId = PolicyAction | (string & {});
|
|
14
16
|
export type PolicyEngineContext = Omit<PolicyContext, "action"> & {
|
|
15
17
|
action: ActionId;
|
|
16
18
|
config: AgentplaneConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/policy/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAg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M,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAkBF,qBAAa,YAAY;IACvB,QAAQ,CAAC,GAAG,EAAE,mBAAmB,GAAG,cAAc;CAcnD"}
|
package/dist/policy/engine.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { evaluatePolicy } from "./evaluate.js";
|
|
2
|
+
import { resolvePolicyActionDescriptor } from "./taxonomy.js";
|
|
2
3
|
function toViolations(result) {
|
|
3
4
|
const out = [];
|
|
4
5
|
for (const err of result.errors) {
|
|
@@ -17,16 +18,14 @@ function toViolations(result) {
|
|
|
17
18
|
export class PolicyEngine {
|
|
18
19
|
evaluate(ctx) {
|
|
19
20
|
const action = ctx.action;
|
|
21
|
+
const descriptor = resolvePolicyActionDescriptor(action);
|
|
20
22
|
// Delegate existing policy actions to the current rule engine.
|
|
21
|
-
if (
|
|
22
|
-
action === "commit" ||
|
|
23
|
-
action === "hook_pre_commit" ||
|
|
24
|
-
action === "hook_commit_msg") {
|
|
23
|
+
if (descriptor.enforcement === "git_rules") {
|
|
25
24
|
const result = evaluatePolicy(ctx);
|
|
26
|
-
return { ok: result.ok, violations: toViolations(result) };
|
|
25
|
+
return { ok: result.ok, action: descriptor, violations: toViolations(result) };
|
|
27
26
|
}
|
|
28
27
|
// Default: no-op. Usecases should still call into the engine so we can harden
|
|
29
28
|
// policy coverage incrementally without duplicating checks across commands.
|
|
30
|
-
return { ok: true, violations: [] };
|
|
29
|
+
return { ok: true, action: descriptor, violations: [] };
|
|
31
30
|
}
|
|
32
31
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type KnownPolicyActionId = "guard_commit" | "commit" | "hook_pre_commit" | "hook_commit_msg" | "network_access" | "force_action" | "policy_write" | "config_write" | "dangerous_fs" | "git_push" | "task_list" | "task_new" | "task_mutation" | "task_status_transition" | "task_start" | "task_block" | "task_set_status" | "task_finish" | "task_plan_set" | "task_plan_approve" | "task_verify" | "task_run" | "scenario_execute" | "recipe_install" | "recipe_list_remote" | "backend_sync" | "backend_migrate_canonical_state" | "backend_inspect" | "upgrade_apply" | "release_apply" | "doctor_fix";
|
|
2
|
+
export type PolicyActionId = KnownPolicyActionId | (string & {});
|
|
3
|
+
export type PolicyActionFamily = "git" | "task" | "runner" | "recipe" | "backend" | "release" | "upgrade" | "workflow" | "network" | "policy" | "config" | "filesystem" | "diagnostics" | "custom";
|
|
4
|
+
export type PolicyApprovalKind = "network_access" | "force_action" | "policy_write" | "config_write" | "dangerous_fs" | "git_push";
|
|
5
|
+
export type PolicyActionDescriptor = {
|
|
6
|
+
id: PolicyActionId;
|
|
7
|
+
family: PolicyActionFamily;
|
|
8
|
+
summary: string;
|
|
9
|
+
mutates_state: boolean;
|
|
10
|
+
risky: boolean;
|
|
11
|
+
destructive: boolean;
|
|
12
|
+
approval: PolicyApprovalKind | null;
|
|
13
|
+
enforcement: "git_rules" | "approval_only" | "none";
|
|
14
|
+
source: "builtin" | "custom";
|
|
15
|
+
};
|
|
16
|
+
export declare function resolvePolicyActionDescriptor(action: PolicyActionId): PolicyActionDescriptor;
|
|
17
|
+
//# sourceMappingURL=taxonomy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taxonomy.d.ts","sourceRoot":"","sources":["../../src/policy/taxonomy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,QAAQ,GACR,iBAAiB,GACjB,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,UAAU,GACV,WAAW,GACX,UAAU,GACV,eAAe,GACf,wBAAwB,GACxB,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,mBAAmB,GACnB,aAAa,GACb,UAAU,GACV,kBAAkB,GAClB,gBAAgB,GAChB,oBAAoB,GACpB,cAAc,GACd,iCAAiC,GACjC,iBAAiB,GACjB,eAAe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