agentplane 0.2.25 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/assets/AGENTS.md +123 -526
- package/assets/agents/UPGRADER.json +10 -9
- package/assets/framework.manifest.json +112 -7
- package/assets/policy/check-routing.mjs +180 -0
- package/assets/policy/dod.code.md +25 -0
- package/assets/policy/dod.core.md +32 -0
- package/assets/policy/dod.docs.md +32 -0
- package/assets/policy/examples/migration-note.md +6 -0
- package/assets/policy/examples/pr-note.md +16 -0
- package/assets/policy/examples/unit-test-pattern.md +19 -0
- package/assets/policy/governance.md +37 -0
- package/assets/policy/incidents.md +36 -0
- package/assets/policy/security.must.md +7 -0
- package/assets/policy/workflow.branch_pr.md +34 -0
- package/assets/policy/workflow.direct.md +46 -0
- package/assets/policy/workflow.md +9 -0
- package/assets/policy/workflow.release.md +31 -0
- package/assets/policy/workflow.upgrade.md +20 -0
- package/bin/agentplane.js +47 -57
- package/bin/dist-guard.js +124 -0
- package/dist/.build-manifest.json +11 -0
- package/dist/agents/agents-template.d.ts +7 -0
- package/dist/agents/agents-template.d.ts.map +1 -1
- package/dist/agents/agents-template.js +41 -2
- package/dist/backends/task-backend/local-backend.d.ts +2 -0
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend.js +12 -1
- package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/mapping.js +26 -1
- package/dist/backends/task-backend/redmine-backend.d.ts +4 -0
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +92 -9
- package/dist/backends/task-backend/shared/types.d.ts +1 -0
- package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
- package/dist/backends/task-index.d.ts.map +1 -1
- package/dist/backends/task-index.js +8 -1
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +39 -17
- package/dist/cli/command-snippets.d.ts +24 -0
- package/dist/cli/command-snippets.d.ts.map +1 -0
- package/dist/cli/command-snippets.js +23 -0
- package/dist/cli/reason-codes.d.ts +9 -0
- package/dist/cli/reason-codes.d.ts.map +1 -0
- package/dist/cli/reason-codes.js +79 -0
- package/dist/cli/recipes-bundled.d.ts +1 -0
- package/dist/cli/recipes-bundled.d.ts.map +1 -1
- package/dist/cli/recipes-bundled.js +4 -1
- 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/command-catalog.js +40 -1
- package/dist/cli/run-cli/commands/config.d.ts +5 -0
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.js +86 -1
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core.js +57 -2
- package/dist/cli/run-cli/commands/ide.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/ide.js +8 -3
- package/dist/cli/run-cli/commands/init/recipes.d.ts +5 -1
- package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/recipes.js +24 -4
- package/dist/cli/run-cli/commands/init/ui.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/ui.js +1 -2
- package/dist/cli/run-cli/commands/init/write-agents.d.ts +2 -0
- package/dist/cli/run-cli/commands/init/write-agents.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/write-agents.js +24 -5
- package/dist/cli/run-cli/commands/init/write-workflow.d.ts +12 -0
- package/dist/cli/run-cli/commands/init/write-workflow.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/write-workflow.js +58 -0
- package/dist/cli/run-cli/commands/init.d.ts +4 -1
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init.js +126 -48
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +195 -8
- package/dist/commands/backend/sync.command.d.ts.map +1 -1
- package/dist/commands/backend/sync.command.js +7 -6
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +2 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +107 -16
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +12 -6
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +36 -13
- package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
- package/dist/commands/recipes/impl/scenario.js +25 -0
- package/dist/commands/recipes/impl/types.d.ts +4 -0
- package/dist/commands/recipes/impl/types.d.ts.map +1 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +9 -4
- package/dist/commands/release/plan.command.d.ts.map +1 -1
- package/dist/commands/release/plan.command.js +9 -3
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
- package/dist/commands/scenario/impl/commands.js +74 -3
- package/dist/commands/scenario/impl/report.d.ts +8 -0
- package/dist/commands/scenario/impl/report.d.ts.map +1 -1
- package/dist/commands/scenario/impl/report.js +1 -0
- package/dist/commands/shared/reconcile-check.d.ts +7 -0
- package/dist/commands/shared/reconcile-check.d.ts.map +1 -0
- package/dist/commands/shared/reconcile-check.js +60 -0
- package/dist/commands/sync.command.d.ts.map +1 -1
- package/dist/commands/sync.command.js +9 -2
- package/dist/commands/task/add.d.ts.map +1 -1
- package/dist/commands/task/add.js +32 -0
- package/dist/commands/task/doc.command.d.ts.map +1 -1
- package/dist/commands/task/doc.command.js +1 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +11 -1
- package/dist/commands/task/list.d.ts.map +1 -1
- package/dist/commands/task/list.js +2 -1
- package/dist/commands/task/list.spec.d.ts.map +1 -1
- package/dist/commands/task/list.spec.js +7 -0
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +41 -4
- package/dist/commands/task/next.d.ts.map +1 -1
- package/dist/commands/task/next.js +2 -1
- package/dist/commands/task/next.spec.d.ts.map +1 -1
- package/dist/commands/task/next.spec.js +7 -0
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +7 -1
- package/dist/commands/task/search.d.ts.map +1 -1
- package/dist/commands/task/search.js +2 -1
- package/dist/commands/task/search.spec.d.ts.map +1 -1
- package/dist/commands/task/search.spec.js +7 -0
- package/dist/commands/task/shared.d.ts +14 -0
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +58 -1
- package/dist/commands/task/start-ready.js +1 -1
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +2 -0
- package/dist/commands/upgrade.command.d.ts.map +1 -1
- package/dist/commands/upgrade.command.js +2 -2
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +263 -294
- package/dist/commands/workflow-build.command.d.ts +8 -0
- package/dist/commands/workflow-build.command.d.ts.map +1 -0
- package/dist/commands/workflow-build.command.js +103 -0
- package/dist/commands/workflow-playbook.command.d.ts +10 -0
- package/dist/commands/workflow-playbook.command.d.ts.map +1 -0
- package/dist/commands/workflow-playbook.command.js +173 -0
- package/dist/commands/workflow-restore.command.d.ts +5 -0
- package/dist/commands/workflow-restore.command.d.ts.map +1 -0
- package/dist/commands/workflow-restore.command.js +30 -0
- package/dist/commands/workflow.command.d.ts +6 -0
- package/dist/commands/workflow.command.d.ts.map +1 -0
- package/dist/commands/workflow.command.js +36 -0
- package/dist/harness/dynamic-tool-contract.d.ts +29 -0
- package/dist/harness/dynamic-tool-contract.d.ts.map +1 -0
- package/dist/harness/dynamic-tool-contract.js +86 -0
- package/dist/harness/hooks-lifecycle.d.ts +27 -0
- package/dist/harness/hooks-lifecycle.d.ts.map +1 -0
- package/dist/harness/hooks-lifecycle.js +67 -0
- package/dist/harness/index.d.ts +9 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +8 -0
- package/dist/harness/reconcile.d.ts +37 -0
- package/dist/harness/reconcile.d.ts.map +1 -0
- package/dist/harness/reconcile.js +42 -0
- package/dist/harness/retry-policy.d.ts +31 -0
- package/dist/harness/retry-policy.d.ts.map +1 -0
- package/dist/harness/retry-policy.js +33 -0
- package/dist/harness/scheduler.d.ts +18 -0
- package/dist/harness/scheduler.d.ts.map +1 -0
- package/dist/harness/scheduler.js +55 -0
- package/dist/harness/state-machine.d.ts +17 -0
- package/dist/harness/state-machine.d.ts.map +1 -0
- package/dist/harness/state-machine.js +70 -0
- package/dist/harness/token-accounting.d.ts +19 -0
- package/dist/harness/token-accounting.d.ts.map +1 -0
- package/dist/harness/token-accounting.js +77 -0
- package/dist/harness/workspace-safety.d.ts +14 -0
- package/dist/harness/workspace-safety.d.ts.map +1 -0
- package/dist/harness/workspace-safety.js +62 -0
- package/dist/recipes/bundled-recipes.d.ts +4 -0
- package/dist/recipes/bundled-recipes.d.ts.map +1 -1
- package/dist/recipes/bundled-recipes.js +11 -0
- package/dist/shared/errors.d.ts +6 -0
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +1 -0
- package/dist/shared/policy-gateway.d.ts +15 -0
- package/dist/shared/policy-gateway.d.ts.map +1 -0
- package/dist/shared/policy-gateway.js +49 -0
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +1 -0
- package/dist/shared/runtime-artifacts.d.ts +2 -2
- package/dist/shared/runtime-artifacts.d.ts.map +1 -1
- package/dist/shared/runtime-artifacts.js +4 -0
- package/dist/workflow-runtime/build.d.ts +4 -0
- package/dist/workflow-runtime/build.d.ts.map +1 -0
- package/dist/workflow-runtime/build.js +126 -0
- package/dist/workflow-runtime/enforcement.d.ts +3 -0
- package/dist/workflow-runtime/enforcement.d.ts.map +1 -0
- package/dist/workflow-runtime/enforcement.js +10 -0
- package/dist/workflow-runtime/file-ops.d.ts +11 -0
- package/dist/workflow-runtime/file-ops.d.ts.map +1 -0
- package/dist/workflow-runtime/file-ops.js +248 -0
- package/dist/workflow-runtime/fix.d.ts +9 -0
- package/dist/workflow-runtime/fix.d.ts.map +1 -0
- package/dist/workflow-runtime/fix.js +107 -0
- package/dist/workflow-runtime/index.d.ts +11 -0
- package/dist/workflow-runtime/index.d.ts.map +1 -0
- package/dist/workflow-runtime/index.js +10 -0
- package/dist/workflow-runtime/markdown.d.ts +10 -0
- package/dist/workflow-runtime/markdown.d.ts.map +1 -0
- package/dist/workflow-runtime/markdown.js +147 -0
- package/dist/workflow-runtime/observability.d.ts +12 -0
- package/dist/workflow-runtime/observability.d.ts.map +1 -0
- package/dist/workflow-runtime/observability.js +14 -0
- package/dist/workflow-runtime/paths.d.ts +3 -0
- package/dist/workflow-runtime/paths.d.ts.map +1 -0
- package/dist/workflow-runtime/paths.js +11 -0
- package/dist/workflow-runtime/template.d.ts +7 -0
- package/dist/workflow-runtime/template.d.ts.map +1 -0
- package/dist/workflow-runtime/template.js +94 -0
- package/dist/workflow-runtime/types.d.ts +68 -0
- package/dist/workflow-runtime/types.d.ts.map +1 -0
- package/dist/workflow-runtime/types.js +1 -0
- package/dist/workflow-runtime/validate.d.ts +8 -0
- package/dist/workflow-runtime/validate.d.ts.map +1 -0
- package/dist/workflow-runtime/validate.js +331 -0
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { saveConfig, setByDottedKey } from "@agentplaneorg/core";
|
|
2
|
+
import { buildExecutionProfile, saveConfig, setByDottedKey } from "@agentplaneorg/core";
|
|
3
3
|
import { usageError } from "../../spec/errors.js";
|
|
4
4
|
import { wrapCommand } from "./wrap-command.js";
|
|
5
5
|
export const configShowSpec = {
|
|
@@ -117,3 +117,88 @@ export function makeRunModeSetHandler(deps) {
|
|
|
117
117
|
deps,
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
+
const PROFILE_PRESETS = {
|
|
121
|
+
light: {
|
|
122
|
+
requirePlan: false,
|
|
123
|
+
requireNetwork: false,
|
|
124
|
+
requireVerify: false,
|
|
125
|
+
executionProfile: "aggressive",
|
|
126
|
+
strictUnsafeConfirm: false,
|
|
127
|
+
},
|
|
128
|
+
normal: {
|
|
129
|
+
requirePlan: true,
|
|
130
|
+
requireNetwork: true,
|
|
131
|
+
requireVerify: true,
|
|
132
|
+
executionProfile: "balanced",
|
|
133
|
+
strictUnsafeConfirm: false,
|
|
134
|
+
},
|
|
135
|
+
"full-harness": {
|
|
136
|
+
requirePlan: true,
|
|
137
|
+
requireNetwork: true,
|
|
138
|
+
requireVerify: true,
|
|
139
|
+
executionProfile: "conservative",
|
|
140
|
+
strictUnsafeConfirm: true,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
function normalizeProfile(value) {
|
|
144
|
+
const normalized = value.trim().toLowerCase();
|
|
145
|
+
if (normalized === "light" || normalized === "vibecoder")
|
|
146
|
+
return "light";
|
|
147
|
+
if (normalized === "normal" || normalized === "manager")
|
|
148
|
+
return "normal";
|
|
149
|
+
if (normalized === "full-harness" || normalized === "developer" || normalized === "enterprise") {
|
|
150
|
+
return "full-harness";
|
|
151
|
+
}
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
export const profileSetSpec = {
|
|
155
|
+
id: ["profile", "set"],
|
|
156
|
+
group: "Config",
|
|
157
|
+
summary: "Apply setup profile presets to config.",
|
|
158
|
+
args: [{ name: "profile", required: true, valueHint: "<light|normal|full-harness>" }],
|
|
159
|
+
examples: [
|
|
160
|
+
{ cmd: "agentplane profile set light", why: "Apply flexible defaults." },
|
|
161
|
+
{ cmd: "agentplane profile set normal", why: "Apply balanced defaults." },
|
|
162
|
+
{ cmd: "agentplane profile set full-harness", why: "Apply strict defaults." },
|
|
163
|
+
],
|
|
164
|
+
parse: (raw) => ({ profile: String(raw.args.profile ?? "") }),
|
|
165
|
+
validate: (p) => {
|
|
166
|
+
if (!normalizeProfile(p.profile)) {
|
|
167
|
+
throw usageError({
|
|
168
|
+
spec: profileSetSpec,
|
|
169
|
+
command: "profile set",
|
|
170
|
+
message: `Invalid value for profile: ${p.profile} (expected: light|normal|full-harness)`,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
async function cmdProfileSet(opts) {
|
|
176
|
+
return wrapCommand({
|
|
177
|
+
command: "profile set",
|
|
178
|
+
rootOverride: opts.rootOverride,
|
|
179
|
+
context: { profile: opts.profile },
|
|
180
|
+
}, async () => {
|
|
181
|
+
const resolved = await opts.deps.getResolvedProject("profile set");
|
|
182
|
+
const loaded = await opts.deps.getLoadedConfig("profile set");
|
|
183
|
+
const raw = { ...loaded.raw };
|
|
184
|
+
const preset = PROFILE_PRESETS[opts.profile];
|
|
185
|
+
const execution = buildExecutionProfile(preset.executionProfile, {
|
|
186
|
+
strictUnsafeConfirm: preset.strictUnsafeConfirm,
|
|
187
|
+
});
|
|
188
|
+
setByDottedKey(raw, "agents.approvals.require_plan", String(preset.requirePlan));
|
|
189
|
+
setByDottedKey(raw, "agents.approvals.require_network", String(preset.requireNetwork));
|
|
190
|
+
setByDottedKey(raw, "agents.approvals.require_verify", String(preset.requireVerify));
|
|
191
|
+
setByDottedKey(raw, "execution", JSON.stringify(execution));
|
|
192
|
+
await saveConfig(resolved.agentplaneDir, raw);
|
|
193
|
+
process.stdout.write(`${opts.profile}\n`);
|
|
194
|
+
return 0;
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
export function makeRunProfileSetHandler(deps) {
|
|
198
|
+
return (ctx, p) => cmdProfileSet({
|
|
199
|
+
cwd: ctx.cwd,
|
|
200
|
+
rootOverride: ctx.rootOverride,
|
|
201
|
+
profile: normalizeProfile(p.profile),
|
|
202
|
+
deps,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/core.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/core.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIrD,KAAK,gBAAgB,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1C,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAcxD,CAAC;AA6BF,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,gBAAgB,CAE1D,CAAC;AAEF,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AACtC,KAAK,eAAe,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAkP9D,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAuCtD,CAAC;AAiDF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,eAAe,CAExD,CAAC;AAEF,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAElD,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CAe5C,CAAC;AAoOF,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,UAAU,CAE9C,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CAMhD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,YAAY,CAAC,CA0FhF"}
|
|
@@ -9,6 +9,7 @@ import { CliError } from "../../../shared/errors.js";
|
|
|
9
9
|
import { dedupeStrings } from "../../../shared/strings.js";
|
|
10
10
|
import { usageError } from "../../spec/errors.js";
|
|
11
11
|
import { listRoles, renderQuickstart, renderRole } from "../../command-guide.js";
|
|
12
|
+
import { isWorkflowEnforcementDisabled, validateWorkflowAtPath, workflowEnforcementEnvHint, } from "../../../workflow-runtime/index.js";
|
|
12
13
|
import { toStringList } from "../../spec/parse-utils.js";
|
|
13
14
|
import { wrapCommand } from "./wrap-command.js";
|
|
14
15
|
export const quickstartSpec = {
|
|
@@ -36,7 +37,7 @@ async function cmdQuickstart(opts) {
|
|
|
36
37
|
.filter((line) => line.length > 0);
|
|
37
38
|
const payload = {
|
|
38
39
|
source_of_truth: {
|
|
39
|
-
workflow_policy: "AGENTS.md",
|
|
40
|
+
workflow_policy: "AGENTS.md|CLAUDE.md",
|
|
40
41
|
cli_syntax: "quickstart/role output",
|
|
41
42
|
},
|
|
42
43
|
lines,
|
|
@@ -95,6 +96,7 @@ function inferApprovals(config) {
|
|
|
95
96
|
}
|
|
96
97
|
async function buildPreflightReport(opts) {
|
|
97
98
|
const nextActions = [];
|
|
99
|
+
const harnessHealthReasons = [];
|
|
98
100
|
const quickstartText = renderQuickstart();
|
|
99
101
|
const quickstartLoaded = {
|
|
100
102
|
ok: quickstartText.trim().length > 0,
|
|
@@ -125,6 +127,7 @@ async function buildPreflightReport(opts) {
|
|
|
125
127
|
command: "agentplane config show",
|
|
126
128
|
reason: `config failed validation (${message})`,
|
|
127
129
|
});
|
|
130
|
+
harnessHealthReasons.push("config_unavailable");
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
133
|
let taskListLoaded = {
|
|
@@ -147,6 +150,46 @@ async function buildPreflightReport(opts) {
|
|
|
147
150
|
command: "agentplane task list",
|
|
148
151
|
reason: `task backend unavailable (${message})`,
|
|
149
152
|
});
|
|
153
|
+
harnessHealthReasons.push("task_backend_unavailable");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
let workflowLoaded = { ok: false, error: "project not resolved" };
|
|
157
|
+
if (resolved) {
|
|
158
|
+
if (isWorkflowEnforcementDisabled()) {
|
|
159
|
+
workflowLoaded = {
|
|
160
|
+
ok: true,
|
|
161
|
+
error: `workflow checks disabled via ${workflowEnforcementEnvHint()}`,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
try {
|
|
166
|
+
const workflowValidation = await validateWorkflowAtPath(resolved.gitRoot);
|
|
167
|
+
workflowLoaded = workflowValidation.ok
|
|
168
|
+
? { ok: true }
|
|
169
|
+
: {
|
|
170
|
+
ok: false,
|
|
171
|
+
error: workflowValidation.diagnostics
|
|
172
|
+
.filter((d) => d.severity === "ERROR")
|
|
173
|
+
.map((d) => `${d.code}:${d.path}`)
|
|
174
|
+
.join(", "),
|
|
175
|
+
};
|
|
176
|
+
if (!workflowValidation.ok) {
|
|
177
|
+
harnessHealthReasons.push("workflow_contract_invalid");
|
|
178
|
+
nextActions.push({
|
|
179
|
+
command: "agentplane workflow build --validate --dry-run",
|
|
180
|
+
reason: "workflow contract is invalid",
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
const message = compactError(err);
|
|
186
|
+
workflowLoaded = { ok: false, error: message };
|
|
187
|
+
harnessHealthReasons.push("workflow_contract_unreadable");
|
|
188
|
+
nextActions.push({
|
|
189
|
+
command: "agentplane workflow build --validate --dry-run",
|
|
190
|
+
reason: `cannot validate workflow (${message})`,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
150
193
|
}
|
|
151
194
|
}
|
|
152
195
|
let workingTree = {
|
|
@@ -166,6 +209,7 @@ async function buildPreflightReport(opts) {
|
|
|
166
209
|
]);
|
|
167
210
|
workingTree = { ok: true, value: staged.length === 0 && unstagedTracked.length === 0 };
|
|
168
211
|
if (!workingTree.value) {
|
|
212
|
+
harnessHealthReasons.push("working_tree_dirty");
|
|
169
213
|
nextActions.push({
|
|
170
214
|
command: "git status --short --untracked-files=no",
|
|
171
215
|
reason: "tracked changes detected",
|
|
@@ -175,6 +219,7 @@ async function buildPreflightReport(opts) {
|
|
|
175
219
|
catch (err) {
|
|
176
220
|
const message = compactError(err);
|
|
177
221
|
workingTree = { ok: false, error: message };
|
|
222
|
+
harnessHealthReasons.push("working_tree_unreadable");
|
|
178
223
|
nextActions.push({
|
|
179
224
|
command: "git status --short --untracked-files=no",
|
|
180
225
|
reason: `cannot inspect git status (${message})`,
|
|
@@ -193,11 +238,16 @@ async function buildPreflightReport(opts) {
|
|
|
193
238
|
project_detected: resolved !== null,
|
|
194
239
|
config_loaded: configLoaded,
|
|
195
240
|
quickstart_loaded: quickstartLoaded,
|
|
241
|
+
workflow_loaded: workflowLoaded,
|
|
196
242
|
task_list_loaded: taskListLoaded,
|
|
197
243
|
working_tree_clean_tracked: workingTree,
|
|
198
244
|
current_branch: branch,
|
|
199
245
|
workflow_mode: inferWorkflowMode(config),
|
|
200
246
|
approvals: inferApprovals(config),
|
|
247
|
+
harness_health: {
|
|
248
|
+
status: harnessHealthReasons.length === 0 ? "ok" : "warn",
|
|
249
|
+
reasons: dedupeStrings(harnessHealthReasons),
|
|
250
|
+
},
|
|
201
251
|
outside_repo_needed: false,
|
|
202
252
|
next_actions: nextActions,
|
|
203
253
|
};
|
|
@@ -256,10 +306,15 @@ async function cmdPreflight(opts) {
|
|
|
256
306
|
process.stdout.write(`- project detected: ${report.project_detected ? "yes" : "no"}\n`);
|
|
257
307
|
process.stdout.write(`- config loaded: ${probeYesNo(report.config_loaded)}\n`);
|
|
258
308
|
process.stdout.write(`- quickstart loaded: ${probeYesNo(report.quickstart_loaded)}\n`);
|
|
309
|
+
process.stdout.write(`- workflow loaded: ${probeYesNo(report.workflow_loaded)}\n`);
|
|
259
310
|
process.stdout.write(`- task list loaded: ${probeYesNo(report.task_list_loaded)}\n`);
|
|
260
311
|
process.stdout.write(`- working tree clean (tracked-only): ${probeValueOrUnknown(report.working_tree_clean_tracked)}\n`);
|
|
261
312
|
process.stdout.write(`- current git branch: ${probeValueOrUnknown(report.current_branch)}\n`);
|
|
262
313
|
process.stdout.write(`- workflow_mode: ${report.workflow_mode}\n`);
|
|
314
|
+
process.stdout.write(`- harness engeneering health: ${report.harness_health.status}\n`);
|
|
315
|
+
if (report.harness_health.reasons.length > 0) {
|
|
316
|
+
process.stdout.write(` - reasons: ${report.harness_health.reasons.join(", ")}\n`);
|
|
317
|
+
}
|
|
263
318
|
process.stdout.write("- approval gates:\n");
|
|
264
319
|
process.stdout.write(` - require_plan: ${String(report.approvals.require_plan)}\n`);
|
|
265
320
|
process.stdout.write(` - require_verify: ${String(report.approvals.require_verify)}\n`);
|
|
@@ -382,7 +437,7 @@ function renderAgentProfileBlock(opts) {
|
|
|
382
437
|
...(permissions.length > 0 ? ["", "Permissions:", ...permissions.map((s) => `- ${s}`)] : []),
|
|
383
438
|
...(workflow.length > 0 ? ["", "Workflow:", ...workflow.map((s) => `- ${s}`)] : []),
|
|
384
439
|
"",
|
|
385
|
-
`Source: .agentplane/agents/${opts.filename} (lower priority; see AGENTS.md)`,
|
|
440
|
+
`Source: .agentplane/agents/${opts.filename} (lower priority; see policy gateway file AGENTS.md or CLAUDE.md)`,
|
|
386
441
|
];
|
|
387
442
|
return lines.join("\n").trimEnd();
|
|
388
443
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ide.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/ide.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ide.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/ide.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,KAAK,aAAa,GAAG;IAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;CAAE,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CAkBlD,CAAC;AAEF,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CA4ClB;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAElF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { mkdir, readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { writeTextIfChanged } from "../../../shared/write-if-changed.js";
|
|
4
|
+
import { resolvePolicyGatewayForRepo } from "../../../shared/policy-gateway.js";
|
|
4
5
|
import { wrapCommand } from "./wrap-command.js";
|
|
5
6
|
export const ideSyncSpec = {
|
|
6
7
|
id: ["ide", "sync"],
|
|
7
8
|
group: "IDE",
|
|
8
|
-
summary: "Generate IDE entrypoints from AGENTS.md.",
|
|
9
|
+
summary: "Generate IDE entrypoints from policy gateway file (AGENTS.md or CLAUDE.md).",
|
|
9
10
|
options: [
|
|
10
11
|
{
|
|
11
12
|
kind: "string",
|
|
@@ -24,13 +25,17 @@ export const ideSyncSpec = {
|
|
|
24
25
|
export async function cmdIdeSync(opts) {
|
|
25
26
|
return wrapCommand({ command: "ide sync", rootOverride: opts.rootOverride }, async () => {
|
|
26
27
|
const resolved = await opts.deps.getResolvedProject("ide sync");
|
|
27
|
-
const
|
|
28
|
+
const gateway = await resolvePolicyGatewayForRepo({
|
|
29
|
+
gitRoot: resolved.gitRoot,
|
|
30
|
+
fallbackFlavor: "codex",
|
|
31
|
+
});
|
|
32
|
+
const agentsPath = gateway.absPath;
|
|
28
33
|
const agentsText = await readFile(agentsPath, "utf8");
|
|
29
34
|
const header = [
|
|
30
35
|
"<!--",
|
|
31
36
|
" AUTOGENERATED by agentplane ide sync.",
|
|
32
37
|
" DO NOT EDIT MANUALLY.",
|
|
33
|
-
|
|
38
|
+
` Source: ${gateway.fileName}`,
|
|
34
39
|
"-->",
|
|
35
40
|
"",
|
|
36
41
|
].join("\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipes.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/recipes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recipes.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/recipes.ts"],"names":[],"mappings":"AAKA,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BhB"}
|
|
@@ -1,11 +1,31 @@
|
|
|
1
|
+
import { cmdRecipeInstall } from "../../../../commands/recipes.js";
|
|
1
2
|
import { infoMessage } from "../../../output.js";
|
|
2
|
-
import { listBundledRecipes } from "../../../recipes-bundled.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { getBundledRecipeSourcePath, listBundledRecipes } from "../../../recipes-bundled.js";
|
|
4
|
+
import { CliError } from "../../../../shared/errors.js";
|
|
5
|
+
export async function maybeInstallBundledRecipes(opts) {
|
|
6
|
+
if (opts.recipes.length === 0)
|
|
5
7
|
return;
|
|
6
8
|
if (listBundledRecipes().length === 0) {
|
|
7
9
|
process.stdout.write(`${infoMessage("bundled recipes are empty; nothing to install")}\n`);
|
|
8
10
|
return;
|
|
9
11
|
}
|
|
10
|
-
|
|
12
|
+
for (const recipeId of opts.recipes) {
|
|
13
|
+
const sourcePath = getBundledRecipeSourcePath(recipeId);
|
|
14
|
+
if (!sourcePath) {
|
|
15
|
+
throw new CliError({
|
|
16
|
+
exitCode: 3,
|
|
17
|
+
code: "E_VALIDATION",
|
|
18
|
+
message: `Bundled recipe ${recipeId} is missing source_path in bundled catalog`,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
await cmdRecipeInstall({
|
|
22
|
+
cwd: opts.cwd,
|
|
23
|
+
rootOverride: opts.rootOverride,
|
|
24
|
+
source: { type: "path", value: sourcePath },
|
|
25
|
+
index: undefined,
|
|
26
|
+
refresh: false,
|
|
27
|
+
onConflict: "overwrite",
|
|
28
|
+
yes: true,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
11
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/ui.ts"],"names":[],"mappings":"AAyBA,wBAAgB,iBAAiB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/ui.ts"],"names":[],"mappings":"AAyBA,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAG5E"}
|
|
@@ -26,12 +26,11 @@ export function renderInitWelcome() {
|
|
|
26
26
|
"░█▀█░█░█░█▀▀░█░█░░█░░▄▀░░█▀▀░█░░░█▀█░█░█░█▀▀",
|
|
27
27
|
"░▀░▀░▀▀▀░▀▀▀░▀░▀░░▀░░▀░░░▀░░░▀▀▀░▀░▀░▀░▀░▀▀▀",
|
|
28
28
|
].map((line) => color(line, "36"));
|
|
29
|
-
const subtitle = color("agent/plane", "36");
|
|
30
29
|
const intro = [
|
|
31
30
|
color("Bootstrap an agent-first workflow in this repository.", "1"),
|
|
32
31
|
"This interactive setup runs once; daily work is executed by agents.",
|
|
33
32
|
];
|
|
34
|
-
return `${logo.join("\n")}\n
|
|
33
|
+
return `${logo.join("\n")}\n\n${box(intro)}\n\n`;
|
|
35
34
|
}
|
|
36
35
|
export function renderInitSection(title, description) {
|
|
37
36
|
const header = color(`[${title}]`, "33");
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { WorkflowMode } from "../../../../agents/agents-template.js";
|
|
2
|
+
import { type PolicyGatewayFlavor } from "../../../../shared/policy-gateway.js";
|
|
2
3
|
export declare function ensureAgentsFiles(opts: {
|
|
3
4
|
gitRoot: string;
|
|
4
5
|
agentplaneDir: string;
|
|
5
6
|
workflow: WorkflowMode;
|
|
7
|
+
policyGateway: PolicyGatewayFlavor;
|
|
6
8
|
configPathAbs: string;
|
|
7
9
|
backendPathAbs: string;
|
|
8
10
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-agents.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-agents.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"write-agents.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-agents.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAQ1E,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,sCAAsC,CAAC;AA6B9C,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,mBAAmB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwDtC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { mkdir, readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { atomicWriteFile } from "@agentplaneorg/core";
|
|
4
|
-
import { filterAgentsByWorkflow, loadAgentTemplates, loadAgentsTemplate, } from "../../../../agents/agents-template.js";
|
|
4
|
+
import { filterAgentsByWorkflow, loadAgentTemplates, loadAgentsTemplate, loadPolicyTemplates, } from "../../../../agents/agents-template.js";
|
|
5
5
|
import { fileExists } from "../../../fs-utils.js";
|
|
6
|
+
import { policyGatewayFileName, renderPolicyGatewayTemplateText, } from "../../../../shared/policy-gateway.js";
|
|
6
7
|
function toUpgradeBaselineKey(repoRelativePath) {
|
|
7
8
|
if (repoRelativePath === "AGENTS.md")
|
|
8
9
|
return "AGENTS.md";
|
|
10
|
+
if (repoRelativePath === "CLAUDE.md")
|
|
11
|
+
return "CLAUDE.md";
|
|
9
12
|
if (repoRelativePath.startsWith(".agentplane/")) {
|
|
10
13
|
return repoRelativePath.slice(".agentplane/".length);
|
|
11
14
|
}
|
|
@@ -26,7 +29,9 @@ async function seedUpgradeBaselineForInstalledFiles(opts) {
|
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
export async function ensureAgentsFiles(opts) {
|
|
29
|
-
const
|
|
32
|
+
const gatewayFileName = policyGatewayFileName(opts.policyGateway);
|
|
33
|
+
const renderGatewayText = (text) => renderPolicyGatewayTemplateText(text, gatewayFileName);
|
|
34
|
+
const agentsPath = path.join(opts.gitRoot, gatewayFileName);
|
|
30
35
|
const installPaths = [
|
|
31
36
|
path.relative(opts.gitRoot, opts.configPathAbs),
|
|
32
37
|
path.relative(opts.gitRoot, opts.backendPathAbs),
|
|
@@ -38,20 +43,34 @@ export async function ensureAgentsFiles(opts) {
|
|
|
38
43
|
}
|
|
39
44
|
else {
|
|
40
45
|
const template = await loadAgentsTemplate();
|
|
41
|
-
const filtered = filterAgentsByWorkflow(template, opts.workflow);
|
|
46
|
+
const filtered = filterAgentsByWorkflow(renderGatewayText(template), opts.workflow);
|
|
42
47
|
await atomicWriteFile(agentsPath, filtered, "utf8");
|
|
43
48
|
wroteAgents = true;
|
|
44
49
|
}
|
|
45
50
|
if (wroteAgents) {
|
|
46
51
|
installPaths.push(path.relative(opts.gitRoot, agentsPath));
|
|
47
|
-
installedManagedPaths.push(
|
|
52
|
+
installedManagedPaths.push(gatewayFileName);
|
|
48
53
|
}
|
|
49
54
|
const agentTemplates = await loadAgentTemplates();
|
|
50
55
|
for (const agent of agentTemplates) {
|
|
51
56
|
const targetPath = path.join(opts.agentplaneDir, "agents", agent.fileName);
|
|
52
57
|
if (await fileExists(targetPath))
|
|
53
58
|
continue;
|
|
54
|
-
await atomicWriteFile(targetPath, agent.contents, "utf8");
|
|
59
|
+
await atomicWriteFile(targetPath, renderGatewayText(agent.contents), "utf8");
|
|
60
|
+
const relPath = path.relative(opts.gitRoot, targetPath);
|
|
61
|
+
installPaths.push(relPath);
|
|
62
|
+
installedManagedPaths.push(relPath);
|
|
63
|
+
}
|
|
64
|
+
const policyTemplates = await loadPolicyTemplates();
|
|
65
|
+
for (const policy of policyTemplates) {
|
|
66
|
+
const targetPath = path.join(opts.agentplaneDir, "policy", policy.relativePath);
|
|
67
|
+
if (await fileExists(targetPath))
|
|
68
|
+
continue;
|
|
69
|
+
const rendered = policy.relativePath.endsWith(".md")
|
|
70
|
+
? renderGatewayText(policy.contents)
|
|
71
|
+
: policy.contents;
|
|
72
|
+
await mkdir(path.dirname(targetPath), { recursive: true });
|
|
73
|
+
await atomicWriteFile(targetPath, rendered, "utf8");
|
|
55
74
|
const relPath = path.relative(opts.gitRoot, targetPath);
|
|
56
75
|
installPaths.push(relPath);
|
|
57
76
|
installedManagedPaths.push(relPath);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function ensureInitWorkflow(opts: {
|
|
2
|
+
gitRoot: string;
|
|
3
|
+
workflowMode: "direct" | "branch_pr";
|
|
4
|
+
approvals: {
|
|
5
|
+
requirePlanApproval: boolean;
|
|
6
|
+
requireVerifyApproval: boolean;
|
|
7
|
+
requireNetworkApproval: boolean;
|
|
8
|
+
};
|
|
9
|
+
}): Promise<{
|
|
10
|
+
installPaths: string[];
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=write-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-workflow.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-workflow.ts"],"names":[],"mappings":"AASA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,GAAG,WAAW,CAAC;IACrC,SAAS,EAAE;QACT,mBAAmB,EAAE,OAAO,CAAC;QAC7B,qBAAqB,EAAE,OAAO,CAAC;QAC/B,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;CACH,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA2DtC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CliError } from "../../../../shared/errors.js";
|
|
2
|
+
import { DEFAULT_WORKFLOW_TEMPLATE, buildWorkflowFromTemplates, diagnosticsSummary, publishWorkflowCandidate, resolveWorkflowPaths, } from "../../../../workflow-runtime/index.js";
|
|
3
|
+
export async function ensureInitWorkflow(opts) {
|
|
4
|
+
const built = buildWorkflowFromTemplates({
|
|
5
|
+
baseTemplate: DEFAULT_WORKFLOW_TEMPLATE,
|
|
6
|
+
runtimeContext: {
|
|
7
|
+
workflow: {
|
|
8
|
+
mode: opts.workflowMode,
|
|
9
|
+
version: 1,
|
|
10
|
+
approvals: {
|
|
11
|
+
require_plan: opts.approvals.requirePlanApproval,
|
|
12
|
+
require_verify: opts.approvals.requireVerifyApproval,
|
|
13
|
+
require_network: opts.approvals.requireNetworkApproval,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
runtime: {
|
|
17
|
+
repo_name: opts.gitRoot.split(/[/\\\\]/).findLast((segment) => segment.length > 0) ?? "repo",
|
|
18
|
+
repo_root: opts.gitRoot,
|
|
19
|
+
timestamp: new Date().toISOString(),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
if (built.diagnostics.some((d) => d.severity === "ERROR")) {
|
|
24
|
+
throw new CliError({
|
|
25
|
+
exitCode: 3,
|
|
26
|
+
code: "E_VALIDATION",
|
|
27
|
+
message: `Failed to generate WORKFLOW.md: ${diagnosticsSummary(built.diagnostics)}`,
|
|
28
|
+
context: {
|
|
29
|
+
diagnostics: built.diagnostics.map((d) => ({
|
|
30
|
+
severity: d.severity,
|
|
31
|
+
code: d.code,
|
|
32
|
+
path: d.path,
|
|
33
|
+
message: d.message,
|
|
34
|
+
})),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const published = await publishWorkflowCandidate(opts.gitRoot, built.text);
|
|
39
|
+
if (!published.ok) {
|
|
40
|
+
throw new CliError({
|
|
41
|
+
exitCode: 3,
|
|
42
|
+
code: "E_VALIDATION",
|
|
43
|
+
message: `Failed to publish WORKFLOW.md: ${diagnosticsSummary(published.diagnostics)}`,
|
|
44
|
+
context: {
|
|
45
|
+
diagnostics: published.diagnostics.map((d) => ({
|
|
46
|
+
severity: d.severity,
|
|
47
|
+
code: d.code,
|
|
48
|
+
path: d.path,
|
|
49
|
+
message: d.message,
|
|
50
|
+
})),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const workflowPaths = resolveWorkflowPaths(opts.gitRoot);
|
|
55
|
+
return {
|
|
56
|
+
installPaths: [workflowPaths.workflowPath, workflowPaths.lastKnownGoodPath],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { CommandHandler, CommandSpec } from "../../spec/spec.js";
|
|
2
2
|
import { type ExecutionProfile } from "@agentplaneorg/core";
|
|
3
|
+
import type { PolicyGatewayFlavor } from "../../../shared/policy-gateway.js";
|
|
3
4
|
type InitFlags = {
|
|
4
|
-
setupProfile?:
|
|
5
|
+
setupProfile?: SetupProfilePreset;
|
|
6
|
+
policyGateway?: PolicyGatewayFlavor;
|
|
5
7
|
ide?: "codex" | "cursor" | "windsurf";
|
|
6
8
|
workflow?: "direct" | "branch_pr";
|
|
7
9
|
backend?: "local" | "redmine";
|
|
@@ -17,6 +19,7 @@ type InitFlags = {
|
|
|
17
19
|
backup?: boolean;
|
|
18
20
|
yes: boolean;
|
|
19
21
|
};
|
|
22
|
+
type SetupProfilePreset = "light" | "normal" | "full-harness";
|
|
20
23
|
type InitParsed = Omit<InitFlags, "yes"> & {
|
|
21
24
|
yes: boolean;
|
|
22
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/init.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItE,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/init.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItE,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAc7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,KAAK,SAAS,GAAG;IACf,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,GAAG,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IACtC,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,KAAK,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAC;AAoF9D,KAAK,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5D,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CAyM5C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,UAAU,CACmB,CAAC"}
|