bmad-method-test-architecture-enterprise 3.6.1 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/README.md +10 -3
- package/cli/lib/automate-prompt.js +3 -7
- package/cli/lib/framework-setup.js +1 -2
- package/cli/lib/parse-report.js +1 -1
- package/cli/lib/resolve-tea-config.js +167 -38
- package/cli/lib/trace-command.js +13 -5
- package/cli/migrate-customizations.js +853 -77
- package/cli/teach.js +0 -1
- package/cli/test-review.js +6 -2
- package/package.json +3 -2
- package/skills/bmad-tea/SKILL.md +2 -2
- package/skills/bmad-tea-automate/SKILL.md +12 -11
- package/skills/bmad-tea-automate/customize.toml +12 -0
- package/skills/bmad-tea-automate/red/atdd-checklist-template.md +4 -4
- package/skills/bmad-tea-automate/red/checklist.md +1 -0
- package/skills/bmad-tea-automate/red/instructions.md +1 -1
- package/skills/bmad-tea-automate/red/steps-c/step-04a-subagent-api-failing.md +5 -0
- package/skills/bmad-tea-automate/red/steps-c/step-04b-subagent-e2e-failing.md +4 -0
- package/skills/bmad-tea-automate/red/steps-c/step-04c-aggregate.md +3 -2
- package/skills/bmad-tea-automate/red/steps-c/step-05-validate-and-complete.md +5 -4
- package/skills/bmad-tea-automate/red/steps-e/step-02-apply-edit.md +4 -4
- package/skills/bmad-tea-automate/red/steps-v/step-01-validate.md +4 -4
- package/skills/bmad-tea-automate/red/workflow.yaml +0 -1
- package/skills/bmad-tea-automate/resources/test-generation-routing.md +4 -7
- package/skills/bmad-tea-automate/steps-c/step-04-validate-and-summarize.md +4 -4
- package/skills/bmad-tea-automate/steps-e/step-02-apply-edit.md +4 -4
- package/skills/bmad-tea-automate/steps-v/step-01-validate.md +4 -4
- package/skills/bmad-tea-automate/workflow.yaml +0 -1
- package/skills/bmad-tea-evaluate/SKILL.md +1 -1
- package/skills/bmad-tea-framework/SKILL.md +3 -3
- package/skills/bmad-tea-framework/customize.toml +11 -2
- package/skills/bmad-tea-framework/resources/hooks/tea-enforce.cjs +366 -46
- package/skills/bmad-tea-framework/resources/setup-routing.md +6 -6
- package/skills/bmad-tea-framework/steps-c/step-04-docs-and-scripts.md +16 -12
- package/skills/bmad-tea-framework/workflow.yaml +0 -1
- package/skills/bmad-tea-nfr/SKILL.md +2 -2
- package/skills/bmad-tea-nfr/workflow.yaml +0 -1
- package/skills/bmad-tea-teach-me-testing/SKILL.md +2 -2
- package/skills/bmad-tea-test-design/SKILL.md +2 -2
- package/skills/bmad-tea-test-design/workflow.yaml +0 -1
- package/skills/bmad-tea-test-review/SKILL.md +2 -2
- package/skills/bmad-tea-test-review/workflow.yaml +0 -1
- package/skills/bmad-tea-trace/SKILL.md +2 -2
- package/skills/bmad-tea-trace/steps-c/step-04-analyze-gaps.md +2 -1
- package/skills/bmad-tea-trace/steps-c/step-05-gate-decision.md +30 -13
- package/skills/bmad-tea-trace/workflow.yaml +0 -1
- package/skills/bmod-tea/bmod.toml +3 -3
- package/skills/bmod-tea/help/help.md +10 -9
- package/skills/bmod-tea/knowledge/maestro-flows.md +1 -1
- package/skills/bmod-tea/migration-1.toml +7 -7
- package/skills/bmod-tea/migration-3.toml +50 -0
- package/skills/bmod-tea/retired.toml +13 -0
- package/skills/bmad-tea-automate/red/customize.toml +0 -38
- package/skills/bmad-tea-framework/ci/customize.toml +0 -10
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"name": "bmad-method-test-architecture-enterprise",
|
|
32
32
|
"source": "./",
|
|
33
33
|
"description": "Master Test Architect module for quality strategy, test generation in red and expand modes with automatic run-and-heal, combined framework and CI setup, CI/CD quality gates, and structured testing education. Existing CI and ATDD customizations can be migrated to the new skill names. Part of the BMad Method ecosystem.",
|
|
34
|
-
"version": "
|
|
34
|
+
"version": "4.0.1",
|
|
35
35
|
"author": {
|
|
36
36
|
"name": "Murat K Ozcan (TEA Creator) & Brian (BMad) Madison"
|
|
37
37
|
},
|
package/README.md
CHANGED
|
@@ -46,17 +46,24 @@ To install a tagged release, replace `<version>` with the release number:
|
|
|
46
46
|
npx skills add https://github.com/bmad-code-org/bmad-method-test-architecture-enterprise/tree/v<version>/skills
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
### Upgrading to 4.0
|
|
50
|
+
|
|
51
|
+
TEA 4.0 reads red-mode overrides from `[workflow.red]` in `bmad-tea-automate.toml` and CI overrides from `[workflow.ci]` in `bmad-tea-framework.toml`, including each personal `.user.toml` layer. Personal module settings belong in `_bmad/custom/config.user.toml`.
|
|
52
|
+
Run `bmad migrate tea` to move existing settings, including legacy personal module keys. The 4.x CLI commands below handle customization files and report personal module keys that still need `bmad migrate tea`.
|
|
53
|
+
|
|
49
54
|
### Upgrading to 3.0
|
|
50
55
|
|
|
51
56
|
The eight direct workflow commands now share the `bmad-tea-*` prefix. Replace `bmad-testarch-automate`, `-evaluate`, `-framework`, `-nfr`, `-test-design`, `-test-review`, and `-trace` with the same suffix under `bmad-tea-`. Replace `bmad-teach-me-testing` with `bmad-tea-teach-me-testing`. The 3.0 package does not publish the old slash commands. The `bmad-tea` agent, `bmod-tea` module, menu codes, and `tea-*` CLI executables keep their names.
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
Use the 4.x migration tool to preview and apply customization changes:
|
|
54
59
|
|
|
55
60
|
```bash
|
|
56
|
-
npx --package=bmad-method-test-architecture-enterprise@
|
|
57
|
-
npx --package=bmad-method-test-architecture-enterprise@
|
|
61
|
+
npx --package=bmad-method-test-architecture-enterprise@4 tea-migrate-customizations --project-root . --check
|
|
62
|
+
npx --package=bmad-method-test-architecture-enterprise@4 tea-migrate-customizations --project-root .
|
|
58
63
|
```
|
|
59
64
|
|
|
65
|
+
Use `--help` for usage. For a directory whose name begins with a dash, pass `--project-root ./-name`; flag-like operands are rejected before the migration reads or writes files.
|
|
66
|
+
|
|
60
67
|
This includes old CI and ATDD customization files and old skill references in custom `bmad-tea` agent menus. The command moves old-only files with their comments and permissions intact. When both old and new filenames exist, it reports both paths and asks for a manual merge so no comments or values are lost. Resolve the reported files, then rerun the command. See the [configuration reference](https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/reference/configuration/) for details.
|
|
61
68
|
|
|
62
69
|
An existing host may retain the old skill folders after installing 3.0. Check the host's project and global skills folders, back up any edits in the old folders, and move those eight folders out of skill discovery. The [troubleshooting guide](https://bmad-code-org.github.io/bmad-method-test-architecture-enterprise/reference/troubleshooting/#old-slash-commands-still-appear-after-30) lists the exact folders and a safe cleanup sequence. Restart the host so its command list refreshes.
|
|
@@ -27,13 +27,9 @@ function resolveGenerationConfig(projectRoot, checkpointPath, operation, skillRo
|
|
|
27
27
|
};
|
|
28
28
|
if (!['none', 'auto', 'cli', 'mcp'].includes(tea.tea_browser_automation))
|
|
29
29
|
throw new Error('tea_browser_automation must be none, auto, cli or mcp');
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
mode === 'red' && !fs.existsSync(sibling)
|
|
34
|
-
? path.join(skillRoot, 'red', 'customize.toml')
|
|
35
|
-
: path.join(mode === 'red' ? path.dirname(sibling) : skillRoot, 'customize.toml');
|
|
36
|
-
const workflowCustomization = readWorkflowCustomization(configSource(projectRoot), path.dirname(defaultsPath), projectRoot, namespace);
|
|
30
|
+
const workflowCustomization = readWorkflowCustomization(configSource(projectRoot), skillRoot, projectRoot, 'bmad-tea-automate', {
|
|
31
|
+
table: mode === 'red' ? 'red' : undefined,
|
|
32
|
+
});
|
|
37
33
|
if (!workflowCustomization || typeof workflowCustomization !== 'object' || Array.isArray(workflowCustomization))
|
|
38
34
|
throw new Error('selected workflow customization must contain a workflow table');
|
|
39
35
|
const settings = { ...HEALING_DEFAULTS };
|
|
@@ -60,7 +60,6 @@ function protectResultPath(request, resultPath, state = request.before?.data) {
|
|
|
60
60
|
'jsconfig.json',
|
|
61
61
|
request.config.configPath,
|
|
62
62
|
'_bmad/config.toml',
|
|
63
|
-
'_bmad/config.user.toml',
|
|
64
63
|
'_bmad/custom/config.toml',
|
|
65
64
|
'_bmad/custom/config.user.toml',
|
|
66
65
|
];
|
|
@@ -607,7 +606,7 @@ function prepareSetup({ projectRoot, skillRoot, config, options }) {
|
|
|
607
606
|
throw problem('Resume has an uncertain started hook. Record explicit operator recovery in the journal before headless execution.');
|
|
608
607
|
const scope = options.operation === 'resume' ? before.data.setup_scope : options.scope;
|
|
609
608
|
const ciConfig = ['ci', 'both'].includes(scope)
|
|
610
|
-
? resolveTeaConfig({ projectRoot, skillRoot
|
|
609
|
+
? resolveTeaConfig({ projectRoot, skillRoot, skillName: 'bmad-tea-framework', workflowTable: 'ci' })
|
|
611
610
|
: null;
|
|
612
611
|
const requiredHooks = {};
|
|
613
612
|
for (const [phase, settings] of [
|
package/cli/lib/parse-report.js
CHANGED
|
@@ -1586,7 +1586,7 @@ function normalizeReportScore(reportText, parsed) {
|
|
|
1586
1586
|
* @throws {Error} With code REPORT_UNPARSEABLE on any missing/invalid element.
|
|
1587
1587
|
*/
|
|
1588
1588
|
function parseReport(reportText, runContract = {}) {
|
|
1589
|
-
const text = stripFencedCodeBlocks(reportText);
|
|
1589
|
+
const text = stripFencedCodeBlocks(reportText.replace(/^\uFEFF/, ''));
|
|
1590
1590
|
|
|
1591
1591
|
parseFrontmatter(text);
|
|
1592
1592
|
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
* Precedence, highest first:
|
|
10
10
|
* 1. An explicit CLI flag (--use-playwright-utils / --no-use-pactjs-utils / ...)
|
|
11
11
|
* 2. The consuming project's `[modules.tea]` table, merged from
|
|
12
|
-
* _bmad/config.toml, _bmad/
|
|
13
|
-
* _bmad/custom/config.user.toml (later files win),
|
|
14
|
-
* writes it.
|
|
15
|
-
* _bmad/
|
|
12
|
+
* _bmad/config.toml, _bmad/custom/config.toml and
|
|
13
|
+
* _bmad/custom/config.user.toml (later files win), the three files
|
|
14
|
+
* BMad core merges, as `bmad setup tea` writes it. Each layer counts when its file exists, so custom
|
|
15
|
+
* layers apply even where the installer-owned _bmad/config.toml is not committed. Only when none of the
|
|
16
|
+
* three exists is a v6 _bmad/tea/config.yaml read instead, so older installs keep working in CI.
|
|
16
17
|
* 3. The module default declared in skills/bmod-tea/bmod.toml
|
|
17
18
|
*
|
|
18
19
|
* Step 01 of the workflow branches on these keys (Playwright Utils loading
|
|
@@ -32,15 +33,62 @@ const TOML = require('smol-toml');
|
|
|
32
33
|
const { minimatch } = require('minimatch');
|
|
33
34
|
const { globSync } = require('glob');
|
|
34
35
|
|
|
35
|
-
/** The central config layers, lowest precedence first.
|
|
36
|
+
/** The central config layers, lowest precedence first, the three files BMad core merges. Each applies when its file exists. */
|
|
36
37
|
const CONFIG_LAYER_RELATIVE_PATHS = [
|
|
37
38
|
path.join('_bmad', 'config.toml'),
|
|
38
|
-
path.join('_bmad', 'config.user.toml'),
|
|
39
39
|
path.join('_bmad', 'custom', 'config.toml'),
|
|
40
40
|
path.join('_bmad', 'custom', 'config.user.toml'),
|
|
41
41
|
];
|
|
42
42
|
const CONFIG_RELATIVE_PATH = CONFIG_LAYER_RELATIVE_PATHS[0];
|
|
43
43
|
const LEGACY_CONFIG_RELATIVE_PATH = path.join('_bmad', 'tea', 'config.yaml');
|
|
44
|
+
/** A pre-v7 personal layer BMad core no longer merges. TEA warns about keys only it holds and reads none of them. */
|
|
45
|
+
const LEGACY_USER_CONFIG_RELATIVE_PATH = path.join('_bmad', 'config.user.toml');
|
|
46
|
+
const warnedLegacyUserConfig = new Set();
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Tell the user once per process that `[modules.tea]` keys in the legacy personal layer are ignored.
|
|
50
|
+
*
|
|
51
|
+
* The old core order was config.toml, config.user.toml, custom/config.toml, custom/config.user.toml
|
|
52
|
+
* (later wins), so the legacy file outranked only `_bmad/config.toml`. A legacy key lost its effect
|
|
53
|
+
* when neither custom layer holds it. When `_bmad/config.toml` holds the same value, nothing
|
|
54
|
+
* changed and the key stays quiet; a different value there is shown next to the legacy one.
|
|
55
|
+
*
|
|
56
|
+
* @param {object} source - Working-tree or pinned-base configuration reader.
|
|
57
|
+
* @param {{label: string, tea: object}[]} layers - The central layers in merge order, each with its own `[modules.tea]` table.
|
|
58
|
+
*/
|
|
59
|
+
function warnLegacyUserConfig(source, layers) {
|
|
60
|
+
const content = source.read(LEGACY_USER_CONFIG_RELATIVE_PATH);
|
|
61
|
+
if (content === null) return;
|
|
62
|
+
const label = source.label(LEGACY_USER_CONFIG_RELATIVE_PATH);
|
|
63
|
+
if (warnedLegacyUserConfig.has(label)) return;
|
|
64
|
+
let legacyTea;
|
|
65
|
+
try {
|
|
66
|
+
legacyTea = TOML.parse(content).modules?.tea;
|
|
67
|
+
} catch {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (!isPlainObject(legacyTea)) return;
|
|
71
|
+
const [base, ...custom] = layers;
|
|
72
|
+
const ignored = [];
|
|
73
|
+
const shadowed = [];
|
|
74
|
+
for (const [key, value] of Object.entries(legacyTea)) {
|
|
75
|
+
if (custom.some((layer) => Object.hasOwn(layer.tea, key))) continue;
|
|
76
|
+
if (!Object.hasOwn(base.tea, key)) {
|
|
77
|
+
ignored.push(key);
|
|
78
|
+
} else if (JSON.stringify(base.tea[key]) !== JSON.stringify(value)) {
|
|
79
|
+
ignored.push(key);
|
|
80
|
+
shadowed.push(
|
|
81
|
+
`${key} is ${JSON.stringify(value)} in ${label} and ${JSON.stringify(base.tea[key])} in ${base.label}, which TEA uses.`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (ignored.length === 0) return;
|
|
86
|
+
warnedLegacyUserConfig.add(label);
|
|
87
|
+
const detail = shadowed.length === 0 ? '' : ` ${shadowed.join(' ')}`;
|
|
88
|
+
process.stderr.write(
|
|
89
|
+
`Warning: ${label} is no longer merged. TEA ignores its [modules.tea] keys (${ignored.join(', ')}).${detail} Run \`bmad migrate tea\` to move them into _bmad/custom/config.user.toml.\n`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
44
92
|
|
|
45
93
|
const MODULE_DEFAULTS = {
|
|
46
94
|
tea_use_playwright_utils: true,
|
|
@@ -284,8 +332,38 @@ function parseToml(content, label) {
|
|
|
284
332
|
}
|
|
285
333
|
}
|
|
286
334
|
|
|
287
|
-
/**
|
|
288
|
-
|
|
335
|
+
/** Customization surfaces that live as `[workflow.<name>]` tables of the owning skill, and the stems they used to have. */
|
|
336
|
+
const SURFACE_TABLES = {
|
|
337
|
+
'bmad-tea-automate': { table: 'red', retiredStems: ['bmad-tea-atdd', 'bmad-testarch-atdd'] },
|
|
338
|
+
'bmad-tea-framework': { table: 'ci', retiredStems: ['bmad-tea-ci', 'bmad-testarch-ci'] },
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
/** Stop on settings the new layout never reads, so a migration is never skipped silently. */
|
|
342
|
+
function assertNoRetiredSurface(source, skillName, workflow) {
|
|
343
|
+
const surface = SURFACE_TABLES[skillName];
|
|
344
|
+
if (!surface) return;
|
|
345
|
+
for (const stem of surface.retiredStems) {
|
|
346
|
+
for (const suffix of ['.toml', '.user.toml']) {
|
|
347
|
+
const file = path.join('_bmad', 'custom', stem + suffix);
|
|
348
|
+
if (source.read(file) !== null) {
|
|
349
|
+
throw configError(
|
|
350
|
+
`${source.label(file)} is no longer read; its settings now live under [workflow.${surface.table}] in ${skillName}.toml and ${skillName}.user.toml. Run: npx --package=bmad-method-test-architecture-enterprise@4 tea-migrate-customizations --project-root <project>`,
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (skillName === 'bmad-tea-framework' && workflow && Object.hasOwn(workflow, 'ci_platform')) {
|
|
356
|
+
throw configError(
|
|
357
|
+
'workflow.ci_platform in bmad-tea-framework.toml or .user.toml is no longer read; set ci_platform under [workflow.ci]. Run: npx --package=bmad-method-test-architecture-enterprise@4 tea-migrate-customizations --project-root <project>',
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Resolve trusted skill defaults and project workflow overrides from the same configuration source.
|
|
364
|
+
* `table` selects a `[workflow.<table>]` surface of the skill (red, ci); without it the surface tables are left out.
|
|
365
|
+
*/
|
|
366
|
+
function readWorkflowCustomization(source, skillRoot, projectRoot, skillName = 'bmad-tea-test-review', { table } = {}) {
|
|
289
367
|
if (!skillRoot) return {};
|
|
290
368
|
const defaultsPath = path.join(skillRoot, 'customize.toml');
|
|
291
369
|
source.recordInput?.(defaultsPath);
|
|
@@ -318,7 +396,17 @@ function readWorkflowCustomization(source, skillRoot, projectRoot, skillName = '
|
|
|
318
396
|
if (merged.workflow !== undefined && !isPlainObject(merged.workflow)) {
|
|
319
397
|
throw configError('Workflow customization must contain a [workflow] table');
|
|
320
398
|
}
|
|
321
|
-
|
|
399
|
+
assertNoRetiredSurface(source, skillName, merged.workflow);
|
|
400
|
+
const surfaces = new Set(Object.values(SURFACE_TABLES).map((surface) => surface.table));
|
|
401
|
+
let workflow = merged.workflow || {};
|
|
402
|
+
if (table === undefined) {
|
|
403
|
+
workflow = Object.fromEntries(Object.entries(workflow).filter(([key]) => !surfaces.has(key) || !isPlainObject(workflow[key])));
|
|
404
|
+
} else {
|
|
405
|
+
if (!surfaces.has(table)) throw configError(`Unknown workflow surface ${table}`);
|
|
406
|
+
const selected = workflow[table];
|
|
407
|
+
if (selected !== undefined && !isPlainObject(selected)) throw configError(`workflow.${table} must be a table`);
|
|
408
|
+
workflow = selected || {};
|
|
409
|
+
}
|
|
322
410
|
if (workflow.persistent_facts !== undefined) {
|
|
323
411
|
if (!Array.isArray(workflow.persistent_facts) || !workflow.persistent_facts.every((fact) => typeof fact === 'string')) {
|
|
324
412
|
throw configError('Workflow persistent_facts must be an array of strings');
|
|
@@ -364,28 +452,38 @@ function unionEqualCustomizationValues(legacy, current) {
|
|
|
364
452
|
return result;
|
|
365
453
|
}
|
|
366
454
|
|
|
367
|
-
/**
|
|
455
|
+
/**
|
|
456
|
+
* Coerce the keys this CLI cares about out of a raw TEA config table.
|
|
457
|
+
*
|
|
458
|
+
* @param {object} table - Raw `[modules.tea]` keys.
|
|
459
|
+
* @param {string|Record<string, string>} source - One label for every key, or the label of the file that supplied each key.
|
|
460
|
+
*/
|
|
368
461
|
function pickTeaValues(table, source) {
|
|
462
|
+
const labelOf = (key) => (typeof source === 'string' ? source : (source[key] ?? 'the configuration'));
|
|
369
463
|
const values = {};
|
|
370
464
|
if ('tea_use_playwright_utils' in table) {
|
|
371
|
-
values.tea_use_playwright_utils = coerceBoolean(
|
|
465
|
+
values.tea_use_playwright_utils = coerceBoolean(
|
|
466
|
+
table.tea_use_playwright_utils,
|
|
467
|
+
'tea_use_playwright_utils',
|
|
468
|
+
labelOf('tea_use_playwright_utils'),
|
|
469
|
+
);
|
|
372
470
|
}
|
|
373
471
|
if ('tea_use_pactjs_utils' in table) {
|
|
374
|
-
values.tea_use_pactjs_utils = coerceBoolean(table.tea_use_pactjs_utils, 'tea_use_pactjs_utils',
|
|
472
|
+
values.tea_use_pactjs_utils = coerceBoolean(table.tea_use_pactjs_utils, 'tea_use_pactjs_utils', labelOf('tea_use_pactjs_utils'));
|
|
375
473
|
}
|
|
376
474
|
if ('tea_pact_mcp' in table) {
|
|
377
|
-
values.tea_pact_mcp = coercePactMcp(table.tea_pact_mcp,
|
|
475
|
+
values.tea_pact_mcp = coercePactMcp(table.tea_pact_mcp, labelOf('tea_pact_mcp'));
|
|
378
476
|
}
|
|
379
477
|
if ('tea_execution_mode' in table) {
|
|
380
|
-
values.tea_execution_mode = coerceExecutionMode(table.tea_execution_mode,
|
|
478
|
+
values.tea_execution_mode = coerceExecutionMode(table.tea_execution_mode, labelOf('tea_execution_mode'));
|
|
381
479
|
}
|
|
382
480
|
if ('tea_capability_probe' in table) {
|
|
383
|
-
values.tea_capability_probe = coerceBoolean(table.tea_capability_probe, 'tea_capability_probe',
|
|
481
|
+
values.tea_capability_probe = coerceBoolean(table.tea_capability_probe, 'tea_capability_probe', labelOf('tea_capability_probe'));
|
|
384
482
|
}
|
|
385
483
|
if ('test_stack_type' in table) {
|
|
386
484
|
const stack = typeof table.test_stack_type === 'string' ? table.test_stack_type.trim().toLowerCase() : '';
|
|
387
485
|
if (!['auto', 'frontend', 'backend', 'fullstack', 'mobile'].includes(stack)) {
|
|
388
|
-
throw configError(`test_stack_type in ${
|
|
486
|
+
throw configError(`test_stack_type in ${labelOf('test_stack_type')} must be auto, frontend, backend, fullstack or mobile`);
|
|
389
487
|
}
|
|
390
488
|
values.test_stack_type = stack;
|
|
391
489
|
}
|
|
@@ -394,30 +492,47 @@ function pickTeaValues(table, source) {
|
|
|
394
492
|
|
|
395
493
|
/**
|
|
396
494
|
* Merge the central TOML layers and return their core and TEA tables.
|
|
495
|
+
* Each layer is shape-checked before the merge, and every `[modules.tea]` key
|
|
496
|
+
* remembers the file that supplied its final value, so errors name that file.
|
|
397
497
|
*
|
|
398
498
|
* @param {object} source - Working-tree or pinned-base configuration reader.
|
|
399
|
-
* @returns {{core: object, tea: object}}
|
|
499
|
+
* @returns {{core: object, tea: object, teaSources: Record<string, string>, found: string[]}}
|
|
500
|
+
* `found` lists the labels of the layer files that exist.
|
|
400
501
|
*/
|
|
401
502
|
function readCentralConfig(source) {
|
|
402
503
|
let merged = {};
|
|
504
|
+
const layers = [];
|
|
505
|
+
const found = [];
|
|
506
|
+
const teaSources = {};
|
|
403
507
|
for (const relativePath of CONFIG_LAYER_RELATIVE_PATHS) {
|
|
508
|
+
const label = source.label(relativePath);
|
|
404
509
|
const content = source.read(relativePath);
|
|
405
|
-
if (content === null)
|
|
406
|
-
|
|
510
|
+
if (content === null) {
|
|
511
|
+
layers.push({ label, tea: {} });
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
found.push(label);
|
|
515
|
+
const parsed = parseToml(content, label);
|
|
516
|
+
const { modules, core } = parsed;
|
|
517
|
+
if (modules !== undefined && !isPlainObject(modules)) {
|
|
518
|
+
throw configError(`[modules] in ${label} must be a table`);
|
|
519
|
+
}
|
|
520
|
+
if (modules?.tea !== undefined && !isPlainObject(modules.tea)) {
|
|
521
|
+
throw configError(`[modules.tea] in ${label} must be a table of config keys`);
|
|
522
|
+
}
|
|
523
|
+
if (core !== undefined && !isPlainObject(core)) {
|
|
524
|
+
throw configError(`[core] in ${label} must be a table of config keys`);
|
|
525
|
+
}
|
|
526
|
+
layers.push({ label, tea: modules?.tea || {} });
|
|
527
|
+
for (const key of Object.keys(modules?.tea || {})) teaSources[key] = label;
|
|
407
528
|
merged = mergeTables(merged, parsed);
|
|
408
529
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
throw configError(`[modules.tea] in ${source.label(CONFIG_RELATIVE_PATH)} must be a table of config keys`);
|
|
412
|
-
}
|
|
413
|
-
if (merged.core !== undefined && !isPlainObject(merged.core)) {
|
|
414
|
-
throw configError(`[core] in ${source.label(CONFIG_RELATIVE_PATH)} must be a table of config keys`);
|
|
415
|
-
}
|
|
416
|
-
return { core: merged.core || {}, tea: modules?.tea || {} };
|
|
530
|
+
warnLegacyUserConfig(source, layers);
|
|
531
|
+
return { core: merged.core || {}, tea: merged.modules?.tea || {}, teaSources, found };
|
|
417
532
|
}
|
|
418
533
|
|
|
419
534
|
/**
|
|
420
|
-
* Read a v6 _bmad/tea/config.yaml, used only when
|
|
535
|
+
* Read a v6 _bmad/tea/config.yaml, used only when none of the central TOML layers exists.
|
|
421
536
|
*
|
|
422
537
|
* @param {string} configPath
|
|
423
538
|
* @param {string} content
|
|
@@ -446,17 +561,20 @@ function readLegacyTeaTable(configPath, content) {
|
|
|
446
561
|
*
|
|
447
562
|
* @param {string} projectRoot - Consuming project root.
|
|
448
563
|
* @param {string} [baseRef] - Base commit or ref; omitted for working-tree config.
|
|
449
|
-
* @returns {{present: boolean, path: string, format: 'toml'|'yaml'|null, values: object}}
|
|
564
|
+
* @returns {{present: boolean, path: string, paths: string[], format: 'toml'|'yaml'|null, values: object}}
|
|
565
|
+
* Present when any of the three central layers exists. `paths` lists the files read; `path` is the base
|
|
566
|
+
* file when it exists, else the first layer found, else the base file's expected location.
|
|
450
567
|
*/
|
|
451
568
|
function readTeaConfigFile(projectRoot, baseRef, source = configSource(projectRoot, baseRef)) {
|
|
452
569
|
const centralPath = source.label(CONFIG_RELATIVE_PATH);
|
|
453
|
-
|
|
454
|
-
|
|
570
|
+
const config = readCentralConfig(source);
|
|
571
|
+
if (config.found.length > 0) {
|
|
455
572
|
return {
|
|
456
573
|
present: true,
|
|
457
|
-
path: centralPath,
|
|
574
|
+
path: config.found.includes(centralPath) ? centralPath : config.found[0],
|
|
575
|
+
paths: config.found,
|
|
458
576
|
format: 'toml',
|
|
459
|
-
values: pickTeaValues(config.tea,
|
|
577
|
+
values: pickTeaValues(config.tea, config.teaSources),
|
|
460
578
|
core: config.core,
|
|
461
579
|
tea: config.tea,
|
|
462
580
|
};
|
|
@@ -470,9 +588,17 @@ function readTeaConfigFile(projectRoot, baseRef, source = configSource(projectRo
|
|
|
470
588
|
.filter((key) => key in table)
|
|
471
589
|
.map((key) => [key, table[key]]),
|
|
472
590
|
);
|
|
473
|
-
return {
|
|
591
|
+
return {
|
|
592
|
+
present: true,
|
|
593
|
+
path: legacyPath,
|
|
594
|
+
paths: [legacyPath],
|
|
595
|
+
format: 'yaml',
|
|
596
|
+
values: pickTeaValues(table, legacyPath),
|
|
597
|
+
core,
|
|
598
|
+
tea: table,
|
|
599
|
+
};
|
|
474
600
|
}
|
|
475
|
-
return { present: false, path: centralPath, format: null, values: {}, core: {}, tea: {} };
|
|
601
|
+
return { present: false, path: centralPath, paths: [], format: null, values: {}, core: {}, tea: {} };
|
|
476
602
|
}
|
|
477
603
|
|
|
478
604
|
/**
|
|
@@ -530,20 +656,21 @@ const KEY_TO_INSTALLED_FIELD = {
|
|
|
530
656
|
* @param {string} options.projectRoot - Consuming project root.
|
|
531
657
|
* @param {string} [options.baseRef] - Configuration source ref, pinned before any file read.
|
|
532
658
|
* @param {string} [options.skillRoot] - Trusted skill defaults for workflow customization.
|
|
659
|
+
* @param {string} [options.workflowTable] - `[workflow.<table>]` surface to return (red, ci) in place of the skill's own workflow table.
|
|
533
660
|
* @param {object} [options.flags] - Parsed CLI options; only the keys in
|
|
534
661
|
* FLAG_TO_KEY are read, and only when not undefined.
|
|
535
662
|
* @param {Set<string>} [options.inputPaths] - Receives working-tree inputs, including missing optional layers.
|
|
536
663
|
* @param {Map<string, string[]>} [options.inputPatterns] - Receives policy glob membership used during resolution.
|
|
537
|
-
* @returns {{values: object, sources: object, installed: object, configSnapshot: object, workflowCustomization: object, configCommit: string|null, configPath: string, configPresent: boolean, configFormat: string|null}}
|
|
664
|
+
* @returns {{values: object, sources: object, installed: object, configSnapshot: object, workflowCustomization: object, configCommit: string|null, configPath: string, configPaths: string[], configPresent: boolean, configFormat: string|null}}
|
|
538
665
|
* `installed` carries one boolean per library gate, read from the project
|
|
539
666
|
* manifest rather than left to the agent.
|
|
540
667
|
* @throws {Error} With code TEA_CONFIG_INVALID on unusable config content.
|
|
541
668
|
*/
|
|
542
|
-
function resolveTeaConfig({ projectRoot, flags = {}, baseRef, skillRoot, skillName, inputPaths, inputPatterns }) {
|
|
669
|
+
function resolveTeaConfig({ projectRoot, flags = {}, baseRef, skillRoot, skillName, workflowTable, inputPaths, inputPatterns }) {
|
|
543
670
|
const source = configSource(projectRoot, baseRef, inputPaths, inputPatterns);
|
|
544
671
|
inputPaths?.add(path.join(projectRoot, 'package.json'));
|
|
545
672
|
const file = readTeaConfigFile(projectRoot, baseRef, source);
|
|
546
|
-
const workflowCustomization = readWorkflowCustomization(source, skillRoot, projectRoot, skillName);
|
|
673
|
+
const workflowCustomization = readWorkflowCustomization(source, skillRoot, projectRoot, skillName, { table: workflowTable });
|
|
547
674
|
|
|
548
675
|
const values = {};
|
|
549
676
|
const sources = {};
|
|
@@ -590,6 +717,7 @@ function resolveTeaConfig({ projectRoot, flags = {}, baseRef, skillRoot, skillNa
|
|
|
590
717
|
workflowCustomization,
|
|
591
718
|
configCommit: source.commit ?? null,
|
|
592
719
|
configPath: file.path,
|
|
720
|
+
configPaths: file.paths,
|
|
593
721
|
configPresent: file.present,
|
|
594
722
|
configFormat: file.format,
|
|
595
723
|
};
|
|
@@ -610,5 +738,6 @@ module.exports = {
|
|
|
610
738
|
CONFIG_RELATIVE_PATH,
|
|
611
739
|
CONFIG_LAYER_RELATIVE_PATHS,
|
|
612
740
|
LEGACY_CONFIG_RELATIVE_PATH,
|
|
741
|
+
LEGACY_USER_CONFIG_RELATIVE_PATH,
|
|
613
742
|
FLAG_TO_KEY,
|
|
614
743
|
};
|
package/cli/lib/trace-command.js
CHANGED
|
@@ -1310,7 +1310,7 @@ function validateTraceOutputs({
|
|
|
1310
1310
|
) {
|
|
1311
1311
|
throw new Error(`Trace coverage ${name} has invalid counts.`);
|
|
1312
1312
|
}
|
|
1313
|
-
const expected = bucket.total === 0 ? 100 : Math.
|
|
1313
|
+
const expected = bucket.total === 0 ? 100 : Math.floor((bucket.covered * 100) / bucket.total);
|
|
1314
1314
|
if (bucket.pct !== expected) throw new Error(`Trace coverage ${name} percentage does not match its counts.`);
|
|
1315
1315
|
}
|
|
1316
1316
|
const priorities = ['P0', 'P1', 'P2', 'P3'].map((key) => summary.coverage.priority_breakdown[key]);
|
|
@@ -1415,21 +1415,27 @@ function validateTraceOutputs({
|
|
|
1415
1415
|
const p0 = summary.coverage.priority_breakdown.P0.pct;
|
|
1416
1416
|
const p1 = summary.coverage.priority_breakdown.P1.pct;
|
|
1417
1417
|
const overall = summary.coverage.inventory.pct;
|
|
1418
|
+
// Displayed percentages round down, so they reach a whole-number threshold exactly when the counts do; decisions compare the source counts.
|
|
1419
|
+
const meets = (bucket, threshold) => bucket.total === 0 || bucket.covered * 100 >= threshold * bucket.total;
|
|
1420
|
+
const p0Met = meets(summary.coverage.priority_breakdown.P0, 100);
|
|
1421
|
+
const p1TargetMet = meets(summary.coverage.priority_breakdown.P1, 90);
|
|
1422
|
+
const p1MinimumMet = meets(summary.coverage.priority_breakdown.P1, 80);
|
|
1423
|
+
const overallMet = meets(summary.coverage.inventory, 80);
|
|
1418
1424
|
const expectedCriteria = {
|
|
1419
1425
|
p0_coverage_required: '100%',
|
|
1420
1426
|
p0_coverage_actual: `${p0}%`,
|
|
1421
|
-
p0_status:
|
|
1427
|
+
p0_status: p0Met ? 'MET' : 'NOT_MET',
|
|
1422
1428
|
p1_coverage_target: '90%',
|
|
1423
1429
|
p1_coverage_minimum: '80%',
|
|
1424
1430
|
p1_coverage_actual: `${p1}%`,
|
|
1425
|
-
p1_status:
|
|
1431
|
+
p1_status: p1TargetMet ? 'MET' : p1MinimumMet ? 'PARTIAL' : 'NOT_MET',
|
|
1426
1432
|
overall_coverage_minimum: '80%',
|
|
1427
1433
|
overall_coverage_actual: `${overall}%`,
|
|
1428
|
-
overall_status:
|
|
1434
|
+
overall_status: overallMet ? 'MET' : 'NOT_MET',
|
|
1429
1435
|
};
|
|
1430
1436
|
for (const [field, expected] of Object.entries(expectedCriteria))
|
|
1431
1437
|
if (criteria[field] !== expected) throw new Error(`Trace gate ${field} contradicts the coverage inventory or Step 5 thresholds.`);
|
|
1432
|
-
let expectedStatus =
|
|
1438
|
+
let expectedStatus = !p0Met || !overallMet || !p1MinimumMet ? 'FAIL' : p1TargetMet ? 'PASS' : 'CONCERNS';
|
|
1433
1439
|
const liveOnly = summary.live_evidence.requirements_live_only;
|
|
1434
1440
|
if (!Number.isInteger(liveOnly) || liveOnly < 0) throw new Error('Trace summary has invalid live-only coverage metadata.');
|
|
1435
1441
|
const synthetic = summary.oracle.synthetic || ['synthetic_requirements', 'user_journeys'].includes(summary.inventory_basis);
|
|
@@ -1440,6 +1446,8 @@ function validateTraceOutputs({
|
|
|
1440
1446
|
frozenLive?.freshFailed ?? summary.live_evidence.fresh_failed ?? (summary.live_evidence.freshness === 'fresh' ? liveFailed : 0);
|
|
1441
1447
|
if (freshFailed !== undefined && (!Number.isInteger(freshFailed) || freshFailed < 0))
|
|
1442
1448
|
throw new Error('Trace live evidence has invalid fresh_failed count.');
|
|
1449
|
+
if (!frozenLive && summary.live_evidence.freshness === 'fresh' && freshFailed !== liveFailed)
|
|
1450
|
+
throw new Error('Trace fresh live evidence fresh_failed contradicts its failed count.');
|
|
1443
1451
|
const freshFailure = freshFailed > 0;
|
|
1444
1452
|
if (expectedStatus === 'PASS' && ((synthetic && summary.confidence !== 'high') || liveOnly > 0 || freshFailure))
|
|
1445
1453
|
expectedStatus = 'CONCERNS';
|