create-byan-agent 2.22.0 → 2.23.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/CHANGELOG.md +29 -0
- package/install/templates/.githooks/pre-commit +21 -2
- package/install/templates/.github/agents/bmad-agent-byan.md +3 -3
- package/install/templates/.github/agents/bmad-agent-skeptic.md +1 -1
- package/install/templates/_byan/_config/agent-manifest.csv +2 -0
- package/install/templates/_byan/mcp/byan-mcp-server/bin/byan-sync-stubs.js +51 -0
- package/install/templates/_byan/mcp/byan-mcp-server/lib/stub-sync.js +158 -0
- package/package.json +1 -1
- package/install/templates/.claude/skills/byan-byan-test/SKILL.md +0 -12
- package/install/templates/.claude/skills/byan-test-dynamic/SKILL.md +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [2.23.0] - 2026-06-09
|
|
13
|
+
|
|
14
|
+
### Added - Stub path normalizer + a 5th pre-commit gate (no _bmad/@bmad drift)
|
|
15
|
+
|
|
16
|
+
The installer generated platform stubs (`.codex/prompts`, `.github/agents`,
|
|
17
|
+
`.claude/skills`) across many versions; older generators wrote the legacy path
|
|
18
|
+
layout (`_bmad/*/agents/X.md`, `@bmad/bmm/agents/X.md`,
|
|
19
|
+
`@bmad-output/bmb-creations/X/X.md`), so the tracked corpus carried a mix of stale
|
|
20
|
+
path forms while the agent source files stayed clean. This adds the mechanism that
|
|
21
|
+
removes the drift and blocks its return.
|
|
22
|
+
|
|
23
|
+
- **Tool** `_byan/mcp/byan-mcp-server/lib/stub-sync.js` + `bin/byan-sync-stubs.js`:
|
|
24
|
+
normalizes stale `_bmad/` and `@bmad/` PATH tokens to the `_byan/` canonical
|
|
25
|
+
layout, in place and surgically. The `@bmad-<word>` invocation syntax and the
|
|
26
|
+
`_bmad-output/` artifact dir are preserved; no stub is overwritten wholesale, so
|
|
27
|
+
the github full-copies and hand-authored skills keep their content. `--check`
|
|
28
|
+
reports any residual stale ref and exits non-zero.
|
|
29
|
+
- **5th pre-commit gate.** `.githooks/pre-commit` runs `byan-sync-stubs --check`
|
|
30
|
+
after the template-fidelity gate, blocking a commit whose tracked stubs have
|
|
31
|
+
drifted. It self-disables when the tool or the stub dirs are absent
|
|
32
|
+
(installed-user no-op).
|
|
33
|
+
- **First run.** 101 stub files normalized (codex prompts + the Codex global
|
|
34
|
+
`instructions.md` + 5 github stubs + their template twins); the byan github
|
|
35
|
+
full-copy changed only its 3 stale path lines, its other 1059 lines untouched.
|
|
36
|
+
- Design mirrors the template-fidelity sync (pure rewrite rules + IO-isolated
|
|
37
|
+
apply); 20 unit tests pin every rule, the two preservation cases, the IO layer,
|
|
38
|
+
and idempotence. The tool ships in the template, so the gate is live for
|
|
39
|
+
installed users too.
|
|
40
|
+
|
|
12
41
|
## [2.22.0] - 2026-06-09
|
|
13
42
|
|
|
14
43
|
### Changed - byan_dispatch routes the model tier by task nature, not by size
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# BYAN pre-commit hook.
|
|
2
|
+
# BYAN pre-commit hook. Five gates run in order:
|
|
3
3
|
# 1. Strict Mode gate : block if a strict session is engaged but not completed.
|
|
4
4
|
# 2. Native-workflow lint : block if a .claude/workflows/*.js couples to state.
|
|
5
5
|
# 3. Template fidelity : block if install/templates/ drifted from root.
|
|
6
|
-
# 4.
|
|
6
|
+
# 4. Stub path drift : block if a tracked stub carries a stale _bmad/@bmad path ref.
|
|
7
|
+
# 5. Mantra floor : block if a Gen3 persona source scores below the floor.
|
|
7
8
|
#
|
|
8
9
|
# Install :
|
|
9
10
|
# git config core.hooksPath .githooks
|
|
@@ -81,6 +82,24 @@ if [ -f "$TEMPLATE_SYNC" ]; then
|
|
|
81
82
|
fi
|
|
82
83
|
fi
|
|
83
84
|
|
|
85
|
+
# Stub path drift gate — the installer generated platform stubs (.codex/prompts,
|
|
86
|
+
# .github/agents, .claude/skills) over many versions; older generators emitted the
|
|
87
|
+
# legacy _bmad/@bmad path layout while the agent sources are clean. This gate
|
|
88
|
+
# blocks a commit whose tracked stubs still carry a stale _bmad/ or @bmad/ PATH
|
|
89
|
+
# ref (the @bmad- invocation syntax and the _bmad-output/ artifact dir are left
|
|
90
|
+
# alone). Re-normalize with the apply command, then restage. No-op if the tool is
|
|
91
|
+
# absent or no stub dirs exist (installed-user no-op).
|
|
92
|
+
STUB_SYNC="_byan/mcp/byan-mcp-server/bin/byan-sync-stubs.js"
|
|
93
|
+
if [ -f "$STUB_SYNC" ]; then
|
|
94
|
+
if ! node "$STUB_SYNC" --check --root "$(git rev-parse --show-toplevel)"; then
|
|
95
|
+
echo ""
|
|
96
|
+
echo "Commit blocked : a tracked stub carries a stale _bmad/@bmad path ref."
|
|
97
|
+
echo "Re-normalize with 'node $STUB_SYNC' then restage, or bypass with"
|
|
98
|
+
echo "'git commit --no-verify' (emergency only)."
|
|
99
|
+
exit 1
|
|
100
|
+
fi
|
|
101
|
+
fi
|
|
102
|
+
|
|
84
103
|
if [ ! -f "$VALIDATOR" ]; then
|
|
85
104
|
exit 0
|
|
86
105
|
fi
|
|
@@ -1023,14 +1023,14 @@ Il n'est PAS un worker isole — il est un orchestrateur dans l'ecosysteme BMAD.
|
|
|
1023
1023
|
|
|
1024
1024
|
L'agent peut executer n'importe quel workflow BMAD :
|
|
1025
1025
|
- Via commande : `@bmad-{module}-{workflow}` (ex: `@bmad-bmm-create-prd`)
|
|
1026
|
-
- Via menu handler : `exec="{project-root}/
|
|
1027
|
-
- Manifeste : `{project-root}/
|
|
1026
|
+
- Via menu handler : `exec="{project-root}/_byan/{module}/workflows/{workflow}/workflow.md"`
|
|
1027
|
+
- Manifeste : `{project-root}/_byan/_config/workflow-manifest.csv`
|
|
1028
1028
|
|
|
1029
1029
|
### Deleguer a d'autres Agents
|
|
1030
1030
|
|
|
1031
1031
|
L'agent peut invoquer n'importe quel agent specialise :
|
|
1032
1032
|
- Via commande : `@bmad-agent-{name}` (ex: `@bmad-agent-bmm-dev`)
|
|
1033
|
-
- Via manifeste : `{project-root}/
|
|
1033
|
+
- Via manifeste : `{project-root}/_byan/_config/agent-manifest.csv`
|
|
1034
1034
|
- L'agent delegue reprend le controle — l'agent courant se retire
|
|
1035
1035
|
|
|
1036
1036
|
### Acceder aux Contextes
|
|
@@ -6,7 +6,7 @@ description: 'Scientific Claim Challenger and Epistemic Guard'
|
|
|
6
6
|
You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.
|
|
7
7
|
|
|
8
8
|
<agent-activation CRITICAL="TRUE">
|
|
9
|
-
1. LOAD the FULL agent file from {project-root}/
|
|
9
|
+
1. LOAD the FULL agent file from {project-root}/_byan/agent/skeptic/skeptic.md
|
|
10
10
|
2. READ its entire contents - this contains the complete agent persona, menu, and instructions
|
|
11
11
|
3. LOAD the soul activation protocol from {project-root}/_byan/core/activation/soul-activation.md and EXECUTE it silently
|
|
12
12
|
4. FOLLOW every step in the <activation> section precisely
|
|
@@ -25,4 +25,6 @@ expert-merise-agile,"Expert Merise","Expert Merise Agile - Assistant de Concepti
|
|
|
25
25
|
"skeptic","The Skeptic","Scientific Claim Challenger and Epistemic Guard","[?]","Epistemic Guard + Fact-Check Specialist","Methodical challenger of all claims. Applies 3-step verification (Source / Proof type / Reproducible). Specializes in auditing documents for unsourced assertions, computing Trust Scores, and verifying reasoning chains with multiplicative confidence propagation.","Cold, methodical, impeccably polite. Speaks in structured CLAIM/CHALLENGE/VERDICT blocks. Uses Socratic method — questions before conclusions. Never hostile, always rigorous.","Challenge Before Confirm | Extraordinary claims require extraordinary evidence | Descartes Doubt | No URL generation | Strict-domain LEVEL-2 minimum","core","_byan/agent/skeptic/skeptic.md"
|
|
26
26
|
"forgeron","Le Forgeron","Revelateur d ames","","Revelateur d ames — Soul Forger","Expert en interview psychologique profonde pour extraire l ame du createur depuis ses experiences de vie. Detecte emotions, valeurs, blessures fondatrices. Genere creator-soul.md et agent soul files. Calme, patient, utilise le silence comme outil.","Calme, patient, minimal, profond. Questions rares mais chaque une compte. Utilise le silence. Reflete sans projeter.","Ne jamais interpreter a la place du createur | Ne jamais precipiter | Emotions = donnees de navigation | Preuve avant sentence","bmb","_byan/agent/forgeron/forgeron.md"
|
|
27
27
|
"tao","Tao","Le Tao — Directeur de Voix des Agents","道","Voice Director — Soul to Expression Bridge","Transforme les valeurs abstraites du soul.md en directives vocales concretes : tics de langage, registre, signatures verbales, vocabulaire interdit. Forge le tao.md de chaque agent. Garantit l anti-uniformite : chaque agent sonne unique.","Calme, precis, chirurgical. L oreille absolue pour les voix. Detecte le generique a la premiere phrase. Concret : jamais de regle sans exemple.","Derivation tracable : chaque tic nait d une valeur d ame | Anti-uniformite : deux agents ne sonnent jamais pareil | Exemple obligatoire | La voix sert l ame pas l inverse","core","_byan/agent/tao/tao.md"
|
|
28
|
+
"jimmy","Jimmy","Spécialiste Documentation Technique & Processus Internes","book-open","Technical Documentation Specialist + Outline Knowledge Custodian","Specialist in technical documentation and internal processes. Creates, maintains, and organizes operational documentation on Outline: runbooks, deployment procedures, infrastructure configs, and server and web guides. Expert in infra, web, and server work with zero approximation in procedures. Documents in French for francophone technical teams.","Professional and rigorous, direct without unnecessary jargon, and pedagogical when needed. Uses a standardized structure per document type.","Clear and actionable technical documentation | Standardized structure per document type | Systematic validation before publication | Coherently named and organized collections | Reusable templates when relevant","bmm","_byan/agent/jimmy/jimmy.md"
|
|
29
|
+
"mike","Mike","Gestionnaire de Projet — Spécialiste Leantime","clipboard-list","Project Manager + Leantime Integration Specialist","Project manager specialized in Leantime. Creates, organizes, and manages projects, tasks (tickets), sprints, and milestones on Leantime. Structures team work clearly and efficiently. Works in French for francophone teams.","Professional and organized, results-oriented, and direct in French. Asks targeted questions to structure the work with no superfluous content.","MVP first, the minimum viable to get moving | Validation before action, confirm before executing | Clarity through explicit names and concise descriptions | Traceability by documenting important decisions | Explicit errors with proposed alternatives","bmm","_byan/agent/mike/mike.md"
|
|
28
30
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { applyFix, check, STUB_DIRS } from '../lib/stub-sync.js';
|
|
5
|
+
|
|
6
|
+
// Normalize stale _bmad / @bmad PATH references in tracked agent stubs to the
|
|
7
|
+
// _byan/ canonical form. Two modes:
|
|
8
|
+
// (default) fix : rewrite stale path tokens in place (atomic per file).
|
|
9
|
+
// --check : report any residual stale ref and exit non-zero (no writes).
|
|
10
|
+
// This is the pre-commit gate's entry point.
|
|
11
|
+
// Usage: node bin/byan-sync-stubs.js [--check] [--root <dir>]
|
|
12
|
+
|
|
13
|
+
function parseArgs(argv) {
|
|
14
|
+
const args = { check: false };
|
|
15
|
+
for (let i = 2; i < argv.length; i++) {
|
|
16
|
+
if (argv[i] === '--check') args.check = true;
|
|
17
|
+
else if (argv[i] === '--root') args.projectRoot = argv[++i];
|
|
18
|
+
}
|
|
19
|
+
return args;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const args = parseArgs(process.argv);
|
|
23
|
+
const root = args.projectRoot || process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
24
|
+
|
|
25
|
+
// Self-disable when none of the stub dirs exist (installed-user no-op).
|
|
26
|
+
const anyDir = STUB_DIRS.some(
|
|
27
|
+
(d) => fs.existsSync(path.join(root, d)) || fs.existsSync(path.join(root, 'install', 'templates', d)),
|
|
28
|
+
);
|
|
29
|
+
if (!anyDir) {
|
|
30
|
+
process.stdout.write('[byan-sync-stubs] no stub directories - nothing to normalize\n');
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (args.check) {
|
|
35
|
+
const { stale, ok, scanned } = check({ rootDir: root });
|
|
36
|
+
if (ok) {
|
|
37
|
+
process.stdout.write(`[byan-sync-stubs] OK - ${scanned} stubs free of stale _bmad/@bmad path refs\n`);
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
for (const { file, refs } of stale) {
|
|
41
|
+
process.stderr.write(`[byan-sync-stubs] stale: ${file} -> ${refs.join(', ')}\n`);
|
|
42
|
+
}
|
|
43
|
+
process.stderr.write(
|
|
44
|
+
`[byan-sync-stubs] FAIL - ${stale.length} stub(s) carry stale path refs. Run: node bin/byan-sync-stubs.js\n`,
|
|
45
|
+
);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { fixed, scanned } = applyFix({ rootDir: root });
|
|
50
|
+
process.stdout.write(`[byan-sync-stubs] normalized - ${fixed.length} stub(s) fixed of ${scanned} scanned\n`);
|
|
51
|
+
process.exit(0);
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Stub path normalizer — keep tracked agent stubs free of stale _bmad / @bmad
|
|
2
|
+
// PATH references.
|
|
3
|
+
//
|
|
4
|
+
// The installer generated platform stubs (.codex/prompts, .github/agents,
|
|
5
|
+
// .claude/skills) over many versions. Older generators emitted the legacy path
|
|
6
|
+
// layout (`_bmad/*/agents/X.md`, `@bmad/bmm/agents/X.md`,
|
|
7
|
+
// `@bmad-output/bmb-creations/X/X.md`); the current generator emits the `_byan/`
|
|
8
|
+
// new layout. The committed corpus therefore carries a mix of stale path forms,
|
|
9
|
+
// while the source agent files are clean. This module normalizes those stale
|
|
10
|
+
// PATH tokens to the `_byan/` canonical form, in place, touching nothing else.
|
|
11
|
+
//
|
|
12
|
+
// Two tokens look similar but are NOT paths and must survive untouched:
|
|
13
|
+
// - `@bmad-<word>` : the agent/workflow INVOCATION syntax (`@bmad-bmm-create-prd`,
|
|
14
|
+
// `@bmad-party-mode`). A command, not a file path.
|
|
15
|
+
// - `_bmad-output/` : the accepted output-artifact directory (planning/
|
|
16
|
+
// implementation artifacts), documented in CLAUDE.md.
|
|
17
|
+
// Both are distinguished structurally: a path token is `@bmad/` or `_bmad/`
|
|
18
|
+
// (immediate slash); the survivors are `@bmad-` / `_bmad-` (immediate hyphen).
|
|
19
|
+
// The one exception is `[@_]bmad-output/bmb-creations/<name>/<name>.md`, which is
|
|
20
|
+
// a stale AGENT-LOAD path (the agent now lives at `_byan/agent/<name>/`), so that
|
|
21
|
+
// specific sub-form IS rewritten.
|
|
22
|
+
//
|
|
23
|
+
// Design mirrors template-sync.js: the risky half (the rewrite rules) is pure and
|
|
24
|
+
// exhaustively unit-tested; the I/O half takes an injected `io` so tests pin
|
|
25
|
+
// behaviour without touching the real filesystem. The tool only ever edits stale
|
|
26
|
+
// path tokens — it never regenerates or overwrites a stub wholesale, so the 6
|
|
27
|
+
// github full-copies and the 12 hand-authored rich skills keep their content.
|
|
28
|
+
|
|
29
|
+
import fs from 'node:fs';
|
|
30
|
+
import path from 'node:path';
|
|
31
|
+
|
|
32
|
+
// Tracked stub directories (root-relative POSIX). Each is scanned (its .md files)
|
|
33
|
+
// both at root and under its install/templates/ twin. `.codex` is taken whole so
|
|
34
|
+
// the Codex global context file (.codex/instructions.md) is normalized alongside
|
|
35
|
+
// the per-agent .codex/prompts/ stubs.
|
|
36
|
+
export const STUB_DIRS = ['.codex', '.github/agents', '.claude/skills'];
|
|
37
|
+
export const TEMPLATE_PREFIX = 'install/templates';
|
|
38
|
+
|
|
39
|
+
// Canonical new-layout reference for an agent name.
|
|
40
|
+
function agentRef(name) {
|
|
41
|
+
return `_byan/agent/${name}/${name}.md`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Ordered rewrite rules. Order matters: the specific agent-load forms run before
|
|
45
|
+
// the generic prefix swaps, so an agent path becomes the new layout
|
|
46
|
+
// (`_byan/agent/X/X.md`) rather than the legacy one (`_byan/*/agents/X.md`).
|
|
47
|
+
const RULES = [
|
|
48
|
+
// bmb-creations agent load -> new-layout agent ref. Matches both @bmad-output
|
|
49
|
+
// and _bmad-output ONLY when followed by /bmb-creations/<dir>/<name>.md, so a
|
|
50
|
+
// plain _bmad-output/ artifact path is left alone. Keyed on the .md FILENAME
|
|
51
|
+
// (not requiring dir == filename) so it covers every form findStaleRefs flags,
|
|
52
|
+
// keeping --fix and --check in lockstep (no flag-but-cannot-fix gate trap).
|
|
53
|
+
[/[@_]bmad-output\/bmb-creations\/[a-z0-9-]+\/([a-z0-9-]+)\.md/gi, (_m, n) => agentRef(n)],
|
|
54
|
+
// agent path, flat or nested: (@bmad|_bmad)/(*|module)/agents/<name>(/<name>)?.md
|
|
55
|
+
[/(?:@bmad|_bmad)\/(?:\*|[a-z0-9_-]+)\/agents\/([a-z0-9-]+)(?:\/[a-z0-9-]+)?\.md/gi, (_m, n) => agentRef(n)],
|
|
56
|
+
// generic _bmad/ path prefix. Does not touch _bmad-output (that is _bmad- then
|
|
57
|
+
// a hyphen, never _bmad followed by a slash).
|
|
58
|
+
[/_bmad\//g, '_byan/'],
|
|
59
|
+
// generic @bmad/ path prefix. Does not touch @bmad- invocation syntax.
|
|
60
|
+
[/@bmad\//g, '_byan/'],
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
// Pure: rewrite stale path tokens. Returns { text, changed }.
|
|
64
|
+
export function normalizeText(text) {
|
|
65
|
+
let out = text;
|
|
66
|
+
for (const [re, rep] of RULES) out = out.replace(re, rep);
|
|
67
|
+
return { text: out, changed: out !== text };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Pure: the stale path refs a clean file must NOT contain. A path token
|
|
71
|
+
// (`@bmad/` or `_bmad/`) or a bmb-creations agent load. Invocation `@bmad-` and
|
|
72
|
+
// plain `_bmad-output/` artifacts are excluded by construction.
|
|
73
|
+
// The generic arm uses [^...]* (zero-or-more) so a bare `@bmad/` or `_bmad/`
|
|
74
|
+
// prefix is flagged even when the next char is an excluded terminator (space,
|
|
75
|
+
// paren, quote, backtick) — rule 3/4 rewrite the prefix regardless, so --check
|
|
76
|
+
// must flag it regardless too.
|
|
77
|
+
const STALE_RE = /(?:[@_]bmad-output\/bmb-creations\/[a-z0-9-]+\/[a-z0-9-]+\.md|(?:@bmad|_bmad)\/[^\s)`'"]*)/gi;
|
|
78
|
+
export function findStaleRefs(text) {
|
|
79
|
+
const m = text.match(STALE_RE);
|
|
80
|
+
return m ? [...new Set(m)] : [];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Recursively list root-relative POSIX paths of every .md file under dir. Returns
|
|
84
|
+
// [] if dir does not exist (an installed user without these dirs is not an error).
|
|
85
|
+
export function walkRelMd(dir, { io = fs, base = dir } = {}) {
|
|
86
|
+
let entries;
|
|
87
|
+
try {
|
|
88
|
+
entries = io.readdirSync(dir, { withFileTypes: true });
|
|
89
|
+
} catch {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
const out = [];
|
|
93
|
+
for (const e of entries) {
|
|
94
|
+
const full = path.join(dir, e.name);
|
|
95
|
+
if (e.isDirectory()) {
|
|
96
|
+
out.push(...walkRelMd(full, { io, base }));
|
|
97
|
+
} else if (e.isFile() && e.name.endsWith('.md')) {
|
|
98
|
+
out.push(path.relative(base, full).split(path.sep).join('/'));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Every stub .md file (root-relative POSIX), root dirs + their template twins.
|
|
105
|
+
export function listStubFiles({ rootDir, io = fs } = {}) {
|
|
106
|
+
const files = [];
|
|
107
|
+
for (const d of STUB_DIRS) {
|
|
108
|
+
files.push(...walkRelMd(path.join(rootDir, d), { io, base: rootDir }));
|
|
109
|
+
files.push(...walkRelMd(path.join(rootDir, TEMPLATE_PREFIX, d), { io, base: rootDir }));
|
|
110
|
+
}
|
|
111
|
+
return files;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Plan: which tracked stub files would change under normalization.
|
|
115
|
+
export function planFix({ rootDir, io = fs } = {}) {
|
|
116
|
+
const files = listStubFiles({ rootDir, io });
|
|
117
|
+
const toFix = [];
|
|
118
|
+
for (const rel of files) {
|
|
119
|
+
const { changed } = normalizeText(io.readFileSync(path.join(rootDir, rel), 'utf8'));
|
|
120
|
+
if (changed) toFix.push(rel);
|
|
121
|
+
}
|
|
122
|
+
return { toFix, scanned: files.length };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Apply: normalize every file that needs it. Each write is atomic (stage adjacent
|
|
126
|
+
// tmp, rename over the target) so a crash never leaves a half-written stub.
|
|
127
|
+
export function applyFix({ rootDir, io = fs } = {}) {
|
|
128
|
+
const { toFix, scanned } = planFix({ rootDir, io });
|
|
129
|
+
for (const rel of toFix) {
|
|
130
|
+
const dest = path.join(rootDir, rel);
|
|
131
|
+
const { text } = normalizeText(io.readFileSync(dest, 'utf8'));
|
|
132
|
+
const tmp = `${dest}.tmp`;
|
|
133
|
+
try {
|
|
134
|
+
io.writeFileSync(tmp, text);
|
|
135
|
+
io.chmodSync(tmp, io.statSync(dest).mode & 0o777);
|
|
136
|
+
io.renameSync(tmp, dest);
|
|
137
|
+
} catch (err) {
|
|
138
|
+
try {
|
|
139
|
+
io.unlinkSync(tmp);
|
|
140
|
+
} catch {
|
|
141
|
+
void 0;
|
|
142
|
+
}
|
|
143
|
+
throw err;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { fixed: toFix, scanned };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Check: the drift verdict for --check. ok=true when no stale ref remains.
|
|
150
|
+
export function check({ rootDir, io = fs } = {}) {
|
|
151
|
+
const files = listStubFiles({ rootDir, io });
|
|
152
|
+
const stale = [];
|
|
153
|
+
for (const rel of files) {
|
|
154
|
+
const refs = findStaleRefs(io.readFileSync(path.join(rootDir, rel), 'utf8'));
|
|
155
|
+
if (refs.length) stale.push({ file: rel, refs });
|
|
156
|
+
}
|
|
157
|
+
return { stale, ok: stale.length === 0, scanned: files.length };
|
|
158
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-byan-agent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "BYAN v2.8 - Intelligent AI agent creator with ELO trust system + scientific fact-check + Hermes universal dispatcher + native Claude Code integration (hooks, skills, MCP server). Multi-platform (Copilot CLI, Claude Code, Codex). Merise Agile + TDD + 71 Mantras. ~54% LLM cost savings.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: byan-byan-test
|
|
3
|
-
description: BYAN Test - Token Optimized Version (-46%)
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# byan-test
|
|
7
|
-
|
|
8
|
-
## Rules
|
|
9
|
-
|
|
10
|
-
- This is a TEST version of BYAN optimized for token reduction (-46%)
|
|
11
|
-
- Full agent: _byan/bmb/agents/byan-test.md (116 lines vs 215 original)
|
|
12
|
-
- Original BYAN still available via bmad-agent-byan
|