@zeyue0329/xiaoma-cli 1.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.
Files changed (123) hide show
  1. package/.releaserc.json +18 -0
  2. package/.vscode/settings.json +44 -0
  3. package/CONTRIBUTING.md +209 -0
  4. package/LICENSE +21 -0
  5. package/QUICK-START.md +173 -0
  6. package/README.md +532 -0
  7. package/common/tasks/create-doc.md +101 -0
  8. package/common/tasks/execute-checklist.md +93 -0
  9. package/common/utils/bmad-doc-template.md +325 -0
  10. package/common/utils/workflow-management.md +69 -0
  11. package/dist/agents/analyst.txt +2882 -0
  12. package/dist/agents/architect.txt +3543 -0
  13. package/dist/agents/dev.txt +428 -0
  14. package/dist/agents/pm.txt +2229 -0
  15. package/dist/agents/po.txt +1364 -0
  16. package/dist/agents/qa.txt +386 -0
  17. package/dist/agents/sm.txt +668 -0
  18. package/dist/agents/ux-expert.txt +701 -0
  19. package/dist/agents/xiaoma-master.txt +8756 -0
  20. package/dist/agents/xiaoma-orchestrator.txt +1490 -0
  21. package/dist/teams/team-all.txt +11062 -0
  22. package/dist/teams/team-fullstack.txt +10392 -0
  23. package/dist/teams/team-ide-minimal.txt +3507 -0
  24. package/dist/teams/team-no-ui.txt +8951 -0
  25. package/docs/GUIDING-PRINCIPLES.md +91 -0
  26. package/docs/core-architecture.md +219 -0
  27. package/docs/expansion-packs.md +280 -0
  28. package/docs/versioning-and-releases.md +77 -0
  29. package/docs/versions.md +48 -0
  30. package/expansion-packs/README.md +3 -0
  31. package/package.json +80 -0
  32. package/tools/bmad-npx-wrapper.js +39 -0
  33. package/tools/builders/web-builder.js +681 -0
  34. package/tools/bump-all-versions.js +106 -0
  35. package/tools/bump-expansion-version.js +83 -0
  36. package/tools/cli.js +152 -0
  37. package/tools/flattener/main.js +570 -0
  38. package/tools/installer/README.md +8 -0
  39. package/tools/installer/bin/xiaoma.js +326 -0
  40. package/tools/installer/config/ide-agent-config.yaml +58 -0
  41. package/tools/installer/config/install.config.yaml +113 -0
  42. package/tools/installer/lib/config-loader.js +253 -0
  43. package/tools/installer/lib/file-manager.js +411 -0
  44. package/tools/installer/lib/ide-base-setup.js +227 -0
  45. package/tools/installer/lib/ide-setup.js +1302 -0
  46. package/tools/installer/lib/installer.js +1772 -0
  47. package/tools/installer/lib/memory-profiler.js +224 -0
  48. package/tools/installer/lib/module-manager.js +110 -0
  49. package/tools/installer/lib/resource-locator.js +310 -0
  50. package/tools/installer/package-lock.json +906 -0
  51. package/tools/installer/package.json +43 -0
  52. package/tools/lib/dependency-resolver.js +179 -0
  53. package/tools/lib/yaml-utils.js +29 -0
  54. package/tools/md-assets/web-agent-startup-instructions.md +39 -0
  55. package/tools/semantic-release-sync-installer.js +30 -0
  56. package/tools/sync-installer-version.js +34 -0
  57. package/tools/update-expansion-version.js +54 -0
  58. package/tools/upgraders/v3-to-v4-upgrader.js +763 -0
  59. package/tools/version-bump.js +79 -0
  60. package/tools/xiaoma-npx-wrapper.js +39 -0
  61. package/tools/yaml-format.js +240 -0
  62. package/xiaoma-core/agent-teams/team-all.yaml +14 -0
  63. package/xiaoma-core/agent-teams/team-fullstack.yaml +18 -0
  64. package/xiaoma-core/agent-teams/team-ide-minimal.yaml +10 -0
  65. package/xiaoma-core/agent-teams/team-no-ui.yaml +13 -0
  66. package/xiaoma-core/agents/analyst.md +81 -0
  67. package/xiaoma-core/agents/architect.md +84 -0
  68. package/xiaoma-core/agents/dev.md +76 -0
  69. package/xiaoma-core/agents/pm.md +81 -0
  70. package/xiaoma-core/agents/po.md +76 -0
  71. package/xiaoma-core/agents/qa.md +69 -0
  72. package/xiaoma-core/agents/sm.md +62 -0
  73. package/xiaoma-core/agents/ux-expert.md +66 -0
  74. package/xiaoma-core/agents/xiaoma-master.md +108 -0
  75. package/xiaoma-core/agents/xiaoma-orchestrator.md +150 -0
  76. package/xiaoma-core/bmad-core/user-guide.md +0 -0
  77. package/xiaoma-core/checklists/architect-checklist.md +443 -0
  78. package/xiaoma-core/checklists/change-checklist.md +182 -0
  79. package/xiaoma-core/checklists/pm-checklist.md +375 -0
  80. package/xiaoma-core/checklists/po-master-checklist.md +441 -0
  81. package/xiaoma-core/checklists/story-dod-checklist.md +101 -0
  82. package/xiaoma-core/checklists/story-draft-checklist.md +156 -0
  83. package/xiaoma-core/core-config.yaml +20 -0
  84. package/xiaoma-core/data/brainstorming-techniques.md +36 -0
  85. package/xiaoma-core/data/elicitation-methods.md +134 -0
  86. package/xiaoma-core/data/technical-preferences.md +3 -0
  87. package/xiaoma-core/data/xiaoma-kb.md +803 -0
  88. package/xiaoma-core/enhanced-ide-development-workflow.md +43 -0
  89. package/xiaoma-core/tasks/advanced-elicitation.md +117 -0
  90. package/xiaoma-core/tasks/brownfield-create-epic.md +160 -0
  91. package/xiaoma-core/tasks/brownfield-create-story.md +147 -0
  92. package/xiaoma-core/tasks/correct-course.md +70 -0
  93. package/xiaoma-core/tasks/create-brownfield-story.md +304 -0
  94. package/xiaoma-core/tasks/create-deep-research-prompt.md +289 -0
  95. package/xiaoma-core/tasks/create-next-story.md +112 -0
  96. package/xiaoma-core/tasks/document-project.md +341 -0
  97. package/xiaoma-core/tasks/facilitate-brainstorming-session.md +136 -0
  98. package/xiaoma-core/tasks/generate-ai-frontend-prompt.md +51 -0
  99. package/xiaoma-core/tasks/index-docs.md +179 -0
  100. package/xiaoma-core/tasks/kb-mode-interaction.md +75 -0
  101. package/xiaoma-core/tasks/review-story.md +145 -0
  102. package/xiaoma-core/tasks/shard-doc.md +187 -0
  103. package/xiaoma-core/tasks/validate-next-story.md +134 -0
  104. package/xiaoma-core/templates/architecture-tmpl.yaml +650 -0
  105. package/xiaoma-core/templates/brainstorming-output-tmpl.yaml +156 -0
  106. package/xiaoma-core/templates/brownfield-architecture-tmpl.yaml +476 -0
  107. package/xiaoma-core/templates/brownfield-prd-tmpl.yaml +280 -0
  108. package/xiaoma-core/templates/competitor-analysis-tmpl.yaml +293 -0
  109. package/xiaoma-core/templates/front-end-architecture-tmpl.yaml +206 -0
  110. package/xiaoma-core/templates/front-end-spec-tmpl.yaml +349 -0
  111. package/xiaoma-core/templates/fullstack-architecture-tmpl.yaml +805 -0
  112. package/xiaoma-core/templates/market-research-tmpl.yaml +252 -0
  113. package/xiaoma-core/templates/prd-tmpl.yaml +202 -0
  114. package/xiaoma-core/templates/project-brief-tmpl.yaml +221 -0
  115. package/xiaoma-core/templates/story-tmpl.yaml +137 -0
  116. package/xiaoma-core/user-guide.md +251 -0
  117. package/xiaoma-core/workflows/brownfield-fullstack.yaml +297 -0
  118. package/xiaoma-core/workflows/brownfield-service.yaml +187 -0
  119. package/xiaoma-core/workflows/brownfield-ui.yaml +197 -0
  120. package/xiaoma-core/workflows/greenfield-fullstack.yaml +240 -0
  121. package/xiaoma-core/workflows/greenfield-service.yaml +206 -0
  122. package/xiaoma-core/workflows/greenfield-ui.yaml +235 -0
  123. package/xiaoma-core/working-in-the-brownfield.md +364 -0
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const yaml = require('js-yaml');
6
+
7
+ const args = process.argv.slice(2);
8
+ const bumpType = args[0] || 'minor'; // default to minor
9
+
10
+ if (!['major', 'minor', 'patch'].includes(bumpType)) {
11
+ console.log('Usage: node bump-all-versions.js [major|minor|patch]');
12
+ console.log('Default: minor');
13
+ process.exit(1);
14
+ }
15
+
16
+ function bumpVersion(currentVersion, type) {
17
+ const [major, minor, patch] = currentVersion.split('.').map(Number);
18
+
19
+ switch (type) {
20
+ case 'major':
21
+ return `${major + 1}.0.0`;
22
+ case 'minor':
23
+ return `${major}.${minor + 1}.0`;
24
+ case 'patch':
25
+ return `${major}.${minor}.${patch + 1}`;
26
+ default:
27
+ return currentVersion;
28
+ }
29
+ }
30
+
31
+ async function bumpAllVersions() {
32
+ const updatedItems = [];
33
+
34
+ // First, bump the core version (package.json)
35
+ const packagePath = path.join(__dirname, '..', 'package.json');
36
+ try {
37
+ const packageContent = fs.readFileSync(packagePath, 'utf8');
38
+ const packageJson = JSON.parse(packageContent);
39
+ const oldCoreVersion = packageJson.version || '1.0.0';
40
+ const newCoreVersion = bumpVersion(oldCoreVersion, bumpType);
41
+
42
+ packageJson.version = newCoreVersion;
43
+
44
+ fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n');
45
+
46
+ updatedItems.push({ type: 'core', name: 'BMad Core', oldVersion: oldCoreVersion, newVersion: newCoreVersion });
47
+ console.log(`✓ BMad Core (package.json): ${oldCoreVersion} → ${newCoreVersion}`);
48
+ } catch (error) {
49
+ console.error(`✗ Failed to update BMad Core: ${error.message}`);
50
+ }
51
+
52
+ // Then, bump all expansion packs
53
+ const expansionPacksDir = path.join(__dirname, '..', 'expansion-packs');
54
+
55
+ try {
56
+ const entries = fs.readdirSync(expansionPacksDir, { withFileTypes: true });
57
+
58
+ for (const entry of entries) {
59
+ if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'README.md') {
60
+ const packId = entry.name;
61
+ const configPath = path.join(expansionPacksDir, packId, 'config.yaml');
62
+
63
+ if (fs.existsSync(configPath)) {
64
+ try {
65
+ const configContent = fs.readFileSync(configPath, 'utf8');
66
+ const config = yaml.load(configContent);
67
+ const oldVersion = config.version || '1.0.0';
68
+ const newVersion = bumpVersion(oldVersion, bumpType);
69
+
70
+ config.version = newVersion;
71
+
72
+ const updatedYaml = yaml.dump(config, { indent: 2 });
73
+ fs.writeFileSync(configPath, updatedYaml);
74
+
75
+ updatedItems.push({ type: 'expansion', name: packId, oldVersion, newVersion });
76
+ console.log(`✓ ${packId}: ${oldVersion} → ${newVersion}`);
77
+
78
+ } catch (error) {
79
+ console.error(`✗ Failed to update ${packId}: ${error.message}`);
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ if (updatedItems.length > 0) {
86
+ const coreCount = updatedItems.filter(i => i.type === 'core').length;
87
+ const expansionCount = updatedItems.filter(i => i.type === 'expansion').length;
88
+
89
+ console.log(`\n✓ Successfully bumped ${updatedItems.length} item(s) with ${bumpType} version bump`);
90
+ if (coreCount > 0) console.log(` - ${coreCount} core`);
91
+ if (expansionCount > 0) console.log(` - ${expansionCount} expansion pack(s)`);
92
+
93
+ console.log('\nNext steps:');
94
+ console.log('1. Test the changes');
95
+ console.log('2. Commit: git add -A && git commit -m "chore: bump all versions (' + bumpType + ')"');
96
+ } else {
97
+ console.log('No items found to update');
98
+ }
99
+
100
+ } catch (error) {
101
+ console.error('Error reading expansion packs directory:', error.message);
102
+ process.exit(1);
103
+ }
104
+ }
105
+
106
+ bumpAllVersions();
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Load required modules
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const yaml = require('js-yaml');
7
+
8
+ // Parse CLI arguments
9
+ const args = process.argv.slice(2);
10
+ const packId = args[0];
11
+ const bumpType = args[1] || 'minor';
12
+
13
+ // Validate arguments
14
+ if (!packId || args.length > 2) {
15
+ console.log('Usage: node bump-expansion-version.js <expansion-pack-id> [major|minor|patch]');
16
+ console.log('Default: minor');
17
+ console.log('Example: node bump-expansion-version.js bmad-creator-tools patch');
18
+ process.exit(1);
19
+ }
20
+
21
+ if (!['major', 'minor', 'patch'].includes(bumpType)) {
22
+ console.error('Error: Bump type must be major, minor, or patch');
23
+ process.exit(1);
24
+ }
25
+
26
+ // Version bump logic
27
+ function bumpVersion(currentVersion, type) {
28
+ const [major, minor, patch] = currentVersion.split('.').map(Number);
29
+
30
+ switch (type) {
31
+ case 'major': return `${major + 1}.0.0`;
32
+ case 'minor': return `${major}.${minor + 1}.0`;
33
+ case 'patch': return `${major}.${minor}.${patch + 1}`;
34
+ default: return currentVersion;
35
+ }
36
+ }
37
+
38
+ // Main function to bump version
39
+ async function updateVersion() {
40
+ const configPath = path.join(__dirname, '..', 'expansion-packs', packId, 'config.yaml');
41
+
42
+ // Check if config exists
43
+ if (!fs.existsSync(configPath)) {
44
+ console.error(`Error: Expansion pack '${packId}' not found`);
45
+ console.log('\nAvailable expansion packs:');
46
+
47
+ const packsDir = path.join(__dirname, '..', 'expansion-packs');
48
+ const entries = fs.readdirSync(packsDir, { withFileTypes: true });
49
+
50
+ entries.forEach(entry => {
51
+ if (entry.isDirectory() && !entry.name.startsWith('.')) {
52
+ console.log(` - ${entry.name}`);
53
+ }
54
+ });
55
+
56
+ process.exit(1);
57
+ }
58
+
59
+ try {
60
+ const configContent = fs.readFileSync(configPath, 'utf8');
61
+ const config = yaml.load(configContent);
62
+
63
+ const oldVersion = config.version || '1.0.0';
64
+ const newVersion = bumpVersion(oldVersion, bumpType);
65
+
66
+ config.version = newVersion;
67
+
68
+ const updatedYaml = yaml.dump(config, { indent: 2 });
69
+ fs.writeFileSync(configPath, updatedYaml);
70
+
71
+ console.log(`✓ ${packId}: ${oldVersion} → ${newVersion}`);
72
+ console.log(`\n✓ Successfully bumped ${packId} with ${bumpType} version bump`);
73
+ console.log('\nNext steps:');
74
+ console.log(`1. Test the changes`);
75
+ console.log(`2. Commit: git add -A && git commit -m "chore: bump ${packId} version (${bumpType})"`);
76
+
77
+ } catch (error) {
78
+ console.error('Error updating version:', error.message);
79
+ process.exit(1);
80
+ }
81
+ }
82
+
83
+ updateVersion();
package/tools/cli.js ADDED
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require('commander');
4
+ const WebBuilder = require('./builders/web-builder');
5
+ const V3ToV4Upgrader = require('./upgraders/v3-to-v4-upgrader');
6
+ const IdeSetup = require('./installer/lib/ide-setup');
7
+ const path = require('path');
8
+
9
+ const program = new Command();
10
+
11
+ program
12
+ .name('xiaoma-build')
13
+ .description('XiaoMa-Method build tool for creating web bundles')
14
+ .version('4.0.0');
15
+
16
+ program
17
+ .command('build')
18
+ .description('Build web bundles for agents and teams')
19
+ .option('-a, --agents-only', 'Build only agent bundles')
20
+ .option('-t, --teams-only', 'Build only team bundles')
21
+ .option('-e, --expansions-only', 'Build only expansion pack bundles')
22
+ .option('--no-expansions', 'Skip building expansion packs')
23
+ .option('--no-clean', 'Skip cleaning output directories')
24
+ .action(async (options) => {
25
+ const builder = new WebBuilder({
26
+ rootDir: process.cwd()
27
+ });
28
+
29
+ try {
30
+ if (options.clean) {
31
+ console.log('Cleaning output directories...');
32
+ await builder.cleanOutputDirs();
33
+ }
34
+
35
+ if (options.expansionsOnly) {
36
+ console.log('Building expansion pack bundles...');
37
+ await builder.buildAllExpansionPacks({ clean: false });
38
+ } else {
39
+ if (!options.teamsOnly) {
40
+ console.log('Building agent bundles...');
41
+ await builder.buildAgents();
42
+ }
43
+
44
+ if (!options.agentsOnly) {
45
+ console.log('Building team bundles...');
46
+ await builder.buildTeams();
47
+ }
48
+
49
+ if (!options.noExpansions) {
50
+ console.log('Building expansion pack bundles...');
51
+ await builder.buildAllExpansionPacks({ clean: false });
52
+ }
53
+ }
54
+
55
+ console.log('Build completed successfully!');
56
+ } catch (error) {
57
+ console.error('Build failed:', error.message);
58
+ process.exit(1);
59
+ }
60
+ });
61
+
62
+ program
63
+ .command('build:expansions')
64
+ .description('Build web bundles for all expansion packs')
65
+ .option('--expansion <name>', 'Build specific expansion pack only')
66
+ .option('--no-clean', 'Skip cleaning output directories')
67
+ .action(async (options) => {
68
+ const builder = new WebBuilder({
69
+ rootDir: process.cwd()
70
+ });
71
+
72
+ try {
73
+ if (options.expansion) {
74
+ console.log(`Building expansion pack: ${options.expansion}`);
75
+ await builder.buildExpansionPack(options.expansion, { clean: options.clean });
76
+ } else {
77
+ console.log('Building all expansion packs...');
78
+ await builder.buildAllExpansionPacks({ clean: options.clean });
79
+ }
80
+
81
+ console.log('Expansion pack build completed successfully!');
82
+ } catch (error) {
83
+ console.error('Expansion pack build failed:', error.message);
84
+ process.exit(1);
85
+ }
86
+ });
87
+
88
+ program
89
+ .command('list:agents')
90
+ .description('List all available agents')
91
+ .action(async () => {
92
+ const builder = new WebBuilder({ rootDir: process.cwd() });
93
+ const agents = await builder.resolver.listAgents();
94
+ console.log('Available agents:');
95
+ agents.forEach(agent => console.log(` - ${agent}`));
96
+ });
97
+
98
+ program
99
+ .command('list:expansions')
100
+ .description('List all available expansion packs')
101
+ .action(async () => {
102
+ const builder = new WebBuilder({ rootDir: process.cwd() });
103
+ const expansions = await builder.listExpansionPacks();
104
+ console.log('Available expansion packs:');
105
+ expansions.forEach(expansion => console.log(` - ${expansion}`));
106
+ });
107
+
108
+ program
109
+ .command('validate')
110
+ .description('Validate agent and team configurations')
111
+ .action(async () => {
112
+ const builder = new WebBuilder({ rootDir: process.cwd() });
113
+ try {
114
+ // Validate by attempting to build all agents and teams
115
+ const agents = await builder.resolver.listAgents();
116
+ const teams = await builder.resolver.listTeams();
117
+
118
+ console.log('Validating agents...');
119
+ for (const agent of agents) {
120
+ await builder.resolver.resolveAgentDependencies(agent);
121
+ console.log(` ✓ ${agent}`);
122
+ }
123
+
124
+ console.log('\nValidating teams...');
125
+ for (const team of teams) {
126
+ await builder.resolver.resolveTeamDependencies(team);
127
+ console.log(` ✓ ${team}`);
128
+ }
129
+
130
+ console.log('\nAll configurations are valid!');
131
+ } catch (error) {
132
+ console.error('Validation failed:', error.message);
133
+ process.exit(1);
134
+ }
135
+ });
136
+
137
+ program
138
+ .command('upgrade')
139
+ .description('Upgrade a XiaoMa-Method V3 project to V4')
140
+ .option('-p, --project <path>', 'Path to V3 project (defaults to current directory)')
141
+ .option('--dry-run', 'Show what would be changed without making changes')
142
+ .option('--no-backup', 'Skip creating backup (not recommended)')
143
+ .action(async (options) => {
144
+ const upgrader = new V3ToV4Upgrader();
145
+ await upgrader.upgrade({
146
+ projectPath: options.project,
147
+ dryRun: options.dryRun,
148
+ backup: options.backup
149
+ });
150
+ });
151
+
152
+ program.parse();