dw-kit 1.0.2 → 1.2.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 CHANGED
@@ -1,139 +1,119 @@
1
- # dw-kit
2
-
3
- > An AI development workflow toolkit for teams using agentic IDEs (Claude Code, Cursor) — from idea to review-ready commits.
4
-
5
- **v1.0** · `npm install -g dw-kit` · [Docs](docs/README.md) · [Get started](docs/get-started.md) · [Cheatsheet](docs/cheatsheet.md)
6
-
7
- ---
8
-
9
- ## What is dw-kit?
10
-
11
- dw-kit helps your team run AI-assisted development with a **repeatable workflow** and clear checkpoints:
12
-
13
- ```
14
- Initialize → Understand → Plan → Execute (TDD) → Verify → Close
15
- ```
16
-
17
- ```mermaid
18
- %%{init: {'flowchart': {'nodeSpacing': 10, 'rankSpacing': 18}}}%%
19
- flowchart LR
20
- classDef extra fill:#f3f4f6,stroke:#9ca3af,stroke-width:1px,color:#111;
21
-
22
- D["Init + Understand"] --> P["Plan (approve)"]
23
- P -->|approved| E["Execute (TDD)"]
24
- P -->|revise| P
25
-
26
- E --> V["Verify (gates)"]
27
- V -->|sign-off| C["Close (handoff + archive)"]
28
- V -->|"revise (fix)"| E
29
-
30
- subgraph Extra["Depth=thorough"]
31
- R[Req] --> Est[Est] --> AR[Arch] --> P
32
- P -.-> TP[Test] -.-> E
33
- E -.-> DU[Docs] --> LW[Log] -.-> C
34
- end
35
-
36
- class R,Est,AR,TP,DU,LW extra
37
- ```
38
-
39
- ## Workflow overview
40
-
41
- `dw` runs a 6-phase process (all phases for `standard` and `thorough`):
42
-
43
- Initialize → Understand → Plan (stops for approval) → Execute (TDD; 1 commit per subtask) → Verify (quality gates + review sign-off) → Close (handoff + archive when done).
44
-
45
- ### 6 phases (full workflow)
46
- - **Initialize**: clarify task scope and set up the workspace + task docs.
47
- - **Understand**: survey the codebase, dependencies, patterns, and test coverage (no implementation).
48
- - **Plan**: design the solution and subtasks; **pause for your approval**.
49
- - **Execute**: implement using **TDD**; each subtask produces a commit.
50
- - **Verify**: run quality gates + review sign-off to ensure correctness and safety.
51
- - **Close**: handoff notes, finalize progress, and archive when done.
52
-
53
- It’s designed for collaboration (Dev / Tech Lead / QA / PM) and keeps work auditable via lightweight task docs.
54
-
55
- ---
56
-
57
- ## Install
58
-
59
- ```bash
60
- npm install -g dw-kit
61
- ```
62
-
63
- ---
64
-
65
- ## Quick start
66
-
67
- Setup dw in project directory:
68
-
69
- ```bash
70
- dw init
71
- ```
72
-
73
- Then in **Claude Code CLI**, run the full workflow:
74
-
75
- ```
76
- /dw-flow your-task-or-anythings
77
- ```
78
-
79
- ---
80
-
81
- Discover other skills:
82
-
83
- ```
84
- /dw-prompt
85
- /dw-thinking
86
- ...
87
-
88
- ```
89
-
90
- ---
91
-
92
- ## CLI commands
93
-
94
- ```bash
95
- dw init # setup wizard / presets
96
- dw validate # validate .dw/config/dw.config.yml
97
- dw doctor # installation health check
98
- dw upgrade # update toolkit files (override-aware)
99
- dw upgrade --check # check for updates only
100
- dw upgrade --dry-run # preview changes
101
- dw prompt # build a well-structured task prompt (autocomplete + wizard)
102
- dw prompt --text "..." # non-interactive: structure a description directly
103
- dw claude-vn-fix # patch Claude CLI to fix Vietnamese IME (backup/restore)
104
- ```
105
-
106
- `dw claude-vn-fix` patches the local Claude CLI bundle to fix Vietnamese IME input (DEL char `\x7f` issue). Includes auto-backup and rollback.
107
-
108
- ---
109
-
110
- ## Depth system
111
-
112
- Pick a default depth for your project, then override per task when risk increases.
113
-
114
- | Depth | Best for | Workflow |
115
- |-------|----------|----------|
116
- | `quick` | Solo dev, hotfix, familiar code | Understand → Execute → Close |
117
- | `standard` | Small teams, new features | Full 6 phases |
118
- | `thorough` | Risky changes (API/DB/security) | Full workflow + arch-review + test-plan |
119
-
120
- Configured in `.dw/config/dw.config.yml`:
121
-
122
- ```yaml
123
- workflow:
124
- default_depth: "standard"
125
- ```
126
-
127
- ---
128
-
129
- ## What gets added to your repo?
130
-
131
- ```
132
- .dw/ # methodology, config, adapters, task docs
133
- .claude/ # Claude Code: skills, hooks, agents, rules
134
- CLAUDE.md # project context for the agent
135
- ```
136
-
137
- ---
138
-
139
- Maintainer: [huygdv](mailto:huygdv19@gmail.com)
1
+ # dw-kit
2
+
3
+ > An AI development workflow toolkit for teams using agentic IDEs (Claude Code, Cursor) — from idea to review-ready commits.
4
+
5
+ **v1.2** · `npm install -g dw-kit` · [Docs](docs/README.md) · [Get started](docs/get-started.md) · [Cheatsheet](docs/cheatsheet.md)
6
+
7
+ ---
8
+
9
+ ## What is dw-kit?
10
+
11
+ dw-kit helps your team run AI-assisted development with a **repeatable workflow** and clear checkpoints:
12
+
13
+ ```
14
+ Initialize → Understand → Plan → Execute (TDD) → Verify → Close
15
+ ```
16
+
17
+ <img src="docs/workflow-diagram.svg" alt="dw-kit workflow diagram" />
18
+
19
+ ## Workflow overview
20
+
21
+ `dw` runs a 6-phase process (all phases for `standard` and `thorough`):
22
+
23
+ Initialize Understand → Plan (stops for approval) → Execute (TDD; 1 commit per subtask) → Verify (quality gates + review sign-off) → Close (handoff + archive when done).
24
+
25
+ ### 6 phases (full workflow)
26
+ - **Initialize**: clarify task scope and set up the workspace + task docs.
27
+ - **Understand**: survey the codebase, dependencies, patterns, and test coverage (no implementation).
28
+ - **Plan**: design the solution and subtasks; **pause for your approval**.
29
+ - **Execute**: implement using **TDD**; each subtask produces a commit.
30
+ - **Verify**: run quality gates + review sign-off to ensure correctness and safety.
31
+ - **Close**: handoff notes, finalize progress, and archive when done.
32
+
33
+ It’s designed for collaboration (Dev / Tech Lead / QA / PM) and keeps work auditable via lightweight task docs.
34
+
35
+ ---
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ npm install -g dw-kit
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Quick start
46
+
47
+ Setup dw in project directory:
48
+
49
+ ```bash
50
+ dw init
51
+ ```
52
+
53
+ Then in **Claude Code CLI**, run the full workflow:
54
+
55
+ ```
56
+ /dw-flow your-task-or-anythings
57
+ ```
58
+
59
+ ---
60
+
61
+ Discover other skills:
62
+
63
+ ```
64
+ /dw-prompt
65
+ /dw-thinking
66
+ ...
67
+
68
+ ```
69
+
70
+ ---
71
+
72
+ ## CLI commands
73
+
74
+ ```bash
75
+ dw init # setup wizard / presets
76
+ dw validate # validate .dw/config/dw.config.yml
77
+ dw doctor # installation health check
78
+ dw upgrade # update toolkit files (override-aware)
79
+ dw upgrade --check # check for updates only
80
+ dw upgrade --dry-run # preview changes
81
+ dw prompt # build a well-structured task prompt (autocomplete + wizard)
82
+ dw prompt --text "..." # non-interactive: structure a description directly
83
+ dw claude-vn-fix # patch Claude CLI to fix Vietnamese IME (backup/restore)
84
+ ```
85
+
86
+ `dw claude-vn-fix` patches the local Claude CLI bundle to fix Vietnamese IME input (DEL char `\x7f` issue). Includes auto-backup and rollback.
87
+
88
+ ---
89
+
90
+ ## Depth system
91
+
92
+ Pick a default depth for your project, then override per task when risk increases.
93
+
94
+ | Depth | Best for | Workflow |
95
+ |-------|----------|----------|
96
+ | `quick` | Solo dev, hotfix, familiar code | Understand → Execute → Close |
97
+ | `standard` | Small teams, new features | Full 6 phases |
98
+ | `thorough` | Risky changes (API/DB/security) | Full workflow + arch-review + test-plan |
99
+
100
+ Configured in `.dw/config/dw.config.yml`:
101
+
102
+ ```yaml
103
+ workflow:
104
+ default_depth: "standard"
105
+ ```
106
+
107
+ ---
108
+
109
+ ## What gets added to your repo?
110
+
111
+ ```
112
+ .dw/ # methodology, config, adapters, task docs
113
+ .claude/ # Claude Code: skills, hooks, agents, rules
114
+ CLAUDE.md # project context for the agent
115
+ ```
116
+
117
+ ---
118
+
119
+ Maintainer: [huygdv](mailto:huygdv19@gmail.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dw-kit",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "description": "AI development workflow toolkit — structured, quality-assured, team-ready. From requirements to dashboard.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,12 +8,44 @@
8
8
  },
9
9
  "files": [
10
10
  "bin/",
11
- "src/",
11
+ "src/cli.mjs",
12
+ "src/commands/",
13
+ "src/lib/",
12
14
  ".dw/core/",
13
15
  ".dw/config/",
14
16
  ".dw/adapters/",
15
- "scripts/",
16
- ".claude/",
17
+ ".claude/agents/",
18
+ ".claude/hooks/",
19
+ ".claude/rules/",
20
+ ".claude/skills/dw-arch-review/",
21
+ ".claude/skills/dw-archive/",
22
+ ".claude/skills/dw-commit/",
23
+ ".claude/skills/dw-config-init/",
24
+ ".claude/skills/dw-config-validate/",
25
+ ".claude/skills/dw-dashboard/",
26
+ ".claude/skills/dw-debug/",
27
+ ".claude/skills/dw-docs-update/",
28
+ ".claude/skills/dw-estimate/",
29
+ ".claude/skills/dw-execute/",
30
+ ".claude/skills/dw-flow/",
31
+ ".claude/skills/dw-handoff/",
32
+ ".claude/skills/dw-kit-report/",
33
+ ".claude/skills/dw-log-work/",
34
+ ".claude/skills/dw-onboard/",
35
+ ".claude/skills/dw-plan/",
36
+ ".claude/skills/dw-prompt/",
37
+ ".claude/skills/dw-requirements/",
38
+ ".claude/skills/dw-research/",
39
+ ".claude/skills/dw-retroactive/",
40
+ ".claude/skills/dw-review/",
41
+ ".claude/skills/dw-rollback/",
42
+ ".claude/skills/dw-sprint-review/",
43
+ ".claude/skills/dw-task-init/",
44
+ ".claude/skills/dw-test-plan/",
45
+ ".claude/skills/dw-thinking/",
46
+ ".claude/skills/dw-upgrade/",
47
+ ".claude/templates/",
48
+ ".claude/settings.json",
17
49
  "CLAUDE.md"
18
50
  ],
19
51
  "engines": {
package/src/cli.mjs CHANGED
@@ -1,92 +1,92 @@
1
- import { Command } from 'commander';
2
- import { createRequire } from 'node:module';
3
- import { fileURLToPath } from 'node:url';
4
- import { dirname, join } from 'node:path';
5
- import chalk from 'chalk';
6
- import { getUpdateNotice, scheduleUpdateCheck } from './lib/update-checker.mjs';
7
-
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = dirname(__filename);
10
- const require = createRequire(import.meta.url);
11
- const pkg = require(join(__dirname, '..', 'package.json'));
12
-
13
- export function run(argv) {
14
- // Show cached update notice (non-blocking), then schedule fresh check in background
15
- const latestVersion = getUpdateNotice(pkg.version);
16
- scheduleUpdateCheck(pkg.version);
17
-
18
- const program = new Command();
19
-
20
- program
21
- .name('dw')
22
- .description('dw-kit — AI development workflow toolkit')
23
- .version(pkg.version, '-v, --version');
24
-
25
- program
26
- .command('init')
27
- .description('Setup dw-kit in current project (interactive wizard)')
28
- .option('-p, --preset <name>', 'Use preset: solo-quick | small-team | enterprise')
29
- .option('-a, --adapter <platform>', 'Target platform: claude-cli | cursor | generic', 'claude-cli')
30
- .option('-s, --silent', 'Non-interactive mode (reads DW_NAME, DW_DEPTH, DW_ROLES, DW_LANG env vars)')
31
- .action(async (opts) => {
32
- const { initCommand } = await import('./commands/init.mjs');
33
- await initCommand(opts);
34
- });
35
-
36
- program
37
- .command('upgrade')
38
- .description('Update dw-kit files in current project')
39
- .option('-n, --dry-run', 'Preview changes without applying')
40
- .option('-c, --check', 'Only check if update is available')
41
- .option('-l, --layer <name>', 'Update specific layer: core | platform | capability | all', 'all')
42
- .action(async (opts) => {
43
- const { upgradeCommand } = await import('./commands/upgrade.mjs');
44
- await upgradeCommand(opts);
45
- });
46
-
47
- program
48
- .command('validate')
49
- .description('Validate .dw/config/dw.config.yml against schema')
50
- .option('-f, --file <path>', 'Config file path', '.dw/config/dw.config.yml')
51
- .action(async (opts) => {
52
- const { validateCommand } = await import('./commands/validate.mjs');
53
- await validateCommand(opts);
54
- });
55
-
56
- program
57
- .command('doctor')
58
- .description('Check dw-kit installation health')
59
- .action(async () => {
60
- const { doctorCommand } = await import('./commands/doctor.mjs');
61
- await doctorCommand();
62
- });
63
-
64
- program
65
- .command('prompt')
66
- .description('Build a well-structured task prompt with autocomplete + guided wizard')
67
- .option('-t, --text <text>', 'Non-interactive: provide description directly')
68
- .action(async (opts) => {
69
- const { promptCommand } = await import('./commands/prompt.mjs');
70
- await promptCommand(opts);
71
- });
72
-
73
- program
74
- .command('claude-vn-fix')
75
- .description('Patch Claude CLI to fix Vietnamese IME (local, with backup/restore)')
76
- .option('--path <file>', 'Path to @anthropic-ai/claude-code/cli.js (optional; auto-detect if omitted)')
77
- .option('--restore', 'Restore from latest backup')
78
- .option('--dry-run', 'Show what would change without writing')
79
- .action(async (opts) => {
80
- const { claudeVnFixCommand } = await import('./commands/claude-vn-fix.mjs');
81
- await claudeVnFixCommand(opts);
82
- });
83
-
84
- program.parse(argv);
85
-
86
- if (latestVersion) {
87
- console.log();
88
- console.log(chalk.yellow(` ↑ Update available`) + ` v${pkg.version} → ` + chalk.green.bold(`v${latestVersion}`));
89
- console.log(` Run ` + chalk.cyan(`npm install -g dw-kit`) + ` to update`);
90
- console.log();
91
- }
92
- }
1
+ import { Command } from 'commander';
2
+ import { createRequire } from 'node:module';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { dirname, join } from 'node:path';
5
+ import chalk from 'chalk';
6
+ import { getUpdateNotice, scheduleUpdateCheck } from './lib/update-checker.mjs';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
10
+ const require = createRequire(import.meta.url);
11
+ const pkg = require(join(__dirname, '..', 'package.json'));
12
+
13
+ export function run(argv) {
14
+ // Show cached update notice (non-blocking), then schedule fresh check in background
15
+ const latestVersion = getUpdateNotice(pkg.version);
16
+ scheduleUpdateCheck(pkg.version);
17
+
18
+ const program = new Command();
19
+
20
+ program
21
+ .name('dw')
22
+ .description('dw-kit — AI development workflow toolkit')
23
+ .version(pkg.version, '-v, --version');
24
+
25
+ program
26
+ .command('init')
27
+ .description('Setup dw-kit in current project (interactive wizard)')
28
+ .option('-p, --preset <name>', 'Use preset: solo-quick | small-team | enterprise')
29
+ .option('-a, --adapter <platform>', 'Target platform: claude-cli | cursor | generic', 'claude-cli')
30
+ .option('-s, --silent', 'Non-interactive mode (reads DW_NAME, DW_DEPTH, DW_ROLES, DW_LANG env vars)')
31
+ .action(async (opts) => {
32
+ const { initCommand } = await import('./commands/init.mjs');
33
+ await initCommand(opts);
34
+ });
35
+
36
+ program
37
+ .command('upgrade')
38
+ .description('Update dw-kit files in current project')
39
+ .option('-n, --dry-run', 'Preview changes without applying')
40
+ .option('-c, --check', 'Only check if update is available')
41
+ .option('-l, --layer <name>', 'Update specific layer: core | platform | capability | all', 'all')
42
+ .action(async (opts) => {
43
+ const { upgradeCommand } = await import('./commands/upgrade.mjs');
44
+ await upgradeCommand(opts);
45
+ });
46
+
47
+ program
48
+ .command('validate')
49
+ .description('Validate .dw/config/dw.config.yml against schema')
50
+ .option('-f, --file <path>', 'Config file path', '.dw/config/dw.config.yml')
51
+ .action(async (opts) => {
52
+ const { validateCommand } = await import('./commands/validate.mjs');
53
+ await validateCommand(opts);
54
+ });
55
+
56
+ program
57
+ .command('doctor')
58
+ .description('Check dw-kit installation health')
59
+ .action(async () => {
60
+ const { doctorCommand } = await import('./commands/doctor.mjs');
61
+ await doctorCommand();
62
+ });
63
+
64
+ program
65
+ .command('prompt')
66
+ .description('Build a well-structured task prompt with autocomplete + guided wizard')
67
+ .option('-t, --text <text>', 'Non-interactive: provide description directly')
68
+ .action(async (opts) => {
69
+ const { promptCommand } = await import('./commands/prompt.mjs');
70
+ await promptCommand(opts);
71
+ });
72
+
73
+ program
74
+ .command('claude-vn-fix')
75
+ .description('Patch Claude CLI to fix Vietnamese IME (local, with backup/restore)')
76
+ .option('--path <file>', 'Path to @anthropic-ai/claude-code/cli.js (optional; auto-detect if omitted)')
77
+ .option('--restore', 'Restore from latest backup')
78
+ .option('--dry-run', 'Show what would change without writing')
79
+ .action(async (opts) => {
80
+ const { claudeVnFixCommand } = await import('./commands/claude-vn-fix.mjs');
81
+ await claudeVnFixCommand(opts);
82
+ });
83
+
84
+ program.parse(argv);
85
+
86
+ if (latestVersion) {
87
+ console.log();
88
+ console.log(chalk.yellow(` ↑ Update available`) + ` v${pkg.version} → ` + chalk.green.bold(`v${latestVersion}`));
89
+ console.log(` Run ` + chalk.cyan(`npm install -g dw-kit`) + ` to update`);
90
+ console.log();
91
+ }
92
+ }
@@ -135,7 +135,7 @@ async function setupProject(projectDir, { projectName, depth, roles, language, a
135
135
 
136
136
  if (adapter === 'claude-cli') {
137
137
  copyClaudeFiles(projectDir);
138
- copyCLAUDEmd(projectDir);
138
+ createMinimalCLAUDEmd(projectDir, projectName);
139
139
  } else if (adapter === 'cursor') {
140
140
  copyCursorFiles(projectDir);
141
141
  copyGenericAdapter(projectDir);
@@ -191,34 +191,34 @@ function copyClaudeFiles(projectDir) {
191
191
  if (skipCount > 0) log(` ${skipCount} existing files preserved`);
192
192
  }
193
193
 
194
- function copyCLAUDEmd(projectDir) {
195
- const src = join(TOOLKIT_ROOT, 'CLAUDE.md');
194
+ function createMinimalCLAUDEmd(projectDir, projectName) {
196
195
  const dst = join(projectDir, 'CLAUDE.md');
197
196
 
198
197
  if (existsSync(dst)) {
199
- warn('CLAUDE.md already exists skipping (review manually if needed)');
198
+ // User already has their own CLAUDE.md — leave it completely alone
200
199
  return;
201
200
  }
202
201
 
203
- copyFile(src, dst);
202
+ const content = `# ${projectName}
203
+
204
+ > Add your project description here.
204
205
 
205
- const techStackSection = `
206
206
  ---
207
207
 
208
208
  ## Tech Stack
209
209
 
210
210
  <!-- Update with your project's actual stack -->
211
- - Framework: [e.g. NestJS / Django / Laravel / Next.js]
212
- - Database: [e.g. PostgreSQL / MySQL / MongoDB]
213
- - Testing: [e.g. Jest / Pytest / PHPUnit]
211
+ - Framework:
212
+ - Database:
213
+ - Testing:
214
214
 
215
215
  ## Project-Specific Rules
216
216
 
217
- <!-- Add project-specific rules -->
218
- - [Rule 1]
217
+ <!-- Add project-specific rules here -->
218
+ <!-- dw workflow rules are auto-loaded from .claude/rules/ -->
219
219
  `;
220
- appendFileSync(dst, techStackSection, 'utf-8');
221
- ok('CLAUDE.md (with Tech Stack template section)');
220
+ writeFileSync(dst, content, 'utf-8');
221
+ ok('CLAUDE.md (minimal project template — dw rules are in .claude/rules/)');
222
222
  }
223
223
 
224
224
  function copyCursorFiles(projectDir) {
@@ -276,7 +276,7 @@ function createRuntimeDirs(projectDir) {
276
276
 
277
277
  function updateGitignore(projectDir) {
278
278
  const gitignorePath = join(projectDir, '.gitignore');
279
- const entriesToAdd = ['.dw/metrics/', '.dw/reports/', 'CLAUDE.local.md'];
279
+ const entriesToAdd = ['CLAUDE.local.md', '.claude/settings.local.json', '.dw/config/dw.config.local.yml'];
280
280
 
281
281
  if (existsSync(gitignorePath)) {
282
282
  const content = readFileSync(gitignorePath, 'utf-8');
@@ -304,8 +304,8 @@ function printSummary({ projectName, depth, roles, language, adapter }) {
304
304
  console.log(` Files created:`);
305
305
  console.log(` .dw/ — core/, config/, adapters/, tasks, docs`);
306
306
  if (adapter === 'claude-cli') {
307
- console.log(` .claude/ — skills, agents, hooks, rules`);
308
- console.log(` CLAUDE.md`);
307
+ console.log(` .claude/ — skills, agents, hooks, rules/`);
308
+ console.log(` CLAUDE.md — minimal project template (dw rules in .claude/rules/)`);
309
309
  } else if (adapter === 'cursor') {
310
310
  console.log(` .cursor/rules/ — workflow rules for Cursor`);
311
311
  console.log(` AGENT.md — methodology reference`);
@@ -317,7 +317,7 @@ function printSummary({ projectName, depth, roles, language, adapter }) {
317
317
  console.log(` Next steps:`);
318
318
  console.log(` Run: claude (to open Claude Code in this directory in terminal)`);
319
319
  console.log(` Run: /dw-flow [task-name]`);
320
- console.log(` Suggested: Update Tech Stack in CLAUDE.md (optional, recommended)`);
320
+ console.log(` Suggested: Update Tech Stack + rules in CLAUDE.md`);
321
321
  } else if (adapter === 'cursor') {
322
322
  console.log(` Next steps:`);
323
323
  console.log(` 1. Open Cursor in this directory`);
@@ -1,14 +1,12 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { load as yamlLoad } from 'js-yaml';
4
1
  import { header, info, ok, warn, err, log } from '../lib/ui.mjs';
5
2
  import { copyToClipboard } from '../lib/clipboard.mjs';
6
3
  import { getSuggestions, isVague, expandTemplate } from '../lib/prompt-suggest.mjs';
4
+ import { detectPlatform } from '../lib/platform.mjs';
7
5
 
8
6
  export async function promptCommand(opts) {
9
7
  header('dw-kit Prompt Builder');
10
8
 
11
- const adapter = readAdapter();
9
+ const adapter = detectPlatform(process.cwd());
12
10
 
13
11
  // Non-interactive mode: --text <text>
14
12
  if (opts.text !== undefined) {
@@ -112,14 +110,3 @@ function outputResult(text, adapter) {
112
110
  info('(generic adapter — copy the text above manually)');
113
111
  }
114
112
  }
115
-
116
- function readAdapter() {
117
- const configPath = join(process.cwd(), '.dw', 'config', 'dw.config.yml');
118
- if (!existsSync(configPath)) return 'claude-cli';
119
- try {
120
- const config = yamlLoad(readFileSync(configPath, 'utf-8'));
121
- return config?.adapter || 'claude-cli';
122
- } catch {
123
- return 'claude-cli';
124
- }
125
- }
@@ -7,6 +7,35 @@ export function loadConfig(configPath) {
7
7
  return yaml.load(content);
8
8
  }
9
9
 
10
+ /**
11
+ * Load config với local override (v1.2+).
12
+ * dw.config.yml — shared, committed
13
+ * dw.config.local.yml — machine-specific, gitignored
14
+ * Local values win over base values (shallow merge per top-level key).
15
+ */
16
+ export function loadConfigWithLocal(configDir) {
17
+ const basePath = `${configDir}/dw.config.yml`;
18
+ const localPath = `${configDir}/dw.config.local.yml`;
19
+
20
+ const base = loadConfig(basePath);
21
+ if (!base) return null;
22
+
23
+ if (!existsSync(localPath)) return base;
24
+
25
+ const local = loadConfig(localPath);
26
+ if (!local) return base;
27
+
28
+ const merged = { ...base };
29
+ for (const key of Object.keys(local)) {
30
+ if (typeof local[key] === 'object' && !Array.isArray(local[key]) && local[key] !== null) {
31
+ merged[key] = { ...(merged[key] || {}), ...local[key] };
32
+ } else {
33
+ merged[key] = local[key];
34
+ }
35
+ }
36
+ return merged;
37
+ }
38
+
10
39
  export function writeConfig(configPath, data) {
11
40
  const content = yaml.dump(data, {
12
41
  indent: 2,
@@ -57,9 +86,9 @@ export function buildConfig({ projectName, language, depth, roles }) {
57
86
  mcp: [],
58
87
  },
59
88
  _toolkit: {
60
- core_version: '1.0',
89
+ core_version: '1.2',
61
90
  platform_version: '1.0',
62
- capability_version: '1.0',
91
+ capability_version: '1.2',
63
92
  installed: today,
64
93
  last_upgrade: today,
65
94
  },