@dmsdc-ai/aterm 0.1.11 → 0.1.13

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/aterm.js CHANGED
@@ -4,9 +4,12 @@ import path from 'node:path';
4
4
  import { spawn } from 'node:child_process';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import {
7
+ detectAiCliStatus,
7
8
  ensureUserLayout,
8
9
  getUserAtermConfigPath,
9
10
  resolveAigentryConfig,
11
+ resolveInstallHomeDir,
12
+ updateConfigFile,
10
13
  } from '../lib/aigentry.js';
11
14
 
12
15
  const __filename = fileURLToPath(import.meta.url);
@@ -76,11 +79,67 @@ async function maybeRunFirstRunWizard() {
76
79
  await wizardModule.completeFirstRunWizard(context, wizardResult);
77
80
  }
78
81
 
82
+ async function maybeRunConfigMigration() {
83
+ const configPath = getUserAtermConfigPath();
84
+ if (!fs.existsSync(configPath)) return;
85
+
86
+ let config;
87
+ try {
88
+ config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
89
+ } catch { return; }
90
+
91
+ if (!config.setupCompleted) return;
92
+
93
+ const isTTY = process.stdin.isTTY && process.stdout.isTTY;
94
+ const cliStatus = detectAiCliStatus(resolveInstallHomeDir());
95
+ const patch = {};
96
+ const questions = [];
97
+
98
+ // Check each field individually — users from any version get prompted only for THEIR missing fields
99
+ if (!config.ai?.defaultCLI) {
100
+ questions.push({
101
+ type: 'select',
102
+ name: 'defaultCLI',
103
+ message: 'Default AI CLI for orchestrator workspace',
104
+ choices: [
105
+ { title: 'claude', value: 'claude', disabled: !cliStatus.claude },
106
+ { title: 'codex', value: 'codex', disabled: !cliStatus.codex },
107
+ { title: 'gemini', value: 'gemini', disabled: !cliStatus.gemini },
108
+ { title: 'none (plain zsh)', value: 'none' },
109
+ ],
110
+ initial: cliStatus.claude ? 0 : cliStatus.codex ? 1 : cliStatus.gemini ? 2 : 3,
111
+ });
112
+ }
113
+
114
+ if (questions.length === 0) return;
115
+
116
+ if (isTTY) {
117
+ try {
118
+ const prompts = (await import('prompts')).default;
119
+ const responses = await prompts(questions);
120
+ if (responses.defaultCLI) {
121
+ patch.ai = { ...config.ai, defaultCLI: responses.defaultCLI };
122
+ }
123
+ } catch { /* fall through to auto-detect */ }
124
+ }
125
+
126
+ // Auto-fill any fields not answered via prompt
127
+ if (!patch.ai?.defaultCLI && !config.ai?.defaultCLI) {
128
+ const auto = cliStatus.claude ? 'claude' : cliStatus.codex ? 'codex' : cliStatus.gemini ? 'gemini' : 'none';
129
+ patch.ai = { ...config.ai, ...patch.ai, defaultCLI: auto };
130
+ }
131
+
132
+ if (Object.keys(patch).length > 0) {
133
+ updateConfigFile(configPath, patch);
134
+ }
135
+ }
136
+
79
137
  if (process.argv.includes('--version') || process.argv.includes('-v')) {
80
138
  printVersionAndExit();
81
139
  }
82
140
 
83
141
  await maybeRunFirstRunWizard();
142
+ await maybeRunConfigMigration();
84
143
  const resolvedConfig = resolveAigentryConfig({ cwd: process.cwd() });
85
144
 
86
145
  if (!fs.existsSync(executable)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aterm",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Native aterm launcher package",
5
5
  "type": "module",
6
6
  "main": "./bin/aterm.js",
@@ -17,11 +17,12 @@
17
17
  "package.json"
18
18
  ],
19
19
  "optionalDependencies": {
20
- "@dmsdc-ai/aterm-darwin-arm64": "0.1.11"
20
+ "@dmsdc-ai/aterm-darwin-arm64": "0.1.13"
21
21
  },
22
22
  "dependencies": {
23
23
  "@dmsdc-ai/aigentry-brain": "latest",
24
24
  "@dmsdc-ai/aigentry-deliberation": "latest",
25
+ "@dmsdc-ai/aigentry-devkit": "latest",
25
26
  "@dmsdc-ai/aigentry-telepty": "latest",
26
27
  "blessed": "^0.1.81",
27
28
  "prompts": "^2.4.2"
@@ -146,10 +146,28 @@ function installNativeBundle() {
146
146
 
147
147
  }
148
148
 
149
+ function runDevkitBootstrap() {
150
+ try {
151
+ const devkitPath = require.resolve('@dmsdc-ai/aigentry-devkit');
152
+ const devkitRoot = path.dirname(devkitPath);
153
+ const bootstrapPath = path.join(devkitRoot, 'bootstrap.js');
154
+ if (fs.existsSync(bootstrapPath)) {
155
+ const { execFileSync } = require('node:child_process');
156
+ execFileSync(process.execPath, [bootstrapPath], {
157
+ stdio: 'inherit',
158
+ env: { ...process.env, AIGENTRY_HOME: resolveInstallHomeDir() },
159
+ });
160
+ }
161
+ } catch {
162
+ // devkit bootstrap is best-effort; don't block install
163
+ }
164
+ }
165
+
149
166
  function main() {
150
167
  const plan = buildDefaultPlan();
151
168
  applyInstallPlan(plan);
152
169
  installNativeBundle();
170
+ runDevkitBootstrap();
153
171
  }
154
172
 
155
173
  main();