aodw-skill 0.7.25 → 0.7.26

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.
Files changed (3) hide show
  1. package/README.md +3 -2
  2. package/bin/aodw.js +59 -43
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -68,8 +68,9 @@ npx aodw-skill uninstall
68
68
  ### 安装后
69
69
 
70
70
  1. **重启编辑器**:确保 AI 工具识别新的规则文件
71
- 2. **开始使用**:您的 AI 助手现在会遵循 AODW-Next 规范工作
72
- 3. **查看文档**:`.aodw-next/01-core/aodw-constitution.md` 包含完整的工作流说明
71
+ 2. **项目深度初始化(推荐)**:`init` 结束时会输出一段提示词,复制到 AI 对话窗口执行,完善 `06-project/` 文档
72
+ 3. **开始使用**:您的 AI 助手现在会遵循 AODW-Next 规范工作
73
+ 4. **查看文档**:`.aodw-next/01-core/aodw-constitution.md` 包含完整的工作流说明
73
74
 
74
75
  ## 项目结构
75
76
 
package/bin/aodw.js CHANGED
@@ -262,11 +262,10 @@ async function runInit() {
262
262
  await saveProjectConfig({ project_name: projectName });
263
263
  }
264
264
 
265
- // --- Step 2: Fixed Local Mode (independent only) ---
265
+ // --- Step 2: Normalize legacy user config (no mode prompt) ---
266
266
  const userConfig = getUserConfig();
267
267
  if (userConfig.mode !== 'independent' || userConfig.server_url) {
268
268
  await saveUserConfig({ mode: 'independent', server_url: '' });
269
- console.log(chalk.gray('已固定为独立模式(本地生成 ID)'));
270
269
  }
271
270
 
272
271
  // --- Step 3: Platform Selection (Multi-select) ---
@@ -415,9 +414,9 @@ async function runInit() {
415
414
 
416
415
  console.log(chalk.green('\n✅ AODW-Next 初始化成功!'));
417
416
  console.log(chalk.white(`项目: ${projectName}`));
418
-
419
- console.log(chalk.white('模式: 独立模式 (本地)'));
420
417
  console.log(chalk.white(`平台: ${platforms.join(', ')}`));
418
+
419
+ await printProjectInitPrompt({ writeFile: true });
421
420
  }
422
421
 
423
422
  async function runUpdate() {
@@ -469,55 +468,70 @@ async function showHelp() {
469
468
  }
470
469
  }
471
470
 
472
- async function generateOverviewPrompt() {
473
- console.clear();
474
- console.log(chalk.bold.cyan('\n=== 项目概览初始化提示词 ===\n'));
475
- console.log(chalk.yellow('📋 请将以下提示词复制给您的 AI 助手(Cursor/Claude/Gemini 等):\n'));
476
-
471
+ function buildProjectInitPrompt() {
477
472
  const overviewFile = path.join(process.cwd(), CORE_DIRNAME, '06-project/ai-overview.md');
478
473
  const modulesIndexFile = path.join(process.cwd(), CORE_DIRNAME, '06-project/modules-index.yaml');
479
474
  const hasOverview = fs.existsSync(overviewFile);
480
475
  const hasModulesIndex = fs.existsSync(modulesIndexFile);
481
-
482
- let overviewPrompt = `请帮我${hasOverview || hasModulesIndex ? '更新' : '初始化'}项目的 AODW-Next 项目概览文档。
476
+ const action = hasOverview || hasModulesIndex ? '更新' : '初始化';
483
477
 
484
- **任务说明**:
485
- 根据当前项目的代码结构、技术栈和架构,生成或完善以下文档:
486
- 1. \`${CORE_DIRNAME}/06-project/ai-overview.md\` - 项目概览文档
487
- 2. \`${CORE_DIRNAME}/06-project/modules-index.yaml\` - 模块索引文件
478
+ return `请帮我对当前仓库执行 AODW-Next 的「项目深度初始化」(${action})。
488
479
 
489
- **文件位置**:
490
- - 项目概览文档:\`${overviewFile}\`
491
- - 模块索引文件:\`${modulesIndexFile}\`
480
+ **背景**:
481
+ CLI 已完成规则安装,并生成了检测草稿。请你基于项目真实代码,补全可被 AI 长期使用的项目知识。
492
482
 
493
- **参考规则**:
494
- - 请参考 \`${CORE_DIRNAME}/01-core/ai-project-overview-rules.md\` 中的详细规则
495
- - 需要检测项目的技术栈(前端、后端、数据库、消息系统等)
496
- - 需要识别项目的模块结构
497
- - 需要分析项目的架构模式
483
+ **必须先读取的规则**:
484
+ 1. \`${CORE_DIRNAME}/01-core/ai-project-overview-rules.md\`
485
+ 2. \`${CORE_DIRNAME}/01-core/module-doc-rules.md\`
498
486
 
499
- **执行步骤**:
500
- 1. 先读取 \`${CORE_DIRNAME}/01-core/ai-project-overview-rules.md\` 了解规则
501
- 2. ${hasOverview ? `读取现有的 \`${CORE_DIRNAME}/06-project/ai-overview.md\` 了解当前项目信息` : '分析项目结构,检测技术栈'}
502
- 3. ${hasModulesIndex ? `读取现有的 \`${CORE_DIRNAME}/06-project/modules-index.yaml\` 了解当前模块结构` : '识别项目模块'}
503
- 4. 生成或更新 \`ai-overview.md\` 和 \`modules-index.yaml\`
487
+ **必须完善的目标文件**:
488
+ 1. \`${overviewFile}\`
489
+ 2. \`${modulesIndexFile}\`
504
490
 
505
- **重要提示**:
506
- - ✅ **这些文件在更新 AODW-Next 时会被保护,不会被覆盖**
507
- - ${hasOverview ? '如果项目已经有部分概览文档,请基于现有内容进行完善' : '如果项目已经有部分概览文档,请基于现有内容进行完善'}
508
- - 确保技术栈信息准确
509
- - 确保模块索引完整
510
- - **此命令可以重复执行**,每次执行会基于现有内容进行更新和完善
491
+ **执行要求**:
492
+ 1. 扫描并理解当前项目代码结构(前端/后端/公共模块/基础设施)
493
+ 2. 识别技术栈、目录结构、核心业务模块
494
+ 3. ${hasOverview ? '在现有 ai-overview.md 基础上完善,不要无意义覆盖用户内容' : '生成 ai-overview.md(含技术栈、架构、目录、模块、系统级 invariants)'}
495
+ 4. ${hasModulesIndex ? '在现有 modules-index.yaml 基础上完善' : '生成 modules-index.yaml(模块名、root、文档路径)'}
496
+ 5. 对重要模块,如缺少模块文档,按规则补 \`docs/modules/<module>.md\`(或项目既有模块文档路径)
497
+ 6. 最后输出简短结果:修改了哪些文件、还有哪些待人工确认项
498
+
499
+ **约束**:
500
+ - 不要修改与本次初始化无关的代码
501
+ - 保持 AODW 文档结构一致
502
+ - 信息不确定时标注“待确认”,不要编造
511
503
 
512
504
  请开始执行。`;
505
+ }
513
506
 
514
- console.log(chalk.white(overviewPrompt));
515
- console.log(chalk.gray('\n' + '='.repeat(60)));
516
- console.log(chalk.green('\n✅ 提示词已生成,请复制上面的内容给您的 AI 助手。'));
517
- if (hasOverview || hasModulesIndex) {
518
- console.log(chalk.blue('\n📝 检测到已有文件,将基于现有内容进行更新。'));
507
+ async function printProjectInitPrompt(options = {}) {
508
+ const { writeFile = false, heading = true } = options;
509
+ const prompt = buildProjectInitPrompt();
510
+ const promptFile = path.join(process.cwd(), CORE_DIRNAME, '06-project/ai-init-prompt.md');
511
+
512
+ if (heading) {
513
+ console.log(chalk.cyan('\n--- 下一步:项目深度初始化(复制到 AI 对话) ---'));
514
+ console.log(chalk.gray('CLI 已完成安装与检测草稿;请让 AI 阅读真实代码后完善 06-project 文档。\n'));
519
515
  }
520
- console.log(chalk.yellow('\n💡 提示:完成项目概览初始化后,再执行"工具初始化"可以更准确地识别技术栈。\n'));
516
+
517
+ console.log(chalk.yellow('📋 请复制以下提示词到 Cursor / Claude / Antigravity:\n'));
518
+ console.log(chalk.white(prompt));
519
+
520
+ if (writeFile) {
521
+ await fs.ensureDir(path.dirname(promptFile));
522
+ await fs.writeFile(promptFile, `${prompt}\n`, 'utf8');
523
+ console.log(chalk.green(`\n💾 提示词已保存: ${path.relative(process.cwd(), promptFile)}`));
524
+ }
525
+
526
+ console.log(chalk.gray('\n' + '='.repeat(60)));
527
+ }
528
+
529
+ async function generateOverviewPrompt() {
530
+ console.clear();
531
+ console.log(chalk.bold.cyan('\n=== 项目深度初始化提示词 ===\n'));
532
+ await printProjectInitPrompt({ writeFile: true, heading: false });
533
+ console.log(chalk.green('\n✅ 请复制上面的内容给您的 AI 助手。'));
534
+ console.log(chalk.yellow('\n💡 完成后再执行工具初始化(可选):npx aodw-skill init-tools\n'));
521
535
  }
522
536
 
523
537
  async function generateToolsPrompt() {
@@ -599,8 +613,10 @@ async function showMainMenu() {
599
613
  console.log(chalk.bold.blue('=== AODW-Next CLI 管理器 ==='));
600
614
  console.log(chalk.gray('版本: ' + packageJson.version));
601
615
 
602
- // Show current config summary
603
- console.log(chalk.gray('当前配置: 🏠 独立模式 (本地生成 ID)'));
616
+ const projectConfig = getProjectConfig();
617
+ if (projectConfig.project_name) {
618
+ console.log(chalk.gray(`当前项目: ${projectConfig.project_name}`));
619
+ }
604
620
  console.log('');
605
621
 
606
622
  const { action } = await inquirer.prompt([{
@@ -613,7 +629,7 @@ async function showMainMenu() {
613
629
  { name: '1. 初始化 / 更新 AODW-Next (在本项目)', value: 'init' },
614
630
 
615
631
  new inquirer.Separator('--- 工具箱 ---'),
616
- { name: '2. 项目概览初始化 (Architecture) - 生成提示词', value: 'init-overview-prompt' },
632
+ { name: '2. 项目深度初始化 - 生成提示词', value: 'init-overview-prompt' },
617
633
  { name: '3. 工具初始化 (ESLint/Ruff/Stack) - 生成提示词', value: 'init-tools-prompt' },
618
634
 
619
635
  new inquirer.Separator('--- 帮助与维护 ---'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aodw-skill",
3
- "version": "0.7.25",
3
+ "version": "0.7.26",
4
4
  "description": "Next-channel CLI tool to scaffold AODW in your project",
5
5
  "main": "bin/aodw.js",
6
6
  "files": [