@indy2kro/agentenv 0.1.0
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/LICENSE +21 -0
- package/README.md +320 -0
- package/dist/adapters/base.d.ts +58 -0
- package/dist/adapters/base.d.ts.map +1 -0
- package/dist/adapters/base.js +16 -0
- package/dist/adapters/base.js.map +1 -0
- package/dist/adapters/claude.d.ts +21 -0
- package/dist/adapters/claude.d.ts.map +1 -0
- package/dist/adapters/claude.js +198 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/codex.d.ts +23 -0
- package/dist/adapters/codex.d.ts.map +1 -0
- package/dist/adapters/codex.js +134 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/adapters/copilot.d.ts +21 -0
- package/dist/adapters/copilot.d.ts.map +1 -0
- package/dist/adapters/copilot.js +111 -0
- package/dist/adapters/copilot.js.map +1 -0
- package/dist/adapters/detect.d.ts +23 -0
- package/dist/adapters/detect.d.ts.map +1 -0
- package/dist/adapters/detect.js +80 -0
- package/dist/adapters/detect.js.map +1 -0
- package/dist/adapters/index.d.ts +12 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +11 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/opencode.d.ts +19 -0
- package/dist/adapters/opencode.d.ts.map +1 -0
- package/dist/adapters/opencode.js +107 -0
- package/dist/adapters/opencode.js.map +1 -0
- package/dist/commands/apply.d.ts +21 -0
- package/dist/commands/apply.d.ts.map +1 -0
- package/dist/commands/apply.js +113 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/configure.d.ts +13 -0
- package/dist/commands/configure.d.ts.map +1 -0
- package/dist/commands/configure.js +151 -0
- package/dist/commands/configure.js.map +1 -0
- package/dist/commands/setup.d.ts +11 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +78 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +152 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/config/schema.d.ts +142 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +778 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/scopes.d.ts +14 -0
- package/dist/config/scopes.d.ts.map +1 -0
- package/dist/config/scopes.js +32 -0
- package/dist/config/scopes.js.map +1 -0
- package/dist/generate/agentsmd.d.ts +44 -0
- package/dist/generate/agentsmd.d.ts.map +1 -0
- package/dist/generate/agentsmd.js +340 -0
- package/dist/generate/agentsmd.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/base.d.ts +33 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +9 -0
- package/dist/integrations/base.js.map +1 -0
- package/dist/integrations/index.d.ts +7 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +5 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/integrations/superpowers.d.ts +48 -0
- package/dist/integrations/superpowers.d.ts.map +1 -0
- package/dist/integrations/superpowers.js +191 -0
- package/dist/integrations/superpowers.js.map +1 -0
- package/dist/shell/detector.d.ts +92 -0
- package/dist/shell/detector.d.ts.map +1 -0
- package/dist/shell/detector.js +714 -0
- package/dist/shell/detector.js.map +1 -0
- package/dist/toolchain/fallbacks.d.ts +77 -0
- package/dist/toolchain/fallbacks.d.ts.map +1 -0
- package/dist/toolchain/fallbacks.js +238 -0
- package/dist/toolchain/fallbacks.js.map +1 -0
- package/dist/toolchain/gh.d.ts +20 -0
- package/dist/toolchain/gh.d.ts.map +1 -0
- package/dist/toolchain/gh.js +36 -0
- package/dist/toolchain/gh.js.map +1 -0
- package/dist/toolchain/mise.d.ts +92 -0
- package/dist/toolchain/mise.d.ts.map +1 -0
- package/dist/toolchain/mise.js +346 -0
- package/dist/toolchain/mise.js.map +1 -0
- package/dist/toolchain/rtk.d.ts +27 -0
- package/dist/toolchain/rtk.d.ts.map +1 -0
- package/dist/toolchain/rtk.js +76 -0
- package/dist/toolchain/rtk.js.map +1 -0
- package/dist/wizard/build.d.ts +24 -0
- package/dist/wizard/build.d.ts.map +1 -0
- package/dist/wizard/build.js +64 -0
- package/dist/wizard/build.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Superpowers Integration Adapter
|
|
3
|
+
* Installs github:obra/superpowers for Claude Code only, via `claude plugin
|
|
4
|
+
* marketplace add` / `claude plugin install` — the only agent with a
|
|
5
|
+
* documented, non-interactive, ref-pinnable installer. See
|
|
6
|
+
* docs/research/superpowers-install-mechanisms.md for the other three
|
|
7
|
+
* agents, which always report `unsupported` and never execute a command.
|
|
8
|
+
*/
|
|
9
|
+
import type { IntegrationConfig } from '../config/schema.js';
|
|
10
|
+
import type { IntegrationAdapter, IntegrationResult } from './base.js';
|
|
11
|
+
export declare const SUPERPOWERS_MARKETPLACE_REPO = "obra/superpowers-marketplace";
|
|
12
|
+
export declare const SUPERPOWERS_PLUGIN_ID = "superpowers@superpowers-marketplace";
|
|
13
|
+
export interface ClaudeCliCommandResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
exitCode: number | null;
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr: string;
|
|
18
|
+
}
|
|
19
|
+
/** Injectable so tests never spawn a real `claude` binary. */
|
|
20
|
+
export type ClaudeCliRunner = (args: string[], cwd: string) => ClaudeCliCommandResult;
|
|
21
|
+
interface FsDeps {
|
|
22
|
+
existsSync: (path: string) => boolean;
|
|
23
|
+
readFileSync: (path: string, encoding: 'utf-8') => string;
|
|
24
|
+
writeFileSync: (path: string, content: string) => void;
|
|
25
|
+
mkdirSync: (path: string, opts?: {
|
|
26
|
+
recursive?: boolean;
|
|
27
|
+
}) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface SuperpowersAdapterDeps {
|
|
30
|
+
runClaudeCli?: ClaudeCliRunner;
|
|
31
|
+
fs?: FsDeps;
|
|
32
|
+
}
|
|
33
|
+
export declare class SuperpowersAdapter implements IntegrationAdapter {
|
|
34
|
+
private readonly runClaudeCli;
|
|
35
|
+
private readonly fsImpl;
|
|
36
|
+
constructor(deps?: SuperpowersAdapterDeps);
|
|
37
|
+
getName(): string;
|
|
38
|
+
isEnabled(config: IntegrationConfig | undefined): boolean;
|
|
39
|
+
private markerPath;
|
|
40
|
+
private readMarker;
|
|
41
|
+
private writeMarker;
|
|
42
|
+
private detectClaudeCode;
|
|
43
|
+
detect(baseDir: string, config: IntegrationConfig | undefined): Promise<IntegrationResult>;
|
|
44
|
+
status(baseDir: string, config: IntegrationConfig | undefined): Promise<IntegrationResult>;
|
|
45
|
+
apply(baseDir: string, config: IntegrationConfig | undefined): Promise<IntegrationResult>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=superpowers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"superpowers.d.ts","sourceRoot":"","sources":["../../src/integrations/superpowers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EAAY,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAyB,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9F,eAAO,MAAM,4BAA4B,iCAAiC,CAAC;AAC3E,eAAO,MAAM,qBAAqB,wCAAwC,CAAC;AAW3E,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8DAA8D;AAC9D,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EA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1
|
+
/**
|
|
2
|
+
* Superpowers Integration Adapter
|
|
3
|
+
* Installs github:obra/superpowers for Claude Code only, via `claude plugin
|
|
4
|
+
* marketplace add` / `claude plugin install` — the only agent with a
|
|
5
|
+
* documented, non-interactive, ref-pinnable installer. See
|
|
6
|
+
* docs/research/superpowers-install-mechanisms.md for the other three
|
|
7
|
+
* agents, which always report `unsupported` and never execute a command.
|
|
8
|
+
*/
|
|
9
|
+
import * as child_process from 'child_process';
|
|
10
|
+
import * as fs from 'fs';
|
|
11
|
+
import * as path from 'path';
|
|
12
|
+
import { resolveBinary } from '../adapters/detect.js';
|
|
13
|
+
import { AGENT_KEYS, resolveIntegrationScope } from '../config/schema.js';
|
|
14
|
+
export const SUPERPOWERS_MARKETPLACE_REPO = 'obra/superpowers-marketplace';
|
|
15
|
+
export const SUPERPOWERS_PLUGIN_ID = 'superpowers@superpowers-marketplace';
|
|
16
|
+
const MANUAL_INSTALL_HINTS = {
|
|
17
|
+
codex_cli: 'No non-interactive install is documented for Codex CLI. In an interactive Codex session, run /plugins, search "superpowers", and select Install Plugin.',
|
|
18
|
+
copilot: 'Upstream documents `copilot plugin marketplace add obra/superpowers-marketplace` then `copilot plugin install superpowers@superpowers-marketplace`, but no ref-pin mechanism is documented, so agentenv does not run this automatically. See docs/research/superpowers-install-mechanisms.md.',
|
|
19
|
+
opencode: 'OpenCode installation is driven by instructions fetched from .opencode/INSTALL.md in the Superpowers repo, which has no fixed command agentenv can safely automate. Follow that file manually.',
|
|
20
|
+
};
|
|
21
|
+
const defaultClaudeCliRunner = (args, cwd) => {
|
|
22
|
+
const claudePath = resolveBinary('claude');
|
|
23
|
+
if (!claudePath) {
|
|
24
|
+
return { success: false, exitCode: null, stdout: '', stderr: 'claude CLI not found on PATH' };
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const result = child_process.spawnSync(claudePath, args, {
|
|
28
|
+
cwd,
|
|
29
|
+
encoding: 'utf-8',
|
|
30
|
+
stdio: 'pipe',
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
success: result.status === 0,
|
|
34
|
+
exitCode: result.status,
|
|
35
|
+
stdout: result.stdout || '',
|
|
36
|
+
stderr: result.stderr || '',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
return {
|
|
41
|
+
success: false,
|
|
42
|
+
exitCode: null,
|
|
43
|
+
stdout: '',
|
|
44
|
+
stderr: err instanceof Error ? err.message : String(err),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export class SuperpowersAdapter {
|
|
49
|
+
constructor(deps = {}) {
|
|
50
|
+
this.runClaudeCli = deps.runClaudeCli ?? defaultClaudeCliRunner;
|
|
51
|
+
this.fsImpl = deps.fs ?? fs;
|
|
52
|
+
}
|
|
53
|
+
getName() {
|
|
54
|
+
return 'Superpowers';
|
|
55
|
+
}
|
|
56
|
+
isEnabled(config) {
|
|
57
|
+
return config?.enabled === true;
|
|
58
|
+
}
|
|
59
|
+
markerPath(baseDir) {
|
|
60
|
+
// path.posix rather than the platform `path` module: baseDir may be a
|
|
61
|
+
// logical (test-injected) identifier rather than an OS path, and Node's
|
|
62
|
+
// fs functions accept forward slashes on Windows regardless.
|
|
63
|
+
return path.posix.join(baseDir, '.agentenv-state', 'integrations', 'superpowers.json');
|
|
64
|
+
}
|
|
65
|
+
readMarker(baseDir) {
|
|
66
|
+
const file = this.markerPath(baseDir);
|
|
67
|
+
if (!this.fsImpl.existsSync(file))
|
|
68
|
+
return undefined;
|
|
69
|
+
try {
|
|
70
|
+
return JSON.parse(this.fsImpl.readFileSync(file, 'utf-8'));
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
writeMarker(baseDir, marker) {
|
|
77
|
+
const file = this.markerPath(baseDir);
|
|
78
|
+
this.fsImpl.mkdirSync(path.posix.dirname(file), { recursive: true });
|
|
79
|
+
this.fsImpl.writeFileSync(file, JSON.stringify(marker, null, 2));
|
|
80
|
+
}
|
|
81
|
+
detectClaudeCode(baseDir, config) {
|
|
82
|
+
const list = this.runClaudeCli(['plugin', 'list'], baseDir);
|
|
83
|
+
if (!list.success && list.exitCode === null) {
|
|
84
|
+
return {
|
|
85
|
+
agent: 'claude_code',
|
|
86
|
+
state: 'unsupported',
|
|
87
|
+
detail: list.stderr || 'claude CLI not found on PATH',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// `claude plugin list` has no documented structured-output flag; this is
|
|
91
|
+
// a best-effort text match on the plugin name. Revisit if a --json flag
|
|
92
|
+
// is documented.
|
|
93
|
+
const installed = list.stdout.toLowerCase().includes('superpowers');
|
|
94
|
+
if (!installed)
|
|
95
|
+
return { agent: 'claude_code', state: 'missing' };
|
|
96
|
+
const marker = this.readMarker(baseDir);
|
|
97
|
+
const requestedRef = config?.ref;
|
|
98
|
+
if (marker && requestedRef && marker.ref !== requestedRef) {
|
|
99
|
+
return {
|
|
100
|
+
agent: 'claude_code',
|
|
101
|
+
state: 'drifted',
|
|
102
|
+
detail: `installed at ${marker.ref}, config requests ${requestedRef}`,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
agent: 'claude_code',
|
|
107
|
+
state: 'installed',
|
|
108
|
+
detail: marker ? `ref ${marker.ref}` : 'installed outside agentenv',
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async detect(baseDir, config) {
|
|
112
|
+
const scope = resolveIntegrationScope({}, config);
|
|
113
|
+
const requestedAgents = config?.agents ?? [...AGENT_KEYS];
|
|
114
|
+
const result = {
|
|
115
|
+
name: this.getName(),
|
|
116
|
+
source: config?.source,
|
|
117
|
+
ref: config?.ref,
|
|
118
|
+
scope,
|
|
119
|
+
agents: [],
|
|
120
|
+
changedFiles: [],
|
|
121
|
+
nativeCommands: [],
|
|
122
|
+
warnings: [],
|
|
123
|
+
errors: [],
|
|
124
|
+
};
|
|
125
|
+
for (const agent of requestedAgents) {
|
|
126
|
+
if (agent !== 'claude_code') {
|
|
127
|
+
result.agents.push({ agent, state: 'unsupported', detail: MANUAL_INSTALL_HINTS[agent] });
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
result.agents.push(this.detectClaudeCode(baseDir, config));
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
async status(baseDir, config) {
|
|
135
|
+
return this.detect(baseDir, config);
|
|
136
|
+
}
|
|
137
|
+
async apply(baseDir, config) {
|
|
138
|
+
const detected = await this.detect(baseDir, config);
|
|
139
|
+
if (!this.isEnabled(config))
|
|
140
|
+
return detected;
|
|
141
|
+
const ref = config?.ref;
|
|
142
|
+
if (!ref || !config?.source) {
|
|
143
|
+
detected.errors.push('integrations.superpowers.source and .ref must be set to apply');
|
|
144
|
+
return detected;
|
|
145
|
+
}
|
|
146
|
+
for (const agentState of detected.agents) {
|
|
147
|
+
if (agentState.agent !== 'claude_code')
|
|
148
|
+
continue;
|
|
149
|
+
if (config.allow_hooks !== true) {
|
|
150
|
+
detected.warnings.push('Superpowers registers a SessionStart hook; set integrations.superpowers.allow_hooks = true to permit installing it for Claude Code.');
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (agentState.state === 'installed')
|
|
154
|
+
continue;
|
|
155
|
+
const wasDrifted = agentState.state === 'drifted';
|
|
156
|
+
const marketplaceArgs = [
|
|
157
|
+
'plugin',
|
|
158
|
+
'marketplace',
|
|
159
|
+
'add',
|
|
160
|
+
`${SUPERPOWERS_MARKETPLACE_REPO}#${ref}`,
|
|
161
|
+
];
|
|
162
|
+
const marketplaceRun = this.runClaudeCli(marketplaceArgs, baseDir);
|
|
163
|
+
detected.nativeCommands.push(`claude ${marketplaceArgs.join(' ')}`);
|
|
164
|
+
if (!marketplaceRun.success) {
|
|
165
|
+
detected.errors.push(`claude plugin marketplace add failed: ${marketplaceRun.stderr || marketplaceRun.stdout}`);
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const installArgs = ['plugin', 'install', SUPERPOWERS_PLUGIN_ID, '--scope', detected.scope];
|
|
169
|
+
const installRun = this.runClaudeCli(installArgs, baseDir);
|
|
170
|
+
detected.nativeCommands.push(`claude ${installArgs.join(' ')}`);
|
|
171
|
+
if (!installRun.success) {
|
|
172
|
+
detected.errors.push(`claude plugin install failed: ${installRun.stderr || installRun.stdout}`);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const marker = {
|
|
176
|
+
ref,
|
|
177
|
+
scope: detected.scope,
|
|
178
|
+
installedAt: new Date().toISOString(),
|
|
179
|
+
};
|
|
180
|
+
this.writeMarker(baseDir, marker);
|
|
181
|
+
detected.changedFiles.push(this.markerPath(baseDir));
|
|
182
|
+
agentState.state = 'installed';
|
|
183
|
+
agentState.detail = wasDrifted ? `updated to ref ${ref}` : `ref ${ref}`;
|
|
184
|
+
}
|
|
185
|
+
if (config.allow_external_requests !== true) {
|
|
186
|
+
detected.warnings.push('external requests disabled: agentenv never installs the optional Superpowers visual companion');
|
|
187
|
+
}
|
|
188
|
+
return detected;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=superpowers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"superpowers.js","sourceRoot":"","sources":["../../src/integrations/superpowers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,aAAa,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAI1E,MAAM,CAAC,MAAM,4BAA4B,GAAG,8BAA8B,CAAC;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,qCAAq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C,IAAI,CAClB,iCAAiC,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,EAAE,CAC1E,CAAC;gBACF,SAAS;YACX,CAAC;YAED,MAAM,MAAM,GAAsB;gBAChC,GAAG;gBACH,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACtC,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAClC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;YACrD,UAAU,CAAC,KAAK,GAAG,WAAW,CAAC;YAC/B,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,kBAAkB,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC;QAC1E,CAAC;QAED,IAAI,MAAM,CAAC,uBAAuB,KAAK,IAAI,EAAE,CAAC;YAC5C,QAAQ,CAAC,QAAQ,CAAC,IAAI,CACpB,+FAA+F,CAChG,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier 0 Shell Detection and Configuration
|
|
3
|
+
* Detects the shell environment and ensures POSIX compatibility on Windows
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentKey } from '../config/schema.js';
|
|
6
|
+
export declare const POSIX_UTILITIES: string[];
|
|
7
|
+
export declare const GIT_BASH_PATHS: string[];
|
|
8
|
+
export interface ShellInfo {
|
|
9
|
+
currentShell: string;
|
|
10
|
+
isPosixCompatible: boolean;
|
|
11
|
+
isWindows: boolean;
|
|
12
|
+
isMacOS: boolean;
|
|
13
|
+
isGitBash: boolean;
|
|
14
|
+
gitBashPath?: string;
|
|
15
|
+
gnubinPath?: string;
|
|
16
|
+
missingUtilities: string[];
|
|
17
|
+
pathEnvironment: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Detect the current shell environment
|
|
21
|
+
*/
|
|
22
|
+
export declare function detectShell(): ShellInfo;
|
|
23
|
+
/**
|
|
24
|
+
* Install GNU coreutils on macOS via Homebrew.
|
|
25
|
+
* Returns the gnubin path that needs to be prepended to PATH, or undefined if installation fails.
|
|
26
|
+
*/
|
|
27
|
+
declare function installGNUCoreutilsMacOS(): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Generate shell configuration for an agent
|
|
30
|
+
* Returns the shell configuration that should be used
|
|
31
|
+
*/
|
|
32
|
+
export declare function getShellConfiguration(shellInfo: ShellInfo): {
|
|
33
|
+
shell: string;
|
|
34
|
+
posixPath?: string;
|
|
35
|
+
gnuPath?: string;
|
|
36
|
+
needsConfiguration: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Generate PATH addition for Git Bash on Windows
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateGitBashPathAddition(gitBashPath: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Generate PATH addition for GNU coreutils on macOS
|
|
44
|
+
*/
|
|
45
|
+
export declare function generateMacOSGNUPathAddition(gnubinPath: string): string;
|
|
46
|
+
export { installGNUCoreutilsMacOS };
|
|
47
|
+
export type ShellFixAction = 'created' | 'updated' | 'unchanged' | 'skipped';
|
|
48
|
+
export interface ShellFixResult {
|
|
49
|
+
agent: AgentKey;
|
|
50
|
+
file: string;
|
|
51
|
+
action: ShellFixAction;
|
|
52
|
+
message: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the full path to bash.exe from a detected Git Bash directory.
|
|
56
|
+
* Handles both the `usr\bin` form and the plain `bin` form Git for Windows ships.
|
|
57
|
+
* Uses win32 path semantics so the result is correct regardless of host OS
|
|
58
|
+
* (the tests exercise this on Linux CI).
|
|
59
|
+
*/
|
|
60
|
+
export declare function bashExecutable(gitBashPath: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Apply the per-agent Tier 0 shell override for one agent, per
|
|
63
|
+
* docs/research/tier0-shell-fix.md:
|
|
64
|
+
* - claude_code: env.CLAUDE_CODE_GIT_BASH_PATH in ~/.claude/settings.json
|
|
65
|
+
* - codex_cli: [windows] shell_path in ~/.codex/config.toml
|
|
66
|
+
* - opencode: shell + defaultShell in ~/.config/opencode/opencode.json
|
|
67
|
+
* - copilot: no per-file override exists (SHELL env var); skipped
|
|
68
|
+
*
|
|
69
|
+
* Existing user content is preserved; files are only written when a fix is
|
|
70
|
+
* actually needed, so repeated runs degrade to "unchanged".
|
|
71
|
+
*/
|
|
72
|
+
export declare function applyAgentShellFix(agent: AgentKey, bashExe: string, home: string): ShellFixResult;
|
|
73
|
+
/**
|
|
74
|
+
* Fix shell configuration for Windows and macOS
|
|
75
|
+
* This is a Tier 0 fix - ensures POSIX utilities are available
|
|
76
|
+
*/
|
|
77
|
+
export declare function fixShellConfiguration(_baseDir?: string, agents?: AgentKey[]): {
|
|
78
|
+
success: boolean;
|
|
79
|
+
message: string;
|
|
80
|
+
gitBashPath?: string;
|
|
81
|
+
gnubinPath?: string;
|
|
82
|
+
results?: ShellFixResult[];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Check if a specific agent is configured to use a POSIX shell
|
|
86
|
+
*/
|
|
87
|
+
export declare function checkAgentShellConfiguration(agent: string): {
|
|
88
|
+
isConfigured: boolean;
|
|
89
|
+
shell?: string;
|
|
90
|
+
needsFix: boolean;
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/shell/detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,eAAO,MAAM,eAAe,UAgB3B,CAAC;AAGF,eAAO,MAAM,cAAc,UAK1B,CAA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