@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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +320 -0
  3. package/dist/adapters/base.d.ts +58 -0
  4. package/dist/adapters/base.d.ts.map +1 -0
  5. package/dist/adapters/base.js +16 -0
  6. package/dist/adapters/base.js.map +1 -0
  7. package/dist/adapters/claude.d.ts +21 -0
  8. package/dist/adapters/claude.d.ts.map +1 -0
  9. package/dist/adapters/claude.js +198 -0
  10. package/dist/adapters/claude.js.map +1 -0
  11. package/dist/adapters/codex.d.ts +23 -0
  12. package/dist/adapters/codex.d.ts.map +1 -0
  13. package/dist/adapters/codex.js +134 -0
  14. package/dist/adapters/codex.js.map +1 -0
  15. package/dist/adapters/copilot.d.ts +21 -0
  16. package/dist/adapters/copilot.d.ts.map +1 -0
  17. package/dist/adapters/copilot.js +111 -0
  18. package/dist/adapters/copilot.js.map +1 -0
  19. package/dist/adapters/detect.d.ts +23 -0
  20. package/dist/adapters/detect.d.ts.map +1 -0
  21. package/dist/adapters/detect.js +80 -0
  22. package/dist/adapters/detect.js.map +1 -0
  23. package/dist/adapters/index.d.ts +12 -0
  24. package/dist/adapters/index.d.ts.map +1 -0
  25. package/dist/adapters/index.js +11 -0
  26. package/dist/adapters/index.js.map +1 -0
  27. package/dist/adapters/opencode.d.ts +19 -0
  28. package/dist/adapters/opencode.d.ts.map +1 -0
  29. package/dist/adapters/opencode.js +107 -0
  30. package/dist/adapters/opencode.js.map +1 -0
  31. package/dist/commands/apply.d.ts +21 -0
  32. package/dist/commands/apply.d.ts.map +1 -0
  33. package/dist/commands/apply.js +113 -0
  34. package/dist/commands/apply.js.map +1 -0
  35. package/dist/commands/configure.d.ts +13 -0
  36. package/dist/commands/configure.d.ts.map +1 -0
  37. package/dist/commands/configure.js +151 -0
  38. package/dist/commands/configure.js.map +1 -0
  39. package/dist/commands/setup.d.ts +11 -0
  40. package/dist/commands/setup.d.ts.map +1 -0
  41. package/dist/commands/setup.js +78 -0
  42. package/dist/commands/setup.js.map +1 -0
  43. package/dist/commands/status.d.ts +3 -0
  44. package/dist/commands/status.d.ts.map +1 -0
  45. package/dist/commands/status.js +152 -0
  46. package/dist/commands/status.js.map +1 -0
  47. package/dist/config/schema.d.ts +142 -0
  48. package/dist/config/schema.d.ts.map +1 -0
  49. package/dist/config/schema.js +778 -0
  50. package/dist/config/schema.js.map +1 -0
  51. package/dist/config/scopes.d.ts +14 -0
  52. package/dist/config/scopes.d.ts.map +1 -0
  53. package/dist/config/scopes.js +32 -0
  54. package/dist/config/scopes.js.map +1 -0
  55. package/dist/generate/agentsmd.d.ts +44 -0
  56. package/dist/generate/agentsmd.d.ts.map +1 -0
  57. package/dist/generate/agentsmd.js +340 -0
  58. package/dist/generate/agentsmd.js.map +1 -0
  59. package/dist/index.d.ts +7 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +24 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/integrations/base.d.ts +33 -0
  64. package/dist/integrations/base.d.ts.map +1 -0
  65. package/dist/integrations/base.js +9 -0
  66. package/dist/integrations/base.js.map +1 -0
  67. package/dist/integrations/index.d.ts +7 -0
  68. package/dist/integrations/index.d.ts.map +1 -0
  69. package/dist/integrations/index.js +5 -0
  70. package/dist/integrations/index.js.map +1 -0
  71. package/dist/integrations/superpowers.d.ts +48 -0
  72. package/dist/integrations/superpowers.d.ts.map +1 -0
  73. package/dist/integrations/superpowers.js +191 -0
  74. package/dist/integrations/superpowers.js.map +1 -0
  75. package/dist/shell/detector.d.ts +92 -0
  76. package/dist/shell/detector.d.ts.map +1 -0
  77. package/dist/shell/detector.js +714 -0
  78. package/dist/shell/detector.js.map +1 -0
  79. package/dist/toolchain/fallbacks.d.ts +77 -0
  80. package/dist/toolchain/fallbacks.d.ts.map +1 -0
  81. package/dist/toolchain/fallbacks.js +238 -0
  82. package/dist/toolchain/fallbacks.js.map +1 -0
  83. package/dist/toolchain/gh.d.ts +20 -0
  84. package/dist/toolchain/gh.d.ts.map +1 -0
  85. package/dist/toolchain/gh.js +36 -0
  86. package/dist/toolchain/gh.js.map +1 -0
  87. package/dist/toolchain/mise.d.ts +92 -0
  88. package/dist/toolchain/mise.d.ts.map +1 -0
  89. package/dist/toolchain/mise.js +346 -0
  90. package/dist/toolchain/mise.js.map +1 -0
  91. package/dist/toolchain/rtk.d.ts +27 -0
  92. package/dist/toolchain/rtk.d.ts.map +1 -0
  93. package/dist/toolchain/rtk.js +76 -0
  94. package/dist/toolchain/rtk.js.map +1 -0
  95. package/dist/wizard/build.d.ts +24 -0
  96. package/dist/wizard/build.d.ts.map +1 -0
  97. package/dist/wizard/build.js +64 -0
  98. package/dist/wizard/build.js.map +1 -0
  99. package/package.json +80 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cristian Radu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,320 @@
1
+ # agentenv
2
+
3
+ > Give AI coding agents a consistent, capable shell environment on Windows,
4
+ > macOS, and Linux — with minimal setup friction, and without maintaining any
5
+ > dev tools yourself.
6
+
7
+ `agentenv` is a thin orchestration + config layer on top of
8
+ [mise](https://mise.jdx.dev) (tool installation), [rtk](https://github.com/rtk-ai/rtk)
9
+ (command rewriting + hooks), and [AGENTS.md](https://agents.md) (repo-level
10
+ instructions). It never re-implements any dev tool — it just drives mise/rtk
11
+ and writes config files for you.
12
+
13
+ It targets four AI coding agents: **Claude Code**, **OpenAI Codex CLI**,
14
+ **GitHub Copilot** (CLI/Chat), and **OpenCode**.
15
+
16
+ > **⚠️ Not yet published to npm.** `npm install -g agentenv` does not work
17
+ > yet — see [Install](#install) below for installing from source in the
18
+ > meantime. Everything else in this guide (commands, config, tool catalog)
19
+ > already works once you've built it locally.
20
+
21
+ ## Contents
22
+
23
+ - [Why agentenv](#why-agentenv)
24
+ - [Requirements](#requirements)
25
+ - [Install](#install)
26
+ - [Quick start](#quick-start)
27
+ - [Commands](#commands)
28
+ - [Configuration (`agentenv.toml`)](#configuration-agentenvtoml)
29
+ - [Tool catalog](#tool-catalog)
30
+ - [Custom tools](#custom-tools)
31
+ - [Optional integrations (experimental, not yet active)](#optional-integrations-experimental-not-yet-active)
32
+ - [Troubleshooting](#troubleshooting)
33
+ - [Development](#development)
34
+ - [What's still missing](#whats-still-missing)
35
+
36
+ ## Why agentenv
37
+
38
+ If you've ever had an AI coding agent fumble because `grep`/`fd`/`jq` weren't
39
+ on PATH, or watched every agent redo the same hook-wiring dance for a
40
+ different config file format, that's what this fixes:
41
+
42
+ - **One command** (`agentenv setup`) gets a fresh machine — Windows included
43
+ — to a working state for whichever of the four agents you have installed.
44
+ - **A single source of truth** (`agentenv.toml`) drives everything else:
45
+ `mise.toml`, `AGENTS.md`/`CLAUDE.md`, and each agent's own hook files are
46
+ all generated from it, never hand-maintained.
47
+ - **Nothing is reinstalled or reinvented.** Tool installation is 100% mise;
48
+ command rewriting/hooks are 100% rtk. agentenv only ever calls out to them
49
+ and writes config.
50
+ - **Safe to re-run.** `agentenv apply` is idempotent — run it as often as you
51
+ like; with no config change it touches nothing and reinstalls nothing.
52
+
53
+ ## Requirements
54
+
55
+ - **Node.js >= 22.13** to run the CLI itself.
56
+ - **[mise](https://mise.jdx.dev)** installed and on PATH — agentenv generates
57
+ a `mise.toml` and delegates all tool installation to it. Without mise,
58
+ `agentenv apply`/`setup` can still generate config files but can't install
59
+ anything.
60
+ - **Git for Windows**, if you're on Windows — agentenv's Tier 0 shell fix
61
+ relies on the POSIX toolchain it bundles.
62
+ - Optionally, whichever of the four agents you want configured already
63
+ installed (agentenv detects what's present; it doesn't install the agents
64
+ themselves).
65
+
66
+ ## Install
67
+
68
+ ### From source (works today)
69
+
70
+ ```sh
71
+ git clone https://github.com/indy2kro/agentenv.git
72
+ cd agentenv/cmd/agentenv
73
+ npm install
74
+ npm run build
75
+ npm link # makes `agentenv` available globally on PATH
76
+ ```
77
+
78
+ `npm link` symlinks this checkout's `dist/index.js` as the global `agentenv`
79
+ binary — rerun `npm run build` after pulling changes, no need to `npm link`
80
+ again. Prefer not to touch global state? Run it in place instead:
81
+
82
+ ```sh
83
+ node dist/index.js setup
84
+ ```
85
+
86
+ ### From npm (coming soon)
87
+
88
+ ```sh
89
+ npm install -g agentenv
90
+ ```
91
+
92
+ This will work once the package is published — see
93
+ [What's still missing](#whats-still-missing).
94
+
95
+ ## Quick start
96
+
97
+ ```sh
98
+ agentenv setup
99
+ ```
100
+
101
+ This is Simple mode: it auto-detects which of the four agents are installed,
102
+ offers the default tool set (Tier 1 always, Tier 2 unless you decline),
103
+ writes `agentenv.toml`, and wires everything up in one pass — including the
104
+ Windows shell fix if you're on Windows. Answer three prompts (agents, Tier 2
105
+ on/off, project vs. user scope) and you're done.
106
+
107
+ Prefer full control over exactly which tools and agents get configured?
108
+ Run `agentenv configure` instead (see [Commands](#commands)).
109
+
110
+ Not in an interactive terminal (CI, a script)? `setup`/`configure` both
111
+ refuse to run and tell you to use `agentenv apply` against a hand-written or
112
+ previously-saved `agentenv.toml` instead.
113
+
114
+ ## Commands
115
+
116
+ | Command | What it does |
117
+ |---|---|
118
+ | `agentenv setup` | Interactive first-run wizard, Simple mode: detect agents, pick Tier 1(+2) tools, pick scope, then applies immediately. |
119
+ | `agentenv configure` | Interactive Advanced-mode wizard: pick agents, the full Tier 1–3 tool picker, add custom binaries, choose scope, toggle rtk, review a diff of what will change, then confirm before applying. Re-run any time — it pre-fills every prompt from your current `agentenv.toml`. |
120
+ | `agentenv apply [--skip-mise-install]` | Non-interactive: read `agentenv.toml` and (re)generate everything — `mise.toml`, `AGENTS.md`/`CLAUDE.md`, per-agent hook files, the Tier 0 shell fix. Safe to run in CI or a script. `--skip-mise-install` generates files only, without running `mise install` (useful for a fast dry-run or when mise isn't available). |
121
+ | `agentenv status` | Read-only report: what's configured, what's actually installed, and where the two disagree (drift) — per agent, per tool, per generated file. |
122
+ | `agentenv --version` / `agentenv --help` | Standard `commander`-generated version/help output; every subcommand also takes `--help`. |
123
+
124
+ `setup`/`configure` both write `agentenv.toml` and then call the same
125
+ `apply` logic internally, so the end state is identical either way — the
126
+ only difference is how you got there.
127
+
128
+ ## Configuration (`agentenv.toml`)
129
+
130
+ Everything flows from one file. It lives either in the project root
131
+ (`./agentenv.toml`, scope = `"project"`, committed to the repo so your whole
132
+ team shares it) or in your user config dir
133
+ (`~/.config/agentenv/agentenv.toml` — or the Windows equivalent via
134
+ `%USERPROFILE%`, scope = `"user"`). `agentenv apply`/`status` look in the
135
+ project directory first, then fall back to the user-scope file.
136
+
137
+ `mise.toml`, `AGENTS.md`, `CLAUDE.md`, and the per-agent hook files are all
138
+ **generated outputs** of `agentenv apply` — never hand-edit them; edit
139
+ `agentenv.toml` and re-run `apply` (or `configure`) instead. Regeneration
140
+ only touches a marker-block section of `AGENTS.md`/`CLAUDE.md`, so any
141
+ content you've added outside that block survives.
142
+
143
+ Full annotated example:
144
+
145
+ ```toml
146
+ # "project" (default, committed to the repo) or "user" (global, ~/.config/agentenv/)
147
+ scope = "project"
148
+
149
+ [agents]
150
+ claude_code = true
151
+ codex_cli = true
152
+ copilot = true
153
+ opencode = true
154
+
155
+ [tools]
156
+ # Tier 1 (essential, on by default)
157
+ ripgrep = true
158
+ fd = true
159
+ jq = true
160
+ rtk = true
161
+ # Tier 2 (AI-coding value-add, on by default)
162
+ ast_grep = true
163
+ git_delta = true
164
+ gh = true
165
+ difftastic = true
166
+ # Tier 3 (power-user, off by default) — see the Tool catalog below for the full list
167
+ yq = false
168
+ bat = false
169
+ # ...
170
+
171
+ # Your own tool, already installed somewhere on the machine
172
+ [[custom_tools]]
173
+ name = "mytool"
174
+ description = "Internal linter wrapper"
175
+ already_installed = true
176
+ path_windows = "C:\\tools\\mytool.exe"
177
+ path_macos = "/usr/local/bin/mytool"
178
+ path_linux = "/usr/local/bin/mytool"
179
+
180
+ # Your own tool, installable via mise (e.g. it publishes GitHub releases)
181
+ [[custom_tools]]
182
+ name = "otherthing"
183
+ mise_source = "github:someorg/otherthing"
184
+ version = "latest"
185
+
186
+ [rtk]
187
+ enabled = true
188
+ [rtk.init]
189
+ claude_code = true
190
+ codex_cli = true
191
+ copilot = true
192
+ opencode = true
193
+
194
+ [tier0]
195
+ check_enabled = true # Windows POSIX-shell fix; set false to skip it
196
+
197
+ [generate]
198
+ marker_start = "<!-- agentenv-managed-start -->"
199
+ marker_end = "<!-- agentenv-managed-end -->"
200
+ files = ["AGENTS.md", "CLAUDE.md"]
201
+
202
+ # See "Optional integrations" below — this section is parsed and validated
203
+ # today, but agentenv apply/status do not act on it yet.
204
+ [integrations.superpowers]
205
+ enabled = false
206
+ ```
207
+
208
+ Every field is optional — omit anything and it falls back to the documented
209
+ default. Run `agentenv configure` if you'd rather build this file
210
+ interactively than hand-write it; the review screen at the end shows you the
211
+ exact diff before anything is written.
212
+
213
+ ## Tool catalog
214
+
215
+ | Tier | Tools | Default |
216
+ |---|---|---|
217
+ | **1 — essential** | `ripgrep` (rg), `fd`, `jq`, `rtk` | always on |
218
+ | **2 — AI-coding value-add** | `ast_grep` (sg), `git_delta` (delta), `gh`, `difftastic` (difft) | on (Simple mode asks once) |
219
+ | **3 — power-user** | `universal_ctags`, `yq`, `bat`, `eza`, `miller` (mlr), `tokei`, `hyperfine`, `fzf`, `just`, `watchexec`, `direnv` | off — pick individually via `agentenv configure` |
220
+
221
+ All of Tiers 1–3 install through mise the same way — no separate mechanism.
222
+ Two tools (`universal_ctags`, `tokei`) aren't in mise's registry on every
223
+ platform; enabling them prints a validation warning suggesting a
224
+ `custom_tools` fallback entry instead.
225
+
226
+ ## Custom tools
227
+
228
+ Anything not in the catalog — an internal CLI, a niche tool, anything you
229
+ already have — goes in `[[custom_tools]]` (see the example above). Two
230
+ supported shapes:
231
+
232
+ - **Already installed:** `already_installed = true` plus whichever of
233
+ `path_windows`/`path_macos`/`path_linux` apply. `agentenv status` checks
234
+ the path for your current OS and flags it if missing.
235
+ - **Installable via mise:** `mise_source = "github:owner/repo"` (mise's
236
+ generic backend, works for most tools that publish GitHub release
237
+ archives) plus an optional `version` (defaults to `"latest"`).
238
+
239
+ Custom tools flow through the exact same "config changed → regenerate
240
+ `AGENTS.md`/hooks" pipeline as catalog tools.
241
+
242
+ ## Optional integrations (experimental, not yet active)
243
+
244
+ `agentenv.toml` has a `[integrations.superpowers]` section for optionally
245
+ installing [Superpowers](https://github.com/obra/superpowers) — a
246
+ third-party Claude Code skill/methodology plugin — through its own
247
+ documented installer, never bundled or forked. The schema is fully
248
+ implemented today (validation, defaults, `agentenv configure`'s pending
249
+ opt-in step) but **`agentenv apply`/`status` do not act on it yet** — setting
250
+ `enabled = true` today parses and validates cleanly but has no effect. See
251
+ [What's still missing](#whats-still-missing).
252
+
253
+ When it lands, only Claude Code will get a fully automated install (via
254
+ `claude plugin marketplace add` / `claude plugin install`, pinned to a
255
+ specific `ref`) — Codex CLI, Copilot, and OpenCode have no safe
256
+ non-interactive installer documented upstream today, so they'll always
257
+ report "unsupported" with manual-install instructions instead. See
258
+ [`docs/research/superpowers-install-mechanisms.md`](../../docs/research/superpowers-install-mechanisms.md)
259
+ for why.
260
+
261
+ `agentenv` also never touches GitHub credentials: a `gh` auth-status probe
262
+ (`gh auth status --hostname github.com`, read-only, never `gh auth login`)
263
+ exists in the codebase but — like the rest of this section — isn't wired
264
+ into `agentenv status`'s output yet either.
265
+
266
+ ## Troubleshooting
267
+
268
+ - **`agentenv setup`/`configure` exits immediately saying it's
269
+ interactive** — you're running it in a non-TTY context (CI, a piped
270
+ script). Use `agentenv apply` against a config file instead.
271
+ - **A tool shows as enabled in `agentenv status` but not found on PATH** —
272
+ run `agentenv apply` (it calls `mise install`), or check that mise itself
273
+ is installed and on PATH. `--skip-mise-install` intentionally leaves tools
274
+ uninstalled; don't use it for your real run.
275
+ - **Windows: agents aren't picking up ripgrep/fd/etc.** — check the "Tier 0
276
+ (shell)" block in `agentenv status`. If it reports not POSIX-compatible,
277
+ re-run `agentenv apply`; if Git Bash truly isn't installed, install
278
+ [Git for Windows](https://gitforwindows.org) first.
279
+ - **A hook file has content you added by hand, and you're worried `apply`
280
+ will clobber it** — it won't. Regeneration only replaces the marker-block
281
+ section (`<!-- agentenv-managed-start -->` … `<!-- agentenv-managed-end
282
+ -->`); everything else in the file is left alone.
283
+ - **`agentenv apply` reports a validation error and refuses to run** — fix
284
+ the listed field in `agentenv.toml`; errors block `apply` deliberately
285
+ (warnings don't).
286
+
287
+ ## Development
288
+
289
+ ```sh
290
+ npm install
291
+ npm run build # tsc -> dist/
292
+ npm test # build + node:test suites
293
+ npm run lint # eslint --max-warnings 0
294
+ npm run format:check
295
+ ```
296
+
297
+ See [`docs/guides/adding-an-adapter.md`](../../docs/guides/adding-an-adapter.md)
298
+ for wiring in a fifth agent, and
299
+ [`docs/plans/agentenv-dev-plan.md`](../../docs/plans/agentenv-dev-plan.md)
300
+ for the full design, config schema rationale, and phase roadmap.
301
+
302
+ ## What's still missing
303
+
304
+ - **npm publish.** The package is not yet on the npm registry —
305
+ `npm install -g agentenv` doesn't work today; install
306
+ [from source](#install) instead. (Needs npm publish credentials on a
307
+ maintainer's machine; everything else — `npm pack`, a real
308
+ `npm install -g` from a tarball, CI — is already verified working.)
309
+ - **Optional integrations aren't wired up yet.** The `[integrations.superpowers]`
310
+ config schema, its Claude Code installer adapter, and the read-only `gh`
311
+ auth probe all exist and are tested, but nothing in `apply`, `status`,
312
+ `setup`, or `configure` calls them yet — see
313
+ [Optional integrations](#optional-integrations-experimental-not-yet-active)
314
+ above. Tracked in
315
+ [`docs/plans/agentenv-dev-plan.md`](../../docs/plans/agentenv-dev-plan.md)
316
+ Phase 6.
317
+
318
+ ## License
319
+
320
+ MIT
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Base Adapter Interface
3
+ * Defines the common interface for all agent adapters
4
+ */
5
+ import type { RtkInitFn } from '../toolchain/rtk.js';
6
+ export interface AdapterConfig {
7
+ enabled: boolean;
8
+ baseDir: string;
9
+ rtkEnabled?: boolean;
10
+ /** Injectable `rtk init` runner; defaults to the real rtk binary. */
11
+ rtkInit?: RtkInitFn;
12
+ }
13
+ export interface AdapterResult {
14
+ success: boolean;
15
+ message: string;
16
+ filesCreated: string[];
17
+ filesModified: string[];
18
+ errors: string[];
19
+ }
20
+ export interface HookConfig {
21
+ name: string;
22
+ type: 'pre' | 'post' | 'session' | 'tool';
23
+ command: string;
24
+ description: string;
25
+ }
26
+ export declare abstract class BaseAdapter {
27
+ protected config: AdapterConfig;
28
+ constructor(config: AdapterConfig);
29
+ /**
30
+ * Initialize the adapter
31
+ */
32
+ abstract initialize(): Promise<AdapterResult>;
33
+ /**
34
+ * Configure hooks for the agent
35
+ */
36
+ abstract configureHooks(): Promise<AdapterResult>;
37
+ /**
38
+ * Get the agent name
39
+ */
40
+ abstract getName(): string;
41
+ /**
42
+ * Check if the agent is installed
43
+ */
44
+ abstract isInstalled(): boolean;
45
+ /**
46
+ * Get the agent's configuration directory
47
+ */
48
+ abstract getConfigDir(): string;
49
+ /**
50
+ * Clean up any generated files
51
+ */
52
+ abstract cleanup(): Promise<AdapterResult>;
53
+ /**
54
+ * Get agent-specific environment variables
55
+ */
56
+ getEnvVars(): Record<string, string>;
57
+ }
58
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/adapters/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qEAAqE;IACrE,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,8BAAsB,WAAW;IAC/B,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;gBAEpB,MAAM,EAAE,aAAa;IAIjC;;OAEG;IACH,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;IAE7C;;OAEG;IACH,QAAQ,CAAC,cAAc,IAAI,OAAO,CAAC,aAAa,CAAC;IAEjD;;OAEG;IACH,QAAQ,CAAC,OAAO,IAAI,MAAM;IAE1B;;OAEG;IACH,QAAQ,CAAC,WAAW,IAAI,OAAO;IAE/B;;OAEG;IACH,QAAQ,CAAC,YAAY,IAAI,MAAM;IAE/B;;OAEG;IACH,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IAE1C;;OAEG;IACH,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAGrC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Base Adapter Interface
3
+ * Defines the common interface for all agent adapters
4
+ */
5
+ export class BaseAdapter {
6
+ constructor(config) {
7
+ this.config = config;
8
+ }
9
+ /**
10
+ * Get agent-specific environment variables
11
+ */
12
+ getEnvVars() {
13
+ return {};
14
+ }
15
+ }
16
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/adapters/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,MAAM,OAAgB,WAAW;IAG/B,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAgCD;;OAEG;IACH,UAAU;QACR,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Claude Code Adapter
3
+ * Handles Claude Code-specific configuration and hook setup
4
+ */
5
+ import { BaseAdapter, AdapterConfig, AdapterResult } from './base.js';
6
+ export declare class ClaudeCodeAdapter extends BaseAdapter {
7
+ private configDir;
8
+ constructor(config: AdapterConfig);
9
+ getName(): string;
10
+ getConfigDir(): string;
11
+ isInstalled(): boolean;
12
+ initialize(): Promise<AdapterResult>;
13
+ configureHooks(): Promise<AdapterResult>;
14
+ cleanup(): Promise<AdapterResult>;
15
+ getEnvVars(): Record<string, string>;
16
+ /**
17
+ * Generate CLAUDE.md content
18
+ */
19
+ private generateClaudeMdContent;
20
+ }
21
+ //# sourceMappingURL=claude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGtE,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,aAAa;IAMjC,OAAO,IAAI,MAAM;IAIjB,YAAY,IAAI,MAAM;IAItB,WAAW,IAAI,OAAO;IAIhB,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;IA2CpC,cAAc,IAAI,OAAO,CAAC,aAAa,CAAC;IAqFxC,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IA8CvC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAWpC;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAmBhC"}
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Claude Code Adapter
3
+ * Handles Claude Code-specific configuration and hook setup
4
+ */
5
+ import * as fs from 'fs';
6
+ import * as path from 'path';
7
+ import { BaseAdapter } from './base.js';
8
+ import { isAgentInstalled } from './detect.js';
9
+ export class ClaudeCodeAdapter extends BaseAdapter {
10
+ constructor(config) {
11
+ super(config);
12
+ const home = process.env.HOME || process.env.USERPROFILE || '';
13
+ this.configDir = path.join(home, '.claude');
14
+ }
15
+ getName() {
16
+ return 'Claude Code';
17
+ }
18
+ getConfigDir() {
19
+ return this.configDir;
20
+ }
21
+ isInstalled() {
22
+ return isAgentInstalled('claude_code');
23
+ }
24
+ async initialize() {
25
+ const result = {
26
+ success: true,
27
+ message: '',
28
+ filesCreated: [],
29
+ filesModified: [],
30
+ errors: [],
31
+ };
32
+ if (!this.config.enabled) {
33
+ result.message = 'Claude Code adapter not enabled';
34
+ return result;
35
+ }
36
+ // Create config directory if it doesn't exist
37
+ try {
38
+ if (!fs.existsSync(this.configDir)) {
39
+ fs.mkdirSync(this.configDir, { recursive: true });
40
+ result.filesCreated.push(this.configDir);
41
+ }
42
+ }
43
+ catch (err) {
44
+ result.success = false;
45
+ result.errors.push(`Failed to create config directory: ${err instanceof Error ? err.message : String(err)}`);
46
+ }
47
+ // Initialize settings.json with RTK hooks if enabled
48
+ if (this.config.rtkEnabled) {
49
+ const hookResult = await this.configureHooks();
50
+ if (hookResult.success) {
51
+ result.filesCreated.push(...hookResult.filesCreated);
52
+ result.filesModified.push(...hookResult.filesModified);
53
+ }
54
+ else {
55
+ result.success = false;
56
+ result.errors.push(...hookResult.errors);
57
+ }
58
+ }
59
+ result.message = 'Claude Code adapter initialized';
60
+ return result;
61
+ }
62
+ async configureHooks() {
63
+ const result = {
64
+ success: true,
65
+ message: '',
66
+ filesCreated: [],
67
+ filesModified: [],
68
+ errors: [],
69
+ };
70
+ if (!this.config.enabled) {
71
+ result.message = 'Claude Code adapter not enabled';
72
+ return result;
73
+ }
74
+ const settingsPath = path.join(this.configDir, 'settings.json');
75
+ // Claude Code stores hooks by event, then matcher. This matches the
76
+ // structure written by `rtk init` and preserves existing hook entries.
77
+ const rtkHook = {
78
+ matcher: 'Bash',
79
+ hooks: [{ type: 'command', command: 'rtk hook claude' }],
80
+ };
81
+ try {
82
+ let settings = {};
83
+ // Load existing settings if they exist
84
+ if (fs.existsSync(settingsPath)) {
85
+ const content = fs.readFileSync(settingsPath, 'utf-8');
86
+ try {
87
+ settings = JSON.parse(content);
88
+ }
89
+ catch {
90
+ // Invalid JSON, start fresh
91
+ settings = {};
92
+ }
93
+ }
94
+ if (!settings.hooks || Array.isArray(settings.hooks))
95
+ settings.hooks = {};
96
+ if (!Array.isArray(settings.hooks.PreToolUse))
97
+ settings.hooks.PreToolUse = [];
98
+ // Check if RTK hook already exists
99
+ const hasRtkHook = settings.hooks.PreToolUse.some((entry) => entry.matcher === 'Bash' &&
100
+ entry.hooks?.some((hook) => hook.command === 'rtk hook claude'));
101
+ if (!hasRtkHook) {
102
+ settings.hooks.PreToolUse.push(rtkHook);
103
+ }
104
+ // Save settings
105
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
106
+ if (!hasRtkHook) {
107
+ result.filesModified.push(settingsPath);
108
+ result.message = `Added RTK PreToolUse hook to Claude Code settings at ${settingsPath}`;
109
+ }
110
+ else {
111
+ result.message = `RTK hook already exists in Claude Code settings`;
112
+ }
113
+ }
114
+ catch (err) {
115
+ result.success = false;
116
+ result.errors.push(`Failed to configure Claude Code hooks: ${err instanceof Error ? err.message : String(err)}`);
117
+ }
118
+ // Also create CLAUDE.md pointing to AGENTS.md
119
+ const claudeMdPath = path.join(this.config.baseDir, 'CLAUDE.md');
120
+ try {
121
+ const claudeMdContent = this.generateClaudeMdContent();
122
+ if (!fs.existsSync(claudeMdPath)) {
123
+ fs.writeFileSync(claudeMdPath, claudeMdContent);
124
+ result.filesCreated.push(claudeMdPath);
125
+ }
126
+ }
127
+ catch (err) {
128
+ result.errors.push(`Failed to create CLAUDE.md: ${err instanceof Error ? err.message : String(err)}`);
129
+ }
130
+ return result;
131
+ }
132
+ async cleanup() {
133
+ const result = {
134
+ success: true,
135
+ message: '',
136
+ filesCreated: [],
137
+ filesModified: [],
138
+ errors: [],
139
+ };
140
+ const settingsPath = path.join(this.configDir, 'settings.json');
141
+ try {
142
+ if (fs.existsSync(settingsPath)) {
143
+ let settings = {};
144
+ const content = fs.readFileSync(settingsPath, 'utf-8');
145
+ try {
146
+ settings = JSON.parse(content);
147
+ }
148
+ catch {
149
+ return result;
150
+ }
151
+ // Remove RTK hooks
152
+ if (Array.isArray(settings.hooks?.PreToolUse)) {
153
+ settings.hooks.PreToolUse = settings.hooks.PreToolUse.filter((entry) => !(entry.matcher === 'Bash' &&
154
+ entry.hooks?.some((hook) => hook.command === 'rtk hook claude')));
155
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
156
+ result.filesModified.push(settingsPath);
157
+ }
158
+ }
159
+ }
160
+ catch (err) {
161
+ result.success = false;
162
+ result.errors.push(`Failed to cleanup Claude Code: ${err instanceof Error ? err.message : String(err)}`);
163
+ }
164
+ result.message = 'Claude Code adapter cleaned up';
165
+ return result;
166
+ }
167
+ getEnvVars() {
168
+ const env = {};
169
+ // Set SHELL to bash.exe on Windows if RTK is enabled
170
+ if (process.platform === 'win32' && this.config.rtkEnabled) {
171
+ env.SHELL = 'bash.exe';
172
+ }
173
+ return env;
174
+ }
175
+ /**
176
+ * Generate CLAUDE.md content
177
+ */
178
+ generateClaudeMdContent() {
179
+ return `# CLAUDE.md
180
+
181
+ This file provides Claude Code-specific instructions.
182
+
183
+ ## General Instructions
184
+
185
+ Please see [AGENTS.md](./AGENTS.md) for the complete list of AI agent instructions.
186
+
187
+ The instructions in AGENTS.md apply to Claude Code as well.
188
+
189
+ ## Claude Code Specific Notes
190
+
191
+ - AGENTS.md is the source of truth for tool availability and usage instructions
192
+ - All tools listed in AGENTS.md are available for use
193
+ - RTK hooks are configured to optimize command execution
194
+ - Use RTK-optimized commands for better performance and token efficiency
195
+ `;
196
+ }
197
+ }
198
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAgC,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAGhD,YAAY,MAAqB;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;QAC/D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;IA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