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
|
@@ -13,51 +13,47 @@ import { collectInitConflicts, handleInitConflicts } from "./init/conflicts.js";
|
|
|
13
13
|
import { ensureGitRoot } from "./init/git.js";
|
|
14
14
|
import { maybeSyncIde } from "./init/ide-sync.js";
|
|
15
15
|
import { maybeInstallBundledRecipes } from "./init/recipes.js";
|
|
16
|
+
import { ensureInitWorkflow } from "./init/write-workflow.js";
|
|
16
17
|
import { ensureAgentplaneDirs, writeBackendStubs, writeInitConfig } from "./init/write-config.js";
|
|
17
18
|
import { ensureAgentsFiles } from "./init/write-agents.js";
|
|
18
19
|
import { ensureInitGitignore } from "./init/write-gitignore.js";
|
|
19
20
|
import { ensureInitRedmineEnvTemplate } from "./init/write-env.js";
|
|
20
21
|
import { renderInitSection, renderInitWelcome } from "./init/ui.js";
|
|
22
|
+
import { fileExists } from "../../fs-utils.js";
|
|
23
|
+
import { policyGatewayFileName } from "../../../shared/policy-gateway.js";
|
|
21
24
|
const setupProfilePresets = {
|
|
22
|
-
|
|
23
|
-
mode: "full",
|
|
24
|
-
description: "I am Developer (full setup questionnaire; hooks on; explicit unsafe confirmations on).",
|
|
25
|
-
defaultHooks: true,
|
|
26
|
-
defaultStrictUnsafeConfirm: true,
|
|
27
|
-
defaultRequirePlanApproval: true,
|
|
28
|
-
defaultRequireNetworkApproval: true,
|
|
29
|
-
defaultRequireVerifyApproval: true,
|
|
30
|
-
defaultExecutionProfile: "balanced",
|
|
31
|
-
},
|
|
32
|
-
vibecoder: {
|
|
25
|
+
light: {
|
|
33
26
|
mode: "compact",
|
|
34
|
-
description: "
|
|
27
|
+
description: "Light profile (maximum flexibility, minimal enforcement, hooks disabled).",
|
|
35
28
|
defaultHooks: false,
|
|
36
29
|
defaultStrictUnsafeConfirm: false,
|
|
37
30
|
defaultRequirePlanApproval: false,
|
|
38
31
|
defaultRequireNetworkApproval: false,
|
|
39
32
|
defaultRequireVerifyApproval: false,
|
|
40
33
|
defaultExecutionProfile: "aggressive",
|
|
34
|
+
defaultRecipes: [],
|
|
41
35
|
},
|
|
42
|
-
|
|
36
|
+
normal: {
|
|
43
37
|
mode: "compact",
|
|
44
|
-
description: "
|
|
45
|
-
defaultHooks:
|
|
38
|
+
description: "Normal profile (balanced defaults and approvals enabled for standard team workflows; hooks enabled).",
|
|
39
|
+
defaultHooks: true,
|
|
46
40
|
defaultStrictUnsafeConfirm: false,
|
|
47
41
|
defaultRequirePlanApproval: true,
|
|
48
42
|
defaultRequireNetworkApproval: true,
|
|
49
43
|
defaultRequireVerifyApproval: true,
|
|
50
44
|
defaultExecutionProfile: "balanced",
|
|
45
|
+
defaultRecipes: [],
|
|
51
46
|
},
|
|
52
|
-
|
|
47
|
+
"full-harness": {
|
|
53
48
|
mode: "full",
|
|
54
|
-
description: "
|
|
49
|
+
description: "Full Harness profile (strict guardrails, explicit confirmations, conservative execution; hooks enabled).",
|
|
55
50
|
defaultHooks: true,
|
|
56
51
|
defaultStrictUnsafeConfirm: true,
|
|
57
52
|
defaultRequirePlanApproval: true,
|
|
58
53
|
defaultRequireNetworkApproval: true,
|
|
59
54
|
defaultRequireVerifyApproval: true,
|
|
60
55
|
defaultExecutionProfile: "conservative",
|
|
56
|
+
defaultRecipes: [],
|
|
61
57
|
},
|
|
62
58
|
};
|
|
63
59
|
function parseBooleanValueForInit(flag, value) {
|
|
@@ -81,6 +77,22 @@ function parseRecipesSelectionForInit(value) {
|
|
|
81
77
|
.map((item) => item.trim())
|
|
82
78
|
.filter(Boolean);
|
|
83
79
|
}
|
|
80
|
+
function normalizeSetupProfile(raw) {
|
|
81
|
+
if (!raw)
|
|
82
|
+
return undefined;
|
|
83
|
+
const value = raw.trim().toLowerCase();
|
|
84
|
+
if (value === "developer")
|
|
85
|
+
return "full-harness";
|
|
86
|
+
if (value === "enterprise")
|
|
87
|
+
return "full-harness";
|
|
88
|
+
if (value === "manager")
|
|
89
|
+
return "normal";
|
|
90
|
+
if (value === "vibecoder")
|
|
91
|
+
return "light";
|
|
92
|
+
if (value === "light" || value === "normal" || value === "full-harness")
|
|
93
|
+
return value;
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
84
96
|
export const initSpec = {
|
|
85
97
|
id: ["init"],
|
|
86
98
|
group: "Setup",
|
|
@@ -90,9 +102,25 @@ export const initSpec = {
|
|
|
90
102
|
{
|
|
91
103
|
kind: "string",
|
|
92
104
|
name: "setup-profile",
|
|
93
|
-
valueHint: "<
|
|
94
|
-
choices: [
|
|
95
|
-
|
|
105
|
+
valueHint: "<light|normal|full-harness>",
|
|
106
|
+
choices: [
|
|
107
|
+
"light",
|
|
108
|
+
"normal",
|
|
109
|
+
"full-harness",
|
|
110
|
+
"developer",
|
|
111
|
+
"vibecoder",
|
|
112
|
+
"manager",
|
|
113
|
+
"enterprise",
|
|
114
|
+
],
|
|
115
|
+
description: "Setup profile preset. Preferred values: light, normal, full-harness.",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
kind: "string",
|
|
119
|
+
name: "policy-gateway",
|
|
120
|
+
valueHint: "<codex|claude>",
|
|
121
|
+
choices: ["codex", "claude"],
|
|
122
|
+
coerce: (raw) => raw.trim().toLowerCase(),
|
|
123
|
+
description: "Policy gateway file to install (codex -> AGENTS.md, claude -> CLAUDE.md).",
|
|
96
124
|
},
|
|
97
125
|
{
|
|
98
126
|
kind: "string",
|
|
@@ -121,7 +149,7 @@ export const initSpec = {
|
|
|
121
149
|
kind: "string",
|
|
122
150
|
name: "hooks",
|
|
123
151
|
valueHint: "<true|false>",
|
|
124
|
-
description: "Install git hooks (
|
|
152
|
+
description: "Install managed git hooks (default by setup profile: light=false, normal/full-harness=true).",
|
|
125
153
|
},
|
|
126
154
|
{
|
|
127
155
|
kind: "string",
|
|
@@ -182,17 +210,17 @@ export const initSpec = {
|
|
|
182
210
|
kind: "boolean",
|
|
183
211
|
name: "gitignore-agents",
|
|
184
212
|
default: false,
|
|
185
|
-
description: "Add agent files (AGENTS.md and .agentplane/agents/) to .gitignore and skip the initial install commit.",
|
|
213
|
+
description: "Add gateway/agent files (AGENTS.md or CLAUDE.md and .agentplane/agents/) to .gitignore and skip the initial install commit.",
|
|
186
214
|
},
|
|
187
215
|
],
|
|
188
216
|
examples: [
|
|
189
217
|
{ cmd: "agentplane init", why: "Interactive setup (prompts for missing values)." },
|
|
190
218
|
{
|
|
191
|
-
cmd: "agentplane init --setup-profile
|
|
192
|
-
why: "Non-interactive
|
|
219
|
+
cmd: "agentplane init --setup-profile light --yes",
|
|
220
|
+
why: "Non-interactive setup with flexible defaults.",
|
|
193
221
|
},
|
|
194
222
|
{
|
|
195
|
-
cmd: "agentplane init --workflow direct --backend local --hooks
|
|
223
|
+
cmd: "agentplane init --workflow direct --backend local --hooks true --require-plan-approval true --require-network-approval true --require-verify-approval true --yes",
|
|
196
224
|
why: "Non-interactive setup with explicit policy flags.",
|
|
197
225
|
},
|
|
198
226
|
{
|
|
@@ -220,7 +248,8 @@ export const initSpec = {
|
|
|
220
248
|
const requireVerifyRaw = raw.opts["require-verify-approval"];
|
|
221
249
|
const recipesRaw = raw.opts.recipes;
|
|
222
250
|
return {
|
|
223
|
-
setupProfile: raw.opts["setup-profile"],
|
|
251
|
+
setupProfile: normalizeSetupProfile(raw.opts["setup-profile"]),
|
|
252
|
+
policyGateway: raw.opts["policy-gateway"],
|
|
224
253
|
ide: raw.opts.ide,
|
|
225
254
|
workflow: raw.opts.workflow,
|
|
226
255
|
backend: raw.opts.backend,
|
|
@@ -259,10 +288,11 @@ export const runInit = (ctx, flags) => cmdInit({ cwd: ctx.cwd, rootOverride: ctx
|
|
|
259
288
|
async function cmdInit(opts) {
|
|
260
289
|
const flags = opts.flags;
|
|
261
290
|
const defaults = {
|
|
291
|
+
policyGateway: "codex",
|
|
262
292
|
ide: "codex",
|
|
263
293
|
workflow: "direct",
|
|
264
294
|
backend: "local",
|
|
265
|
-
hooks:
|
|
295
|
+
hooks: true,
|
|
266
296
|
recipes: [],
|
|
267
297
|
requirePlanApproval: true,
|
|
268
298
|
requireNetworkApproval: true,
|
|
@@ -271,6 +301,7 @@ async function cmdInit(opts) {
|
|
|
271
301
|
strictUnsafeConfirm: false,
|
|
272
302
|
};
|
|
273
303
|
let ide = flags.ide ?? defaults.ide;
|
|
304
|
+
let policyGateway = flags.policyGateway ?? defaults.policyGateway;
|
|
274
305
|
let workflow = flags.workflow ?? defaults.workflow;
|
|
275
306
|
let backend = flags.backend ?? defaults.backend;
|
|
276
307
|
let hooks = flags.hooks ?? defaults.hooks;
|
|
@@ -283,19 +314,18 @@ async function cmdInit(opts) {
|
|
|
283
314
|
let setupProfile = flags.setupProfile
|
|
284
315
|
? setupProfilePresets[flags.setupProfile].mode
|
|
285
316
|
: "compact";
|
|
286
|
-
let setupProfilePreset = flags.setupProfile ?? "
|
|
317
|
+
let setupProfilePreset = flags.setupProfile ?? "normal";
|
|
287
318
|
const isInteractive = process.stdin.isTTY && !flags.yes;
|
|
288
319
|
if (!process.stdin.isTTY &&
|
|
289
320
|
!flags.yes &&
|
|
290
321
|
(!flags.workflow ||
|
|
291
|
-
flags.hooks === undefined ||
|
|
292
322
|
flags.requirePlanApproval === undefined ||
|
|
293
323
|
flags.requireNetworkApproval === undefined ||
|
|
294
324
|
flags.requireVerifyApproval === undefined)) {
|
|
295
325
|
throw usageError({
|
|
296
326
|
spec: initSpec,
|
|
297
327
|
command: "init",
|
|
298
|
-
message: "Non-interactive init requires --yes or explicit values for: --workflow, --
|
|
328
|
+
message: "Non-interactive init requires --yes or explicit values for: --workflow, --require-plan-approval, --require-network-approval, --require-verify-approval.",
|
|
299
329
|
});
|
|
300
330
|
}
|
|
301
331
|
if (isInteractive) {
|
|
@@ -316,19 +346,25 @@ async function cmdInit(opts) {
|
|
|
316
346
|
};
|
|
317
347
|
process.stdout.write(renderInitWelcome());
|
|
318
348
|
const presetLines = Object.entries(setupProfilePresets).map(([id, preset]) => `- ${id}: ${preset.description}`);
|
|
319
|
-
process.stdout.write(renderInitSection("
|
|
349
|
+
process.stdout.write(renderInitSection("Setup Profile", "Pick one of three setup profiles. This controls policy strictness and questionnaire depth."));
|
|
320
350
|
process.stdout.write(`${presetLines.join("\n")}\n\n`);
|
|
321
351
|
if (flags.setupProfile) {
|
|
322
352
|
setupProfilePreset = flags.setupProfile;
|
|
323
353
|
}
|
|
324
354
|
else {
|
|
325
|
-
const selected = await askChoice("
|
|
355
|
+
const selected = await askChoice("Setup profile", ["light", "normal", "full-harness"], "normal");
|
|
326
356
|
setupProfilePreset = selected;
|
|
327
357
|
}
|
|
328
358
|
const selectedPreset = setupProfilePresets[setupProfilePreset];
|
|
329
359
|
setupProfile = selectedPreset.mode;
|
|
330
|
-
|
|
331
|
-
|
|
360
|
+
hooks = flags.hooks ?? selectedPreset.defaultHooks;
|
|
361
|
+
if (flags.policyGateway) {
|
|
362
|
+
policyGateway = flags.policyGateway;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
process.stdout.write(renderInitSection("Policy Gateway", "Choose which root policy gateway file to install for your primary agent runtime."));
|
|
366
|
+
policyGateway = (await askChoice("Policy gateway", ["codex", "claude"], policyGateway));
|
|
367
|
+
}
|
|
332
368
|
if (flags.strictUnsafeConfirm === undefined) {
|
|
333
369
|
strictUnsafeConfirm = selectedPreset.defaultStrictUnsafeConfirm;
|
|
334
370
|
}
|
|
@@ -360,9 +396,9 @@ async function cmdInit(opts) {
|
|
|
360
396
|
backend = choice === "redmine" ? "redmine" : "local";
|
|
361
397
|
}
|
|
362
398
|
if (setupProfile === "full") {
|
|
363
|
-
|
|
364
|
-
hooks
|
|
365
|
-
|
|
399
|
+
process.stdout.write(renderInitSection("Hooks", hooks
|
|
400
|
+
? "Managed git hooks are enabled and will be installed automatically."
|
|
401
|
+
: "Managed git hooks are disabled by profile/flag and will not be installed."));
|
|
366
402
|
process.stdout.write(renderInitSection("Execution Profile", "Set default autonomy/effort for agents. You can change this later in config."));
|
|
367
403
|
if (!flags.executionProfile) {
|
|
368
404
|
executionProfile = (await askChoice("Execution profile", ["conservative", "balanced", "aggressive"], executionProfile));
|
|
@@ -383,18 +419,27 @@ async function cmdInit(opts) {
|
|
|
383
419
|
process.stdout.write(renderInitSection("Recipes", "Optional: install recipe packs now (comma-separated IDs) or choose none."));
|
|
384
420
|
if (!flags.recipes) {
|
|
385
421
|
process.stdout.write(`${renderBundledRecipesHint()}\n`);
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
422
|
+
const defaultRecipesLabel = selectedPreset.defaultRecipes.length > 0
|
|
423
|
+
? selectedPreset.defaultRecipes.join(", ")
|
|
424
|
+
: "none";
|
|
425
|
+
const answer = await askInput(`Install optional recipes (comma separated, or none) [default: ${defaultRecipesLabel}]: `);
|
|
426
|
+
const normalized = answer.trim().toLowerCase();
|
|
427
|
+
if (normalized === "") {
|
|
428
|
+
recipes = [...selectedPreset.defaultRecipes];
|
|
429
|
+
}
|
|
430
|
+
else if (normalized === "none") {
|
|
431
|
+
recipes = [];
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
recipes = answer
|
|
389
435
|
.split(",")
|
|
390
436
|
.map((item) => item.trim())
|
|
391
|
-
.filter(Boolean)
|
|
392
|
-
|
|
437
|
+
.filter(Boolean);
|
|
438
|
+
}
|
|
393
439
|
}
|
|
394
440
|
}
|
|
395
441
|
else {
|
|
396
|
-
|
|
397
|
-
recipes = flags.recipes ?? defaults.recipes;
|
|
442
|
+
recipes = flags.recipes ?? selectedPreset.defaultRecipes;
|
|
398
443
|
requirePlanApproval = flags.requirePlanApproval ?? selectedPreset.defaultRequirePlanApproval;
|
|
399
444
|
requireNetworkApproval =
|
|
400
445
|
flags.requireNetworkApproval ?? selectedPreset.defaultRequireNetworkApproval;
|
|
@@ -402,16 +447,17 @@ async function cmdInit(opts) {
|
|
|
402
447
|
flags.requireVerifyApproval ?? selectedPreset.defaultRequireVerifyApproval;
|
|
403
448
|
executionProfile = flags.executionProfile ?? selectedPreset.defaultExecutionProfile;
|
|
404
449
|
strictUnsafeConfirm = flags.strictUnsafeConfirm ?? selectedPreset.defaultStrictUnsafeConfirm;
|
|
405
|
-
process.stdout.write(renderInitSection("Defaults Applied", `Using compact ${setupProfilePreset} defaults for
|
|
450
|
+
process.stdout.write(renderInitSection("Defaults Applied", `Using compact ${setupProfilePreset} defaults for approvals, execution profile, and recipes. Hooks: ${hooks ? "enabled" : "disabled"}.`));
|
|
406
451
|
}
|
|
407
452
|
}
|
|
408
453
|
if (flags.yes) {
|
|
409
454
|
const yesPreset = setupProfilePresets[setupProfilePreset];
|
|
410
455
|
ide = flags.ide ?? defaults.ide;
|
|
456
|
+
policyGateway = flags.policyGateway ?? defaults.policyGateway;
|
|
411
457
|
workflow = flags.workflow ?? defaults.workflow;
|
|
412
458
|
backend = flags.backend ?? defaults.backend;
|
|
413
459
|
hooks = flags.hooks ?? yesPreset.defaultHooks;
|
|
414
|
-
recipes = flags.recipes ??
|
|
460
|
+
recipes = flags.recipes ?? yesPreset.defaultRecipes;
|
|
415
461
|
requirePlanApproval = flags.requirePlanApproval ?? yesPreset.defaultRequirePlanApproval;
|
|
416
462
|
requireNetworkApproval =
|
|
417
463
|
flags.requireNetworkApproval ?? yesPreset.defaultRequireNetworkApproval;
|
|
@@ -446,6 +492,21 @@ async function cmdInit(opts) {
|
|
|
446
492
|
];
|
|
447
493
|
const initFiles = [configPath, backendPath];
|
|
448
494
|
const conflicts = await collectInitConflicts({ initDirs, initFiles });
|
|
495
|
+
const gatewayPath = path.join(resolved.gitRoot, policyGatewayFileName(policyGateway));
|
|
496
|
+
const agentsMissing = !(await fileExists(gatewayPath));
|
|
497
|
+
if (conflicts.length > 0 && agentsMissing) {
|
|
498
|
+
// Recovery path: if a repo already contains conflicting .agentplane config/backend files,
|
|
499
|
+
// still materialize missing policy/agent templates before reporting conflicts.
|
|
500
|
+
await ensureAgentplaneDirs(resolved.agentplaneDir, backend);
|
|
501
|
+
await ensureAgentsFiles({
|
|
502
|
+
gitRoot: resolved.gitRoot,
|
|
503
|
+
agentplaneDir: resolved.agentplaneDir,
|
|
504
|
+
workflow,
|
|
505
|
+
policyGateway,
|
|
506
|
+
configPathAbs: configPath,
|
|
507
|
+
backendPathAbs: backendPath,
|
|
508
|
+
});
|
|
509
|
+
}
|
|
449
510
|
await handleInitConflicts({
|
|
450
511
|
gitRoot: resolved.gitRoot,
|
|
451
512
|
conflicts,
|
|
@@ -472,6 +533,7 @@ async function cmdInit(opts) {
|
|
|
472
533
|
gitRoot: resolved.gitRoot,
|
|
473
534
|
agentplaneDir: resolved.agentplaneDir,
|
|
474
535
|
workflow,
|
|
536
|
+
policyGateway,
|
|
475
537
|
configPathAbs: configPath,
|
|
476
538
|
backendPathAbs: backendPath,
|
|
477
539
|
});
|
|
@@ -483,6 +545,18 @@ async function cmdInit(opts) {
|
|
|
483
545
|
includeAgentPromptFiles: flags.gitignoreAgents === true,
|
|
484
546
|
});
|
|
485
547
|
installPaths.push(".gitignore");
|
|
548
|
+
const workflowInit = await ensureInitWorkflow({
|
|
549
|
+
gitRoot: resolved.gitRoot,
|
|
550
|
+
workflowMode: workflow,
|
|
551
|
+
approvals: {
|
|
552
|
+
requirePlanApproval,
|
|
553
|
+
requireVerifyApproval,
|
|
554
|
+
requireNetworkApproval,
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
for (const abs of workflowInit.installPaths) {
|
|
558
|
+
installPaths.push(path.relative(resolved.gitRoot, abs));
|
|
559
|
+
}
|
|
486
560
|
if (flags.gitignoreAgents) {
|
|
487
561
|
await setPinnedBaseBranch({
|
|
488
562
|
cwd: resolved.gitRoot,
|
|
@@ -501,14 +575,18 @@ async function cmdInit(opts) {
|
|
|
501
575
|
gitRoot: resolved.gitRoot,
|
|
502
576
|
});
|
|
503
577
|
installPaths.push(...ideRes.installPaths);
|
|
504
|
-
maybeInstallBundledRecipes(
|
|
578
|
+
await maybeInstallBundledRecipes({
|
|
579
|
+
recipes,
|
|
580
|
+
cwd: opts.cwd,
|
|
581
|
+
rootOverride: opts.rootOverride,
|
|
582
|
+
});
|
|
505
583
|
if (!flags.gitignoreAgents) {
|
|
506
584
|
await ensureInitCommit({
|
|
507
585
|
gitRoot: resolved.gitRoot,
|
|
508
586
|
baseBranch: initBaseBranch,
|
|
509
587
|
installPaths,
|
|
510
588
|
version: getVersion(),
|
|
511
|
-
skipHooks:
|
|
589
|
+
skipHooks: true,
|
|
512
590
|
});
|
|
513
591
|
}
|
|
514
592
|
process.stdout.write(`${path.relative(resolved.gitRoot, resolved.agentplaneDir)}\n`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cli.d.ts","sourceRoot":"","sources":["../../src/cli/run-cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-cli.d.ts","sourceRoot":"","sources":["../../src/cli/run-cli.ts"],"names":[],"mappings":"AA0lBA,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6N5D"}
|