@aiwg/cli 2026.11.0 → 2026.11.2

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.
Files changed (168) hide show
  1. package/agentic/code/addons/aiwg-hooks/canonical/aiwg-prompt-discovery.yaml +9 -0
  2. package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +136 -0
  3. package/agentic/code/providers/flue/README.md +2 -1
  4. package/agentic/code/providers/model-capabilities.v1.json +27 -23
  5. package/agentic/code/providers/model-catalog.v1.json +3 -3
  6. package/dist/src/artifacts/cli.js +13 -13
  7. package/dist/src/artifacts/discover-cli-help.js +25 -0
  8. package/dist/src/artifacts/discover-facets.js +2 -0
  9. package/dist/src/artifacts/discover-session-facets.js +15 -0
  10. package/dist/src/artifacts/fortemi-core-prebuilt-freshness.js +28 -0
  11. package/dist/src/artifacts/fortemi-core-query-adapter.js +4 -4
  12. package/dist/src/artifacts/fortemi-core-sync.js +3 -0
  13. package/dist/src/artifacts/framework-capabilities.js +11 -3
  14. package/dist/src/artifacts/framework-source-digest.js +1 -1
  15. package/dist/src/artifacts/index-builder.js +12 -13
  16. package/dist/src/artifacts/index-dependencies.js +72 -0
  17. package/dist/src/artifacts/query-engine-discover-output.js +13 -5
  18. package/dist/src/artifacts/query-engine-discover.js +103 -28
  19. package/dist/src/artifacts/query-engine-entries.js +107 -10
  20. package/dist/src/artifacts/query-engine-installation.js +27 -0
  21. package/dist/src/artifacts/query-engine-options.js +14 -1
  22. package/dist/src/artifacts/query-engine-rules.js +1 -2
  23. package/dist/src/artifacts/query-engine-scoring.js +38 -32
  24. package/dist/src/artifacts/query-engine-show-card.js +8 -2
  25. package/dist/src/artifacts/query-engine-show-load.js +1 -1
  26. package/dist/src/artifacts/query-engine-show.js +5 -3
  27. package/dist/src/artifacts/query-engine-templates.js +33 -0
  28. package/dist/src/artifacts/query-engine-verbose.js +25 -0
  29. package/dist/src/artifacts/relations-builder.js +49 -4
  30. package/dist/src/artifacts/relations.js +26 -10
  31. package/dist/src/artifacts/template-references.js +42 -0
  32. package/dist/src/artifacts/types.js +1 -1
  33. package/dist/src/cli/handlers/bundle-reconciliation.js +7 -3
  34. package/dist/src/cli/handlers/checkpoint-handoff.js +48 -0
  35. package/dist/src/cli/handlers/checkpoint-record.js +20 -0
  36. package/dist/src/cli/handlers/checkpoint.js +176 -0
  37. package/dist/src/cli/handlers/decision.js +1 -1
  38. package/dist/src/cli/handlers/doctor-args.js +3 -1
  39. package/dist/src/cli/handlers/doctor-help.js +2 -1
  40. package/dist/src/cli/handlers/help.js +1 -0
  41. package/dist/src/cli/handlers/index.js +4 -2
  42. package/dist/src/cli/handlers/models-resource-sample.js +7 -3
  43. package/dist/src/cli/handlers/ralph-launcher.js +1 -1
  44. package/dist/src/cli/handlers/refresh-bundles.js +2 -1
  45. package/dist/src/cli/handlers/refresh-managed-deployment.js +196 -0
  46. package/dist/src/cli/handlers/refresh.js +10 -2
  47. package/dist/src/cli/handlers/script-runner.js +2 -1
  48. package/dist/src/cli/handlers/steward-signing.js +44 -0
  49. package/dist/src/cli/handlers/steward.js +5 -0
  50. package/dist/src/cli/handlers/subcommands-discovery.js +8 -1
  51. package/dist/src/cli/handlers/use-provider-results.js +17 -0
  52. package/dist/src/cli/handlers/use.js +19 -18
  53. package/dist/src/cli/router.js +12 -2
  54. package/dist/src/cli/services/deployment-verification.js +11 -7
  55. package/dist/src/cli/user-scope-mirror.js +3 -1
  56. package/dist/src/config/aiwg-config.js +5 -1
  57. package/dist/src/config/cli.js +1 -0
  58. package/dist/src/config/delivery-validation.js +21 -0
  59. package/dist/src/config/host-resource-report.d.mts +1 -1
  60. package/dist/src/config/host-resource-report.mjs +23 -4
  61. package/dist/src/config/host-resource-runtime.d.mts +8 -0
  62. package/dist/src/config/host-resource-runtime.mjs +67 -24
  63. package/dist/src/config/index-graph-overrides.js +4 -0
  64. package/dist/src/config/worker-attribution.d.mts +7 -0
  65. package/dist/src/config/worker-attribution.mjs +44 -0
  66. package/dist/src/config/worker-write.js +4 -10
  67. package/dist/src/decision/ledger.js +15 -15
  68. package/dist/src/decision/offload.js +6 -7
  69. package/dist/src/delivery/git.js +62 -0
  70. package/dist/src/delivery/pr.js +151 -0
  71. package/dist/src/delivery/template-sections.js +56 -0
  72. package/dist/src/delivery/tracker.js +33 -0
  73. package/dist/src/discovery/interview.js +1 -1
  74. package/dist/src/extensions/claude-hooks-installer.js +62 -53
  75. package/dist/src/extensions/loader.js +2 -1
  76. package/dist/src/extensions/managed-hook-script-state.js +48 -0
  77. package/dist/src/extensions/muse-managed-hooks.js +49 -0
  78. package/dist/src/issues/cli.js +15 -3
  79. package/dist/src/issues/external-cli.js +79 -0
  80. package/dist/src/issues/live.js +26 -2
  81. package/dist/src/issues/local.js +5 -1
  82. package/dist/src/issues/tracker-policy.js +27 -0
  83. package/dist/src/mcp/json-document.d.mts +2 -0
  84. package/dist/src/mcp/tools/worker-invoke.mjs +2 -1
  85. package/dist/src/mcp/tools/worker-stdin-runtime.mjs +12 -0
  86. package/dist/src/models/conductor-data-policy.d.mts +3 -2
  87. package/dist/src/models/conductor-data-policy.mjs +94 -5
  88. package/dist/src/models/model-capabilities.v1.json +27 -23
  89. package/dist/src/models/model-catalog.v1.json +3 -3
  90. package/dist/src/models/provider-policy.js +8 -0
  91. package/dist/src/models/worker-health-readiness.js +20 -4
  92. package/dist/src/models/worker-health-snapshot.js +29 -0
  93. package/dist/src/models/worker-installation.d.mts +5 -1
  94. package/dist/src/models/worker-installation.mjs +11 -5
  95. package/dist/src/models/worker-plan.js +3 -3
  96. package/dist/src/models/worker-qualification-policy.js +54 -0
  97. package/dist/src/models/worker-selection-policy.js +2 -1
  98. package/dist/src/providers/deployment-lock.js +77 -0
  99. package/dist/src/providers/deployment-ownership.d.mts +12 -2
  100. package/dist/src/providers/deployment-ownership.mjs +115 -21
  101. package/dist/src/providers/deployment-preservation.d.mts +2 -1
  102. package/dist/src/providers/deployment-preservation.mjs +3 -0
  103. package/dist/src/providers/provider-definitions.js +4 -0
  104. package/dist/src/providers/skill-ownership.d.mts +1 -0
  105. package/dist/src/providers/transformation-receipt-integration.js +4 -2
  106. package/dist/src/providers/transformation-receipt.js +4 -2
  107. package/dist/src/serve/worker-invocation-preparation.js +3 -1
  108. package/dist/src/serve/worker-invocation.js +6 -2
  109. package/dist/src/skills/run.js +5 -0
  110. package/dist/src/smiths/context-pipeline/workspace-audit.js +34 -17
  111. package/dist/src/smiths/context-pipeline/workspace-context-shared.js +12 -6
  112. package/dist/src/smiths/context-pipeline/workspace-doctor.js +44 -4
  113. package/dist/src/smiths/context-pipeline/workspace-document.js +5 -2
  114. package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -1
  115. package/dist/src/smiths/hook-bridge/codex-translator.js +150 -92
  116. package/dist/src/smiths/hook-bridge/codex-trust.js +50 -0
  117. package/dist/src/smiths/hook-bridge/factory-hook-config.js +132 -0
  118. package/dist/src/smiths/hook-bridge/factory-translator.js +88 -33
  119. package/dist/src/smiths/hook-bridge/hermes-translator.js +3 -1
  120. package/dist/src/smiths/hook-bridge/index.js +3 -3
  121. package/dist/src/smiths/hook-bridge/loader.js +10 -2
  122. package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +5 -0
  123. package/dist/src/storage/workspace-permissions-health.js +64 -0
  124. package/dist/src/storage/workspace-permissions.js +51 -0
  125. package/package.json +9 -2
  126. package/schemas/models/model-config-compatibility.v1.schema.json +4 -0
  127. package/tools/agents/deploy-agents.mjs +15 -0
  128. package/tools/agents/providers/base-contract.mjs +7 -1
  129. package/tools/agents/providers/base-files.mjs +2 -1
  130. package/tools/agents/providers/base-flat-artifacts.mjs +6 -3
  131. package/tools/agents/providers/base-inventory.mjs +35 -13
  132. package/tools/agents/providers/base-models-platforms.mjs +3 -3
  133. package/tools/agents/providers/base-skill-copy.mjs +2 -0
  134. package/tools/agents/providers/base.mjs +1 -1
  135. package/tools/agents/providers/bound-rules-pointer.mjs +21 -0
  136. package/tools/agents/providers/claude-post-deploy.mjs +9 -5
  137. package/tools/agents/providers/codex-post-deploy.mjs +10 -0
  138. package/tools/agents/providers/conductor-data-guard.mjs +35 -11
  139. package/tools/agents/providers/factory-hooks.mjs +43 -0
  140. package/tools/agents/providers/factory.mjs +4 -91
  141. package/tools/agents/providers/muse-hooks.mjs +6 -41
  142. package/tools/agents/providers/muse-prompt-discovery.mjs +18 -0
  143. package/tools/agents/providers/packaged-codex-agents.mjs +48 -0
  144. package/tools/agents/providers/provider-prepare-coordinator.mjs +15 -10
  145. package/tools/agents/providers/rule-delivery-surface.mjs +10 -7
  146. package/tools/agents/providers/rule-deployment-commit.mjs +10 -0
  147. package/tools/agents/providers/rule-presentation.mjs +6 -5
  148. package/tools/agents/providers/rule-projection.mjs +10 -2
  149. package/tools/agents/providers/rule-startup.mjs +8 -1
  150. package/tools/agents/providers/stale-artifact-prune.mjs +9 -8
  151. package/tools/cli/decision-offload-report.mjs +7 -2
  152. package/tools/plugin/issue-template-copies.mjs +24 -0
  153. package/tools/plugin/package-plugins.mjs +11 -3
  154. package/tools/ralph-external/lib/factory-adapter.mjs +7 -8
  155. package/tools/ralph-external/lib/worker-artifacts.mjs +4 -2
  156. package/tools/ralph-external/lib/worker-capture.mjs +157 -0
  157. package/tools/ralph-external/lib/worker-final.mjs +43 -8
  158. package/tools/ralph-external/lib/worker-health.mjs +3 -0
  159. package/tools/ralph-external/lib/worker-invocation-processes.mjs +9 -6
  160. package/tools/ralph-external/lib/worker-launch-cli.mjs +20 -2
  161. package/tools/ralph-external/lib/worker-process-identity.mjs +30 -0
  162. package/tools/ralph-external/lib/worker-prompt.mjs +35 -0
  163. package/tools/ralph-external/lib/worker-retry-evidence.mjs +87 -6
  164. package/tools/ralph-external/lib/worker-run-directory-refusal.mjs +8 -0
  165. package/tools/ralph-external/lib/worker-termination.mjs +56 -6
  166. package/tools/ralph-external/process-monitor.mjs +12 -18
  167. package/tools/ralph-external/session-launcher.mjs +53 -36
  168. package/vscode-extension/schemas/aiwg.config.v1.json +15 -0
@@ -0,0 +1,20 @@
1
+ // Validate CLI checkpoint records against their canonical catalog contract at persistence boundaries.
2
+ import { loadSchemaCatalog, SchemaResolver, SchemaValidator } from '../../schema/index.js';
3
+ import { findPackageRoot } from '../find-package-root.js';
4
+ export const CHECKPOINT_SCHEMA_ID = 'https://aiwg.io/schemas/artifacts/checkpoint-record.v1.schema.json';
5
+ let validator;
6
+ export function assertCheckpointRecord(value, source) {
7
+ if (!validator) {
8
+ const rootDir = findPackageRoot(import.meta.dirname);
9
+ if (!rootDir)
10
+ throw new Error('Cannot locate checkpoint schema package root');
11
+ const loaded = loadSchemaCatalog({ rootDir });
12
+ if (!loaded.valid || !loaded.catalog)
13
+ throw new Error('Invalid checkpoint schema catalog');
14
+ validator = new SchemaValidator(new SchemaResolver(loaded.catalog, { rootDir }), { rootDir });
15
+ }
16
+ if (!validator.validate(CHECKPOINT_SCHEMA_ID, value).valid) {
17
+ throw new Error(`Invalid checkpoint record: ${source}`);
18
+ }
19
+ }
20
+ //# sourceMappingURL=checkpoint-record.js.map
@@ -0,0 +1,176 @@
1
+ // Create, list, and inspect lightweight workflow checkpoints in the configured artifact root.
2
+ import { randomUUID } from 'node:crypto';
3
+ import { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
4
+ import { join } from 'node:path';
5
+ import { boundedExecFileSync } from '../../process/bounded-child-process.mjs';
6
+ import { resolveProjectAiwgDirForWrite } from '../../config/project-artifacts.js';
7
+ import { writeCheckpointHandoff } from './checkpoint-handoff.js';
8
+ import { assertCheckpointRecord } from './checkpoint-record.js';
9
+ const usage = [
10
+ 'aiwg checkpoint — Save or inspect a workflow resume position',
11
+ '',
12
+ 'Usage:',
13
+ ' aiwg checkpoint create [--name N] [--phase P] [--step S] [--artifact <path>]... [--note N]',
14
+ ' [--handoff [--scope S] [--todo T]... [--constraint C]...]',
15
+ ' aiwg checkpoint list [--json]',
16
+ ' aiwg checkpoint recover [<id|name>] [--json]',
17
+ '',
18
+ 'Recover reports the saved record without changing the repository.',
19
+ 'Duplicate names select the newest matching checkpoint.',
20
+ 'Handoffs include handoff.md and next-session-prompt.md; omitted sections have TODO placeholders.',
21
+ 'Create is headless. Value flags require nonempty values; --scope/--todo/--constraint require --handoff.',
22
+ 'Recover prints the saved prompt and both paths for handoffs; --json returns the record.',
23
+ ].join('\n');
24
+ function parse(args) {
25
+ const [action, ...rest] = args;
26
+ if (!['create', 'list', 'recover'].includes(action))
27
+ throw new Error(`Unknown checkpoint action: ${action ?? '(missing)'}\n${usage}`);
28
+ const values = {};
29
+ const artifacts = [];
30
+ const todos = [];
31
+ const constraints = [];
32
+ let scope;
33
+ let handoff = false;
34
+ let lookup;
35
+ let json = false;
36
+ for (let i = 0; i < rest.length; i++) {
37
+ const arg = rest[i];
38
+ if (arg === '--json' && action !== 'create') {
39
+ json = true;
40
+ continue;
41
+ }
42
+ if (arg === '--handoff' && action === 'create') {
43
+ if (handoff)
44
+ throw new Error('--handoff may be given once');
45
+ handoff = true;
46
+ continue;
47
+ }
48
+ if (action === 'create' && /^--(name|phase|step|artifact|note|scope|todo|constraint)(=|$)/.test(arg)) {
49
+ const eq = arg.indexOf('=');
50
+ const key = arg.slice(2, eq < 0 ? undefined : eq);
51
+ const value = eq < 0 ? rest[++i] : arg.slice(eq + 1);
52
+ if (!value?.trim() || (eq < 0 && value.startsWith('-')))
53
+ throw new Error(`--${key} requires a value`);
54
+ if (key === 'artifact')
55
+ artifacts.push(value);
56
+ else if (key === 'todo')
57
+ todos.push(value);
58
+ else if (key === 'constraint')
59
+ constraints.push(value);
60
+ else if (key === 'scope') {
61
+ if (scope !== undefined)
62
+ throw new Error('--scope may be given once');
63
+ scope = value;
64
+ }
65
+ else {
66
+ if (key in values)
67
+ throw new Error(`--${key} may be given once`);
68
+ values[key] = value;
69
+ }
70
+ }
71
+ else if (action === 'recover' && !arg.startsWith('-') && lookup === undefined) {
72
+ lookup = arg;
73
+ }
74
+ else
75
+ throw new Error(`Unexpected checkpoint argument: ${arg}`);
76
+ }
77
+ if (!handoff && (scope !== undefined || todos.length || constraints.length)) {
78
+ throw new Error('--scope, --todo, and --constraint require --handoff');
79
+ }
80
+ return { action, values, artifacts, lookup, json, handoff, scope, todos, constraints };
81
+ }
82
+ async function records(dir) {
83
+ let files;
84
+ try {
85
+ files = (await readdir(dir, { withFileTypes: true })).flatMap(entry => entry.isFile() && entry.name.endsWith('.json') ? [entry.name]
86
+ : entry.isDirectory() && entry.name.startsWith('ckpt_') ? [join(entry.name, 'checkpoint.json')] : []);
87
+ }
88
+ catch (error) {
89
+ if (error.code === 'ENOENT')
90
+ return [];
91
+ throw error;
92
+ }
93
+ const result = await Promise.all(files.filter(file => file.endsWith('.json')).map(async (file) => {
94
+ const record = JSON.parse(await readFile(join(dir, file), 'utf8'));
95
+ assertCheckpointRecord(record, file);
96
+ return record;
97
+ }));
98
+ return result.sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt) || b.id.localeCompare(a.id));
99
+ }
100
+ function resumeText(record) {
101
+ return [
102
+ `Checkpoint: ${record.id}${record.name ? ` (${record.name})` : ''}`,
103
+ `Created: ${record.createdAt}`,
104
+ `Resume in: ${record.cwd}`,
105
+ `Phase: ${record.phase ?? '(unspecified)'}`,
106
+ `Step: ${record.step ?? '(unspecified)'}`,
107
+ ...(record.gitHead ? [`Git HEAD: ${record.gitHead}`] : []),
108
+ `Artifacts: ${record.artifacts.length ? record.artifacts.join(', ') : '(none)'}`,
109
+ ...(record.note !== undefined ? [`Note: ${record.note}`] : []),
110
+ ].join('\n');
111
+ }
112
+ export const checkpointHandler = {
113
+ id: 'checkpoint',
114
+ name: 'Workflow Checkpoints',
115
+ description: 'Create, list, or recover workflow positions and session handoffs',
116
+ category: 'workspace',
117
+ aliases: [],
118
+ async help() { return { exitCode: 0, message: usage, rawOutput: true }; },
119
+ async execute(ctx) {
120
+ if (ctx.args.includes('--help') || ctx.args.includes('-h') || ctx.args[0] === 'help') {
121
+ return { exitCode: 0, message: usage, rawOutput: true };
122
+ }
123
+ try {
124
+ const { action, values, artifacts, lookup, json, handoff, scope, todos, constraints } = parse(ctx.args);
125
+ const dir = join(resolveProjectAiwgDirForWrite(ctx.cwd), 'checkpoints');
126
+ if (action === 'create') {
127
+ if (ctx.dryRun)
128
+ return { exitCode: 0, message: `Would create checkpoint in ${dir}`, rawOutput: true };
129
+ let gitHead;
130
+ try {
131
+ gitHead = String(boundedExecFileSync('git', ['rev-parse', '--verify', 'HEAD'], 'quick', {
132
+ cwd: ctx.cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'],
133
+ })).trim();
134
+ }
135
+ catch { /* Checkpoints also work outside git repositories. */ }
136
+ const record = {
137
+ id: `ckpt_${randomUUID()}`, ...values, createdAt: new Date().toISOString(),
138
+ cwd: ctx.cwd, ...(gitHead ? { gitHead } : {}), artifacts,
139
+ };
140
+ assertCheckpointRecord(record, record.id);
141
+ await mkdir(dir, { recursive: true });
142
+ if (handoff) {
143
+ await writeCheckpointHandoff(ctx.frameworkRoot, dir, record, { scope, todos, constraints });
144
+ }
145
+ else {
146
+ await writeFile(join(dir, `${record.id}.json`), `${JSON.stringify(record, null, 2)}\n`, { flag: 'wx' });
147
+ }
148
+ return { exitCode: 0, message: record.id, rawOutput: true };
149
+ }
150
+ const all = await records(dir);
151
+ if (action === 'list') {
152
+ return {
153
+ exitCode: 0, rawOutput: true,
154
+ message: json ? JSON.stringify(all, null, 2) : all.length
155
+ ? ['ID\tName\tCreated\tPhase / Step\tHandoff', ...all.map(record => `${record.id}\t${record.name ?? '(unnamed)'}\t${record.createdAt}\t${record.phase ?? '-'} / ${record.step ?? '-'}\t${record.handoffPath ? 'yes' : '-'}`)].join('\n')
156
+ : 'No checkpoints found.',
157
+ };
158
+ }
159
+ const record = lookup === undefined ? all[0]
160
+ : all.find(record => record.id === lookup) ?? all.find(record => record.name === lookup);
161
+ if (!record)
162
+ throw new Error(lookup === undefined ? 'No checkpoints found.' : `Checkpoint not found: ${lookup}`);
163
+ let message = json ? JSON.stringify(record, null, 2) : resumeText(record);
164
+ if (!json && record.handoffPath && record.nextSessionPromptPath) {
165
+ const prompt = await readFile(record.nextSessionPromptPath, 'utf8');
166
+ message += `\nHandoff: ${record.handoffPath}\nNext-session prompt: ${record.nextSessionPromptPath}\n\n${prompt}`;
167
+ }
168
+ return { exitCode: 0, message, rawOutput: true };
169
+ }
170
+ catch (error) {
171
+ return { exitCode: 1, message: error instanceof Error ? error.message : String(error) };
172
+ }
173
+ },
174
+ };
175
+ export const checkpointHandlers = [checkpointHandler];
176
+ //# sourceMappingURL=checkpoint.js.map
@@ -167,7 +167,7 @@ async function decisionAsk(ctx) {
167
167
  throw invocation.outcome === 'unknown' ? invocation.error : new Error('Decision ask was skipped');
168
168
  const result = invocation.result;
169
169
  if (args.includes('--json'))
170
- return jsonResult(result);
170
+ return jsonResult({ ...result, ledgerRecorded: invocation.opportunity.ledgerRecorded });
171
171
  if (result.status === 'fallback')
172
172
  return { exitCode: 0, message: `FALLBACK to LLM: ${result.reason}`, rawOutput: true };
173
173
  return { exitCode: 0, message: `${String(result.answer)} (confidence ${result.confidence?.toFixed(2) ?? 'unknown'}, ${result.model ?? 'unknown-model'})`, rawOutput: true };
@@ -4,7 +4,7 @@ export function parsePublicDoctorFlags(args) {
4
4
  const valueFlags = ['--provider', '--bundle', '--scope', '--context-baseline', '--context-budget-tokens', '--cli', '--forget-approval', '--group'];
5
5
  const knownFlags = new Set([
6
6
  ...valueFlags, '--list-approvals', '--all-providers', '--probe-workers', '--qualify', '--yes', '--dry-run', '--no-budget-check', '--strict-context', '--json',
7
- '--resources', '--decision-offload', '--deployment', '--user', '--verbose', '-v', '--project-local', '--quiet', '--help', '-h',
7
+ '--resources', '--decision-offload', '--fix', '--deployment', '--user', '--verbose', '-v', '--project-local', '--quiet', '--help', '-h',
8
8
  ]);
9
9
  const hasSwitch = (name) => hasPositionalOrSwitch(args, name, valueFlags);
10
10
  const values = new Map();
@@ -21,6 +21,8 @@ export function parsePublicDoctorFlags(args) {
21
21
  throw new Error(`Unknown flag: ${name}`);
22
22
  }
23
23
  }
24
+ if (hasSwitch('--fix') && !hasSwitch('--decision-offload'))
25
+ throw new Error('--fix requires --decision-offload');
24
26
  if (values.get('--group') !== undefined && !hasSwitch('--resources'))
25
27
  throw new Error('--group requires --resources');
26
28
  if (hasSwitch('--resources') && (['--probe-workers', '--decision-offload', '--deployment', '--user', '--project-local'].some(hasSwitch) || values.get('--scope') !== undefined)) {
@@ -20,7 +20,8 @@ Options:
20
20
  --cli NAME Limit worker probes, qualification, or approvals to one CLI
21
21
  --group <name> Apply the named group cap (requires --resources)
22
22
  --resources Report live host resources, threshold origins and remaining worker slots (supports --json)
23
- --decision-offload Show offline advisory decision readiness and adoption report
23
+ --decision-offload Show offline advisory decision readiness, adoption and workspace permission report
24
+ --fix With --decision-offload, repair unsafe journal modes and collapsed group masks on non-secret outputs
24
25
  --probe-workers Run bounded worker CLI version probes (default: config-only, no subprocess)
25
26
  --project-local Include project-local artifact diagnostics
26
27
  --json Emit machine-readable output (with --probe-workers: one worker-probe record per CLI; with --deployment: deployment verification; with --decision-offload: offline snapshot; with --resources: host capacity)
@@ -116,6 +116,7 @@ function displayHelp() {
116
116
  ['cost-report --fleet', 'Observe OpenRouter per-bot MTD spend and correlate local activity'],
117
117
  ]);
118
118
  helpGroup('EVIDENCE', [
119
+ ['checkpoint create|list|recover', 'Save workflow positions or session handoffs (create --handoff)'],
119
120
  ['evidence export --output <dir>', 'Package portable activity, report, source, eval, and provenance evidence'],
120
121
  ['evidence verify <bundle>', 'Verify every member hash and the bundle checkpoint'],
121
122
  ['effect record|lookup|reconcile', 'Record, look up or reconcile a side effect in the signed effect ledger'],
@@ -33,6 +33,7 @@ import { regenerateHandler, regenerateHandlers } from './regenerate.js';
33
33
  import { workspaceContextHandler, workspaceContextHandlers } from './workspace-context.js';
34
34
  import { artifactsHandler, artifactsHandlers } from './artifacts.js';
35
35
  import { effectHandler, effectHandlers } from './effect.js';
36
+ import { checkpointHandler, checkpointHandlers } from './checkpoint.js';
36
37
  import { mcHandler, mcHandlers } from './mc.js';
37
38
  import { missionHandlers } from './mission.js';
38
39
  import { sdlcAccelerateHandler } from './sdlc-accelerate.js';
@@ -88,7 +89,7 @@ newBundleHandler, quickrefHandler, newProjectHandler, sessionHandler, sessionsHa
88
89
  // Workspace
89
90
  statusHandler, wizardHandler, migrateWorkspaceHandler, rollbackWorkspaceHandler,
90
91
  // Subcommands
91
- mcpHandler, catalogHandler, modelsHandler, versionsHandler, indexHandler, artifactsHandler, effectHandler, corpusHandler, discoverHandler, showHandler, featuresHandler, skillsHandler, configHandler, opsHandler, storageHandler, activityLogHandler, commandLogHandler, skillUsageHandler, kbHandler, memoryHandler, reflectionsHandler, provenanceHandler, researchStoreHandler, researchQueryHandler, runtimeInfoHandler, agentcardHandler, uhpHandler,
92
+ mcpHandler, catalogHandler, modelsHandler, versionsHandler, indexHandler, artifactsHandler, effectHandler, checkpointHandler, corpusHandler, discoverHandler, showHandler, featuresHandler, skillsHandler, configHandler, opsHandler, storageHandler, activityLogHandler, commandLogHandler, skillUsageHandler, kbHandler, memoryHandler, reflectionsHandler, provenanceHandler, researchStoreHandler, researchQueryHandler, runtimeInfoHandler, agentcardHandler, uhpHandler,
92
93
  // Agentic Tools (RLM)
93
94
  chunkHandler, fanoutHandler, rlmPrepHandler, rlmSearchHandler, rlmStatusCliHandler, rlmCacheHandler,
94
95
  // Utilities
@@ -124,7 +125,7 @@ repoAccessHandler,
124
125
  // Lint
125
126
  lintHandler, };
126
127
  // Re-export handler arrays
127
- export { workspaceHandlers, utilityHandlers, scaffoldingHandlers, housekeeperHandlers, ralphHandlers, subcommandHandlers, mcHandlers, missionHandlers, teamHandlers, stewardHandlers, regenerateHandlers, workspaceContextHandlers, artifactsHandlers, effectHandlers, daemonHandlers, sandboxHandlers, repoAccessHandlers, };
128
+ export { workspaceHandlers, utilityHandlers, scaffoldingHandlers, housekeeperHandlers, ralphHandlers, subcommandHandlers, mcHandlers, missionHandlers, teamHandlers, stewardHandlers, regenerateHandlers, workspaceContextHandlers, artifactsHandlers, effectHandlers, checkpointHandlers, daemonHandlers, sandboxHandlers, repoAccessHandlers, };
128
129
  /**
129
130
  * All registered command handlers
130
131
  *
@@ -186,6 +187,7 @@ export const allHandlers = [
186
187
  indexHandler,
187
188
  artifactsHandler,
188
189
  effectHandler,
190
+ checkpointHandler,
189
191
  corpusHandler,
190
192
  discoverHandler,
191
193
  showHandler,
@@ -1,10 +1,14 @@
1
1
  // Sample the project and actual CLI request filesystems before rendering a worker.
2
2
  import path from 'node:path';
3
- import { readLiveHostResources } from '../../config/host-resource-runtime.mjs';
3
+ import { nearestDispatchPathSync, readLiveHostResources } from '../../config/host-resource-runtime.mjs';
4
4
  import { parseWorkerCommandArgs } from '../../serve/worker-command-request.js';
5
5
  export function sampleWorkerHostResources(ctx, readers) {
6
6
  const request = ctx.args[0] === 'resolve' ? parseWorkerCommandArgs(ctx.args.slice(1)) : undefined;
7
- const paths = request ? [ctx.cwd, request.workdir, path.dirname(request.final_output)] : [ctx.cwd];
8
- return readLiveHostResources({ ...readers, paths });
7
+ // A final-output folder is normally created by the launch, so sample the
8
+ // filesystem it will land on, under the launcher's fail-closed rules (#3856).
9
+ const paths = request
10
+ ? [ctx.cwd, request.workdir, nearestDispatchPathSync(path.dirname(request.final_output))]
11
+ : [ctx.cwd];
12
+ return readLiveHostResources({ ...readers, paths, workspace: request?.workdir ?? ctx.cwd });
9
13
  }
10
14
  //# sourceMappingURL=models-resource-sample.js.map
@@ -264,7 +264,7 @@ export async function launchExternalRalph(frameworkRoot, projectRoot, options) {
264
264
  while (!identity && process.hrtime.bigint() < identityDeadline) {
265
265
  if ((child.exitCode !== null && child.exitCode !== undefined) || child.signalCode)
266
266
  break;
267
- identity = capture.observe(sampleWorkerIdentity(pid));
267
+ identity = capture.observe(sampleWorkerIdentity(pid, { includeExited: true }));
268
268
  if (!identity)
269
269
  await new Promise(resolve => setTimeout(resolve, 10));
270
270
  }
@@ -12,7 +12,8 @@ export async function refreshDeclaredBundles(ctx, config, frameworks, requested,
12
12
  for (const provider of bundleProviders(config?.installed ?? {}, fw, requested)) {
13
13
  const copyArgs = bundleCopyArgs(config?.installed ?? {}, fw, provider);
14
14
  if (opts.dryRun) {
15
- console.log(` Would re-deploy: ${fw} for ${provider} — aiwg use ${bundleUseName(fw)} --provider ${provider}${copyArgs.length ? ` ${copyArgs.join(' ')}` : ''}`);
15
+ if (!opts.quiet)
16
+ console.log(` Would re-deploy: ${fw} for ${provider} — aiwg use ${bundleUseName(fw)} --provider ${provider}${copyArgs.length ? ` ${copyArgs.join(' ')}` : ''}`);
16
17
  continue;
17
18
  }
18
19
  const result = await withInstalledSelection(ctx.cwd, config?.installed, () => opts.handler.execute({ ...ctx, frameworkRoot: opts.frameworkRoot,
@@ -0,0 +1,196 @@
1
+ // Detect managed hook registration/script drift and outdated rule headers without writes.
2
+ import fs from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { isDeepStrictEqual } from 'node:util';
5
+ import { lt, valid } from 'semver';
6
+ import { managedClaudeHooks } from '../../extensions/claude-hooks-installer.js';
7
+ import { AIWG_MANAGED_HOOKS } from '../../extensions/muse-managed-hooks.js';
8
+ import { managedHookScriptState } from '../../extensions/managed-hook-script-state.js';
9
+ import { managedFactoryHooks } from '../../smiths/hook-bridge/factory-translator.js';
10
+ import { readFactoryDocument } from '../../smiths/hook-bridge/factory-hook-config.js';
11
+ import { loadHookSources } from '../../smiths/hook-bridge/loader.js';
12
+ import { parseJson } from '../../mcp/json-document.mjs';
13
+ import { getProviderArtifactPathStrings } from '../../providers/provider-definitions.js';
14
+ import * as ui from '../ui.js';
15
+ import { getFortemiCorePrebuiltStatus } from '../../artifacts/fortemi-core-sync.js';
16
+ import { fortemiCorePrebuiltRepairHint } from '../../artifacts/fortemi-core-prebuilt-freshness.js';
17
+ import { inferInstallationMethod } from '../../installation/manager.mjs';
18
+ export function sourcePrebuiltIndexRepairHint(frameworkRoot) {
19
+ if (inferInstallationMethod(frameworkRoot) !== 'source')
20
+ return null;
21
+ const status = getFortemiCorePrebuiltStatus('framework', frameworkRoot);
22
+ if (status.built && !status.stale)
23
+ return null;
24
+ return `${status.reason ?? 'prebuilt framework index is missing'} — ${fortemiCorePrebuiltRepairHint(frameworkRoot)}`;
25
+ }
26
+ async function readJson(file) {
27
+ try {
28
+ const doc = parseJson(await fs.readFile(file, 'utf8'));
29
+ if (!doc || typeof doc !== 'object' || Array.isArray(doc))
30
+ throw new Error('Expected an object');
31
+ return doc;
32
+ }
33
+ catch (error) {
34
+ if (error.code === 'ENOENT')
35
+ return {};
36
+ throw error;
37
+ }
38
+ }
39
+ function groups(doc, event) {
40
+ const hooks = doc.hooks;
41
+ return Array.isArray(hooks?.[event]) ? hooks[event] : [];
42
+ }
43
+ async function staleHooks(projectRoot, frameworkRoot, provider) {
44
+ if (!['claude', 'muse', 'factory'].includes(provider))
45
+ return [];
46
+ const file = provider === 'claude' ? '.claude/settings.json' : `.${provider}/hooks.json`;
47
+ let doc;
48
+ // Factory hooks.json is a top-level event map (older AIWG wrote it nested); normalize both (#3971).
49
+ try {
50
+ doc = provider === 'factory' ? readFactoryDocument(path.join(projectRoot, file)) : await readJson(path.join(projectRoot, file));
51
+ }
52
+ catch {
53
+ return [{ name: `${provider} managed hooks`, file, reason: 'unreadable' }];
54
+ }
55
+ const stale = [];
56
+ if (provider === 'factory') {
57
+ for (const hook of managedFactoryHooks()) {
58
+ const candidates = groups(doc, hook.event).flatMap(group => Array.isArray(group?.hooks) ? group.hooks : [])
59
+ .filter(entry => entry && (entry._aiwg_id === hook.id || entry.command === hook.command));
60
+ if (!candidates.some(entry => entry.type === 'command' && entry.command === hook.command
61
+ && entry._aiwg_managed === true && entry._aiwg_id === hook.id)) {
62
+ stale.push({ name: `${hook.event} → ${hook.id}`, file, reason: candidates.length ? 'outdated' : 'missing' });
63
+ }
64
+ }
65
+ }
66
+ else if (provider === 'claude') {
67
+ const source = path.join(frameworkRoot, 'agentic/code/addons/aiwg-hooks/hooks');
68
+ let sourceFiles;
69
+ try {
70
+ sourceFiles = await fs.readdir(source);
71
+ }
72
+ catch (error) {
73
+ if (error.code === 'ENOENT')
74
+ return [];
75
+ throw error;
76
+ }
77
+ for (const hook of managedClaudeHooks(sourceFiles)) {
78
+ const candidates = groups(doc, hook.event).flatMap(group => Array.isArray(group?.hooks) ? group.hooks : [])
79
+ .filter(entry => entry && (entry._aiwg_id === hook.hookId ||
80
+ (typeof entry.command === 'string' && entry.command.includes(hook.script))));
81
+ const current = candidates.some(entry => entry.type === 'command' && entry.command === hook.command &&
82
+ entry._aiwg_managed === true && entry._aiwg_id === hook.hookId);
83
+ if (!current)
84
+ stale.push({ name: `${hook.event} → ${hook.hookId}`, file, reason: candidates.length ? 'outdated' : 'missing' });
85
+ }
86
+ }
87
+ else {
88
+ // Muse cannot carry in-band ids. Its sidecar supplies identity for older commands.
89
+ let recorded = [];
90
+ try {
91
+ const sidecar = await readJson(path.join(projectRoot, '.muse/.aiwg-hooks.json'));
92
+ if (Array.isArray(sidecar.hooks))
93
+ recorded = sidecar.hooks;
94
+ }
95
+ catch { /* The live document still proves canonical registrations without a sidecar. */ }
96
+ for (const hook of AIWG_MANAGED_HOOKS) {
97
+ const deployed = groups(doc, hook.event);
98
+ if (deployed.some(group => isDeepStrictEqual(group, hook.group)))
99
+ continue;
100
+ const previous = recorded.find(entry => entry?.id === hook.id);
101
+ const exists = deployed.some(group => isDeepStrictEqual(group, previous?.group) ||
102
+ group?.hooks?.some(entry => entry?.command === hook.group.hooks[0].command));
103
+ stale.push({ name: `${hook.event} → ${hook.id}`, file, reason: exists ? 'outdated' : 'missing' });
104
+ }
105
+ }
106
+ return stale;
107
+ }
108
+ async function staleRules(projectRoot, provider, version) {
109
+ const directory = getProviderArtifactPathStrings(provider)?.rules;
110
+ if (!directory || path.isAbsolute(directory) || directory.startsWith('~'))
111
+ return [];
112
+ const stale = [];
113
+ async function visit(relative) {
114
+ let entries;
115
+ try {
116
+ entries = await fs.readdir(path.join(projectRoot, relative), { withFileTypes: true });
117
+ }
118
+ catch (error) {
119
+ if (error.code !== 'ENOENT')
120
+ throw error;
121
+ return;
122
+ }
123
+ await Promise.all(entries.map(async (entry) => {
124
+ const file = path.join(relative, entry.name);
125
+ if (entry.isDirectory())
126
+ return visit(file);
127
+ if (!entry.isFile() || !/\.(md|mdc)$/.test(entry.name))
128
+ return;
129
+ const content = await fs.readFile(path.join(projectRoot, file), 'utf8');
130
+ const marker = /^(?:#|<!--)\s*aiwg:managed\s+v([^\s>]+)([^\r\n]*)/m.exec(content);
131
+ if (!marker || /\bproject-local\b/.test(marker[2]))
132
+ return;
133
+ const older = valid(marker[1]) && valid(version) ? lt(marker[1], version) : marker[1] !== version;
134
+ if (older)
135
+ stale.push({ name: `${file} (v${marker[1]} → v${version})`, file, reason: 'outdated' });
136
+ }));
137
+ }
138
+ await visit(directory);
139
+ return stale;
140
+ }
141
+ async function staleHookScripts(projectRoot, frameworkRoot, provider) {
142
+ const source = path.join(frameworkRoot, 'agentic/code/addons/aiwg-hooks/hooks');
143
+ const scripts = new Map();
144
+ if (provider === 'claude') {
145
+ let files;
146
+ try {
147
+ files = await fs.readdir(source);
148
+ }
149
+ catch (error) {
150
+ if (error.code === 'ENOENT')
151
+ return [];
152
+ throw error;
153
+ }
154
+ for (const hook of managedClaudeHooks(files))
155
+ scripts.set(hook.script, path.join(source, path.basename(hook.script)));
156
+ }
157
+ else if (provider === 'muse') {
158
+ scripts.set('.muse/hooks/aiwg-prompt-discovery.cjs', path.join(source, 'aiwg-prompt-discovery.cjs'));
159
+ }
160
+ else if (provider === 'codex' || provider === 'factory') {
161
+ // Match installCodexPromptDiscovery: resolve packaged canonical arguments,
162
+ // not the portable launcher command emitted into hooks.json.
163
+ const { sources, errors } = await loadHookSources(frameworkRoot);
164
+ if (errors.length)
165
+ throw new Error(errors.join('\n'));
166
+ const hook = sources.find(entry => entry.id === 'aiwg-prompt-discovery');
167
+ if (hook?.args?.[0])
168
+ scripts.set(`.${provider}/hooks/aiwg-prompt-discovery.cjs`, hook.args[0]);
169
+ }
170
+ const stale = [];
171
+ for (const [file, sourceFile] of scripts) {
172
+ // Each provider currently copies these bytes verbatim; registrations may
173
+ // transform commands independently (notably Codex's portable launcher).
174
+ const reason = await managedHookScriptState(projectRoot, file, await fs.readFile(sourceFile));
175
+ if (reason)
176
+ stale.push({ name: file, file, reason });
177
+ }
178
+ return stale;
179
+ }
180
+ export async function checkManagedDeployment(options) {
181
+ const { projectRoot, frameworkRoot, provider, quiet } = options;
182
+ const pkg = await readJson(path.join(frameworkRoot, 'package.json'));
183
+ const [hooks, scripts, rules] = await Promise.all([
184
+ staleHooks(projectRoot, frameworkRoot, provider),
185
+ staleHookScripts(projectRoot, frameworkRoot, provider),
186
+ typeof pkg.version === 'string' ? staleRules(projectRoot, provider, pkg.version) : [],
187
+ ]);
188
+ const stale = [...hooks, ...scripts, ...rules].sort((a, b) => a.name.localeCompare(b.name));
189
+ if (stale.length && !quiet) {
190
+ for (const item of stale)
191
+ ui.warn(`Stale deployment: ${item.reason} ${item.name} — ${item.file}${item.reason === 'operator-edited' ? ' (kept; review operator edits before redeploying)' : ''}`);
192
+ ui.warn(`Fix this deployment: aiwg use all --provider ${provider}`);
193
+ }
194
+ return stale;
195
+ }
196
+ //# sourceMappingURL=refresh-managed-deployment.js.map
@@ -22,6 +22,7 @@ import { createUseHandler } from './use.js';
22
22
  import { automaticRemovalAllowed } from '../../providers/deployment-preservation.mjs';
23
23
  import { refreshDeclaredBundles } from './refresh-bundles.js';
24
24
  import { bundledRuleOutputNames } from './refresh-rule-inventory.js';
25
+ import { checkManagedDeployment, sourcePrebuiltIndexRepairHint } from './refresh-managed-deployment.js';
25
26
  import { getFrameworkRoot } from '../../channel/manager.mjs';
26
27
  import { refreshAllPackages } from '../../packages/registry.js';
27
28
  import { resolveActiveProvider } from '../provider-resolution.js';
@@ -606,6 +607,7 @@ export const refreshHandler = {
606
607
  ui.warn('--prune-tracked has no effect without --prune-other-providers; nothing was removed.');
607
608
  }
608
609
  let staleAgentRemovals = [];
610
+ let staleManagedDeployments = [];
609
611
  let trackedSkipped = [];
610
612
  // A dry run still reports what a real run would remove. Skipping the pass
611
613
  // entirely meant `refresh --dry-run` printed "Checking for stale deployments..."
@@ -688,7 +690,7 @@ export const refreshHandler = {
688
690
  try {
689
691
  const { getFrameworkRoot } = await import('../../channel/manager.mjs');
690
692
  const { join } = await import('path');
691
- const config = await readAiwgConfig(process.cwd());
693
+ const config = await readAiwgConfig(ctx.cwd);
692
694
  if (config) {
693
695
  const MANIFEST_PATHS = {
694
696
  sdlc: 'agentic/code/frameworks/sdlc-complete/manifest.json',
@@ -697,6 +699,7 @@ export const refreshHandler = {
697
699
  research: 'agentic/code/frameworks/research-complete/manifest.json',
698
700
  };
699
701
  const frameworkRoot = await getFrameworkRoot();
702
+ staleManagedDeployments = await checkManagedDeployment({ projectRoot: ctx.cwd, frameworkRoot, provider: detectedProvider, quiet });
700
703
  // Batch-hash manifests in parallel instead of serially awaiting each
701
704
  // one. For ~10 frameworks this cuts refresh latency from ~N*I/O to
702
705
  // max-single-I/O on a warm filesystem (#919 cleanup).
@@ -724,7 +727,7 @@ export const refreshHandler = {
724
727
  : `Deployments current, but ${removed} stale artifact(s) were removed this run — review the list above`);
725
728
  }
726
729
  }
727
- else {
730
+ else if (staleManagedDeployments.length === 0) {
728
731
  if (!quiet)
729
732
  ui.success('All deployments up to date');
730
733
  }
@@ -778,6 +781,9 @@ export const refreshHandler = {
778
781
  }
779
782
  }
780
783
  // Step 5: Health check
784
+ const prebuiltIndexRepair = dryRun ? null : sourcePrebuiltIndexRepairHint(frameworkRoot);
785
+ if (prebuiltIndexRepair && !quiet)
786
+ ui.warn(prebuiltIndexRepair);
781
787
  if (!quiet)
782
788
  ui.info(dryRun ? 'Would run health check...' : 'Running health check...');
783
789
  if (!dryRun) {
@@ -819,8 +825,10 @@ export const refreshHandler = {
819
825
  skipUpdate,
820
826
  channel: channel || undefined,
821
827
  staleAgentRemovals,
828
+ staleManagedDeployments,
822
829
  deploymentFailures,
823
830
  updateFailure,
831
+ prebuiltIndexRepair,
824
832
  });
825
833
  console.log(output);
826
834
  }
@@ -15,6 +15,7 @@ import { pathToFileURL } from 'node:url';
15
15
  import { Console } from 'node:console';
16
16
  import { Writable } from 'node:stream';
17
17
  import { writeSync } from 'node:fs';
18
+ import { providerDeploymentLockEnvironment } from '../../providers/deployment-lock.js';
18
19
  // Embedded deployers use process-wide console/environment APIs. Serialize the
19
20
  // complete invocation (including import), and restore them even after failure.
20
21
  let deploymentQueue = Promise.resolve();
@@ -62,7 +63,7 @@ export class DefaultScriptRunner {
62
63
  const stdio = options.capture
63
64
  ? ['pipe', options.stdoutFd ?? 'pipe', 'pipe']
64
65
  : 'inherit';
65
- const environment = { ...process.env, ...options.env };
66
+ const environment = { ...process.env, ...providerDeploymentLockEnvironment(), ...options.env };
66
67
  for (const name of options.omitEnv ?? [])
67
68
  delete environment[name];
68
69
  const child = spawn('node', [fullPath, ...args], {
@@ -0,0 +1,44 @@
1
+ // Offer optional signed local merges with a reviewable preview and an explicit config-only apply.
2
+ import { readAiwgConfig, writeAiwgConfig } from '../../config/aiwg-config.js';
3
+ export async function stewardSignedMerges(args, cwd) {
4
+ const values = new Map();
5
+ for (let i = 0; i < args.length; i++) {
6
+ if (['--apply', '--skip', '--help'].includes(args[i]))
7
+ continue;
8
+ if (!['--key', '--key-file', '--name', '--email', '--format', '--program'].includes(args[i]) || !args[i + 1] || args[i + 1].startsWith('--'))
9
+ throw new Error('Invalid signed-merges option');
10
+ values.set(args[i], args[++i]);
11
+ }
12
+ if (args.includes('--skip')) {
13
+ console.log('Signed merge setup skipped; project configuration preserved.');
14
+ return;
15
+ }
16
+ const config = await readAiwgConfig(cwd);
17
+ if (!config)
18
+ throw new Error('Signed merge setup requires .aiwg/aiwg.config');
19
+ const existing = config.delivery;
20
+ const key = values.get('--key') ?? existing?.signing?.key;
21
+ const name = values.get('--name') ?? existing?.committer?.name;
22
+ const email = values.get('--email') ?? existing?.committer?.email;
23
+ const format = values.get('--format') ?? existing?.signing?.format ?? 'openpgp';
24
+ if (!['openpgp', 'ssh', 'x509'].includes(format))
25
+ throw new Error('Signing format must be openpgp, ssh, or x509');
26
+ if (args.includes('--help') || !key || !name || !email) {
27
+ console.log('Recommended, optional: set up signed merges using an existing signing key and permitted repository policy. Skip when signing is unavailable or unwanted.\naiwg steward signed-merges --key <fingerprint> --name <committer> --email <email> [--format openpgp|ssh|x509] [--key-file <path>] [--program <path>]\nReview the preview, then add --apply to save. Use --skip to preserve unsigned delivery. SSH signing uses --key SHA256:... for verification and --key-file for the signing key path. This step creates no keys and changes no repository policies.');
28
+ if (args.includes('--apply'))
29
+ throw new Error('Applying signed merges requires key, name, and email');
30
+ return;
31
+ }
32
+ const delivery = { ...existing, merge: 'local-signed', require_signed_commits: true,
33
+ committer: { name, email }, signing: { ...existing?.signing, key, format: format, enforce: 'commits',
34
+ ...(values.has('--key-file') ? { key_file: values.get('--key-file') } : {}),
35
+ ...(values.has('--program') ? { program: values.get('--program') } : {}) } };
36
+ console.log(JSON.stringify({ delivery }, null, 2));
37
+ if (args.includes('--apply')) {
38
+ await writeAiwgConfig(cwd, { ...config, delivery });
39
+ console.log('Signed local merge configuration saved.');
40
+ }
41
+ else
42
+ console.log('Preview only. Add --apply to save, or --skip to keep current delivery.');
43
+ }
44
+ //# sourceMappingURL=steward-signing.js.map