mandrel 2.83.0 → 2.84.0
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/.agents/README.md +65 -20
- package/.agents/docs/configuration.md +36 -0
- package/.agents/docs/runbooks/mods.md +98 -54
- package/.agents/docs/workflows.md +14 -0
- package/.agents/instructions.md +4 -1
- package/.agents/mods/mandrel-status/hooks/register.tsx +579 -204
- package/.agents/mods/mandrel-status/types/index.d.ts +58 -13
- package/.agents/scripts/boot-sweep.js +42 -13
- package/.agents/scripts/generate-workflows-doc.js +14 -0
- package/.agents/scripts/lib/bootstrap/agents-md-fold.js +99 -16
- package/.agents/scripts/lib/bootstrap/manifest.js +4 -4
- package/.agents/scripts/lib/bootstrap/project-bootstrap.js +16 -1
- package/.agents/scripts/lib/codex/agents-projection.js +284 -0
- package/.agents/scripts/lib/codex/skills-projection.js +291 -0
- package/.agents/scripts/lib/config/agentrc-overlay.js +91 -0
- package/.agents/scripts/lib/config/sync-agentrc.js +39 -19
- package/.agents/scripts/lib/config-resolver.js +5 -42
- package/.agents/scripts/lib/config-settings-schema-quality.js +1 -1
- package/.agents/scripts/lib/observability/source-classifier.js +2 -0
- package/.agents/scripts/lib/orchestration/review-providers/codex-cli.js +152 -0
- package/.agents/scripts/lib/orchestration/review-providers/codex.js +33 -105
- package/.agents/scripts/lib/orchestration/review-providers/provider-severity.js +30 -0
- package/.agents/scripts/lib/orchestration/review-providers/security-review.js +3 -17
- package/.agents/scripts/lib/orchestration/single-story-close/phases/reconcile-done.js +12 -5
- package/.agents/scripts/lib/single-story-sweep/reconcile-closing.js +89 -0
- package/.agents/scripts/single-story-init.js +20 -5
- package/.agents/scripts/sync-agentrc.js +5 -3
- package/.agents/scripts/sync-claude-agents.js +20 -0
- package/.agents/scripts/sync-claude-commands.js +64 -27
- package/.agents/scripts/sync-codex-agents.js +36 -0
- package/.agents/scripts/sync-codex-skills.js +36 -0
- package/.agents/workflows/helpers/mandrel-sync-config.md +16 -9
- package/.agents/workflows/mandrel-update.md +2 -1
- package/docs/CHANGELOG.md +15 -0
- package/lib/cli/guarded-sync.js +3 -2
- package/lib/cli/registry.js +248 -0
- package/lib/cli/sync-agents.js +5 -2
- package/lib/cli/sync-commands.js +5 -2
- package/lib/cli/sync.js +45 -14
- package/lib/cli/uninstall.js +8 -1
- package/lib/migrations/index.js +2 -0
- package/lib/migrations/steps/2.84.0-hoist-system-prompt-block.js +64 -0
- package/package.json +3 -2
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Only a live close flips `agent::done`; a PR that merges after it is gone
|
|
3
|
+
* closes the issue at `agent::closing`. Boot finishes the flip via
|
|
4
|
+
* `reconcileDoneLabel` (MERGED PR required). Bounded; never throws.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { getStoryBranch } from '../git-utils.js';
|
|
8
|
+
import { AGENT_LABELS, TYPE_LABELS } from '../label-constants.js';
|
|
9
|
+
import { reconcileDoneLabel as defaultReconcile } from '../orchestration/single-story-close/phases/reconcile-done.js';
|
|
10
|
+
|
|
11
|
+
/** Candidates processed per sweep; a larger backlog drains across boots. */
|
|
12
|
+
export const DEFAULT_RECONCILE_LIMIT = 10;
|
|
13
|
+
|
|
14
|
+
function isStrandedStory(ticket) {
|
|
15
|
+
const labels = Array.isArray(ticket?.labels) ? ticket.labels : [];
|
|
16
|
+
return (
|
|
17
|
+
labels.includes(TYPE_LABELS.STORY) && !labels.includes(AGENT_LABELS.DONE)
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function reconcileOne({ story, cwd, deps, logger, reconcileFn }) {
|
|
22
|
+
try {
|
|
23
|
+
return await reconcileFn(
|
|
24
|
+
{
|
|
25
|
+
storyId: story.id,
|
|
26
|
+
storyBranch: getStoryBranch(story.id),
|
|
27
|
+
story,
|
|
28
|
+
options: { cwd },
|
|
29
|
+
},
|
|
30
|
+
deps,
|
|
31
|
+
(_tag, msg) => logger.info?.(msg),
|
|
32
|
+
);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
logger.warn?.(
|
|
35
|
+
`could not reconcile Story #${story.id} (host continues): ${err?.message ?? err}`,
|
|
36
|
+
);
|
|
37
|
+
return 'error';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function reconcileStrandedClosing({
|
|
42
|
+
provider,
|
|
43
|
+
config,
|
|
44
|
+
cwd,
|
|
45
|
+
gh,
|
|
46
|
+
notify,
|
|
47
|
+
sleep,
|
|
48
|
+
logger = {},
|
|
49
|
+
limit = DEFAULT_RECONCILE_LIMIT,
|
|
50
|
+
reconcileFn = defaultReconcile,
|
|
51
|
+
}) {
|
|
52
|
+
const outcome = { ok: true, reconciled: [], skipped: [] };
|
|
53
|
+
if (typeof provider?.listTicketsByLabel !== 'function') return outcome;
|
|
54
|
+
let tickets;
|
|
55
|
+
try {
|
|
56
|
+
tickets = await provider.listTicketsByLabel({
|
|
57
|
+
state: 'closed',
|
|
58
|
+
labels: AGENT_LABELS.CLOSING,
|
|
59
|
+
});
|
|
60
|
+
} catch (err) {
|
|
61
|
+
const msg = err?.message ?? String(err);
|
|
62
|
+
logger.warn?.(
|
|
63
|
+
`closed agent::closing listing failed (host continues): ${msg}`,
|
|
64
|
+
);
|
|
65
|
+
return { ...outcome, ok: false, error: msg };
|
|
66
|
+
}
|
|
67
|
+
const candidates = (Array.isArray(tickets) ? tickets : [])
|
|
68
|
+
.filter(isStrandedStory)
|
|
69
|
+
.slice(0, limit);
|
|
70
|
+
const deps = { provider, config, gh, notify, sleep };
|
|
71
|
+
for (const story of candidates) {
|
|
72
|
+
const storyId = story.id;
|
|
73
|
+
const result = await reconcileOne({
|
|
74
|
+
story,
|
|
75
|
+
cwd,
|
|
76
|
+
deps,
|
|
77
|
+
logger,
|
|
78
|
+
reconcileFn,
|
|
79
|
+
});
|
|
80
|
+
if (result === 'done') outcome.reconciled.push(storyId);
|
|
81
|
+
else outcome.skipped.push({ storyId, reason: result });
|
|
82
|
+
}
|
|
83
|
+
if (outcome.reconciled.length > 0) {
|
|
84
|
+
logger.info?.(
|
|
85
|
+
`🏷️ reconciled ${outcome.reconciled.length} closed Story(ies) stranded at agent::closing → agent::done.`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return outcome;
|
|
89
|
+
}
|
|
@@ -279,11 +279,12 @@ export async function reapClosedStoryWorktrees({
|
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
281
|
* Reap merged `story-*` branches (excluding the current one), then the
|
|
282
|
-
* closed-Story worktrees
|
|
283
|
-
* work, dirty worktree, open
|
|
284
|
-
* `boot-sweep.js` via
|
|
282
|
+
* closed-Story worktrees, then stranded `agent::closing` Stories. Never
|
|
283
|
+
* blocks init. Protected candidates (unpushed work, dirty worktree, open
|
|
284
|
+
* Story) are skipped; the lockfile is shared with `boot-sweep.js` via
|
|
285
|
+
* `resolveSweepLockPath` so concurrent reaps cannot race.
|
|
285
286
|
*
|
|
286
|
-
* @returns {Promise<{ worktreeSweep: object }>}
|
|
287
|
+
* @returns {Promise<{ worktreeSweep: object, closingReconcile: object }>}
|
|
287
288
|
*/
|
|
288
289
|
export async function reapMergedStoryBranches({
|
|
289
290
|
cwd,
|
|
@@ -294,6 +295,7 @@ export async function reapMergedStoryBranches({
|
|
|
294
295
|
injectedSweep,
|
|
295
296
|
worktreeSweepFn,
|
|
296
297
|
acquireLockFn,
|
|
298
|
+
closingReconcileFn,
|
|
297
299
|
}) {
|
|
298
300
|
const sweepFn =
|
|
299
301
|
injectedSweep ??
|
|
@@ -320,7 +322,20 @@ export async function reapMergedStoryBranches({
|
|
|
320
322
|
worktreeSweepFn,
|
|
321
323
|
acquireLockFn,
|
|
322
324
|
});
|
|
323
|
-
|
|
325
|
+
const reconcile =
|
|
326
|
+
closingReconcileFn ??
|
|
327
|
+
(await import('./lib/single-story-sweep/reconcile-closing.js'))
|
|
328
|
+
.reconcileStrandedClosing;
|
|
329
|
+
const closingReconcile = await reconcile({
|
|
330
|
+
provider,
|
|
331
|
+
config,
|
|
332
|
+
cwd,
|
|
333
|
+
logger: {
|
|
334
|
+
info: (m) => progress('CLEANUP', m),
|
|
335
|
+
warn: (m) => progress('CLEANUP', `⚠️ ${m}`),
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
return { worktreeSweep, closingReconcile };
|
|
324
339
|
}
|
|
325
340
|
|
|
326
341
|
async function reapMergedBranches({
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Validate `.agentrc.json`
|
|
4
|
+
* Validate `.agentrc.json` (with any `.agentrc.local.json` overlay merged in,
|
|
5
|
+
* as the runtime resolver does) and flag leaves that restate a framework
|
|
6
|
+
* default.
|
|
5
7
|
* Never writes the file: defaults are layered at read time, so absent keys
|
|
6
8
|
* need no filling. Flags and exit codes live in `USAGE`.
|
|
7
9
|
*/
|
|
@@ -14,13 +16,13 @@ import { Logger } from './lib/Logger.js';
|
|
|
14
16
|
const USAGE = {
|
|
15
17
|
invocation: 'node .agents/scripts/sync-agentrc.js [--cwd <path>] [--quiet]',
|
|
16
18
|
summary:
|
|
17
|
-
'Validate `.agentrc.json` against the framework schema and report every
|
|
19
|
+
'Validate `.agentrc.json` — with any gitignored `.agentrc.local.json` deep-merged over it, as the runtime resolver does — against the framework schema, and report every committed leaf that merely restates a framework default. Never writes the config.',
|
|
18
20
|
flags: [
|
|
19
21
|
['--cwd <path>', 'Project root (default: process cwd).'],
|
|
20
22
|
['--quiet', 'Suppress advisory rows; print only the status line.'],
|
|
21
23
|
],
|
|
22
24
|
notes: [
|
|
23
|
-
'Exit codes:\n 0 config is valid (advisories may still appear)\n 1
|
|
25
|
+
'Exit codes:\n 0 config is valid (advisories may still appear)\n 1 `.agentrc.json` is missing, either file is malformed, or the merged config fails schema validation',
|
|
24
26
|
],
|
|
25
27
|
};
|
|
26
28
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import fs from 'node:fs';
|
|
13
13
|
import path from 'node:path';
|
|
14
14
|
|
|
15
|
+
import { syncCodexAgents } from './lib/codex/agents-projection.js';
|
|
15
16
|
import { applyHeader } from './lib/command-header.js';
|
|
16
17
|
import { applyAgentModel, getAgentModels } from './lib/config/agent-models.js';
|
|
17
18
|
import { resolveConfig } from './lib/config-resolver.js';
|
|
@@ -148,3 +149,22 @@ await Promise.all(Array.from(byName.values()).map(syncEntry));
|
|
|
148
149
|
Logger.info(
|
|
149
150
|
`\n✔ ${synced} file(s) synced, ${sourceSet.size} total agents in .claude/agents/`,
|
|
150
151
|
);
|
|
152
|
+
|
|
153
|
+
// The Codex half: the same roles as `.codex/agents/mandrel-<role>.toml`. A
|
|
154
|
+
// fixture run (a DEST override) skips it unless SYNC_CODEX_AGENTS_DEST names
|
|
155
|
+
// its own target.
|
|
156
|
+
const codexAgentsDest =
|
|
157
|
+
process.env.SYNC_CODEX_AGENTS_DEST ??
|
|
158
|
+
(process.env.SYNC_CLAUDE_AGENTS_DEST ? null : undefined);
|
|
159
|
+
if (codexAgentsDest !== null) {
|
|
160
|
+
const codex = syncCodexAgents({
|
|
161
|
+
projectRoot: PROJECT_ROOT,
|
|
162
|
+
payloadSrc: PAYLOAD_SRC,
|
|
163
|
+
localSrc: LOCAL_SRC,
|
|
164
|
+
destDir: codexAgentsDest,
|
|
165
|
+
log: (line) => Logger.info(line),
|
|
166
|
+
});
|
|
167
|
+
Logger.info(
|
|
168
|
+
`✔ ${codex.written.length} file(s) synced, ${codex.total} total Codex agents in .codex/agents/`,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import fs from 'node:fs';
|
|
14
14
|
import path from 'node:path';
|
|
15
15
|
|
|
16
|
+
import { syncCodexSkills } from './lib/codex/skills-projection.js';
|
|
16
17
|
import { applyHeader, isCommandExcluded } from './lib/command-header.js';
|
|
17
18
|
import { Logger } from './lib/Logger.js';
|
|
18
19
|
|
|
@@ -117,14 +118,27 @@ function enumerateLoopUnits(dir) {
|
|
|
117
118
|
// Payload first, so it wins a collision.
|
|
118
119
|
const SRC_DIRS = [PAYLOAD_SRC, LOCAL_SRC].filter(dirExists);
|
|
119
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Named, not inline: an anonymous callback in this spawned-only script has no
|
|
123
|
+
* coverage coordinates for the CRAP seat to resolve.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} dir A workflows source root.
|
|
126
|
+
* @returns {Array<{dir: string, name: string, rel: string}>}
|
|
127
|
+
*/
|
|
128
|
+
function workflowEntriesIn(dir) {
|
|
129
|
+
return [
|
|
130
|
+
...fs
|
|
131
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
132
|
+
.filter(isTopLevelWorkflow)
|
|
133
|
+
.map(function toWorkflowEntry(e) {
|
|
134
|
+
return { dir, name: e.name, rel: e.name };
|
|
135
|
+
}),
|
|
136
|
+
...enumerateLoopUnits(dir),
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
|
|
120
140
|
/** @type {Array<{dir: string, name: string, rel: string}>} */
|
|
121
|
-
const entries = SRC_DIRS.flatMap(
|
|
122
|
-
...fs
|
|
123
|
-
.readdirSync(dir, { withFileTypes: true })
|
|
124
|
-
.filter(isTopLevelWorkflow)
|
|
125
|
-
.map((e) => ({ dir, name: e.name, rel: e.name })),
|
|
126
|
-
...enumerateLoopUnits(dir),
|
|
127
|
-
]);
|
|
141
|
+
const entries = SRC_DIRS.flatMap(workflowEntriesIn);
|
|
128
142
|
|
|
129
143
|
// A `command: false` workflow never enters `sourceSet`, so a stale copy is reaped.
|
|
130
144
|
const byRel = new Map();
|
|
@@ -171,30 +185,53 @@ for (const rel of listExistingCommands()) {
|
|
|
171
185
|
// The header goes after any frontmatter, so `---` stays on line 1.
|
|
172
186
|
let synced = 0;
|
|
173
187
|
const resolvedEntries = Array.from(byRel.values());
|
|
174
|
-
await Promise.all(
|
|
175
|
-
resolvedEntries.map(async ({ dir, rel }) => {
|
|
176
|
-
const isLocal = dir === LOCAL_SRC;
|
|
177
|
-
const header = isLocal ? LOCAL_HEADER : HEADER;
|
|
178
|
-
const content = await fs.promises.readFile(path.join(dir, rel), 'utf8');
|
|
179
|
-
const dest = path.join(DEST_DIR, rel);
|
|
180
|
-
const target = applyHeader(content, header);
|
|
181
188
|
|
|
182
|
-
|
|
189
|
+
/**
|
|
190
|
+
* @param {{ dir: string, rel: string }} entry
|
|
191
|
+
* @returns {Promise<void>}
|
|
192
|
+
*/
|
|
193
|
+
async function syncEntry({ dir, rel }) {
|
|
194
|
+
const isLocal = dir === LOCAL_SRC;
|
|
195
|
+
const header = isLocal ? LOCAL_HEADER : HEADER;
|
|
196
|
+
const content = await fs.promises.readFile(path.join(dir, rel), 'utf8');
|
|
197
|
+
const dest = path.join(DEST_DIR, rel);
|
|
198
|
+
const target = applyHeader(content, header);
|
|
183
199
|
|
|
184
|
-
|
|
185
|
-
try {
|
|
186
|
-
const existingContent = await fs.promises.readFile(dest, 'utf8');
|
|
187
|
-
if (existingContent === target) return;
|
|
188
|
-
} catch (err) {
|
|
189
|
-
if (err.code !== 'ENOENT') throw err;
|
|
190
|
-
}
|
|
200
|
+
await fs.promises.mkdir(path.dirname(dest), { recursive: true });
|
|
191
201
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
)
|
|
202
|
+
// Skip identical content to avoid noisy git diffs.
|
|
203
|
+
try {
|
|
204
|
+
const existingContent = await fs.promises.readFile(dest, 'utf8');
|
|
205
|
+
if (existingContent === target) return;
|
|
206
|
+
} catch (err) {
|
|
207
|
+
if (err.code !== 'ENOENT') throw err;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
await fs.promises.writeFile(dest, target, 'utf8');
|
|
211
|
+
synced++;
|
|
212
|
+
Logger.info(` synced ${rel}`);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
await Promise.all(resolvedEntries.map(syncEntry));
|
|
197
216
|
|
|
198
217
|
Logger.info(
|
|
199
218
|
`\n✔ ${synced} file(s) synced, ${sourceSet.size} total commands in .claude/commands/`,
|
|
200
219
|
);
|
|
220
|
+
|
|
221
|
+
// The Codex half: the same source set as Codex skills. A fixture run (a
|
|
222
|
+
// DEST override) skips it unless SYNC_CODEX_SKILLS_DEST names its own target.
|
|
223
|
+
const codexSkillsDest =
|
|
224
|
+
process.env.SYNC_CODEX_SKILLS_DEST ??
|
|
225
|
+
(process.env.SYNC_CLAUDE_COMMANDS_DEST ? null : undefined);
|
|
226
|
+
if (codexSkillsDest !== null) {
|
|
227
|
+
const codex = syncCodexSkills({
|
|
228
|
+
projectRoot: PROJECT_ROOT,
|
|
229
|
+
payloadSrc: PAYLOAD_SRC,
|
|
230
|
+
localSrc: LOCAL_SRC,
|
|
231
|
+
destDir: codexSkillsDest,
|
|
232
|
+
log: (line) => Logger.info(line),
|
|
233
|
+
});
|
|
234
|
+
Logger.info(
|
|
235
|
+
`✔ ${codex.written.length} file(s) synced, ${codex.total} total Codex skills in .agents/skills/workflows/`,
|
|
236
|
+
);
|
|
237
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Project the role agents into Codex custom agents under `.codex/agents/`.
|
|
5
|
+
* `sync-claude-agents.js` runs the same projection after the Claude one, so
|
|
6
|
+
* `mandrel sync-agents` and `npm run sync:agents` cover both hosts; this
|
|
7
|
+
* entry point refreshes the Codex half alone.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { runAsCli } from './lib/cli-utils.js';
|
|
11
|
+
import {
|
|
12
|
+
CODEX_AGENTS_DIR,
|
|
13
|
+
syncCodexAgents,
|
|
14
|
+
} from './lib/codex/agents-projection.js';
|
|
15
|
+
import { Logger } from './lib/Logger.js';
|
|
16
|
+
|
|
17
|
+
/** @returns {Promise<void>} */
|
|
18
|
+
async function main() {
|
|
19
|
+
const { written, total } = syncCodexAgents({
|
|
20
|
+
projectRoot: process.cwd(),
|
|
21
|
+
log: (line) => Logger.info(line),
|
|
22
|
+
});
|
|
23
|
+
Logger.info(
|
|
24
|
+
`\n✔ ${written.length} file(s) synced, ${total} total agents in ${CODEX_AGENTS_DIR}/`,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
runAsCli(import.meta.url, main, {
|
|
29
|
+
source: 'sync-codex-agents',
|
|
30
|
+
usage: {
|
|
31
|
+
invocation: 'node .agents/scripts/sync-codex-agents.js',
|
|
32
|
+
summary:
|
|
33
|
+
'Regenerate the Codex custom-agent projection of .agents/agents/ (and .agents/local/agents/) as .codex/agents/mandrel-<role>.toml.',
|
|
34
|
+
flags: [],
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Project the workflow set into Codex skills under `.agents/skills/workflows/`.
|
|
5
|
+
* `sync-claude-commands.js` runs the same projection after the Claude one, so
|
|
6
|
+
* `mandrel sync-commands` and `npm run sync:commands` cover both hosts; this
|
|
7
|
+
* entry point refreshes the Codex half alone.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { runAsCli } from './lib/cli-utils.js';
|
|
11
|
+
import {
|
|
12
|
+
CODEX_SKILLS_DIR,
|
|
13
|
+
syncCodexSkills,
|
|
14
|
+
} from './lib/codex/skills-projection.js';
|
|
15
|
+
import { Logger } from './lib/Logger.js';
|
|
16
|
+
|
|
17
|
+
/** @returns {Promise<void>} */
|
|
18
|
+
async function main() {
|
|
19
|
+
const { written, total } = syncCodexSkills({
|
|
20
|
+
projectRoot: process.cwd(),
|
|
21
|
+
log: (line) => Logger.info(line),
|
|
22
|
+
});
|
|
23
|
+
Logger.info(
|
|
24
|
+
`\n✔ ${written.length} file(s) synced, ${total} total skills in ${CODEX_SKILLS_DIR}/`,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
runAsCli(import.meta.url, main, {
|
|
29
|
+
source: 'sync-codex-skills',
|
|
30
|
+
usage: {
|
|
31
|
+
invocation: 'node .agents/scripts/sync-codex-skills.js',
|
|
32
|
+
summary:
|
|
33
|
+
'Regenerate the Codex skill projection of .agents/workflows/ (and .agents/local/workflows/) under .agents/skills/workflows/.',
|
|
34
|
+
flags: [],
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -35,9 +35,10 @@ The reconciliation rules:
|
|
|
35
35
|
|
|
36
36
|
| Scenario | Behavior |
|
|
37
37
|
| --------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
|
38
|
-
|
|
|
38
|
+
| Merged config (`.agentrc.json` + `.agentrc.local.json`) validates | **Preserve** unconditionally |
|
|
39
39
|
| Project value fails validation | **Abort** with a list of validation errors |
|
|
40
|
-
| Required key missing
|
|
40
|
+
| Required key missing from both files | **Abort via validator** — the schema catches it; the helper does not auto-fill |
|
|
41
|
+
| Required key supplied only by `.agentrc.local.json` | **Valid** — the overlay is merged before validation, as the runtime resolver does |
|
|
41
42
|
| Optional key missing in project | **Leave absent** — the runtime resolves the framework default at read time |
|
|
42
43
|
| Project value deep-equals framework default | **Emit `[REDUNDANT]` advisory** (informational only — the file is never modified) |
|
|
43
44
|
| Identity placeholder paths (`github.owner` / `repo` / …) | **Never flagged** — they carry no usable framework default |
|
|
@@ -72,22 +73,28 @@ The script:
|
|
|
72
73
|
override). When the file is missing, prints an error asking the
|
|
73
74
|
operator to run `mandrel init` (new project) or
|
|
74
75
|
`node .agents/scripts/bootstrap.js` (existing project) and exits 1.
|
|
75
|
-
2.
|
|
76
|
+
2. When a gitignored `.agentrc.local.json` exists, deep-merges it over
|
|
77
|
+
`.agentrc.json` exactly as the runtime resolver does (a malformed overlay
|
|
78
|
+
is reported by name and exits 1). Per-operator identity such as
|
|
79
|
+
`github.operatorHandle` may therefore live in the overlay alone — see
|
|
80
|
+
[Multi-operator repos](../../docs/configuration.md#multi-operator-repos).
|
|
81
|
+
3. Validates the merged config against the framework AJV schema
|
|
76
82
|
(`getAgentrcValidator()`). On any failure, prints a single-line error
|
|
77
83
|
list and exits 1 — the operator must fix the typo / missing required
|
|
78
|
-
key before re-running.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
`
|
|
84
|
+
key before re-running. A missing `github.operatorHandle` names where to
|
|
85
|
+
set it.
|
|
86
|
+
4. Walks every default leaf path. For each path where the committed
|
|
87
|
+
`.agentrc.json` carries a value deep-equal to the framework default,
|
|
88
|
+
prints a `[REDUNDANT]` advisory row (overlay leaves are never flagged). Advisories are informational — the
|
|
82
89
|
project file is never modified.
|
|
83
|
-
|
|
90
|
+
5. Prints the summary line and exits 0.
|
|
84
91
|
|
|
85
92
|
### Exit codes
|
|
86
93
|
|
|
87
94
|
| Code | Meaning |
|
|
88
95
|
| ---- | ----------------------------------------------------------------------------- |
|
|
89
96
|
| 0 | Config is valid (advisories may still appear) |
|
|
90
|
-
| 1 |
|
|
97
|
+
| 1 | `.agentrc.json` is missing, either file is malformed, or the merged config fails schema validation |
|
|
91
98
|
|
|
92
99
|
### Flags
|
|
93
100
|
|
|
@@ -147,7 +147,8 @@ node .agents/scripts/sync-agentrc.js
|
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
The helper is default-aware and **read-only**: it validates
|
|
150
|
-
the consumer config
|
|
150
|
+
the consumer config — `.agentrc.json` with any gitignored
|
|
151
|
+
`.agentrc.local.json` merged over it, as the runtime does — against the new schema (non-zero exit → fix the
|
|
151
152
|
validation error and re-run before proceeding), never auto-fills missing
|
|
152
153
|
optional keys (the runtime layers defaults at read time), and flags
|
|
153
154
|
project values that deep-equal the framework default as `[REDUNDANT]`
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,21 @@ All notable changes to this project will be documented in this file.
|
|
|
15
15
|
-->
|
|
16
16
|
<!-- markdownlint-disable-file MD004 MD012 MD037 -->
|
|
17
17
|
|
|
18
|
+
## [2.84.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.83.0...mandrel-v2.84.0) (2026-10-13)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
* make Codex a first-class Mandrel host alongside Claude Code ([#5655](https://github.com/dsj1984/mandrel/issues/5655)) ([#5660](https://github.com/dsj1984/mandrel/issues/5660)) ([14d999e](https://github.com/dsj1984/mandrel/commit/14d999eaebb8f456890e2e4cd49d2e912687f46d))
|
|
24
|
+
* mandrel-status band v2: one quiet line while healthy, a colored action line when a Story needs attention ([#5657](https://github.com/dsj1984/mandrel/issues/5657)) ([#5658](https://github.com/dsj1984/mandrel/issues/5658)) ([19ca2ee](https://github.com/dsj1984/mandrel/commit/19ca2ee2b6387fb828788dce79a89307d8787420))
|
|
25
|
+
* run the `codex` review provider on the Codex CLI instead of Claude ([#5656](https://github.com/dsj1984/mandrel/issues/5656)) ([#5659](https://github.com/dsj1984/mandrel/issues/5659)) ([0829fdf](https://github.com/dsj1984/mandrel/commit/0829fdf525198adf49773776c4d2bfc25e6519ed))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
* boot sweep finishes the agent::done flip for Stories GitHub closed while still at agent::closing ([#5652](https://github.com/dsj1984/mandrel/issues/5652)) ([#5653](https://github.com/dsj1984/mandrel/issues/5653)) ([f29e5f8](https://github.com/dsj1984/mandrel/commit/f29e5f88cff2ff09729dd2cadbb4248e428bf608))
|
|
31
|
+
* sync-agentrc validates the merged .agentrc.json + .agentrc.local.json, like the resolver ([#5649](https://github.com/dsj1984/mandrel/issues/5649)) ([#5650](https://github.com/dsj1984/mandrel/issues/5650)) ([7d4ee1d](https://github.com/dsj1984/mandrel/commit/7d4ee1d8add1d99a2cfd31d389d5495bfa9d8fd0))
|
|
32
|
+
|
|
18
33
|
## [2.83.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.82.0...mandrel-v2.83.0) (2026-10-12)
|
|
19
34
|
|
|
20
35
|
|
package/lib/cli/guarded-sync.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Shared body of `mandrel sync-commands` / `mandrel sync-agents`: run a
|
|
4
4
|
* `.agents/scripts/` projector in a child process, forwarding its exit code.
|
|
5
5
|
* Refuses first when `.agents/` does not match the running CLI (version
|
|
6
|
-
* marker, else the `agents-drift` check): `.claude
|
|
7
|
-
* stale
|
|
6
|
+
* marker, else the `agents-drift` check): every projection (`.claude/*`, the
|
|
7
|
+
* Codex skills and agents) is gitignored, so a stale one surfaces only when an
|
|
8
|
+
* agent hits a missing module. The projector writes both hosts' trees.
|
|
8
9
|
* The marker is read from `cwd()`; `PROJECT_ROOT` only names this CLI's version.
|
|
9
10
|
*/
|
|
10
11
|
|