bmad-method 6.0.5-next.8 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/bmm/agents/analyst.agent.yaml +1 -1
- package/src/bmm/module-help.csv +1 -1
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-02-vision.md +1 -1
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-03-users.md +1 -1
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-04-metrics.md +1 -1
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-05-scope.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-02-discovery.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-02b-vision.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-02c-executive-summary.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-03-success.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-04-journeys.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-05-domain.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-06-innovation.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-07-project-type.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-08-scoping.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-09-functional.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-10-nonfunctional.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-11-polish.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-e/step-e-01-discovery.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-prd/steps-v/step-v-01-discovery.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-02-discovery.md +1 -1
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-03-core-experience.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-04-emotional-response.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-05-inspiration.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-06-design-system.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-07-defining-experience.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-08-visual-foundation.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-09-design-directions.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-10-user-journeys.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-11-component-strategy.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-12-ux-patterns.md +2 -2
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-13-responsive-accessibility.md +2 -2
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-02-context.md +2 -2
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-03-starter.md +2 -2
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-04-decisions.md +2 -2
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-05-patterns.md +2 -2
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-06-structure.md +2 -2
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-07-validation.md +2 -2
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-01-validate-prerequisites.md +31 -13
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-02-design-epics.md +1 -1
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-03-create-stories.md +6 -2
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-04-final-validation.md +1 -1
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/templates/epics-template.md +4 -0
- package/src/bmm/workflows/4-implementation/code-review/workflow.md +4 -7
- package/src/bmm/workflows/bmad-quick-flow/bmad-quick-dev-new-preview/workflow.md +0 -4
- package/src/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md +1 -1
- package/src/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md +1 -1
- package/src/bmm/workflows/generate-project-context/steps/step-02-generate.md +1 -1
- package/src/core/module-help.csv +2 -2
- package/src/core/workflows/bmad-brainstorming/SKILL.md +6 -0
- package/src/core/workflows/bmad-brainstorming/bmad-skill-manifest.yaml +1 -0
- package/src/core/workflows/{brainstorming → bmad-brainstorming}/workflow.md +2 -5
- package/src/core/workflows/bmad-party-mode/SKILL.md +6 -0
- package/src/core/workflows/bmad-party-mode/bmad-skill-manifest.yaml +1 -0
- package/src/core/workflows/{party-mode → bmad-party-mode}/steps/step-03-graceful-exit.md +0 -1
- package/src/core/workflows/{party-mode → bmad-party-mode}/workflow.md +0 -4
- package/tools/cli/external-official-modules.yaml +18 -18
- package/tools/cli/installers/lib/core/installer.js +25 -8
- package/tools/cli/installers/lib/ide/_base-ide.js +0 -1
- package/tools/cli/installers/lib/ide/_config-driven.js +9 -4
- package/tools/cli/installers/lib/ide/manager.js +3 -3
- package/tools/cli/lib/agent/compiler.js +1 -1
- package/.augment/code_review_guidelines.yaml +0 -231
- package/.coderabbit.yaml +0 -85
- package/.github/CODE_OF_CONDUCT.md +0 -128
- package/.github/FUNDING.yaml +0 -15
- package/.github/ISSUE_TEMPLATE/bug-report.yaml +0 -124
- package/.github/ISSUE_TEMPLATE/config.yaml +0 -8
- package/.github/ISSUE_TEMPLATE/documentation.yaml +0 -55
- package/.github/ISSUE_TEMPLATE/feature-request.md +0 -22
- package/.github/ISSUE_TEMPLATE/issue.md +0 -32
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -13
- package/.github/scripts/discord-helpers.sh +0 -34
- package/.github/workflows/coderabbit-review.yaml +0 -22
- package/.github/workflows/discord.yaml +0 -90
- package/.github/workflows/docs.yaml +0 -64
- package/.github/workflows/publish.yaml +0 -133
- package/.github/workflows/quality.yaml +0 -116
- package/.husky/pre-commit +0 -20
- package/.markdownlint-cli2.yaml +0 -41
- package/.nvmrc +0 -1
- package/.prettierignore +0 -12
- package/.vscode/settings.json +0 -96
- package/CHANGELOG.md +0 -1785
- package/CNAME +0 -1
- package/CONTRIBUTING.md +0 -176
- package/CONTRIBUTORS.md +0 -32
- package/SECURITY.md +0 -85
- package/TRADEMARK.md +0 -55
- package/Wordmark.png +0 -0
- package/banner-bmad-method.png +0 -0
- package/docs/404.md +0 -9
- package/docs/_STYLE_GUIDE.md +0 -370
- package/docs/explanation/advanced-elicitation.md +0 -49
- package/docs/explanation/adversarial-review.md +0 -59
- package/docs/explanation/brainstorming.md +0 -33
- package/docs/explanation/established-projects-faq.md +0 -50
- package/docs/explanation/party-mode.md +0 -59
- package/docs/explanation/preventing-agent-conflicts.md +0 -112
- package/docs/explanation/project-context.md +0 -157
- package/docs/explanation/quick-dev-new-preview.md +0 -73
- package/docs/explanation/quick-flow.md +0 -77
- package/docs/explanation/why-solutioning-matters.md +0 -77
- package/docs/how-to/customize-bmad.md +0 -172
- package/docs/how-to/established-projects.md +0 -117
- package/docs/how-to/get-answers-about-bmad.md +0 -138
- package/docs/how-to/install-bmad.md +0 -116
- package/docs/how-to/non-interactive-installation.md +0 -171
- package/docs/how-to/project-context.md +0 -136
- package/docs/how-to/quick-fixes.md +0 -123
- package/docs/how-to/shard-large-documents.md +0 -78
- package/docs/how-to/upgrade-to-v6.md +0 -100
- package/docs/index.md +0 -60
- package/docs/reference/agents.md +0 -28
- package/docs/reference/commands.md +0 -145
- package/docs/reference/modules.md +0 -76
- package/docs/reference/testing.md +0 -106
- package/docs/reference/workflow-map.md +0 -89
- package/docs/roadmap.mdx +0 -136
- package/docs/tutorials/getting-started.md +0 -275
- package/docs/zh-cn/404.md +0 -9
- package/docs/zh-cn/_STYLE_GUIDE.md +0 -370
- package/docs/zh-cn/explanation/advanced-elicitation.md +0 -62
- package/docs/zh-cn/explanation/adversarial-review.md +0 -71
- package/docs/zh-cn/explanation/brainstorming.md +0 -43
- package/docs/zh-cn/explanation/established-projects-faq.md +0 -60
- package/docs/zh-cn/explanation/party-mode.md +0 -79
- package/docs/zh-cn/explanation/preventing-agent-conflicts.md +0 -137
- package/docs/zh-cn/explanation/project-context.md +0 -176
- package/docs/zh-cn/explanation/quick-flow.md +0 -93
- package/docs/zh-cn/explanation/why-solutioning-matters.md +0 -90
- package/docs/zh-cn/how-to/customize-bmad.md +0 -182
- package/docs/zh-cn/how-to/established-projects.md +0 -134
- package/docs/zh-cn/how-to/get-answers-about-bmad.md +0 -144
- package/docs/zh-cn/how-to/install-bmad.md +0 -105
- package/docs/zh-cn/how-to/non-interactive-installation.md +0 -181
- package/docs/zh-cn/how-to/project-context.md +0 -152
- package/docs/zh-cn/how-to/quick-fixes.md +0 -140
- package/docs/zh-cn/how-to/shard-large-documents.md +0 -86
- package/docs/zh-cn/how-to/upgrade-to-v6.md +0 -120
- package/docs/zh-cn/index.md +0 -69
- package/docs/zh-cn/reference/agents.md +0 -41
- package/docs/zh-cn/reference/commands.md +0 -166
- package/docs/zh-cn/reference/modules.md +0 -94
- package/docs/zh-cn/reference/testing.md +0 -122
- package/docs/zh-cn/reference/workflow-map.md +0 -104
- package/docs/zh-cn/roadmap.mdx +0 -152
- package/docs/zh-cn/tutorials/getting-started.md +0 -300
- package/eslint.config.mjs +0 -141
- package/prettier.config.mjs +0 -32
- package/src/core/workflows/brainstorming/bmad-skill-manifest.yaml +0 -3
- package/src/core/workflows/party-mode/bmad-skill-manifest.yaml +0 -3
- package/test/README.md +0 -295
- package/test/adversarial-review-tests/README.md +0 -56
- package/test/adversarial-review-tests/sample-content.md +0 -46
- package/test/adversarial-review-tests/test-cases.yaml +0 -103
- package/test/fixtures/agent-schema/invalid/critical-actions/actions-as-string.agent.yaml +0 -27
- package/test/fixtures/agent-schema/invalid/critical-actions/empty-string-in-actions.agent.yaml +0 -30
- package/test/fixtures/agent-schema/invalid/menu/empty-menu.agent.yaml +0 -22
- package/test/fixtures/agent-schema/invalid/menu/missing-menu.agent.yaml +0 -20
- package/test/fixtures/agent-schema/invalid/menu-commands/empty-command-target.agent.yaml +0 -25
- package/test/fixtures/agent-schema/invalid/menu-commands/no-command-target.agent.yaml +0 -24
- package/test/fixtures/agent-schema/invalid/menu-triggers/camel-case.agent.yaml +0 -25
- package/test/fixtures/agent-schema/invalid/menu-triggers/compound-invalid-format.agent.yaml +0 -25
- package/test/fixtures/agent-schema/invalid/menu-triggers/compound-mismatched-kebab.agent.yaml +0 -25
- package/test/fixtures/agent-schema/invalid/menu-triggers/duplicate-triggers.agent.yaml +0 -31
- package/test/fixtures/agent-schema/invalid/menu-triggers/empty-trigger.agent.yaml +0 -25
- package/test/fixtures/agent-schema/invalid/menu-triggers/leading-asterisk.agent.yaml +0 -25
- package/test/fixtures/agent-schema/invalid/menu-triggers/snake-case.agent.yaml +0 -25
- package/test/fixtures/agent-schema/invalid/menu-triggers/trigger-with-spaces.agent.yaml +0 -25
- package/test/fixtures/agent-schema/invalid/metadata/empty-module-string.agent.yaml +0 -26
- package/test/fixtures/agent-schema/invalid/metadata/empty-name.agent.yaml +0 -24
- package/test/fixtures/agent-schema/invalid/metadata/extra-metadata-fields.agent.yaml +0 -27
- package/test/fixtures/agent-schema/invalid/metadata/missing-id.agent.yaml +0 -23
- package/test/fixtures/agent-schema/invalid/persona/empty-principles-array.agent.yaml +0 -24
- package/test/fixtures/agent-schema/invalid/persona/empty-string-in-principles.agent.yaml +0 -27
- package/test/fixtures/agent-schema/invalid/persona/extra-persona-fields.agent.yaml +0 -27
- package/test/fixtures/agent-schema/invalid/persona/missing-role.agent.yaml +0 -24
- package/test/fixtures/agent-schema/invalid/prompts/empty-content.agent.yaml +0 -29
- package/test/fixtures/agent-schema/invalid/prompts/extra-prompt-fields.agent.yaml +0 -31
- package/test/fixtures/agent-schema/invalid/prompts/missing-content.agent.yaml +0 -28
- package/test/fixtures/agent-schema/invalid/prompts/missing-id.agent.yaml +0 -28
- package/test/fixtures/agent-schema/invalid/top-level/empty-file.agent.yaml +0 -5
- package/test/fixtures/agent-schema/invalid/top-level/extra-top-level-keys.agent.yaml +0 -28
- package/test/fixtures/agent-schema/invalid/top-level/missing-agent-key.agent.yaml +0 -11
- package/test/fixtures/agent-schema/invalid/yaml-errors/invalid-indentation.agent.yaml +0 -19
- package/test/fixtures/agent-schema/invalid/yaml-errors/malformed-yaml.agent.yaml +0 -18
- package/test/fixtures/agent-schema/valid/critical-actions/empty-critical-actions.agent.yaml +0 -24
- package/test/fixtures/agent-schema/valid/critical-actions/no-critical-actions.agent.yaml +0 -22
- package/test/fixtures/agent-schema/valid/critical-actions/valid-critical-actions.agent.yaml +0 -27
- package/test/fixtures/agent-schema/valid/menu/multiple-menu-items.agent.yaml +0 -31
- package/test/fixtures/agent-schema/valid/menu/single-menu-item.agent.yaml +0 -22
- package/test/fixtures/agent-schema/valid/menu-commands/all-command-types.agent.yaml +0 -38
- package/test/fixtures/agent-schema/valid/menu-commands/multiple-commands.agent.yaml +0 -23
- package/test/fixtures/agent-schema/valid/menu-triggers/compound-triggers.agent.yaml +0 -31
- package/test/fixtures/agent-schema/valid/menu-triggers/kebab-case-triggers.agent.yaml +0 -34
- package/test/fixtures/agent-schema/valid/metadata/core-agent-with-module.agent.yaml +0 -24
- package/test/fixtures/agent-schema/valid/metadata/empty-module-name-in-path.agent.yaml +0 -24
- package/test/fixtures/agent-schema/valid/metadata/malformed-path-treated-as-core.agent.yaml +0 -24
- package/test/fixtures/agent-schema/valid/metadata/module-agent-correct.agent.yaml +0 -24
- package/test/fixtures/agent-schema/valid/metadata/module-agent-missing-module.agent.yaml +0 -23
- package/test/fixtures/agent-schema/valid/metadata/wrong-module-value.agent.yaml +0 -24
- package/test/fixtures/agent-schema/valid/persona/complete-persona.agent.yaml +0 -24
- package/test/fixtures/agent-schema/valid/prompts/empty-prompts.agent.yaml +0 -24
- package/test/fixtures/agent-schema/valid/prompts/no-prompts.agent.yaml +0 -22
- package/test/fixtures/agent-schema/valid/prompts/valid-prompts-minimal.agent.yaml +0 -28
- package/test/fixtures/agent-schema/valid/prompts/valid-prompts-with-description.agent.yaml +0 -30
- package/test/fixtures/agent-schema/valid/top-level/minimal-core-agent.agent.yaml +0 -24
- package/test/fixtures/file-refs-csv/invalid/all-empty-workflow.csv +0 -3
- package/test/fixtures/file-refs-csv/invalid/empty-data.csv +0 -1
- package/test/fixtures/file-refs-csv/invalid/no-workflow-column.csv +0 -3
- package/test/fixtures/file-refs-csv/invalid/unresolvable-vars.csv +0 -3
- package/test/fixtures/file-refs-csv/valid/bmm-style.csv +0 -3
- package/test/fixtures/file-refs-csv/valid/core-style.csv +0 -3
- package/test/fixtures/file-refs-csv/valid/minimal.csv +0 -2
- package/test/test-agent-schema.js +0 -387
- package/test/test-cli-integration.sh +0 -159
- package/test/test-file-refs-csv.js +0 -133
- package/test/test-install-to-bmad.js +0 -154
- package/test/test-installation-components.js +0 -1796
- package/test/test-rehype-plugins.mjs +0 -1050
- package/test/test-workflow-path-regex.js +0 -88
- package/test/unit-test-schema.js +0 -133
- package/tools/build-docs.mjs +0 -464
- package/tools/docs/_prompt-external-modules-page.md +0 -59
- package/tools/docs/fix-refs.md +0 -91
- package/tools/docs/native-skills-migration-checklist.md +0 -281
- package/tools/fix-doc-links.js +0 -285
- package/tools/validate-agent-schema.js +0 -110
- package/tools/validate-doc-links.js +0 -407
- package/tools/validate-file-refs.js +0 -556
- package/website/README.md +0 -75
- package/website/astro.config.mjs +0 -157
- package/website/public/diagrams/quick-dev-diagram.png +0 -0
- package/website/public/favicon.ico +0 -0
- package/website/public/img/bmad-dark.png +0 -0
- package/website/public/img/bmad-light.png +0 -0
- package/website/public/workflow-map-diagram.html +0 -361
- package/website/src/components/Banner.astro +0 -62
- package/website/src/components/Header.astro +0 -96
- package/website/src/components/MobileMenuFooter.astro +0 -33
- package/website/src/content/config.ts +0 -7
- package/website/src/content/i18n/zh-CN.json +0 -28
- package/website/src/lib/site-url.mjs +0 -25
- package/website/src/pages/404.astro +0 -11
- package/website/src/pages/robots.txt.ts +0 -48
- package/website/src/rehype-base-paths.js +0 -112
- package/website/src/rehype-markdown-links.js +0 -119
- package/website/src/styles/custom.css +0 -805
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/brain-methods.csv +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/steps/step-01-session-setup.md +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/steps/step-01b-continue.md +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/steps/step-02a-user-selected.md +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/steps/step-02b-ai-recommended.md +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/steps/step-02c-random-selection.md +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/steps/step-02d-progressive-flow.md +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/steps/step-03-technique-execution.md +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/steps/step-04-idea-organization.md +0 -0
- /package/src/core/workflows/{brainstorming → bmad-brainstorming}/template.md +0 -0
- /package/src/core/workflows/{party-mode → bmad-party-mode}/steps/step-01-agent-loading.md +0 -0
- /package/src/core/workflows/{party-mode → bmad-party-mode}/steps/step-02-discussion-orchestration.md +0 -0
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workflow Path Regex Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests that the source and install workflow path regexes in ModuleManager
|
|
5
|
-
* extract the correct capture groups (module name and workflow sub-path).
|
|
6
|
-
*
|
|
7
|
-
* Usage: node test/test-workflow-path-regex.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// ANSI colors
|
|
11
|
-
const colors = {
|
|
12
|
-
reset: '\u001B[0m',
|
|
13
|
-
green: '\u001B[32m',
|
|
14
|
-
red: '\u001B[31m',
|
|
15
|
-
cyan: '\u001B[36m',
|
|
16
|
-
dim: '\u001B[2m',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
let passed = 0;
|
|
20
|
-
let failed = 0;
|
|
21
|
-
|
|
22
|
-
function assert(condition, testName, errorMessage = '') {
|
|
23
|
-
if (condition) {
|
|
24
|
-
console.log(`${colors.green}✓${colors.reset} ${testName}`);
|
|
25
|
-
passed++;
|
|
26
|
-
} else {
|
|
27
|
-
console.log(`${colors.red}✗${colors.reset} ${testName}`);
|
|
28
|
-
if (errorMessage) {
|
|
29
|
-
console.log(` ${colors.dim}${errorMessage}${colors.reset}`);
|
|
30
|
-
}
|
|
31
|
-
failed++;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
// These regexes are extracted from ModuleManager.vendorWorkflowDependencies()
|
|
37
|
-
// in tools/cli/installers/lib/modules/manager.js
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
|
|
40
|
-
// Source regex (line ~1081) — uses non-capturing group for _bmad
|
|
41
|
-
const SOURCE_REGEX = /\{project-root\}\/(?:_bmad)\/([^/]+)\/workflows\/(.+)/;
|
|
42
|
-
|
|
43
|
-
// Install regex (line ~1091) — uses non-capturing group for _bmad,
|
|
44
|
-
// consistent with source regex
|
|
45
|
-
const INSTALL_REGEX = /\{project-root\}\/(?:_bmad)\/([^/]+)\/workflows\/(.+)/;
|
|
46
|
-
|
|
47
|
-
// ---------------------------------------------------------------------------
|
|
48
|
-
// Test data
|
|
49
|
-
// ---------------------------------------------------------------------------
|
|
50
|
-
const sourcePath = '{project-root}/_bmad/bmm/workflows/4-implementation/create-story/workflow.md';
|
|
51
|
-
const installPath = '{project-root}/_bmad/bmgd/workflows/4-production/create-story/workflow.md';
|
|
52
|
-
|
|
53
|
-
console.log(`\n${colors.cyan}Workflow Path Regex Tests${colors.reset}\n`);
|
|
54
|
-
|
|
55
|
-
// --- Source regex tests (these should pass — source regex is correct) ---
|
|
56
|
-
|
|
57
|
-
const sourceMatch = sourcePath.match(SOURCE_REGEX);
|
|
58
|
-
|
|
59
|
-
assert(sourceMatch !== null, 'Source regex matches source path');
|
|
60
|
-
assert(
|
|
61
|
-
sourceMatch && sourceMatch[1] === 'bmm',
|
|
62
|
-
'Source regex group [1] is the module name',
|
|
63
|
-
`Expected "bmm", got "${sourceMatch && sourceMatch[1]}"`,
|
|
64
|
-
);
|
|
65
|
-
assert(
|
|
66
|
-
sourceMatch && sourceMatch[2] === '4-implementation/create-story/workflow.md',
|
|
67
|
-
'Source regex group [2] is the workflow sub-path',
|
|
68
|
-
`Expected "4-implementation/create-story/workflow.md", got "${sourceMatch && sourceMatch[2]}"`,
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
// --- Install regex tests (group [2] returns module name, not sub-path) ---
|
|
72
|
-
|
|
73
|
-
const installMatch = installPath.match(INSTALL_REGEX);
|
|
74
|
-
|
|
75
|
-
assert(installMatch !== null, 'Install regex matches install path');
|
|
76
|
-
|
|
77
|
-
// This is the critical test: installMatch[2] should be the workflow sub-path,
|
|
78
|
-
// because the code uses it as `installWorkflowSubPath`.
|
|
79
|
-
// With the bug, installMatch[2] is "bmgd" (module name) instead of the sub-path.
|
|
80
|
-
assert(
|
|
81
|
-
installMatch && installMatch[2] === '4-production/create-story/workflow.md',
|
|
82
|
-
'Install regex group [2] is the workflow sub-path (used as installWorkflowSubPath)',
|
|
83
|
-
`Expected "4-production/create-story/workflow.md", got "${installMatch && installMatch[2]}"`,
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
// --- Summary ---
|
|
87
|
-
console.log(`\n${passed} passed, ${failed} failed\n`);
|
|
88
|
-
process.exit(failed > 0 ? 1 : 0);
|
package/test/unit-test-schema.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit Tests for Agent Schema Edge Cases
|
|
3
|
-
*
|
|
4
|
-
* Tests internal functions to achieve 100% branch coverage
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const { validateAgentFile } = require('../tools/schema/agent.js');
|
|
8
|
-
|
|
9
|
-
console.log('Running edge case unit tests...\n');
|
|
10
|
-
|
|
11
|
-
let passed = 0;
|
|
12
|
-
let failed = 0;
|
|
13
|
-
|
|
14
|
-
// Test 1: Path with malformed module structure (no slash after module name)
|
|
15
|
-
// This tests line 213: slashIndex === -1
|
|
16
|
-
console.log('Test 1: Malformed module path (no slash after module name)');
|
|
17
|
-
try {
|
|
18
|
-
const result = validateAgentFile('src/bmm', {
|
|
19
|
-
agent: {
|
|
20
|
-
metadata: {
|
|
21
|
-
id: 'test',
|
|
22
|
-
name: 'Test',
|
|
23
|
-
title: 'Test',
|
|
24
|
-
icon: '🧪',
|
|
25
|
-
},
|
|
26
|
-
persona: {
|
|
27
|
-
role: 'Test',
|
|
28
|
-
identity: 'Test',
|
|
29
|
-
communication_style: 'Test',
|
|
30
|
-
principles: ['Test'],
|
|
31
|
-
},
|
|
32
|
-
menu: [{ trigger: 'help', description: 'Help', action: 'help' }],
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
if (result.success) {
|
|
37
|
-
console.log('✗ Should have failed - missing module field');
|
|
38
|
-
failed++;
|
|
39
|
-
} else {
|
|
40
|
-
console.log('✓ Correctly handled malformed path (treated as core agent)');
|
|
41
|
-
passed++;
|
|
42
|
-
}
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.log('✗ Unexpected error:', error.message);
|
|
45
|
-
failed++;
|
|
46
|
-
}
|
|
47
|
-
console.log('');
|
|
48
|
-
|
|
49
|
-
// Test 2: Module option with empty string
|
|
50
|
-
// This tests line 222: trimmed.length > 0
|
|
51
|
-
console.log('Test 2: Module agent with empty string in module field');
|
|
52
|
-
try {
|
|
53
|
-
const result = validateAgentFile('src/bmm/agents/test.agent.yaml', {
|
|
54
|
-
agent: {
|
|
55
|
-
metadata: {
|
|
56
|
-
id: 'test',
|
|
57
|
-
name: 'Test',
|
|
58
|
-
title: 'Test',
|
|
59
|
-
icon: '🧪',
|
|
60
|
-
module: ' ', // Empty after trimming
|
|
61
|
-
},
|
|
62
|
-
persona: {
|
|
63
|
-
role: 'Test',
|
|
64
|
-
identity: 'Test',
|
|
65
|
-
communication_style: 'Test',
|
|
66
|
-
principles: ['Test'],
|
|
67
|
-
},
|
|
68
|
-
menu: [{ trigger: 'help', description: 'Help', action: 'help' }],
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
if (result.success) {
|
|
73
|
-
console.log('✗ Should have failed - empty module string');
|
|
74
|
-
failed++;
|
|
75
|
-
} else {
|
|
76
|
-
console.log('✓ Correctly rejected empty module string');
|
|
77
|
-
passed++;
|
|
78
|
-
}
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.log('✗ Unexpected error:', error.message);
|
|
81
|
-
failed++;
|
|
82
|
-
}
|
|
83
|
-
console.log('');
|
|
84
|
-
|
|
85
|
-
// Test 3: Core agent path (src/core/agents/...) - tests the !filePath.startsWith(marker) branch
|
|
86
|
-
console.log('Test 3: Core agent path returns null for module');
|
|
87
|
-
try {
|
|
88
|
-
const result = validateAgentFile('src/core/agents/test.agent.yaml', {
|
|
89
|
-
agent: {
|
|
90
|
-
metadata: {
|
|
91
|
-
id: 'test',
|
|
92
|
-
name: 'Test',
|
|
93
|
-
title: 'Test',
|
|
94
|
-
icon: '🧪',
|
|
95
|
-
// No module field - correct for core agent
|
|
96
|
-
},
|
|
97
|
-
persona: {
|
|
98
|
-
role: 'Test',
|
|
99
|
-
identity: 'Test',
|
|
100
|
-
communication_style: 'Test',
|
|
101
|
-
principles: ['Test'],
|
|
102
|
-
},
|
|
103
|
-
menu: [{ trigger: 'help', description: 'Help', action: 'help' }],
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
if (result.success) {
|
|
108
|
-
console.log('✓ Core agent validated correctly (no module required)');
|
|
109
|
-
passed++;
|
|
110
|
-
} else {
|
|
111
|
-
console.log('✗ Core agent should pass without module field');
|
|
112
|
-
failed++;
|
|
113
|
-
}
|
|
114
|
-
} catch (error) {
|
|
115
|
-
console.log('✗ Unexpected error:', error.message);
|
|
116
|
-
failed++;
|
|
117
|
-
}
|
|
118
|
-
console.log('');
|
|
119
|
-
|
|
120
|
-
// Summary
|
|
121
|
-
console.log('═══════════════════════════════════════');
|
|
122
|
-
console.log('Edge Case Unit Test Results:');
|
|
123
|
-
console.log(` Passed: ${passed}`);
|
|
124
|
-
console.log(` Failed: ${failed}`);
|
|
125
|
-
console.log('═══════════════════════════════════════\n');
|
|
126
|
-
|
|
127
|
-
if (failed === 0) {
|
|
128
|
-
console.log('✨ All edge case tests passed!\n');
|
|
129
|
-
process.exit(0);
|
|
130
|
-
} else {
|
|
131
|
-
console.log('❌ Some edge case tests failed\n');
|
|
132
|
-
process.exit(1);
|
|
133
|
-
}
|
package/tools/build-docs.mjs
DELETED
|
@@ -1,464 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BMAD Documentation Build Pipeline
|
|
3
|
-
*
|
|
4
|
-
* Consolidates docs from multiple sources, generates LLM-friendly files,
|
|
5
|
-
* and builds the Astro+Starlight site.
|
|
6
|
-
*
|
|
7
|
-
* Build outputs:
|
|
8
|
-
* build/artifacts/ - With llms.txt, llms-full.txt
|
|
9
|
-
* build/site/ - Final Astro output (deployable)
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { execSync } from 'node:child_process';
|
|
13
|
-
import fs from 'node:fs';
|
|
14
|
-
import path from 'node:path';
|
|
15
|
-
import { fileURLToPath } from 'node:url';
|
|
16
|
-
import { getSiteUrl } from '../website/src/lib/site-url.mjs';
|
|
17
|
-
|
|
18
|
-
// =============================================================================
|
|
19
|
-
// Configuration
|
|
20
|
-
// =============================================================================
|
|
21
|
-
|
|
22
|
-
const PROJECT_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
23
|
-
const BUILD_DIR = path.join(PROJECT_ROOT, 'build');
|
|
24
|
-
|
|
25
|
-
const REPO_URL = 'https://github.com/bmad-code-org/BMAD-METHOD';
|
|
26
|
-
|
|
27
|
-
// DO NOT CHANGE THESE VALUES!
|
|
28
|
-
// llms-full.txt is consumed by AI agents as context. Most LLMs have ~200k token limits.
|
|
29
|
-
// 600k chars ≈ 150k tokens (safe margin). Exceeding this breaks AI agent functionality.
|
|
30
|
-
const LLM_MAX_CHARS = 600_000;
|
|
31
|
-
const LLM_WARN_CHARS = 500_000;
|
|
32
|
-
|
|
33
|
-
const LLM_EXCLUDE_PATTERNS = [
|
|
34
|
-
'changelog',
|
|
35
|
-
'ide-info/',
|
|
36
|
-
'v4-to-v6-upgrade',
|
|
37
|
-
'faq',
|
|
38
|
-
'reference/glossary/',
|
|
39
|
-
'explanation/game-dev/',
|
|
40
|
-
'bmgd/',
|
|
41
|
-
// Note: Files/dirs starting with _ (like _STYLE_GUIDE.md, _archive/) are excluded in shouldExcludeFromLlm()
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
// =============================================================================
|
|
45
|
-
// Main Entry Point
|
|
46
|
-
/**
|
|
47
|
-
* Orchestrates the full BMAD documentation build pipeline.
|
|
48
|
-
*
|
|
49
|
-
* Executes the high-level build steps in sequence: prints headers and paths, validates internal
|
|
50
|
-
* documentation links, cleans the build directory, generates artifacts from the `docs/` folder,
|
|
51
|
-
* builds the Astro site, and prints a final build summary.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
async function main() {
|
|
55
|
-
if (process.platform === 'win32') {
|
|
56
|
-
console.error('Error: The docs build pipeline does not support Windows.');
|
|
57
|
-
console.error('Please build on Linux, macOS, or WSL.');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
console.log();
|
|
62
|
-
printBanner('BMAD Documentation Build Pipeline');
|
|
63
|
-
console.log();
|
|
64
|
-
console.log(`Project root: ${PROJECT_ROOT}`);
|
|
65
|
-
console.log(`Build directory: ${BUILD_DIR}`);
|
|
66
|
-
console.log();
|
|
67
|
-
|
|
68
|
-
// Check for broken internal links before building
|
|
69
|
-
checkDocLinks();
|
|
70
|
-
|
|
71
|
-
cleanBuildDirectory();
|
|
72
|
-
|
|
73
|
-
const docsDir = path.join(PROJECT_ROOT, 'docs');
|
|
74
|
-
const artifactsDir = await generateArtifacts(docsDir);
|
|
75
|
-
const siteDir = buildAstroSite();
|
|
76
|
-
|
|
77
|
-
printBuildSummary(docsDir, artifactsDir, siteDir);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
main().catch((error) => {
|
|
81
|
-
console.error(error);
|
|
82
|
-
process.exit(1);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// =============================================================================
|
|
86
|
-
// Pipeline Stages
|
|
87
|
-
/**
|
|
88
|
-
* Generate LLM files for the documentation pipeline.
|
|
89
|
-
*
|
|
90
|
-
* Creates the build/artifacts directory and writes `llms.txt` and `llms-full.txt` (sourced from the provided docs directory).
|
|
91
|
-
*
|
|
92
|
-
* @param {string} docsDir - Path to the source docs directory containing Markdown files.
|
|
93
|
-
* @returns {string} Path to the created artifacts directory.
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
async function generateArtifacts(docsDir) {
|
|
97
|
-
printHeader('Generating LLM files');
|
|
98
|
-
|
|
99
|
-
const outputDir = path.join(BUILD_DIR, 'artifacts');
|
|
100
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
101
|
-
|
|
102
|
-
// Generate LLM files reading from docs/, output to artifacts/
|
|
103
|
-
generateLlmsTxt(outputDir);
|
|
104
|
-
generateLlmsFullTxt(docsDir, outputDir);
|
|
105
|
-
|
|
106
|
-
console.log();
|
|
107
|
-
console.log(` \u001B[32m✓\u001B[0m Artifact generation complete`);
|
|
108
|
-
|
|
109
|
-
return outputDir;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Builds the Astro + Starlight site and copies generated artifacts into the site output directory.
|
|
114
|
-
*
|
|
115
|
-
* @returns {string} The filesystem path to the built site directory (e.g., build/site).
|
|
116
|
-
*/
|
|
117
|
-
function buildAstroSite() {
|
|
118
|
-
printHeader('Building Astro + Starlight site');
|
|
119
|
-
|
|
120
|
-
const siteDir = path.join(BUILD_DIR, 'site');
|
|
121
|
-
const artifactsDir = path.join(BUILD_DIR, 'artifacts');
|
|
122
|
-
|
|
123
|
-
// Build Astro site (outputs to build/site via astro.config.mjs)
|
|
124
|
-
runAstroBuild();
|
|
125
|
-
copyArtifactsToSite(artifactsDir, siteDir);
|
|
126
|
-
|
|
127
|
-
console.log();
|
|
128
|
-
console.log(` \u001B[32m✓\u001B[0m Astro build complete`);
|
|
129
|
-
|
|
130
|
-
return siteDir;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// =============================================================================
|
|
134
|
-
// LLM File Generation
|
|
135
|
-
/**
|
|
136
|
-
* Create a concise llms.txt summary file containing project metadata, core links, and quick navigation entries for LLM consumption.
|
|
137
|
-
*
|
|
138
|
-
* Writes the file to `${outputDir}/llms.txt`.
|
|
139
|
-
*
|
|
140
|
-
* @param {string} outputDir - Destination directory where `llms.txt` will be written.
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
function generateLlmsTxt(outputDir) {
|
|
144
|
-
console.log(' → Generating llms.txt...');
|
|
145
|
-
|
|
146
|
-
const siteUrl = getSiteUrl();
|
|
147
|
-
const content = [
|
|
148
|
-
'# BMAD Method Documentation',
|
|
149
|
-
'',
|
|
150
|
-
'> AI-driven agile development with specialized agents and workflows that scale from bug fixes to enterprise platforms.',
|
|
151
|
-
'',
|
|
152
|
-
`Documentation: ${siteUrl}`,
|
|
153
|
-
`Repository: ${REPO_URL}`,
|
|
154
|
-
`Full docs: ${siteUrl}/llms-full.txt`,
|
|
155
|
-
'',
|
|
156
|
-
'## Quick Start',
|
|
157
|
-
'',
|
|
158
|
-
`- **[Getting Started](${siteUrl}/tutorials/getting-started/)** - Tutorial: install and learn how BMad works`,
|
|
159
|
-
`- **[Installation](${siteUrl}/how-to/install-bmad/)** - How to install BMad Method`,
|
|
160
|
-
'',
|
|
161
|
-
'## Core Concepts',
|
|
162
|
-
'',
|
|
163
|
-
`- **[Quick Flow](${siteUrl}/explanation/quick-flow/)** - Fast development workflow`,
|
|
164
|
-
`- **[Quick Dev New Preview](${siteUrl}/explanation/quick-dev-new-preview/)** - Unified quick workflow with planning, implementation, and review in one run`,
|
|
165
|
-
`- **[Party Mode](${siteUrl}/explanation/party-mode/)** - Multi-agent collaboration`,
|
|
166
|
-
`- **[Workflow Map](${siteUrl}/reference/workflow-map/)** - Visual overview of phases and workflows`,
|
|
167
|
-
'',
|
|
168
|
-
'## Modules',
|
|
169
|
-
'',
|
|
170
|
-
`- **[Official Modules](${siteUrl}/reference/modules/)** - BMM, BMB, BMGD, and more`,
|
|
171
|
-
'',
|
|
172
|
-
'---',
|
|
173
|
-
'',
|
|
174
|
-
'## Quick Links',
|
|
175
|
-
'',
|
|
176
|
-
`- [Full Documentation (llms-full.txt)](${siteUrl}/llms-full.txt) - Complete docs for AI context`,
|
|
177
|
-
'',
|
|
178
|
-
].join('\n');
|
|
179
|
-
|
|
180
|
-
const outputPath = path.join(outputDir, 'llms.txt');
|
|
181
|
-
fs.writeFileSync(outputPath, content, 'utf-8');
|
|
182
|
-
console.log(` Generated llms.txt (${content.length.toLocaleString()} chars)`);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Builds a consolidated llms-full.txt containing all Markdown files under docsDir wrapped in <document path="..."> tags for LLM consumption.
|
|
187
|
-
*
|
|
188
|
-
* Writes the generated file to outputDir/llms-full.txt. Files matching LLM_EXCLUDE_PATTERNS are skipped; read errors for individual files are logged. The combined content is validated against configured size thresholds (will exit on overflow and warn if near limit).
|
|
189
|
-
* @param {string} docsDir - Root directory containing source Markdown files; paths in the output are relative to this directory.
|
|
190
|
-
* @param {string} outputDir - Directory where llms-full.txt will be written.
|
|
191
|
-
*/
|
|
192
|
-
function generateLlmsFullTxt(docsDir, outputDir) {
|
|
193
|
-
console.log(' → Generating llms-full.txt...');
|
|
194
|
-
|
|
195
|
-
const date = new Date().toISOString().split('T')[0];
|
|
196
|
-
const files = getAllMarkdownFiles(docsDir).sort(compareLlmDocs);
|
|
197
|
-
|
|
198
|
-
const output = [
|
|
199
|
-
'# BMAD Method Documentation (Full)',
|
|
200
|
-
'',
|
|
201
|
-
'> Complete documentation for AI consumption',
|
|
202
|
-
`> Generated: ${date}`,
|
|
203
|
-
`> Repository: ${REPO_URL}`,
|
|
204
|
-
'',
|
|
205
|
-
];
|
|
206
|
-
|
|
207
|
-
let fileCount = 0;
|
|
208
|
-
let skippedCount = 0;
|
|
209
|
-
|
|
210
|
-
for (const mdPath of files) {
|
|
211
|
-
if (shouldExcludeFromLlm(mdPath)) {
|
|
212
|
-
skippedCount++;
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const fullPath = path.join(docsDir, mdPath);
|
|
217
|
-
try {
|
|
218
|
-
const content = readMarkdownContent(fullPath);
|
|
219
|
-
output.push(`<document path="${mdPath}">`, content, '</document>', '');
|
|
220
|
-
fileCount++;
|
|
221
|
-
} catch (error) {
|
|
222
|
-
console.error(` Warning: Could not read ${mdPath}: ${error.message}`);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const result = output.join('\n');
|
|
227
|
-
validateLlmSize(result);
|
|
228
|
-
|
|
229
|
-
const outputPath = path.join(outputDir, 'llms-full.txt');
|
|
230
|
-
fs.writeFileSync(outputPath, result, 'utf-8');
|
|
231
|
-
|
|
232
|
-
const tokenEstimate = Math.floor(result.length / 4).toLocaleString();
|
|
233
|
-
console.log(
|
|
234
|
-
` Processed ${fileCount} files (skipped ${skippedCount}), ${result.length.toLocaleString()} chars (~${tokenEstimate} tokens)`,
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function compareLlmDocs(a, b) {
|
|
239
|
-
const aKey = getLlmSortKey(a);
|
|
240
|
-
const bKey = getLlmSortKey(b);
|
|
241
|
-
|
|
242
|
-
if (aKey !== bKey) return aKey - bKey;
|
|
243
|
-
return a.localeCompare(b);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function getLlmSortKey(filePath) {
|
|
247
|
-
if (filePath === 'index.md') return 0;
|
|
248
|
-
if (filePath.startsWith(`tutorials${path.sep}`) || filePath.startsWith('tutorials/')) return 2;
|
|
249
|
-
if (filePath.startsWith(`how-to${path.sep}`) || filePath.startsWith('how-to/')) return 3;
|
|
250
|
-
if (filePath.startsWith(`explanation${path.sep}`) || filePath.startsWith('explanation/')) return 4;
|
|
251
|
-
if (filePath.startsWith(`reference${path.sep}`) || filePath.startsWith('reference/')) return 5;
|
|
252
|
-
if (filePath.startsWith(`bmgd${path.sep}`) || filePath.startsWith('bmgd/')) return 6;
|
|
253
|
-
return 7;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Collects all Markdown (.md) files under a directory and returns their paths relative to a base directory.
|
|
258
|
-
* @param {string} dir - Directory to search for Markdown files.
|
|
259
|
-
* @param {string} [baseDir=dir] - Base directory used to compute returned relative paths.
|
|
260
|
-
* @returns {string[]} An array of file paths (relative to `baseDir`) for every `.md` file found under `dir`.
|
|
261
|
-
*/
|
|
262
|
-
function getAllMarkdownFiles(dir, baseDir = dir) {
|
|
263
|
-
const files = [];
|
|
264
|
-
|
|
265
|
-
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
266
|
-
const fullPath = path.join(dir, entry.name);
|
|
267
|
-
|
|
268
|
-
if (entry.isDirectory()) {
|
|
269
|
-
files.push(...getAllMarkdownFiles(fullPath, baseDir));
|
|
270
|
-
} else if (entry.name.endsWith('.md')) {
|
|
271
|
-
// Return relative path from baseDir
|
|
272
|
-
const relativePath = path.relative(baseDir, fullPath);
|
|
273
|
-
files.push(relativePath);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
return files;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Determine whether a file path matches any configured LLM exclusion pattern.
|
|
282
|
-
* Also excludes any files or directories starting with underscore.
|
|
283
|
-
* @param {string} filePath - The file path to test.
|
|
284
|
-
* @returns {boolean} `true` if excluded, `false` otherwise.
|
|
285
|
-
*/
|
|
286
|
-
function shouldExcludeFromLlm(filePath) {
|
|
287
|
-
// Exclude if ANY path component starts with underscore
|
|
288
|
-
// (e.g., _STYLE_GUIDE.md, _archive/file.md, dir/_STYLE_GUIDE.md)
|
|
289
|
-
const pathParts = filePath.split(path.sep);
|
|
290
|
-
if (pathParts.some((part) => part.startsWith('_'))) return true;
|
|
291
|
-
|
|
292
|
-
// Check configured patterns
|
|
293
|
-
return LLM_EXCLUDE_PATTERNS.some((pattern) => filePath.includes(pattern));
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function readMarkdownContent(filePath) {
|
|
297
|
-
let content = fs.readFileSync(filePath, 'utf-8');
|
|
298
|
-
|
|
299
|
-
if (content.startsWith('---')) {
|
|
300
|
-
const end = content.indexOf('---', 3);
|
|
301
|
-
if (end !== -1) {
|
|
302
|
-
content = content.slice(end + 3).trim();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
return content;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
function validateLlmSize(content) {
|
|
310
|
-
const charCount = content.length;
|
|
311
|
-
|
|
312
|
-
if (charCount > LLM_MAX_CHARS) {
|
|
313
|
-
console.error(` ERROR: Exceeds ${LLM_MAX_CHARS.toLocaleString()} char limit`);
|
|
314
|
-
process.exit(1);
|
|
315
|
-
} else if (charCount > LLM_WARN_CHARS) {
|
|
316
|
-
console.warn(` \u001B[33mWARNING: Approaching ${LLM_WARN_CHARS.toLocaleString()} char limit\u001B[0m`);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// =============================================================================
|
|
321
|
-
// Astro Build
|
|
322
|
-
/**
|
|
323
|
-
* Builds the Astro site to build/site (configured in astro.config.mjs).
|
|
324
|
-
*/
|
|
325
|
-
function runAstroBuild() {
|
|
326
|
-
console.log(' → Running astro build...');
|
|
327
|
-
execSync('npx astro build --root website', {
|
|
328
|
-
cwd: PROJECT_ROOT,
|
|
329
|
-
stdio: 'inherit',
|
|
330
|
-
env: {
|
|
331
|
-
...process.env,
|
|
332
|
-
},
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Copy generated artifact files into the built site directory.
|
|
338
|
-
*
|
|
339
|
-
* Copies llms.txt and llms-full.txt from the artifacts directory into the site directory.
|
|
340
|
-
*
|
|
341
|
-
* @param {string} artifactsDir - Path to the build artifacts directory containing generated files.
|
|
342
|
-
* @param {string} siteDir - Path to the target site directory where artifacts should be placed.
|
|
343
|
-
*/
|
|
344
|
-
function copyArtifactsToSite(artifactsDir, siteDir) {
|
|
345
|
-
console.log(' → Copying artifacts to site...');
|
|
346
|
-
|
|
347
|
-
fs.copyFileSync(path.join(artifactsDir, 'llms.txt'), path.join(siteDir, 'llms.txt'));
|
|
348
|
-
fs.copyFileSync(path.join(artifactsDir, 'llms-full.txt'), path.join(siteDir, 'llms-full.txt'));
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// =============================================================================
|
|
352
|
-
// Build Summary
|
|
353
|
-
/**
|
|
354
|
-
* Prints a concise end-of-build summary and displays a sample listing of the final site directory.
|
|
355
|
-
*
|
|
356
|
-
* @param {string} docsDir - Path to the source documentation directory used for the build.
|
|
357
|
-
* @param {string} artifactsDir - Path to the directory containing generated artifacts (e.g., llms.txt).
|
|
358
|
-
* @param {string} siteDir - Path to the final built site directory whose contents will be listed.
|
|
359
|
-
*/
|
|
360
|
-
|
|
361
|
-
function printBuildSummary(docsDir, artifactsDir, siteDir) {
|
|
362
|
-
console.log();
|
|
363
|
-
printBanner('Build Complete!');
|
|
364
|
-
console.log();
|
|
365
|
-
console.log('Build artifacts:');
|
|
366
|
-
console.log(` Source docs: ${docsDir}`);
|
|
367
|
-
console.log(` Generated files: ${artifactsDir}`);
|
|
368
|
-
console.log(` Final site: ${siteDir}`);
|
|
369
|
-
console.log();
|
|
370
|
-
console.log(`Deployable output: ${siteDir}/`);
|
|
371
|
-
console.log();
|
|
372
|
-
|
|
373
|
-
listDirectoryContents(siteDir);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
function listDirectoryContents(dir) {
|
|
377
|
-
const entries = fs.readdirSync(dir).slice(0, 15);
|
|
378
|
-
|
|
379
|
-
for (const entry of entries) {
|
|
380
|
-
const fullPath = path.join(dir, entry);
|
|
381
|
-
const stat = fs.statSync(fullPath);
|
|
382
|
-
|
|
383
|
-
if (stat.isFile()) {
|
|
384
|
-
const sizeStr = formatFileSize(stat.size);
|
|
385
|
-
console.log(` ${entry.padEnd(40)} ${sizeStr.padStart(8)}`);
|
|
386
|
-
} else {
|
|
387
|
-
console.log(` ${entry}/`);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Format a byte count into a compact human-readable string using B, K, or M units.
|
|
394
|
-
* @param {number} bytes - The number of bytes to format.
|
|
395
|
-
* @returns {string} The formatted size: bytes as `N B` (e.g. `512B`), kilobytes truncated to an integer with `K` (e.g. `2K`), or megabytes with one decimal and `M` (e.g. `1.2M`).
|
|
396
|
-
*/
|
|
397
|
-
function formatFileSize(bytes) {
|
|
398
|
-
if (bytes > 1024 * 1024) {
|
|
399
|
-
return `${(bytes / 1024 / 1024).toFixed(1)}M`;
|
|
400
|
-
} else if (bytes > 1024) {
|
|
401
|
-
return `${Math.floor(bytes / 1024)}K`;
|
|
402
|
-
}
|
|
403
|
-
return `${bytes}B`;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// =============================================================================
|
|
407
|
-
// File System Utilities
|
|
408
|
-
/**
|
|
409
|
-
* Remove any existing build output and recreate the build directory.
|
|
410
|
-
*
|
|
411
|
-
* Ensures the configured BUILD_DIR is empty by deleting it if present and then creating a fresh directory.
|
|
412
|
-
*/
|
|
413
|
-
|
|
414
|
-
function cleanBuildDirectory() {
|
|
415
|
-
console.log('Cleaning previous build...');
|
|
416
|
-
|
|
417
|
-
if (fs.existsSync(BUILD_DIR)) {
|
|
418
|
-
fs.rmSync(BUILD_DIR, { recursive: true });
|
|
419
|
-
}
|
|
420
|
-
fs.mkdirSync(BUILD_DIR, { recursive: true });
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// =============================================================================
|
|
424
|
-
// Console Output Formatting
|
|
425
|
-
// =============================================================================
|
|
426
|
-
|
|
427
|
-
function printHeader(title) {
|
|
428
|
-
console.log();
|
|
429
|
-
console.log('┌' + '─'.repeat(62) + '┐');
|
|
430
|
-
console.log(`│ ${title.padEnd(60)} │`);
|
|
431
|
-
console.log('└' + '─'.repeat(62) + '┘');
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Prints a centered decorative ASCII banner to the console using the provided title.
|
|
436
|
-
* @param {string} title - Text to display centered inside the banner. */
|
|
437
|
-
function printBanner(title) {
|
|
438
|
-
console.log('╔' + '═'.repeat(62) + '╗');
|
|
439
|
-
console.log(`║${title.padStart(31 + title.length / 2).padEnd(62)}║`);
|
|
440
|
-
console.log('╚' + '═'.repeat(62) + '╝');
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// =============================================================================
|
|
444
|
-
// Link Checking
|
|
445
|
-
/**
|
|
446
|
-
* Verify internal documentation links by running the link-checking script.
|
|
447
|
-
*
|
|
448
|
-
* Executes the Node script tools/validate-doc-links.js from the project root and
|
|
449
|
-
* exits the process with code 1 if the check fails.
|
|
450
|
-
*/
|
|
451
|
-
|
|
452
|
-
function checkDocLinks() {
|
|
453
|
-
printHeader('Checking documentation links');
|
|
454
|
-
|
|
455
|
-
try {
|
|
456
|
-
execSync('node tools/validate-doc-links.js', {
|
|
457
|
-
cwd: PROJECT_ROOT,
|
|
458
|
-
stdio: 'inherit',
|
|
459
|
-
});
|
|
460
|
-
} catch {
|
|
461
|
-
console.error('\n \u001B[31m✗\u001B[0m Link check failed - fix broken links before building\n');
|
|
462
|
-
process.exit(1);
|
|
463
|
-
}
|
|
464
|
-
}
|