create-dwy 0.13.0 → 0.13.1

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/bin/index.js CHANGED
@@ -22,8 +22,9 @@ Examples:
22
22
  $ dwy claude sync -i 重新交互式选择
23
23
  $ dwy claude sync --dry-run 预演同步,不写入文件
24
24
  $ dwy claude sync md 仅同步 CLAUDE.md 到 ~/.claude/
25
- $ dwy codex sync 同步配置到 Codex(AGENTS.md / .agents/skills / .codex)
25
+ $ dwy codex sync 同步配置到项目(AGENTS.md / .agents/skills / .codex)
26
26
  $ dwy codex sync -i 重新交互式选择
27
+ $ dwy codex sync md 仅同步 CLAUDE.md 到 ~/.codex/AGENTS.md
27
28
  `)
28
29
 
29
30
  program
@@ -60,7 +61,7 @@ const codexCmd = program
60
61
 
61
62
  codexCmd
62
63
  .command('sync [target]')
63
- .description('同步配置到项目(rules→AGENTS.md / skills→.agents/skills / hooks→.codex)')
64
+ .description('同步配置到项目(rules→AGENTS.md / skills→.agents/skills / hooks→.codex;target=md 时仅同步 CLAUDE.md 到 ~/.codex/AGENTS.md)')
64
65
  .option('-i, --reselect', '忽略已选缓存,重新交互式选择(已选项默认勾选)')
65
66
  .option('--dry-run', '预演模式,不实际写入文件')
66
67
  .action((target, opts) => syncCodex({ target, ...opts }))
@@ -69,6 +70,7 @@ Examples:
69
70
  $ dwy codex sync 基于已选覆盖同步
70
71
  $ dwy codex sync -i 重新交互式选择
71
72
  $ dwy codex sync --dry-run 预演,不写入文件
73
+ $ dwy codex sync md 仅同步 CLAUDE.md 到 ~/.codex/AGENTS.md
72
74
  `)
73
75
 
74
76
  program.parse()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-dwy",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "项目脚手架与 Claude Code 配置同步工具",
5
5
  "type": "module",
6
6
  "bin": {
package/src/sync-codex.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import fs from 'fs-extra'
2
2
  import path from 'path'
3
+ import os from 'os'
3
4
  import inquirer from 'inquirer'
4
5
  import { chalk } from './utils.js'
5
6
  import { groupedCheckbox } from './prompts/grouped-checkbox.js'
@@ -253,10 +254,9 @@ async function interactiveSelect(scans, existing) {
253
254
  // ---------- 入口 ----------
254
255
 
255
256
  /**
256
- * 入口:`dwy codex sync`
257
- * rules → 项目根 AGENTS.md(DWY-RULES 托管块)
258
- * skills → 项目 .agents/skills/<name>/
259
- * hooks → 项目 .codex/hooks/ + .codex/hooks.json
257
+ * 入口:`dwy codex sync [target]`
258
+ * target=undefined 同步到项目:rules→AGENTS.md / skills→.agents/skills / hooks→.codex
259
+ * target='md' 仅同步 CLAUDE.md → 全局 ~/.codex/AGENTS.md
260
260
  */
261
261
  export async function syncCodex({ target, reselect = false, dryRun = false } = {}) {
262
262
  const claudeGlobal = await resolveSourceDir()
@@ -264,8 +264,26 @@ export async function syncCodex({ target, reselect = false, dryRun = false } = {
264
264
  console.error(chalk.red('Error: claude-global templates not found in repo'))
265
265
  process.exit(1)
266
266
  }
267
+
268
+ if (target === 'md') {
269
+ const src = path.join(claudeGlobal, 'CLAUDE.md')
270
+ if (!await fs.pathExists(src)) {
271
+ console.log(chalk.yellow('CLAUDE.md not found in templates, nothing to sync.'))
272
+ return
273
+ }
274
+ const dest = path.join(os.homedir(), '.codex', 'AGENTS.md')
275
+ console.log(chalk.blue(`\nSyncing CLAUDE.md → ${dest}...\n`))
276
+ if (!dryRun) {
277
+ await fs.ensureDir(path.dirname(dest))
278
+ await fs.copy(src, dest, { overwrite: true })
279
+ }
280
+ logAction(dryRun, dest)
281
+ console.log(chalk.blue(`\n${dryRun ? 'Dry-run complete.' : 'Done.'}`))
282
+ return
283
+ }
284
+
267
285
  if (target !== undefined) {
268
- console.error(chalk.red(`Error: unknown sync target "${target}". codex sync 不接受参数`))
286
+ console.error(chalk.red(`Error: unknown sync target "${target}". Supported: (none) | md`))
269
287
  process.exit(2)
270
288
  }
271
289