@zeyue0329/xiaoma-cli 1.7.0 → 1.8.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/README.md +33 -33
- package/package.json +3 -8
- package/pipeline-optimization-report.md +331 -564
- package/src/core/module-help.csv +10 -10
- package/src/core/skills/xiaoma-advanced-elicitation/SKILL.md +2 -2
- package/src/core/skills/xiaoma-advanced-elicitation/workflow.md +2 -2
- package/src/core/skills/xiaoma-brainstorming/SKILL.md +1 -1
- package/src/core/skills/xiaoma-brainstorming/steps/step-01-session-setup.md +4 -0
- package/src/core/skills/xiaoma-brainstorming/steps/step-01b-continue.md +3 -1
- package/src/core/skills/xiaoma-brainstorming/steps/step-02a-user-selected.md +5 -1
- package/src/core/skills/xiaoma-brainstorming/steps/step-02b-ai-recommended.md +3 -1
- package/src/core/skills/xiaoma-brainstorming/steps/step-02c-random-selection.md +3 -1
- package/src/core/skills/xiaoma-brainstorming/steps/step-02d-progressive-flow.md +3 -1
- package/src/core/skills/xiaoma-brainstorming/steps/step-03-technique-execution.md +2 -0
- package/src/core/skills/xiaoma-brainstorming/steps/step-04-idea-organization.md +2 -0
- package/src/core/skills/xiaoma-brainstorming/workflow.md +1 -2
- package/src/core/skills/xiaoma-distillator/SKILL.md +1 -1
- package/src/core/skills/xiaoma-distillator/agents/distillate-compressor.md +4 -4
- package/src/core/skills/xiaoma-distillator/resources/distillate-format-reference.md +34 -34
- package/src/core/skills/xiaoma-distillator/xiaoma-skill-manifest.yaml +1 -1
- package/src/core/skills/xiaoma-editorial-review-prose/SKILL.md +1 -1
- package/src/core/skills/xiaoma-editorial-review-structure/SKILL.md +1 -1
- package/src/core/skills/xiaoma-editorial-review-structure/workflow.md +1 -1
- package/src/core/skills/xiaoma-help/SKILL.md +2 -2
- package/src/core/skills/xiaoma-index-docs/SKILL.md +1 -1
- package/src/core/skills/xiaoma-party-mode/SKILL.md +2 -2
- package/src/core/skills/xiaoma-party-mode/steps/step-01-agent-loading.md +3 -3
- package/src/core/skills/xiaoma-party-mode/steps/step-02-discussion-orchestration.md +2 -2
- package/src/core/skills/xiaoma-party-mode/steps/step-03-graceful-exit.md +5 -5
- package/src/core/skills/xiaoma-party-mode/workflow.md +4 -4
- package/src/core/skills/xiaoma-review-adversarial-general/SKILL.md +1 -1
- package/src/core/skills/xiaoma-review-edge-case-hunter/SKILL.md +2 -2
- package/src/core/skills/xiaoma-shard-doc/SKILL.md +1 -1
- package/src/core/tasks/xiaoma-create-prd/SKILL.md +1 -1
- package/src/core/tasks/xiaoma-create-prd/data/prd-purpose.md +4 -4
- package/src/core/tasks/xiaoma-create-prd/data/project-types.csv +1 -1
- package/src/core/tasks/xiaoma-create-prd/steps-c/step-11-polish.md +1 -1
- package/src/xmc/agents/analyst.agent.yaml +3 -3
- package/src/xmc/agents/qa.agent.yaml +1 -1
- package/src/xmc/agents/sm.agent.yaml +3 -3
- package/src/xmc/agents/tech-writer/tech-writer-sidecar/documentation-standards.md +2 -2
- package/src/xmc/agents/tech-writer/xiaoma-skill-manifest.yaml +1 -1
- package/src/xmc/agents/xiaoma-skill-manifest.yaml +8 -8
- package/src/xmc/module-help.csv +31 -31
- package/src/xmc/module.yaml +2 -2
- package/src/xmc/teams/default-party.csv +14 -14
- package/src/xmc/teams/team-fullstack.yaml +1 -1
- package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/steps/step-04-create-prd.md +2 -1
- package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/steps/step-05-validate-prd.md +3 -2
- package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/steps/step-06-create-epics.md +14 -5
- package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/steps/step-08-finalize.md +3 -3
- package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/workflow.md +1 -0
- package/src/xmc/workflows/1-analysis/research/xiaoma-domain-research/SKILL.md +1 -1
- package/src/xmc/workflows/1-analysis/research/xiaoma-market-research/SKILL.md +1 -1
- package/src/xmc/workflows/1-analysis/research/xiaoma-technical-research/SKILL.md +1 -1
- package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/SKILL.md +1 -1
- package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-02-vision.md +1 -0
- package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-03-users.md +1 -0
- package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-04-metrics.md +1 -0
- package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-05-scope.md +1 -0
- package/src/xmc/workflows/1-analysis/xiaoma-product-brief-preview/SKILL.md +1 -1
- package/src/xmc/workflows/1-analysis/xiaoma-product-brief-preview/prompts/contextual-discovery.md +7 -7
- package/src/xmc/workflows/1-analysis/xiaoma-product-brief-preview/prompts/draft-and-review.md +5 -5
- package/src/xmc/workflows/1-analysis/xiaoma-product-brief-preview/prompts/finalize.md +1 -1
- package/src/xmc/workflows/1-analysis/xiaoma-product-brief-preview/prompts/guided-elicitation.md +2 -2
- package/src/xmc/workflows/1-analysis/xiaoma-product-brief-preview/xiaoma-manifest.json +2 -2
- package/src/xmc/workflows/2-plan-workflows/create-prd/data/prd-purpose.md +4 -4
- package/src/xmc/workflows/2-plan-workflows/create-prd/data/project-types.csv +1 -1
- package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-01-discovery.md +1 -1
- package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-02-format-detection.md +16 -16
- package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-02b-parity-check.md +9 -9
- package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-03-density-validation.md +1 -1
- package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-11-holistic-quality-validation.md +8 -8
- package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-13-report-complete.md +1 -1
- package/src/xmc/workflows/2-plan-workflows/create-prd/workflow-validate-prd.md +2 -2
- package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/SKILL.md +1 -1
- package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/SKILL.md +1 -1
- package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-01-discovery.md +13 -17
- package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-01b-legacy-conversion.md +9 -13
- package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-02-review.md +4 -8
- package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-03-edit.md +9 -13
- package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-04-complete.md +2 -5
- package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/workflow.md +1 -2
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/SKILL.md +1 -1
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/data/prd-purpose.md +4 -4
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/data/project-types.csv +1 -1
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-01-discovery.md +1 -4
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-02-format-detection.md +16 -19
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-02b-parity-check.md +8 -11
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-03-density-validation.md +1 -4
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-04-brief-coverage-validation.md +0 -3
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-05-measurability-validation.md +0 -3
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-06-traceability-validation.md +0 -3
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-07-implementation-leakage-validation.md +0 -3
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-08-domain-compliance-validation.md +0 -3
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-09-project-type-validation.md +0 -3
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-10-smart-validation.md +0 -3
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-11-holistic-quality-validation.md +8 -11
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-12-completeness-validation.md +0 -3
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-13-report-complete.md +2 -5
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/workflow.md +2 -2
- package/src/xmc/workflows/3-solutioning/xiaoma-check-implementation-readiness/SKILL.md +1 -1
- package/src/xmc/workflows/3-solutioning/xiaoma-create-architecture/SKILL.md +1 -1
- package/src/xmc/workflows/3-solutioning/xiaoma-create-epics-and-stories/SKILL.md +1 -1
- package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-01-init-and-validate.md +6 -3
- package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-05-code-review.md +5 -6
- package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-07-fix-and-retest.md +14 -7
- package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-09-cycle-check.md +11 -2
- package/src/xmc/workflows/4-implementation/auto-story-pipeline/workflow.md +9 -8
- package/src/xmc/workflows/4-implementation/xiaoma-code-review/SKILL.md +2 -2
- package/src/xmc/workflows/4-implementation/xiaoma-code-review/steps/step-01-gather-context.md +61 -0
- package/src/xmc/workflows/4-implementation/xiaoma-code-review/steps/step-02-review.md +41 -0
- package/src/xmc/workflows/4-implementation/xiaoma-code-review/steps/step-03-triage.md +50 -0
- package/src/xmc/workflows/4-implementation/xiaoma-code-review/steps/step-04-present.md +38 -0
- package/src/xmc/workflows/4-implementation/xiaoma-code-review/workflow.md +33 -240
- package/src/xmc/workflows/4-implementation/xiaoma-correct-course/SKILL.md +1 -1
- package/src/xmc/workflows/4-implementation/xiaoma-correct-course/workflow.md +1 -1
- package/src/xmc/workflows/4-implementation/xiaoma-create-story/SKILL.md +1 -1
- package/src/xmc/workflows/4-implementation/xiaoma-create-story/workflow.md +3 -3
- package/src/xmc/workflows/4-implementation/xiaoma-dev-story/SKILL.md +1 -1
- package/src/xmc/workflows/4-implementation/xiaoma-dev-story/workflow.md +1 -1
- package/src/xmc/workflows/4-implementation/xiaoma-retrospective/SKILL.md +1 -1
- package/src/xmc/workflows/4-implementation/xiaoma-sprint-planning/SKILL.md +1 -1
- package/src/xmc/workflows/4-implementation/xiaoma-sprint-planning/workflow.md +2 -2
- package/src/xmc/workflows/4-implementation/xiaoma-sprint-status/SKILL.md +1 -1
- package/src/xmc/workflows/4-implementation/xiaoma-sprint-status/workflow.md +5 -5
- package/src/xmc/workflows/xiaoma-document-project/SKILL.md +1 -1
- package/src/xmc/workflows/xiaoma-document-project/templates/index-template.md +1 -1
- package/src/xmc/workflows/xiaoma-document-project/templates/project-overview-template.md +1 -1
- package/src/xmc/workflows/xiaoma-document-project/templates/source-tree-template.md +1 -1
- package/src/xmc/workflows/xiaoma-generate-project-context/SKILL.md +1 -1
- package/src/xmc/workflows/xiaoma-generate-project-context/steps/step-01-discover.md +3 -1
- package/src/xmc/workflows/xiaoma-generate-project-context/steps/step-02-generate.md +2 -0
- package/src/xmc/workflows/xiaoma-qa-generate-e2e-tests/SKILL.md +1 -1
- package/src/xmc/workflows/xiaoma-qa-generate-e2e-tests/checklist.md +1 -1
- package/src/xmc/workflows/xiaoma-qa-generate-e2e-tests/workflow.md +2 -2
- package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/SKILL.md +1 -1
- package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/steps/step-01-mode-detection.md +2 -2
- package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev-new-preview/SKILL.md +1 -1
- package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-spec/SKILL.md +1 -1
- package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-spec/workflow.md +1 -0
- package/tools/cli/README.md +4 -4
- package/tools/cli/commands/install.js +1 -1
- package/tools/cli/commands/status.js +4 -4
- package/tools/cli/commands/uninstall.js +9 -9
- package/tools/cli/external-official-modules.yaml +2 -54
- package/tools/cli/installers/install-messages.yaml +5 -5
- package/tools/cli/installers/lib/core/config-collector.js +2 -2
- package/tools/cli/installers/lib/core/dependency-resolver.js +2 -2
- package/tools/cli/installers/lib/core/detector.js +9 -9
- package/tools/cli/installers/lib/core/ide-config-manager.js +7 -7
- package/tools/cli/installers/lib/core/installer.js +51 -51
- package/tools/cli/installers/lib/core/manifest-generator.js +6 -6
- package/tools/cli/installers/lib/core/manifest.js +3 -3
- package/tools/cli/installers/lib/custom/handler.js +5 -5
- package/tools/cli/installers/lib/ide/_base-ide.js +15 -15
- package/tools/cli/installers/lib/ide/_config-driven.js +31 -31
- package/tools/cli/installers/lib/ide/manager.js +8 -8
- package/tools/cli/installers/lib/ide/platform-codes.yaml +3 -3
- package/tools/cli/installers/lib/ide/shared/agent-command-generator.js +3 -3
- package/tools/cli/installers/lib/ide/shared/path-utils.js +3 -3
- package/tools/cli/installers/lib/ide/shared/skill-manifest.js +2 -2
- package/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js +13 -13
- package/tools/cli/installers/lib/ide/shared/workflow-command-generator.js +2 -2
- package/tools/cli/installers/lib/ide/shared/xiaoma-artifacts.js +1 -1
- package/tools/cli/installers/lib/ide/templates/agent-command-template.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/antigravity.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/default-agent.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/default-task.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/default-tool.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/default-workflow.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/kiro-agent.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/kiro-task.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/kiro-tool.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/kiro-workflow.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/opencode-agent.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/opencode-task.md +3 -3
- package/tools/cli/installers/lib/ide/templates/combined/opencode-tool.md +3 -3
- package/tools/cli/installers/lib/ide/templates/combined/opencode-workflow-yaml.md +3 -3
- package/tools/cli/installers/lib/ide/templates/combined/opencode-workflow.md +3 -3
- package/tools/cli/installers/lib/ide/templates/combined/rovodev.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/trae.md +1 -1
- package/tools/cli/installers/lib/ide/templates/combined/windsurf-workflow.md +1 -1
- package/tools/cli/installers/lib/modules/manager.js +22 -22
- package/tools/cli/lib/agent/compiler.js +3 -3
- package/tools/cli/lib/agent/installer.js +9 -9
- package/tools/cli/lib/agent/template-engine.js +1 -1
- package/tools/cli/lib/agent-party-generator.js +3 -3
- package/tools/cli/lib/cli-utils.js +1 -1
- package/tools/cli/lib/project-root.js +5 -5
- package/tools/cli/lib/prompts.js +1 -1
- package/tools/cli/lib/ui.js +27 -27
- package/tools/cli/lib/xml-handler.js +1 -1
- package/tools/cli/lib/yaml-format.js +1 -1
- package/tools/cli/lib/yaml-xml-builder.js +2 -2
- package/tools/cli/xiaoma-cli.js +3 -3
- package/tools/platform-codes.yaml +2 -2
- package/tools/schema/agent.js +1 -1
- package/tools/xiaoma-npx-wrapper.js +1 -1
- package/.idea/codeStyles/Project.xml +0 -60
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -146
- package/AGENTS.md +0 -9
- package/README_CN.md +0 -121
- package/XIAOMA-CLI-GUIDE.md +0 -512
- package/src/core/skills/xiaoma-advanced-elicitation/SKILL.md.bak +0 -6
- package/src/core/skills/xiaoma-brainstorming/SKILL.md.bak +0 -6
- package/src/core/skills/xiaoma-distillator/SKILL.md.bak +0 -178
- package/src/core/skills/xiaoma-editorial-review-prose/SKILL.md.bak +0 -6
- package/src/core/skills/xiaoma-editorial-review-structure/SKILL.md.bak +0 -6
- package/src/core/skills/xiaoma-index-docs/SKILL.md.bak +0 -6
- package/src/core/skills/xiaoma-party-mode/SKILL.md.bak +0 -6
- package/src/core/skills/xiaoma-review-adversarial-general/SKILL.md.bak +0 -6
- package/src/core/skills/xiaoma-review-edge-case-hunter/SKILL.md.bak +0 -6
- package/src/core/skills/xiaoma-shard-doc/SKILL.md.bak +0 -6
- package/src/core/tasks/xiaoma-create-prd/SKILL.md.bak +0 -6
- package/src/xmc/workflows/1-analysis/research/xiaoma-domain-research/SKILL.md.bak +0 -6
- package/src/xmc/workflows/1-analysis/research/xiaoma-market-research/SKILL.md.bak +0 -6
- package/src/xmc/workflows/1-analysis/research/xiaoma-technical-research/SKILL.md.bak +0 -6
- package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/SKILL.md.bak +0 -6
- package/src/xmc/workflows/1-analysis/xiaoma-product-brief-preview/SKILL.md.bak +0 -88
- package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/SKILL.md.bak +0 -6
- package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/SKILL.md.bak +0 -6
- package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/SKILL.md.bak +0 -6
- package/src/xmc/workflows/3-solutioning/xiaoma-check-implementation-readiness/SKILL.md.bak +0 -6
- package/src/xmc/workflows/3-solutioning/xiaoma-create-architecture/SKILL.md.bak +0 -6
- package/src/xmc/workflows/3-solutioning/xiaoma-create-epics-and-stories/SKILL.md.bak +0 -6
- package/src/xmc/workflows/4-implementation/xiaoma-code-review/SKILL.md.bak +0 -6
- package/src/xmc/workflows/4-implementation/xiaoma-correct-course/SKILL.md.bak +0 -6
- package/src/xmc/workflows/4-implementation/xiaoma-create-story/SKILL.md.bak +0 -6
- package/src/xmc/workflows/4-implementation/xiaoma-dev-story/SKILL.md.bak +0 -6
- package/src/xmc/workflows/4-implementation/xiaoma-retrospective/SKILL.md.bak +0 -6
- package/src/xmc/workflows/4-implementation/xiaoma-sprint-planning/SKILL.md.bak +0 -6
- package/src/xmc/workflows/4-implementation/xiaoma-sprint-status/SKILL.md.bak +0 -6
- package/src/xmc/workflows/xiaoma-document-project/SKILL.md.bak +0 -6
- package/src/xmc/workflows/xiaoma-generate-project-context/SKILL.md.bak +0 -6
- package/src/xmc/workflows/xiaoma-qa-generate-e2e-tests/SKILL.md.bak +0 -6
- package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/SKILL.md.bak +0 -6
- package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev-new-preview/SKILL.md.bak +0 -6
- package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-spec/SKILL.md.bak +0 -6
- package/tools/format-workflow-md.js +0 -263
- package/tools/migrate-custom-module-paths.js +0 -124
- package/tools/skill-validator.md +0 -322
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BMAD Workflow Markdown Formatter
|
|
3
|
-
*
|
|
4
|
-
* Formats mixed markdown + XML workflow instruction files with:
|
|
5
|
-
* - 2-space XML indentation
|
|
6
|
-
* - Preserved markdown content
|
|
7
|
-
* - Proper tag nesting
|
|
8
|
-
* - Consistent formatting
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const fs = require('node:fs');
|
|
12
|
-
const path = require('node:path');
|
|
13
|
-
|
|
14
|
-
class WorkflowFormatter {
|
|
15
|
-
constructor(options = {}) {
|
|
16
|
-
this.indentSize = options.indentSize || 2;
|
|
17
|
-
this.preserveMarkdown = options.preserveMarkdown !== false;
|
|
18
|
-
this.verbose = options.verbose || false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Format a workflow markdown file
|
|
23
|
-
*/
|
|
24
|
-
format(filePath) {
|
|
25
|
-
if (this.verbose) {
|
|
26
|
-
console.log(`Formatting: ${filePath}`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
30
|
-
const formatted = this.formatContent(content);
|
|
31
|
-
|
|
32
|
-
// Only write if content changed
|
|
33
|
-
if (content === formatted) {
|
|
34
|
-
if (this.verbose) {
|
|
35
|
-
console.log(`- No changes: ${filePath}`);
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
} else {
|
|
39
|
-
fs.writeFileSync(filePath, formatted, 'utf8');
|
|
40
|
-
if (this.verbose) {
|
|
41
|
-
console.log(`✓ Formatted: ${filePath}`);
|
|
42
|
-
}
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Format content string with stateful indentation tracking
|
|
49
|
-
*/
|
|
50
|
-
formatContent(content) {
|
|
51
|
-
const lines = content.split('\n');
|
|
52
|
-
const formatted = [];
|
|
53
|
-
let indentLevel = 0;
|
|
54
|
-
let inCodeBlock = false;
|
|
55
|
-
let checkBlockDepth = 0; // Track nested check blocks
|
|
56
|
-
|
|
57
|
-
for (let i = 0; i < lines.length; i++) {
|
|
58
|
-
const line = lines[i];
|
|
59
|
-
const trimmed = line.trim();
|
|
60
|
-
|
|
61
|
-
// Track code blocks (don't format inside them)
|
|
62
|
-
if (trimmed.startsWith('```')) {
|
|
63
|
-
if (inCodeBlock) {
|
|
64
|
-
inCodeBlock = false;
|
|
65
|
-
} else {
|
|
66
|
-
inCodeBlock = true;
|
|
67
|
-
}
|
|
68
|
-
formatted.push(line);
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Don't format inside code blocks
|
|
73
|
-
if (inCodeBlock) {
|
|
74
|
-
formatted.push(line);
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Handle XML tags
|
|
79
|
-
if (this.isXMLLine(trimmed)) {
|
|
80
|
-
const result = this.formatXMLLine(trimmed, indentLevel, checkBlockDepth, i, lines);
|
|
81
|
-
formatted.push(result.line);
|
|
82
|
-
indentLevel = result.nextIndent;
|
|
83
|
-
checkBlockDepth = result.nextCheckDepth;
|
|
84
|
-
} else if (trimmed === '') {
|
|
85
|
-
// Preserve blank lines
|
|
86
|
-
formatted.push('');
|
|
87
|
-
} else {
|
|
88
|
-
// Markdown content - preserve as-is but maintain current indent if inside XML
|
|
89
|
-
formatted.push(line);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return formatted.join('\n');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Check if line contains XML tag
|
|
98
|
-
*/
|
|
99
|
-
isXMLLine(line) {
|
|
100
|
-
return /^<[a-zA-Z-]+(\s|>|\/)/.test(line) || /^<\/[a-zA-Z-]+>/.test(line);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Format a single XML line with context awareness
|
|
105
|
-
*/
|
|
106
|
-
formatXMLLine(line, currentIndent, checkDepth, lineIndex, allLines) {
|
|
107
|
-
const trimmed = line.trim();
|
|
108
|
-
let indent = currentIndent;
|
|
109
|
-
let nextIndent = currentIndent;
|
|
110
|
-
let nextCheckDepth = checkDepth;
|
|
111
|
-
|
|
112
|
-
// Get the tag name
|
|
113
|
-
const tagMatch = trimmed.match(/^<\/?([a-zA-Z-]+)/);
|
|
114
|
-
const tagName = tagMatch ? tagMatch[1] : '';
|
|
115
|
-
|
|
116
|
-
// Closing tag - decrease indent before this line
|
|
117
|
-
if (trimmed.startsWith('</')) {
|
|
118
|
-
indent = Math.max(0, currentIndent - 1);
|
|
119
|
-
nextIndent = indent;
|
|
120
|
-
|
|
121
|
-
// If closing a step, reset check depth
|
|
122
|
-
if (tagName === 'step' || tagName === 'workflow') {
|
|
123
|
-
nextCheckDepth = 0;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// Self-closing tags (opens and closes on same line)
|
|
127
|
-
// EXCEPT <check> tags which create logical blocks
|
|
128
|
-
else if (this.isSelfClosingTag(trimmed) && tagName !== 'check') {
|
|
129
|
-
// These don't change indent level
|
|
130
|
-
indent = currentIndent;
|
|
131
|
-
nextIndent = currentIndent;
|
|
132
|
-
}
|
|
133
|
-
// Opening tags
|
|
134
|
-
else if (trimmed.startsWith('<')) {
|
|
135
|
-
// Check if this is a <check> tag - these create logical blocks
|
|
136
|
-
if (tagName === 'check') {
|
|
137
|
-
indent = currentIndent;
|
|
138
|
-
// Check tags increase indent for following content
|
|
139
|
-
nextIndent = currentIndent + 1;
|
|
140
|
-
nextCheckDepth = checkDepth + 1;
|
|
141
|
-
}
|
|
142
|
-
// <action> tags inside check blocks stay at current indent
|
|
143
|
-
else if (tagName === 'action' && checkDepth > 0) {
|
|
144
|
-
indent = currentIndent;
|
|
145
|
-
nextIndent = currentIndent; // Don't increase further
|
|
146
|
-
}
|
|
147
|
-
// Other tags close check blocks and return to structural level
|
|
148
|
-
else if (checkDepth > 0) {
|
|
149
|
-
// Close all check blocks - return to base structural level
|
|
150
|
-
indent = Math.max(0, currentIndent - checkDepth);
|
|
151
|
-
nextIndent = indent + 1;
|
|
152
|
-
nextCheckDepth = 0;
|
|
153
|
-
}
|
|
154
|
-
// Regular opening tags (no check blocks active)
|
|
155
|
-
else {
|
|
156
|
-
indent = currentIndent;
|
|
157
|
-
nextIndent = currentIndent + 1;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const indentStr = ' '.repeat(indent * this.indentSize);
|
|
162
|
-
return {
|
|
163
|
-
line: indentStr + trimmed,
|
|
164
|
-
nextIndent: nextIndent,
|
|
165
|
-
nextCheckDepth: nextCheckDepth,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Check if tag opens and closes on same line
|
|
171
|
-
*/
|
|
172
|
-
isSelfClosingTag(line) {
|
|
173
|
-
// Self-closing with />
|
|
174
|
-
if (line.endsWith('/>')) {
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
// Opens and closes on same line: <tag>content</tag>
|
|
178
|
-
const match = line.match(/^<([a-zA-Z-]+)(\s[^>]*)?>.*<\/\1>$/);
|
|
179
|
-
return match !== null;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Check if tag is a block-level structural tag
|
|
184
|
-
*/
|
|
185
|
-
isBlockLevelTag(tagName) {
|
|
186
|
-
return ['step', 'workflow', 'check'].includes(tagName);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* CLI Entry Point
|
|
192
|
-
*/
|
|
193
|
-
function main() {
|
|
194
|
-
const args = process.argv.slice(2);
|
|
195
|
-
|
|
196
|
-
if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
|
|
197
|
-
console.log(`
|
|
198
|
-
BMAD Workflow Markdown Formatter
|
|
199
|
-
|
|
200
|
-
Usage:
|
|
201
|
-
node format-workflow-md.js <file-pattern> [options]
|
|
202
|
-
|
|
203
|
-
Options:
|
|
204
|
-
--verbose, -v Verbose output
|
|
205
|
-
--check, -c Check formatting without writing (exit 1 if changes needed)
|
|
206
|
-
--help, -h Show this help
|
|
207
|
-
|
|
208
|
-
Examples:
|
|
209
|
-
node format-workflow-md.js src/**/instructions.md
|
|
210
|
-
node format-workflow-md.js "src/modules/bmb/**/*.md" --verbose
|
|
211
|
-
node format-workflow-md.js file.md --check
|
|
212
|
-
`);
|
|
213
|
-
process.exit(0);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const verbose = args.includes('--verbose') || args.includes('-v');
|
|
217
|
-
const check = args.includes('--check') || args.includes('-c');
|
|
218
|
-
|
|
219
|
-
// Remove flags from args
|
|
220
|
-
const files = args.filter((arg) => !arg.startsWith('-'));
|
|
221
|
-
|
|
222
|
-
const formatter = new WorkflowFormatter({ verbose });
|
|
223
|
-
let hasChanges = false;
|
|
224
|
-
let formattedCount = 0;
|
|
225
|
-
|
|
226
|
-
// Process files
|
|
227
|
-
for (const pattern of files) {
|
|
228
|
-
// For now, treat as direct file path
|
|
229
|
-
// TODO: Add glob support for patterns
|
|
230
|
-
if (fs.existsSync(pattern)) {
|
|
231
|
-
const stat = fs.statSync(pattern);
|
|
232
|
-
if (stat.isFile()) {
|
|
233
|
-
const changed = formatter.format(pattern);
|
|
234
|
-
if (changed) {
|
|
235
|
-
hasChanges = true;
|
|
236
|
-
formattedCount++;
|
|
237
|
-
}
|
|
238
|
-
} else if (stat.isDirectory()) {
|
|
239
|
-
console.error(`Error: ${pattern} is a directory. Please specify file paths.`);
|
|
240
|
-
}
|
|
241
|
-
} else {
|
|
242
|
-
console.error(`Error: File not found: ${pattern}`);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (verbose || formattedCount > 0) {
|
|
247
|
-
console.log(`\nFormatted ${formattedCount} file(s)`);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (check && hasChanges) {
|
|
251
|
-
console.error('\n❌ Some files need formatting. Run without --check to format.');
|
|
252
|
-
process.exit(1);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
process.exit(0);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// Run if called directly
|
|
259
|
-
if (require.main === module) {
|
|
260
|
-
main();
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
module.exports = { WorkflowFormatter };
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Migration script to convert relative paths to absolute paths in custom module manifests
|
|
3
|
-
* This should be run once to update existing installations
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require('fs-extra');
|
|
7
|
-
const path = require('node:path');
|
|
8
|
-
const yaml = require('yaml');
|
|
9
|
-
const chalk = require('chalk');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Find XiaoMa directory in project
|
|
13
|
-
*/
|
|
14
|
-
function findXiaomaDir(projectDir = process.cwd()) {
|
|
15
|
-
const possibleNames = ['_xiaoma'];
|
|
16
|
-
|
|
17
|
-
for (const name of possibleNames) {
|
|
18
|
-
const xiaomaDir = path.join(projectDir, name);
|
|
19
|
-
if (fs.existsSync(xiaomaDir)) {
|
|
20
|
-
return xiaomaDir;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Update manifest to use absolute paths
|
|
29
|
-
*/
|
|
30
|
-
async function updateManifest(manifestPath, projectRoot) {
|
|
31
|
-
console.log(chalk.cyan(`\nUpdating manifest: ${manifestPath}`));
|
|
32
|
-
|
|
33
|
-
const content = await fs.readFile(manifestPath, 'utf8');
|
|
34
|
-
const manifest = yaml.parse(content);
|
|
35
|
-
|
|
36
|
-
if (!manifest.customModules || manifest.customModules.length === 0) {
|
|
37
|
-
console.log(chalk.dim(' No custom modules found'));
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let updated = false;
|
|
42
|
-
|
|
43
|
-
for (const customModule of manifest.customModules) {
|
|
44
|
-
if (customModule.relativePath && !customModule.sourcePath) {
|
|
45
|
-
// Convert relative path to absolute
|
|
46
|
-
const absolutePath = path.resolve(projectRoot, customModule.relativePath);
|
|
47
|
-
customModule.sourcePath = absolutePath;
|
|
48
|
-
|
|
49
|
-
// Remove the old relativePath
|
|
50
|
-
delete customModule.relativePath;
|
|
51
|
-
|
|
52
|
-
console.log(chalk.green(` ✓ Updated ${customModule.id}: ${customModule.relativePath} → ${absolutePath}`));
|
|
53
|
-
updated = true;
|
|
54
|
-
} else if (customModule.sourcePath && !path.isAbsolute(customModule.sourcePath)) {
|
|
55
|
-
// Source path exists but is not absolute
|
|
56
|
-
const absolutePath = path.resolve(customModule.sourcePath);
|
|
57
|
-
customModule.sourcePath = absolutePath;
|
|
58
|
-
|
|
59
|
-
console.log(chalk.green(` ✓ Updated ${customModule.id}: ${customModule.sourcePath} → ${absolutePath}`));
|
|
60
|
-
updated = true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (updated) {
|
|
65
|
-
// Write back the updated manifest
|
|
66
|
-
const yamlStr = yaml.dump(manifest, {
|
|
67
|
-
indent: 2,
|
|
68
|
-
lineWidth: -1,
|
|
69
|
-
noRefs: true,
|
|
70
|
-
sortKeys: false,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
await fs.writeFile(manifestPath, yamlStr);
|
|
74
|
-
console.log(chalk.green(' Manifest updated successfully'));
|
|
75
|
-
} else {
|
|
76
|
-
console.log(chalk.dim(' All paths already absolute'));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return updated;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Main migration function
|
|
84
|
-
*/
|
|
85
|
-
async function migrate(directory) {
|
|
86
|
-
const projectRoot = path.resolve(directory || process.cwd());
|
|
87
|
-
const xiaomaDir = findXiaomaDir(projectRoot);
|
|
88
|
-
|
|
89
|
-
if (!xiaomaDir) {
|
|
90
|
-
console.error(chalk.red('✗ No XiaoMa installation found in directory'));
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
console.log(chalk.blue.bold('🔄 XiaoMa Custom Module Path Migration'));
|
|
95
|
-
console.log(chalk.dim(`Project: ${projectRoot}`));
|
|
96
|
-
console.log(chalk.dim(`XiaoMa Directory: ${xiaomaDir}`));
|
|
97
|
-
|
|
98
|
-
const manifestPath = path.join(xiaomaDir, '_config', 'manifest.yaml');
|
|
99
|
-
|
|
100
|
-
if (!fs.existsSync(manifestPath)) {
|
|
101
|
-
console.error(chalk.red('✗ No manifest.yaml found'));
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const updated = await updateManifest(manifestPath, projectRoot);
|
|
106
|
-
|
|
107
|
-
if (updated) {
|
|
108
|
-
console.log(chalk.green.bold('\n✨ Migration completed successfully!'));
|
|
109
|
-
console.log(chalk.dim('Custom modules now use absolute source paths.'));
|
|
110
|
-
} else {
|
|
111
|
-
console.log(chalk.yellow('\n⚠ No migration needed - paths already absolute'));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Run migration if called directly
|
|
116
|
-
if (require.main === module) {
|
|
117
|
-
const directory = process.argv[2];
|
|
118
|
-
migrate(directory).catch((error) => {
|
|
119
|
-
console.error(chalk.red('\n✗ Migration failed:'), error.message);
|
|
120
|
-
process.exit(1);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
module.exports = { migrate };
|