bmad-cybersec 3.2.3 → 4.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bmad-cybersec",
3
- "version": "3.2.3",
3
+ "version": "4.0.0",
4
4
  "description": "Production-ready BMAD security and automation framework with comprehensive validation, authentication, and audit capabilities",
5
5
  "type": "module",
6
6
  "main": "./_bmad/framework/dist/_bmad/framework/index.js",
@@ -69,16 +69,16 @@
69
69
  "postinstall": "node -e \"console.log('✓ BMAD-CYBERSEC installed. Framework is pre-built and ready to use.')\"",
70
70
  "quality:check": "npm run lint && npm run type-check && npm run test:coverage",
71
71
  "ci:quality": "npm run quality:check && npm run security:scan && npm run build",
72
- "setup": "node src/utility/tools/installer/bin/setup-wizard.mjs",
73
- "modules": "node src/utility/tools/module-selector/index.js",
74
- "modules:offline": "node src/utility/tools/module-selector/index.js --offline",
72
+ "setup": "bmad setup",
73
+ "modules": "bmad modules",
74
+ "modules:offline": "bmad modules --offline",
75
75
  "install:offline": "npm install --offline",
76
76
  "cache:prepare": "npm pack && npm cache add *.tgz",
77
- "security:config": "node src/utility/tools/security-config/index.js",
78
- "llm:setup": "node src/utility/tools/llm-setup/index.js",
79
- "health": "node src/utility/tools/health-check/index.js",
80
- "pgp:setup": "node src/utility/tools/pgp-setup/index.js",
81
- "validate:refs": "node src/utility/tools/reference-validator/cli.js",
77
+ "security:config": "bmad security:config",
78
+ "llm:setup": "bmad llm:setup",
79
+ "health": "bmad health",
80
+ "pgp:setup": "bmad pgp:setup",
81
+ "validate:refs": "bmad validate:refs",
82
82
  "lint:md": "markdownlint-cli2 '**/*.md' '#node_modules'",
83
83
  "test:schemas": "node tools/validate-agent-schema.js && node tools/validate-workflow-schema.js && node tools/validate-module-schema.js",
84
84
  "qa": "npm run test:schemas && npm run lint && npm run lint:md && npm test && bash scripts/security-regression.sh"
@@ -1,12 +1,77 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { Command } from 'commander';
4
+ import { fileURLToPath } from 'url';
5
+ import { pathToFileURL } from 'url';
6
+ import path from 'path';
7
+ import { existsSync } from 'fs';
4
8
  import { versionCommand } from './commands/version.js';
5
9
  import { installCommand } from './commands/install.js';
6
10
  import { updateCommand } from './commands/update.js';
7
11
  import { statusCommand } from './commands/status.js';
8
12
  import { CONFIG } from './lib/config.js';
9
13
 
14
+ // Get package root directory
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = path.dirname(__filename);
17
+ const packageRoot = path.resolve(__dirname, '../..');
18
+
19
+ /**
20
+ * Resolve a path to a tool script within the package
21
+ * @param {string} toolPath - Relative path from package root
22
+ * @returns {string} Absolute path to the tool
23
+ */
24
+ function resolveToolPath(toolPath) {
25
+ const absolutePath = path.join(packageRoot, toolPath);
26
+ if (!existsSync(absolutePath)) {
27
+ console.error(`Error: Tool not found at ${absolutePath}`);
28
+ console.error('This may indicate a corrupted installation. Try reinstalling:');
29
+ console.error(' npm uninstall bmad-cybersec && npm install bmad-cybersec');
30
+ process.exit(1);
31
+ }
32
+ return absolutePath;
33
+ }
34
+
35
+ /**
36
+ * Dynamically import and run a tool
37
+ * @param {string} toolPath - Path to tool module
38
+ * @param {string[]} [extraArgs] - Extra arguments to prepend to process.argv
39
+ * @returns {Promise<void>}
40
+ */
41
+ async function runTool(toolPath, extraArgs = []) {
42
+ const absolutePath = resolveToolPath(toolPath);
43
+ const toolUrl = pathToFileURL(absolutePath).href;
44
+ const toolModule = await import(toolUrl);
45
+
46
+ // If extra args provided, prepend them to process.argv for the tool
47
+ const originalArgv = process.argv.slice();
48
+ if (extraArgs.length > 0) {
49
+ process.argv = [
50
+ process.argv[0],
51
+ absolutePath,
52
+ ...extraArgs,
53
+ ...process.argv.slice(2)
54
+ ];
55
+ }
56
+
57
+ try {
58
+ // Tools may export a main function, run function, or handle execution themselves
59
+ if (toolModule.default && typeof toolModule.default === 'function') {
60
+ await toolModule.default();
61
+ } else if (toolModule.main && typeof toolModule.main === 'function') {
62
+ await toolModule.main();
63
+ } else if (toolModule.run && typeof toolModule.run === 'function') {
64
+ await toolModule.run();
65
+ }
66
+ // If none of above, tool may have its own entry point detection
67
+ } finally {
68
+ // Restore original argv
69
+ if (extraArgs.length > 0) {
70
+ process.argv = originalArgv;
71
+ }
72
+ }
73
+ }
74
+
10
75
  // Check Node.js version
11
76
  const nodeVersion = parseInt(process.version.slice(1).split('.')[0], 10);
12
77
  if (nodeVersion < 20) {
@@ -63,6 +128,58 @@ program
63
128
  .description('Show BMAD-CYBER installation status')
64
129
  .action(statusCommand);
65
130
 
131
+ // Configuration commands
132
+ program
133
+ .command('setup')
134
+ .description('Run BMAD setup wizard')
135
+ .action(async () => {
136
+ await runTool('src/utility/tools/installer/bin/setup-wizard.mjs');
137
+ });
138
+
139
+ program
140
+ .command('modules')
141
+ .description('Configure BMAD modules')
142
+ .option('--offline', 'Run in offline mode')
143
+ .action(async (options) => {
144
+ const extraArgs = options.offline ? ['--offline'] : [];
145
+ await runTool('src/utility/tools/module-selector/index.js', extraArgs);
146
+ });
147
+
148
+ program
149
+ .command('security:config')
150
+ .description('Configure security settings')
151
+ .action(async () => {
152
+ await runTool('src/utility/tools/security-config/index.js');
153
+ });
154
+
155
+ program
156
+ .command('llm:setup')
157
+ .description('Configure LLM provider')
158
+ .action(async () => {
159
+ await runTool('src/utility/tools/llm-setup/index.js');
160
+ });
161
+
162
+ program
163
+ .command('health')
164
+ .description('Run health check')
165
+ .action(async () => {
166
+ await runTool('src/utility/tools/health-check/index.js');
167
+ });
168
+
169
+ program
170
+ .command('pgp:setup')
171
+ .description('Configure PGP keys')
172
+ .action(async () => {
173
+ await runTool('src/utility/tools/pgp-setup/index.js');
174
+ });
175
+
176
+ program
177
+ .command('validate:refs')
178
+ .description('Validate reference configuration')
179
+ .action(async () => {
180
+ await runTool('src/utility/tools/reference-validator/cli.js');
181
+ });
182
+
66
183
  // Handle unknown commands
67
184
  program.on('command:*', () => {
68
185
  console.error(`Unknown command: ${program.args.join(' ')}`);
@@ -13,7 +13,7 @@
13
13
  * console.log(`Installing from ${CONFIG.GITHUB_OWNER}/${CONFIG.GITHUB_REPO}`);
14
14
  */
15
15
  export const CONFIG = {
16
- VERSION: '2.3.0',
16
+ VERSION: '4.0.0',
17
17
  GITHUB_OWNER: 'SchenLong',
18
18
  GITHUB_REPO: 'BMAD-CYBERSEC',
19
19
  MIN_NODE_VERSION: 20,