ccjk 16.0.6 → 16.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -316
- package/dist/chunks/claude-code-config-manager.mjs +28 -7
- package/dist/chunks/claude-code-incremental-manager.mjs +2 -2
- package/dist/chunks/codex-config-switch.mjs +3 -3
- package/dist/chunks/codex-presets.mjs +98 -0
- package/dist/chunks/codex-provider-manager.mjs +4 -4
- package/dist/chunks/codex-runtime.mjs +246 -0
- package/dist/chunks/codex-uninstaller.mjs +2 -2
- package/dist/chunks/commands.mjs +1 -1
- package/dist/chunks/features.mjs +35 -15
- package/dist/chunks/simple-config.mjs +659 -148
- package/dist/cli.mjs +1700 -908
- package/dist/i18n/locales/en/clean.json +24 -0
- package/dist/i18n/locales/en/codex.json +24 -1
- package/dist/i18n/locales/en/configuration.json +27 -12
- package/dist/i18n/locales/en/hub.json +30 -0
- package/dist/i18n/locales/en/menu.json +32 -8
- package/dist/i18n/locales/en/workflow.json +13 -1
- package/dist/i18n/locales/zh-CN/clean.json +24 -0
- package/dist/i18n/locales/zh-CN/codex.json +24 -1
- package/dist/i18n/locales/zh-CN/configuration.json +27 -12
- package/dist/i18n/locales/zh-CN/hub.json +30 -0
- package/dist/i18n/locales/zh-CN/menu.json +32 -8
- package/dist/i18n/locales/zh-CN/workflow.json +13 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{ccjk.BSLlI-JL.mjs → ccjk.TC1_-qhV.mjs} +1 -1
- package/package.json +1 -1
- package/templates/common/output-styles/en/agents-md-baseline.md +28 -0
- package/templates/common/output-styles/en/plan-first.md +30 -0
- package/templates/common/output-styles/en/surgical-diff.md +27 -0
- package/templates/common/output-styles/en/verify-and-ship.md +31 -0
- package/templates/common/output-styles/zh-CN/agents-md-baseline.md +28 -0
- package/templates/common/output-styles/zh-CN/plan-first.md +30 -0
- package/templates/common/output-styles/zh-CN/surgical-diff.md +27 -0
- package/templates/common/output-styles/zh-CN/verify-and-ship.md +31 -0
- package/templates/common/workflow/bmad/en/bmad-init.md +275 -0
- package/templates/common/workflow/bmad/zh-CN/bmad-init.md +275 -0
- package/templates/common/workflow/codeReview/en/code-review.md +34 -0
- package/templates/common/workflow/codeReview/zh-CN/code-review.md +34 -0
- package/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +628 -0
- package/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +628 -0
- package/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +187 -0
- package/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +191 -0
- package/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +249 -0
- package/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +277 -0
- package/templates/common/workflow/essential/en/agents/get-current-datetime.md +29 -0
- package/templates/common/workflow/essential/en/agents/init-architect.md +115 -0
- package/templates/common/workflow/essential/en/agents/planner.md +116 -0
- package/templates/common/workflow/essential/en/agents/teamagent.md +102 -0
- package/templates/common/workflow/essential/en/agents/ui-ux-designer.md +91 -0
- package/templates/common/workflow/essential/en/feat.md +92 -0
- package/templates/common/workflow/essential/en/init-project.md +53 -0
- package/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +29 -0
- package/templates/common/workflow/essential/zh-CN/agents/init-architect.md +115 -0
- package/templates/common/workflow/essential/zh-CN/agents/planner.md +116 -0
- package/templates/common/workflow/essential/zh-CN/agents/teamagent.md +102 -0
- package/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +91 -0
- package/templates/common/workflow/essential/zh-CN/feat.md +315 -0
- package/templates/common/workflow/essential/zh-CN/init-project.md +53 -0
- package/templates/common/workflow/interview/en/interview.md +67 -0
- package/templates/common/workflow/interview/zh-CN/interview.md +67 -0
- package/templates/common/workflow/linearMethod/en/linear-method.md +651 -0
- package/templates/common/workflow/linearMethod/zh-CN/linear-method.md +750 -0
- package/templates/common/workflow/refactoringMaster/en/refactoring-master.md +516 -0
- package/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +810 -0
- package/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +364 -0
- package/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +364 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agents-md-baseline
|
|
3
|
+
description: OpenAI Codex AGENTS.md engineering baseline - verify loops, minimal diffs, risky-op confirmation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AGENTS.md Engineering Baseline
|
|
7
|
+
|
|
8
|
+
> Based on the [OpenAI Codex AGENTS.md guide](https://developers.openai.com/codex/guides/agents-md) and community best practices.
|
|
9
|
+
|
|
10
|
+
## Working agreements
|
|
11
|
+
|
|
12
|
+
- **Read before edit**: Review relevant code, tests, and project docs (e.g. `ARCHITECTURE.md`, `docs/`) before changing anything.
|
|
13
|
+
- **Minimal diffs**: Change only what the task requires; no drive-by refactors or unrelated cleanup.
|
|
14
|
+
- **Verify loop**: After edits, run the project's smallest relevant checks (`pnpm test`, `pnpm lint`, `npm test`, etc.); fix failures before moving on.
|
|
15
|
+
- **Confirm risky ops**: Get explicit approval before deleting files, force git operations, production config changes, or bulk dependency updates.
|
|
16
|
+
- **Paths and commands**: Quote file paths; prefer the package manager and scripts documented in the repo.
|
|
17
|
+
|
|
18
|
+
## Output style
|
|
19
|
+
|
|
20
|
+
- Lead with conclusions; keep steps clear; avoid filler.
|
|
21
|
+
- Reference code with `path:line` when possible.
|
|
22
|
+
- Investigate or ask when unsure — do not guess APIs or layout.
|
|
23
|
+
|
|
24
|
+
## Collaboration
|
|
25
|
+
|
|
26
|
+
- Match existing naming, structure, and test patterns.
|
|
27
|
+
- Explain rationale before new dependencies or large-scope changes.
|
|
28
|
+
- End tasks with a short summary of what changed and how it was verified.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-first
|
|
3
|
+
description: OpenAI Codex recommended - plan before coding; clarify Goal/Context/Constraints/Done-when
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Plan-First Engineering Style
|
|
7
|
+
|
|
8
|
+
> From [Codex Best Practices](https://developers.openai.com/codex/learn/best-practices) — plan before implementing complex, ambiguous, or multi-step work.
|
|
9
|
+
|
|
10
|
+
## Four task anchors
|
|
11
|
+
|
|
12
|
+
Align on these before acting:
|
|
13
|
+
|
|
14
|
+
1. **Goal** — What outcome is required?
|
|
15
|
+
2. **Context** — Which files, dirs, docs, or errors matter?
|
|
16
|
+
3. **Constraints** — Architecture, safety, style, and boundaries?
|
|
17
|
+
4. **Done when** — What must be true to finish? (tests pass, behavior changes, bug gone)
|
|
18
|
+
|
|
19
|
+
## Planning discipline
|
|
20
|
+
|
|
21
|
+
- Multi-file changes, architecture decisions, unclear requirements: **plan first, code second**.
|
|
22
|
+
- Plans cover scope, step order, verification, and risks.
|
|
23
|
+
- Implement only after the plan is sound; explain deviations before continuing.
|
|
24
|
+
- Split large work into verifiable steps with clear done criteria.
|
|
25
|
+
|
|
26
|
+
## Coding
|
|
27
|
+
|
|
28
|
+
- Execute the smallest planned step; no unplanned refactors.
|
|
29
|
+
- Revise the plan when reality changes — do not brute-force around it.
|
|
30
|
+
- Cite code as `path:line` for reviewability.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: surgical-diff
|
|
3
|
+
description: Community consensus (Karpathy/senior maintainers) - surgical minimal diffs, understand before editing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Surgical-Diff Engineering Style
|
|
7
|
+
|
|
8
|
+
> Shared discipline for effective agents: smaller, well-scoped diffs win. Aligns with OpenAI Codex repo maintenance practice and community “surgical edit” norms.
|
|
9
|
+
|
|
10
|
+
## Core rules
|
|
11
|
+
|
|
12
|
+
- **Read before edit** — No changes without reading relevant code, tests, and callers.
|
|
13
|
+
- **Minimal diff** — Only lines the task requires; no drive-by refactors, unrelated formatting, or comment deletes.
|
|
14
|
+
- **Single intent** — One PR-sized purpose per task; no unrelated fixes bundled in.
|
|
15
|
+
- **Reuse first** — Extend existing functions and patterns; do not parallel-reimplement.
|
|
16
|
+
|
|
17
|
+
## Avoid
|
|
18
|
+
|
|
19
|
+
- Broad renames “for cleanliness”
|
|
20
|
+
- Dependency/CI/config churn without request
|
|
21
|
+
- try-catch that hides failures to green tests
|
|
22
|
+
- Guessing APIs — read code or docs when unsure
|
|
23
|
+
|
|
24
|
+
## Before done
|
|
25
|
+
|
|
26
|
+
- Diff size matches task scope; huge changes need a plan first.
|
|
27
|
+
- Every hunk has a one-line “why necessary” rationale.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-and-ship
|
|
3
|
+
description: OpenAI Codex recommended - test/lint/self-review loop before shipping
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verify-and-Ship Engineering Style
|
|
7
|
+
|
|
8
|
+
> From [Codex Best Practices](https://developers.openai.com/codex/learn/best-practices) — Codex should test, check, and confirm results, not only generate code.
|
|
9
|
+
|
|
10
|
+
## Verification loop (required)
|
|
11
|
+
|
|
12
|
+
After changes, run in order:
|
|
13
|
+
|
|
14
|
+
1. **Tests** — Run the smallest relevant suite; add tests for new logic.
|
|
15
|
+
2. **Static checks** — Lint, format, typecheck per repo scripts (`pnpm test`, `pnpm lint`, etc.).
|
|
16
|
+
3. **Behavior** — Confirm against the task, not just “it compiles”.
|
|
17
|
+
4. **Diff self-review** — Regressions, edge cases, risky patterns (swallowed errors, secrets).
|
|
18
|
+
|
|
19
|
+
Fix and repeat until green; only then report done.
|
|
20
|
+
|
|
21
|
+
## Shipping bar
|
|
22
|
+
|
|
23
|
+
- Summarize what changed, why, and how it was verified.
|
|
24
|
+
- List commands run and outcomes.
|
|
25
|
+
- If full suite was skipped, say why and what was covered.
|
|
26
|
+
- Do not claim completion until Done-when is met.
|
|
27
|
+
|
|
28
|
+
## Collaboration
|
|
29
|
+
|
|
30
|
+
- Use documented package manager and scripts; do not invent commands.
|
|
31
|
+
- Confirm destructive ops; never skip verification.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agents-md-baseline
|
|
3
|
+
description: OpenAI Codex 官方 AGENTS.md 工程基线 - 验证循环、最小改动、危险操作确认
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AGENTS.md 工程基线
|
|
7
|
+
|
|
8
|
+
> 基于 [OpenAI Codex AGENTS.md 指南](https://developers.openai.com/codex/guides/agents-md) 与社区最佳实践。
|
|
9
|
+
|
|
10
|
+
## 工作约定
|
|
11
|
+
|
|
12
|
+
- **先读后改**:动手前阅读相关代码、测试与项目文档(如 `ARCHITECTURE.md`、`docs/`)。
|
|
13
|
+
- **最小改动**:只改完成任务所需的代码,不做无关重构或顺手清理。
|
|
14
|
+
- **验证循环**:改动后运行项目已有的最小验证命令(如 `pnpm test`、`pnpm lint`、`npm test`);失败则修复后再继续。
|
|
15
|
+
- **危险操作确认**:删除文件、强制 git 操作、改生产配置、批量依赖变更前必须说明影响并征得确认。
|
|
16
|
+
- **路径与命令**:文件路径用引号包裹;优先使用项目文档中记录的包管理器与脚本。
|
|
17
|
+
|
|
18
|
+
## 输出风格
|
|
19
|
+
|
|
20
|
+
- 结论先行,步骤清晰,避免空话。
|
|
21
|
+
- 引用代码时用 `文件路径:行号` 格式,便于定位。
|
|
22
|
+
- 不确定时先调查或提问,不猜测 API 或文件结构。
|
|
23
|
+
|
|
24
|
+
## 协作原则
|
|
25
|
+
|
|
26
|
+
- 遵循仓库既有命名、目录结构与测试风格。
|
|
27
|
+
- 新依赖或大范围改动前先说明理由。
|
|
28
|
+
- 任务完成时简要说明改了什么、如何验证。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-first
|
|
3
|
+
description: OpenAI Codex 推荐 - 复杂任务先规划再编码,明确 Goal/Context/Constraints/Done-when
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Plan-First 工程风格
|
|
7
|
+
|
|
8
|
+
> 来源:[Codex Best Practices](https://developers.openai.com/codex/learn/best-practices) — 复杂、模糊或多步骤任务先规划再动手。
|
|
9
|
+
|
|
10
|
+
## 任务启动四要素
|
|
11
|
+
|
|
12
|
+
每次接到任务,先在心里(或输出中)对齐:
|
|
13
|
+
|
|
14
|
+
1. **Goal**:要达成什么结果?
|
|
15
|
+
2. **Context**:哪些文件、目录、文档、错误信息相关?
|
|
16
|
+
3. **Constraints**:架构、安全、风格、不可触碰的边界是什么?
|
|
17
|
+
4. **Done when**:怎样算完成?(测试通过、行为改变、bug 不再复现)
|
|
18
|
+
|
|
19
|
+
## 规划纪律
|
|
20
|
+
|
|
21
|
+
- 多文件改动、架构决策、需求不清时:**先出计划,不写代码**。
|
|
22
|
+
- 计划包含:影响范围、步骤顺序、验证方式、风险点。
|
|
23
|
+
- 计划经确认或自洽后再实施;实施中偏离计划时先说明原因。
|
|
24
|
+
- 大任务可拆为可独立验证的小步,每步有明确完成标准。
|
|
25
|
+
|
|
26
|
+
## 编码原则
|
|
27
|
+
|
|
28
|
+
- 按计划的最小步骤推进,不做计划外重构。
|
|
29
|
+
- 发现计划有误时,更新计划再继续,不硬改。
|
|
30
|
+
- 引用代码用 `路径:行号`,便于审查。
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: surgical-diff
|
|
3
|
+
description: 社区共识(Karpathy/资深维护者)- 外科手术式最小改动,先理解再动刀
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Surgical-Diff 工程风格
|
|
7
|
+
|
|
8
|
+
> 高效 agent 的共同纪律:改动越小、上下文越准,结果越稳。参考 OpenAI Codex 官方仓库维护实践与社区「surgical edit」共识。
|
|
9
|
+
|
|
10
|
+
## 核心纪律
|
|
11
|
+
|
|
12
|
+
- **先读后改**:不读相关代码、测试、调用方就不改。
|
|
13
|
+
- **最小 diff**:只改完成任务必需的行;禁止顺手重构、格式化无关文件、删无关注释。
|
|
14
|
+
- **单一意图**:一个任务一个 PR 级意图,不混入无关修复。
|
|
15
|
+
- **复用优先**:扩展现有函数/模式,不平行造轮子。
|
|
16
|
+
|
|
17
|
+
## 禁止
|
|
18
|
+
|
|
19
|
+
- 大范围重命名「为了好看」
|
|
20
|
+
- 未要求时升级依赖、改 CI、动配置
|
|
21
|
+
- 用 try-catch 吞掉错误来「让测试过」
|
|
22
|
+
- 猜测 API:不确定就查代码或文档
|
|
23
|
+
|
|
24
|
+
## 完成前
|
|
25
|
+
|
|
26
|
+
- Diff 行数与任务规模匹配;超大改动需先拆计划。
|
|
27
|
+
- 每条改动能一句话说明「为何必要」。
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-and-ship
|
|
3
|
+
description: OpenAI Codex 推荐 - 测试/静态检查/自审闭环,确认行为后再交付
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verify-and-Ship 工程风格
|
|
7
|
+
|
|
8
|
+
> 来源:[Codex Best Practices](https://developers.openai.com/codex/learn/best-practices) — Codex 应测试、检查、确认结果,而非只生成代码。
|
|
9
|
+
|
|
10
|
+
## 验证闭环(必须)
|
|
11
|
+
|
|
12
|
+
完成改动后按顺序执行:
|
|
13
|
+
|
|
14
|
+
1. **测试**:运行与变更相关的最小测试集(单元/集成);新增逻辑需补测试。
|
|
15
|
+
2. **静态检查**:运行项目已有的 lint、format、typecheck(如 `pnpm test`、`pnpm lint`)。
|
|
16
|
+
3. **行为确认**:对照任务要求验证实际行为,不只「编译通过」。
|
|
17
|
+
4. **Diff 自审**:检查回归、边界条件、危险模式(未处理错误、硬编码密钥等)。
|
|
18
|
+
|
|
19
|
+
失败则修复并重复闭环,通过后再报告完成。
|
|
20
|
+
|
|
21
|
+
## 交付标准
|
|
22
|
+
|
|
23
|
+
- 说明改了什么、为什么、如何验证。
|
|
24
|
+
- 列出已运行的命令及结果。
|
|
25
|
+
- 未跑全量测试时说明原因与已覆盖范围。
|
|
26
|
+
- 不声称「完成」除非 Done-when 条件已满足。
|
|
27
|
+
|
|
28
|
+
## 协作
|
|
29
|
+
|
|
30
|
+
- 使用仓库文档中的包管理器与脚本,不臆造命令。
|
|
31
|
+
- 破坏性操作前确认;不跳过验证步骤。
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# /bmad-init Command
|
|
2
|
+
|
|
3
|
+
This command initializes or updates BMad-Method (V6) in your project.
|
|
4
|
+
|
|
5
|
+
## When this command is invoked:
|
|
6
|
+
|
|
7
|
+
1. Check if `_bmad/` directory exists to determine if BMad V6 is already installed
|
|
8
|
+
2. Check for legacy V4 installations (`.bmad-core` or `.bmad-method` directories)
|
|
9
|
+
3. Fresh install executes: `npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yes`
|
|
10
|
+
4. Existing install executes: `npx bmad-method install --directory . --action quick-update --yes`
|
|
11
|
+
5. Fix installer bug: rename `{output_folder}` to `_bmad-output` (Beta known issue)
|
|
12
|
+
6. Automatically update `.gitignore` (remove V4 entries, add V6 entries)
|
|
13
|
+
7. Display installation results and prompt user for next steps
|
|
14
|
+
|
|
15
|
+
## Implementation
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
const { execSync } = require('node:child_process')
|
|
19
|
+
const fs = require('node:fs')
|
|
20
|
+
const path = require('node:path')
|
|
21
|
+
|
|
22
|
+
// Legacy entries to clean from .gitignore
|
|
23
|
+
const LEGACY_GITIGNORE_ENTRIES = [
|
|
24
|
+
'.bmad-core',
|
|
25
|
+
'.bmad-method',
|
|
26
|
+
'.claude/commands/BMad',
|
|
27
|
+
'{output_folder}', // v6.0.0-Beta.8 bug artifact
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
// V6 .gitignore entries
|
|
31
|
+
const V6_GITIGNORE_ENTRIES = [
|
|
32
|
+
'_bmad/',
|
|
33
|
+
'_bmad-output/',
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
// Fix installer bug: {output_folder} not resolved to _bmad-output (v6.0.0-Beta.8)
|
|
37
|
+
function fixOutputFolderBug(cwd) {
|
|
38
|
+
const buggyPath = path.join(cwd, '{output_folder}')
|
|
39
|
+
const correctPath = path.join(cwd, '_bmad-output')
|
|
40
|
+
|
|
41
|
+
if (!fs.existsSync(buggyPath)) return false
|
|
42
|
+
|
|
43
|
+
if (!fs.existsSync(correctPath)) {
|
|
44
|
+
// _bmad-output doesn't exist, simply rename
|
|
45
|
+
fs.renameSync(buggyPath, correctPath)
|
|
46
|
+
console.log(' ✅ {output_folder} → _bmad-output/ (renamed)')
|
|
47
|
+
} else {
|
|
48
|
+
// _bmad-output already exists, merge subdirectories then delete
|
|
49
|
+
const entries = fs.readdirSync(buggyPath, { withFileTypes: true })
|
|
50
|
+
for (const entry of entries) {
|
|
51
|
+
const src = path.join(buggyPath, entry.name)
|
|
52
|
+
const dest = path.join(correctPath, entry.name)
|
|
53
|
+
if (!fs.existsSync(dest)) {
|
|
54
|
+
fs.renameSync(src, dest)
|
|
55
|
+
console.log(` ✅ Moved ${entry.name} → _bmad-output/`)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
fs.rmSync(buggyPath, { recursive: true, force: true })
|
|
59
|
+
console.log(' ✅ Removed redundant {output_folder}/')
|
|
60
|
+
}
|
|
61
|
+
return true
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function updateGitignore(cwd) {
|
|
65
|
+
const gitignorePath = path.join(cwd, '.gitignore')
|
|
66
|
+
let content = ''
|
|
67
|
+
let exists = false
|
|
68
|
+
|
|
69
|
+
if (fs.existsSync(gitignorePath)) {
|
|
70
|
+
content = fs.readFileSync(gitignorePath, 'utf8')
|
|
71
|
+
exists = true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const lines = content.split('\n')
|
|
75
|
+
let changed = false
|
|
76
|
+
|
|
77
|
+
// Remove V4 legacy entries
|
|
78
|
+
const filtered = lines.filter(line => {
|
|
79
|
+
const trimmed = line.trim()
|
|
80
|
+
const isLegacy = LEGACY_GITIGNORE_ENTRIES.some(entry =>
|
|
81
|
+
trimmed === entry || trimmed === entry + '/' || trimmed === '/' + entry
|
|
82
|
+
)
|
|
83
|
+
if (isLegacy) {
|
|
84
|
+
console.log(` 🗑️ Removing legacy entry: ${trimmed}`)
|
|
85
|
+
changed = true
|
|
86
|
+
}
|
|
87
|
+
return !isLegacy
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// Add V6 entries
|
|
91
|
+
const newEntries = []
|
|
92
|
+
for (const entry of V6_GITIGNORE_ENTRIES) {
|
|
93
|
+
const entryBase = entry.replace(/\/$/, '')
|
|
94
|
+
const alreadyExists = filtered.some(line => {
|
|
95
|
+
const trimmed = line.trim()
|
|
96
|
+
return trimmed === entry || trimmed === entryBase || trimmed === '/' + entryBase
|
|
97
|
+
})
|
|
98
|
+
if (!alreadyExists) {
|
|
99
|
+
newEntries.push(entry)
|
|
100
|
+
console.log(` ✅ Adding new entry: ${entry}`)
|
|
101
|
+
changed = true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!changed) {
|
|
106
|
+
console.log(' ℹ️ .gitignore is up to date, no changes needed')
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Build new content
|
|
111
|
+
let result = filtered.join('\n')
|
|
112
|
+
|
|
113
|
+
if (newEntries.length > 0) {
|
|
114
|
+
// Ensure trailing newline, then add BMad section
|
|
115
|
+
if (result.length > 0 && !result.endsWith('\n')) {
|
|
116
|
+
result += '\n'
|
|
117
|
+
}
|
|
118
|
+
result += '\n# BMad Method V6\n'
|
|
119
|
+
result += newEntries.join('\n') + '\n'
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
fs.writeFileSync(gitignorePath, result, 'utf8')
|
|
123
|
+
console.log(` 📝 .gitignore ${exists ? 'updated' : 'created'}`)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function initBmad() {
|
|
127
|
+
const cwd = process.cwd()
|
|
128
|
+
const bmadV6Path = path.join(cwd, '_bmad')
|
|
129
|
+
const legacyCorePath = path.join(cwd, '.bmad-core')
|
|
130
|
+
const legacyMethodPath = path.join(cwd, '.bmad-method')
|
|
131
|
+
|
|
132
|
+
// Check for legacy V4 installation
|
|
133
|
+
const hasLegacyCore = fs.existsSync(legacyCorePath)
|
|
134
|
+
const hasLegacyMethod = fs.existsSync(legacyMethodPath)
|
|
135
|
+
|
|
136
|
+
if (hasLegacyCore || hasLegacyMethod) {
|
|
137
|
+
console.log('⚠️ Legacy BMad V4 installation detected:')
|
|
138
|
+
if (hasLegacyCore) console.log(' • .bmad-core/ (V4 core directory)')
|
|
139
|
+
if (hasLegacyMethod) console.log(' • .bmad-method/ (V4 method directory)')
|
|
140
|
+
console.log('')
|
|
141
|
+
console.log('📌 The V6 installer will handle legacy migration automatically. Follow the prompts during installation.')
|
|
142
|
+
console.log(' Details: https://bmad-code-org.github.io/BMAD-METHOD/docs/how-to/upgrade-to-v6')
|
|
143
|
+
console.log('')
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Check if V6 is already installed
|
|
147
|
+
const hasV6 = fs.existsSync(bmadV6Path)
|
|
148
|
+
|
|
149
|
+
// Build non-interactive install command
|
|
150
|
+
let installCmd
|
|
151
|
+
if (hasV6) {
|
|
152
|
+
console.log('🔄 Existing BMad V6 installation detected, performing quick update...')
|
|
153
|
+
console.log('')
|
|
154
|
+
installCmd = [
|
|
155
|
+
'npx bmad-method install',
|
|
156
|
+
'--directory .',
|
|
157
|
+
'--action quick-update',
|
|
158
|
+
'--yes',
|
|
159
|
+
].join(' ')
|
|
160
|
+
} else {
|
|
161
|
+
console.log('🚀 Initializing BMad-Method V6...')
|
|
162
|
+
console.log('')
|
|
163
|
+
installCmd = [
|
|
164
|
+
'npx bmad-method install',
|
|
165
|
+
'--directory .',
|
|
166
|
+
'--modules bmm',
|
|
167
|
+
'--tools claude-code',
|
|
168
|
+
'--communication-language English',
|
|
169
|
+
'--document-output-language English',
|
|
170
|
+
'--yes',
|
|
171
|
+
].join(' ')
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Execute installation
|
|
175
|
+
try {
|
|
176
|
+
console.log(`📋 Executing: ${installCmd}`)
|
|
177
|
+
console.log('')
|
|
178
|
+
execSync(installCmd, {
|
|
179
|
+
stdio: 'inherit',
|
|
180
|
+
cwd: cwd,
|
|
181
|
+
shell: true
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
console.log('')
|
|
185
|
+
console.log('✅ BMad-Method V6 installation/update complete!')
|
|
186
|
+
console.log('')
|
|
187
|
+
console.log('═══════════════════════════════════════════════════════════════')
|
|
188
|
+
console.log('📌 IMPORTANT: Please restart your AI IDE to load BMad extensions')
|
|
189
|
+
console.log('═══════════════════════════════════════════════════════════════')
|
|
190
|
+
console.log('')
|
|
191
|
+
// Fix {output_folder} bug (v6.0.0-Beta.8)
|
|
192
|
+
console.log('🔧 Checking for known installer issues...')
|
|
193
|
+
try {
|
|
194
|
+
const fixed = fixOutputFolderBug(cwd)
|
|
195
|
+
if (!fixed) console.log(' ℹ️ No fixes needed')
|
|
196
|
+
} catch (err) {
|
|
197
|
+
console.log(` ⚠️ Failed to fix {output_folder}: ${err.message}`)
|
|
198
|
+
console.log(' Please manually rename {output_folder}/ to _bmad-output/')
|
|
199
|
+
}
|
|
200
|
+
console.log('')
|
|
201
|
+
|
|
202
|
+
console.log('📂 V6 Directory Structure:')
|
|
203
|
+
console.log(' • _bmad/ — agents, workflows, tasks, and configuration')
|
|
204
|
+
console.log(' • _bmad-output/ — generated artifact output directory')
|
|
205
|
+
console.log('')
|
|
206
|
+
|
|
207
|
+
// Automatically update .gitignore
|
|
208
|
+
console.log('🔧 Updating .gitignore...')
|
|
209
|
+
try {
|
|
210
|
+
updateGitignore(cwd)
|
|
211
|
+
} catch (err) {
|
|
212
|
+
console.log(' ⚠️ Failed to automatically update .gitignore, please manually add _bmad/ and _bmad-output/')
|
|
213
|
+
}
|
|
214
|
+
console.log('')
|
|
215
|
+
console.log('🚀 Quick Start:')
|
|
216
|
+
console.log(' 1. Restart your AI IDE')
|
|
217
|
+
console.log(' 2. Run /bmad-help for guidance and next step suggestions')
|
|
218
|
+
console.log(' 3. Type /bmad and use autocomplete to browse available commands')
|
|
219
|
+
console.log('')
|
|
220
|
+
console.log('💡 Common Workflows:')
|
|
221
|
+
console.log(' • /bmad-help — Interactive help')
|
|
222
|
+
console.log(' • /bmad-bmm-create-prd — Create Product Requirements Document')
|
|
223
|
+
console.log(' • /bmad-bmm-create-architecture — Create Architecture Document')
|
|
224
|
+
console.log(' • /bmad-bmm-create-epics-and-stories — Create Epics and User Stories')
|
|
225
|
+
console.log(' • /bmad-bmm-sprint-planning — Initialize Sprint Planning')
|
|
226
|
+
console.log(' • /bmad-bmm-dev-story — Implement User Story')
|
|
227
|
+
|
|
228
|
+
// Legacy V4 IDE command cleanup reminder
|
|
229
|
+
const legacyClaudeAgents = path.join(cwd, '.claude', 'commands', 'BMad', 'agents')
|
|
230
|
+
const legacyClaudeTasks = path.join(cwd, '.claude', 'commands', 'BMad', 'tasks')
|
|
231
|
+
if (fs.existsSync(legacyClaudeAgents) || fs.existsSync(legacyClaudeTasks)) {
|
|
232
|
+
console.log('')
|
|
233
|
+
console.log('⚠️ Legacy V4 IDE commands detected, consider removing manually:')
|
|
234
|
+
if (fs.existsSync(legacyClaudeAgents)) console.log(' • .claude/commands/BMad/agents/')
|
|
235
|
+
if (fs.existsSync(legacyClaudeTasks)) console.log(' • .claude/commands/BMad/tasks/')
|
|
236
|
+
console.log(' New V6 commands are installed under .claude/commands/bmad/')
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
console.error('❌ Installation failed:', error.message)
|
|
241
|
+
console.log('')
|
|
242
|
+
console.log('🛠️ Manual Installation Guide:')
|
|
243
|
+
console.log(' 1. Ensure Node.js 20+ is installed')
|
|
244
|
+
console.log(' 2. Non-interactive install:')
|
|
245
|
+
console.log(' npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yes')
|
|
246
|
+
console.log(' 3. Quick update existing installation:')
|
|
247
|
+
console.log(' npx bmad-method install --directory . --action quick-update --yes')
|
|
248
|
+
console.log(' 4. Or interactive install:')
|
|
249
|
+
console.log(' npx bmad-method install')
|
|
250
|
+
console.log('')
|
|
251
|
+
console.log('📖 Documentation:')
|
|
252
|
+
console.log(' https://bmad-code-org.github.io/BMAD-METHOD/docs/how-to/install-bmad')
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Execute initialization
|
|
257
|
+
initBmad()
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Usage
|
|
261
|
+
|
|
262
|
+
Simply type in Claude Code:
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
/bmad-init
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
This command will:
|
|
269
|
+
|
|
270
|
+
1. Detect current installation status (V6 / V4 legacy / not installed)
|
|
271
|
+
2. Fresh install: non-interactively execute `npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yes`
|
|
272
|
+
3. Existing install: execute `npx bmad-method install --directory . --action quick-update --yes`
|
|
273
|
+
4. Fix `{output_folder}` → `_bmad-output` installer bug
|
|
274
|
+
5. Automatically update `.gitignore` (clean up legacy entries, add V6 entries)
|
|
275
|
+
6. Provide next step suggestions
|