bmad-plus 0.12.1 → 0.13.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 +637 -580
- package/README.md +123 -120
- package/osint-agent-package/agents/osint-investigator.md +12 -0
- package/osint-agent-package/skills/bmad-osint-investigate/osint/SKILL.md +491 -482
- package/osint-agent-package/skills/bmad-osint-investigate/osint/assets/dossier-template.md +126 -126
- package/osint-agent-package/skills/bmad-osint-investigate/osint/assets/lawful-basis-record.md +48 -48
- package/osint-agent-package/skills/bmad-osint-investigate/osint/references/content-extraction.md +100 -100
- package/osint-agent-package/skills/bmad-osint-investigate/osint/references/gdpr-osint.md +48 -48
- package/osint-agent-package/skills/bmad-osint-investigate/osint/references/platforms.md +130 -130
- package/osint-agent-package/skills/bmad-osint-investigate/osint/references/psychoprofile.md +69 -69
- package/osint-agent-package/skills/bmad-osint-investigate/osint/references/tools.md +281 -281
- package/osint-agent-package/skills/bmad-osint-investigate/osint/scripts/mcp-client.py +136 -136
- package/package.json +106 -91
- package/readme-international/README.de.md +625 -594
- package/readme-international/README.es.md +642 -611
- package/readme-international/README.fr.md +640 -609
- package/src/bmad-plus/agents/agent-orchestrator/SKILL.md +2 -0
- package/src/bmad-plus/agents/agent-shadow/SKILL.md +18 -0
- package/src/bmad-plus/data/role-triggers.yaml +52 -0
- package/src/bmad-plus/module.yaml +333 -283
- package/src/bmad-plus/packs/pack-animated/animated-website-agent.md +325 -325
- package/src/bmad-plus/packs/pack-animated/templates/animated-website-workflow.md +55 -55
- package/src/bmad-plus/packs/pack-backup/backup-agent.md +71 -71
- package/src/bmad-plus/packs/pack-backup/templates/backup-workflow.md +51 -51
- package/src/bmad-plus/packs/pack-dev-studio/README.md +162 -162
- package/src/bmad-plus/packs/pack-dev-studio/categories/analysis/analyst-agent.md +73 -73
- package/src/bmad-plus/packs/pack-dev-studio/categories/analysis/document-project.md +61 -61
- package/src/bmad-plus/packs/pack-dev-studio/categories/analysis/domain-research.md +95 -95
- package/src/bmad-plus/packs/pack-dev-studio/categories/analysis/market-research.md +95 -95
- package/src/bmad-plus/packs/pack-dev-studio/categories/analysis/prfaq.md +134 -134
- package/src/bmad-plus/packs/pack-dev-studio/categories/analysis/product-brief.md +80 -80
- package/src/bmad-plus/packs/pack-dev-studio/categories/analysis/tech-writer-agent.md +73 -73
- package/src/bmad-plus/packs/pack-dev-studio/categories/analysis/technical-research.md +95 -95
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/architect-agent.md +73 -73
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/create-architecture.md +73 -73
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/create-epics-stories.md +92 -92
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/generate-project-context.md +80 -80
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/implementation-readiness.md +90 -90
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-01-init.md +153 -153
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-01b-continue.md +173 -173
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-02-context.md +224 -224
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-03-starter.md +329 -329
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-04-decisions.md +318 -318
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-05-patterns.md +359 -359
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-06-structure.md +379 -379
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-07-validation.md +361 -361
- package/src/bmad-plus/packs/pack-dev-studio/categories/architecture/steps/step-08-complete.md +81 -81
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/checkpoint-preview.md +67 -67
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/code-review-steps/step-01-gather-context.md +85 -85
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/code-review-steps/step-02-review.md +35 -35
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/code-review-steps/step-03-triage.md +49 -49
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/code-review-steps/step-04-present.md +131 -131
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/code-review.md +89 -89
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/correct-course.md +300 -300
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/create-story.md +428 -428
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/dev-agent.md +73 -73
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/dev-story-checklist.md +80 -80
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/dev-story.md +484 -484
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/investigate.md +193 -193
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/qa-e2e-tests.md +175 -175
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/quick-dev.md +110 -110
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/retrospective.md +1511 -1511
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/sprint-planning.md +298 -298
- package/src/bmad-plus/packs/pack-dev-studio/categories/implementation/sprint-status.md +296 -296
- package/src/bmad-plus/packs/pack-dev-studio/categories/planning/create-prd.md +29 -29
- package/src/bmad-plus/packs/pack-dev-studio/categories/planning/create-ux-design.md +74 -74
- package/src/bmad-plus/packs/pack-dev-studio/categories/planning/edit-prd.md +29 -29
- package/src/bmad-plus/packs/pack-dev-studio/categories/planning/pm-agent.md +73 -73
- package/src/bmad-plus/packs/pack-dev-studio/categories/planning/prd.md +89 -89
- package/src/bmad-plus/packs/pack-dev-studio/categories/planning/ux-designer-agent.md +73 -73
- package/src/bmad-plus/packs/pack-dev-studio/categories/planning/validate-prd.md +29 -29
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/advanced-elicitation.md +141 -141
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/adversarial-review.md +37 -37
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/bmad-help.md +75 -75
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/brainstorming.md +6 -6
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/customize.md +110 -110
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/distillator.md +176 -176
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/edge-case-hunter.md +67 -67
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/editorial-review-prose.md +86 -86
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/editorial-review-structure.md +179 -179
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/index-docs.md +66 -66
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/party-mode.md +127 -127
- package/src/bmad-plus/packs/pack-dev-studio/categories/utilities/shard-doc.md +105 -105
- package/src/bmad-plus/packs/pack-dev-studio/dev-studio-orchestrator.md +120 -120
- package/src/bmad-plus/packs/pack-dev-studio/shared/architecture-decision-template.md +12 -12
- package/src/bmad-plus/packs/pack-dev-studio/shared/bwml-spec.md +328 -328
- package/src/bmad-plus/packs/pack-dev-studio/shared/module-help.csv +32 -32
- package/src/bmad-plus/packs/pack-dev-studio/upstream-sync.yaml +81 -81
- package/src/bmad-plus/packs/pack-seo/SKILL.md +171 -171
- package/src/bmad-plus/packs/pack-seo/checklist.md +140 -140
- package/src/bmad-plus/packs/pack-seo/pagespeed-playbook.md +320 -320
- package/src/bmad-plus/packs/pack-seo/ref/audit-schema.json +187 -187
- package/src/bmad-plus/packs/pack-seo/ref/cwv-thresholds.md +87 -87
- package/src/bmad-plus/packs/pack-seo/ref/eeat-criteria.md +123 -123
- package/src/bmad-plus/packs/pack-seo/ref/geo-signals.md +167 -167
- package/src/bmad-plus/packs/pack-seo/ref/hreflang-rules.md +153 -153
- package/src/bmad-plus/packs/pack-seo/ref/quality-gates.md +133 -133
- package/src/bmad-plus/packs/pack-seo/ref/schema-catalog.md +91 -91
- package/src/bmad-plus/packs/pack-seo/ref/schema-templates.json +356 -356
- package/src/bmad-plus/packs/pack-seo/requirements.txt +17 -0
- package/src/bmad-plus/packs/pack-seo/scripts/seo_apis.py +456 -0
- package/src/bmad-plus/packs/pack-seo/scripts/seo_crawl.py +359 -0
- package/src/bmad-plus/packs/pack-seo/scripts/seo_fetch.py +303 -0
- package/src/bmad-plus/packs/pack-seo/scripts/seo_parse.py +255 -0
- package/src/bmad-plus/packs/pack-seo/scripts/seo_report.py +409 -0
- package/src/bmad-plus/packs/pack-seo/scripts/seo_screenshot.py +202 -0
- package/src/bmad-plus/packs/pack-seo/seo-chief.md +294 -294
- package/src/bmad-plus/packs/pack-seo/seo-judge.md +241 -241
- package/src/bmad-plus/packs/pack-seo/seo-scout.md +171 -171
- package/src/bmad-plus/packs/pack-seo/templates/seo-audit-workflow.md +241 -241
- package/src/bmad-plus/packs/pack-shield/README.md +6 -6
- package/src/bmad-plus/packs/pack-shield/SKILL.md +2 -2
- package/src/bmad-plus/packs/pack-shield/categories/accessibility-esg/csrd-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/accessibility-esg/section508-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/accessibility-esg/wcag-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/ai-governance/eu-ai-act-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/ai-governance/iso42001-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/ai-governance/nist-ai-rmf-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/cybersecurity/cis-controls-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/cybersecurity/ism-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/cybersecurity/iso27001-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/cybersecurity/nis2-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/cybersecurity/nist-800-53-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/cybersecurity/nist-csf-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/defense-export/cmmc-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/defense-export/ear-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/defense-export/itar-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/defense-export/tsa-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/industry-compliance/dora-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/industry-compliance/fedramp-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/industry-compliance/hipaa-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/industry-compliance/pci-dss-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/industry-compliance/soc2-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/categories/industry-compliance/swift-csp-agent.md +11 -11
- package/src/bmad-plus/packs/pack-shield/shield-orchestrator.md +1 -1
- package/src/bmad-plus/skills/bmad-plus-autopilot/SKILL.md +1 -1
- package/tools/bmad-plus-npx.js +4 -2
- package/tools/build/adapters.config.js +60 -51
- package/tools/build/check-counts.js +626 -0
- package/tools/build/check-install-contract.js +298 -0
- package/tools/build/generate-adapters.js +252 -56
- package/tools/build/generate.js +187 -10
- package/tools/build/generated-adapters/.codex/AGENTS.md +20 -7
- package/tools/build/generated-adapters/.cursor/rules/bmad-plus.mdc +20 -7
- package/tools/build/generated-adapters/.opencode/AGENTS.md +20 -7
- package/tools/build/generated-adapters/AGENTS.md +20 -7
- package/tools/build/generated-adapters/CLAUDE.md +20 -7
- package/tools/build/generated-adapters/CONVENTIONS.md +20 -7
- package/tools/build/generated-adapters/GEMINI.md +20 -7
- package/tools/build/module.template.yaml +82 -0
- package/tools/cli/bmad-plus-cli.js +16 -1
- package/tools/cli/commands/autoconfig.js +470 -470
- package/tools/cli/commands/doctor.js +205 -233
- package/tools/cli/commands/install.js +543 -501
- package/tools/cli/commands/memory-journal-cmd.js +311 -311
- package/tools/cli/commands/memory.js +195 -195
- package/tools/cli/commands/scan.js +348 -348
- package/tools/cli/commands/uninstall.js +209 -101
- package/tools/cli/commands/update-check.js +31 -0
- package/tools/cli/commands/update-policy.js +39 -0
- package/tools/cli/commands/update.js +123 -134
- package/tools/cli/i18n.js +905 -845
- package/tools/cli/lib/README-memory-journal.md +125 -125
- package/tools/cli/lib/ide-config.js +10 -259
- package/tools/cli/lib/install-manifest.js +17 -0
- package/tools/cli/lib/installed-adapters.js +89 -0
- package/tools/cli/lib/npm-runner.js +177 -0
- package/tools/cli/lib/pack-copy.js +62 -66
- package/tools/cli/lib/packs.js +437 -3
- package/tools/cli/lib/python-provision.js +508 -508
- package/tools/cli/lib/stack-detect.js +102 -102
- package/tools/cli/lib/update-check.js +153 -0
- package/tools/cli/lib/update-dispatch.js +182 -0
- package/tools/cli/lib/update-policy.js +90 -0
- package/tools/cli/lib/update-transaction.js +334 -0
- package/tools/cli/lib/validate.js +50 -50
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Verify that real source and npm-package installs deliver the adapter contract.
|
|
4
|
+
* Uses existing dependencies, temporary projects and an isolated brain; no
|
|
5
|
+
* lifecycle scripts, dependency installation or Python provisioning are run.
|
|
6
|
+
*
|
|
7
|
+
* Run: node tools/build/check-install-contract.js
|
|
8
|
+
* Author: Laurent Rochetta
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const assert = require('node:assert/strict');
|
|
13
|
+
const fs = require('node:fs');
|
|
14
|
+
const os = require('node:os');
|
|
15
|
+
const path = require('node:path');
|
|
16
|
+
const crypto = require('node:crypto');
|
|
17
|
+
const { spawnSync } = require('node:child_process');
|
|
18
|
+
|
|
19
|
+
const REPO_ROOT = path.resolve(__dirname, '..', '..');
|
|
20
|
+
const TEMP_PREFIX = 'bmad-install-contract-';
|
|
21
|
+
|
|
22
|
+
function resolveWithin(root, relative) {
|
|
23
|
+
assert(typeof relative === 'string' && relative.length > 0, 'Expected a relative file path');
|
|
24
|
+
assert(
|
|
25
|
+
!path.win32.isAbsolute(relative) && !path.posix.isAbsolute(relative),
|
|
26
|
+
`Absolute path: ${relative}`
|
|
27
|
+
);
|
|
28
|
+
const target = path.resolve(root, relative);
|
|
29
|
+
const fromRoot = path.relative(root, target);
|
|
30
|
+
assert(
|
|
31
|
+
fromRoot &&
|
|
32
|
+
!path.isAbsolute(fromRoot) &&
|
|
33
|
+
!fromRoot.startsWith(`..${path.sep}`) &&
|
|
34
|
+
fromRoot !== '..',
|
|
35
|
+
`Path escapes project: ${relative}`
|
|
36
|
+
);
|
|
37
|
+
return target;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function sameSelection(actual, expected, label) {
|
|
41
|
+
assert(Array.isArray(actual), `Manifest ${label} must be an array`);
|
|
42
|
+
assert.deepEqual(
|
|
43
|
+
[...actual].sort(),
|
|
44
|
+
[...expected].sort(),
|
|
45
|
+
`Manifest ${label} differs from requested selection`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Compare the installed bytes, normalizing only Windows/Unix line endings. */
|
|
50
|
+
function verifyInstallation(projectDir, { packs, tools, derived, ideConfigs, renderFiles, requireInventory = false }) {
|
|
51
|
+
const manifest = JSON.parse(
|
|
52
|
+
fs.readFileSync(path.join(projectDir, '_bmad', '.bmad-plus-install.json'), 'utf8')
|
|
53
|
+
);
|
|
54
|
+
sameSelection(manifest.packs, packs, 'packs');
|
|
55
|
+
sameSelection(manifest.ides, tools, 'ides');
|
|
56
|
+
assert(typeof manifest.user === 'string' && manifest.user, 'Manifest user is missing');
|
|
57
|
+
assert(
|
|
58
|
+
typeof manifest.language === 'string' && manifest.language,
|
|
59
|
+
'Manifest language is missing'
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const files = renderFiles(derived, {
|
|
63
|
+
packs,
|
|
64
|
+
userName: manifest.user,
|
|
65
|
+
language: manifest.language,
|
|
66
|
+
tools: manifest.ides,
|
|
67
|
+
});
|
|
68
|
+
const expectedPaths = new Set(files.map(({ file }) => file));
|
|
69
|
+
assert.equal(expectedPaths.size, files.length, 'Renderer returned duplicate output paths');
|
|
70
|
+
assert.equal(
|
|
71
|
+
derived.targets.spine,
|
|
72
|
+
'AGENTS.md',
|
|
73
|
+
'Install contract requires the root AGENTS.md spine'
|
|
74
|
+
);
|
|
75
|
+
assert(
|
|
76
|
+
expectedPaths.has(derived.targets.spine),
|
|
77
|
+
'Renderer must include the root AGENTS.md spine'
|
|
78
|
+
);
|
|
79
|
+
for (const tool of tools) {
|
|
80
|
+
assert(expectedPaths.has(ideConfigs[tool].configFile), `Renderer omitted the ${tool} adapter`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (const { file, content } of files) {
|
|
84
|
+
const target = resolveWithin(projectDir, file);
|
|
85
|
+
assert(fs.existsSync(target), `Missing installed file: ${file}`);
|
|
86
|
+
const actual = fs.readFileSync(target, 'utf8').replace(/\r\n/g, '\n');
|
|
87
|
+
const expected = content.replace(/\r\n/g, '\n');
|
|
88
|
+
assert(actual === expected, `Installed adapter differs from renderer: ${file}`);
|
|
89
|
+
}
|
|
90
|
+
for (const { configFile } of Object.values(ideConfigs)) {
|
|
91
|
+
assert(
|
|
92
|
+
expectedPaths.has(configFile) || !fs.existsSync(resolveWithin(projectDir, configFile)),
|
|
93
|
+
`Unselected adapter was installed: ${configFile}`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
if (requireInventory) {
|
|
97
|
+
assert.equal(manifest.fileInventory?.schemaVersion, 1, 'Missing file inventory');
|
|
98
|
+
const { collectManagedFiles } = require('../cli/lib/update-transaction');
|
|
99
|
+
const managedFiles = collectManagedFiles({ projectDir, packs });
|
|
100
|
+
assert.deepEqual(Object.keys(manifest.fileInventory.files).sort(), managedFiles.map(entry => entry.file).sort(),
|
|
101
|
+
'Inventory does not cover exactly the selected framework files');
|
|
102
|
+
for (const { file } of managedFiles) {
|
|
103
|
+
const actualHash = crypto.createHash('sha256').update(fs.readFileSync(resolveWithin(projectDir, file))).digest('hex');
|
|
104
|
+
assert.equal(manifest.fileInventory.files[file], actualHash, `Inventory differs from installed bytes: ${file}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return files.length;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function run(command, args, { cwd, env, timeout = 60000 }) {
|
|
111
|
+
const result = spawnSync(command, args, {
|
|
112
|
+
cwd,
|
|
113
|
+
env,
|
|
114
|
+
timeout,
|
|
115
|
+
encoding: 'utf8',
|
|
116
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
117
|
+
windowsHide: true,
|
|
118
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
119
|
+
});
|
|
120
|
+
if (result.error || result.status !== 0) {
|
|
121
|
+
const reason = result.error
|
|
122
|
+
? result.error.message
|
|
123
|
+
: `exit ${result.status}, signal ${result.signal || 'none'}`;
|
|
124
|
+
throw new Error(
|
|
125
|
+
`${path.basename(command)} ${args.join(' ')}: ${reason}\n${result.stdout || ''}${result.stderr || ''}`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
return result.stdout;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Invoke npm without a shell, including Windows where npm.cmd is not executable. */
|
|
132
|
+
function npmCommand(env) {
|
|
133
|
+
const candidates = [
|
|
134
|
+
env.npm_execpath,
|
|
135
|
+
path.join(path.dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
136
|
+
...(env.PATH || env.Path || '')
|
|
137
|
+
.split(path.delimiter)
|
|
138
|
+
.map((dir) => path.join(dir, 'node_modules', 'npm', 'bin', 'npm-cli.js')),
|
|
139
|
+
];
|
|
140
|
+
const cli = candidates.find(
|
|
141
|
+
(candidate) => candidate && /npm-cli\.js$/i.test(candidate) && fs.existsSync(candidate)
|
|
142
|
+
);
|
|
143
|
+
if (cli) return { command: process.execPath, args: [cli] };
|
|
144
|
+
assert(process.platform !== 'win32', 'Could not locate npm-cli.js beside Node or on PATH');
|
|
145
|
+
return { command: 'npm', args: [] };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function packAndExtract(tempRoot, env) {
|
|
149
|
+
const destination = path.join(tempRoot, 'distribution');
|
|
150
|
+
fs.mkdirSync(destination);
|
|
151
|
+
const npm = npmCommand(env);
|
|
152
|
+
const output = run(
|
|
153
|
+
npm.command,
|
|
154
|
+
[
|
|
155
|
+
...npm.args,
|
|
156
|
+
'pack',
|
|
157
|
+
'--ignore-scripts',
|
|
158
|
+
'--offline',
|
|
159
|
+
'--json',
|
|
160
|
+
'--pack-destination',
|
|
161
|
+
destination,
|
|
162
|
+
'--cache',
|
|
163
|
+
path.join(tempRoot, 'npm-cache'),
|
|
164
|
+
],
|
|
165
|
+
{ cwd: REPO_ROOT, env, timeout: 120000 }
|
|
166
|
+
);
|
|
167
|
+
const packed = JSON.parse(output);
|
|
168
|
+
assert(Array.isArray(packed) && packed.length === 1, 'npm pack must produce exactly one package');
|
|
169
|
+
const archive = resolveWithin(destination, packed[0].filename);
|
|
170
|
+
const entries = run('tar', ['-tzf', archive], { cwd: destination, env }).trim().split(/\r?\n/);
|
|
171
|
+
for (const entry of entries) {
|
|
172
|
+
assert(entry.startsWith('package/'), `Unexpected npm archive entry: ${entry}`);
|
|
173
|
+
resolveWithin(destination, entry);
|
|
174
|
+
}
|
|
175
|
+
run('tar', ['-xzf', archive, '-C', destination], { cwd: destination, env });
|
|
176
|
+
const packageRoot = path.join(destination, 'package');
|
|
177
|
+
assert(
|
|
178
|
+
!fs.existsSync(path.join(packageRoot, 'registry.yaml')),
|
|
179
|
+
'npm contract must work without registry.yaml'
|
|
180
|
+
);
|
|
181
|
+
assert(fs.statSync(packageRoot).isDirectory(), 'npm package directory is missing');
|
|
182
|
+
return packageRoot;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function runMatrix(packageRoot, variant, tempRoot, env, reference) {
|
|
186
|
+
const allPacks = Object.keys(reference.packDefinitions).filter(
|
|
187
|
+
(id) => !reference.packDefinitions[id].disabled
|
|
188
|
+
);
|
|
189
|
+
const allTools = Object.keys(reference.ideConfigs);
|
|
190
|
+
assert(allTools.length > 0, 'IDE_CONFIGS must expose at least one target');
|
|
191
|
+
const selections = [
|
|
192
|
+
{ argument: 'core', packs: ['core'] },
|
|
193
|
+
{ argument: 'core,osint', packs: ['core', 'osint'] },
|
|
194
|
+
{ argument: 'core,memory', packs: ['core', 'memory'] },
|
|
195
|
+
{ argument: 'all', packs: allPacks },
|
|
196
|
+
];
|
|
197
|
+
const toolSelections = [...allTools.map((tool) => [tool]), allTools];
|
|
198
|
+
let installations = 0;
|
|
199
|
+
let files = 0;
|
|
200
|
+
for (const selection of selections) {
|
|
201
|
+
for (const tools of toolSelections) {
|
|
202
|
+
const label = `${variant}/${selection.argument}/${tools.join(',')}`;
|
|
203
|
+
const projectDir = path.join(tempRoot, `${variant}-project-${++installations}`);
|
|
204
|
+
fs.mkdirSync(projectDir);
|
|
205
|
+
try {
|
|
206
|
+
run(
|
|
207
|
+
process.execPath,
|
|
208
|
+
[
|
|
209
|
+
path.join(packageRoot, 'tools', 'cli', 'bmad-plus-cli.js'),
|
|
210
|
+
'install',
|
|
211
|
+
'--yes',
|
|
212
|
+
'--lang',
|
|
213
|
+
'en',
|
|
214
|
+
'--directory',
|
|
215
|
+
projectDir,
|
|
216
|
+
'--packs',
|
|
217
|
+
selection.argument,
|
|
218
|
+
'--tools',
|
|
219
|
+
tools.join(','),
|
|
220
|
+
],
|
|
221
|
+
{ cwd: projectDir, env }
|
|
222
|
+
);
|
|
223
|
+
files += verifyInstallation(projectDir, { ...reference, packs: selection.packs, tools });
|
|
224
|
+
if (tools.length === allTools.length) {
|
|
225
|
+
const output = run(process.execPath, [
|
|
226
|
+
path.join(packageRoot, 'tools', 'cli', 'bmad-plus-cli.js'),
|
|
227
|
+
'update-check', '--offline', '--json', '--directory', projectDir,
|
|
228
|
+
], { cwd: projectDir, env });
|
|
229
|
+
const checked = JSON.parse(output);
|
|
230
|
+
assert.equal(checked.status, 'unknown', 'Offline check must not claim the latest release');
|
|
231
|
+
assert.equal(checked.updateAvailable, null);
|
|
232
|
+
assert.equal(checked.canAutoApply, false);
|
|
233
|
+
}
|
|
234
|
+
} catch (error) {
|
|
235
|
+
throw new Error(`${label}: ${error.message}`, { cause: error });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
console.log(
|
|
239
|
+
`OK ${variant}: ${selection.argument} across ${toolSelections.length} tool selections`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
return { installations, files };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function main() {
|
|
246
|
+
const { PACKS, DERIVED } = require('../cli/lib/packs');
|
|
247
|
+
const { IDE_CONFIGS } = require('../cli/lib/ide-config');
|
|
248
|
+
const { generateUserFiles } = require('./generate-adapters');
|
|
249
|
+
assert(
|
|
250
|
+
DERIVED && typeof generateUserFiles === 'function',
|
|
251
|
+
'Generated install contract exports are missing'
|
|
252
|
+
);
|
|
253
|
+
const reference = {
|
|
254
|
+
packDefinitions: PACKS,
|
|
255
|
+
derived: DERIVED,
|
|
256
|
+
ideConfigs: IDE_CONFIGS,
|
|
257
|
+
renderFiles: generateUserFiles,
|
|
258
|
+
requireInventory: true,
|
|
259
|
+
};
|
|
260
|
+
const tempParent = fs.realpathSync(os.tmpdir());
|
|
261
|
+
const tempRoot = fs.mkdtempSync(path.join(tempParent, TEMP_PREFIX));
|
|
262
|
+
try {
|
|
263
|
+
const brain = path.join(tempRoot, 'brain');
|
|
264
|
+
fs.mkdirSync(brain);
|
|
265
|
+
const env = {
|
|
266
|
+
...process.env,
|
|
267
|
+
BMAD_PLUS_BRAIN: brain,
|
|
268
|
+
NODE_PATH: path.join(REPO_ROOT, 'node_modules'),
|
|
269
|
+
NO_COLOR: '1',
|
|
270
|
+
NPM_CONFIG_UPDATE_NOTIFIER: 'false',
|
|
271
|
+
};
|
|
272
|
+
const source = runMatrix(REPO_ROOT, 'source', tempRoot, env, reference);
|
|
273
|
+
const packageRoot = packAndExtract(tempRoot, env);
|
|
274
|
+
const packaged = runMatrix(packageRoot, 'npm', tempRoot, env, reference);
|
|
275
|
+
console.log(
|
|
276
|
+
`Install contract passed: ${source.installations + packaged.installations} installs, ${source.files + packaged.files} files compared (source + npm without registry.yaml).`
|
|
277
|
+
);
|
|
278
|
+
return 0;
|
|
279
|
+
} finally {
|
|
280
|
+
// Delete only this mkdtemp-owned direct child of the verified temp directory.
|
|
281
|
+
assert(
|
|
282
|
+
path.dirname(tempRoot) === tempParent && path.basename(tempRoot).startsWith(TEMP_PREFIX)
|
|
283
|
+
);
|
|
284
|
+
assert(fs.realpathSync(tempRoot) === tempRoot && !fs.lstatSync(tempRoot).isSymbolicLink());
|
|
285
|
+
fs.rmSync(tempRoot, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (require.main === module) {
|
|
290
|
+
try {
|
|
291
|
+
process.exitCode = main();
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.error(`Install contract failed: ${error.message}`);
|
|
294
|
+
process.exitCode = 1;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
module.exports = { main, resolveWithin, verifyInstallation };
|