@unlaxer/dxe-suite 0.1.3 → 0.1.4
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/dxe.js +77 -23
- package/package.json +1 -1
package/bin/dxe.js
CHANGED
|
@@ -10,14 +10,77 @@
|
|
|
10
10
|
const { execSync } = require('child_process');
|
|
11
11
|
const path = require('path');
|
|
12
12
|
|
|
13
|
+
// --- i18n ---
|
|
14
|
+
function detectLang(argv) {
|
|
15
|
+
const flag = argv.find(a => a.startsWith('--lang='));
|
|
16
|
+
if (flag) return flag.split('=')[1];
|
|
17
|
+
const env = process.env.LANG || '';
|
|
18
|
+
return (env.startsWith('en') || env === 'C' || env === 'POSIX') ? 'en' : 'ja';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const MESSAGES = {
|
|
22
|
+
ja: {
|
|
23
|
+
installing: name => `\n[${name}] installing...`,
|
|
24
|
+
updating: name => `\n[${name}] updating...`,
|
|
25
|
+
notInstalled: 'not installed',
|
|
26
|
+
unknownToolkit: name => `Unknown toolkit: ${name}`,
|
|
27
|
+
agentHint: (desc, phrase) => ` ${desc} → コーディングエージェントで ${phrase}`,
|
|
28
|
+
help: `
|
|
29
|
+
DxE Suite — DGE / DDE / DRE toolkit manager
|
|
30
|
+
|
|
31
|
+
Usage:
|
|
32
|
+
npx dxe install 全toolkit をインストール
|
|
33
|
+
npx dxe install dge DGE のみ
|
|
34
|
+
npx dxe install dde dre DDE + DRE
|
|
35
|
+
npx dxe update 全toolkit をアップデート
|
|
36
|
+
npx dxe status インストール済みバージョンを表示
|
|
37
|
+
`,
|
|
38
|
+
},
|
|
39
|
+
en: {
|
|
40
|
+
installing: name => `\n[${name}] installing...`,
|
|
41
|
+
updating: name => `\n[${name}] updating...`,
|
|
42
|
+
notInstalled: 'not installed',
|
|
43
|
+
unknownToolkit: name => `Unknown toolkit: ${name}`,
|
|
44
|
+
agentHint: (desc, phrase) => ` ${desc} → tell your coding agent ${phrase}`,
|
|
45
|
+
help: `
|
|
46
|
+
DxE Suite — DGE / DDE / DRE toolkit manager
|
|
47
|
+
|
|
48
|
+
Usage:
|
|
49
|
+
npx dxe install install all toolkits
|
|
50
|
+
npx dxe install dge DGE only
|
|
51
|
+
npx dxe install dde dre DDE + DRE
|
|
52
|
+
npx dxe update update all toolkits
|
|
53
|
+
npx dxe status show installed versions
|
|
54
|
+
`,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
13
58
|
const TOOLKITS = {
|
|
14
|
-
dge: {
|
|
15
|
-
|
|
16
|
-
|
|
59
|
+
dge: {
|
|
60
|
+
pkg: '@unlaxer/dge-toolkit', install: 'dge-install', update: 'dge-update',
|
|
61
|
+
desc: { ja: '会話劇で設計の gap を抽出', en: 'extract design gaps via dialogue' },
|
|
62
|
+
phrase: { ja: '「DGE して」', en: '"run DGE"' },
|
|
63
|
+
},
|
|
64
|
+
dde: {
|
|
65
|
+
pkg: '@unlaxer/dde-toolkit', install: 'dde-install', update: 'dde-update',
|
|
66
|
+
desc: { ja: 'ドキュメントの穴を補完', en: 'fill documentation deficits' },
|
|
67
|
+
phrase: { ja: '「DDE して」', en: '"run DDE"' },
|
|
68
|
+
},
|
|
69
|
+
dre: {
|
|
70
|
+
pkg: '@unlaxer/dre-toolkit', install: 'dre-install', update: 'dre-update',
|
|
71
|
+
desc: { ja: 'rules/skills を配布・管理', en: 'distribute & manage rules/skills' },
|
|
72
|
+
phrase: { ja: '「DRE して」', en: '"run DRE"' },
|
|
73
|
+
},
|
|
17
74
|
};
|
|
18
75
|
|
|
19
|
-
const
|
|
20
|
-
const
|
|
76
|
+
const rawArgs = process.argv.slice(2);
|
|
77
|
+
const lang = detectLang(rawArgs);
|
|
78
|
+
const M = MESSAGES[lang] || MESSAGES.ja;
|
|
79
|
+
|
|
80
|
+
// Strip --lang=* from args before parsing command/targets
|
|
81
|
+
const cleanArgs = rawArgs.filter(a => !a.startsWith('--lang='));
|
|
82
|
+
const [command, ...targets_] = cleanArgs;
|
|
83
|
+
const targets = targets_.length > 0 ? targets_ : Object.keys(TOOLKITS);
|
|
21
84
|
|
|
22
85
|
function run(cmd) {
|
|
23
86
|
console.log(`\n → ${cmd}`);
|
|
@@ -28,24 +91,24 @@ if (command === 'install') {
|
|
|
28
91
|
const installed = [];
|
|
29
92
|
for (const name of targets) {
|
|
30
93
|
const tk = TOOLKITS[name];
|
|
31
|
-
if (!tk) { console.error(
|
|
32
|
-
console.log(
|
|
94
|
+
if (!tk) { console.error(M.unknownToolkit(name)); process.exit(1); }
|
|
95
|
+
console.log(M.installing(name.toUpperCase()));
|
|
33
96
|
run(`npm install ${tk.pkg}`);
|
|
34
|
-
run(`npx ${tk.install}`);
|
|
97
|
+
run(`npx ${tk.install} --lang=${lang}`);
|
|
35
98
|
installed.push(tk);
|
|
36
99
|
}
|
|
37
100
|
console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
38
101
|
for (const tk of installed) {
|
|
39
|
-
console.log(
|
|
102
|
+
console.log(M.agentHint(tk.desc[lang], tk.phrase[lang]));
|
|
40
103
|
}
|
|
41
104
|
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
|
|
42
105
|
} else if (command === 'update') {
|
|
43
106
|
for (const name of targets) {
|
|
44
107
|
const tk = TOOLKITS[name];
|
|
45
|
-
if (!tk) { console.error(
|
|
46
|
-
console.log(
|
|
108
|
+
if (!tk) { console.error(M.unknownToolkit(name)); process.exit(1); }
|
|
109
|
+
console.log(M.updating(name.toUpperCase()));
|
|
47
110
|
run(`npm install ${tk.pkg}@latest`);
|
|
48
|
-
run(`npx ${tk.update}`);
|
|
111
|
+
run(`npx ${tk.update} --lang=${lang}`);
|
|
49
112
|
}
|
|
50
113
|
} else if (command === 'status') {
|
|
51
114
|
for (const [name, tk] of Object.entries(TOOLKITS)) {
|
|
@@ -53,18 +116,9 @@ if (command === 'install') {
|
|
|
53
116
|
const pkg = require(path.join(process.cwd(), 'node_modules', tk.pkg, 'package.json'));
|
|
54
117
|
console.log(` ${name.toUpperCase()}: ${pkg.version}`);
|
|
55
118
|
} catch {
|
|
56
|
-
console.log(` ${name.toUpperCase()}:
|
|
119
|
+
console.log(` ${name.toUpperCase()}: ${M.notInstalled}`);
|
|
57
120
|
}
|
|
58
121
|
}
|
|
59
122
|
} else {
|
|
60
|
-
console.log(
|
|
61
|
-
DxE Suite — DGE / DDE / DRE toolkit manager
|
|
62
|
-
|
|
63
|
-
Usage:
|
|
64
|
-
npx dxe install 全toolkit をインストール
|
|
65
|
-
npx dxe install dge DGE のみ
|
|
66
|
-
npx dxe install dde dre DDE + DRE
|
|
67
|
-
npx dxe update 全toolkit をアップデート
|
|
68
|
-
npx dxe status インストール済みバージョンを表示
|
|
69
|
-
`);
|
|
123
|
+
console.log(M.help);
|
|
70
124
|
}
|