@indy2kro/agentenv 1.0.0 → 1.0.2
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/agent-dirs.d.ts +29 -0
- package/dist/adapters/agent-dirs.d.ts.map +1 -0
- package/dist/adapters/agent-dirs.js +46 -0
- package/dist/adapters/agent-dirs.js.map +1 -0
- package/dist/adapters/base.d.ts +7 -1
- package/dist/adapters/base.d.ts.map +1 -1
- package/dist/adapters/base.js.map +1 -1
- package/dist/adapters/claude.d.ts.map +1 -1
- package/dist/adapters/claude.js +18 -10
- package/dist/adapters/claude.js.map +1 -1
- package/dist/adapters/cline.d.ts.map +1 -1
- package/dist/adapters/cline.js +2 -2
- package/dist/adapters/cline.js.map +1 -1
- package/dist/adapters/codex.d.ts.map +1 -1
- package/dist/adapters/codex.js +3 -2
- package/dist/adapters/codex.js.map +1 -1
- package/dist/adapters/copilot.d.ts.map +1 -1
- package/dist/adapters/copilot.js +3 -4
- package/dist/adapters/copilot.js.map +1 -1
- package/dist/adapters/cursor.d.ts.map +1 -1
- package/dist/adapters/cursor.js +7 -6
- package/dist/adapters/cursor.js.map +1 -1
- package/dist/adapters/detect.d.ts.map +1 -1
- package/dist/adapters/detect.js +1 -0
- package/dist/adapters/detect.js.map +1 -1
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +2 -2
- package/dist/adapters/gemini.js.map +1 -1
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +21 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/opencode.d.ts.map +1 -1
- package/dist/adapters/opencode.js +2 -2
- package/dist/adapters/opencode.js.map +1 -1
- package/dist/adapters/rtk-delegation.d.ts.map +1 -1
- package/dist/adapters/rtk-delegation.js +16 -1
- package/dist/adapters/rtk-delegation.js.map +1 -1
- package/dist/adapters/vibe.d.ts.map +1 -1
- package/dist/adapters/vibe.js +2 -2
- package/dist/adapters/vibe.js.map +1 -1
- package/dist/adapters/windsurf.d.ts.map +1 -1
- package/dist/adapters/windsurf.js +2 -2
- package/dist/adapters/windsurf.js.map +1 -1
- package/dist/cli/exit.d.ts +17 -6
- package/dist/cli/exit.d.ts.map +1 -1
- package/dist/cli/exit.js +17 -7
- package/dist/cli/exit.js.map +1 -1
- package/dist/commands/apply.d.ts +77 -0
- package/dist/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +202 -27
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/config-edit.d.ts +33 -0
- package/dist/commands/config-edit.d.ts.map +1 -0
- package/dist/commands/config-edit.js +216 -0
- package/dist/commands/config-edit.js.map +1 -0
- package/dist/commands/doctor.d.ts +41 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +135 -52
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/setup.d.ts +4 -0
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +58 -5
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +40 -16
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/uninstall.d.ts +78 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +329 -31
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts +51 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +172 -71
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/wizard.d.ts +27 -1
- package/dist/commands/wizard.d.ts.map +1 -1
- package/dist/commands/wizard.js +48 -31
- package/dist/commands/wizard.js.map +1 -1
- package/dist/config/schema.d.ts +31 -3
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +224 -123
- package/dist/config/schema.js.map +1 -1
- package/dist/config/scopes.d.ts +4 -2
- package/dist/config/scopes.d.ts.map +1 -1
- package/dist/config/scopes.js +23 -4
- package/dist/config/scopes.js.map +1 -1
- package/dist/generate/agentsmd.d.ts +54 -0
- package/dist/generate/agentsmd.d.ts.map +1 -1
- package/dist/generate/agentsmd.js +225 -143
- package/dist/generate/agentsmd.js.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/integrations/render.d.ts.map +1 -1
- package/dist/integrations/render.js +25 -10
- package/dist/integrations/render.js.map +1 -1
- package/dist/integrations/superpowers.d.ts.map +1 -1
- package/dist/integrations/superpowers.js +2 -0
- package/dist/integrations/superpowers.js.map +1 -1
- package/dist/shell/detector.d.ts +22 -2
- package/dist/shell/detector.d.ts.map +1 -1
- package/dist/shell/detector.js +122 -34
- package/dist/shell/detector.js.map +1 -1
- package/dist/toolchain/gh.d.ts.map +1 -1
- package/dist/toolchain/gh.js +1 -0
- package/dist/toolchain/gh.js.map +1 -1
- package/dist/toolchain/mise.d.ts +7 -0
- package/dist/toolchain/mise.d.ts.map +1 -1
- package/dist/toolchain/mise.js +23 -3
- package/dist/toolchain/mise.js.map +1 -1
- package/dist/toolchain/rtk.d.ts +71 -3
- package/dist/toolchain/rtk.d.ts.map +1 -1
- package/dist/toolchain/rtk.js +115 -7
- package/dist/toolchain/rtk.js.map +1 -1
- package/dist/ui/output.d.ts.map +1 -1
- package/dist/ui/output.js +10 -2
- package/dist/ui/output.js.map +1 -1
- package/dist/ui/spinner.d.ts +15 -3
- package/dist/ui/spinner.d.ts.map +1 -1
- package/dist/ui/spinner.js +52 -4
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/theme.d.ts +27 -1
- package/dist/ui/theme.d.ts.map +1 -1
- package/dist/ui/theme.js +73 -8
- package/dist/ui/theme.js.map +1 -1
- package/dist/utils/fs-retry.d.ts +16 -0
- package/dist/utils/fs-retry.d.ts.map +1 -1
- package/dist/utils/fs-retry.js +28 -0
- package/dist/utils/fs-retry.js.map +1 -1
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rtk-delegation.js","sourceRoot":"","sources":["../../src/adapters/rtk-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,WAAW,EAA0C,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,
|
|
1
|
+
{"version":3,"file":"rtk-delegation.js","sourceRoot":"","sources":["../../src/adapters/rtk-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,WAAW,EAA0C,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,4BAA4B,EAC5B,cAAc,EACd,UAAU,GACX,MAAM,qBAAqB,CAAC;AAkB7B,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IAGnD,YAAY,MAAqB,EAAE,IAA0B;QAC3D,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACzB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;IAC7B,CAAC;IAED,WAAW;QACT,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,MAAM,GAAkB;YAC5B,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,EAAE;YAChB,aAAa,EAAE,EAAE;YACjB,MAAM,EAAE,EAAE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"version":3,"file":"vibe.d.ts","sourceRoot":"","sources":["../../src/adapters/vibe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"vibe.d.ts","sourceRoot":"","sources":["../../src/adapters/vibe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI/C,qBAAa,WAAY,SAAQ,oBAAoB;gBACvC,MAAM,EAAE,aAAa;CASlC"}
|
package/dist/adapters/vibe.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import { RtkDelegationAdapter } from './rtk-delegation.js';
|
|
6
6
|
import { RTK_INIT_FLAGS } from '../toolchain/rtk.js';
|
|
7
|
+
import { homeDir } from './agent-dirs.js';
|
|
7
8
|
export class VibeAdapter extends RtkDelegationAdapter {
|
|
8
9
|
constructor(config) {
|
|
9
|
-
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
10
10
|
super(config, {
|
|
11
11
|
agentKey: 'vibe',
|
|
12
12
|
label: 'Mistral Vibe',
|
|
13
13
|
rtkFlags: RTK_INIT_FLAGS.vibe,
|
|
14
|
-
configDir: path.join(
|
|
14
|
+
configDir: path.join(homeDir(), '.vibe'),
|
|
15
15
|
expectedFile: 'RTK.md',
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vibe.js","sourceRoot":"","sources":["../../src/adapters/vibe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"vibe.js","sourceRoot":"","sources":["../../src/adapters/vibe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,OAAO,WAAY,SAAQ,oBAAoB;IACnD,YAAY,MAAqB;QAC/B,KAAK,CAAC,MAAM,EAAE;YACZ,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,cAAc;YACrB,QAAQ,EAAE,cAAc,CAAC,IAAI;YAC7B,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC;YACxC,YAAY,EAAE,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windsurf.d.ts","sourceRoot":"","sources":["../../src/adapters/windsurf.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"windsurf.d.ts","sourceRoot":"","sources":["../../src/adapters/windsurf.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI/C,qBAAa,eAAgB,SAAQ,oBAAoB;gBAC3C,MAAM,EAAE,aAAa;CASlC"}
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import { RtkDelegationAdapter } from './rtk-delegation.js';
|
|
6
6
|
import { RTK_INIT_FLAGS } from '../toolchain/rtk.js';
|
|
7
|
+
import { homeDir } from './agent-dirs.js';
|
|
7
8
|
export class WindsurfAdapter extends RtkDelegationAdapter {
|
|
8
9
|
constructor(config) {
|
|
9
|
-
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
10
10
|
super(config, {
|
|
11
11
|
agentKey: 'windsurf',
|
|
12
12
|
label: 'Windsurf',
|
|
13
13
|
rtkFlags: RTK_INIT_FLAGS.windsurf,
|
|
14
|
-
configDir: path.join(
|
|
14
|
+
configDir: path.join(homeDir(), '.windsurf'),
|
|
15
15
|
expectedFile: 'RTK.md',
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windsurf.js","sourceRoot":"","sources":["../../src/adapters/windsurf.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"windsurf.js","sourceRoot":"","sources":["../../src/adapters/windsurf.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,OAAO,eAAgB,SAAQ,oBAAoB;IACvD,YAAY,MAAqB;QAC/B,KAAK,CAAC,MAAM,EAAE;YACZ,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,cAAc,CAAC,QAAQ;YACjC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC;YAC5C,YAAY,EAAE,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/cli/exit.d.ts
CHANGED
|
@@ -5,12 +5,23 @@ import type { Command, CommanderError } from 'commander';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function exitCodeForCommanderError(error: CommanderError): 0 | 2;
|
|
7
7
|
/**
|
|
8
|
-
* Install the usage-error exit-code contract on a program and every
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* callback
|
|
8
|
+
* Install the usage-error exit-code contract on a program and every command
|
|
9
|
+
* already registered on it. MUST be called *after* every `addCommand()`, so
|
|
10
|
+
* the explicit loop below reaches them all. A command registered later via
|
|
11
|
+
* `.command(name)` (not `.addCommand()`) inherits it automatically —
|
|
12
|
+
* Commander's own `copyInheritedSettings()` copies the parent's exit
|
|
13
|
+
* callback onto it at creation time.
|
|
14
|
+
*
|
|
15
|
+
* This deliberately does NOT also listen for a `'command:add'` event: no
|
|
16
|
+
* such registration event exists in Commander. That string is only ever
|
|
17
|
+
* emitted as the *legacy* per-command completion event `command:${name}` —
|
|
18
|
+
* fired on the parent after a subcommand's action handler runs, with
|
|
19
|
+
* `(operands, unknown)` as its arguments — so a listener bound to the
|
|
20
|
+
* literal name `'command:add'` would silently misfire as soon as any
|
|
21
|
+
* command were named "add", handing `command.exitOverride()` an array
|
|
22
|
+
* instead of a Command and crashing every run of it.
|
|
23
|
+
*
|
|
24
|
+
* The callback MUST rethrow: commander's `error()` calls `process.exit(1)`
|
|
14
25
|
* immediately after the override returns normally, which would clobber the
|
|
15
26
|
* mapped code. Rethrowing lets `parseAsync()`'s rejection carry the error out
|
|
16
27
|
* to the entrypoint, which then honors the already-set `process.exitCode`.
|
package/dist/cli/exit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../src/cli/exit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,cAAc,GAAG,CAAC,GAAG,CAAC,CAStE;AAED
|
|
1
|
+
{"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../src/cli/exit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,cAAc,GAAG,CAAC,GAAG,CAAC,CAStE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAO1D"}
|
package/dist/cli/exit.js
CHANGED
|
@@ -13,12 +13,23 @@ export function exitCodeForCommanderError(error) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Install the usage-error exit-code contract on a program and every
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* callback
|
|
16
|
+
* Install the usage-error exit-code contract on a program and every command
|
|
17
|
+
* already registered on it. MUST be called *after* every `addCommand()`, so
|
|
18
|
+
* the explicit loop below reaches them all. A command registered later via
|
|
19
|
+
* `.command(name)` (not `.addCommand()`) inherits it automatically —
|
|
20
|
+
* Commander's own `copyInheritedSettings()` copies the parent's exit
|
|
21
|
+
* callback onto it at creation time.
|
|
22
|
+
*
|
|
23
|
+
* This deliberately does NOT also listen for a `'command:add'` event: no
|
|
24
|
+
* such registration event exists in Commander. That string is only ever
|
|
25
|
+
* emitted as the *legacy* per-command completion event `command:${name}` —
|
|
26
|
+
* fired on the parent after a subcommand's action handler runs, with
|
|
27
|
+
* `(operands, unknown)` as its arguments — so a listener bound to the
|
|
28
|
+
* literal name `'command:add'` would silently misfire as soon as any
|
|
29
|
+
* command were named "add", handing `command.exitOverride()` an array
|
|
30
|
+
* instead of a Command and crashing every run of it.
|
|
31
|
+
*
|
|
32
|
+
* The callback MUST rethrow: commander's `error()` calls `process.exit(1)`
|
|
22
33
|
* immediately after the override returns normally, which would clobber the
|
|
23
34
|
* mapped code. Rethrowing lets `parseAsync()`'s rejection carry the error out
|
|
24
35
|
* to the entrypoint, which then honors the already-set `process.exitCode`.
|
|
@@ -29,7 +40,6 @@ export function installExitOverride(program) {
|
|
|
29
40
|
throw error;
|
|
30
41
|
};
|
|
31
42
|
program.exitOverride(override);
|
|
32
|
-
program.on('command:add', (command) => command.exitOverride(override));
|
|
33
43
|
for (const command of program.commands)
|
|
34
44
|
command.exitOverride(override);
|
|
35
45
|
}
|
package/dist/cli/exit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../src/cli/exit.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqB;IAC7D,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,yBAAyB,CAAC;QAC/B,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB;YACtB,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../src/cli/exit.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqB;IAC7D,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,yBAAyB,CAAC;QAC/B,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB;YACtB,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,QAAQ,GAAG,CAAC,KAAqB,EAAQ,EAAE;QAC/C,OAAO,CAAC,QAAQ,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;QACpD,MAAM,KAAK,CAAC;IACd,CAAC,CAAC;IACF,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC/B,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/commands/apply.d.ts
CHANGED
|
@@ -10,6 +10,59 @@ export interface ApplyResult {
|
|
|
10
10
|
/** Wall-clock milliseconds the apply took, for the end-of-run timing line. */
|
|
11
11
|
elapsedMs?: number;
|
|
12
12
|
}
|
|
13
|
+
export interface ApplyJsonResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
configPath: string;
|
|
16
|
+
baseDir: string;
|
|
17
|
+
messages: string[];
|
|
18
|
+
errors: string[];
|
|
19
|
+
warnings: string[];
|
|
20
|
+
elapsedMs?: number;
|
|
21
|
+
}
|
|
22
|
+
/** Shape `--json` prints for a completed (non-dry-run) apply. */
|
|
23
|
+
export declare function buildApplyJsonResult(result: ApplyResult, extra: {
|
|
24
|
+
configPath: string;
|
|
25
|
+
baseDir: string;
|
|
26
|
+
warnings: string[];
|
|
27
|
+
}): ApplyJsonResult;
|
|
28
|
+
export interface DryRunFileStatus {
|
|
29
|
+
path: string;
|
|
30
|
+
status: 'create' | 'update' | 'unchanged' | 'error';
|
|
31
|
+
message?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface DryRunTier0Agent {
|
|
34
|
+
agent: string;
|
|
35
|
+
needsFix: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface ApplyDryRunPlan {
|
|
38
|
+
configPath: string;
|
|
39
|
+
baseDir: string;
|
|
40
|
+
misePlan: {
|
|
41
|
+
miseTomlPath: string;
|
|
42
|
+
enabledToolCount: number;
|
|
43
|
+
status: 'create' | 'update' | 'unchanged';
|
|
44
|
+
};
|
|
45
|
+
generatedFiles: DryRunFileStatus[];
|
|
46
|
+
agents: string[];
|
|
47
|
+
rtkEnabled: boolean;
|
|
48
|
+
integrations: string[];
|
|
49
|
+
/** Per-agent Tier 0 shell-fix plan on Windows with Git Bash found; null everywhere else. */
|
|
50
|
+
tier0: DryRunTier0Agent[] | null;
|
|
51
|
+
}
|
|
52
|
+
export interface ApplyDryRunJsonResult extends ApplyDryRunPlan {
|
|
53
|
+
success: true;
|
|
54
|
+
dryRun: true;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Compute what `apply` would actually change, without writing anything:
|
|
58
|
+
* mise.toml's and each generated file's create/update/unchanged status (via
|
|
59
|
+
* planMarkerUpdate(), the same decision the real write path uses, so they
|
|
60
|
+
* can never disagree about what counts as a change) and, on Windows with
|
|
61
|
+
* Git Bash found, the per-agent Tier 0 shell-fix plan.
|
|
62
|
+
*/
|
|
63
|
+
export declare function buildApplyDryRunPlan(config: AgentenvConfig, baseDir: string, configPath: string, files: GeneratedFile[], agents: string[], integrations: Array<{
|
|
64
|
+
getName(): string;
|
|
65
|
+
}>): ApplyDryRunPlan;
|
|
13
66
|
export interface ApplyOptions {
|
|
14
67
|
/**
|
|
15
68
|
* Skip ensuring/installing via mise. Used by tests and any caller that
|
|
@@ -24,6 +77,11 @@ export interface ApplyOptions {
|
|
|
24
77
|
skipPrereqMessage?: boolean;
|
|
25
78
|
/** Injectable `rtk init` runner (tests pass a stub). */
|
|
26
79
|
rtkInit?: RtkInitFn;
|
|
80
|
+
/**
|
|
81
|
+
* Overrides config.tier0.mode for this run (e.g. the `--shell-fix` CLI
|
|
82
|
+
* flag). Takes precedence over the config file when set.
|
|
83
|
+
*/
|
|
84
|
+
tier0Mode?: 'auto' | 'always' | 'never';
|
|
27
85
|
/** Injectable Superpowers adapter dependencies (tests pass a claude stub). */
|
|
28
86
|
superpowersDeps?: SuperpowersAdapterDeps;
|
|
29
87
|
/**
|
|
@@ -38,6 +96,25 @@ export interface ApplyOptions {
|
|
|
38
96
|
onEnd?: () => void;
|
|
39
97
|
};
|
|
40
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Whether the Tier 0 Windows shell fix should actually write files this run,
|
|
101
|
+
* given its resolved mode and whether stdin is a TTY:
|
|
102
|
+
* - "auto" (the long-standing default): only with a TTY.
|
|
103
|
+
* - "always": always — this is what lets an AI agent (which never has a
|
|
104
|
+
* TTY) running `apply`/`setup --yes` still get the fix applied.
|
|
105
|
+
* - "never": never, even with a TTY.
|
|
106
|
+
*/
|
|
107
|
+
export declare function resolveTier0WriteFiles(mode: 'auto' | 'always' | 'never', isTTY: boolean): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether step 3 (mise install/verify) should run: only when mise.toml was
|
|
110
|
+
* actually written (there'd be nothing to install otherwise) and
|
|
111
|
+
* --skip-mise-install wasn't passed. Deliberately NOT gated on the
|
|
112
|
+
* cumulative error count — a Tier 0 failure (step 1) is unrelated and must
|
|
113
|
+
* not also skip installing every configured tool: gating this on
|
|
114
|
+
* `errors.length === 0` meant one broken agent shell-fix write silently
|
|
115
|
+
* skipped tool installation entirely.
|
|
116
|
+
*/
|
|
117
|
+
export declare function shouldRunMiseInstall(miseTomlWritten: boolean, skipMiseInstall: boolean): boolean;
|
|
41
118
|
/**
|
|
42
119
|
* For user/global scope the instruction files are written into each enabled
|
|
43
120
|
* agent's own user-level instruction file (e.g. ~/.claude/CLAUDE.md for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC,OAAO,KAAK,EAAE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AI,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAIjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,OAAO,CAEhG;AAmCD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,YAAY,GACpB,aAAa,EAAE,CAOjB;AAED,iFAAiF;AACjF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAsItB;AAED,eAAO,MAAM,YAAY,SAqMtB,CAAC"}
|
package/dist/commands/apply.js
CHANGED
|
@@ -1,20 +1,104 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import * as fs from 'fs';
|
|
2
3
|
import * as path from 'path';
|
|
3
4
|
import { ClaudeCodeAdapter, CodexCliAdapter, CopilotAdapter, OpenCodeAdapter, GeminiCliAdapter, CursorAdapter, WindsurfAdapter, ClineAdapter, VibeAdapter, } from '../adapters/index.js';
|
|
4
5
|
import { getEnabledAgents, loadConfig, validateConfig } from '../config/schema.js';
|
|
5
|
-
import { resolveScopeDir } from '../config/scopes.js';
|
|
6
|
-
import { findConfigPath } from '../config/scopes.js';
|
|
6
|
+
import { configFilePath, findConfigPath, parseScopeFlag, resolveScopeDir, } from '../config/scopes.js';
|
|
7
7
|
import { SuperpowersAdapter, integrationResultLines } from '../integrations/index.js';
|
|
8
|
-
import { generateAgentsMd, generateInstructionFiles, updateWithMarkers, } from '../generate/agentsmd.js';
|
|
9
|
-
import { fixShellConfiguration } from '../shell/detector.js';
|
|
8
|
+
import { generateAgentsMd, generateInstructionFiles, planMarkerUpdate, updateWithMarkers, } from '../generate/agentsmd.js';
|
|
9
|
+
import { checkAgentShellConfiguration, detectShell, fixShellConfiguration, } from '../shell/detector.js';
|
|
10
10
|
import { shellFixStatePath } from '../shell/shell-fix-state.js';
|
|
11
11
|
import { isUnsupportedRtkAgentError } from '../toolchain/rtk.js';
|
|
12
12
|
import { ensureGlobalShimsDir, eulaPreflightHint, generateMiseToml, isMiseInstalled, miseActivationHint, miseInstallInstructions, miseInstallOutcome, platformUnsupportedHint, prereqMessage, runMiseInstall, saveMiseToml, toolAvailabilityLine, trustMiseToml, verifyHintNeeded, verifySummaryLine, verifyToolAvailability, } from '../toolchain/mise.js';
|
|
13
13
|
import { normalizeOutput } from '../utils/output.js';
|
|
14
14
|
import { colorizeLine, theme } from '../ui/theme.js';
|
|
15
|
-
import { renderLogo } from '../ui/output.js';
|
|
15
|
+
import { renderLogo, setQuietEnabled } from '../ui/output.js';
|
|
16
16
|
import { printConfigPath, printMessages, printResult, reportValidation } from '../ui/report.js';
|
|
17
17
|
import { withSpinner } from '../ui/spinner.js';
|
|
18
|
+
/** Shape `--json` prints for a completed (non-dry-run) apply. */
|
|
19
|
+
export function buildApplyJsonResult(result, extra) {
|
|
20
|
+
return {
|
|
21
|
+
success: result.success,
|
|
22
|
+
configPath: extra.configPath,
|
|
23
|
+
baseDir: extra.baseDir,
|
|
24
|
+
messages: result.messages,
|
|
25
|
+
errors: result.errors,
|
|
26
|
+
warnings: extra.warnings,
|
|
27
|
+
elapsedMs: result.elapsedMs,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Compute what `apply` would actually change, without writing anything:
|
|
32
|
+
* mise.toml's and each generated file's create/update/unchanged status (via
|
|
33
|
+
* planMarkerUpdate(), the same decision the real write path uses, so they
|
|
34
|
+
* can never disagree about what counts as a change) and, on Windows with
|
|
35
|
+
* Git Bash found, the per-agent Tier 0 shell-fix plan.
|
|
36
|
+
*/
|
|
37
|
+
export function buildApplyDryRunPlan(config, baseDir, configPath, files, agents, integrations) {
|
|
38
|
+
const enabledToolCount = Object.values(config.tools ?? {}).filter((on) => on === true).length;
|
|
39
|
+
const miseTomlPath = path.join(baseDir, 'mise.toml');
|
|
40
|
+
const miseContent = generateMiseToml(config, config.custom_tools ?? []);
|
|
41
|
+
const miseStatus = !fs.existsSync(miseTomlPath)
|
|
42
|
+
? 'create'
|
|
43
|
+
: fs.readFileSync(miseTomlPath, 'utf-8') === miseContent
|
|
44
|
+
? 'unchanged'
|
|
45
|
+
: 'update';
|
|
46
|
+
const markerStart = config.generate?.marker_start ?? '<!-- agentenv-managed-start -->';
|
|
47
|
+
const markerEnd = config.generate?.marker_end ?? '<!-- agentenv-managed-end -->';
|
|
48
|
+
const generatedFiles = files.map((file) => {
|
|
49
|
+
const plan = planMarkerUpdate(file.path, file.content, markerStart, markerEnd);
|
|
50
|
+
return plan.status === 'error'
|
|
51
|
+
? { path: file.path, status: 'error', message: plan.message }
|
|
52
|
+
: { path: file.path, status: plan.status };
|
|
53
|
+
});
|
|
54
|
+
let tier0 = null;
|
|
55
|
+
if (process.platform === 'win32') {
|
|
56
|
+
const shell = detectShell();
|
|
57
|
+
if (shell.gitBashPath) {
|
|
58
|
+
tier0 = agents.map((agent) => ({
|
|
59
|
+
agent,
|
|
60
|
+
needsFix: checkAgentShellConfiguration(agent).needsFix,
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
configPath,
|
|
66
|
+
baseDir,
|
|
67
|
+
misePlan: { miseTomlPath, enabledToolCount, status: miseStatus },
|
|
68
|
+
generatedFiles,
|
|
69
|
+
agents,
|
|
70
|
+
rtkEnabled: config.rtk?.enabled === true,
|
|
71
|
+
integrations: integrations.map((integration) => integration.getName()),
|
|
72
|
+
tier0,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Whether the Tier 0 Windows shell fix should actually write files this run,
|
|
77
|
+
* given its resolved mode and whether stdin is a TTY:
|
|
78
|
+
* - "auto" (the long-standing default): only with a TTY.
|
|
79
|
+
* - "always": always — this is what lets an AI agent (which never has a
|
|
80
|
+
* TTY) running `apply`/`setup --yes` still get the fix applied.
|
|
81
|
+
* - "never": never, even with a TTY.
|
|
82
|
+
*/
|
|
83
|
+
export function resolveTier0WriteFiles(mode, isTTY) {
|
|
84
|
+
if (mode === 'always')
|
|
85
|
+
return true;
|
|
86
|
+
if (mode === 'never')
|
|
87
|
+
return false;
|
|
88
|
+
return isTTY;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Whether step 3 (mise install/verify) should run: only when mise.toml was
|
|
92
|
+
* actually written (there'd be nothing to install otherwise) and
|
|
93
|
+
* --skip-mise-install wasn't passed. Deliberately NOT gated on the
|
|
94
|
+
* cumulative error count — a Tier 0 failure (step 1) is unrelated and must
|
|
95
|
+
* not also skip installing every configured tool: gating this on
|
|
96
|
+
* `errors.length === 0` meant one broken agent shell-fix write silently
|
|
97
|
+
* skipped tool installation entirely.
|
|
98
|
+
*/
|
|
99
|
+
export function shouldRunMiseInstall(miseTomlWritten, skipMiseInstall) {
|
|
100
|
+
return miseTomlWritten && !skipMiseInstall;
|
|
101
|
+
}
|
|
18
102
|
function adaptersFor(config, baseDir, options) {
|
|
19
103
|
const adapterConfig = {
|
|
20
104
|
enabled: true,
|
|
@@ -88,8 +172,10 @@ export async function applyConfiguration(config, baseDir, options = {}) {
|
|
|
88
172
|
// Step 1 — Tier 0 shell compatibility fix.
|
|
89
173
|
if (config.tier0?.check_enabled !== false) {
|
|
90
174
|
const enabledAgents = getEnabledAgents(config);
|
|
175
|
+
const tier0Mode = options.tier0Mode ?? config.tier0?.mode ?? 'auto';
|
|
176
|
+
const writeShellFixFiles = resolveTier0WriteFiles(tier0Mode, process.stdin.isTTY === true);
|
|
91
177
|
try {
|
|
92
|
-
const tier0 = fixShellConfiguration(baseDir, enabledAgents,
|
|
178
|
+
const tier0 = fixShellConfiguration(baseDir, enabledAgents, writeShellFixFiles);
|
|
93
179
|
(tier0.success ? messages : errors).push(`Tier 0: ${tier0.message}`);
|
|
94
180
|
if (tier0.results) {
|
|
95
181
|
for (const result of tier0.results) {
|
|
@@ -104,8 +190,10 @@ export async function applyConfiguration(config, baseDir, options = {}) {
|
|
|
104
190
|
// Step 2 — mise.toml (declares the tools).
|
|
105
191
|
const enabledToolCount = Object.values(config.tools ?? {}).filter((on) => on === true).length;
|
|
106
192
|
const misePath = path.join(baseDir, 'mise.toml');
|
|
193
|
+
let miseTomlWritten = false;
|
|
107
194
|
try {
|
|
108
195
|
saveMiseToml(generateMiseToml(config, config.custom_tools ?? []), misePath);
|
|
196
|
+
miseTomlWritten = true;
|
|
109
197
|
messages.push(`Tools: wrote ${misePath} (${enabledToolCount} enabled)`);
|
|
110
198
|
const platformSkip = platformUnsupportedHint(config);
|
|
111
199
|
if (platformSkip)
|
|
@@ -115,7 +203,7 @@ export async function applyConfiguration(config, baseDir, options = {}) {
|
|
|
115
203
|
errors.push(`Unable to write ${misePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
116
204
|
}
|
|
117
205
|
// Step 3 — global shims config + trust + install + verify.
|
|
118
|
-
if (
|
|
206
|
+
if (shouldRunMiseInstall(miseTomlWritten, options.skipMiseInstall === true)) {
|
|
119
207
|
const shims = ensureGlobalShimsDir(shellFixStatePath());
|
|
120
208
|
(shims.success ? messages : errors).push(shims.message);
|
|
121
209
|
const trust = trustMiseToml(misePath, baseDir);
|
|
@@ -193,58 +281,145 @@ export const applyCommand = new Command()
|
|
|
193
281
|
.description('Non-interactive: read config and generate everything')
|
|
194
282
|
.option('--skip-mise-install', 'skip mise install (files only; for CI/dry-run)')
|
|
195
283
|
.option('--dry-run', 'show what would be written without changing anything')
|
|
196
|
-
.
|
|
284
|
+
.option('--shell-fix <mode>', 'Tier 0 Windows shell fix: auto (default; only writes files with a TTY) | always (write even without a TTY — for an agent running apply) | never')
|
|
285
|
+
.option('--scope <scope>', 'config scope to apply: project|user (default: nearest config)')
|
|
286
|
+
.option('--json', 'emit a machine-readable JSON document on stdout')
|
|
287
|
+
.action(async (options, command) => {
|
|
197
288
|
const startedAt = Date.now();
|
|
289
|
+
const json = options.json === true;
|
|
290
|
+
if (json)
|
|
291
|
+
setQuietEnabled(true);
|
|
198
292
|
renderLogo();
|
|
199
293
|
const dryRun = options.dryRun === true;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
console.error('No agentenv.toml found. Run `agentenv setup` first.');
|
|
204
|
-
process.exitCode = 1;
|
|
294
|
+
const scope = parseScopeFlag(options.scope);
|
|
295
|
+
if (scope.error) {
|
|
296
|
+
command.error(scope.error);
|
|
205
297
|
return;
|
|
206
298
|
}
|
|
299
|
+
let tier0Mode;
|
|
300
|
+
if (options.shellFix !== undefined) {
|
|
301
|
+
if (['auto', 'always', 'never'].includes(options.shellFix)) {
|
|
302
|
+
tier0Mode = options.shellFix;
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
command.error(`invalid --shell-fix "${options.shellFix}" (expected "auto", "always", or "never")`);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/** Emit a single-error JSON failure document (json mode's equivalent of a themed console.error). */
|
|
310
|
+
const jsonFail = (error) => {
|
|
311
|
+
console.log(JSON.stringify({ success: false, messages: [], errors: [error] }, null, 2));
|
|
312
|
+
};
|
|
313
|
+
let config;
|
|
314
|
+
let configPath;
|
|
315
|
+
if (scope.scope) {
|
|
316
|
+
configPath = configFilePath(scope.scope);
|
|
317
|
+
if (!fs.existsSync(configPath)) {
|
|
318
|
+
const error = `No agentenv.toml found at ${configPath} (scope ${scope.scope}).`;
|
|
319
|
+
if (json)
|
|
320
|
+
jsonFail(error);
|
|
321
|
+
else
|
|
322
|
+
console.error(error);
|
|
323
|
+
process.exitCode = 1;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
configPath = findConfigPath() ?? null;
|
|
329
|
+
if (!configPath) {
|
|
330
|
+
const error = 'No agentenv.toml found. Run `agentenv setup` first.';
|
|
331
|
+
if (json)
|
|
332
|
+
jsonFail(error);
|
|
333
|
+
else
|
|
334
|
+
console.error(error);
|
|
335
|
+
process.exitCode = 1;
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
207
339
|
try {
|
|
208
|
-
config = loadConfig(configPath);
|
|
340
|
+
config = loadConfig(configPath, { layerUserConfig: true });
|
|
209
341
|
}
|
|
210
342
|
catch (error) {
|
|
211
|
-
|
|
343
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
344
|
+
if (json)
|
|
345
|
+
jsonFail(message);
|
|
346
|
+
else
|
|
347
|
+
console.error(theme.fail(message));
|
|
212
348
|
process.exitCode = 1;
|
|
213
349
|
return;
|
|
214
350
|
}
|
|
215
|
-
|
|
351
|
+
if (!json)
|
|
352
|
+
printConfigPath(configPath);
|
|
216
353
|
const report = validateConfig(config);
|
|
217
|
-
if (
|
|
354
|
+
if (report.errors.length > 0) {
|
|
355
|
+
if (json) {
|
|
356
|
+
console.log(JSON.stringify({ success: false, messages: [], errors: report.errors, warnings: report.warnings }, null, 2));
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
reportValidation(report, 'Configuration invalid — not applying.');
|
|
360
|
+
}
|
|
218
361
|
process.exitCode = 1;
|
|
219
362
|
return;
|
|
220
363
|
}
|
|
364
|
+
if (!json)
|
|
365
|
+
reportValidation(report, 'Configuration invalid — not applying.');
|
|
221
366
|
const baseDir = resolveScopeDir(config.scope);
|
|
222
367
|
if (dryRun) {
|
|
223
|
-
const enabledToolCount = Object.values(config.tools ?? {}).filter((on) => on === true).length;
|
|
224
368
|
const files = [
|
|
225
369
|
...generateInstructionFiles(config, baseDir),
|
|
226
370
|
...userScopeInstructionFiles(config, baseDir, options),
|
|
227
371
|
];
|
|
228
372
|
const agents = [...getEnabledAgents(config)];
|
|
229
373
|
const integrations = enabledIntegrations(config, options);
|
|
230
|
-
|
|
231
|
-
|
|
374
|
+
const plan = buildApplyDryRunPlan(config, baseDir, configPath, files, agents, integrations);
|
|
375
|
+
if (json) {
|
|
376
|
+
const payload = { success: true, dryRun: true, ...plan };
|
|
377
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
console.log(` Tools: ${plan.misePlan.enabledToolCount} enabled -> ${plan.misePlan.miseTomlPath} [${plan.misePlan.status}]`);
|
|
381
|
+
console.log(' Generated files:');
|
|
382
|
+
if (plan.generatedFiles.length === 0) {
|
|
383
|
+
console.log(' (none)');
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
for (const file of plan.generatedFiles) {
|
|
387
|
+
console.log(` ${file.path} [${file.status}]${file.message ? ` — ${file.message}` : ''}`);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
232
390
|
console.log(` Agents: ${agents.join(', ') || '(none)'}${config.rtk?.enabled === true ? ' (rtk rewriting on)' : ''}`);
|
|
233
391
|
console.log(` Integrations: ${integrations.length > 0 ? integrations.map((i) => i.getName()).join(', ') : '(none)'}`);
|
|
392
|
+
if (plan.tier0) {
|
|
393
|
+
console.log(' Tier 0 (Windows shell fix):');
|
|
394
|
+
for (const entry of plan.tier0) {
|
|
395
|
+
console.log(` ${entry.agent}: ${entry.needsFix ? 'needs fix' : 'already configured'}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
234
398
|
printResult('ok', 'Dry run complete', 'no changes were made', Date.now() - startedAt);
|
|
235
399
|
return;
|
|
236
400
|
}
|
|
237
401
|
const result = await withSpinner('Applying configuration...', (spinner) => applyConfiguration(config, baseDir, {
|
|
238
402
|
skipMiseInstall: options.skipMiseInstall === true,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
403
|
+
tier0Mode,
|
|
404
|
+
// Streamed mise install progress is human-only chrome — it would
|
|
405
|
+
// otherwise interleave raw text into the JSON document.
|
|
406
|
+
onMiseInstall: json
|
|
407
|
+
? undefined
|
|
408
|
+
: {
|
|
409
|
+
onStart: () => {
|
|
410
|
+
spinner.stop();
|
|
411
|
+
console.log(colorizeLine('Installing tools via mise...'));
|
|
412
|
+
},
|
|
413
|
+
onOutput: (chunk) => process.stdout.write(chunk),
|
|
414
|
+
onEnd: () => spinner.start(),
|
|
243
415
|
},
|
|
244
|
-
onOutput: (chunk) => process.stdout.write(chunk),
|
|
245
|
-
onEnd: () => spinner.start(),
|
|
246
|
-
},
|
|
247
416
|
}));
|
|
417
|
+
if (json) {
|
|
418
|
+
console.log(JSON.stringify(buildApplyJsonResult(result, { configPath, baseDir, warnings: report.warnings }), null, 2));
|
|
419
|
+
if (!result.success)
|
|
420
|
+
process.exitCode = 1;
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
248
423
|
printMessages(result.messages, result.errors);
|
|
249
424
|
if (!result.success) {
|
|
250
425
|
process.exitCode = 1;
|