ai-scaffold-pro 1.1.1 → 2.0.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/README.md +90 -0
- package/bin/cli.js +47 -56
- package/package.json +17 -5
- package/scripts/bootstrap.sh +63 -0
- package/src/detect.js +21 -3
- package/src/prompts.js +21 -128
- package/src/render.js +284 -335
- package/templates/AI_INIT_GUIDE.md +141 -0
- package/templates/minimal_entry.md +62 -0
- package/templates/skills/project_initialization/SKILL.md +692 -0
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# ai-scaffold-pro
|
|
2
|
+
|
|
3
|
+
> AI Coding Skeleton v2.0 — CLI + LLM Collaborative Architecture
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
ai-scaffold-pro is a **CLI + LLM collaborative scaffolding system** that generates a complete AI coding assistance framework for your existing project.
|
|
8
|
+
|
|
9
|
+
### Two-Phase Approach
|
|
10
|
+
|
|
11
|
+
1. **CLI Phase** (10 seconds): Auto-detects your project type and creates the skeleton structure
|
|
12
|
+
2. **AI Phase** (2-5 minutes): Scans your source code, understands architecture, and generates customized rules
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
### Step 1: CLI Skeleton Creation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cd your-project/
|
|
20
|
+
npx ai-scaffold-pro
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Follow the minimal prompts:
|
|
24
|
+
1. Select language (中文 / English)
|
|
25
|
+
2. Select AI tool (Claude Code / Qoder / Codex / OpenCode)
|
|
26
|
+
3. Project auto-detected
|
|
27
|
+
4. Skeleton created!
|
|
28
|
+
|
|
29
|
+
### Step 2: AI Deep Initialization
|
|
30
|
+
|
|
31
|
+
Open your project in your chosen AI tool and enter:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Initialize using .qoder/skills/project_initialization/SKILL.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The AI will automatically:
|
|
38
|
+
- Scan your project structure
|
|
39
|
+
- Read key source files
|
|
40
|
+
- Ask 7-11 configuration questions
|
|
41
|
+
- Generate customized rules based on actual code
|
|
42
|
+
- Create comprehensive references documentation
|
|
43
|
+
- Set up intelligent agents and hooks
|
|
44
|
+
|
|
45
|
+
**Total time**: ~3 minutes (10s CLI + 2-5min AI)
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- **CLI + LLM Collaboration**: CLI builds skeleton instantly, AI fills in customized content
|
|
50
|
+
- **Multi-tool support**: Claude Code, Qoder, Codex, OpenCode
|
|
51
|
+
- **Multi-platform**: Android, iOS, HarmonyOS, Flutter, React Native
|
|
52
|
+
- **SKILL.md as AI Manual**: Comprehensive initialization guide
|
|
53
|
+
- **Auto-generated references**: AI scans source code to generate accurate module docs
|
|
54
|
+
- **CodeGraph integration**: Optional integration for better performance
|
|
55
|
+
|
|
56
|
+
## Supported Platforms
|
|
57
|
+
|
|
58
|
+
| Platform | Build System | Detection File |
|
|
59
|
+
|----------|-------------|----------------|
|
|
60
|
+
| Android | Gradle | `settings.gradle` / `build.gradle.kts` |
|
|
61
|
+
| iOS | Xcode / SPM | `*.xcodeproj` / `Package.swift` |
|
|
62
|
+
| HarmonyOS | Hvigor | `hvigor-config.json5` |
|
|
63
|
+
| Flutter | Dart Pub | `pubspec.yaml` |
|
|
64
|
+
| React Native | npm/yarn | `package.json` + react-native |
|
|
65
|
+
| Generic | — | Fallback for any project |
|
|
66
|
+
|
|
67
|
+
## Project Structure (After AI Initialization)
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
AGENTS.md / CLAUDE.md ← Entry point (full version, generated by AI)
|
|
71
|
+
AI_INIT_GUIDE.md ← User-friendly initialization guide
|
|
72
|
+
.qoder/ (or .claude/.codex/.opencode)
|
|
73
|
+
├── CHANGELOG.md
|
|
74
|
+
├── settings.json
|
|
75
|
+
├── hooks/
|
|
76
|
+
├── rules/ ← AI-generated
|
|
77
|
+
├── skills/
|
|
78
|
+
│ └── project_initialization/ ← AI initialization manual
|
|
79
|
+
├── agents/ ← AI-generated
|
|
80
|
+
├── scripts/
|
|
81
|
+
└── references/ ← AI-generated from source code
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Repository
|
|
85
|
+
|
|
86
|
+
For more information, visit: https://github.com/Jorgejie/ai_scaffold
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT
|
package/bin/cli.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
-
import { execSync } from 'child_process';
|
|
5
4
|
import { detectProject } from '../src/detect.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { promptMinimalConfig } from '../src/prompts.js';
|
|
6
|
+
import { createSkeleton } from '../src/render.js';
|
|
8
7
|
import path from 'path';
|
|
9
8
|
import { fileURLToPath } from 'url';
|
|
10
9
|
|
|
@@ -12,75 +11,67 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
12
11
|
const TEMPLATE_ROOT = path.resolve(__dirname, '../templates');
|
|
13
12
|
|
|
14
13
|
async function main() {
|
|
15
|
-
console.log(chalk.cyan.bold('\n AI Coding Skeleton — ai-scaffold\n'));
|
|
14
|
+
console.log(chalk.cyan.bold('\n🤖 AI Coding Skeleton — ai-scaffold\n'));
|
|
15
|
+
console.log(chalk.gray('CLI + LLM 协作架构: CLI搭建骨架 → AI深度初始化\n'));
|
|
16
16
|
|
|
17
17
|
const targetDir = process.argv[2] || process.cwd();
|
|
18
|
-
console.log(chalk.gray(
|
|
18
|
+
console.log(chalk.gray(`📁 Target directory: ${targetDir}\n`));
|
|
19
19
|
|
|
20
|
-
// Phase
|
|
21
|
-
|
|
22
|
-
console.log(chalk.yellow(' Detecting project...'));
|
|
20
|
+
// Phase 1: 项目检测
|
|
21
|
+
console.log(chalk.yellow('🔍 Step 1: Detecting project...'));
|
|
23
22
|
const detection = await detectProject(targetDir);
|
|
24
|
-
console.log(chalk.green(
|
|
23
|
+
console.log(chalk.green(`✓ Platform: ${detection.platform} / ${detection.buildSystem}`));
|
|
24
|
+
console.log(chalk.green(`✓ Language: ${detection.language}`));
|
|
25
25
|
if (detection.hasNdk) {
|
|
26
|
-
console.log(chalk.green(' NDK/C++: detected'));
|
|
26
|
+
console.log(chalk.green('✓ NDK/C++: detected'));
|
|
27
|
+
}
|
|
28
|
+
if (detection.hasCodeGraph) {
|
|
29
|
+
console.log(chalk.green('✓ CodeGraph: installed (will use lightweight mode)'));
|
|
27
30
|
}
|
|
28
31
|
console.log();
|
|
29
32
|
|
|
30
|
-
// Phase
|
|
31
|
-
|
|
33
|
+
// Phase 2: 最小化配置(仅语言和AI工具选择)
|
|
34
|
+
console.log(chalk.yellow('⚙️ Step 2: Minimal configuration...'));
|
|
35
|
+
const config = await promptMinimalConfig(detection);
|
|
36
|
+
console.log(chalk.green(`✓ AI Tool: ${config.target}`));
|
|
37
|
+
console.log(chalk.green(`✓ Language: ${config.lang === 'zh' ? '中文' : 'English'}\n`));
|
|
32
38
|
|
|
33
|
-
// Phase 3:
|
|
34
|
-
console.log(chalk.yellow('
|
|
35
|
-
await
|
|
39
|
+
// Phase 3: 创建骨架(不渲染具体内容)
|
|
40
|
+
console.log(chalk.yellow('🏗️ Step 3: Creating skeleton...'));
|
|
41
|
+
await createSkeleton(TEMPLATE_ROOT, targetDir, config, detection);
|
|
36
42
|
|
|
37
|
-
//
|
|
43
|
+
// 输出完成信息和下一步指引
|
|
38
44
|
const dir = config.dir;
|
|
39
45
|
const entry = config.entry;
|
|
40
46
|
const isZh = config.lang === 'zh';
|
|
41
|
-
|
|
42
|
-
console.log(chalk.cyan.bold(`\n
|
|
43
|
-
console.log(chalk.white(`
|
|
44
|
-
console.log(chalk.white(`
|
|
45
|
-
console.log(chalk.white(`
|
|
46
|
-
|
|
47
|
-
console.log('');
|
|
48
|
-
console.log(chalk.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log(chalk.
|
|
60
|
-
?
|
|
61
|
-
:
|
|
62
|
-
console.log(chalk.white(isZh
|
|
63
|
-
? ` 3. [可选] 调整 ${dir}/agents/ 中各 Agent 的检查规则`
|
|
64
|
-
: ` 3. [Optional] Adjust check rules in ${dir}/agents/`));
|
|
65
|
-
console.log(chalk.white(isZh
|
|
66
|
-
? ` 4. [可选] 修改 ${dir}/skills/ 中的审查标准`
|
|
67
|
-
: ` 4. [Optional] Modify review standards in ${dir}/skills/`));
|
|
68
|
-
console.log('');
|
|
47
|
+
|
|
48
|
+
console.log(chalk.cyan.bold(`\n✅ Skeleton created successfully!\n`));
|
|
49
|
+
console.log(chalk.white(`Entry file: ${entry}`));
|
|
50
|
+
console.log(chalk.white(`Config dir: ${dir}/`));
|
|
51
|
+
console.log(chalk.white(`Language: ${isZh ? '中文' : 'English'}\n`));
|
|
52
|
+
|
|
53
|
+
console.log(chalk.cyan.bold(isZh ? '📋 下一步操作:' : '📋 Next Steps:\n'));
|
|
54
|
+
console.log(chalk.white(isZh
|
|
55
|
+
? ' 1. 在 AI 工具中打开本项目'
|
|
56
|
+
: ' 1. Open this project in your AI tool'));
|
|
57
|
+
console.log(chalk.white(isZh
|
|
58
|
+
? ` 2. 输入指令: "按 ${dir}/skills/project_initialization/SKILL.md 初始化"`
|
|
59
|
+
: ` 2. Enter command: "Initialize using ${dir}/skills/project_initialization/SKILL.md"`));
|
|
60
|
+
console.log(chalk.white(isZh
|
|
61
|
+
? ' 3. AI 将扫描源码、理解架构、生成定制化规则'
|
|
62
|
+
: ' 3. AI will scan source code, understand architecture, generate customized rules'));
|
|
63
|
+
console.log();
|
|
64
|
+
|
|
65
|
+
console.log(chalk.gray(isZh
|
|
66
|
+
? ' 💡 提示: 查看 AI_INIT_GUIDE.md 了解详细流程'
|
|
67
|
+
: ' 💡 Tip: See AI_INIT_GUIDE.md for detailed instructions'));
|
|
69
68
|
console.log(chalk.gray(isZh
|
|
70
|
-
? '
|
|
71
|
-
: ' Estimated
|
|
72
|
-
console.log(chalk.gray(isZh
|
|
73
|
-
? ' 验证方式:让 AI 阅读生成的规则文件并确认无冲突'
|
|
74
|
-
: ' Verification: Ask the AI to read the generated rules and confirm no conflicts'));
|
|
75
|
-
console.log('');
|
|
69
|
+
? ' ⏱️ 预计AI初始化时间: 2-5分钟\n'
|
|
70
|
+
: ' ⏱️ Estimated AI initialization time: 2-5 minutes\n'));
|
|
76
71
|
}
|
|
77
72
|
|
|
78
73
|
main().catch(err => {
|
|
79
|
-
console.error(chalk.red('Error:'), err.message);
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
main().catch(err => {
|
|
84
|
-
console.error(chalk.red('Error:'), err.message);
|
|
74
|
+
console.error(chalk.red('\n❌ Error:'), err.message);
|
|
75
|
+
console.error(chalk.red(' No files were written to the target directory.'));
|
|
85
76
|
process.exit(1);
|
|
86
77
|
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-scaffold-pro",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "AI Coding Skeleton —
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "AI Coding Skeleton — CLI + LLM协作架构: CLI搭建骨架 → AI深度初始化",
|
|
5
5
|
"bin": {
|
|
6
|
-
"ai-scaffold-pro": "
|
|
6
|
+
"ai-scaffold-pro": "bin/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"start": "node bin/cli.js"
|
|
10
|
+
"start": "node bin/cli.js",
|
|
11
|
+
"bootstrap": "bash scripts/bootstrap.sh"
|
|
11
12
|
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/",
|
|
15
|
+
"src/",
|
|
16
|
+
"templates/",
|
|
17
|
+
"hooks/",
|
|
18
|
+
"scripts/",
|
|
19
|
+
"i18n/",
|
|
20
|
+
"package.json",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
12
23
|
"keywords": [
|
|
13
24
|
"ai",
|
|
14
25
|
"coding",
|
|
@@ -18,7 +29,8 @@
|
|
|
18
29
|
"codex",
|
|
19
30
|
"opencode",
|
|
20
31
|
"rules",
|
|
21
|
-
"scaffold"
|
|
32
|
+
"scaffold",
|
|
33
|
+
"cli-llm-collaboration"
|
|
22
34
|
],
|
|
23
35
|
"license": "MIT",
|
|
24
36
|
"dependencies": {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# ai-scaffold 快速启动脚本
|
|
3
|
+
# 一键执行: CLI骨架搭建 + AI初始化指引
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🤖 AI Coding Skeleton — ai-scaffold"
|
|
8
|
+
echo "===================================="
|
|
9
|
+
echo ""
|
|
10
|
+
|
|
11
|
+
# 检查是否在Git仓库中
|
|
12
|
+
if [ ! -d ".git" ]; then
|
|
13
|
+
echo "⚠️ Warning: Current directory is not a Git repository."
|
|
14
|
+
echo " It's recommended to initialize Git first:"
|
|
15
|
+
echo " git init"
|
|
16
|
+
echo ""
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Step 1: 运行CLI创建骨架
|
|
20
|
+
echo "🔧 Step 1: Creating project skeleton..."
|
|
21
|
+
echo ""
|
|
22
|
+
|
|
23
|
+
npx ai-scaffold-pro "$@"
|
|
24
|
+
|
|
25
|
+
echo ""
|
|
26
|
+
echo "===================================="
|
|
27
|
+
echo ""
|
|
28
|
+
|
|
29
|
+
# Step 2: 显示AI初始化指引
|
|
30
|
+
echo "🤖 Step 2: AI Initialization Guide"
|
|
31
|
+
echo ""
|
|
32
|
+
echo "✅ Skeleton created successfully!"
|
|
33
|
+
echo ""
|
|
34
|
+
echo "Next steps:"
|
|
35
|
+
echo ""
|
|
36
|
+
echo "1. Open this project in your AI coding assistant:"
|
|
37
|
+
echo " - Claude Code"
|
|
38
|
+
echo " - Qoder"
|
|
39
|
+
echo " - Codex"
|
|
40
|
+
echo " - OpenCode"
|
|
41
|
+
echo ""
|
|
42
|
+
echo "2. In the AI chat, enter one of these commands:"
|
|
43
|
+
echo ""
|
|
44
|
+
echo " Option A:"
|
|
45
|
+
echo " 👉 '按 .qoder/skills/project_initialization/SKILL.md 初始化'"
|
|
46
|
+
echo ""
|
|
47
|
+
echo " Option B:"
|
|
48
|
+
echo " 👉 '阅读 AI_INIT_GUIDE.md 并执行初始化'"
|
|
49
|
+
echo ""
|
|
50
|
+
echo "3. The AI will:"
|
|
51
|
+
echo " • Scan your source code"
|
|
52
|
+
echo " • Understand your project architecture"
|
|
53
|
+
echo " • Generate customized rules based on actual code"
|
|
54
|
+
echo " • Create comprehensive references documentation"
|
|
55
|
+
echo " • Set up intelligent agents and hooks"
|
|
56
|
+
echo ""
|
|
57
|
+
echo " Estimated time: 2-5 minutes"
|
|
58
|
+
echo ""
|
|
59
|
+
echo "💡 Tip: See AI_INIT_GUIDE.md for detailed instructions"
|
|
60
|
+
echo ""
|
|
61
|
+
echo "===================================="
|
|
62
|
+
echo ""
|
|
63
|
+
echo "Happy coding! 🎉"
|
package/src/detect.js
CHANGED
|
@@ -39,10 +39,13 @@ export async function detectProject(targetDir) {
|
|
|
39
39
|
allDetected: [],
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
console.log(chalk.gray(' Scanning project structure...'));
|
|
43
|
+
|
|
42
44
|
// 1. 检测已有 AI 工具
|
|
43
45
|
for (const [indicator, tool] of Object.entries(AI_TOOLS)) {
|
|
44
46
|
if (fs.existsSync(path.join(targetDir, indicator))) {
|
|
45
47
|
result.existingTool = tool;
|
|
48
|
+
console.log(chalk.gray(` ✓ Found existing ${tool.target} setup (${indicator})`));
|
|
46
49
|
break;
|
|
47
50
|
}
|
|
48
51
|
}
|
|
@@ -60,11 +63,13 @@ export async function detectProject(targetDir) {
|
|
|
60
63
|
|
|
61
64
|
// 输出检测日志
|
|
62
65
|
if (matched.length > 0) {
|
|
63
|
-
console.log(chalk.gray('
|
|
66
|
+
console.log(chalk.gray(' Detected project indicators:'));
|
|
64
67
|
for (const m of matched) {
|
|
65
68
|
const label = m.platform || 'package.json';
|
|
66
69
|
console.log(chalk.gray(` • ${m.file} → ${label} (priority: ${m.priority})`));
|
|
67
70
|
}
|
|
71
|
+
} else {
|
|
72
|
+
console.log(chalk.yellow(' ⚠ No standard project indicators found, using generic mode'));
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
// 3. 确定平台
|
|
@@ -77,15 +82,18 @@ export async function detectProject(targetDir) {
|
|
|
77
82
|
if (isAndroid) {
|
|
78
83
|
result.platform = 'Android';
|
|
79
84
|
result.buildSystem = top.build;
|
|
85
|
+
console.log(chalk.gray(' ✓ Verified as Android project (found AndroidManifest.xml or com.android plugin)'));
|
|
80
86
|
} else {
|
|
81
87
|
result.platform = 'JVM';
|
|
82
88
|
result.buildSystem = top.build;
|
|
89
|
+
console.log(chalk.gray(' ✓ Detected as JVM project (no Android-specific files)'));
|
|
83
90
|
}
|
|
84
91
|
} else if (top.platform === null && top.file === 'package.json') {
|
|
85
92
|
// package.json 深度检测
|
|
86
93
|
const detected = detectFromPackageJson(targetDir);
|
|
87
94
|
result.platform = detected.platform;
|
|
88
95
|
result.buildSystem = detected.build;
|
|
96
|
+
console.log(chalk.gray(` ✓ Identified Node.js project type: ${detected.platform}`));
|
|
89
97
|
} else {
|
|
90
98
|
result.platform = top.platform;
|
|
91
99
|
result.buildSystem = top.build;
|
|
@@ -100,22 +108,32 @@ export async function detectProject(targetDir) {
|
|
|
100
108
|
|
|
101
109
|
// 混合项目日志
|
|
102
110
|
if (matched.length > 1) {
|
|
103
|
-
console.log(chalk.yellow(` ⚠
|
|
111
|
+
console.log(chalk.yellow(` ⚠ Multiple platforms detected, selected highest priority: ${result.platform} (${result.buildSystem})`));
|
|
112
|
+
console.log(chalk.gray(` Other detected platforms: ${matched.slice(1).map(m => m.platform || 'Node').join(', ')}`));
|
|
104
113
|
}
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
// 4. 检测 NDK/C++
|
|
108
117
|
result.hasNdk = detectNdk(targetDir);
|
|
118
|
+
if (result.hasNdk) {
|
|
119
|
+
console.log(chalk.gray(' ✓ NDK/C++ code detected (found .cpp/.c/.h files or CMakeLists.txt)'));
|
|
120
|
+
}
|
|
109
121
|
|
|
110
122
|
// 5. 检测语言
|
|
111
123
|
result.language = detectLanguage(targetDir, result.platform, result.buildSystem);
|
|
124
|
+
console.log(chalk.gray(` ✓ Primary language: ${result.language}`));
|
|
112
125
|
|
|
113
126
|
// 6. 检测 CodeGraph
|
|
114
127
|
result.hasCodeGraph = detectCodeGraph();
|
|
115
128
|
if (result.hasCodeGraph) {
|
|
116
|
-
console.log(chalk.gray(' CodeGraph
|
|
129
|
+
console.log(chalk.gray(' ✓ CodeGraph CLI detected (will use lightweight references mode)'));
|
|
130
|
+
} else {
|
|
131
|
+
console.log(chalk.gray(' ℹ CodeGraph CLI not found (will use full references mode)'));
|
|
132
|
+
console.log(chalk.gray(' Tip: Install with `npx @colbymchenry/codegraph` for better performance'));
|
|
117
133
|
}
|
|
118
134
|
|
|
135
|
+
console.log(chalk.green(`\n Project detection complete: ${result.platform} / ${result.buildSystem}\n`));
|
|
136
|
+
|
|
119
137
|
return result;
|
|
120
138
|
}
|
|
121
139
|
|
package/src/prompts.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 最小化配置 - 仅收集语言和AI工具选择
|
|
5
|
+
* 其他所有配置将由AI在初始化时通过交互式问答收集
|
|
6
|
+
*/
|
|
7
|
+
export async function promptMinimalConfig(detection) {
|
|
4
8
|
const answers = {};
|
|
5
9
|
|
|
6
10
|
// Phase 0: Language selection
|
|
@@ -59,133 +63,22 @@ export async function promptConfig(detection) {
|
|
|
59
63
|
answers.entry = 'AGENTS.md';
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
name: 'installCodeGraph',
|
|
70
|
-
message: isZh
|
|
71
|
-
? '检测到项目未安装 CodeGraph(代码关系图工具,可提升 AI 对代码库的理解能力)。是否安装?'
|
|
72
|
-
: 'CodeGraph (code relationship graph tool for improved AI codebase understanding) is not installed. Install it?',
|
|
73
|
-
default: true,
|
|
74
|
-
},
|
|
75
|
-
]);
|
|
76
|
-
answers.installCodeGraph = installCodeGraph;
|
|
77
|
-
answers.hasCodeGraph = false;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Phase 2: Configuration questions
|
|
81
|
-
const configPrompts = [
|
|
82
|
-
{
|
|
83
|
-
type: 'input',
|
|
84
|
-
name: 'projectName',
|
|
85
|
-
message: isZh ? '项目名称' : 'Project name',
|
|
86
|
-
default: 'MyProject',
|
|
87
|
-
validate: v => {
|
|
88
|
-
if (!v || v.trim().length === 0) {
|
|
89
|
-
return isZh ? '项目名不能为空' : 'Project name cannot be empty';
|
|
90
|
-
}
|
|
91
|
-
if (v.length > 50) {
|
|
92
|
-
return isZh ? '项目名不能超过 50 个字符' : 'Project name cannot exceed 50 characters';
|
|
93
|
-
}
|
|
94
|
-
return true;
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
type: 'input',
|
|
99
|
-
name: 'projectDescription',
|
|
100
|
-
message: isZh ? '项目描述(一句话)' : 'Project description (one sentence)',
|
|
101
|
-
default: isZh ? '一个项目' : 'A project',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
type: 'input',
|
|
105
|
-
name: 'packageName',
|
|
106
|
-
message: isZh ? '主包名' : 'Main package name',
|
|
107
|
-
default: 'com.example.app',
|
|
108
|
-
validate: v => {
|
|
109
|
-
if (!v) return true;
|
|
110
|
-
if (!/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/.test(v)) {
|
|
111
|
-
return isZh ? '请输入有效的包名格式 (如 com.example.app)' : 'Please enter a valid package name (e.g. com.example.app)';
|
|
112
|
-
}
|
|
113
|
-
return true;
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
type: 'input',
|
|
118
|
-
name: 'aiName',
|
|
119
|
-
message: isZh ? 'AI 助手名称' : 'AI assistant name',
|
|
120
|
-
default: 'AI Assistant',
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
type: 'input',
|
|
124
|
-
name: 'buildDebug',
|
|
125
|
-
message: isZh ? 'Debug 构建命令' : 'Debug build command',
|
|
126
|
-
default: detection.platform === 'Android' ? './gradlew assembleDebug' : 'npm run build',
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
type: 'input',
|
|
130
|
-
name: 'buildRelease',
|
|
131
|
-
message: isZh ? 'Release 构建命令' : 'Release build command',
|
|
132
|
-
default: detection.platform === 'Android' ? './gradlew assembleRelease' : 'npm run build:prod',
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
type: 'confirm',
|
|
136
|
-
name: 'hasTests',
|
|
137
|
-
message: isZh ? '项目有自动化测试吗?' : 'Does the project have automated tests?',
|
|
138
|
-
default: true,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
type: 'input',
|
|
142
|
-
name: 'reviewThreshold',
|
|
143
|
-
message: isZh ? '修改几个文件触发代码审查?' : 'How many files modified triggers code review?',
|
|
144
|
-
default: '2',
|
|
145
|
-
validate: v => {
|
|
146
|
-
const n = parseInt(v);
|
|
147
|
-
if (isNaN(n) || n < 1 || n > 100) {
|
|
148
|
-
return isZh ? '请输入 1-100 之间的数字' : 'Please enter a number between 1 and 100';
|
|
149
|
-
}
|
|
150
|
-
return true;
|
|
151
|
-
},
|
|
152
|
-
filter: v => parseInt(v),
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
type: 'input',
|
|
156
|
-
name: 'archThreshold',
|
|
157
|
-
message: isZh ? '修改几个模块触发架构审查?' : 'How many modules modified triggers architecture review?',
|
|
158
|
-
default: '3',
|
|
159
|
-
validate: v => !isNaN(v) || 'Please enter a number',
|
|
160
|
-
},
|
|
161
|
-
];
|
|
162
|
-
|
|
163
|
-
const config = await inquirer.prompt(configPrompts);
|
|
164
|
-
Object.assign(answers, config);
|
|
165
|
-
|
|
166
|
-
// NDK questions
|
|
167
|
-
if (detection.hasNdk) {
|
|
168
|
-
const ndkConfig = await inquirer.prompt([
|
|
169
|
-
{
|
|
170
|
-
type: 'list',
|
|
171
|
-
name: 'ndkBuildSystem',
|
|
172
|
-
message: isZh ? 'NDK 构建系统' : 'NDK build system',
|
|
173
|
-
choices: ['ndk-build', 'CMake'],
|
|
174
|
-
default: 'ndk-build',
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
type: 'list',
|
|
178
|
-
name: 'jniMethod',
|
|
179
|
-
message: isZh ? 'JNI native 方法注册方式' : 'JNI native method registration',
|
|
180
|
-
choices: [
|
|
181
|
-
{ name: isZh ? '动态注册 (RegisterNatives)' : 'Dynamic (RegisterNatives)', value: 'dynamic' },
|
|
182
|
-
{ name: isZh ? '静态绑定' : 'Static binding', value: 'static' },
|
|
183
|
-
],
|
|
184
|
-
default: 'dynamic',
|
|
185
|
-
},
|
|
186
|
-
]);
|
|
187
|
-
Object.assign(answers, ndkConfig);
|
|
188
|
-
}
|
|
66
|
+
// 设置显示名称
|
|
67
|
+
answers.targetDisplay = {
|
|
68
|
+
'claude': 'Claude Code',
|
|
69
|
+
'qoder': 'Qoder',
|
|
70
|
+
'codex': 'Codex',
|
|
71
|
+
'opencode': 'OpenCode'
|
|
72
|
+
}[answers.target];
|
|
189
73
|
|
|
190
74
|
return answers;
|
|
191
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 原有的完整配置函数(已废弃,保留供参考)
|
|
79
|
+
* @deprecated 使用 promptMinimalConfig 代替
|
|
80
|
+
*/
|
|
81
|
+
export async function promptConfig(detection) {
|
|
82
|
+
console.warn('⚠️ Warning: promptConfig is deprecated, use promptMinimalConfig instead');
|
|
83
|
+
return await promptMinimalConfig(detection);
|
|
84
|
+
}
|