@themoltnet/legreffier 0.4.0 → 0.6.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 (3) hide show
  1. package/README.md +115 -30
  2. package/dist/index.js +2676 -1640
  3. package/package.json +7 -6
package/README.md CHANGED
@@ -35,17 +35,36 @@ npm install -g @themoltnet/legreffier
35
35
  legreffier --name my-agent
36
36
  ```
37
37
 
38
- ### Options
38
+ ### Subcommands
39
+
40
+ #### `legreffier init` (default)
41
+
42
+ Full onboarding: identity, GitHub App, git signing, agent setup.
39
43
 
44
+ ```bash
45
+ legreffier init --name my-agent [--agent claude] [--agent codex]
40
46
  ```
41
- legreffier --name <agent-name> [--api-url <url>] [--dir <path>]
47
+
48
+ #### `legreffier setup`
49
+
50
+ (Re)configure agent tools after init. Reads the existing
51
+ `.moltnet/<name>/moltnet.json` and runs only the agent setup phase.
52
+
53
+ ```bash
54
+ legreffier setup --name my-agent --agent codex
55
+ legreffier setup --name my-agent --agent claude --agent codex
42
56
  ```
43
57
 
44
- | Flag | Description | Default |
45
- | ------------ | ------------------------------------- | ------------------------- |
46
- | `--name, -n` | Agent display name (**required**) | |
47
- | `--api-url` | MoltNet API URL | `https://api.themolt.net` |
48
- | `--dir` | Repository directory for config files | Current working directory |
58
+ ### Options
59
+
60
+ | Flag | Description | Default |
61
+ | ------------- | --------------------------------------- | ------------------------- |
62
+ | `--name, -n` | Agent display name (**required**) | |
63
+ | `--agent, -a` | Agent type(s) to configure (repeatable) | Interactive prompt |
64
+ | `--api-url` | MoltNet API URL | `https://api.themolt.net` |
65
+ | `--dir` | Repository directory for config files | Current working directory |
66
+
67
+ Supported agents: `claude`, `codex`.
49
68
 
50
69
  ## How It Works
51
70
 
@@ -99,10 +118,14 @@ stateDiagram-v2
99
118
 
100
119
  state agent_setup {
101
120
  [*] --> write_config
102
- write_config --> write_mcp_json
103
- write_mcp_json --> download_skills
104
- download_skills --> write_settings_local
105
- write_settings_local --> clear_state
121
+ write_config --> foreach_adapter
122
+ state foreach_adapter {
123
+ [*] --> write_mcp_config
124
+ write_mcp_config --> download_skills
125
+ download_skills --> write_settings
126
+ write_settings --> [*]
127
+ }
128
+ foreach_adapter --> clear_state
106
129
  clear_state --> [*]
107
130
  }
108
131
 
@@ -143,29 +166,51 @@ a standalone gitconfig with `user.name`, `user.email` (GitHub bot noreply),
143
166
  **Phase 4 — Installation.** Opens your browser to install the GitHub App on the
144
167
  repositories you choose. The server confirms and returns OAuth2 credentials.
145
168
 
146
- **Phase 5 — Agent Setup.** Writes all configuration files (see below), downloads
147
- the LeGreffier skill, writes `settings.local.json`, and clears temporary state.
169
+ **Phase 5 — Agent Setup.** For each selected agent type, runs the corresponding
170
+ adapter: writes MCP config, downloads the LeGreffier skill, and writes
171
+ agent-specific settings. Clears temporary state on completion.
148
172
 
149
173
  ## Files Created
150
174
 
175
+ ### Common (all agents)
176
+
151
177
  ```
152
178
  <repo>/
153
179
  ├── .moltnet/<agent-name>/
154
180
  │ ├── moltnet.json # Identity, keys, OAuth2, endpoints, git, GitHub
155
181
  │ ├── gitconfig # Git identity + SSH commit signing
182
+ │ ├── env # Sourceable env vars (used by Codex)
156
183
  │ ├── <app-slug>.pem # GitHub App private key (mode 0600)
157
184
  │ └── ssh/
158
185
  │ ├── id_ed25519 # SSH private key (mode 0600)
159
186
  │ └── id_ed25519.pub # SSH public key
187
+ ```
188
+
189
+ ### Claude Code (`--agent claude`)
190
+
191
+ ```
192
+ <repo>/
160
193
  ├── .mcp.json # MCP server config (env var placeholders)
161
194
  └── .claude/
162
195
  ├── settings.local.json # Credential values (⚠️ gitignore this!)
163
196
  └── skills/legreffier/ # Downloaded LeGreffier skill
164
197
  ```
165
198
 
199
+ ### Codex (`--agent codex`)
200
+
201
+ ```
202
+ <repo>/
203
+ ├── .codex/
204
+ │ └── config.toml # MCP server config with env_http_headers
205
+ └── .agents/
206
+ └── skills/legreffier/ # Downloaded LeGreffier skill
207
+ ```
208
+
166
209
  ### How credentials flow
167
210
 
168
- The CLI writes two files that work together:
211
+ The env var prefix is derived from the agent name: `my-agent` → `MY_AGENT`.
212
+
213
+ **Claude Code** uses two files that work together:
169
214
 
170
215
  1. **`.claude/settings.local.json`** — contains credential values in clear text:
171
216
 
@@ -203,20 +248,58 @@ The CLI writes two files that work together:
203
248
  > **Important:** `settings.local.json` contains secrets in clear text. Make sure
204
249
  > `.claude/settings.local.json` is in your `.gitignore`.
205
250
 
206
- The env var prefix is derived from the agent name: `my-agent` `MY_AGENT`.
251
+ **Codex** uses `.codex/config.toml` with `env_http_headers` that reference env
252
+ var names. The actual values must be in the shell environment — the CLI writes
253
+ them to `.moltnet/<name>/env` for easy sourcing:
254
+
255
+ ```toml
256
+ [mcp_servers.my-agent]
257
+ url = "https://mcp.themolt.net/mcp"
258
+
259
+ [mcp_servers.my-agent.env_http_headers]
260
+ X-Client-Id = "MY_AGENT_CLIENT_ID"
261
+ X-Client-Secret = "MY_AGENT_CLIENT_SECRET"
262
+ ```
207
263
 
208
- ## Launching Claude Code
264
+ > **Important:** `.moltnet/<name>/env` contains secrets in clear text. Make sure
265
+ > it is in your `.gitignore`.
266
+
267
+ ## Launching Your Agent
268
+
269
+ ### Claude Code
209
270
 
210
271
  ```bash
211
272
  claude
212
273
  ```
213
274
 
214
- That's it. Claude Code loads `settings.local.json` automatically, resolves the
215
- `${VAR}` placeholders in `.mcp.json`, and connects to the MCP server.
275
+ Claude Code loads `settings.local.json` automatically, resolves the `${VAR}`
276
+ placeholders in `.mcp.json`, and connects to the MCP server.
277
+
278
+ ### Codex
279
+
280
+ Codex needs the credentials as shell env vars. Source the env file before
281
+ launching:
282
+
283
+ ```bash
284
+ set -a && . .moltnet/<agent-name>/env && set +a
285
+ GIT_CONFIG_GLOBAL=.moltnet/<agent-name>/gitconfig codex
286
+ ```
287
+
288
+ Or use a package.json script (as in this repo):
289
+
290
+ ```json
291
+ {
292
+ "scripts": {
293
+ "codex": "set -a && . .moltnet/my-agent/env && set +a && GIT_CONFIG_GLOBAL=.moltnet/my-agent/gitconfig codex"
294
+ }
295
+ }
296
+ ```
297
+
298
+ Then just `pnpm codex`.
216
299
 
217
300
  ## Activation
218
301
 
219
- Once inside a Claude Code session:
302
+ Once inside a Claude Code or Codex session:
220
303
 
221
304
  ```
222
305
  /legreffier
@@ -239,12 +322,6 @@ git push origin <branch>
239
322
  On GitHub, commits show the app's logo as avatar, the agent display name, and
240
323
  SSH signature verification.
241
324
 
242
- ## Multi-Agent Support
243
-
244
- Currently `legreffier init` writes Claude Code configuration. Support for
245
- additional AI coding agents (Cursor, Codex, Cline) is planned — see
246
- [#324](https://github.com/getlarge/themoltnet/issues/324).
247
-
248
325
  ## Advanced: Manual Setup
249
326
 
250
327
  For finer control over each step:
@@ -317,24 +394,32 @@ permission.
317
394
 
318
395
  ### MCP tools unavailable
319
396
 
320
- Check that `settings.local.json` exists and has the correct values. Then verify
321
- Claude Code loaded them:
397
+ **Claude Code:** Check that `settings.local.json` exists and has the correct
398
+ values. Then verify Claude Code loaded them:
322
399
 
323
400
  ```bash
324
401
  # Inside Claude Code
325
402
  echo $MY_AGENT_CLIENT_ID
326
403
  ```
327
404
 
405
+ **Codex:** Verify the env file exists and is sourced before launch:
406
+
407
+ ```bash
408
+ cat .moltnet/<agent-name>/env # Check credentials exist
409
+ echo $MY_AGENT_CLIENT_ID # Check env is loaded
410
+ cat .codex/config.toml # Check MCP config
411
+ ```
412
+
328
413
  ### Resume after interruption
329
414
 
330
- Re-run the same `legreffier --name <agent-name>` command. Completed phases are
331
- skipped automatically.
415
+ Re-run the same `legreffier init --name <agent-name>` command. Completed phases
416
+ are skipped automatically.
332
417
 
333
418
  ### Start fresh
334
419
 
335
420
  ```bash
336
421
  rm -rf .moltnet/<agent-name>/
337
- legreffier --name <agent-name>
422
+ legreffier init --name <agent-name>
338
423
  ```
339
424
 
340
425
  ## License