aodw-skill 0.7.9 → 0.7.11
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/aodw.js +46 -26
- package/package.json +1 -1
package/bin/aodw.js
CHANGED
|
@@ -53,14 +53,34 @@ const GEMINI_RULE_FILES = [
|
|
|
53
53
|
];
|
|
54
54
|
|
|
55
55
|
// Define source paths (Next version - fixed paths)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
56
|
+
// Support both development (from source) and production (from npm package) environments
|
|
57
|
+
function getSourcePaths() {
|
|
58
|
+
const packageRoot = path.join(__dirname, '..'); // cli/ or node_modules/aodw-skill/
|
|
59
|
+
|
|
60
|
+
// Try npm package paths first (production)
|
|
61
|
+
const npmCore = path.join(packageRoot, '.aodw-next');
|
|
62
|
+
const npmAdapters = path.join(packageRoot, 'AODW_Adapters');
|
|
63
|
+
const npmDocs = path.join(packageRoot, 'docs');
|
|
64
|
+
|
|
65
|
+
// Try development paths (from source)
|
|
66
|
+
const devCore = path.join(packageRoot, '../templates/.aodw-next');
|
|
67
|
+
const devAdapters = path.join(packageRoot, '../templates/AODW_Adapters');
|
|
68
|
+
const devDocs = path.join(packageRoot, '../templates/docs');
|
|
69
|
+
|
|
70
|
+
// Use npm package paths if they exist, otherwise use development paths
|
|
71
|
+
const SOURCE_CORE = fs.existsSync(npmCore) ? npmCore : devCore;
|
|
72
|
+
const SOURCE_ADAPTERS = fs.existsSync(npmAdapters) ? npmAdapters : devAdapters;
|
|
73
|
+
const SOURCE_DOCS = fs.existsSync(npmDocs) ? npmDocs : devDocs;
|
|
74
|
+
|
|
75
|
+
return { SOURCE_CORE, SOURCE_ADAPTERS, SOURCE_DOCS };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const { SOURCE_CORE, SOURCE_ADAPTERS, SOURCE_DOCS } = getSourcePaths();
|
|
59
79
|
const SOURCE_TEMPLATE = path.join(SOURCE_CORE, 'templates/aodw-kernel-loader-template.md');
|
|
60
80
|
|
|
61
81
|
program
|
|
62
82
|
.version(packageJson.version)
|
|
63
|
-
.description('Initialize AODW in your project');
|
|
83
|
+
.description('Initialize AODW-Next in your project');
|
|
64
84
|
|
|
65
85
|
// Helper: Install file with processor
|
|
66
86
|
async function installFile(source, target, processorClass = BaseProcessor) {
|
|
@@ -72,7 +92,7 @@ async function installFile(source, target, processorClass = BaseProcessor) {
|
|
|
72
92
|
async function copyRecursive(sourceDir, targetDir, processorClass, renameFn = null) {
|
|
73
93
|
// Files to exclude from distribution (maintainer-only tools)
|
|
74
94
|
const excludeFiles = [
|
|
75
|
-
'aodw-governance.md', // AODW 治理检查(仅维护者)
|
|
95
|
+
'aodw-governance.md', // AODW-Next 治理检查(仅维护者)
|
|
76
96
|
'aodw-init.md' // 初始化(CLI 已处理)
|
|
77
97
|
];
|
|
78
98
|
|
|
@@ -125,7 +145,7 @@ async function isTemplateFile(filePath) {
|
|
|
125
145
|
// Template has empty tech stack sections like "- 前端:\n- 后端:"
|
|
126
146
|
const hasEmptyTechStack = /- 前端:\s*\n\s*- 后端:/.test(content);
|
|
127
147
|
// Template has placeholder text
|
|
128
|
-
const hasPlaceholder = /(由 AI 或人工在首次接入 AODW 时填写/.test(content);
|
|
148
|
+
const hasPlaceholder = /(由 AI 或人工在首次接入 AODW-Next 时填写/.test(content);
|
|
129
149
|
return hasEmptyTechStack || hasPlaceholder;
|
|
130
150
|
}
|
|
131
151
|
|
|
@@ -222,13 +242,13 @@ async function checkServerHealth(url) {
|
|
|
222
242
|
}
|
|
223
243
|
|
|
224
244
|
async function runInit() {
|
|
225
|
-
console.log(chalk.blue('🚀 正在初始化 AODW...'));
|
|
245
|
+
console.log(chalk.blue('🚀 正在初始化 AODW-Next...'));
|
|
226
246
|
|
|
227
|
-
// --- Safeguard: Prevent running in AODW Source Repo ---
|
|
247
|
+
// --- Safeguard: Prevent running in AODW-Next Source Repo ---
|
|
228
248
|
if (fs.existsSync(path.join(process.cwd(), 'cli/bin/aodw.js')) &&
|
|
229
249
|
(fs.existsSync(path.join(process.cwd(), 'templates/.aodw')) ||
|
|
230
250
|
fs.existsSync(path.join(process.cwd(), 'templates/.aodw-next')))) {
|
|
231
|
-
console.log(chalk.red('\n🛑 严重错误: 您正在 AODW 源码仓库中运行 "aodw init"!'));
|
|
251
|
+
console.log(chalk.red('\n🛑 严重错误: 您正在 AODW-Next 源码仓库中运行 "aodw-skill init"!'));
|
|
232
252
|
console.log(chalk.yellow(' 这将导致开发模板覆盖源文件。'));
|
|
233
253
|
console.log(chalk.yellow(' 如需更新模板,请使用: cd cli && ./build-local.sh'));
|
|
234
254
|
return;
|
|
@@ -438,7 +458,7 @@ async function runInit() {
|
|
|
438
458
|
}
|
|
439
459
|
}
|
|
440
460
|
|
|
441
|
-
console.log(chalk.green('\n✅ AODW
|
|
461
|
+
console.log(chalk.green('\n✅ AODW-Next 初始化成功!'));
|
|
442
462
|
console.log(chalk.white(`项目: ${projectName}`));
|
|
443
463
|
|
|
444
464
|
const updatedConfig = getUserConfig();
|
|
@@ -450,7 +470,7 @@ async function runInit() {
|
|
|
450
470
|
}
|
|
451
471
|
|
|
452
472
|
async function runUpdate() {
|
|
453
|
-
console.log(chalk.blue('🔄 正在更新 AODW...'));
|
|
473
|
+
console.log(chalk.blue('🔄 正在更新 AODW-Next...'));
|
|
454
474
|
await runInit();
|
|
455
475
|
}
|
|
456
476
|
|
|
@@ -459,7 +479,7 @@ async function runUninstall() {
|
|
|
459
479
|
{
|
|
460
480
|
type: 'confirm',
|
|
461
481
|
name: 'confirm',
|
|
462
|
-
message: `确定要卸载 AODW
|
|
482
|
+
message: `确定要卸载 AODW-Next 吗? 这将删除 ${CORE_DIRNAME} 目录(包含 ui-kit)。`,
|
|
463
483
|
default: false
|
|
464
484
|
}
|
|
465
485
|
]);
|
|
@@ -493,7 +513,7 @@ async function runUninstall() {
|
|
|
493
513
|
await removeIfExists(path.join(cwd, CORE_DIRNAME, 'AGENTS.md'));
|
|
494
514
|
await removeIfExists(path.join(cwd, '.github', 'copilot-instructions.md'));
|
|
495
515
|
|
|
496
|
-
console.log(chalk.green('✅ AODW 已卸载。'));
|
|
516
|
+
console.log(chalk.green('✅ AODW-Next 已卸载。'));
|
|
497
517
|
}
|
|
498
518
|
}
|
|
499
519
|
|
|
@@ -501,7 +521,7 @@ async function showHelp() {
|
|
|
501
521
|
const deployDocPath = path.join(__dirname, '../DEPLOY.md');
|
|
502
522
|
if (fs.existsSync(deployDocPath)) {
|
|
503
523
|
const content = fs.readFileSync(deployDocPath, 'utf8');
|
|
504
|
-
console.log(chalk.cyan('\n=== AODW 部署指南 ===\n'));
|
|
524
|
+
console.log(chalk.cyan('\n=== AODW-Next 部署指南 ===\n'));
|
|
505
525
|
console.log(content);
|
|
506
526
|
} else {
|
|
507
527
|
console.log(chalk.red('未找到帮助文件。'));
|
|
@@ -518,7 +538,7 @@ async function generateOverviewPrompt() {
|
|
|
518
538
|
const hasOverview = fs.existsSync(overviewFile);
|
|
519
539
|
const hasModulesIndex = fs.existsSync(modulesIndexFile);
|
|
520
540
|
|
|
521
|
-
let overviewPrompt = `请帮我${hasOverview || hasModulesIndex ? '更新' : '初始化'}项目的 AODW 项目概览文档。
|
|
541
|
+
let overviewPrompt = `请帮我${hasOverview || hasModulesIndex ? '更新' : '初始化'}项目的 AODW-Next 项目概览文档。
|
|
522
542
|
|
|
523
543
|
**任务说明**:
|
|
524
544
|
根据当前项目的代码结构、技术栈和架构,生成或完善以下文档:
|
|
@@ -542,7 +562,7 @@ async function generateOverviewPrompt() {
|
|
|
542
562
|
4. 生成或更新 \`ai-overview.md\` 和 \`modules-index.yaml\`
|
|
543
563
|
|
|
544
564
|
**重要提示**:
|
|
545
|
-
- ✅ **这些文件在更新 AODW 时会被保护,不会被覆盖**
|
|
565
|
+
- ✅ **这些文件在更新 AODW-Next 时会被保护,不会被覆盖**
|
|
546
566
|
- ${hasOverview ? '如果项目已经有部分概览文档,请基于现有内容进行完善' : '如果项目已经有部分概览文档,请基于现有内容进行完善'}
|
|
547
567
|
- 确保技术栈信息准确
|
|
548
568
|
- 确保模块索引完整
|
|
@@ -609,8 +629,8 @@ async function generateToolsPrompt() {
|
|
|
609
629
|
`;
|
|
610
630
|
}
|
|
611
631
|
|
|
612
|
-
toolsPrompt += `- ✅ **工具状态文件在更新 AODW 时会被保护,不会被覆盖**
|
|
613
|
-
- ✅ **工具配置文件在项目根目录,不会被 AODW 更新影响**
|
|
632
|
+
toolsPrompt += `- ✅ **工具状态文件在更新 AODW-Next 时会被保护,不会被覆盖**
|
|
633
|
+
- ✅ **工具配置文件在项目根目录,不会被 AODW-Next 更新影响**
|
|
614
634
|
- 确保生成的配置文件符合项目规范
|
|
615
635
|
- 如果工具已存在,请检查配置是否需要更新
|
|
616
636
|
- **此命令可以重复执行**,每次执行会检查并更新工具配置
|
|
@@ -649,7 +669,7 @@ async function configureMode(pause = true, forceConnect = false) {
|
|
|
649
669
|
const answers = await inquirer.prompt([{
|
|
650
670
|
type: 'input',
|
|
651
671
|
name: 'serverUrl',
|
|
652
|
-
message: '请输入 AODW ID 服务器地址:',
|
|
672
|
+
message: '请输入 AODW-Next ID 服务器地址:',
|
|
653
673
|
default: 'http://114.67.218.31:2005',
|
|
654
674
|
validate: (input) => {
|
|
655
675
|
if (!input || input.trim() === '') {
|
|
@@ -697,7 +717,7 @@ async function configureMode(pause = true, forceConnect = false) {
|
|
|
697
717
|
async function showMainMenu() {
|
|
698
718
|
while (true) {
|
|
699
719
|
console.clear();
|
|
700
|
-
console.log(chalk.bold.blue('=== AODW CLI 管理器 ==='));
|
|
720
|
+
console.log(chalk.bold.blue('=== AODW-Next CLI 管理器 ==='));
|
|
701
721
|
console.log(chalk.gray('版本: ' + packageJson.version));
|
|
702
722
|
|
|
703
723
|
// Show current config summary
|
|
@@ -713,7 +733,7 @@ async function showMainMenu() {
|
|
|
713
733
|
pageSize: 10,
|
|
714
734
|
choices: [
|
|
715
735
|
new inquirer.Separator('--- 核心功能 ---'),
|
|
716
|
-
{ name: '1. 初始化 / 更新 AODW (在本项目)', value: 'init' },
|
|
736
|
+
{ name: '1. 初始化 / 更新 AODW-Next (在本项目)', value: 'init' },
|
|
717
737
|
{ name: '2. 配置全局开发模式 (单机/联网)', value: 'config' },
|
|
718
738
|
|
|
719
739
|
new inquirer.Separator('--- 工具箱 ---'),
|
|
@@ -722,7 +742,7 @@ async function showMainMenu() {
|
|
|
722
742
|
|
|
723
743
|
new inquirer.Separator('--- 帮助与维护 ---'),
|
|
724
744
|
{ name: '5. 查看帮助 & 部署指南', value: 'help' },
|
|
725
|
-
{ name: '6. 卸载 AODW', value: 'uninstall' },
|
|
745
|
+
{ name: '6. 卸载 AODW-Next', value: 'uninstall' },
|
|
726
746
|
new inquirer.Separator(),
|
|
727
747
|
{ name: '0. 退出 (Exit)', value: 'exit' }
|
|
728
748
|
]
|
|
@@ -771,22 +791,22 @@ async function showMainMenu() {
|
|
|
771
791
|
|
|
772
792
|
program
|
|
773
793
|
.command('init')
|
|
774
|
-
.description('Initialize AODW')
|
|
794
|
+
.description('Initialize AODW-Next')
|
|
775
795
|
.action(runInit);
|
|
776
796
|
|
|
777
797
|
program
|
|
778
798
|
.command('update')
|
|
779
|
-
.description('Update AODW')
|
|
799
|
+
.description('Update AODW-Next')
|
|
780
800
|
.action(runUpdate);
|
|
781
801
|
|
|
782
802
|
program
|
|
783
803
|
.command('uninstall')
|
|
784
|
-
.description('Uninstall AODW')
|
|
804
|
+
.description('Uninstall AODW-Next')
|
|
785
805
|
.action(runUninstall);
|
|
786
806
|
|
|
787
807
|
program
|
|
788
808
|
.command('serve')
|
|
789
|
-
.description('Start the AODW ID Server')
|
|
809
|
+
.description('Start the AODW-Next ID Server')
|
|
790
810
|
.option('-p, --port <number>', 'Port to listen on', 2005)
|
|
791
811
|
.action(serve);
|
|
792
812
|
|