@zeyue0329/xiaoma-cli 1.0.48 → 6.0.0-alpha.13
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 +0 -2
- package/custom/src/agents/commit-poet/commit-poet.agent.yaml +129 -0
- package/custom/src/agents/commit-poet/installation-guide.md +36 -0
- package/custom/src/agents/toolsmith/installation-guide.md +36 -0
- package/custom/src/agents/toolsmith/toolsmith-sidecar/instructions.md +70 -0
- package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/bundlers.md +111 -0
- package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/deploy.md +70 -0
- package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/docs.md +114 -0
- package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/installers.md +134 -0
- package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/modules.md +160 -0
- package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/tests.md +103 -0
- package/custom/src/agents/toolsmith/toolsmith-sidecar/memories.md +17 -0
- package/custom/src/agents/toolsmith/toolsmith.agent.yaml +108 -0
- package/docs/BUNDLE_DISTRIBUTION_SETUP.md +95 -0
- package/docs/agent-customization-guide.md +208 -0
- package/docs/custom-agent-installation.md +183 -0
- package/docs/document-sharding-guide.md +449 -0
- package/docs/ide-info/auggie.md +31 -0
- package/docs/ide-info/claude-code.md +25 -0
- package/docs/ide-info/cline.md +31 -0
- package/docs/ide-info/codex.md +21 -0
- package/docs/ide-info/crush.md +30 -0
- package/docs/ide-info/cursor.md +25 -0
- package/docs/ide-info/gemini.md +25 -0
- package/docs/ide-info/github-copilot.md +26 -0
- package/docs/ide-info/iflow.md +33 -0
- package/docs/ide-info/kilo.md +24 -0
- package/docs/ide-info/opencode.md +24 -0
- package/docs/ide-info/qwen.md +25 -0
- package/docs/ide-info/roo.md +27 -0
- package/docs/ide-info/rovo-dev.md +388 -0
- package/docs/ide-info/trae.md +25 -0
- package/docs/ide-info/windsurf.md +22 -0
- package/docs/index.md +144 -0
- package/docs/installers-bundlers/ide-injections.md +186 -0
- package/docs/installers-bundlers/installers-modules-platforms-reference.md +379 -0
- package/docs/rag/rag.md +812 -0
- package/docs/v4-to-v6-upgrade.md +220 -0
- package/docs/v6-open-items.md +17 -0
- package/docs/web-bundles-gemini-gpt-guide.md +468 -0
- package/eslint.config.mjs +133 -0
- package/package.json +41 -51
- package/prettier.config.mjs +32 -0
- package/src/core/_module-installer/install-config.yaml +29 -0
- package/src/core/_module-installer/installer.js +60 -0
- package/src/core/agents/xiaoma-master.agent.yaml +39 -0
- package/src/core/agents/xiaoma-web-orchestrator.agent.xml +113 -0
- package/src/core/resources/excalidraw/README.md +160 -0
- package/src/core/resources/excalidraw/excalidraw-helpers.md +127 -0
- package/src/core/resources/excalidraw/library-loader.md +50 -0
- package/src/core/resources/excalidraw/validate-json-instructions.md +79 -0
- package/src/core/tasks/advanced-elicitation-methods.csv +51 -0
- package/src/core/tasks/advanced-elicitation.xml +116 -0
- package/src/core/tasks/index-docs.xml +65 -0
- package/src/core/tasks/validate-workflow.xml +89 -0
- package/src/core/tasks/workflow.xml +235 -0
- package/src/core/tools/shard-doc.xml +109 -0
- package/src/core/workflows/brainstorming/brain-methods.csv +62 -0
- package/src/core/workflows/brainstorming/steps/step-01-session-setup.md +196 -0
- package/src/core/workflows/brainstorming/steps/step-01b-continue.md +121 -0
- package/src/core/workflows/brainstorming/steps/step-02a-user-selected.md +224 -0
- package/src/core/workflows/brainstorming/steps/step-02b-ai-recommended.md +236 -0
- package/src/core/workflows/brainstorming/steps/step-02c-random-selection.md +208 -0
- package/src/core/workflows/brainstorming/steps/step-02d-progressive-flow.md +263 -0
- package/src/core/workflows/brainstorming/steps/step-03-technique-execution.md +339 -0
- package/src/core/workflows/brainstorming/steps/step-04-idea-organization.md +302 -0
- package/src/core/workflows/brainstorming/template.md +15 -0
- package/src/core/workflows/brainstorming/workflow.md +51 -0
- package/src/core/workflows/party-mode/steps/step-01-agent-loading.md +138 -0
- package/src/core/workflows/party-mode/steps/step-02-discussion-orchestration.md +203 -0
- package/src/core/workflows/party-mode/steps/step-03-graceful-exit.md +159 -0
- package/src/core/workflows/party-mode/workflow.md +207 -0
- package/src/modules/cis/_module-installer/install-config.yaml +16 -0
- package/src/modules/cis/_module-installer/installer.js +92 -0
- package/src/modules/cis/agents/README.md +104 -0
- package/src/modules/cis/agents/brainstorming-coach.agent.yaml +29 -0
- package/src/modules/cis/agents/creative-problem-solver.agent.yaml +29 -0
- package/src/modules/cis/agents/design-thinking-coach.agent.yaml +29 -0
- package/src/modules/cis/agents/innovation-strategist.agent.yaml +29 -0
- package/src/modules/cis/agents/presentation-master.agent.yaml +61 -0
- package/src/modules/cis/agents/storyteller.agent.yaml +29 -0
- package/src/modules/cis/readme.md +153 -0
- package/src/modules/cis/teams/creative-squad.yaml +7 -0
- package/src/modules/cis/teams/default-party.csv +12 -0
- package/src/modules/cis/workflows/README.md +139 -0
- package/src/modules/cis/workflows/design-thinking/README.md +56 -0
- package/src/modules/cis/workflows/design-thinking/design-methods.csv +31 -0
- package/src/modules/cis/workflows/design-thinking/instructions.md +202 -0
- package/src/modules/cis/workflows/design-thinking/template.md +111 -0
- package/src/modules/cis/workflows/design-thinking/workflow.yaml +38 -0
- package/src/modules/cis/workflows/innovation-strategy/README.md +56 -0
- package/src/modules/cis/workflows/innovation-strategy/innovation-frameworks.csv +31 -0
- package/src/modules/cis/workflows/innovation-strategy/instructions.md +276 -0
- package/src/modules/cis/workflows/innovation-strategy/template.md +189 -0
- package/src/modules/cis/workflows/innovation-strategy/workflow.yaml +38 -0
- package/src/modules/cis/workflows/problem-solving/README.md +56 -0
- package/src/modules/cis/workflows/problem-solving/instructions.md +252 -0
- package/src/modules/cis/workflows/problem-solving/solving-methods.csv +31 -0
- package/src/modules/cis/workflows/problem-solving/template.md +165 -0
- package/src/modules/cis/workflows/problem-solving/workflow.yaml +38 -0
- package/src/modules/cis/workflows/storytelling/README.md +58 -0
- package/src/modules/cis/workflows/storytelling/instructions.md +293 -0
- package/src/modules/cis/workflows/storytelling/story-types.csv +26 -0
- package/src/modules/cis/workflows/storytelling/template.md +113 -0
- package/src/modules/cis/workflows/storytelling/workflow.yaml +38 -0
- package/src/modules/xmb/README.md +261 -0
- package/src/modules/xmb/_module-installer/install-config.yaml +28 -0
- package/src/modules/xmb/agents/xiaoma-builder.agent.yaml +71 -0
- package/src/modules/xmb/docs/agents/agent-compilation.md +340 -0
- package/src/modules/xmb/docs/agents/agent-menu-patterns.md +524 -0
- package/src/modules/xmb/docs/agents/expert-agent-architecture.md +364 -0
- package/src/modules/xmb/docs/agents/index.md +55 -0
- package/src/modules/xmb/docs/agents/kb.csv +0 -0
- package/src/modules/xmb/docs/agents/module-agent-architecture.md +367 -0
- package/src/modules/xmb/docs/agents/simple-agent-architecture.md +288 -0
- package/src/modules/xmb/docs/agents/understanding-agent-types.md +184 -0
- package/src/modules/xmb/docs/workflows/architecture.md +220 -0
- package/src/modules/xmb/docs/workflows/common-workflow-tools.csv +19 -0
- package/src/modules/xmb/docs/workflows/csv-data-file-standards.md +206 -0
- package/src/modules/xmb/docs/workflows/index.md +45 -0
- package/src/modules/xmb/docs/workflows/intent-vs-prescriptive-spectrum.md +220 -0
- package/src/modules/xmb/docs/workflows/kb.csv +0 -0
- package/src/modules/xmb/docs/workflows/step-template.md +283 -0
- package/src/modules/xmb/docs/workflows/terms.md +97 -0
- package/src/modules/xmb/docs/workflows/workflow-template.md +152 -0
- package/src/modules/xmb/reference/agents/expert-examples/journal-keeper/README.md +242 -0
- package/src/modules/xmb/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/breakthroughs.md +24 -0
- package/src/modules/xmb/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/instructions.md +108 -0
- package/src/modules/xmb/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/memories.md +46 -0
- package/src/modules/xmb/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/mood-patterns.md +39 -0
- package/src/modules/xmb/reference/agents/expert-examples/journal-keeper/journal-keeper.agent.yaml +152 -0
- package/src/modules/xmb/reference/agents/module-examples/README.md +50 -0
- package/src/modules/xmb/reference/agents/module-examples/security-engineer.agent.yaml +53 -0
- package/src/modules/xmb/reference/agents/module-examples/trend-analyst.agent.yaml +57 -0
- package/src/modules/xmb/reference/agents/simple-examples/README.md +223 -0
- package/src/modules/xmb/reference/agents/simple-examples/commit-poet.agent.yaml +126 -0
- package/src/modules/xmb/reference/readme.md +3 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/data/dietary-restrictions.csv +18 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/data/macro-calculator.csv +16 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/data/recipe-database.csv +28 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/steps/step-01-init.md +177 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/steps/step-01b-continue.md +150 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/steps/step-02-profile.md +164 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/steps/step-03-assessment.md +152 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/steps/step-04-strategy.md +182 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/steps/step-05-shopping.md +167 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/steps/step-06-prep-schedule.md +194 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/templates/assessment-section.md +25 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/templates/nutrition-plan.md +68 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/templates/prep-schedule-section.md +29 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/templates/profile-section.md +47 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/templates/shopping-section.md +37 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/templates/strategy-section.md +18 -0
- package/src/modules/xmb/reference/workflows/meal-prep-nutrition/workflow.md +58 -0
- package/src/modules/xmb/workflows/create-agent/data/agent-validation-checklist.md +174 -0
- package/src/modules/xmb/workflows/create-agent/data/brainstorm-context.md +153 -0
- package/src/modules/xmb/workflows/create-agent/data/communication-presets.csv +61 -0
- package/src/modules/xmb/workflows/create-agent/data/info-and-installation-guide.md +17 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/README.md +3 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/README.md +242 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/breakthroughs.md +24 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/instructions.md +108 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/memories.md +46 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/mood-patterns.md +39 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper.agent.yaml +152 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/module-examples/README.md +50 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/module-examples/security-engineer.agent.yaml +53 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/module-examples/trend-analyst.agent.yaml +57 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/simple-examples/README.md +223 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/agents/simple-examples/commit-poet.agent.yaml +126 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/data/dietary-restrictions.csv +18 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/data/macro-calculator.csv +16 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/data/recipe-database.csv +28 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-01-init.md +177 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-01b-continue.md +150 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-02-profile.md +164 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-03-assessment.md +152 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-04-strategy.md +182 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-05-shopping.md +167 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-06-prep-schedule.md +194 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/assessment-section.md +25 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/nutrition-plan.md +68 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/prep-schedule-section.md +29 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/profile-section.md +47 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/shopping-section.md +37 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/strategy-section.md +18 -0
- package/src/modules/xmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/workflow.md +58 -0
- package/src/modules/xmb/workflows/create-agent/data/validation-complete.md +305 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-01-brainstorm.md +145 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-02-discover.md +210 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-03-persona.md +260 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-04-commands.md +237 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-05-name.md +231 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-06-build.md +224 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-07-validate.md +234 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-08-setup.md +179 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-09-customize.md +197 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-10-build-tools.md +180 -0
- package/src/modules/xmb/workflows/create-agent/steps/step-11-celebrate.md +222 -0
- package/src/modules/xmb/workflows/create-agent/templates/agent_commands.md +21 -0
- package/src/modules/xmb/workflows/create-agent/templates/agent_persona.md +25 -0
- package/src/modules/xmb/workflows/create-agent/templates/agent_purpose_and_type.md +23 -0
- package/src/modules/xmb/workflows/create-agent/workflow.md +91 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-01-init.md +168 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-02-gather.md +233 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-03-tools-overview.md +127 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-04-core-tools.md +145 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-05-memory-requirements.md +136 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-06-external-tools.md +154 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-07-installation-guidance.md +159 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-08-tools-summary.md +167 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-09-design.md +239 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-10-plan-review.md +215 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-11-build.md +262 -0
- package/src/modules/xmb/workflows/create-workflow/steps/step-12-review.md +270 -0
- package/src/modules/xmb/workflows/create-workflow/templates/build-summary.md +36 -0
- package/src/modules/xmb/workflows/create-workflow/templates/completion-section.md +39 -0
- package/src/modules/xmb/workflows/create-workflow/templates/content-template.md +21 -0
- package/src/modules/xmb/workflows/create-workflow/templates/design-section.md +53 -0
- package/src/modules/xmb/workflows/create-workflow/templates/project-info.md +18 -0
- package/src/modules/xmb/workflows/create-workflow/templates/requirements-section.md +47 -0
- package/src/modules/xmb/workflows/create-workflow/templates/review-section.md +56 -0
- package/src/modules/xmb/workflows/create-workflow/templates/step-file.md +139 -0
- package/src/modules/xmb/workflows/create-workflow/templates/workflow-plan.md +54 -0
- package/src/modules/xmb/workflows/create-workflow/templates/workflow.md +58 -0
- package/src/modules/xmb/workflows/create-workflow/workflow.md +58 -0
- package/src/modules/xmb/workflows/edit-agent/steps/step-01-discover-intent.md +134 -0
- package/src/modules/xmb/workflows/edit-agent/steps/step-02-analyze-agent.md +202 -0
- package/src/modules/xmb/workflows/edit-agent/steps/step-03-propose-changes.md +157 -0
- package/src/modules/xmb/workflows/edit-agent/steps/step-04-apply-changes.md +150 -0
- package/src/modules/xmb/workflows/edit-agent/steps/step-05-validate.md +150 -0
- package/src/modules/xmb/workflows/edit-agent/workflow.md +58 -0
- package/src/modules/xmb/workflows/edit-workflow/steps/step-01-analyze.md +221 -0
- package/src/modules/xmb/workflows/edit-workflow/steps/step-02-discover.md +253 -0
- package/src/modules/xmb/workflows/edit-workflow/steps/step-03-improve.md +217 -0
- package/src/modules/xmb/workflows/edit-workflow/steps/step-04-validate.md +193 -0
- package/src/modules/xmb/workflows/edit-workflow/steps/step-05-compliance-check.md +245 -0
- package/src/modules/xmb/workflows/edit-workflow/templates/completion-summary.md +75 -0
- package/src/modules/xmb/workflows/edit-workflow/templates/improvement-goals.md +68 -0
- package/src/modules/xmb/workflows/edit-workflow/templates/improvement-log.md +40 -0
- package/src/modules/xmb/workflows/edit-workflow/templates/validation-results.md +51 -0
- package/src/modules/xmb/workflows/edit-workflow/templates/workflow-analysis.md +56 -0
- package/src/modules/xmb/workflows/edit-workflow/workflow.md +58 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/steps/step-01-validate-goal.md +152 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/steps/step-02-workflow-validation.md +243 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/steps/step-03-step-validation.md +274 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/steps/step-04-file-validation.md +295 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/steps/step-05-intent-spectrum-validation.md +264 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/steps/step-06-web-subprocess-validation.md +360 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/steps/step-07-holistic-analysis.md +258 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/steps/step-08-generate-report.md +301 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/templates/compliance-report.md +140 -0
- package/src/modules/xmb/workflows/workflow-compliance-check/workflow.md +58 -0
- package/src/modules/xmb/workflows-legacy/create-module/README.md +229 -0
- package/src/modules/xmb/workflows-legacy/create-module/brainstorm-context.md +137 -0
- package/src/modules/xmb/workflows-legacy/create-module/checklist.md +235 -0
- package/src/modules/xmb/workflows-legacy/create-module/installer-templates/install-config.yaml +92 -0
- package/src/modules/xmb/workflows-legacy/create-module/installer-templates/installer.js +231 -0
- package/src/modules/xmb/workflows-legacy/create-module/instructions.md +577 -0
- package/src/modules/xmb/workflows-legacy/create-module/module-structure.md +400 -0
- package/src/modules/xmb/workflows-legacy/create-module/workflow.yaml +52 -0
- package/src/modules/xmb/workflows-legacy/edit-module/README.md +187 -0
- package/src/modules/xmb/workflows-legacy/edit-module/checklist.md +165 -0
- package/src/modules/xmb/workflows-legacy/edit-module/instructions.md +341 -0
- package/src/modules/xmb/workflows-legacy/edit-module/workflow.yaml +34 -0
- package/src/modules/xmb/workflows-legacy/module-brief/README.md +264 -0
- package/src/modules/xmb/workflows-legacy/module-brief/checklist.md +116 -0
- package/src/modules/xmb/workflows-legacy/module-brief/instructions.md +268 -0
- package/src/modules/xmb/workflows-legacy/module-brief/template.md +275 -0
- package/src/modules/xmb/workflows-legacy/module-brief/workflow.yaml +36 -0
- package/src/modules/xmc/README.md +128 -0
- package/src/modules/xmc/_module-installer/install-config.yaml +53 -0
- package/src/modules/xmc/_module-installer/installer.js +131 -0
- package/src/modules/xmc/_module-installer/platform-specifics/claude-code.js +35 -0
- package/src/modules/xmc/_module-installer/platform-specifics/windsurf.js +32 -0
- package/src/modules/xmc/agents/analyst.agent.yaml +49 -0
- package/src/modules/xmc/agents/architect.agent.yaml +52 -0
- package/src/modules/xmc/agents/auto-iteration-orchestrator.agent.yaml +115 -0
- package/src/modules/xmc/agents/dev.agent.yaml +44 -0
- package/src/modules/xmc/agents/pm.agent.yaml +50 -0
- package/src/modules/xmc/agents/quick-flow-solo-dev.agent.yaml +36 -0
- package/src/modules/xmc/agents/sm.agent.yaml +55 -0
- package/src/modules/xmc/agents/tea.agent.yaml +70 -0
- package/src/modules/xmc/agents/tech-writer.agent.yaml +67 -0
- package/src/modules/xmc/agents/ux-designer.agent.yaml +45 -0
- package/src/modules/xmc/data/README.md +29 -0
- package/src/modules/xmc/data/documentation-standards.md +262 -0
- package/src/modules/xmc/data/project-context-template.md +40 -0
- package/src/modules/xmc/docs/README.md +252 -0
- package/src/modules/xmc/docs/agents-guide.md +952 -0
- package/src/modules/xmc/docs/brownfield-guide.md +750 -0
- package/src/modules/xmc/docs/enterprise-agentic-development.md +686 -0
- package/src/modules/xmc/docs/faq.md +561 -0
- package/src/modules/xmc/docs/glossary.md +303 -0
- package/src/modules/xmc/docs/images/workflow-method-greenfield.excalidraw +5174 -0
- package/src/modules/xmc/docs/images/workflow-method-greenfield.svg +2 -0
- package/src/modules/xmc/docs/iteration-development-guide.md +752 -0
- package/src/modules/xmc/docs/party-mode.md +224 -0
- package/src/modules/xmc/docs/quick-flow-solo-dev.md +337 -0
- package/src/modules/xmc/docs/quick-start.md +367 -0
- package/src/modules/xmc/docs/scale-adaptive-system.md +618 -0
- package/src/modules/xmc/docs/test-architecture.md +462 -0
- package/src/modules/xmc/docs/workflow-architecture-reference.md +366 -0
- package/src/modules/xmc/docs/workflow-document-project-reference.md +489 -0
- package/src/modules/xmc/docs/workflows-analysis.md +266 -0
- package/src/modules/xmc/docs/workflows-implementation.md +171 -0
- package/src/modules/xmc/docs/workflows-planning.md +451 -0
- package/src/modules/xmc/docs/workflows-solutioning.md +509 -0
- package/src/modules/xmc/docs/xiaoma-quick-flow.md +528 -0
- package/src/modules/xmc/sub-modules/claude-code/config.yaml +5 -0
- package/src/modules/xmc/sub-modules/claude-code/injections.yaml +242 -0
- package/src/modules/xmc/sub-modules/claude-code/readme.md +87 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-analysis/api-documenter.md +102 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-analysis/codebase-analyzer.md +82 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-analysis/data-analyst.md +101 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-analysis/pattern-detector.md +84 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-planning/dependency-mapper.md +83 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-planning/epic-optimizer.md +81 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-planning/requirements-analyst.md +61 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-planning/technical-decisions-curator.md +168 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-planning/trend-spotter.md +115 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-planning/user-journey-mapper.md +123 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-planning/user-researcher.md +72 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-research/market-researcher.md +51 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-research/tech-debt-auditor.md +106 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-review/document-reviewer.md +102 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-review/technical-evaluator.md +68 -0
- package/src/modules/xmc/sub-modules/claude-code/sub-agents/bmad-review/test-coverage-analyzer.md +108 -0
- package/src/modules/xmc/teams/default-party.csv +21 -0
- package/src/modules/xmc/teams/team-fullstack.yaml +12 -0
- package/src/modules/xmc/testarch/knowledge/api-request.md +303 -0
- package/src/modules/xmc/testarch/knowledge/auth-session.md +356 -0
- package/src/modules/xmc/testarch/knowledge/burn-in.md +273 -0
- package/src/modules/xmc/testarch/knowledge/ci-burn-in.md +675 -0
- package/src/modules/xmc/testarch/knowledge/component-tdd.md +486 -0
- package/src/modules/xmc/testarch/knowledge/contract-testing.md +957 -0
- package/src/modules/xmc/testarch/knowledge/data-factories.md +500 -0
- package/src/modules/xmc/testarch/knowledge/email-auth.md +721 -0
- package/src/modules/xmc/testarch/knowledge/error-handling.md +725 -0
- package/src/modules/xmc/testarch/knowledge/feature-flags.md +750 -0
- package/src/modules/xmc/testarch/knowledge/file-utils.md +260 -0
- package/src/modules/xmc/testarch/knowledge/fixture-architecture.md +401 -0
- package/src/modules/xmc/testarch/knowledge/fixtures-composition.md +382 -0
- package/src/modules/xmc/testarch/knowledge/intercept-network-call.md +280 -0
- package/src/modules/xmc/testarch/knowledge/log.md +294 -0
- package/src/modules/xmc/testarch/knowledge/network-error-monitor.md +272 -0
- package/src/modules/xmc/testarch/knowledge/network-first.md +486 -0
- package/src/modules/xmc/testarch/knowledge/network-recorder.md +265 -0
- package/src/modules/xmc/testarch/knowledge/nfr-criteria.md +670 -0
- package/src/modules/xmc/testarch/knowledge/overview.md +284 -0
- package/src/modules/xmc/testarch/knowledge/playwright-config.md +730 -0
- package/src/modules/xmc/testarch/knowledge/probability-impact.md +601 -0
- package/src/modules/xmc/testarch/knowledge/recurse.md +296 -0
- package/src/modules/xmc/testarch/knowledge/risk-governance.md +615 -0
- package/src/modules/xmc/testarch/knowledge/selective-testing.md +732 -0
- package/src/modules/xmc/testarch/knowledge/selector-resilience.md +527 -0
- package/src/modules/xmc/testarch/knowledge/test-healing-patterns.md +644 -0
- package/src/modules/xmc/testarch/knowledge/test-levels-framework.md +473 -0
- package/src/modules/xmc/testarch/knowledge/test-priorities-matrix.md +373 -0
- package/src/modules/xmc/testarch/knowledge/test-quality.md +664 -0
- package/src/modules/xmc/testarch/knowledge/timing-debugging.md +372 -0
- package/src/modules/xmc/testarch/knowledge/visual-debugging.md +524 -0
- package/src/modules/xmc/testarch/tea-index.csv +33 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/product-brief.template.md +8 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/steps/step-01-init.md +192 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/steps/step-01b-continue.md +167 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/steps/step-02-vision.md +203 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/steps/step-03-users.md +206 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/steps/step-04-metrics.md +209 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/steps/step-05-scope.md +223 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/steps/step-06-complete.md +199 -0
- package/src/modules/xmc/workflows/1-analysis/product-brief/workflow.md +58 -0
- package/src/modules/xmc/workflows/1-analysis/research/domain-steps/step-01-init.md +136 -0
- package/src/modules/xmc/workflows/1-analysis/research/domain-steps/step-02-domain-analysis.md +228 -0
- package/src/modules/xmc/workflows/1-analysis/research/domain-steps/step-03-competitive-landscape.md +237 -0
- package/src/modules/xmc/workflows/1-analysis/research/domain-steps/step-04-regulatory-focus.md +205 -0
- package/src/modules/xmc/workflows/1-analysis/research/domain-steps/step-05-technical-trends.md +233 -0
- package/src/modules/xmc/workflows/1-analysis/research/domain-steps/step-06-research-synthesis.md +443 -0
- package/src/modules/xmc/workflows/1-analysis/research/market-steps/step-01-init.md +182 -0
- package/src/modules/xmc/workflows/1-analysis/research/market-steps/step-02-customer-behavior.md +235 -0
- package/src/modules/xmc/workflows/1-analysis/research/market-steps/step-02-customer-insights.md +198 -0
- package/src/modules/xmc/workflows/1-analysis/research/market-steps/step-03-customer-pain-points.md +247 -0
- package/src/modules/xmc/workflows/1-analysis/research/market-steps/step-04-customer-decisions.md +257 -0
- package/src/modules/xmc/workflows/1-analysis/research/market-steps/step-05-competitive-analysis.md +175 -0
- package/src/modules/xmc/workflows/1-analysis/research/market-steps/step-06-research-completion.md +475 -0
- package/src/modules/xmc/workflows/1-analysis/research/research.template.md +16 -0
- package/src/modules/xmc/workflows/1-analysis/research/technical-steps/step-01-init.md +136 -0
- package/src/modules/xmc/workflows/1-analysis/research/technical-steps/step-02-technical-overview.md +237 -0
- package/src/modules/xmc/workflows/1-analysis/research/technical-steps/step-03-integration-patterns.md +246 -0
- package/src/modules/xmc/workflows/1-analysis/research/technical-steps/step-04-architectural-patterns.md +200 -0
- package/src/modules/xmc/workflows/1-analysis/research/technical-steps/step-05-implementation-research.md +237 -0
- package/src/modules/xmc/workflows/1-analysis/research/technical-steps/step-06-research-synthesis.md +486 -0
- package/src/modules/xmc/workflows/1-analysis/research/workflow.md +198 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-01-init.md +159 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-01b-continue.md +126 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-02-discovery.md +209 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-03-core-experience.md +215 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-04-emotional-response.md +218 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-05-inspiration.md +233 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-06-design-system.md +251 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-07-defining-experience.md +253 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-08-visual-foundation.md +223 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-09-design-directions.md +223 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-10-user-journeys.md +240 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-11-component-strategy.md +247 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-12-ux-patterns.md +236 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-13-responsive-accessibility.md +263 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/steps/step-14-complete.md +226 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/ux-design-template.md +13 -0
- package/src/modules/xmc/workflows/2-plan-workflows/create-ux-design/workflow.md +53 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/domain-complexity.csv +13 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/prd-template.md +9 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/project-types.csv +11 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-01-init.md +161 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-01b-continue.md +123 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-02-discovery.md +275 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-03-success.md +271 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-04-journeys.md +272 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-05-domain.md +249 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-06-innovation.md +240 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-07-project-type.md +236 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-08-scoping.md +280 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-09-functional.md +251 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-10-nonfunctional.md +275 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/steps/step-11-complete.md +210 -0
- package/src/modules/xmc/workflows/2-plan-workflows/prd/workflow.md +61 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/architecture-decision-template.md +13 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/data/domain-complexity.csv +11 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/data/project-types.csv +7 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-01-init.md +194 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-01b-continue.md +163 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-02-context.md +223 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-03-starter.md +330 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-04-decisions.md +317 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-05-patterns.md +358 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-06-structure.md +378 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-07-validation.md +358 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/steps/step-08-complete.md +351 -0
- package/src/modules/xmc/workflows/3-solutioning/architecture/workflow.md +48 -0
- package/src/modules/xmc/workflows/3-solutioning/create-epics-and-stories/epics-template.md +80 -0
- package/src/modules/xmc/workflows/3-solutioning/create-epics-and-stories/instructions.md +387 -0
- package/src/modules/xmc/workflows/3-solutioning/create-epics-and-stories/workflow.yaml +53 -0
- package/src/modules/xmc/workflows/3-solutioning/implementation-readiness/checklist.md +169 -0
- package/src/modules/xmc/workflows/3-solutioning/implementation-readiness/instructions.md +332 -0
- package/src/modules/xmc/workflows/3-solutioning/implementation-readiness/template.md +146 -0
- package/src/modules/xmc/workflows/3-solutioning/implementation-readiness/workflow.yaml +64 -0
- package/src/modules/xmc/workflows/4-implementation/code-review/instructions.xml +176 -0
- package/src/modules/xmc/workflows/4-implementation/code-review/workflow.yaml +54 -0
- package/src/modules/xmc/workflows/4-implementation/correct-course/checklist.md +279 -0
- package/src/modules/xmc/workflows/4-implementation/correct-course/instructions.md +206 -0
- package/src/modules/xmc/workflows/4-implementation/correct-course/workflow.yaml +58 -0
- package/src/modules/xmc/workflows/4-implementation/create-story/checklist.md +358 -0
- package/src/modules/xmc/workflows/4-implementation/create-story/instructions.xml +354 -0
- package/src/modules/xmc/workflows/4-implementation/create-story/template.md +51 -0
- package/src/modules/xmc/workflows/4-implementation/create-story/workflow.yaml +60 -0
- package/src/modules/xmc/workflows/4-implementation/dev-story/checklist.md +80 -0
- package/src/modules/xmc/workflows/4-implementation/dev-story/instructions.xml +406 -0
- package/src/modules/xmc/workflows/4-implementation/dev-story/workflow.yaml +27 -0
- package/src/modules/xmc/workflows/4-implementation/retrospective/instructions.md +1443 -0
- package/src/modules/xmc/workflows/4-implementation/retrospective/workflow.yaml +57 -0
- package/src/modules/xmc/workflows/4-implementation/sprint-planning/checklist.md +33 -0
- package/src/modules/xmc/workflows/4-implementation/sprint-planning/instructions.md +232 -0
- package/src/modules/xmc/workflows/4-implementation/sprint-planning/sprint-status-template.yaml +56 -0
- package/src/modules/xmc/workflows/4-implementation/sprint-planning/workflow.yaml +53 -0
- package/src/modules/xmc/workflows/auto-iteration/full-auto-workflow.md +692 -0
- package/src/modules/xmc/workflows/auto-iteration/knowledge-base/kb-call-points.md +595 -0
- package/src/modules/xmc/workflows/auto-iteration/knowledge-base/kb-interface.md +347 -0
- package/src/modules/xmc/workflows/auto-iteration/knowledge-base/kb-query.md +368 -0
- package/src/modules/xmc/workflows/auto-iteration/knowledge-base/kb-setup.md +343 -0
- package/src/modules/xmc/workflows/auto-iteration/phases/phase-1-analyze.md +406 -0
- package/src/modules/xmc/workflows/auto-iteration/phases/phase-2-plan.md +574 -0
- package/src/modules/xmc/workflows/auto-iteration/phases/phase-3-design.md +628 -0
- package/src/modules/xmc/workflows/auto-iteration/phases/phase-4-develop.md +622 -0
- package/src/modules/xmc/workflows/auto-iteration/phases/phase-5-test.md +538 -0
- package/src/modules/xmc/workflows/auto-iteration/resume.md +254 -0
- package/src/modules/xmc/workflows/auto-iteration/status.md +194 -0
- package/src/modules/xmc/workflows/auto-iteration/templates/auto-iteration-status.template.yaml +142 -0
- package/src/modules/xmc/workflows/bmad-quick-flow/create-tech-spec/instructions.md +115 -0
- package/src/modules/xmc/workflows/bmad-quick-flow/create-tech-spec/workflow.yaml +26 -0
- package/src/modules/xmc/workflows/bmad-quick-flow/quick-dev/checklist.md +25 -0
- package/src/modules/xmc/workflows/bmad-quick-flow/quick-dev/instructions.md +105 -0
- package/src/modules/xmc/workflows/bmad-quick-flow/quick-dev/workflow.yaml +29 -0
- package/src/modules/xmc/workflows/diagrams/_shared/excalidraw-library.json +90 -0
- package/src/modules/xmc/workflows/diagrams/_shared/excalidraw-templates.yaml +127 -0
- package/src/modules/xmc/workflows/diagrams/create-dataflow/checklist.md +39 -0
- package/src/modules/xmc/workflows/diagrams/create-dataflow/instructions.md +130 -0
- package/src/modules/xmc/workflows/diagrams/create-dataflow/workflow.yaml +27 -0
- package/src/modules/xmc/workflows/diagrams/create-diagram/checklist.md +43 -0
- package/src/modules/xmc/workflows/diagrams/create-diagram/instructions.md +141 -0
- package/src/modules/xmc/workflows/diagrams/create-diagram/workflow.yaml +27 -0
- package/src/modules/xmc/workflows/diagrams/create-flowchart/checklist.md +49 -0
- package/src/modules/xmc/workflows/diagrams/create-flowchart/instructions.md +241 -0
- package/src/modules/xmc/workflows/diagrams/create-flowchart/workflow.yaml +27 -0
- package/src/modules/xmc/workflows/diagrams/create-wireframe/checklist.md +38 -0
- package/src/modules/xmc/workflows/diagrams/create-wireframe/instructions.md +133 -0
- package/src/modules/xmc/workflows/diagrams/create-wireframe/workflow.yaml +27 -0
- package/src/modules/xmc/workflows/document-project/checklist.md +245 -0
- package/src/modules/xmc/workflows/document-project/documentation-requirements.csv +12 -0
- package/src/modules/xmc/workflows/document-project/instructions.md +222 -0
- package/src/modules/xmc/workflows/document-project/templates/deep-dive-template.md +345 -0
- package/src/modules/xmc/workflows/document-project/templates/index-template.md +169 -0
- package/src/modules/xmc/workflows/document-project/templates/project-overview-template.md +103 -0
- package/src/modules/xmc/workflows/document-project/templates/project-scan-report-schema.json +160 -0
- package/src/modules/xmc/workflows/document-project/templates/source-tree-template.md +135 -0
- package/src/modules/xmc/workflows/document-project/workflow.yaml +31 -0
- package/src/modules/xmc/workflows/document-project/workflows/deep-dive-instructions.md +298 -0
- package/src/modules/xmc/workflows/document-project/workflows/deep-dive.yaml +31 -0
- package/src/modules/xmc/workflows/document-project/workflows/full-scan-instructions.md +1106 -0
- package/src/modules/xmc/workflows/document-project/workflows/full-scan.yaml +31 -0
- package/src/modules/xmc/workflows/generate-project-context/project-context-template.md +20 -0
- package/src/modules/xmc/workflows/generate-project-context/steps/step-01-discover.md +193 -0
- package/src/modules/xmc/workflows/generate-project-context/steps/step-02-generate.md +317 -0
- package/src/modules/xmc/workflows/generate-project-context/steps/step-03-complete.md +277 -0
- package/src/modules/xmc/workflows/generate-project-context/workflow.md +48 -0
- package/src/modules/xmc/workflows/testarch/atdd/atdd-checklist-template.md +363 -0
- package/src/modules/xmc/workflows/testarch/atdd/checklist.md +373 -0
- package/src/modules/xmc/workflows/testarch/atdd/instructions.md +805 -0
- package/src/modules/xmc/workflows/testarch/atdd/workflow.yaml +47 -0
- package/src/modules/xmc/workflows/testarch/automate/checklist.md +580 -0
- package/src/modules/xmc/workflows/testarch/automate/instructions.md +1324 -0
- package/src/modules/xmc/workflows/testarch/automate/workflow.yaml +54 -0
- package/src/modules/xmc/workflows/testarch/ci/checklist.md +246 -0
- package/src/modules/xmc/workflows/testarch/ci/github-actions-template.yaml +165 -0
- package/src/modules/xmc/workflows/testarch/ci/gitlab-ci-template.yaml +128 -0
- package/src/modules/xmc/workflows/testarch/ci/instructions.md +534 -0
- package/src/modules/xmc/workflows/testarch/ci/workflow.yaml +47 -0
- package/src/modules/xmc/workflows/testarch/framework/checklist.md +321 -0
- package/src/modules/xmc/workflows/testarch/framework/instructions.md +481 -0
- package/src/modules/xmc/workflows/testarch/framework/workflow.yaml +49 -0
- package/src/modules/xmc/workflows/testarch/nfr-assess/checklist.md +405 -0
- package/src/modules/xmc/workflows/testarch/nfr-assess/instructions.md +722 -0
- package/src/modules/xmc/workflows/testarch/nfr-assess/nfr-report-template.md +443 -0
- package/src/modules/xmc/workflows/testarch/nfr-assess/workflow.yaml +49 -0
- package/src/modules/xmc/workflows/testarch/test-design/checklist.md +234 -0
- package/src/modules/xmc/workflows/testarch/test-design/instructions.md +788 -0
- package/src/modules/xmc/workflows/testarch/test-design/test-design-template.md +285 -0
- package/src/modules/xmc/workflows/testarch/test-design/workflow.yaml +50 -0
- package/src/modules/xmc/workflows/testarch/test-review/checklist.md +470 -0
- package/src/modules/xmc/workflows/testarch/test-review/instructions.md +628 -0
- package/src/modules/xmc/workflows/testarch/test-review/test-review-template.md +388 -0
- package/src/modules/xmc/workflows/testarch/test-review/workflow.yaml +48 -0
- package/src/modules/xmc/workflows/testarch/trace/checklist.md +654 -0
- package/src/modules/xmc/workflows/testarch/trace/instructions.md +1045 -0
- package/src/modules/xmc/workflows/testarch/trace/trace-template.md +673 -0
- package/src/modules/xmc/workflows/testarch/trace/workflow.yaml +57 -0
- package/src/modules/xmc/workflows/workflow-status/init/instructions.md +331 -0
- package/src/modules/xmc/workflows/workflow-status/init/workflow.yaml +29 -0
- package/src/modules/xmc/workflows/workflow-status/instructions.md +395 -0
- package/src/modules/xmc/workflows/workflow-status/paths/enterprise-brownfield.yaml +127 -0
- package/src/modules/xmc/workflows/workflow-status/paths/enterprise-greenfield.yaml +115 -0
- package/src/modules/xmc/workflows/workflow-status/paths/method-brownfield.yaml +111 -0
- package/src/modules/xmc/workflows/workflow-status/paths/method-greenfield.yaml +102 -0
- package/src/modules/xmc/workflows/workflow-status/project-levels.yaml +59 -0
- package/src/modules/xmc/workflows/workflow-status/workflow-status-template.yaml +24 -0
- package/src/modules/xmc/workflows/workflow-status/workflow.yaml +30 -0
- package/src/utility/models/action-command-header.md +0 -0
- package/src/utility/models/agent-activation-ide.xml +51 -0
- package/src/utility/models/agent-activation-web.xml +50 -0
- package/src/utility/models/agent-command-header.md +1 -0
- package/src/utility/models/agent-config-template.md +23 -0
- package/src/utility/models/agent-in-team-activation.xml +3 -0
- package/src/utility/models/fragments/activation-rules.xml +7 -0
- package/src/utility/models/fragments/activation-steps.xml +16 -0
- package/src/utility/models/fragments/handler-action.xml +4 -0
- package/src/utility/models/fragments/handler-data.xml +5 -0
- package/src/utility/models/fragments/handler-exec.xml +6 -0
- package/src/utility/models/fragments/handler-multi.xml +14 -0
- package/src/utility/models/fragments/handler-tmpl.xml +5 -0
- package/src/utility/models/fragments/handler-validate-workflow.xml +7 -0
- package/src/utility/models/fragments/handler-workflow.xml +9 -0
- package/src/utility/models/fragments/menu-handlers.xml +6 -0
- package/src/utility/models/fragments/web-bundle-activation-steps.xml +32 -0
- package/src/utility/templates/agent.customize.template.yaml +42 -0
- package/test/README.md +295 -0
- package/test/fixtures/agent-schema/invalid/critical-actions/actions-as-string.agent.yaml +26 -0
- package/test/fixtures/agent-schema/invalid/critical-actions/empty-string-in-actions.agent.yaml +29 -0
- package/test/fixtures/agent-schema/invalid/menu/empty-menu.agent.yaml +21 -0
- package/test/fixtures/agent-schema/invalid/menu/missing-menu.agent.yaml +19 -0
- package/test/fixtures/agent-schema/invalid/menu-commands/empty-command-target.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/menu-commands/no-command-target.agent.yaml +23 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/camel-case.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/duplicate-triggers.agent.yaml +30 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/empty-trigger.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/leading-asterisk.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/snake-case.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/trigger-with-spaces.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/metadata/core-agent-with-module.agent.yaml +26 -0
- package/test/fixtures/agent-schema/invalid/metadata/empty-module-string.agent.yaml +26 -0
- package/test/fixtures/agent-schema/invalid/metadata/empty-name.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/metadata/extra-metadata-fields.agent.yaml +26 -0
- package/test/fixtures/agent-schema/invalid/metadata/missing-id.agent.yaml +23 -0
- package/test/fixtures/agent-schema/invalid/metadata/module-agent-missing-module.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/metadata/wrong-module-value.agent.yaml +26 -0
- package/test/fixtures/agent-schema/invalid/persona/empty-principles-array.agent.yaml +23 -0
- package/test/fixtures/agent-schema/invalid/persona/empty-string-in-principles.agent.yaml +26 -0
- package/test/fixtures/agent-schema/invalid/persona/extra-persona-fields.agent.yaml +26 -0
- package/test/fixtures/agent-schema/invalid/persona/missing-role.agent.yaml +23 -0
- package/test/fixtures/agent-schema/invalid/prompts/empty-content.agent.yaml +28 -0
- package/test/fixtures/agent-schema/invalid/prompts/extra-prompt-fields.agent.yaml +30 -0
- package/test/fixtures/agent-schema/invalid/prompts/missing-content.agent.yaml +27 -0
- package/test/fixtures/agent-schema/invalid/prompts/missing-id.agent.yaml +27 -0
- package/test/fixtures/agent-schema/invalid/top-level/empty-file.agent.yaml +5 -0
- package/test/fixtures/agent-schema/invalid/top-level/extra-top-level-keys.agent.yaml +27 -0
- package/test/fixtures/agent-schema/invalid/top-level/missing-agent-key.agent.yaml +11 -0
- package/test/fixtures/agent-schema/invalid/yaml-errors/invalid-indentation.agent.yaml +19 -0
- package/test/fixtures/agent-schema/invalid/yaml-errors/malformed-yaml.agent.yaml +18 -0
- package/test/fixtures/agent-schema/valid/critical-actions/empty-critical-actions.agent.yaml +23 -0
- package/test/fixtures/agent-schema/valid/critical-actions/no-critical-actions.agent.yaml +21 -0
- package/test/fixtures/agent-schema/valid/critical-actions/valid-critical-actions.agent.yaml +26 -0
- package/test/fixtures/agent-schema/valid/menu/multiple-menu-items.agent.yaml +30 -0
- package/test/fixtures/agent-schema/valid/menu/single-menu-item.agent.yaml +21 -0
- package/test/fixtures/agent-schema/valid/menu-commands/all-command-types.agent.yaml +37 -0
- package/test/fixtures/agent-schema/valid/menu-commands/multiple-commands.agent.yaml +23 -0
- package/test/fixtures/agent-schema/valid/menu-triggers/kebab-case-triggers.agent.yaml +33 -0
- package/test/fixtures/agent-schema/valid/metadata/empty-module-name-in-path.agent.yaml +23 -0
- package/test/fixtures/agent-schema/valid/metadata/malformed-path-treated-as-core.agent.yaml +23 -0
- package/test/fixtures/agent-schema/valid/metadata/module-agent-correct.agent.yaml +23 -0
- package/test/fixtures/agent-schema/valid/persona/complete-persona.agent.yaml +23 -0
- package/test/fixtures/agent-schema/valid/prompts/empty-prompts.agent.yaml +23 -0
- package/test/fixtures/agent-schema/valid/prompts/no-prompts.agent.yaml +21 -0
- package/test/fixtures/agent-schema/valid/prompts/valid-prompts-minimal.agent.yaml +27 -0
- package/test/fixtures/agent-schema/valid/prompts/valid-prompts-with-description.agent.yaml +29 -0
- package/test/fixtures/agent-schema/valid/top-level/minimal-core-agent.agent.yaml +23 -0
- package/test/test-agent-schema.js +387 -0
- package/test/test-cli-integration.sh +159 -0
- package/test/test-installation-components.js +214 -0
- package/test/unit-test-schema.js +133 -0
- package/tools/cli/README.md +609 -0
- package/tools/cli/bundlers/bundle-web.js +179 -0
- package/tools/cli/bundlers/test-analyst.js +28 -0
- package/tools/cli/bundlers/test-bundler.js +119 -0
- package/tools/cli/bundlers/web-bundler.js +1764 -0
- package/tools/cli/commands/agent-install.js +409 -0
- package/tools/cli/commands/build.js +458 -0
- package/tools/cli/commands/cleanup.js +141 -0
- package/tools/cli/commands/install.js +124 -0
- package/tools/cli/commands/list.js +28 -0
- package/tools/cli/commands/status.js +47 -0
- package/tools/cli/commands/uninstall.js +44 -0
- package/tools/cli/commands/update.js +28 -0
- package/tools/cli/installers/lib/core/config-collector.js +876 -0
- package/tools/cli/installers/lib/core/dependency-resolver.js +725 -0
- package/tools/cli/installers/lib/core/detector.js +329 -0
- package/tools/cli/installers/lib/core/ide-config-manager.js +154 -0
- package/tools/cli/installers/lib/core/installer.js +2956 -0
- package/tools/cli/installers/lib/core/manifest-generator.js +692 -0
- package/tools/cli/installers/lib/core/manifest.js +540 -0
- package/tools/cli/installers/lib/ide/_base-ide.js +651 -0
- package/tools/cli/installers/lib/ide/antigravity.js +510 -0
- package/tools/cli/installers/lib/ide/auggie.js +232 -0
- package/tools/cli/installers/lib/ide/claude-code.js +512 -0
- package/tools/cli/installers/lib/ide/cline.js +269 -0
- package/tools/cli/installers/lib/ide/codex.js +388 -0
- package/tools/cli/installers/lib/ide/crush.js +287 -0
- package/tools/cli/installers/lib/ide/cursor.js +400 -0
- package/tools/cli/installers/lib/ide/gemini.js +253 -0
- package/tools/cli/installers/lib/ide/github-copilot.js +387 -0
- package/tools/cli/installers/lib/ide/iflow.js +172 -0
- package/tools/cli/installers/lib/ide/kilo.js +249 -0
- package/tools/cli/installers/lib/ide/manager.js +245 -0
- package/tools/cli/installers/lib/ide/opencode.js +257 -0
- package/tools/cli/installers/lib/ide/qwen.js +372 -0
- package/tools/cli/installers/lib/ide/roo.js +324 -0
- package/tools/cli/installers/lib/ide/rovo-dev.js +290 -0
- package/tools/cli/installers/lib/ide/shared/agent-command-generator.js +90 -0
- package/tools/cli/installers/lib/ide/shared/module-injections.js +133 -0
- package/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js +119 -0
- package/tools/cli/installers/lib/ide/shared/workflow-command-generator.js +237 -0
- package/tools/cli/installers/lib/ide/shared/xiaoma-artifacts.js +143 -0
- package/tools/cli/installers/lib/ide/templates/agent-command-template.md +14 -0
- package/tools/cli/installers/lib/ide/templates/gemini-agent-command.toml +14 -0
- package/tools/cli/installers/lib/ide/templates/gemini-task-command.toml +12 -0
- package/tools/cli/installers/lib/ide/templates/workflow-command-template.md +13 -0
- package/tools/cli/installers/lib/ide/trae.js +313 -0
- package/tools/cli/installers/lib/ide/windsurf.js +258 -0
- package/tools/cli/installers/lib/modules/manager.js +751 -0
- package/tools/cli/lib/activation-builder.js +168 -0
- package/tools/cli/lib/agent/compiler.js +524 -0
- package/tools/cli/lib/agent/installer.js +735 -0
- package/tools/cli/lib/agent/template-engine.js +152 -0
- package/tools/cli/lib/agent-analyzer.js +109 -0
- package/tools/cli/lib/agent-party-generator.js +206 -0
- package/tools/cli/lib/cli-utils.js +210 -0
- package/tools/cli/lib/config.js +212 -0
- package/tools/cli/lib/file-ops.js +204 -0
- package/tools/cli/lib/platform-codes.js +116 -0
- package/tools/cli/lib/project-root.js +71 -0
- package/tools/cli/lib/replace-project-root.js +239 -0
- package/tools/cli/lib/ui.js +769 -0
- package/tools/cli/lib/xml-handler.js +229 -0
- package/tools/cli/lib/xml-to-markdown.js +82 -0
- package/tools/{yaml-format.js → cli/lib/yaml-format.js} +36 -66
- package/tools/cli/lib/yaml-xml-builder.js +606 -0
- package/tools/cli/regenerate-manifests.js +28 -0
- package/tools/cli/test-yaml-builder.js +43 -0
- package/tools/cli/xiaoma-cli.js +40 -0
- package/tools/flattener/aggregate.js +12 -30
- package/tools/flattener/binary.js +43 -46
- package/tools/flattener/discovery.js +15 -23
- package/tools/flattener/files.js +6 -6
- package/tools/flattener/ignoreRules.js +122 -127
- package/tools/flattener/main.js +140 -330
- package/tools/flattener/projectRoot.js +71 -81
- package/tools/flattener/prompts.js +10 -12
- package/tools/flattener/stats.helpers.js +63 -119
- package/tools/flattener/stats.js +2 -7
- package/tools/flattener/test-matrix.js +169 -228
- package/tools/flattener/xml.js +23 -31
- package/tools/format-workflow-md.js +263 -0
- package/tools/platform-codes.yaml +145 -0
- package/tools/schema/agent.js +389 -0
- package/tools/validate-agent-schema.js +110 -0
- package/tools/validate-bundles.js +87 -0
- package/tools/xiaoma-npx-wrapper.js +18 -24
- package/.claude/agents/tech-translator.md +0 -124
- package/.claude/settings.local.json +0 -37
- package/.idea/XiaoMa-Cli.iml +0 -9
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -7
- package/.idea/workspace.xml +0 -114
- package/.xiaoma-core/.coordinator-state.json +0 -19
- package/CLAUDE.md +0 -283
- package/JAVA-BACKEND-COMMANDS-REFERENCE.md +0 -300
- package/JAVA-BACKEND-ITERATION-GUIDE.md +0 -2116
- package/common/tasks/create-doc.md +0 -103
- package/common/tasks/execute-checklist.md +0 -88
- package/common/utils/bmad-doc-template.md +0 -327
- package/common/utils/workflow-management.md +0 -71
- package/dist/agents/analyst.txt +0 -6308
- package/dist/agents/architect.txt +0 -3911
- package/dist/agents/automation-orchestrator.txt +0 -396
- package/dist/agents/dev.txt +0 -576
- package/dist/agents/full-requirement-orchestrator.txt +0 -505
- package/dist/agents/pm.txt +0 -2224
- package/dist/agents/po.txt +0 -1358
- package/dist/agents/qa.txt +0 -2002
- package/dist/agents/sm.txt +0 -2061
- package/dist/agents/ux-expert.txt +0 -707
- package/dist/agents/workflow-executor.txt +0 -1029
- package/dist/agents/workflow-helper.txt +0 -93
- package/dist/agents/xiaoma-master.txt +0 -9008
- package/dist/agents/xiaoma-orchestrator.txt +0 -1523
- package/dist/teams/team-all.txt +0 -19525
- package/dist/teams/team-fullstack-with-database.txt +0 -21500
- package/dist/teams/team-fullstack.txt +0 -13831
- package/dist/teams/team-ide-minimal.txt +0 -6698
- package/dist/teams/team-no-ui.txt +0 -12379
- package/docs/GUIDING-PRINCIPLES.md +0 -91
- package/docs/architecture/workflow-coordinator-implementation.md +0 -1188
- package/docs/architecture-sharding-modification.md +0 -623
- package/docs/automated-requirements-analysis-outputs.md +0 -896
- package/docs/core-architecture.md +0 -219
- package/docs/enhanced-ide-development-workflow.md +0 -248
- package/docs/prd/workflow-coordinator-prd.md +0 -1214
- package/docs/user-guide.md +0 -530
- package/docs/versioning-and-releases.md +0 -155
- package/docs/versions.md +0 -48
- package/docs/working-in-the-brownfield.md +0 -597
- package/tools/api-server.js +0 -367
- package/tools/builders/web-builder.js +0 -830
- package/tools/bump-all-versions.js +0 -133
- package/tools/cli.js +0 -157
- package/tools/installer/README.md +0 -8
- package/tools/installer/bin/xiaoma.js +0 -477
- package/tools/installer/config/ide-agent-config.yaml +0 -58
- package/tools/installer/config/install.config.yaml +0 -164
- package/tools/installer/lib/config-loader.js +0 -286
- package/tools/installer/lib/file-manager.js +0 -446
- package/tools/installer/lib/ide-base-setup.js +0 -238
- package/tools/installer/lib/ide-setup.js +0 -2027
- package/tools/installer/lib/installer.js +0 -2333
- package/tools/installer/lib/memory-profiler.js +0 -235
- package/tools/installer/lib/module-manager.js +0 -116
- package/tools/installer/lib/resource-locator.js +0 -334
- package/tools/installer/package-lock.json +0 -715
- package/tools/installer/package.json +0 -44
- package/tools/lib/dependency-resolver.js +0 -186
- package/tools/lib/yaml-utils.js +0 -34
- package/tools/md-assets/web-agent-startup-instructions.md +0 -39
- package/tools/preview-release-notes.js +0 -74
- package/tools/setup-hooks.sh +0 -37
- package/tools/shared/bannerArt.js +0 -105
- package/tools/sync-installer-version.js +0 -41
- package/tools/sync-version.sh +0 -23
- package/tools/upgraders/v3-to-v4-upgrader.js +0 -753
- package/tools/version-bump.js +0 -100
- package/tools/workflow-coordinator/README.md +0 -38
- package/tools/workflow-coordinator/USAGE.md +0 -548
- package/tools/workflow-coordinator/package-lock.json +0 -4868
- package/tools/workflow-coordinator/package.json +0 -35
- package/tools/workflow-coordinator/src/api/server.js +0 -207
- package/tools/workflow-coordinator/src/controller/workflow-controller.js +0 -263
- package/tools/workflow-coordinator/src/index.js +0 -113
- package/tools/workflow-coordinator/src/parser/workflow-parser.js +0 -144
- package/tools/workflow-coordinator/src/utils/state-manager.js +0 -59
- package/tools/workflow-coordinator/src/utils/validator.js +0 -86
- package/tools/workflow-coordinator/test/integration-test.js +0 -266
- package/tools/workflow-coordinator/test/quick-test.js +0 -127
- package/xiaoma-core/agent-teams/team-all.yaml +0 -15
- package/xiaoma-core/agent-teams/team-fullstack-with-database.yaml +0 -27
- package/xiaoma-core/agent-teams/team-fullstack.yaml +0 -19
- package/xiaoma-core/agent-teams/team-ide-minimal.yaml +0 -11
- package/xiaoma-core/agent-teams/team-no-ui.yaml +0 -14
- package/xiaoma-core/agents/analyst.md +0 -91
- package/xiaoma-core/agents/architect.md +0 -85
- package/xiaoma-core/agents/automated-fix-validator.yaml +0 -579
- package/xiaoma-core/agents/automated-quality-validator.yaml +0 -549
- package/xiaoma-core/agents/automation-orchestrator.md +0 -353
- package/xiaoma-core/agents/dev.md +0 -79
- package/xiaoma-core/agents/enhanced-workflow-orchestrator.yaml +0 -304
- package/xiaoma-core/agents/full-requirement-orchestrator.md +0 -462
- package/xiaoma-core/agents/global-requirements-auditor.yaml +0 -520
- package/xiaoma-core/agents/intelligent-template-adapter.yaml +0 -389
- package/xiaoma-core/agents/issue-dispatcher.yaml +0 -627
- package/xiaoma-core/agents/master-execution-engine.yaml +0 -543
- package/xiaoma-core/agents/pm.md +0 -82
- package/xiaoma-core/agents/po.md +0 -77
- package/xiaoma-core/agents/qa.md +0 -88
- package/xiaoma-core/agents/requirements-coverage-auditor.yaml +0 -373
- package/xiaoma-core/agents/sm.md +0 -67
- package/xiaoma-core/agents/ux-expert.md +0 -67
- package/xiaoma-core/agents/workflow-executor.md +0 -1031
- package/xiaoma-core/agents/workflow-helper.md +0 -481
- package/xiaoma-core/agents/xiaoma-master.md +0 -108
- package/xiaoma-core/agents/xiaoma-orchestrator.md +0 -145
- package/xiaoma-core/checklists/architect-checklist.md +0 -440
- package/xiaoma-core/checklists/change-checklist.md +0 -184
- package/xiaoma-core/checklists/dev-completion-checklist.md +0 -324
- package/xiaoma-core/checklists/pm-checklist.md +0 -372
- package/xiaoma-core/checklists/po-master-checklist.md +0 -434
- package/xiaoma-core/checklists/po-story-validation-checklist.md +0 -219
- package/xiaoma-core/checklists/qa-approval-checklist.md +0 -393
- package/xiaoma-core/checklists/story-dod-checklist.md +0 -96
- package/xiaoma-core/checklists/story-draft-checklist.md +0 -155
- package/xiaoma-core/core-config.yaml +0 -23
- package/xiaoma-core/data/bmad-kb.md +0 -809
- package/xiaoma-core/data/brainstorming-techniques.md +0 -38
- package/xiaoma-core/data/elicitation-methods.md +0 -156
- package/xiaoma-core/data/technical-preferences.md +0 -5
- package/xiaoma-core/data/test-levels-framework.md +0 -148
- package/xiaoma-core/data/test-priorities-matrix.md +0 -174
- package/xiaoma-core/scripts/build-validation/pre-dev-validation.sh +0 -71
- package/xiaoma-core/scripts/build-validation/progressive-validation.sh +0 -88
- package/xiaoma-core/scripts/build-validation/quick-check.sh +0 -69
- package/xiaoma-core/tasks/advanced-elicitation.md +0 -119
- package/xiaoma-core/tasks/analyze-existing-database.md +0 -155
- package/xiaoma-core/tasks/apply-qa-fixes.md +0 -150
- package/xiaoma-core/tasks/automated-story-cycle.md +0 -370
- package/xiaoma-core/tasks/batch-story-generation.md +0 -354
- package/xiaoma-core/tasks/brownfield-create-epic.md +0 -162
- package/xiaoma-core/tasks/brownfield-create-story.md +0 -149
- package/xiaoma-core/tasks/correct-course.md +0 -72
- package/xiaoma-core/tasks/create-brownfield-story.md +0 -314
- package/xiaoma-core/tasks/create-database-design.md +0 -161
- package/xiaoma-core/tasks/create-deep-research-prompt.md +0 -280
- package/xiaoma-core/tasks/create-enhanced-story-with-database.md +0 -250
- package/xiaoma-core/tasks/create-next-story.md +0 -114
- package/xiaoma-core/tasks/document-project.md +0 -345
- package/xiaoma-core/tasks/facilitate-brainstorming-session.md +0 -138
- package/xiaoma-core/tasks/generate-ai-frontend-prompt.md +0 -53
- package/xiaoma-core/tasks/generate-database-ddl.md +0 -240
- package/xiaoma-core/tasks/generate-database-entities.md +0 -501
- package/xiaoma-core/tasks/generate-rag-questions.md +0 -312
- package/xiaoma-core/tasks/index-docs.md +0 -175
- package/xiaoma-core/tasks/kb-mode-interaction.md +0 -77
- package/xiaoma-core/tasks/nfr-assess.md +0 -345
- package/xiaoma-core/tasks/project-integration-testing.md +0 -477
- package/xiaoma-core/tasks/qa-gate.md +0 -163
- package/xiaoma-core/tasks/requirement-analysis-with-rag.md +0 -1318
- package/xiaoma-core/tasks/requirements-coverage-audit.md +0 -198
- package/xiaoma-core/tasks/review-story.md +0 -316
- package/xiaoma-core/tasks/risk-profile.md +0 -355
- package/xiaoma-core/tasks/serial-development-orchestration.md +0 -426
- package/xiaoma-core/tasks/shard-doc.md +0 -187
- package/xiaoma-core/tasks/test-design.md +0 -176
- package/xiaoma-core/tasks/trace-requirements.md +0 -266
- package/xiaoma-core/tasks/validate-next-story.md +0 -136
- package/xiaoma-core/templates/api-design-tmpl.yaml +0 -704
- package/xiaoma-core/templates/architecture-tmpl.yaml +0 -650
- package/xiaoma-core/templates/brainstorming-output-tmpl.yaml +0 -156
- package/xiaoma-core/templates/brownfield-architecture-tmpl.yaml +0 -476
- package/xiaoma-core/templates/brownfield-prd-tmpl.yaml +0 -280
- package/xiaoma-core/templates/competitor-analysis-tmpl.yaml +0 -336
- package/xiaoma-core/templates/database-design-tmpl.yaml +0 -266
- package/xiaoma-core/templates/enhanced-story-with-database-tmpl.yaml +0 -428
- package/xiaoma-core/templates/front-end-architecture-tmpl.yaml +0 -272
- package/xiaoma-core/templates/front-end-spec-tmpl.yaml +0 -354
- package/xiaoma-core/templates/fullstack-architecture-tmpl.yaml +0 -925
- package/xiaoma-core/templates/global-qa-monitoring-tmpl.yaml +0 -443
- package/xiaoma-core/templates/market-research-tmpl.yaml +0 -252
- package/xiaoma-core/templates/maven-lombok-template.xml +0 -111
- package/xiaoma-core/templates/prd-tmpl.yaml +0 -202
- package/xiaoma-core/templates/project-brief-tmpl.yaml +0 -221
- package/xiaoma-core/templates/qa-gate-tmpl.yaml +0 -102
- package/xiaoma-core/templates/rag-knowledge-tmpl.yaml +0 -569
- package/xiaoma-core/templates/rag-questions-tmpl.yaml +0 -949
- package/xiaoma-core/templates/requirements-coverage-audit.yaml +0 -330
- package/xiaoma-core/templates/start-enhanced-workflow.yaml +0 -347
- package/xiaoma-core/templates/story-tmpl.yaml +0 -137
- package/xiaoma-core/workflows/automated-requirements-analysis.yaml +0 -2149
- package/xiaoma-core/workflows/automated-requirements-development.yaml +0 -739
- package/xiaoma-core/workflows/automated-story-development.yaml +0 -1264
- package/xiaoma-core/workflows/brownfield-fullstack.yaml +0 -298
- package/xiaoma-core/workflows/brownfield-service.yaml +0 -188
- package/xiaoma-core/workflows/brownfield-ui.yaml +0 -198
- package/xiaoma-core/workflows/enhanced-fullstack-with-database.yaml +0 -427
- package/xiaoma-core/workflows/enhanced-fullstack-with-qa-loop.yaml +0 -766
- package/xiaoma-core/workflows/full-requirement-automation.yaml +0 -1305
- package/xiaoma-core/workflows/greenfield-fullstack.yaml +0 -241
- package/xiaoma-core/workflows/greenfield-service.yaml +0 -207
- package/xiaoma-core/workflows/greenfield-ui.yaml +0 -236
|
@@ -0,0 +1,1764 @@
|
|
|
1
|
+
const path = require('node:path');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const yaml = require('js-yaml');
|
|
5
|
+
const { DependencyResolver } = require('../installers/lib/core/dependency-resolver');
|
|
6
|
+
const { XmlHandler } = require('../lib/xml-handler');
|
|
7
|
+
const { YamlXmlBuilder } = require('../lib/yaml-xml-builder');
|
|
8
|
+
const { AgentPartyGenerator } = require('../lib/agent-party-generator');
|
|
9
|
+
const xml2js = require('xml2js');
|
|
10
|
+
const { getProjectRoot, getSourcePath, getModulePath } = require('../lib/project-root');
|
|
11
|
+
|
|
12
|
+
class WebBundler {
|
|
13
|
+
constructor(sourceDir = null, outputDir = 'web-bundles') {
|
|
14
|
+
this.sourceDir = sourceDir || getSourcePath();
|
|
15
|
+
this.outputDir = path.isAbsolute(outputDir) ? outputDir : path.join(getProjectRoot(), outputDir);
|
|
16
|
+
this.modulesPath = getSourcePath('modules');
|
|
17
|
+
this.utilityPath = getSourcePath('utility');
|
|
18
|
+
|
|
19
|
+
this.dependencyResolver = new DependencyResolver();
|
|
20
|
+
this.xmlHandler = new XmlHandler();
|
|
21
|
+
this.yamlBuilder = new YamlXmlBuilder();
|
|
22
|
+
|
|
23
|
+
// Cache for resolved dependencies to avoid duplicates
|
|
24
|
+
this.dependencyCache = new Map();
|
|
25
|
+
|
|
26
|
+
// Discovered agents and teams for manifest generation
|
|
27
|
+
this.discoveredAgents = [];
|
|
28
|
+
this.discoveredTeams = [];
|
|
29
|
+
|
|
30
|
+
// Temporary directory for generated manifests
|
|
31
|
+
this.tempDir = path.join(process.cwd(), '.bundler-temp');
|
|
32
|
+
this.tempManifestDir = path.join(this.tempDir, 'xiaoma', '_cfg');
|
|
33
|
+
|
|
34
|
+
// Bundle statistics
|
|
35
|
+
this.stats = {
|
|
36
|
+
totalAgents: 0,
|
|
37
|
+
bundledAgents: 0,
|
|
38
|
+
skippedAgents: 0,
|
|
39
|
+
failedAgents: 0,
|
|
40
|
+
invalidXml: 0,
|
|
41
|
+
warnings: [],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Main entry point to bundle all modules
|
|
47
|
+
*/
|
|
48
|
+
async bundleAll() {
|
|
49
|
+
console.log(chalk.cyan.bold('═══════════════════════════════════════════════'));
|
|
50
|
+
console.log(chalk.cyan.bold(' 🚀 Web Bundle Generation'));
|
|
51
|
+
console.log(chalk.cyan.bold('═══════════════════════════════════════════════\n'));
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
// Vendor cross-module workflows FIRST
|
|
55
|
+
const modules = await this.discoverModules();
|
|
56
|
+
for (const module of modules) {
|
|
57
|
+
await this.vendorCrossModuleWorkflows(module);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Pre-discover all modules to generate complete manifests
|
|
61
|
+
for (const module of modules) {
|
|
62
|
+
await this.preDiscoverModule(module);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Create temporary manifest files
|
|
66
|
+
await this.createTempManifests();
|
|
67
|
+
|
|
68
|
+
// Process all modules
|
|
69
|
+
for (const module of modules) {
|
|
70
|
+
await this.bundleModule(module);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Display summary
|
|
74
|
+
this.displaySummary();
|
|
75
|
+
} finally {
|
|
76
|
+
// Clean up temp files
|
|
77
|
+
await this.cleanupTempFiles();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Bundle a specific module
|
|
83
|
+
*/
|
|
84
|
+
async bundleModule(moduleName) {
|
|
85
|
+
const modulePath = path.join(this.modulesPath, moduleName);
|
|
86
|
+
|
|
87
|
+
if (!(await fs.pathExists(modulePath))) {
|
|
88
|
+
console.log(chalk.yellow(`Module ${moduleName} not found`));
|
|
89
|
+
return { module: moduleName, agents: [], teams: [] };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
console.log(chalk.bold(`\n📦 Bundling module: ${moduleName}`));
|
|
93
|
+
|
|
94
|
+
const results = {
|
|
95
|
+
module: moduleName,
|
|
96
|
+
agents: [],
|
|
97
|
+
teams: [],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Vendor cross-module workflows first (if not already done by bundleAll)
|
|
101
|
+
await this.vendorCrossModuleWorkflows(moduleName);
|
|
102
|
+
|
|
103
|
+
// Pre-discover all agents and teams for manifest generation
|
|
104
|
+
await this.preDiscoverModule(moduleName);
|
|
105
|
+
|
|
106
|
+
// Ensure temp manifests exist (might not exist if called directly)
|
|
107
|
+
if (!(await fs.pathExists(this.tempManifestDir))) {
|
|
108
|
+
await this.createTempManifests();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Process agents
|
|
112
|
+
const agents = await this.discoverAgents(modulePath);
|
|
113
|
+
for (const agent of agents) {
|
|
114
|
+
try {
|
|
115
|
+
await this.bundleAgent(moduleName, agent, false); // false = don't track again
|
|
116
|
+
results.agents.push(agent);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error(` Failed to bundle agent ${agent}:`, error.message);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Process teams
|
|
123
|
+
const teams = await this.discoverTeams(modulePath);
|
|
124
|
+
for (const team of teams) {
|
|
125
|
+
try {
|
|
126
|
+
await this.bundleTeam(moduleName, team);
|
|
127
|
+
results.teams.push(team);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
console.error(` Failed to bundle team ${team}:`, error.message);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return results;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Bundle a single agent
|
|
138
|
+
*/
|
|
139
|
+
async bundleAgent(moduleName, agentFile, shouldTrack = true) {
|
|
140
|
+
const agentName = agentFile.endsWith('.agent.yaml') ? path.basename(agentFile, '.agent.yaml') : path.basename(agentFile, '.md');
|
|
141
|
+
this.stats.totalAgents++;
|
|
142
|
+
|
|
143
|
+
console.log(chalk.dim(` → Processing: ${agentName}`));
|
|
144
|
+
|
|
145
|
+
// Vendor cross-module workflows first (if not already done)
|
|
146
|
+
await this.vendorCrossModuleWorkflows(moduleName);
|
|
147
|
+
|
|
148
|
+
const agentPath = path.join(this.modulesPath, moduleName, 'agents', agentFile);
|
|
149
|
+
|
|
150
|
+
// Check if agent file exists
|
|
151
|
+
if (!(await fs.pathExists(agentPath))) {
|
|
152
|
+
this.stats.failedAgents++;
|
|
153
|
+
console.log(chalk.red(` ✗ Agent file not found`));
|
|
154
|
+
throw new Error(`Agent file not found: ${agentPath}`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let content;
|
|
158
|
+
let agentXml;
|
|
159
|
+
|
|
160
|
+
// Handle YAML agents - build in-memory to XML
|
|
161
|
+
if (agentFile.endsWith('.agent.yaml')) {
|
|
162
|
+
// Check for webskip flag in YAML before building
|
|
163
|
+
const yamlContent = await fs.readFile(agentPath, 'utf8');
|
|
164
|
+
const agentYaml = yaml.load(yamlContent);
|
|
165
|
+
|
|
166
|
+
if (agentYaml?.agent?.webskip === true) {
|
|
167
|
+
this.stats.skippedAgents++;
|
|
168
|
+
console.log(chalk.gray(` ⊘ Skipped (webskip="true")`));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Build agent from YAML (no customize file for web bundles)
|
|
173
|
+
const xmlContent = await this.yamlBuilder.buildFromYaml(agentPath, null, {
|
|
174
|
+
includeMetadata: false, // Don't include build metadata in web bundles
|
|
175
|
+
forWebBundle: true, // Use web-specific activation fragments
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
content = xmlContent;
|
|
179
|
+
agentXml = this.extractAgentXml(xmlContent);
|
|
180
|
+
} else {
|
|
181
|
+
// Legacy MD format - read and extract XML
|
|
182
|
+
content = await fs.readFile(agentPath, 'utf8');
|
|
183
|
+
agentXml = this.extractAgentXml(content);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!agentXml) {
|
|
187
|
+
this.stats.failedAgents++;
|
|
188
|
+
console.log(chalk.red(` ✗ No agent XML found in ${agentFile}`));
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Check if agent has bundle="false" attribute
|
|
193
|
+
if (this.shouldSkipBundling(agentXml)) {
|
|
194
|
+
this.stats.skippedAgents++;
|
|
195
|
+
console.log(chalk.gray(` ⊘ Skipped (bundle="false")`));
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Process {project-root} references in agent XML
|
|
200
|
+
agentXml = this.processProjectRootReferences(agentXml);
|
|
201
|
+
|
|
202
|
+
// Track for manifest generation BEFORE generating manifests (if not pre-discovered)
|
|
203
|
+
if (shouldTrack) {
|
|
204
|
+
const agentDetails = AgentPartyGenerator.extractAgentDetails(content, moduleName, agentName);
|
|
205
|
+
if (agentDetails) {
|
|
206
|
+
this.discoveredAgents.push(agentDetails);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Resolve dependencies with warning tracking
|
|
211
|
+
const dependencyWarnings = [];
|
|
212
|
+
const { dependencies, skippedWorkflows } = await this.resolveAgentDependencies(agentXml, moduleName, dependencyWarnings);
|
|
213
|
+
|
|
214
|
+
if (dependencyWarnings.length > 0) {
|
|
215
|
+
this.stats.warnings.push({ agent: agentName, warnings: dependencyWarnings });
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Check for module's default-party.csv and include it as agent manifest
|
|
219
|
+
const defaultPartyPath = path.join(this.modulesPath, moduleName, 'teams', 'default-party.csv');
|
|
220
|
+
if (await fs.pathExists(defaultPartyPath)) {
|
|
221
|
+
const partyContent = await fs.readFile(defaultPartyPath, 'utf8');
|
|
222
|
+
// Process any placeholders in the CSV content
|
|
223
|
+
const processedPartyContent = this.processProjectRootReferences(partyContent);
|
|
224
|
+
// Wrap as text to preserve raw CSV format in CDATA
|
|
225
|
+
const wrappedParty = this.wrapContentInXml(processedPartyContent, 'xiaoma/_cfg/agent-manifest.csv', 'text');
|
|
226
|
+
dependencies.set('xiaoma/_cfg/agent-manifest.csv', wrappedParty);
|
|
227
|
+
console.log(chalk.gray(` + Added party manifest from module default-party.csv`));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Remove commands for skipped workflows from agent XML
|
|
231
|
+
if (skippedWorkflows.length > 0) {
|
|
232
|
+
agentXml = this.removeSkippedWorkflowCommands(agentXml, skippedWorkflows);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Build the bundle (no manifests for individual agents)
|
|
236
|
+
const bundle = this.buildAgentBundle(agentXml, dependencies);
|
|
237
|
+
|
|
238
|
+
// Validate XML
|
|
239
|
+
const isValid = await this.validateXml(bundle);
|
|
240
|
+
if (!isValid) {
|
|
241
|
+
this.stats.invalidXml++;
|
|
242
|
+
console.log(chalk.red(` ⚠ Invalid XML generated!`));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Format XML for readability
|
|
246
|
+
const formattedBundle = this.formatXml(bundle);
|
|
247
|
+
|
|
248
|
+
// Write bundle to output
|
|
249
|
+
const outputPath = path.join(this.outputDir, moduleName, 'agents', `${agentName}.xml`);
|
|
250
|
+
await fs.ensureDir(path.dirname(outputPath));
|
|
251
|
+
await fs.writeFile(outputPath, formattedBundle, 'utf8');
|
|
252
|
+
|
|
253
|
+
this.stats.bundledAgents++;
|
|
254
|
+
const statusIcon = isValid ? chalk.green('✓') : chalk.yellow('⚠');
|
|
255
|
+
console.log(` ${statusIcon} Bundled: ${agentName}.xml${isValid ? '' : chalk.yellow(' (invalid XML)')}`);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Bundle a team - includes orchestrator and all agents with their dependencies
|
|
260
|
+
*/
|
|
261
|
+
async bundleTeam(moduleName, teamFile) {
|
|
262
|
+
const teamName = path.basename(teamFile, path.extname(teamFile));
|
|
263
|
+
console.log(chalk.dim(` → Processing team: ${teamName}`));
|
|
264
|
+
|
|
265
|
+
const teamPath = path.join(this.modulesPath, moduleName, 'teams', teamFile);
|
|
266
|
+
|
|
267
|
+
// Check if team file exists
|
|
268
|
+
if (!(await fs.pathExists(teamPath))) {
|
|
269
|
+
console.log(chalk.red(` ✗ Team file not found`));
|
|
270
|
+
throw new Error(`Team file not found: ${teamPath}`);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Read and parse team YAML
|
|
274
|
+
const teamContent = await fs.readFile(teamPath, 'utf8');
|
|
275
|
+
const teamConfig = yaml.load(teamContent);
|
|
276
|
+
|
|
277
|
+
if (!teamConfig || !teamConfig.bundle) {
|
|
278
|
+
console.log(chalk.red(` ✗ Invalid team configuration`));
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Start building the team bundle
|
|
283
|
+
const dependencies = new Map();
|
|
284
|
+
const processed = new Set();
|
|
285
|
+
const allAgentXmls = [];
|
|
286
|
+
const warnings = [];
|
|
287
|
+
|
|
288
|
+
// Check if team has a party CSV file (agent manifest)
|
|
289
|
+
const hasPartyFile = teamConfig.party && teamConfig.party.endsWith('.csv');
|
|
290
|
+
if (hasPartyFile) {
|
|
291
|
+
// Load the party CSV and add it as xiaoma/_cfg/agent-manifest.csv
|
|
292
|
+
const partyPath = path.join(path.dirname(teamPath), teamConfig.party.replace(/^\.\//, ''));
|
|
293
|
+
if (await fs.pathExists(partyPath)) {
|
|
294
|
+
const partyContent = await fs.readFile(partyPath, 'utf8');
|
|
295
|
+
// Process any placeholders in the CSV content
|
|
296
|
+
const processedPartyContent = this.processProjectRootReferences(partyContent);
|
|
297
|
+
// Wrap as text/csv to preserve raw CSV format in CDATA
|
|
298
|
+
const wrappedParty = this.wrapContentInXml(processedPartyContent, 'xiaoma/_cfg/agent-manifest.csv', 'text');
|
|
299
|
+
dependencies.set('xiaoma/_cfg/agent-manifest.csv', wrappedParty);
|
|
300
|
+
console.log(chalk.gray(` + Added agent manifest from: ${teamConfig.party}`));
|
|
301
|
+
} else {
|
|
302
|
+
console.log(chalk.yellow(` ⚠ Party file not found: ${partyPath}`));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// 1. First, always add the xiaoma-web-orchestrator (XML file only, no transformation needed)
|
|
307
|
+
const orchestratorXmlPath = path.join(this.sourceDir, 'core', 'agents', 'xiaoma-web-orchestrator.agent.xml');
|
|
308
|
+
|
|
309
|
+
if (await fs.pathExists(orchestratorXmlPath)) {
|
|
310
|
+
// Read the XML file directly - no transformation needed
|
|
311
|
+
const xmlContent = await fs.readFile(orchestratorXmlPath, 'utf8');
|
|
312
|
+
let orchestratorXml = xmlContent.trim();
|
|
313
|
+
|
|
314
|
+
// Process {project-root} references
|
|
315
|
+
orchestratorXml = this.processProjectRootReferences(orchestratorXml);
|
|
316
|
+
|
|
317
|
+
// Inject help/exit menu items only (orchestrator has its own activation)
|
|
318
|
+
orchestratorXml = this.injectHelpExitMenuItems(orchestratorXml);
|
|
319
|
+
|
|
320
|
+
// Resolve orchestrator dependencies
|
|
321
|
+
const { dependencies: orchDeps } = await this.resolveAgentDependencies(orchestratorXml, 'core', warnings);
|
|
322
|
+
|
|
323
|
+
// Merge orchestrator dependencies
|
|
324
|
+
for (const [id, content] of orchDeps) {
|
|
325
|
+
if (!dependencies.has(id)) {
|
|
326
|
+
dependencies.set(id, content);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Add orchestrator XML first
|
|
331
|
+
allAgentXmls.push(orchestratorXml);
|
|
332
|
+
console.log(chalk.gray(` + Added orchestrator: xiaoma-web-orchestrator`));
|
|
333
|
+
} else {
|
|
334
|
+
console.log(chalk.yellow(` ⚠ Orchestrator not found at: ${orchestratorXmlPath}`));
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// 2. Determine which agents to include
|
|
338
|
+
let agentsToBundle = [];
|
|
339
|
+
|
|
340
|
+
if (teamConfig.agents === '*' || (Array.isArray(teamConfig.agents) && teamConfig.agents.includes('*'))) {
|
|
341
|
+
// Include all agents from the module
|
|
342
|
+
const agentsPath = path.join(this.modulesPath, moduleName, 'agents');
|
|
343
|
+
if (await fs.pathExists(agentsPath)) {
|
|
344
|
+
const agentFiles = await fs.readdir(agentsPath);
|
|
345
|
+
agentsToBundle = agentFiles
|
|
346
|
+
.filter((file) => file.endsWith('.agent.yaml') || (file.endsWith('.md') && !file.toLowerCase().includes('readme')))
|
|
347
|
+
.map((file) => file.replace(/\.(agent\.yaml|md)$/, ''));
|
|
348
|
+
}
|
|
349
|
+
} else if (Array.isArray(teamConfig.agents)) {
|
|
350
|
+
// Include specific agents listed
|
|
351
|
+
agentsToBundle = teamConfig.agents;
|
|
352
|
+
} else {
|
|
353
|
+
console.log(chalk.yellow(` ⚠ No agents specified in team configuration`));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// 3. Process each agent and their dependencies
|
|
357
|
+
for (const agentName of agentsToBundle) {
|
|
358
|
+
// Try YAML first, then MD
|
|
359
|
+
let agentPath = path.join(this.modulesPath, moduleName, 'agents', `${agentName}.agent.yaml`);
|
|
360
|
+
let isYaml = await fs.pathExists(agentPath);
|
|
361
|
+
|
|
362
|
+
if (!isYaml) {
|
|
363
|
+
agentPath = path.join(this.modulesPath, moduleName, 'agents', `${agentName}.md`);
|
|
364
|
+
if (!(await fs.pathExists(agentPath))) {
|
|
365
|
+
console.log(chalk.yellow(` ⚠ Agent not found: ${agentName}`));
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
let agentXml;
|
|
371
|
+
|
|
372
|
+
if (isYaml) {
|
|
373
|
+
// Check for webskip flag in YAML
|
|
374
|
+
const yamlContent = await fs.readFile(agentPath, 'utf8');
|
|
375
|
+
const agentYaml = yaml.load(yamlContent);
|
|
376
|
+
|
|
377
|
+
if (agentYaml?.agent?.webskip === true) {
|
|
378
|
+
console.log(chalk.gray(` ⊘ Skipped agent (webskip="true"): ${agentName}`));
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Build YAML agent in-memory - skip activation for team agents (orchestrator handles it)
|
|
383
|
+
const xmlContent = await this.yamlBuilder.buildFromYaml(agentPath, null, {
|
|
384
|
+
includeMetadata: false,
|
|
385
|
+
skipActivation: true, // Skip activation for team agents
|
|
386
|
+
});
|
|
387
|
+
agentXml = this.extractAgentXml(xmlContent);
|
|
388
|
+
} else {
|
|
389
|
+
// Read legacy MD agent
|
|
390
|
+
const agentContent = await fs.readFile(agentPath, 'utf8');
|
|
391
|
+
agentXml = this.extractAgentXml(agentContent);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (!agentXml) {
|
|
395
|
+
console.log(chalk.yellow(` ⚠ No XML found in agent: ${agentName}`));
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Skip agents with bundle="false"
|
|
400
|
+
if (this.shouldSkipBundling(agentXml)) {
|
|
401
|
+
console.log(chalk.gray(` ⊘ Skipped agent (bundle="false"): ${agentName}`));
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Process {project-root} references
|
|
406
|
+
agentXml = this.processProjectRootReferences(agentXml);
|
|
407
|
+
|
|
408
|
+
// Resolve agent dependencies
|
|
409
|
+
const agentWarnings = [];
|
|
410
|
+
const { dependencies: agentDeps, skippedWorkflows } = await this.resolveAgentDependencies(agentXml, moduleName, agentWarnings);
|
|
411
|
+
|
|
412
|
+
if (agentWarnings.length > 0) {
|
|
413
|
+
warnings.push({ agent: agentName, warnings: agentWarnings });
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Remove commands for skipped workflows from agent XML
|
|
417
|
+
if (skippedWorkflows.length > 0) {
|
|
418
|
+
agentXml = this.removeSkippedWorkflowCommands(agentXml, skippedWorkflows);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Merge agent dependencies (deduplicate)
|
|
422
|
+
for (const [id, content] of agentDeps) {
|
|
423
|
+
if (!dependencies.has(id)) {
|
|
424
|
+
dependencies.set(id, content);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// Skip web activation injection for team agents - orchestrator handles everything
|
|
429
|
+
// Only inject help/exit menu items if missing
|
|
430
|
+
agentXml = this.injectHelpExitMenuItems(agentXml);
|
|
431
|
+
|
|
432
|
+
// Add agent XML to the collection
|
|
433
|
+
allAgentXmls.push(agentXml);
|
|
434
|
+
console.log(chalk.gray(` + Added agent: ${agentName}`));
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// 4. Build the team bundle XML
|
|
438
|
+
const bundle = this.buildTeamBundle(teamConfig.bundle, allAgentXmls, dependencies);
|
|
439
|
+
|
|
440
|
+
// 5. Validate XML
|
|
441
|
+
const isValid = await this.validateXml(bundle);
|
|
442
|
+
if (!isValid) {
|
|
443
|
+
console.log(chalk.red(` ⚠ Invalid XML generated for team!`));
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Format XML for readability
|
|
447
|
+
const formattedBundle = this.formatXml(bundle);
|
|
448
|
+
|
|
449
|
+
// 6. Write bundle to output
|
|
450
|
+
const outputPath = path.join(this.outputDir, moduleName, 'teams', `${teamName}.xml`);
|
|
451
|
+
await fs.ensureDir(path.dirname(outputPath));
|
|
452
|
+
await fs.writeFile(outputPath, formattedBundle, 'utf8');
|
|
453
|
+
|
|
454
|
+
const statusIcon = isValid ? chalk.green('✓') : chalk.yellow('⚠');
|
|
455
|
+
console.log(` ${statusIcon} Bundled team: ${teamName}.xml${isValid ? '' : chalk.yellow(' (invalid XML)')}`);
|
|
456
|
+
|
|
457
|
+
// Track warnings
|
|
458
|
+
if (warnings.length > 0) {
|
|
459
|
+
this.stats.warnings.push(...warnings);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Build the final team bundle XML
|
|
465
|
+
*/
|
|
466
|
+
buildTeamBundle(teamMetadata, agentXmls, dependencies) {
|
|
467
|
+
const parts = ['<?xml version="1.0" encoding="UTF-8"?>', '<team-bundle>', ' <!-- Agent Definitions -->', ' <agents>'];
|
|
468
|
+
|
|
469
|
+
for (const agentXml of agentXmls) {
|
|
470
|
+
// Indent each agent XML properly (add 4 spaces to each line)
|
|
471
|
+
const indentedAgent = agentXml
|
|
472
|
+
.split('\n')
|
|
473
|
+
.map((line) => ' ' + line)
|
|
474
|
+
.join('\n');
|
|
475
|
+
parts.push(indentedAgent);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
parts.push(' </agents>');
|
|
479
|
+
|
|
480
|
+
// Add all dependencies
|
|
481
|
+
if (dependencies && dependencies.size > 0) {
|
|
482
|
+
parts.push('', ' <!-- Shared Dependencies -->', ' <dependencies>');
|
|
483
|
+
|
|
484
|
+
for (const [id, content] of dependencies) {
|
|
485
|
+
// All dependencies are now consistently wrapped in <file> elements
|
|
486
|
+
// Indent properly (add 4 spaces to each line)
|
|
487
|
+
const indentedContent = content
|
|
488
|
+
.split('\n')
|
|
489
|
+
.map((line) => ' ' + line)
|
|
490
|
+
.join('\n');
|
|
491
|
+
parts.push(indentedContent);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
parts.push(' </dependencies>');
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
parts.push('</team-bundle>');
|
|
498
|
+
|
|
499
|
+
return parts.join('\n');
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Vendor cross-module workflows for a module
|
|
504
|
+
* Scans source agent YAML files for workflow-install attributes and copies workflows
|
|
505
|
+
*/
|
|
506
|
+
async vendorCrossModuleWorkflows(moduleName) {
|
|
507
|
+
const modulePath = path.join(this.modulesPath, moduleName);
|
|
508
|
+
const agentsPath = path.join(modulePath, 'agents');
|
|
509
|
+
|
|
510
|
+
if (!(await fs.pathExists(agentsPath))) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// Find all agent YAML files
|
|
515
|
+
const files = await fs.readdir(agentsPath);
|
|
516
|
+
const yamlFiles = files.filter((f) => f.endsWith('.agent.yaml'));
|
|
517
|
+
|
|
518
|
+
for (const agentFile of yamlFiles) {
|
|
519
|
+
const agentPath = path.join(agentsPath, agentFile);
|
|
520
|
+
const agentYaml = yaml.load(await fs.readFile(agentPath, 'utf8'));
|
|
521
|
+
|
|
522
|
+
const menuItems = agentYaml?.agent?.menu || [];
|
|
523
|
+
const workflowInstallItems = menuItems.filter((item) => item['workflow-install']);
|
|
524
|
+
|
|
525
|
+
for (const item of workflowInstallItems) {
|
|
526
|
+
const sourceWorkflowPath = item.workflow;
|
|
527
|
+
const installWorkflowPath = item['workflow-install'];
|
|
528
|
+
|
|
529
|
+
if (!sourceWorkflowPath || !installWorkflowPath) {
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Parse paths to extract module and workflow location
|
|
534
|
+
// Support both {project-root}/xiaoma/... and {project-root}/{xiaoma_folder}/... patterns
|
|
535
|
+
const sourceMatch = sourceWorkflowPath.match(/\{project-root\}\/(?:\{xiaoma_folder\}|xiaoma)\/([^/]+)\/workflows\/(.+)/);
|
|
536
|
+
const installMatch = installWorkflowPath.match(/\{project-root\}\/(?:\{xiaoma_folder\}|xiaoma)\/([^/]+)\/workflows\/(.+)/);
|
|
537
|
+
|
|
538
|
+
if (!sourceMatch || !installMatch) {
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
const sourceModule = sourceMatch[1];
|
|
543
|
+
const sourceWorkflowRelPath = sourceMatch[2];
|
|
544
|
+
const installModule = installMatch[1];
|
|
545
|
+
const installWorkflowRelPath = installMatch[2];
|
|
546
|
+
|
|
547
|
+
// Build actual filesystem paths
|
|
548
|
+
const actualSourceWorkflowPath = path.join(this.modulesPath, sourceModule, 'workflows', sourceWorkflowRelPath);
|
|
549
|
+
const actualDestWorkflowPath = path.join(this.modulesPath, installModule, 'workflows', installWorkflowRelPath);
|
|
550
|
+
|
|
551
|
+
// Check if source workflow exists
|
|
552
|
+
if (!(await fs.pathExists(actualSourceWorkflowPath))) {
|
|
553
|
+
console.log(chalk.yellow(` ⚠ Source workflow not found for vendoring: ${sourceWorkflowPath}`));
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// Check if destination already exists (skip if already vendored)
|
|
558
|
+
if (await fs.pathExists(actualDestWorkflowPath)) {
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Get workflow directory (workflow.yaml is in a directory with other files)
|
|
563
|
+
const sourceWorkflowDir = path.dirname(actualSourceWorkflowPath);
|
|
564
|
+
const destWorkflowDir = path.dirname(actualDestWorkflowPath);
|
|
565
|
+
|
|
566
|
+
// Copy entire workflow directory
|
|
567
|
+
await fs.copy(sourceWorkflowDir, destWorkflowDir, { overwrite: false });
|
|
568
|
+
|
|
569
|
+
// Update config_source in the vendored workflow.yaml
|
|
570
|
+
const workflowYamlPath = actualDestWorkflowPath;
|
|
571
|
+
if (await fs.pathExists(workflowYamlPath)) {
|
|
572
|
+
await this.updateWorkflowConfigSource(workflowYamlPath, installModule);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
console.log(chalk.dim(` → Vendored workflow: ${sourceWorkflowRelPath} → ${installModule}/workflows/${installWorkflowRelPath}`));
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Update config_source in a vendored workflow YAML file
|
|
582
|
+
*/
|
|
583
|
+
async updateWorkflowConfigSource(workflowYamlPath, newModuleName) {
|
|
584
|
+
let yamlContent = await fs.readFile(workflowYamlPath, 'utf8');
|
|
585
|
+
|
|
586
|
+
// Replace config_source with new module reference
|
|
587
|
+
// Support both old format (xiaoma) and new format ({xiaoma_folder})
|
|
588
|
+
const configSourcePattern = /config_source:\s*["']?\{project-root\}\/(?:\{xiaoma_folder\}|xiaoma)\/[^/]+\/config\.yaml["']?/g;
|
|
589
|
+
const newConfigSource = `config_source: "{project-root}/{xiaoma_folder}/${newModuleName}/config.yaml"`;
|
|
590
|
+
|
|
591
|
+
const updatedYaml = yamlContent.replaceAll(configSourcePattern, newConfigSource);
|
|
592
|
+
await fs.writeFile(workflowYamlPath, updatedYaml, 'utf8');
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Pre-discover all agents and teams in a module for manifest generation
|
|
597
|
+
*/
|
|
598
|
+
async preDiscoverModule(moduleName) {
|
|
599
|
+
const modulePath = path.join(this.modulesPath, moduleName);
|
|
600
|
+
|
|
601
|
+
// Clear any previously discovered agents for this module
|
|
602
|
+
this.discoveredAgents = this.discoveredAgents.filter((a) => a.module !== moduleName);
|
|
603
|
+
|
|
604
|
+
// Discover agents
|
|
605
|
+
const agentsPath = path.join(modulePath, 'agents');
|
|
606
|
+
if (await fs.pathExists(agentsPath)) {
|
|
607
|
+
const files = await fs.readdir(agentsPath);
|
|
608
|
+
for (const file of files) {
|
|
609
|
+
if (file.endsWith('.agent.yaml') || (file.endsWith('.md') && !file.toLowerCase().includes('readme'))) {
|
|
610
|
+
const agentPath = path.join(agentsPath, file);
|
|
611
|
+
let content;
|
|
612
|
+
|
|
613
|
+
if (file.endsWith('.agent.yaml')) {
|
|
614
|
+
// Check for webskip flag in YAML
|
|
615
|
+
const yamlContent = await fs.readFile(agentPath, 'utf8');
|
|
616
|
+
const agentYaml = yaml.load(yamlContent);
|
|
617
|
+
|
|
618
|
+
if (agentYaml?.agent?.webskip === true) {
|
|
619
|
+
continue; // Skip this agent
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// Build YAML agent in-memory
|
|
623
|
+
content = await this.yamlBuilder.buildFromYaml(agentPath, null, {
|
|
624
|
+
includeMetadata: false,
|
|
625
|
+
});
|
|
626
|
+
} else {
|
|
627
|
+
// Read legacy MD agent
|
|
628
|
+
content = await fs.readFile(agentPath, 'utf8');
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
const agentXml = this.extractAgentXml(content);
|
|
632
|
+
|
|
633
|
+
if (agentXml) {
|
|
634
|
+
// Skip agents with bundle="false"
|
|
635
|
+
if (this.shouldSkipBundling(agentXml)) {
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
const agentName = file.endsWith('.agent.yaml') ? path.basename(file, '.agent.yaml') : path.basename(file, '.md');
|
|
640
|
+
// Use the shared generator to extract agent details (pass full content)
|
|
641
|
+
const agentDetails = AgentPartyGenerator.extractAgentDetails(content, moduleName, agentName);
|
|
642
|
+
if (agentDetails) {
|
|
643
|
+
this.discoveredAgents.push(agentDetails);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// TODO: Discover teams when implemented
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Extract agent XML from markdown content
|
|
655
|
+
*/
|
|
656
|
+
extractAgentXml(content) {
|
|
657
|
+
// Try 4 backticks first (can contain 3 backtick blocks inside)
|
|
658
|
+
let match = content.match(/````xml\s*([\s\S]*?)````/);
|
|
659
|
+
if (!match) {
|
|
660
|
+
// Fall back to 3 backticks if no 4-backtick block found
|
|
661
|
+
match = content.match(/```xml\s*([\s\S]*?)```/);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
if (match) {
|
|
665
|
+
const xmlContent = match[1];
|
|
666
|
+
const agentMatch = xmlContent.match(/<agent[^>]*>[\s\S]*?<\/agent>/);
|
|
667
|
+
return agentMatch ? agentMatch[0] : null;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// Fall back to direct extraction
|
|
671
|
+
match = content.match(/<agent[^>]*>[\s\S]*?<\/agent>/);
|
|
672
|
+
return match ? match[0] : null;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Resolve all dependencies for an agent
|
|
677
|
+
*/
|
|
678
|
+
async resolveAgentDependencies(agentXml, moduleName, warnings = []) {
|
|
679
|
+
const dependencies = new Map();
|
|
680
|
+
const processed = new Set();
|
|
681
|
+
const skippedWorkflows = [];
|
|
682
|
+
|
|
683
|
+
// Extract file references from agent XML
|
|
684
|
+
const { refs, workflowRefs } = this.extractFileReferences(agentXml);
|
|
685
|
+
|
|
686
|
+
// Process regular file references
|
|
687
|
+
for (const ref of refs) {
|
|
688
|
+
await this.processFileDependency(ref, dependencies, processed, moduleName, warnings);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// Process workflow references with special handling
|
|
692
|
+
for (const workflowRef of workflowRefs) {
|
|
693
|
+
const result = await this.processWorkflowDependency(workflowRef, dependencies, processed, moduleName, warnings);
|
|
694
|
+
if (result && result.skipped) {
|
|
695
|
+
skippedWorkflows.push(workflowRef);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
return { dependencies, skippedWorkflows };
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Extract file references from agent XML
|
|
704
|
+
*/
|
|
705
|
+
extractFileReferences(xml) {
|
|
706
|
+
const refs = new Set();
|
|
707
|
+
const workflowRefs = new Set();
|
|
708
|
+
|
|
709
|
+
// Remove agent id attribute to prevent it from being treated as a dependency
|
|
710
|
+
// The id attribute is just a metadata identifier, not a file reference
|
|
711
|
+
const xmlWithoutAgentId = xml.replace(/<agent[^>]*id="[^"]*"[^>]*>/, (match) => {
|
|
712
|
+
return match.replace(/\sid="[^"]*"/, '');
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
// Match various file reference patterns
|
|
716
|
+
const patterns = [
|
|
717
|
+
/exec="([^"]+)"/g, // Command exec paths
|
|
718
|
+
/tmpl="([^"]+)"/g, // Template paths
|
|
719
|
+
/data="([^"]+)"/g, // Data file paths
|
|
720
|
+
/file="([^"]+)"/g, // Generic file refs
|
|
721
|
+
/src="([^"]+)"/g, // Source paths
|
|
722
|
+
/system-prompts="([^"]+)"/g,
|
|
723
|
+
/tools="([^"]+)"/g,
|
|
724
|
+
/knowledge="([^"]+)"/g,
|
|
725
|
+
/{project-root}\/([^"'\s<>]+)/g, // Legacy {project-root} paths
|
|
726
|
+
/\bxiaoma\/([^"'\s<>]+)/g, // Direct xiaoma/ paths (after {xiaoma_folder} replacement)
|
|
727
|
+
];
|
|
728
|
+
|
|
729
|
+
for (const pattern of patterns) {
|
|
730
|
+
let match;
|
|
731
|
+
// Use the XML with agent id removed for pattern matching
|
|
732
|
+
while ((match = pattern.exec(xmlWithoutAgentId)) !== null) {
|
|
733
|
+
let filePath = match[1];
|
|
734
|
+
// Remove {project-root} prefix if present
|
|
735
|
+
filePath = filePath.replace(/^{project-root}\//, '');
|
|
736
|
+
// Remove {xiaoma_folder} prefix if present (should be rare, mostly replaced already)
|
|
737
|
+
filePath = filePath.replace(/^{xiaoma_folder}\//, 'xiaoma/');
|
|
738
|
+
|
|
739
|
+
// For xiaoma/ pattern, prepend 'xiaoma/' since it was captured without it
|
|
740
|
+
if (pattern.source.includes(String.raw`\bxiaoma\/`)) {
|
|
741
|
+
filePath = 'xiaoma/' + filePath;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// Skip obvious placeholder/example paths
|
|
745
|
+
if (filePath && !filePath.includes('path/to/') && !filePath.includes('example') && !filePath.includes('...')) {
|
|
746
|
+
refs.add(filePath);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// Extract workflow references from agent files
|
|
752
|
+
const workflowPatterns = [
|
|
753
|
+
/workflow="([^"]+)"/g, // Menu items with workflow attribute
|
|
754
|
+
/validate-workflow="([^"]+)"/g, // Validation workflow references
|
|
755
|
+
];
|
|
756
|
+
|
|
757
|
+
for (const pattern of workflowPatterns) {
|
|
758
|
+
let match;
|
|
759
|
+
// Use original xml for workflow patterns (they don't conflict with agent id)
|
|
760
|
+
while ((match = pattern.exec(xml)) !== null) {
|
|
761
|
+
let workflowPath = match[1];
|
|
762
|
+
workflowPath = workflowPath.replace(/^{project-root}\//, '');
|
|
763
|
+
// Remove {xiaoma_folder} prefix if present and replace with xiaoma
|
|
764
|
+
workflowPath = workflowPath.replace(/^{xiaoma_folder}\//, 'xiaoma/');
|
|
765
|
+
|
|
766
|
+
// Skip obvious placeholder/example paths
|
|
767
|
+
if (workflowPath && workflowPath.endsWith('.yaml') && !workflowPath.includes('path/to/') && !workflowPath.includes('example')) {
|
|
768
|
+
workflowRefs.add(workflowPath);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
return { refs: [...refs], workflowRefs: [...workflowRefs] };
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Remove commands from agent XML that reference skipped workflows
|
|
778
|
+
*/
|
|
779
|
+
removeSkippedWorkflowCommands(agentXml, skippedWorkflows) {
|
|
780
|
+
let modifiedXml = agentXml;
|
|
781
|
+
|
|
782
|
+
// For each skipped workflow, find and remove menu items and commands
|
|
783
|
+
for (const workflowPath of skippedWorkflows) {
|
|
784
|
+
// Need to escape special regex characters in the path
|
|
785
|
+
const escapedPath = workflowPath.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
786
|
+
|
|
787
|
+
// Pattern 1: Remove <item> tags with workflow attribute
|
|
788
|
+
// Match: <item cmd="..." workflow="workflowPath">...</item>
|
|
789
|
+
const itemWorkflowPattern = new RegExp(`\\s*<item\\s+[^>]*workflow="[^"]*${escapedPath}"[^>]*>.*?</item>\\s*`, 'gs');
|
|
790
|
+
modifiedXml = modifiedXml.replace(itemWorkflowPattern, '');
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return modifiedXml;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Process a file dependency recursively
|
|
798
|
+
*/
|
|
799
|
+
async processFileDependency(filePath, dependencies, processed, moduleName, warnings = []) {
|
|
800
|
+
// Skip workflow YAML files - they're handled by processWorkflowDependency
|
|
801
|
+
if (filePath.includes('/workflow') && filePath.endsWith('workflow.yaml')) {
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// Skip if already processed
|
|
806
|
+
if (processed.has(filePath)) {
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
processed.add(filePath);
|
|
810
|
+
|
|
811
|
+
// Skip agent-manifest.csv manifest for web bundles (agents are already bundled)
|
|
812
|
+
if (filePath === 'xiaoma/_cfg/agent-manifest.csv' || filePath.endsWith('/agent-manifest.csv')) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// Handle wildcard patterns
|
|
817
|
+
if (filePath.includes('*')) {
|
|
818
|
+
await this.processWildcardDependency(filePath, dependencies, processed, moduleName, warnings);
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// Resolve actual file path
|
|
823
|
+
const actualPath = this.resolveFilePath(filePath, moduleName);
|
|
824
|
+
|
|
825
|
+
if (!actualPath || !(await fs.pathExists(actualPath))) {
|
|
826
|
+
warnings.push(filePath);
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// Skip if it's a directory
|
|
831
|
+
const stats = await fs.stat(actualPath);
|
|
832
|
+
if (stats.isDirectory()) {
|
|
833
|
+
// Silently skip directories - they're not file dependencies
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// Read file content
|
|
838
|
+
let content = await fs.readFile(actualPath, 'utf8');
|
|
839
|
+
|
|
840
|
+
// Process {project-root} references
|
|
841
|
+
content = this.processProjectRootReferences(content);
|
|
842
|
+
|
|
843
|
+
// Extract dependencies from frontmatter if present
|
|
844
|
+
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
845
|
+
if (frontmatterMatch) {
|
|
846
|
+
const frontmatter = frontmatterMatch[1];
|
|
847
|
+
// Look for dependencies in frontmatter
|
|
848
|
+
const depMatch = frontmatter.match(/dependencies:\s*\[(.*?)\]/);
|
|
849
|
+
if (depMatch) {
|
|
850
|
+
const deps = depMatch[1].match(/['"]([^'"]+)['"]/g);
|
|
851
|
+
if (deps) {
|
|
852
|
+
for (const dep of deps) {
|
|
853
|
+
let depPath = dep.replaceAll(/['"]/g, '').replace(/^{project-root}\//, '');
|
|
854
|
+
depPath = depPath.replace(/^{xiaoma_folder}\//, 'xiaoma/');
|
|
855
|
+
if (depPath && !processed.has(depPath)) {
|
|
856
|
+
await this.processFileDependency(depPath, dependencies, processed, moduleName, warnings);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
// Look for template references
|
|
862
|
+
const templateMatch = frontmatter.match(/template:\s*\[(.*?)\]/);
|
|
863
|
+
if (templateMatch) {
|
|
864
|
+
const templates = templateMatch[1].match(/['"]([^'"]+)['"]/g);
|
|
865
|
+
if (templates) {
|
|
866
|
+
for (const template of templates) {
|
|
867
|
+
let templatePath = template.replaceAll(/['"]/g, '').replace(/^{project-root}\//, '');
|
|
868
|
+
templatePath = templatePath.replace(/^{xiaoma_folder}\//, 'xiaoma/');
|
|
869
|
+
if (templatePath && !processed.has(templatePath)) {
|
|
870
|
+
await this.processFileDependency(templatePath, dependencies, processed, moduleName, warnings);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
// Extract XML from markdown if applicable
|
|
878
|
+
const ext = path.extname(actualPath).toLowerCase();
|
|
879
|
+
let processedContent = content;
|
|
880
|
+
|
|
881
|
+
switch (ext) {
|
|
882
|
+
case '.md': {
|
|
883
|
+
// Try to extract XML from markdown - handle both 3 and 4 backtick blocks
|
|
884
|
+
// First try 4 backticks (which can contain 3 backtick blocks inside)
|
|
885
|
+
let xmlMatches = [...content.matchAll(/````xml\s*([\s\S]*?)````/g)];
|
|
886
|
+
|
|
887
|
+
// If no 4-backtick blocks, try 3 backticks
|
|
888
|
+
if (xmlMatches.length === 0) {
|
|
889
|
+
xmlMatches = [...content.matchAll(/```xml\s*([\s\S]*?)```/g)];
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
const xmlBlocks = [];
|
|
893
|
+
|
|
894
|
+
for (const match of xmlMatches) {
|
|
895
|
+
if (match[1]) {
|
|
896
|
+
xmlBlocks.push(match[1].trim());
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
if (xmlBlocks.length > 0) {
|
|
901
|
+
// For XML content, just include it directly (it's already valid XML)
|
|
902
|
+
processedContent = xmlBlocks.join('\n\n');
|
|
903
|
+
} else {
|
|
904
|
+
// No XML blocks found, skip non-XML markdown files
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
break;
|
|
909
|
+
}
|
|
910
|
+
case '.csv': {
|
|
911
|
+
// CSV files need special handling - convert to XML file-index
|
|
912
|
+
const lines = content.split('\n').filter((line) => line.trim());
|
|
913
|
+
if (lines.length === 0) return;
|
|
914
|
+
|
|
915
|
+
const headers = lines[0].split(',').map((h) => h.trim());
|
|
916
|
+
const rows = lines.slice(1);
|
|
917
|
+
|
|
918
|
+
const indexParts = [`<file-index id="${filePath}">`];
|
|
919
|
+
indexParts.push(' <items>');
|
|
920
|
+
|
|
921
|
+
// Track files referenced in CSV for additional bundling
|
|
922
|
+
const referencedFiles = new Set();
|
|
923
|
+
|
|
924
|
+
for (const row of rows) {
|
|
925
|
+
const values = row.split(',').map((v) => v.trim());
|
|
926
|
+
if (values.every((v) => !v)) continue;
|
|
927
|
+
|
|
928
|
+
indexParts.push(' <item>');
|
|
929
|
+
for (const [i, header] of headers.entries()) {
|
|
930
|
+
const value = values[i] || '';
|
|
931
|
+
const tagName = header.toLowerCase().replaceAll(/[^a-z0-9]/g, '_');
|
|
932
|
+
indexParts.push(` <${tagName}>${value}</${tagName}>`);
|
|
933
|
+
|
|
934
|
+
// Track referenced files
|
|
935
|
+
if (header.toLowerCase().includes('file') && value.endsWith('.md')) {
|
|
936
|
+
// Build path relative to CSV location
|
|
937
|
+
const csvDir = path.dirname(actualPath);
|
|
938
|
+
const refPath = path.join(csvDir, value);
|
|
939
|
+
if (fs.existsSync(refPath)) {
|
|
940
|
+
const refId = filePath.replace('index.csv', value);
|
|
941
|
+
referencedFiles.add(refId);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
indexParts.push(' </item>');
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
indexParts.push(' </items>', '</file-index>');
|
|
949
|
+
|
|
950
|
+
// Store the XML version wrapped in a file element
|
|
951
|
+
const csvXml = indexParts.join('\n');
|
|
952
|
+
const wrappedCsv = `<file id="${filePath}" type="xml">\n${csvXml}\n</file>`;
|
|
953
|
+
dependencies.set(filePath, wrappedCsv);
|
|
954
|
+
|
|
955
|
+
// Process referenced files from CSV
|
|
956
|
+
for (const refId of referencedFiles) {
|
|
957
|
+
if (!processed.has(refId)) {
|
|
958
|
+
await this.processFileDependency(refId, dependencies, processed, moduleName, warnings);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
case '.xml': {
|
|
965
|
+
// XML files can be included directly
|
|
966
|
+
processedContent = content;
|
|
967
|
+
break;
|
|
968
|
+
}
|
|
969
|
+
default: {
|
|
970
|
+
// For other non-XML file types, skip them
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// Determine file type for wrapping
|
|
976
|
+
let fileType = 'text';
|
|
977
|
+
if (ext === '.xml' || (ext === '.md' && processedContent.trim().startsWith('<'))) {
|
|
978
|
+
fileType = 'xml';
|
|
979
|
+
} else
|
|
980
|
+
switch (ext) {
|
|
981
|
+
case '.yaml':
|
|
982
|
+
case '.yml': {
|
|
983
|
+
fileType = 'yaml';
|
|
984
|
+
|
|
985
|
+
break;
|
|
986
|
+
}
|
|
987
|
+
case '.json': {
|
|
988
|
+
fileType = 'json';
|
|
989
|
+
|
|
990
|
+
break;
|
|
991
|
+
}
|
|
992
|
+
case '.md': {
|
|
993
|
+
fileType = 'md';
|
|
994
|
+
|
|
995
|
+
break;
|
|
996
|
+
}
|
|
997
|
+
// No default
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// Wrap content in file element and store
|
|
1001
|
+
const wrappedContent = this.wrapContentInXml(processedContent, filePath, fileType);
|
|
1002
|
+
dependencies.set(filePath, wrappedContent);
|
|
1003
|
+
|
|
1004
|
+
// Recursively scan for more dependencies
|
|
1005
|
+
const { refs: nestedRefs } = this.extractFileReferences(processedContent);
|
|
1006
|
+
for (const ref of nestedRefs) {
|
|
1007
|
+
await this.processFileDependency(ref, dependencies, processed, moduleName, warnings);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Process a workflow YAML file and its bundle files
|
|
1013
|
+
*/
|
|
1014
|
+
async processWorkflowDependency(workflowPath, dependencies, processed, moduleName, warnings = []) {
|
|
1015
|
+
// Skip if already processed
|
|
1016
|
+
if (processed.has(workflowPath)) {
|
|
1017
|
+
return { skipped: false };
|
|
1018
|
+
}
|
|
1019
|
+
processed.add(workflowPath);
|
|
1020
|
+
|
|
1021
|
+
// Resolve actual file path
|
|
1022
|
+
const actualPath = this.resolveFilePath(workflowPath, moduleName);
|
|
1023
|
+
|
|
1024
|
+
if (!actualPath || !(await fs.pathExists(actualPath))) {
|
|
1025
|
+
warnings.push(workflowPath);
|
|
1026
|
+
return { skipped: true };
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
// Read and parse YAML file
|
|
1030
|
+
const yamlContent = await fs.readFile(actualPath, 'utf8');
|
|
1031
|
+
let workflowConfig;
|
|
1032
|
+
|
|
1033
|
+
try {
|
|
1034
|
+
workflowConfig = yaml.load(yamlContent);
|
|
1035
|
+
} catch (error) {
|
|
1036
|
+
warnings.push(`${workflowPath} (invalid YAML: ${error.message})`);
|
|
1037
|
+
return { skipped: true };
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
// Check if web_bundle is explicitly set to false
|
|
1041
|
+
if (workflowConfig.web_bundle === false) {
|
|
1042
|
+
// Mark this workflow as skipped so we can remove the command from agent
|
|
1043
|
+
return { skipped: true, workflowPath };
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// Create YAML content with only web_bundle section (flattened)
|
|
1047
|
+
let bundleYamlContent;
|
|
1048
|
+
if (workflowConfig.web_bundle && typeof workflowConfig.web_bundle === 'object') {
|
|
1049
|
+
// Only include the web_bundle content, flattened to root level
|
|
1050
|
+
bundleYamlContent = yaml.dump(workflowConfig.web_bundle);
|
|
1051
|
+
} else {
|
|
1052
|
+
// If no web_bundle section, include full YAML
|
|
1053
|
+
bundleYamlContent = yamlContent;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// Process {project-root} and {xiaoma_folder} references in the YAML content
|
|
1057
|
+
bundleYamlContent = this.processProjectRootReferences(bundleYamlContent);
|
|
1058
|
+
|
|
1059
|
+
// Include the YAML file with only web_bundle content, wrapped in XML
|
|
1060
|
+
// Process the workflow path to create a clean ID
|
|
1061
|
+
let yamlId = workflowPath.replace(/^{project-root}\//, '');
|
|
1062
|
+
yamlId = yamlId.replace(/^{xiaoma_folder}\//, 'xiaoma/');
|
|
1063
|
+
const wrappedYaml = this.wrapContentInXml(bundleYamlContent, yamlId, 'yaml');
|
|
1064
|
+
dependencies.set(yamlId, wrappedYaml);
|
|
1065
|
+
|
|
1066
|
+
// Always include core workflow task when processing workflows
|
|
1067
|
+
await this.includeCoreWorkflowFiles(dependencies, processed, moduleName, warnings);
|
|
1068
|
+
|
|
1069
|
+
// Check if advanced elicitation is enabled
|
|
1070
|
+
if (workflowConfig.web_bundle && workflowConfig.web_bundle.use_advanced_elicitation) {
|
|
1071
|
+
await this.includeAdvancedElicitationFiles(dependencies, processed, moduleName, warnings);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// Process web_bundle_files if they exist
|
|
1075
|
+
if (workflowConfig.web_bundle && workflowConfig.web_bundle.web_bundle_files) {
|
|
1076
|
+
const bundleFiles = workflowConfig.web_bundle.web_bundle_files;
|
|
1077
|
+
|
|
1078
|
+
for (const bundleFilePath of bundleFiles) {
|
|
1079
|
+
// Process the file path to create a clean ID for checking if already processed
|
|
1080
|
+
let cleanFilePath = bundleFilePath.replace(/^{project-root}\//, '');
|
|
1081
|
+
cleanFilePath = cleanFilePath.replace(/^{xiaoma_folder}\//, 'xiaoma/');
|
|
1082
|
+
|
|
1083
|
+
if (processed.has(cleanFilePath)) {
|
|
1084
|
+
continue;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
const bundleActualPath = this.resolveFilePath(bundleFilePath, moduleName);
|
|
1088
|
+
|
|
1089
|
+
if (!bundleActualPath || !(await fs.pathExists(bundleActualPath))) {
|
|
1090
|
+
// Use the cleaned path in warnings (with {xiaoma_folder} replaced)
|
|
1091
|
+
warnings.push(cleanFilePath);
|
|
1092
|
+
continue;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
// Check if this is another workflow.yaml file - if so, recursively process it
|
|
1096
|
+
if (bundleFilePath.endsWith('workflow.yaml')) {
|
|
1097
|
+
// Recursively process this workflow and its dependencies
|
|
1098
|
+
await this.processWorkflowDependency(bundleFilePath, dependencies, processed, moduleName, warnings);
|
|
1099
|
+
} else {
|
|
1100
|
+
// Regular file - process normally
|
|
1101
|
+
processed.add(cleanFilePath);
|
|
1102
|
+
|
|
1103
|
+
// Read the file content
|
|
1104
|
+
let fileContent = await fs.readFile(bundleActualPath, 'utf8');
|
|
1105
|
+
const fileExt = path.extname(bundleActualPath).toLowerCase().replace('.', '');
|
|
1106
|
+
|
|
1107
|
+
// Process {project-root} references before wrapping
|
|
1108
|
+
fileContent = this.processProjectRootReferences(fileContent);
|
|
1109
|
+
|
|
1110
|
+
// Wrap in XML with proper escaping
|
|
1111
|
+
const wrappedContent = this.wrapContentInXml(fileContent, cleanFilePath, fileExt);
|
|
1112
|
+
dependencies.set(cleanFilePath, wrappedContent);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
return { skipped: false };
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* Include core workflow task files
|
|
1122
|
+
*/
|
|
1123
|
+
async includeCoreWorkflowFiles(dependencies, processed, moduleName, warnings = []) {
|
|
1124
|
+
const coreWorkflowPath = 'xiaoma/core/tasks/workflow.xml';
|
|
1125
|
+
|
|
1126
|
+
if (processed.has(coreWorkflowPath)) {
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
processed.add(coreWorkflowPath);
|
|
1130
|
+
|
|
1131
|
+
const actualPath = this.resolveFilePath(coreWorkflowPath, moduleName);
|
|
1132
|
+
|
|
1133
|
+
if (!actualPath || !(await fs.pathExists(actualPath))) {
|
|
1134
|
+
warnings.push(coreWorkflowPath);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
let fileContent = await fs.readFile(actualPath, 'utf8');
|
|
1139
|
+
// Process {project-root} and {xiaoma_folder} references
|
|
1140
|
+
fileContent = this.processProjectRootReferences(fileContent);
|
|
1141
|
+
const wrappedContent = this.wrapContentInXml(fileContent, coreWorkflowPath, 'xml');
|
|
1142
|
+
dependencies.set(coreWorkflowPath, wrappedContent);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* Include advanced elicitation files
|
|
1147
|
+
*/
|
|
1148
|
+
async includeAdvancedElicitationFiles(dependencies, processed, moduleName, warnings = []) {
|
|
1149
|
+
const elicitationFiles = ['xiaoma/core/tasks/advanced-elicitation.xml', 'xiaoma/core/tasks/advanced-elicitation-methods.csv'];
|
|
1150
|
+
|
|
1151
|
+
for (const filePath of elicitationFiles) {
|
|
1152
|
+
if (processed.has(filePath)) {
|
|
1153
|
+
continue;
|
|
1154
|
+
}
|
|
1155
|
+
processed.add(filePath);
|
|
1156
|
+
|
|
1157
|
+
const actualPath = this.resolveFilePath(filePath, moduleName);
|
|
1158
|
+
|
|
1159
|
+
if (!actualPath || !(await fs.pathExists(actualPath))) {
|
|
1160
|
+
warnings.push(filePath);
|
|
1161
|
+
continue;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
let fileContent = await fs.readFile(actualPath, 'utf8');
|
|
1165
|
+
// Process {project-root} and {xiaoma_folder} references
|
|
1166
|
+
fileContent = this.processProjectRootReferences(fileContent);
|
|
1167
|
+
const fileExt = path.extname(actualPath).toLowerCase().replace('.', '');
|
|
1168
|
+
const wrappedContent = this.wrapContentInXml(fileContent, filePath, fileExt);
|
|
1169
|
+
dependencies.set(filePath, wrappedContent);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Wrap file content in XML with proper escaping
|
|
1175
|
+
*/
|
|
1176
|
+
wrapContentInXml(content, id, type = 'text') {
|
|
1177
|
+
// For XML files, include directly without CDATA (they're already valid XML)
|
|
1178
|
+
if (type === 'xml') {
|
|
1179
|
+
// XML files can be included directly as they're already well-formed
|
|
1180
|
+
// Just wrap in a file element
|
|
1181
|
+
return `<file id="${id}" type="${type}">\n${content}\n</file>`;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// For all other file types, use CDATA to preserve content exactly
|
|
1185
|
+
// Escape any ]]> sequences in the content by splitting CDATA sections
|
|
1186
|
+
// Replace ]]> with ]]]]><![CDATA[> to properly escape it within CDATA
|
|
1187
|
+
const escapedContent = content.replaceAll(']]>', ']]]]><![CDATA[>');
|
|
1188
|
+
|
|
1189
|
+
// Use CDATA to preserve content exactly as-is, including special characters
|
|
1190
|
+
return `<file id="${id}" type="${type}"><![CDATA[${escapedContent}]]></file>`;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Process wildcard dependency patterns
|
|
1195
|
+
*/
|
|
1196
|
+
async processWildcardDependency(pattern, dependencies, processed, moduleName, warnings = []) {
|
|
1197
|
+
// Remove {project-root} prefix
|
|
1198
|
+
pattern = pattern.replace(/^{project-root}\//, '');
|
|
1199
|
+
// Replace {xiaoma_folder} with xiaoma
|
|
1200
|
+
pattern = pattern.replace(/^{xiaoma_folder}\//, 'xiaoma/');
|
|
1201
|
+
|
|
1202
|
+
// Get directory and file pattern
|
|
1203
|
+
const lastSlash = pattern.lastIndexOf('/');
|
|
1204
|
+
const dirPath = pattern.slice(0, Math.max(0, lastSlash));
|
|
1205
|
+
const filePattern = pattern.slice(Math.max(0, lastSlash + 1));
|
|
1206
|
+
|
|
1207
|
+
// Resolve directory path without checking file existence
|
|
1208
|
+
let dir;
|
|
1209
|
+
if (dirPath.startsWith('xiaoma/')) {
|
|
1210
|
+
// Remove xiaoma/ prefix
|
|
1211
|
+
const actualPath = dirPath.replace(/^xiaoma\//, '');
|
|
1212
|
+
|
|
1213
|
+
// Try different path mappings for directories
|
|
1214
|
+
const possibleDirs = [
|
|
1215
|
+
// Try as module path: xiaoma/cis/... -> src/modules/cis/...
|
|
1216
|
+
path.join(this.sourceDir, 'modules', actualPath),
|
|
1217
|
+
// Try as direct path: xiaoma/core/... -> src/core/...
|
|
1218
|
+
path.join(this.sourceDir, actualPath),
|
|
1219
|
+
];
|
|
1220
|
+
|
|
1221
|
+
for (const testDir of possibleDirs) {
|
|
1222
|
+
if (fs.existsSync(testDir)) {
|
|
1223
|
+
dir = testDir;
|
|
1224
|
+
break;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
if (!dir) {
|
|
1230
|
+
warnings.push(`${pattern} (could not resolve directory)`);
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
if (!(await fs.pathExists(dir))) {
|
|
1234
|
+
warnings.push(pattern);
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// Read directory and match files
|
|
1239
|
+
const files = await fs.readdir(dir);
|
|
1240
|
+
let matchedFiles = [];
|
|
1241
|
+
|
|
1242
|
+
if (filePattern === '*.*') {
|
|
1243
|
+
matchedFiles = files;
|
|
1244
|
+
} else if (filePattern.startsWith('*.')) {
|
|
1245
|
+
const ext = filePattern.slice(1);
|
|
1246
|
+
matchedFiles = files.filter((f) => f.endsWith(ext));
|
|
1247
|
+
} else {
|
|
1248
|
+
// Simple glob matching
|
|
1249
|
+
const regex = new RegExp('^' + filePattern.replace('*', '.*') + '$');
|
|
1250
|
+
matchedFiles = files.filter((f) => regex.test(f));
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// Process each matched file
|
|
1254
|
+
for (const file of matchedFiles) {
|
|
1255
|
+
const fullPath = dirPath + '/' + file;
|
|
1256
|
+
if (!processed.has(fullPath)) {
|
|
1257
|
+
await this.processFileDependency(fullPath, dependencies, processed, moduleName, warnings);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
/**
|
|
1263
|
+
* Resolve file path relative to project
|
|
1264
|
+
*/
|
|
1265
|
+
resolveFilePath(filePath, moduleName) {
|
|
1266
|
+
// Remove {project-root} prefix
|
|
1267
|
+
filePath = filePath.replace(/^{project-root}\//, '');
|
|
1268
|
+
// Replace {xiaoma_folder} with xiaoma
|
|
1269
|
+
filePath = filePath.replace(/^{xiaoma_folder}\//, 'xiaoma/');
|
|
1270
|
+
filePath = filePath.replace(/^{xiaoma_folder}$/, 'xiaoma');
|
|
1271
|
+
|
|
1272
|
+
// Check temp directory first for _cfg files
|
|
1273
|
+
if (filePath.startsWith('xiaoma/_cfg/')) {
|
|
1274
|
+
const filename = filePath.split('/').pop();
|
|
1275
|
+
const tempPath = path.join(this.tempManifestDir, filename);
|
|
1276
|
+
if (fs.existsSync(tempPath)) {
|
|
1277
|
+
return tempPath;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
// Handle different path patterns for xiaoma files
|
|
1282
|
+
// xiaoma/cis/tasks/brain-session.md -> src/modules/cis/tasks/brain-session.md
|
|
1283
|
+
// xiaoma/core/tasks/create-doc.md -> src/core/tasks/create-doc.md
|
|
1284
|
+
// xiaoma/xmc/templates/brief.md -> src/modules/xmc/templates/brief.md
|
|
1285
|
+
|
|
1286
|
+
let actualPath = filePath;
|
|
1287
|
+
|
|
1288
|
+
if (filePath.startsWith('xiaoma/')) {
|
|
1289
|
+
// Remove xiaoma/ prefix
|
|
1290
|
+
actualPath = filePath.replace(/^xiaoma\//, '');
|
|
1291
|
+
|
|
1292
|
+
// Check if it's a module-specific file (cis, xmc, etc) or core file
|
|
1293
|
+
const parts = actualPath.split('/');
|
|
1294
|
+
const firstPart = parts[0];
|
|
1295
|
+
|
|
1296
|
+
// Try different path mappings
|
|
1297
|
+
const possiblePaths = [
|
|
1298
|
+
// Try in temp directory first
|
|
1299
|
+
path.join(this.tempDir, filePath),
|
|
1300
|
+
// Try as module path: xiaoma/cis/... -> src/modules/cis/...
|
|
1301
|
+
path.join(this.sourceDir, 'modules', actualPath),
|
|
1302
|
+
// Try as direct path: xiaoma/core/... -> src/core/...
|
|
1303
|
+
path.join(this.sourceDir, actualPath),
|
|
1304
|
+
// Try without any prefix in src
|
|
1305
|
+
path.join(this.sourceDir, parts.slice(1).join('/')),
|
|
1306
|
+
// Try in project root
|
|
1307
|
+
path.join(this.sourceDir, '..', actualPath),
|
|
1308
|
+
// Try original with xiaoma
|
|
1309
|
+
path.join(this.sourceDir, '..', filePath),
|
|
1310
|
+
];
|
|
1311
|
+
|
|
1312
|
+
for (const testPath of possiblePaths) {
|
|
1313
|
+
if (fs.existsSync(testPath)) {
|
|
1314
|
+
return testPath;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// Try standard paths for non-xiaoma files
|
|
1320
|
+
const basePaths = [
|
|
1321
|
+
this.sourceDir, // src directory
|
|
1322
|
+
path.join(this.modulesPath, moduleName), // Current module
|
|
1323
|
+
path.join(this.sourceDir, '..'), // Project root
|
|
1324
|
+
];
|
|
1325
|
+
|
|
1326
|
+
for (const basePath of basePaths) {
|
|
1327
|
+
const fullPath = path.join(basePath, actualPath);
|
|
1328
|
+
if (fs.existsSync(fullPath)) {
|
|
1329
|
+
return fullPath;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
return null;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Process and remove {project-root} references and replace {xiaoma_folder} with xiaoma
|
|
1338
|
+
*/
|
|
1339
|
+
processProjectRootReferences(content) {
|
|
1340
|
+
// Remove {project-root}/ prefix (with slash)
|
|
1341
|
+
content = content.replaceAll('{project-root}/', '');
|
|
1342
|
+
// Also remove {project-root} without slash
|
|
1343
|
+
content = content.replaceAll('{project-root}', '');
|
|
1344
|
+
// Replace {xiaoma_folder} with xiaoma
|
|
1345
|
+
content = content.replaceAll('{xiaoma_folder}', 'xiaoma');
|
|
1346
|
+
return content;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Escape special XML characters in text content
|
|
1351
|
+
*/
|
|
1352
|
+
escapeXmlText(text) {
|
|
1353
|
+
return text
|
|
1354
|
+
.replaceAll('&', '&')
|
|
1355
|
+
.replaceAll('<', '<')
|
|
1356
|
+
.replaceAll('>', '>')
|
|
1357
|
+
.replaceAll('"', '"')
|
|
1358
|
+
.replaceAll("'", ''');
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Escape XML content while preserving XML tags
|
|
1363
|
+
*/
|
|
1364
|
+
escapeXmlContent(content) {
|
|
1365
|
+
const tagPattern = /<([^>]+)>/g;
|
|
1366
|
+
const parts = [];
|
|
1367
|
+
let lastIndex = 0;
|
|
1368
|
+
let match;
|
|
1369
|
+
|
|
1370
|
+
while ((match = tagPattern.exec(content)) !== null) {
|
|
1371
|
+
if (match.index > lastIndex) {
|
|
1372
|
+
parts.push(this.escapeXmlText(content.slice(lastIndex, match.index)));
|
|
1373
|
+
}
|
|
1374
|
+
parts.push('<' + match[1] + '>');
|
|
1375
|
+
lastIndex = match.index + match[0].length;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
if (lastIndex < content.length) {
|
|
1379
|
+
parts.push(this.escapeXmlText(content.slice(lastIndex)));
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
return parts.join('');
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/**
|
|
1386
|
+
* Inject help and exit menu items into agent XML
|
|
1387
|
+
*/
|
|
1388
|
+
injectHelpExitMenuItems(agentXml) {
|
|
1389
|
+
// Check if menu already has help and exit
|
|
1390
|
+
const hasHelp = agentXml.includes('cmd="*help"') || agentXml.includes('trigger="*help"');
|
|
1391
|
+
const hasExit = agentXml.includes('cmd="*exit"') || agentXml.includes('trigger="*exit"');
|
|
1392
|
+
|
|
1393
|
+
if (hasHelp && hasExit) {
|
|
1394
|
+
return agentXml; // Already has both, skip injection
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
// Find the menu section
|
|
1398
|
+
const menuMatch = agentXml.match(/(<menu>[\s\S]*?<\/menu>)/);
|
|
1399
|
+
if (!menuMatch) {
|
|
1400
|
+
return agentXml; // No menu found, skip injection
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
const menuContent = menuMatch[1];
|
|
1404
|
+
const menuClosingMatch = menuContent.match(/(\s*)<\/menu>/);
|
|
1405
|
+
if (!menuClosingMatch) {
|
|
1406
|
+
return agentXml;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
const indent = menuClosingMatch[1];
|
|
1410
|
+
const menuItems = [];
|
|
1411
|
+
|
|
1412
|
+
if (!hasHelp) {
|
|
1413
|
+
menuItems.push(`${indent}<item cmd="*menu">[M] Redisplay Menu Options</item>`);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
if (!hasExit) {
|
|
1417
|
+
menuItems.push(`${indent}<item cmd="*dismiss">[D] Dismiss Agent</item>`);
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
if (menuItems.length === 0) {
|
|
1421
|
+
return agentXml;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
// Inject menu items before closing </menu> tag
|
|
1425
|
+
const newMenuContent = menuContent.replace(/(\s*)<\/menu>/, `\n${menuItems.join('\n')}\n${indent}</menu>`);
|
|
1426
|
+
return agentXml.replace(menuContent, newMenuContent);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* Inject web activation instructions into agent XML
|
|
1431
|
+
*/
|
|
1432
|
+
injectWebActivation(agentXml) {
|
|
1433
|
+
// First, always inject help/exit menu items
|
|
1434
|
+
agentXml = this.injectHelpExitMenuItems(agentXml);
|
|
1435
|
+
|
|
1436
|
+
// Load the web activation template
|
|
1437
|
+
const activationPath = path.join(this.sourceDir, 'utility', 'models', 'agent-activation-web.xml');
|
|
1438
|
+
|
|
1439
|
+
if (!fs.existsSync(activationPath)) {
|
|
1440
|
+
console.warn(chalk.yellow('Warning: agent-activation-web.xml not found, skipping activation injection'));
|
|
1441
|
+
return agentXml;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
const activationXml = fs.readFileSync(activationPath, 'utf8');
|
|
1445
|
+
|
|
1446
|
+
// For web bundles, ALWAYS replace existing activation with web activation
|
|
1447
|
+
// This is because fragment-based activation assumes filesystem access which won't work in web bundles
|
|
1448
|
+
const hasActivation = agentXml.includes('<activation');
|
|
1449
|
+
|
|
1450
|
+
if (hasActivation) {
|
|
1451
|
+
// Replace existing activation block with web activation
|
|
1452
|
+
const injectedXml = agentXml.replace(/<activation[^>]*>[\s\S]*?<\/activation>/, activationXml);
|
|
1453
|
+
return injectedXml;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
// Check for critical-actions block (legacy)
|
|
1457
|
+
const hasCriticalActions = agentXml.includes('<critical-actions');
|
|
1458
|
+
|
|
1459
|
+
if (hasCriticalActions) {
|
|
1460
|
+
// Replace critical-actions block with activation
|
|
1461
|
+
const injectedXml = agentXml.replace(/<critical-actions>[\s\S]*?<\/critical-actions>/, activationXml);
|
|
1462
|
+
return injectedXml;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
// If no critical-actions, inject before closing </agent> tag
|
|
1466
|
+
const closingTagMatch = agentXml.match(/(\s*)<\/agent>/);
|
|
1467
|
+
if (!closingTagMatch) {
|
|
1468
|
+
console.warn(chalk.yellow('Warning: Could not find </agent> tag for activation injection'));
|
|
1469
|
+
return agentXml;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
// Inject the activation block before the closing </agent> tag
|
|
1473
|
+
// Properly indent each line of the activation XML
|
|
1474
|
+
const indent = closingTagMatch[1];
|
|
1475
|
+
const indentedActivation = activationXml
|
|
1476
|
+
.split('\n')
|
|
1477
|
+
.map((line) => (line.trim() ? indent + line : ''))
|
|
1478
|
+
.join('\n');
|
|
1479
|
+
|
|
1480
|
+
const injectedXml = agentXml.replace(/(\s*)<\/agent>/, `\n${indentedActivation}\n${indent}</agent>`);
|
|
1481
|
+
|
|
1482
|
+
return injectedXml;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* Build the final agent bundle XML
|
|
1487
|
+
*/
|
|
1488
|
+
buildAgentBundle(agentXml, dependencies) {
|
|
1489
|
+
// Web activation is now handled by fragments during YAML building
|
|
1490
|
+
// agentXml = this.injectWebActivation(agentXml);
|
|
1491
|
+
|
|
1492
|
+
const parts = [
|
|
1493
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
1494
|
+
'<agent-bundle>',
|
|
1495
|
+
' <!-- Agent Definition -->',
|
|
1496
|
+
' ' + agentXml.replaceAll('\n', '\n '),
|
|
1497
|
+
];
|
|
1498
|
+
|
|
1499
|
+
// Add dependencies (all are now consistently wrapped in <file> elements)
|
|
1500
|
+
if (dependencies && dependencies.size > 0) {
|
|
1501
|
+
parts.push('\n <!-- Dependencies -->');
|
|
1502
|
+
for (const [id, content] of dependencies) {
|
|
1503
|
+
// All dependencies are now wrapped in <file> elements
|
|
1504
|
+
// Indent properly
|
|
1505
|
+
const indentedContent = content
|
|
1506
|
+
.split('\n')
|
|
1507
|
+
.map((line) => ' ' + line)
|
|
1508
|
+
.join('\n');
|
|
1509
|
+
parts.push(indentedContent);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
parts.push('</agent-bundle>');
|
|
1514
|
+
|
|
1515
|
+
return parts.join('\n');
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* Discover all modules
|
|
1520
|
+
*/
|
|
1521
|
+
async discoverModules() {
|
|
1522
|
+
const modules = [];
|
|
1523
|
+
|
|
1524
|
+
if (!(await fs.pathExists(this.modulesPath))) {
|
|
1525
|
+
console.log(chalk.yellow('No modules directory found'));
|
|
1526
|
+
return modules;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
const entries = await fs.readdir(this.modulesPath, { withFileTypes: true });
|
|
1530
|
+
|
|
1531
|
+
for (const entry of entries) {
|
|
1532
|
+
if (entry.isDirectory()) {
|
|
1533
|
+
modules.push(entry.name);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
return modules;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* Discover agents in a module
|
|
1542
|
+
*/
|
|
1543
|
+
async discoverAgents(modulePath) {
|
|
1544
|
+
const agents = [];
|
|
1545
|
+
const agentsPath = path.join(modulePath, 'agents');
|
|
1546
|
+
|
|
1547
|
+
if (!(await fs.pathExists(agentsPath))) {
|
|
1548
|
+
return agents;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
const files = await fs.readdir(agentsPath);
|
|
1552
|
+
|
|
1553
|
+
for (const file of files) {
|
|
1554
|
+
// Look for .agent.yaml files (new format) or .md files (legacy format)
|
|
1555
|
+
if (file.endsWith('.agent.yaml') || (file.endsWith('.md') && !file.toLowerCase().includes('readme'))) {
|
|
1556
|
+
agents.push(file);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
return agents;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
/**
|
|
1564
|
+
* Discover all teams in a module
|
|
1565
|
+
*/
|
|
1566
|
+
async discoverTeams(modulePath) {
|
|
1567
|
+
const teams = [];
|
|
1568
|
+
const teamsPath = path.join(modulePath, 'teams');
|
|
1569
|
+
|
|
1570
|
+
if (!(await fs.pathExists(teamsPath))) {
|
|
1571
|
+
return teams;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
const files = await fs.readdir(teamsPath);
|
|
1575
|
+
|
|
1576
|
+
for (const file of files) {
|
|
1577
|
+
if (file.endsWith('.yaml') || file.endsWith('.yml')) {
|
|
1578
|
+
teams.push(file);
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
return teams;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* Extract agent name from XML
|
|
1587
|
+
*/
|
|
1588
|
+
getAgentName(xml) {
|
|
1589
|
+
const match = xml.match(/<agent[^>]*name="([^"]+)"/);
|
|
1590
|
+
return match ? match[1] : 'Unknown';
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* Extract agent description from XML
|
|
1595
|
+
*/
|
|
1596
|
+
getAgentDescription(xml) {
|
|
1597
|
+
const match = xml.match(/<description>([^<]+)<\/description>/);
|
|
1598
|
+
return match ? match[1] : '';
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Check if agent should be skipped for bundling
|
|
1603
|
+
*/
|
|
1604
|
+
shouldSkipBundling(xml) {
|
|
1605
|
+
// Check for bundle="false" attribute in the agent tag
|
|
1606
|
+
const match = xml.match(/<agent[^>]*bundle="false"[^>]*>/);
|
|
1607
|
+
return match !== null;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* Create temporary manifest files
|
|
1612
|
+
*/
|
|
1613
|
+
async createTempManifests() {
|
|
1614
|
+
// Ensure temp directory exists
|
|
1615
|
+
await fs.ensureDir(this.tempManifestDir);
|
|
1616
|
+
|
|
1617
|
+
// Generate agent-manifest.csv using shared generator
|
|
1618
|
+
const agentPartyPath = path.join(this.tempManifestDir, 'agent-manifest.csv');
|
|
1619
|
+
await AgentPartyGenerator.writeAgentParty(agentPartyPath, this.discoveredAgents, { forWeb: true });
|
|
1620
|
+
|
|
1621
|
+
console.log(chalk.dim(' ✓ Created temporary manifest files'));
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
/**
|
|
1625
|
+
* Clean up temporary files
|
|
1626
|
+
*/
|
|
1627
|
+
async cleanupTempFiles() {
|
|
1628
|
+
if (await fs.pathExists(this.tempDir)) {
|
|
1629
|
+
await fs.remove(this.tempDir);
|
|
1630
|
+
console.log(chalk.dim('\n✓ Cleaned up temporary files'));
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* Validate XML content
|
|
1636
|
+
*/
|
|
1637
|
+
async validateXml(xmlContent) {
|
|
1638
|
+
try {
|
|
1639
|
+
await xml2js.parseStringPromise(xmlContent, {
|
|
1640
|
+
strict: true,
|
|
1641
|
+
explicitArray: false,
|
|
1642
|
+
});
|
|
1643
|
+
return true;
|
|
1644
|
+
} catch {
|
|
1645
|
+
return false;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* Format XML content for readability
|
|
1651
|
+
*/
|
|
1652
|
+
formatXml(xml) {
|
|
1653
|
+
const TAB = ' '; // 2 spaces
|
|
1654
|
+
let result = '';
|
|
1655
|
+
let depth = 0;
|
|
1656
|
+
|
|
1657
|
+
// Split by tags while preserving them
|
|
1658
|
+
const parts = xml.split(/(<[^>]+>)/g);
|
|
1659
|
+
|
|
1660
|
+
for (let i = 0; i < parts.length; i++) {
|
|
1661
|
+
const part = parts[i];
|
|
1662
|
+
if (!part) continue;
|
|
1663
|
+
|
|
1664
|
+
if (part.startsWith('<?xml')) {
|
|
1665
|
+
// XML declaration - no indent
|
|
1666
|
+
result += part + '\n';
|
|
1667
|
+
} else if (part.startsWith('<!--')) {
|
|
1668
|
+
// Comment
|
|
1669
|
+
result += TAB.repeat(depth) + part + '\n';
|
|
1670
|
+
} else if (part.startsWith('</')) {
|
|
1671
|
+
// Closing tag - unindent first
|
|
1672
|
+
depth = Math.max(0, depth - 1);
|
|
1673
|
+
result += TAB.repeat(depth) + part + '\n';
|
|
1674
|
+
} else if (part.startsWith('<')) {
|
|
1675
|
+
// Opening or self-closing tag
|
|
1676
|
+
const isSelfClosing = part.endsWith('/>');
|
|
1677
|
+
const tagName = part.match(/<(\w+)/)?.[1];
|
|
1678
|
+
|
|
1679
|
+
// Check if next part is simple text content
|
|
1680
|
+
const nextPart = parts[i + 1];
|
|
1681
|
+
const hasSimpleContent = nextPart && !nextPart.startsWith('<') && nextPart.trim().length > 0 && nextPart.trim().length <= 100;
|
|
1682
|
+
|
|
1683
|
+
if (hasSimpleContent && parts[i + 2] && parts[i + 2] === `</${tagName}>`) {
|
|
1684
|
+
// Simple tag with inline content: <tag>content</tag>
|
|
1685
|
+
result += TAB.repeat(depth) + part + nextPart.trim() + parts[i + 2] + '\n';
|
|
1686
|
+
i += 2; // Skip content and closing tag
|
|
1687
|
+
} else {
|
|
1688
|
+
// Multi-line tag
|
|
1689
|
+
result += TAB.repeat(depth) + part + '\n';
|
|
1690
|
+
if (!isSelfClosing) {
|
|
1691
|
+
depth++;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
} else {
|
|
1695
|
+
// Text content between tags
|
|
1696
|
+
const trimmed = part.trim();
|
|
1697
|
+
if (trimmed) {
|
|
1698
|
+
result += TAB.repeat(depth) + trimmed + '\n';
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
return result;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Display summary statistics
|
|
1708
|
+
*/
|
|
1709
|
+
displaySummary() {
|
|
1710
|
+
console.log(chalk.cyan.bold('\n═══════════════════════════════════════════════'));
|
|
1711
|
+
console.log(chalk.cyan.bold(' SUMMARY'));
|
|
1712
|
+
console.log(chalk.cyan.bold('═══════════════════════════════════════════════\n'));
|
|
1713
|
+
|
|
1714
|
+
console.log(chalk.bold('Bundle Statistics:'));
|
|
1715
|
+
console.log(` Total agents found: ${this.stats.totalAgents}`);
|
|
1716
|
+
console.log(` Successfully bundled: ${chalk.green(this.stats.bundledAgents)}`);
|
|
1717
|
+
if (this.stats.skippedAgents > 0) {
|
|
1718
|
+
console.log(` Skipped (webskip/bundle): ${chalk.gray(this.stats.skippedAgents)}`);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
if (this.stats.failedAgents > 0) {
|
|
1722
|
+
console.log(` Failed to bundle: ${chalk.red(this.stats.failedAgents)}`);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
if (this.stats.invalidXml > 0) {
|
|
1726
|
+
console.log(` Invalid XML bundles: ${chalk.yellow(this.stats.invalidXml)}`);
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
// Display warnings summary
|
|
1730
|
+
// Check if there are actually any warnings with content
|
|
1731
|
+
const hasActualWarnings = this.stats.warnings.some((w) => w && w.warnings && w.warnings.length > 0);
|
|
1732
|
+
|
|
1733
|
+
if (hasActualWarnings) {
|
|
1734
|
+
console.log(chalk.yellow('\n⚠ Missing Dependencies by Agent:'));
|
|
1735
|
+
|
|
1736
|
+
// Group and display warnings by agent
|
|
1737
|
+
for (const agentWarning of this.stats.warnings) {
|
|
1738
|
+
if (agentWarning && agentWarning.warnings && agentWarning.warnings.length > 0) {
|
|
1739
|
+
console.log(chalk.bold(`\n ${agentWarning.agent}:`));
|
|
1740
|
+
// Display unique warnings for this agent
|
|
1741
|
+
const uniqueWarnings = [...new Set(agentWarning.warnings)];
|
|
1742
|
+
for (const warning of uniqueWarnings) {
|
|
1743
|
+
console.log(chalk.dim(` • ${warning}`));
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
} else {
|
|
1748
|
+
console.log(chalk.green('\n✓ No missing dependencies'));
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
// Final status
|
|
1752
|
+
if (this.stats.invalidXml > 0) {
|
|
1753
|
+
console.log(chalk.yellow('\n⚠ Some bundles have invalid XML. Please review the output.'));
|
|
1754
|
+
} else if (this.stats.failedAgents > 0) {
|
|
1755
|
+
console.log(chalk.yellow('\n⚠ Some agents failed to bundle. Please review the errors.'));
|
|
1756
|
+
} else {
|
|
1757
|
+
console.log(chalk.green('\n✨ All bundles generated successfully!'));
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
console.log(chalk.cyan.bold('\n═══════════════════════════════════════════════\n'));
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
module.exports = { WebBundler };
|