@indy2kro/agentenv 0.5.0 → 1.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/dist/adapters/base.d.ts +0 -6
- package/dist/adapters/base.d.ts.map +1 -1
- package/dist/adapters/base.js.map +1 -1
- package/dist/adapters/claude.js +2 -2
- package/dist/adapters/claude.js.map +1 -1
- package/dist/adapters/codex.d.ts.map +1 -1
- package/dist/adapters/codex.js +2 -1
- package/dist/adapters/codex.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +12 -6
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +18 -2
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/shell-fix.d.ts.map +1 -1
- package/dist/commands/shell-fix.js +2 -1
- package/dist/commands/shell-fix.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +2 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/config/schema.d.ts +3 -4
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +38 -111
- package/dist/config/schema.js.map +1 -1
- package/dist/generate/agentsmd.d.ts +9 -1
- package/dist/generate/agentsmd.d.ts.map +1 -1
- package/dist/generate/agentsmd.js +27 -15
- package/dist/generate/agentsmd.js.map +1 -1
- package/dist/integrations/superpowers.d.ts.map +1 -1
- package/dist/integrations/superpowers.js +6 -1
- package/dist/integrations/superpowers.js.map +1 -1
- package/dist/shell/detector.d.ts +1 -1
- package/dist/shell/detector.d.ts.map +1 -1
- package/dist/shell/detector.js +53 -18
- package/dist/shell/detector.js.map +1 -1
- package/dist/shell/shell-fix-state.d.ts +9 -1
- package/dist/shell/shell-fix-state.d.ts.map +1 -1
- package/dist/shell/shell-fix-state.js.map +1 -1
- package/dist/toolchain/fallbacks.d.ts +6 -64
- package/dist/toolchain/fallbacks.d.ts.map +1 -1
- package/dist/toolchain/fallbacks.js +6 -209
- package/dist/toolchain/fallbacks.js.map +1 -1
- package/dist/toolchain/mise.d.ts +15 -18
- package/dist/toolchain/mise.d.ts.map +1 -1
- package/dist/toolchain/mise.js +73 -128
- package/dist/toolchain/mise.js.map +1 -1
- package/dist/ui/output.d.ts +1 -3
- package/dist/ui/output.d.ts.map +1 -1
- package/dist/ui/output.js +1 -7
- package/dist/ui/output.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Toolchain Fallbacks
|
|
3
|
+
* Marks tools that cannot be installed via mise (tokei) and tools whose only
|
|
4
|
+
* mise backend refuses to resolve on certain platforms, as documented in
|
|
5
|
+
* phase0-windows-findings.md. The old per-platform install/verify/advice
|
|
6
|
+
* helpers were dead public surface and were removed — tool installation is
|
|
7
|
+
* delegated to mise or handled through `[[custom_tools]]`.
|
|
5
8
|
*/
|
|
6
|
-
import * as child_process from 'child_process';
|
|
7
|
-
/**
|
|
8
|
-
* Fallback tools that cannot be installed via mise
|
|
9
|
-
* Based on Phase 0 findings:
|
|
10
|
-
* - tokei: aqua:XAMPPRocky/tokei doesn't work, needs cargo:tokei (requires Rust)
|
|
11
|
-
*/
|
|
12
|
-
export const FALLBACK_TOOLS = {
|
|
13
|
-
tokei: {
|
|
14
|
-
name: 'tokei',
|
|
15
|
-
description: 'Fast LOC/code-statistics tool',
|
|
16
|
-
install: {
|
|
17
|
-
macos: ['brew install --quiet tokei'],
|
|
18
|
-
linux: ['cargo install --quiet tokei', 'sudo apt-get install -y tokei'],
|
|
19
|
-
windows: ['cargo install --quiet tokei', 'choco install tokei'],
|
|
20
|
-
},
|
|
21
|
-
verify: {
|
|
22
|
-
macos: ['command -v tokei', 'tokei --version'],
|
|
23
|
-
linux: ['command -v tokei', 'tokei --version'],
|
|
24
|
-
windows: ['where tokei', 'tokei --version'],
|
|
25
|
-
},
|
|
26
|
-
paths: {
|
|
27
|
-
macos: '/usr/local/bin/tokei',
|
|
28
|
-
linux: '~/.cargo/bin/tokei',
|
|
29
|
-
windows: '%USERPROFILE%\\.cargo\\bin\\tokei.exe',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
9
|
/**
|
|
34
10
|
* Tools that have special installation requirements
|
|
35
11
|
* These are marked as "Fallback required" in phase0-windows-findings.md
|
|
@@ -57,183 +33,4 @@ export const PLATFORM_UNSUPPORTED_TOOLS = {
|
|
|
57
33
|
export function isPlatformUnsupported(toolName, platform = process.platform) {
|
|
58
34
|
return PLATFORM_UNSUPPORTED_TOOLS[toolName]?.includes(platform) ?? false;
|
|
59
35
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Get the platform-specific installation command for a fallback tool
|
|
62
|
-
*/
|
|
63
|
-
export function getInstallCommand(toolName) {
|
|
64
|
-
const platform = process.platform;
|
|
65
|
-
const fallbackTool = FALLBACK_TOOLS[toolName];
|
|
66
|
-
if (!fallbackTool) {
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
if (platform === 'darwin') {
|
|
70
|
-
return fallbackTool.install.macos;
|
|
71
|
-
}
|
|
72
|
-
else if (platform === 'linux') {
|
|
73
|
-
return fallbackTool.install.linux;
|
|
74
|
-
}
|
|
75
|
-
else if (platform === 'win32') {
|
|
76
|
-
return fallbackTool.install.windows;
|
|
77
|
-
}
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Get the platform-specific verification command for a fallback tool
|
|
82
|
-
*/
|
|
83
|
-
export function getVerifyCommand(toolName) {
|
|
84
|
-
const platform = process.platform;
|
|
85
|
-
const fallbackTool = FALLBACK_TOOLS[toolName];
|
|
86
|
-
if (!fallbackTool) {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
if (platform === 'darwin') {
|
|
90
|
-
return fallbackTool.verify.macos;
|
|
91
|
-
}
|
|
92
|
-
else if (platform === 'linux') {
|
|
93
|
-
return fallbackTool.verify.linux;
|
|
94
|
-
}
|
|
95
|
-
else if (platform === 'win32') {
|
|
96
|
-
return fallbackTool.verify.windows;
|
|
97
|
-
}
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Check if a fallback tool is installed on the current platform
|
|
102
|
-
*/
|
|
103
|
-
export function isFallbackToolInstalled(toolName) {
|
|
104
|
-
const verifyCommands = getVerifyCommand(toolName);
|
|
105
|
-
if (!verifyCommands || verifyCommands.length === 0) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
// Try each verification command until one succeeds
|
|
110
|
-
for (const cmd of verifyCommands) {
|
|
111
|
-
const shell = process.platform === 'win32' ? 'cmd.exe' : 'sh';
|
|
112
|
-
const shellArgs = process.platform === 'win32' ? ['/c', cmd] : ['-c', cmd];
|
|
113
|
-
const result = child_process.spawnSync(shell, shellArgs, { stdio: 'ignore', shell: true });
|
|
114
|
-
if (result.status === 0)
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Install a fallback tool on the current platform
|
|
125
|
-
* Returns success status and any error message
|
|
126
|
-
*/
|
|
127
|
-
export function installFallbackTool(toolName) {
|
|
128
|
-
const installCommands = getInstallCommand(toolName);
|
|
129
|
-
if (!installCommands || installCommands.length === 0) {
|
|
130
|
-
return {
|
|
131
|
-
success: false,
|
|
132
|
-
message: `No installation commands defined for ${toolName} on ${process.platform}`,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
const fallbackTool = FALLBACK_TOOLS[toolName];
|
|
136
|
-
try {
|
|
137
|
-
// Try each installation command until one succeeds
|
|
138
|
-
for (const cmd of installCommands) {
|
|
139
|
-
try {
|
|
140
|
-
const shell = process.platform === 'win32' ? 'cmd.exe' : 'sh';
|
|
141
|
-
const shellArgs = process.platform === 'win32' ? ['/c', cmd] : ['-c', cmd];
|
|
142
|
-
child_process.spawnSync(shell, shellArgs, { stdio: 'inherit', shell: true });
|
|
143
|
-
// Verify installation was successful
|
|
144
|
-
if (isFallbackToolInstalled(toolName)) {
|
|
145
|
-
return {
|
|
146
|
-
success: true,
|
|
147
|
-
message: `Successfully installed ${fallbackTool?.description || toolName} via: ${cmd}`,
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
catch {
|
|
152
|
-
// Try the next command
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return {
|
|
157
|
-
success: false,
|
|
158
|
-
message: `Failed to install ${fallbackTool?.description || toolName}. Tried all available installation methods.`,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
catch (err) {
|
|
162
|
-
return {
|
|
163
|
-
success: false,
|
|
164
|
-
message: `Error installing ${fallbackTool?.description || toolName}: ${err}`,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Get the expected path for a fallback tool on the current platform
|
|
170
|
-
*/
|
|
171
|
-
export function getFallbackToolPath(toolName) {
|
|
172
|
-
const platform = process.platform;
|
|
173
|
-
const fallbackTool = FALLBACK_TOOLS[toolName];
|
|
174
|
-
if (!fallbackTool || !fallbackTool.paths) {
|
|
175
|
-
return undefined;
|
|
176
|
-
}
|
|
177
|
-
if (platform === 'darwin' && fallbackTool.paths.macos) {
|
|
178
|
-
return fallbackTool.paths.macos;
|
|
179
|
-
}
|
|
180
|
-
else if (platform === 'linux' && fallbackTool.paths.linux) {
|
|
181
|
-
return fallbackTool.paths.linux;
|
|
182
|
-
}
|
|
183
|
-
else if (platform === 'win32' && fallbackTool.paths.windows) {
|
|
184
|
-
return fallbackTool.paths.windows;
|
|
185
|
-
}
|
|
186
|
-
return undefined;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Generate platform-specific advice for installing a fallback tool
|
|
190
|
-
*/
|
|
191
|
-
export function getFallbackInstallationAdvice(toolName) {
|
|
192
|
-
const platform = process.platform;
|
|
193
|
-
const fallbackTool = FALLBACK_TOOLS[toolName];
|
|
194
|
-
if (!fallbackTool) {
|
|
195
|
-
return `Tool ${toolName} requires manual installation. Please install it according to your platform's package manager.`;
|
|
196
|
-
}
|
|
197
|
-
const installCommands = getInstallCommand(toolName);
|
|
198
|
-
if (platform === 'darwin') {
|
|
199
|
-
return `To install ${fallbackTool.description} on macOS, run: ${installCommands?.join(' or ')}`;
|
|
200
|
-
}
|
|
201
|
-
else if (platform === 'linux') {
|
|
202
|
-
return `To install ${fallbackTool.description} on Linux, run: ${installCommands?.join(' or ')}`;
|
|
203
|
-
}
|
|
204
|
-
else if (platform === 'win32') {
|
|
205
|
-
return `To install ${fallbackTool.description} on Windows, run: ${installCommands?.join(' or ')}`;
|
|
206
|
-
}
|
|
207
|
-
return `Tool ${toolName} requires manual installation.`;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Generate custom tool configuration for fallback tools
|
|
211
|
-
* This can be used when generating agentenv.toml for tools that need fallbacks
|
|
212
|
-
*/
|
|
213
|
-
export function generateFallbackCustomToolConfig(toolName) {
|
|
214
|
-
const fallbackTool = FALLBACK_TOOLS[toolName];
|
|
215
|
-
if (!fallbackTool) {
|
|
216
|
-
return '';
|
|
217
|
-
}
|
|
218
|
-
const lines = [];
|
|
219
|
-
lines.push(`# ${fallbackTool.description}`);
|
|
220
|
-
lines.push(`# Platform-specific fallback installation required`);
|
|
221
|
-
lines.push(`# macOS: ${fallbackTool.install.macos.join(' or ')}`);
|
|
222
|
-
lines.push(`# Linux: ${fallbackTool.install.linux.join(' or ')}`);
|
|
223
|
-
lines.push(`# Windows: ${fallbackTool.install.windows.join(' or ')}`);
|
|
224
|
-
lines.push(`[[custom_tools]]`);
|
|
225
|
-
lines.push(`name = "${toolName}"`);
|
|
226
|
-
lines.push(`description = "${fallbackTool.description}"`);
|
|
227
|
-
lines.push(`already_installed = true`);
|
|
228
|
-
if (fallbackTool.paths.macos) {
|
|
229
|
-
lines.push(`path.macos = "${fallbackTool.paths.macos}"`);
|
|
230
|
-
}
|
|
231
|
-
if (fallbackTool.paths.linux) {
|
|
232
|
-
lines.push(`path.linux = "${fallbackTool.paths.linux}"`);
|
|
233
|
-
}
|
|
234
|
-
if (fallbackTool.paths.windows) {
|
|
235
|
-
lines.push(`path.windows = "${fallbackTool.paths.windows}"`);
|
|
236
|
-
}
|
|
237
|
-
return lines.join('\n');
|
|
238
|
-
}
|
|
239
36
|
//# sourceMappingURL=fallbacks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallbacks.js","sourceRoot":"","sources":["../../src/toolchain/fallbacks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fallbacks.js","sourceRoot":"","sources":["../../src/toolchain/fallbacks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAO,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,uBAAuB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAsC;IAC3E,WAAW,EAAE,CAAC,OAAO,CAAC;IACtB,KAAK,EAAE,CAAC,OAAO,CAAC;CACjB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,UAAU,qBAAqB,CACnC,QAAgB,EAChB,WAA4B,OAAO,CAAC,QAAQ;IAE5C,OAAO,0BAA0B,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC;AAC3E,CAAC"}
|
package/dist/toolchain/mise.d.ts
CHANGED
|
@@ -13,11 +13,6 @@ export interface MiseTool {
|
|
|
13
13
|
tier: number;
|
|
14
14
|
category: string;
|
|
15
15
|
}
|
|
16
|
-
export interface MiseConfig {
|
|
17
|
-
tools: Record<string, string>;
|
|
18
|
-
env?: Record<string, string>;
|
|
19
|
-
settings?: Record<string, any>;
|
|
20
|
-
}
|
|
21
16
|
/**
|
|
22
17
|
* Tools agentenv invokes directly are pinned to versions we have verified;
|
|
23
18
|
* everything else resolves to latest. rtk is invoked by agentenv's delegation
|
|
@@ -80,11 +75,25 @@ export declare function upsertShimsDir(content: string, dir: string): string;
|
|
|
80
75
|
* config, or null when it is absent. Used by `agentenv doctor`.
|
|
81
76
|
*/
|
|
82
77
|
export declare function getShimsDirValue(content: string): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Remove the `shims_dir` line that upsertShimsDir writes and, if that leaves
|
|
80
|
+
* the `[settings]` section with no other keys, the section header too ("other
|
|
81
|
+
* keys" means any non-empty line between the header and the next section).
|
|
82
|
+
* Returns the content unchanged when no `shims_dir` line is present. Surgical
|
|
83
|
+
* counterpart to upsertShimsDir, used by `shell-fix --revert`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function removeShimsDirValue(content: string): string;
|
|
83
86
|
/**
|
|
84
87
|
* Ensure mise's GLOBAL config declares the shims_dir agentenv relies on, and
|
|
85
88
|
* tell the user whether the shims dir is actually on PATH. Idempotent.
|
|
89
|
+
*
|
|
90
|
+
* When `statePath` is given, a change made here is recorded in the shell-fix
|
|
91
|
+
* manifest (agent `mise`) so `agentenv shell-fix --revert` can undo it. The
|
|
92
|
+
* existing manifest's bashExe is preserved when merging so a Tier 0 entry and
|
|
93
|
+
* the mise entry coexist in one apply run without clobbering each other's
|
|
94
|
+
* revert comparison value.
|
|
86
95
|
*/
|
|
87
|
-
export declare function ensureGlobalShimsDir(): {
|
|
96
|
+
export declare function ensureGlobalShimsDir(statePath?: string): {
|
|
88
97
|
success: boolean;
|
|
89
98
|
message: string;
|
|
90
99
|
};
|
|
@@ -172,7 +181,6 @@ export interface MiseCapturedOutput {
|
|
|
172
181
|
status: number | null;
|
|
173
182
|
stdout: string;
|
|
174
183
|
stderr: string;
|
|
175
|
-
blockedWarn: boolean;
|
|
176
184
|
}
|
|
177
185
|
/**
|
|
178
186
|
* Run a single mise command with args passed as an array (never a
|
|
@@ -193,8 +201,6 @@ export declare function isMiseInstalled(): boolean;
|
|
|
193
201
|
* installed version, so it is dropped here).
|
|
194
202
|
*/
|
|
195
203
|
export declare function getMiseVersion(): string;
|
|
196
|
-
/** Alias used by prereq/status/doctor so version probes never surface mise WARN. */
|
|
197
|
-
export declare function getMiseVersionSilent(): string;
|
|
198
204
|
/**
|
|
199
205
|
* Check if a specific tool is installed via mise
|
|
200
206
|
*/
|
|
@@ -389,13 +395,4 @@ export declare function parseInstalledToolState(raw: string): Record<string, Ins
|
|
|
389
395
|
* output (or an absent mise) yields an empty map rather than `null`.
|
|
390
396
|
*/
|
|
391
397
|
export declare function getInstalledToolState(raw?: string, opts?: RunMiseCapturedOptions): Record<string, InstalledToolState>;
|
|
392
|
-
/**
|
|
393
|
-
* Parse existing mise.toml file
|
|
394
|
-
*/
|
|
395
|
-
export declare function parseMiseToml(filePath: string): MiseConfig | null;
|
|
396
|
-
/**
|
|
397
|
-
* Merge existing mise.toml with new tools
|
|
398
|
-
* Preserves existing tools that are not in the new config
|
|
399
|
-
*/
|
|
400
|
-
export declare function mergeMiseConfigs(existing: MiseConfig | null, newConfig: MiseConfig): MiseConfig;
|
|
401
398
|
//# sourceMappingURL=mise.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mise.d.ts","sourceRoot":"","sources":["../../src/toolchain/mise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,cAAc,EAAqC,MAAM,qBAAqB,CAAC;AAGxF,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,g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10
10
|
import { resolveBinary } from '../adapters/detect.js';
|
|
11
11
|
import { writeFileWithVerify } from '../utils/fs-retry.js';
|
|
12
12
|
import { FALLBACK_REQUIRED_TOOLS, isPlatformUnsupported, requiresFallback } from './fallbacks.js';
|
|
13
|
+
import { mergeShellFixEntries, readShellFixState, writeShellFixState, } from '../shell/shell-fix-state.js';
|
|
13
14
|
// Tool to mise name mappings
|
|
14
15
|
export const MISE_TOOL_NAMES = {
|
|
15
16
|
ripgrep: 'ripgrep',
|
|
@@ -45,6 +46,9 @@ export const MISE_TOOL_NAMES = {
|
|
|
45
46
|
tealdeer: 'tealdeer',
|
|
46
47
|
duckdb: 'duckdb',
|
|
47
48
|
qsv: 'qsv',
|
|
49
|
+
taplo: 'taplo',
|
|
50
|
+
hadolint: 'hadolint',
|
|
51
|
+
trivy: 'trivy',
|
|
48
52
|
};
|
|
49
53
|
// Tools that cannot be installed via mise and require fallback
|
|
50
54
|
// Based on Phase 0 findings: tokei is not in the mise registry (needs cargo backend)
|
|
@@ -229,19 +233,64 @@ export function getShimsDirValue(content) {
|
|
|
229
233
|
}
|
|
230
234
|
return null;
|
|
231
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Remove the `shims_dir` line that upsertShimsDir writes and, if that leaves
|
|
238
|
+
* the `[settings]` section with no other keys, the section header too ("other
|
|
239
|
+
* keys" means any non-empty line between the header and the next section).
|
|
240
|
+
* Returns the content unchanged when no `shims_dir` line is present. Surgical
|
|
241
|
+
* counterpart to upsertShimsDir, used by `shell-fix --revert`.
|
|
242
|
+
*/
|
|
243
|
+
export function removeShimsDirValue(content) {
|
|
244
|
+
const lines = content.split(/\r?\n/);
|
|
245
|
+
const shimsIdx = lines.findIndex((line) => /^\s*shims_dir\s*=/.test(line.trim()));
|
|
246
|
+
if (shimsIdx === -1)
|
|
247
|
+
return content;
|
|
248
|
+
lines.splice(shimsIdx, 1);
|
|
249
|
+
const headerIdx = lines.findIndex((line) => /^\s*\[settings\]\s*$/.test(line.trim()));
|
|
250
|
+
if (headerIdx !== -1) {
|
|
251
|
+
let empty = true;
|
|
252
|
+
for (let i = headerIdx + 1; i < lines.length; i++) {
|
|
253
|
+
const trimmed = lines[i].trim();
|
|
254
|
+
if (/^\s*\[.*\]$/.test(trimmed))
|
|
255
|
+
break;
|
|
256
|
+
if (trimmed !== '') {
|
|
257
|
+
empty = false;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (empty) {
|
|
262
|
+
lines.splice(headerIdx, 1);
|
|
263
|
+
if (lines[headerIdx]?.trim() === '')
|
|
264
|
+
lines.splice(headerIdx, 1);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
while (lines.length > 0 && lines[lines.length - 1].trim() === '')
|
|
268
|
+
lines.pop();
|
|
269
|
+
return lines.length > 0 ? `${lines.join('\n')}\n` : '';
|
|
270
|
+
}
|
|
232
271
|
/**
|
|
233
272
|
* Ensure mise's GLOBAL config declares the shims_dir agentenv relies on, and
|
|
234
273
|
* tell the user whether the shims dir is actually on PATH. Idempotent.
|
|
274
|
+
*
|
|
275
|
+
* When `statePath` is given, a change made here is recorded in the shell-fix
|
|
276
|
+
* manifest (agent `mise`) so `agentenv shell-fix --revert` can undo it. The
|
|
277
|
+
* existing manifest's bashExe is preserved when merging so a Tier 0 entry and
|
|
278
|
+
* the mise entry coexist in one apply run without clobbering each other's
|
|
279
|
+
* revert comparison value.
|
|
235
280
|
*/
|
|
236
|
-
export function ensureGlobalShimsDir() {
|
|
281
|
+
export function ensureGlobalShimsDir(statePath) {
|
|
237
282
|
const dir = shimsDir();
|
|
238
283
|
const configPath = miseGlobalConfigPath();
|
|
239
284
|
try {
|
|
240
285
|
fs.mkdirSync(miseGlobalConfigDir(), { recursive: true });
|
|
241
286
|
const existing = fs.existsSync(configPath) ? fs.readFileSync(configPath, 'utf-8') : '';
|
|
242
287
|
const updated = upsertShimsDir(existing, dir);
|
|
243
|
-
if (updated !== existing)
|
|
288
|
+
if (updated !== existing) {
|
|
244
289
|
fs.writeFileSync(configPath, updated);
|
|
290
|
+
if (statePath) {
|
|
291
|
+
recordShimsDirState(configPath, existing, tomlPath(dir), statePath);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
245
294
|
const pathLine = shimsDirOnPath()
|
|
246
295
|
? `${dir} is on PATH`
|
|
247
296
|
: `Add ${dir} to PATH so the shims resolve (Windows: System Properties > Environment Variables > Path)`;
|
|
@@ -267,6 +316,28 @@ export function ensureGlobalShimsDir() {
|
|
|
267
316
|
function tomlPath(p) {
|
|
268
317
|
return p.replace(/\\/g, '/');
|
|
269
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Record a mise shims_dir write in the shell-fix manifest, preserving the
|
|
321
|
+
* existing manifest's bashExe so Tier 0 entries keep comparing against the
|
|
322
|
+
* git-bash path they were written with. Advisory: a recording failure must
|
|
323
|
+
* never fail the (already-successful) shims config itself.
|
|
324
|
+
*/
|
|
325
|
+
function recordShimsDirState(configPath, existing, setValue, statePath) {
|
|
326
|
+
try {
|
|
327
|
+
const existingState = readShellFixState(statePath);
|
|
328
|
+
writeShellFixState(mergeShellFixEntries(existingState, [
|
|
329
|
+
{
|
|
330
|
+
agent: 'mise',
|
|
331
|
+
file: configPath,
|
|
332
|
+
createdFile: existing === '',
|
|
333
|
+
fields: [{ key: 'shims_dir', previous: getShimsDirValue(existing), set: setValue }],
|
|
334
|
+
},
|
|
335
|
+
], existingState?.bashExe ?? setValue), statePath);
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
// Recording is advisory; the fix itself already succeeded.
|
|
339
|
+
}
|
|
340
|
+
}
|
|
270
341
|
/**
|
|
271
342
|
* Save mise.toml to a file
|
|
272
343
|
*/
|
|
@@ -422,7 +493,6 @@ export function runMiseCaptured(args, opts = {}) {
|
|
|
422
493
|
status: null,
|
|
423
494
|
stdout: '',
|
|
424
495
|
stderr: err instanceof Error ? err.message : String(err),
|
|
425
|
-
blockedWarn: false,
|
|
426
496
|
};
|
|
427
497
|
}
|
|
428
498
|
const stderr = result.error ? result.error.message : (result.stderr ?? '');
|
|
@@ -430,7 +500,6 @@ export function runMiseCaptured(args, opts = {}) {
|
|
|
430
500
|
status: result.status,
|
|
431
501
|
stdout: result.stdout ?? '',
|
|
432
502
|
stderr,
|
|
433
|
-
blockedWarn: /warn|self-update|version .* available/i.test(stderr),
|
|
434
503
|
};
|
|
435
504
|
}
|
|
436
505
|
/**
|
|
@@ -450,10 +519,6 @@ export function getMiseVersion() {
|
|
|
450
519
|
const version = result.stdout.trim();
|
|
451
520
|
return result.status === 0 && version !== '' ? version : 'unknown';
|
|
452
521
|
}
|
|
453
|
-
/** Alias used by prereq/status/doctor so version probes never surface mise WARN. */
|
|
454
|
-
export function getMiseVersionSilent() {
|
|
455
|
-
return getMiseVersion();
|
|
456
|
-
}
|
|
457
522
|
/**
|
|
458
523
|
* Check if a specific tool is installed via mise
|
|
459
524
|
*/
|
|
@@ -883,124 +948,4 @@ export function parseInstalledToolState(raw) {
|
|
|
883
948
|
export function getInstalledToolState(raw, opts = {}) {
|
|
884
949
|
return parseInstalledToolState(raw ?? runMiseCaptured(['ls', '--json'], opts).stdout) ?? {};
|
|
885
950
|
}
|
|
886
|
-
/**
|
|
887
|
-
* Parse existing mise.toml file
|
|
888
|
-
*/
|
|
889
|
-
export function parseMiseToml(filePath) {
|
|
890
|
-
try {
|
|
891
|
-
if (!fs.existsSync(filePath)) {
|
|
892
|
-
return null;
|
|
893
|
-
}
|
|
894
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
895
|
-
return parseToml(content);
|
|
896
|
-
}
|
|
897
|
-
catch {
|
|
898
|
-
return null;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* Simple TOML parser helper
|
|
903
|
-
*/
|
|
904
|
-
function parseToml(content) {
|
|
905
|
-
const result = {};
|
|
906
|
-
let currentTable = result;
|
|
907
|
-
const lines = content.split('\n');
|
|
908
|
-
for (const line of lines) {
|
|
909
|
-
const trimmed = line.trim();
|
|
910
|
-
// Skip comments and empty lines
|
|
911
|
-
if (trimmed === '' || trimmed.startsWith('#')) {
|
|
912
|
-
continue;
|
|
913
|
-
}
|
|
914
|
-
// Section header
|
|
915
|
-
if (trimmed.startsWith('[') && trimmed.endsWith(']')) {
|
|
916
|
-
const section = trimmed.slice(1, -1);
|
|
917
|
-
if (section.includes('.')) {
|
|
918
|
-
// Nested section
|
|
919
|
-
const parts = section.split('.');
|
|
920
|
-
let parent = result;
|
|
921
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
922
|
-
if (!parent[parts[i]]) {
|
|
923
|
-
parent[parts[i]] = {};
|
|
924
|
-
}
|
|
925
|
-
parent = parent[parts[i]];
|
|
926
|
-
}
|
|
927
|
-
currentTable = parent;
|
|
928
|
-
}
|
|
929
|
-
else {
|
|
930
|
-
if (!result[section]) {
|
|
931
|
-
result[section] = {};
|
|
932
|
-
}
|
|
933
|
-
currentTable = result[section];
|
|
934
|
-
}
|
|
935
|
-
continue;
|
|
936
|
-
}
|
|
937
|
-
// Key-value pair
|
|
938
|
-
const equalsIndex = trimmed.indexOf('=');
|
|
939
|
-
if (equalsIndex > 0) {
|
|
940
|
-
const key = trimmed.slice(0, equalsIndex).trim();
|
|
941
|
-
const value = trimmed.slice(equalsIndex + 1).trim();
|
|
942
|
-
// Remove quotes if present
|
|
943
|
-
let cleanValue = value;
|
|
944
|
-
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
945
|
-
(value.startsWith("'") && value.endsWith("'"))) {
|
|
946
|
-
cleanValue = value.slice(1, -1);
|
|
947
|
-
}
|
|
948
|
-
// Parse boolean
|
|
949
|
-
if (cleanValue.toLowerCase() === 'true') {
|
|
950
|
-
cleanValue = true;
|
|
951
|
-
}
|
|
952
|
-
else if (cleanValue.toLowerCase() === 'false') {
|
|
953
|
-
cleanValue = false;
|
|
954
|
-
}
|
|
955
|
-
// Parse number
|
|
956
|
-
if (!isNaN(Number(cleanValue))) {
|
|
957
|
-
cleanValue = Number(cleanValue);
|
|
958
|
-
}
|
|
959
|
-
currentTable[key] = cleanValue;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
return result;
|
|
963
|
-
}
|
|
964
|
-
/**
|
|
965
|
-
* Merge existing mise.toml with new tools
|
|
966
|
-
* Preserves existing tools that are not in the new config
|
|
967
|
-
*/
|
|
968
|
-
export function mergeMiseConfigs(existing, newConfig) {
|
|
969
|
-
const result = {
|
|
970
|
-
tools: { ...newConfig.tools },
|
|
971
|
-
env: { ...newConfig.env },
|
|
972
|
-
settings: { ...newConfig.settings },
|
|
973
|
-
};
|
|
974
|
-
if (existing) {
|
|
975
|
-
// Merge tools - preserve existing versions if not in new config
|
|
976
|
-
for (const [tool, version] of Object.entries(existing.tools || {})) {
|
|
977
|
-
if (!result.tools[tool]) {
|
|
978
|
-
result.tools[tool] = version;
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
// Merge env
|
|
982
|
-
if (existing.env) {
|
|
983
|
-
for (const [key, value] of Object.entries(existing.env)) {
|
|
984
|
-
if (!result.env || !result.env[key]) {
|
|
985
|
-
if (!result.env) {
|
|
986
|
-
result.env = {};
|
|
987
|
-
}
|
|
988
|
-
result.env[key] = value;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
// Merge settings
|
|
993
|
-
if (existing.settings) {
|
|
994
|
-
for (const [key, value] of Object.entries(existing.settings)) {
|
|
995
|
-
if (!result.settings || result.settings[key] === undefined) {
|
|
996
|
-
if (!result.settings) {
|
|
997
|
-
result.settings = {};
|
|
998
|
-
}
|
|
999
|
-
result.settings[key] = value;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
return result;
|
|
1005
|
-
}
|
|
1006
951
|
//# sourceMappingURL=mise.js.map
|