@unlaxer/dxe-suite 0.1.2 → 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.
Files changed (2) hide show
  1. package/bin/dxe.js +83 -22
  2. 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: { pkg: '@unlaxer/dge-toolkit', install: 'dge-install', update: 'dge-update' },
15
- dde: { pkg: '@unlaxer/dde-toolkit', install: 'dde-install', update: 'dde-update' },
16
- dre: { pkg: '@unlaxer/dre-toolkit', install: 'dre-install', update: 'dre-update' },
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 [,, command, ...args] = process.argv;
20
- const targets = args.length > 0 ? args : Object.keys(TOOLKITS);
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}`);
@@ -25,20 +88,27 @@ function run(cmd) {
25
88
  }
26
89
 
27
90
  if (command === 'install') {
91
+ const installed = [];
28
92
  for (const name of targets) {
29
93
  const tk = TOOLKITS[name];
30
- if (!tk) { console.error(`Unknown toolkit: ${name}`); process.exit(1); }
31
- console.log(`\n[${name.toUpperCase()}] installing...`);
94
+ if (!tk) { console.error(M.unknownToolkit(name)); process.exit(1); }
95
+ console.log(M.installing(name.toUpperCase()));
32
96
  run(`npm install ${tk.pkg}`);
33
- run(`npx ${tk.install}`);
97
+ run(`npx ${tk.install} --lang=${lang}`);
98
+ installed.push(tk);
34
99
  }
100
+ console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
101
+ for (const tk of installed) {
102
+ console.log(M.agentHint(tk.desc[lang], tk.phrase[lang]));
103
+ }
104
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
35
105
  } else if (command === 'update') {
36
106
  for (const name of targets) {
37
107
  const tk = TOOLKITS[name];
38
- if (!tk) { console.error(`Unknown toolkit: ${name}`); process.exit(1); }
39
- console.log(`\n[${name.toUpperCase()}] updating...`);
108
+ if (!tk) { console.error(M.unknownToolkit(name)); process.exit(1); }
109
+ console.log(M.updating(name.toUpperCase()));
40
110
  run(`npm install ${tk.pkg}@latest`);
41
- run(`npx ${tk.update}`);
111
+ run(`npx ${tk.update} --lang=${lang}`);
42
112
  }
43
113
  } else if (command === 'status') {
44
114
  for (const [name, tk] of Object.entries(TOOLKITS)) {
@@ -46,18 +116,9 @@ if (command === 'install') {
46
116
  const pkg = require(path.join(process.cwd(), 'node_modules', tk.pkg, 'package.json'));
47
117
  console.log(` ${name.toUpperCase()}: ${pkg.version}`);
48
118
  } catch {
49
- console.log(` ${name.toUpperCase()}: not installed`);
119
+ console.log(` ${name.toUpperCase()}: ${M.notInstalled}`);
50
120
  }
51
121
  }
52
122
  } else {
53
- console.log(`
54
- DxE Suite — DGE / DDE / DRE toolkit manager
55
-
56
- Usage:
57
- npx dxe install 全toolkit をインストール
58
- npx dxe install dge DGE のみ
59
- npx dxe install dde dre DDE + DRE
60
- npx dxe update 全toolkit をアップデート
61
- npx dxe status インストール済みバージョンを表示
62
- `);
123
+ console.log(M.help);
63
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unlaxer/dxe-suite",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "DxE Suite — DGE / DDE / DRE toolkit を一括インストール・管理するスイートパッケージ",
5
5
  "license": "MIT",
6
6
  "repository": {