aiwf 0.3.12 → 0.3.14
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/package.json +8 -2
- package/scripts/check-dependencies.js +101 -0
- package/src/lib/installer.js +26 -1
- package/src/utils/paths.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiwf",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"description": "AI Workflow Framework for Claude Code with multi-language support (Korean/English)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
15
|
+
"check:deps": "node scripts/check-dependencies.js",
|
|
16
|
+
"prepublishOnly": "npm run check:deps",
|
|
15
17
|
"lang:status": "node src/cli/index.js lang status",
|
|
16
18
|
"lang:set": "node src/cli/index.js lang set",
|
|
17
19
|
"lang:reset": "node src/cli/index.js lang reset",
|
|
@@ -67,13 +69,17 @@
|
|
|
67
69
|
],
|
|
68
70
|
"dependencies": {
|
|
69
71
|
"chalk": "^5.3.0",
|
|
72
|
+
"chokidar": "^3.5.3",
|
|
70
73
|
"commander": "^11.1.0",
|
|
71
74
|
"fs-extra": "^11.3.0",
|
|
75
|
+
"glob": "^10.3.10",
|
|
72
76
|
"js-yaml": "^4.1.0",
|
|
73
77
|
"ora": "^8.0.1",
|
|
74
78
|
"prompts": "^2.4.2",
|
|
79
|
+
"table": "^6.8.1",
|
|
75
80
|
"tar": "^6.2.1",
|
|
76
|
-
"tiktoken": "^1.0.21"
|
|
81
|
+
"tiktoken": "^1.0.21",
|
|
82
|
+
"yaml": "^2.3.4"
|
|
77
83
|
},
|
|
78
84
|
"devDependencies": {
|
|
79
85
|
"jest": "^30.0.3"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 의존성 검증 스크립트
|
|
5
|
+
* 모든 import된 패키지가 package.json에 선언되어 있는지 확인
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import fs from 'fs/promises';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { glob } from 'glob';
|
|
11
|
+
import { builtinModules } from 'module';
|
|
12
|
+
|
|
13
|
+
// Node.js 내장 모듈 체크 함수
|
|
14
|
+
function isBuiltinModule(moduleName) {
|
|
15
|
+
const rootModule = moduleName.split('/')[0];
|
|
16
|
+
return builtinModules.includes(rootModule);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function checkDependencies() {
|
|
20
|
+
console.log('🔍 의존성 검증을 시작합니다...\n');
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
// package.json 읽기
|
|
24
|
+
const packageJson = JSON.parse(await fs.readFile('package.json', 'utf8'));
|
|
25
|
+
const dependencies = {
|
|
26
|
+
...packageJson.dependencies,
|
|
27
|
+
...packageJson.devDependencies
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// 모든 JS 파일 찾기 (템플릿 제외)
|
|
31
|
+
const jsFiles = await glob('src/**/*.js', {
|
|
32
|
+
ignore: ['src/lib/resources/templates/**/*.js']
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const missingDeps = new Set();
|
|
36
|
+
const foundImports = new Set();
|
|
37
|
+
|
|
38
|
+
for (const file of jsFiles) {
|
|
39
|
+
const content = await fs.readFile(file, 'utf8');
|
|
40
|
+
|
|
41
|
+
// import 문 찾기
|
|
42
|
+
const importMatches = content.match(/import\s+.*?\s+from\s+['"`]([^'"`]+)['"`]/g);
|
|
43
|
+
if (importMatches) {
|
|
44
|
+
for (const match of importMatches) {
|
|
45
|
+
const packageName = match.match(/from\s+['"`]([^'"`]+)['"`]/)[1];
|
|
46
|
+
|
|
47
|
+
// 내장 모듈이나 상대 경로가 아닌 경우만 체크
|
|
48
|
+
if (!packageName.startsWith('.') && !packageName.startsWith('node:') && !isBuiltinModule(packageName)) {
|
|
49
|
+
const rootPackage = packageName.split('/')[0];
|
|
50
|
+
foundImports.add(rootPackage);
|
|
51
|
+
|
|
52
|
+
if (!dependencies[rootPackage]) {
|
|
53
|
+
missingDeps.add(`${rootPackage} (used in ${file})`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// require 문도 찾기 (혹시 있을 경우)
|
|
60
|
+
const requireMatches = content.match(/require\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g);
|
|
61
|
+
if (requireMatches) {
|
|
62
|
+
for (const match of requireMatches) {
|
|
63
|
+
const packageName = match.match(/['"`]([^'"`]+)['"`]/)[1];
|
|
64
|
+
|
|
65
|
+
if (!packageName.startsWith('.') && !packageName.startsWith('node:') && !isBuiltinModule(packageName)) {
|
|
66
|
+
const rootPackage = packageName.split('/')[0];
|
|
67
|
+
foundImports.add(rootPackage);
|
|
68
|
+
|
|
69
|
+
if (!dependencies[rootPackage]) {
|
|
70
|
+
missingDeps.add(`${rootPackage} (used in ${file})`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 결과 출력
|
|
78
|
+
console.log(`✅ 검사한 파일: ${jsFiles.length}개`);
|
|
79
|
+
console.log(`📦 발견된 외부 패키지: ${foundImports.size}개`);
|
|
80
|
+
console.log(` ${Array.from(foundImports).join(', ')}\n`);
|
|
81
|
+
|
|
82
|
+
if (missingDeps.size > 0) {
|
|
83
|
+
console.log('❌ 누락된 의존성:');
|
|
84
|
+
for (const dep of missingDeps) {
|
|
85
|
+
console.log(` - ${dep}`);
|
|
86
|
+
}
|
|
87
|
+
console.log('\n💡 다음 명령어로 설치하세요:');
|
|
88
|
+
const packages = Array.from(missingDeps).map(dep => dep.split(' ')[0]);
|
|
89
|
+
console.log(` npm install ${packages.join(' ')}`);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
} else {
|
|
92
|
+
console.log('✅ 모든 의존성이 올바르게 선언되어 있습니다!');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error('❌ 의존성 검증 중 오류 발생:', error.message);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
checkDependencies();
|
package/src/lib/installer.js
CHANGED
|
@@ -190,6 +190,7 @@ async function createDirectoryStructure() {
|
|
|
190
190
|
// Create tool-specific directories
|
|
191
191
|
await fs.mkdir(TOOL_DIRS.CURSOR_RULES, { recursive: true });
|
|
192
192
|
await fs.mkdir(TOOL_DIRS.WINDSURF_RULES, { recursive: true });
|
|
193
|
+
await fs.mkdir(TOOL_DIRS.CLAUDE_AGENTS, { recursive: true });
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
/**
|
|
@@ -285,7 +286,7 @@ async function updateDocumentation(languagePath, spinner, msg, debugLog) {
|
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
/**
|
|
288
|
-
* Update commands
|
|
289
|
+
* Update Claude commands and agents
|
|
289
290
|
* @param {string} languagePath - Language path
|
|
290
291
|
* @param {Object} spinner - Ora spinner instance
|
|
291
292
|
* @param {Object} msg - Localized messages
|
|
@@ -298,7 +299,14 @@ async function updateCommands(languagePath, spinner, msg, debugLog) {
|
|
|
298
299
|
await fs.rm(TOOL_DIRS.CLAUDE_COMMANDS, { recursive: true, force: true });
|
|
299
300
|
}
|
|
300
301
|
|
|
302
|
+
// Delete existing agents folder if it exists
|
|
303
|
+
if (await fs.access(TOOL_DIRS.CLAUDE_AGENTS).then(() => true).catch(() => false)) {
|
|
304
|
+
logWithSpinner(spinner, 'Deleting old agents...', debugLog);
|
|
305
|
+
await fs.rm(TOOL_DIRS.CLAUDE_AGENTS, { recursive: true, force: true });
|
|
306
|
+
}
|
|
307
|
+
|
|
301
308
|
await fs.mkdir(TOOL_DIRS.CLAUDE_COMMANDS, { recursive: true });
|
|
309
|
+
await fs.mkdir(TOOL_DIRS.CLAUDE_AGENTS, { recursive: true });
|
|
302
310
|
|
|
303
311
|
// Download commands
|
|
304
312
|
logWithSpinner(spinner, msg.downloadingCommands, debugLog);
|
|
@@ -314,11 +322,28 @@ async function updateCommands(languagePath, spinner, msg, debugLog) {
|
|
|
314
322
|
} catch (error) {
|
|
315
323
|
logWithSpinner(spinner, msg.commandsNotFound, debugLog);
|
|
316
324
|
}
|
|
325
|
+
|
|
326
|
+
// Download agents
|
|
327
|
+
logWithSpinner(spinner, 'Downloading agents...', debugLog);
|
|
328
|
+
try {
|
|
329
|
+
await downloadDirectory(
|
|
330
|
+
`${GITHUB_CONTENT_PREFIX}/${languagePath}/${TOOL_DIRS.CLAUDE_AGENTS}`,
|
|
331
|
+
TOOL_DIRS.CLAUDE_AGENTS,
|
|
332
|
+
spinner,
|
|
333
|
+
msg,
|
|
334
|
+
languagePath,
|
|
335
|
+
false // agents도 기존 방식 유지 (파일 리스트 사용)
|
|
336
|
+
);
|
|
337
|
+
logWithSpinner(spinner, 'Successfully downloaded agents', debugLog);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
logWithSpinner(spinner, 'Agents not found or failed to download', debugLog);
|
|
340
|
+
}
|
|
317
341
|
}
|
|
318
342
|
|
|
319
343
|
/**
|
|
320
344
|
* Download and process rules
|
|
321
345
|
* @param {Object} spinner - Ora spinner instance
|
|
346
|
+
{{ ... }}
|
|
322
347
|
* @param {Object} msg - Localized messages
|
|
323
348
|
* @param {boolean} debugLog - Debug mode flag
|
|
324
349
|
*/
|
package/src/utils/paths.js
CHANGED
|
@@ -37,6 +37,7 @@ export const AIWF_DIRS = {
|
|
|
37
37
|
// Tool-specific directories
|
|
38
38
|
export const TOOL_DIRS = {
|
|
39
39
|
CLAUDE_COMMANDS: path.join(BASE_DIRS.CLAUDE, 'commands', 'aiwf'),
|
|
40
|
+
CLAUDE_AGENTS: path.join(BASE_DIRS.CLAUDE, 'agents'),
|
|
40
41
|
GEMINI_PROMPTS: path.join(BASE_DIRS.GEMINI, 'prompts', 'aiwf'),
|
|
41
42
|
CURSOR_RULES: path.join(BASE_DIRS.CURSOR, 'rules'),
|
|
42
43
|
WINDSURF_RULES: path.join(BASE_DIRS.WINDSURF, 'rules')
|