oh-my-opencode 4.11.0 → 4.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/agents/atlas/agent.d.ts +3 -2
  2. package/dist/agents/sisyphus/glm-5-2.d.ts +4 -0
  3. package/dist/agents/sisyphus/index.d.ts +1 -0
  4. package/dist/agents/sisyphus-agent-config.d.ts +1 -0
  5. package/dist/agents/sisyphus-junior/agent.d.ts +1 -1
  6. package/dist/agents/sisyphus-junior/glm-5-2.d.ts +1 -0
  7. package/dist/agents/sisyphus-junior/index.d.ts +1 -0
  8. package/dist/cli/index.js +25 -26
  9. package/dist/cli-node/index.js +25 -26
  10. package/dist/hooks/keyword-detector/ultrawork/glm.d.ts +2 -0
  11. package/dist/hooks/keyword-detector/ultrawork/index.d.ts +4 -2
  12. package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +5 -4
  13. package/dist/index.js +953 -31
  14. package/dist/skills/init-deep/SKILL.md +21 -26
  15. package/dist/skills/programming/SKILL.md +25 -121
  16. package/dist/skills/programming/references/code-smells.md +390 -0
  17. package/package.json +13 -13
  18. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  19. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +26 -12
  20. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  21. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  22. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +8 -4
  23. package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
  24. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +8 -7
  25. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +11 -10
  26. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  27. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  28. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  29. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  30. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  31. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  32. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  33. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  34. package/packages/omo-codex/plugin/components/rules/dist/cli.js +2 -2
  35. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  36. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  37. package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +2 -2
  38. package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +3 -0
  39. package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
  40. package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
  41. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  42. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  43. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  44. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  45. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
  46. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  47. package/packages/omo-codex/plugin/hooks/hooks.json +19 -19
  48. package/packages/omo-codex/plugin/package-lock.json +12 -12
  49. package/packages/omo-codex/plugin/package.json +1 -1
  50. package/packages/omo-codex/plugin/scripts/auto-update.mjs +1 -1
  51. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +21 -26
  52. package/packages/omo-codex/plugin/skills/programming/SKILL.md +25 -121
  53. package/packages/omo-codex/plugin/skills/programming/references/code-smells.md +390 -0
  54. package/packages/omo-codex/plugin/test/auto-update.test.mjs +1 -1
  55. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +31 -0
  56. package/packages/omo-codex/scripts/install-dist/install-local.mjs +30 -13
  57. package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +24 -0
  58. package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +36 -0
  59. package/packages/shared-skills/skills/init-deep/SKILL.md +21 -26
  60. package/packages/shared-skills/skills/programming/SKILL.md +25 -121
  61. package/packages/shared-skills/skills/programming/references/code-smells.md +390 -0
@@ -0,0 +1,390 @@
1
+ # Code Smells — Full Reference
2
+
3
+ When any of these smells is detected, **STOP and re-examine your design.** A code smell is not a syntax error — it is a signal that the current structure deserves a second look. The correct response is to assess whether `/refactor` is warranted, fix the smell, or document a SPECIFIC justification for carrying it. "It's fine" is not a justification.
4
+
5
+ ---
6
+
7
+ ## Smell 1 — File exceeds 250 pure LOC
8
+
9
+ ### Why 250
10
+
11
+ At 250 pure LOC a file still fits in one screen on a 32-inch monitor with a 14pt font. A reviewer can hold the whole thing in working memory and spot a cross-cutting bug. At 500 LOC they cannot. At 1000 LOC they stop trying. The number is the cognitive ceiling of a single human reviewer who has not memorized the file.
12
+
13
+ A file past this line is telling you:
14
+
15
+ - The module is doing more than one thing.
16
+ - Multiple cohesive units got merged "to save a file."
17
+ - Re-exports, barrels, and orchestrators got fused into pure-logic units.
18
+ - Every future reader pays a tax to find what they need.
19
+
20
+ ### Measuring pure LOC
21
+
22
+ ```bash
23
+ # Quick (line-comment + blank exclusion):
24
+ awk '!/^[[:space:]]*$/ && !/^[[:space:]]*(\/\/|#|--)/' <file> | wc -l
25
+
26
+ # Authoritative (handles block comments correctly):
27
+ cloc --by-file <file> # the "code" column is the number
28
+ ```
29
+
30
+ ### Required behavior when detected
31
+
32
+ **Creating a file that will exceed 250 pure LOC.** Split it before the first commit. Carve by responsibility, one cohesive unit per file. Use a barrel (`__init__.py`, `mod.rs`, `index.ts`) for re-exports ONLY — never for logic.
33
+
34
+ **Editing a file that already exceeds 250 pure LOC and your edit adds lines.** Refactor the unit you are touching into its own file BEFORE adding the new lines. The split is part of THIS task, not a follow-up someone will never do.
35
+
36
+ **Reading a file that exceeds 250 pure LOC while implementing a feature.** Surface the smell in your reply, propose a concrete split, and ask the user whether to split now or carry the smell.
37
+
38
+ ### Forbidden escapes
39
+
40
+ - Counting comments and blank lines toward the budget. **Pure LOC means code lines.**
41
+ - Splitting by token count (`foo_1.py`, `module_part_A.rs`, `service-2.ts`). Split by what each file DOES.
42
+ - Catch-all dump files: `utils.py`, `helpers.ts`, `lib.rs` (as a logic dump), `common.py`, `shared.ts`.
43
+ - "It's generated, so it's fine." Only true if the file lives in `dist/`, `target/`, `__generated__/`.
44
+ - "It's a test file with many cases." Split by SUT or by behavior cluster.
45
+ - "230 pure LOC, close enough." A 230-LOC file about to grow is already at the limit. Split now.
46
+
47
+ ### Acceptable exceptions (rare, require justification)
48
+
49
+ A file may legitimately exceed 250 pure LOC if **and only if** it is:
50
+
51
+ - A truly indivisible single-responsibility unit (e.g., a generated parser table, a state machine whose states share a single closure). Mark with `// allow: SIZE_OK — <reason>`.
52
+ - A pure data table (translation strings, error code lookup, brand color palette).
53
+
54
+ `// allow: SIZE_OK` without a justifying comment is itself slop.
55
+
56
+ ### Concrete split examples
57
+
58
+ #### Python — BEFORE (`user_service.py`, 412 pure LOC)
59
+
60
+ ```python
61
+ # user_service.py — DOES TOO MUCH
62
+ class UserRepository: ... # 90 LOC of SQLAlchemy
63
+ class UserValidator: ... # 60 LOC of Pydantic + business rules
64
+ class PasswordHasher: ... # 40 LOC of bcrypt wrapper
65
+ class EmailSender: ... # 50 LOC of httpx2 client
66
+ class UserService: ... # 130 LOC orchestrating the four above
67
+ def _build_query(...): ... # 25 LOC helper
68
+ def _format_email(...): ... # 17 LOC helper
69
+ ```
70
+
71
+ #### Python — AFTER (split by responsibility)
72
+
73
+ ```
74
+ src/myapp/users/
75
+ ├── __init__.py # barrel: re-exports UserService only (5 LOC)
76
+ ├── repository.py # UserRepository (~95 LOC)
77
+ ├── validator.py # UserValidator (~65 LOC)
78
+ ├── password.py # PasswordHasher (~45 LOC)
79
+ ├── notifier.py # EmailSender (renamed — the role, not the verb)
80
+ ├── service.py # UserService (orchestrator) (~135 LOC)
81
+ └── _queries.py # _build_query (private) (~30 LOC)
82
+ ```
83
+
84
+ #### Rust — BEFORE (`auth.rs`, 380 pure LOC)
85
+
86
+ ```rust
87
+ // auth.rs — DOES TOO MUCH
88
+ pub struct Session { ... } // 40 LOC
89
+ impl Session { ... } // 90 LOC of methods
90
+ pub struct TokenIssuer { ... } // 30 LOC
91
+ impl TokenIssuer { ... } // 70 LOC
92
+ pub struct RateLimiter { ... } // 50 LOC
93
+ impl RateLimiter { ... } // 70 LOC
94
+ fn parse_authorization_header(...) { ... } // 30 LOC
95
+ ```
96
+
97
+ #### Rust — AFTER
98
+
99
+ ```
100
+ src/auth/
101
+ ├── mod.rs # re-exports Session, TokenIssuer, RateLimiter (8 LOC)
102
+ ├── session.rs # Session + impl (~130 LOC)
103
+ ├── token.rs # TokenIssuer + impl (~100 LOC)
104
+ ├── rate_limit.rs # RateLimiter + impl (~120 LOC)
105
+ └── header.rs # parse_authorization_header (~35 LOC)
106
+ ```
107
+
108
+ #### TypeScript — BEFORE (`api/orders.ts`, 510 pure LOC)
109
+
110
+ ```typescript
111
+ // api/orders.ts — DOES TOO MUCH
112
+ export const OrderSchema = z.object({ ... }) // 30 LOC
113
+ type Order = z.infer<typeof OrderSchema>
114
+ export class OrderRepository { ... } // 110 LOC
115
+ export class PricingEngine { ... } // 130 LOC
116
+ export class TaxCalculator { ... } // 90 LOC
117
+ export class OrderService { ... } // 150 LOC
118
+ ```
119
+
120
+ #### TypeScript — AFTER
121
+
122
+ ```
123
+ src/orders/
124
+ ├── index.ts # barrel (6 LOC)
125
+ ├── schema.ts # OrderSchema + Order type (~35 LOC)
126
+ ├── repository.ts # OrderRepository (~115 LOC)
127
+ ├── pricing.ts # PricingEngine (~135 LOC)
128
+ ├── tax.ts # TaxCalculator (~95 LOC)
129
+ └── service.ts # OrderService (orchestrator) (~155 LOC)
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Smell 2 — Function with more than 3 parameters
135
+
136
+ ### Why 3
137
+
138
+ A function's parameters are its contract with every caller. More than 3 independent inputs overwhelm the caller's working memory and signal one of two design problems:
139
+
140
+ 1. **The function does too much.** It should be two functions.
141
+ 2. **Related parameters belong together.** They should be a typed struct/object — a domain concept, not a parameter bag.
142
+
143
+ ### Workaround detection — THESE COUNT AS THE SAME SMELL
144
+
145
+ Disguising parameter count does not fix the design. The following patterns are the same smell wearing a different hat:
146
+
147
+ **Dict/map smuggling:**
148
+ ```python
149
+ # SMELL — hiding 6 args in a dict
150
+ def create_order(params: dict[str, Any]) -> Order: ...
151
+ ```
152
+ ```typescript
153
+ // SMELL — untyped options bag
154
+ function createOrder(opts: Record<string, unknown>): Order { ... }
155
+ ```
156
+ ```go
157
+ // SMELL — map instead of typed params
158
+ func CreateOrder(params map[string]any) (*Order, error) { ... }
159
+ ```
160
+
161
+ **Variadic/kwargs catch-all:**
162
+ ```python
163
+ # SMELL — hiding real params behind kwargs
164
+ def send_notification(recipient: str, **kwargs) -> None: ...
165
+ ```
166
+ ```typescript
167
+ // SMELL — rest params to avoid naming args
168
+ function sendNotification(recipient: string, ...args: unknown[]): void { ... }
169
+ ```
170
+
171
+ **Config object that wraps positional args:**
172
+ ```python
173
+ # SMELL — "options" object that exists only to bundle what would be positional args
174
+ @dataclass
175
+ class CreateUserOptions:
176
+ name: str
177
+ email: str
178
+ password: str
179
+ role: str
180
+ department: str
181
+ manager_id: int
182
+ # 6 fields, used by exactly one function, no defaults
183
+
184
+ def create_user(opts: CreateUserOptions) -> User: ...
185
+ ```
186
+
187
+ **When the options object is NOT a smell:** when it represents a genuine domain concept reused across multiple call sites with sensible defaults for most fields (e.g., `HttpClientConfig`, `DatabaseConnectionOptions`, `RetryPolicy`).
188
+
189
+ ### The fix
190
+
191
+ Group related parameters into typed value objects with domain names:
192
+
193
+ ```python
194
+ # CLEAN — grouped by domain concept
195
+ @dataclass(frozen=True)
196
+ class UserIdentity:
197
+ name: str
198
+ email: str
199
+
200
+ @dataclass(frozen=True)
201
+ class OrgPlacement:
202
+ role: str
203
+ department: str
204
+ manager_id: int
205
+
206
+ def create_user(identity: UserIdentity, placement: OrgPlacement, password: str) -> User: ...
207
+ # 3 params, each a meaningful concept
208
+ ```
209
+
210
+ ```typescript
211
+ // CLEAN — typed grouping
212
+ interface ShippingDetails {
213
+ readonly address: string;
214
+ readonly city: string;
215
+ readonly zip: string;
216
+ readonly country: string;
217
+ }
218
+
219
+ function createOrder(customer: CustomerId, items: readonly LineItem[], shipping: ShippingDetails): Order { ... }
220
+ // 3 params, shipping is a reusable domain type
221
+ ```
222
+
223
+ ```go
224
+ // CLEAN — struct with domain meaning
225
+ type Placement struct {
226
+ Role string
227
+ Department string
228
+ ManagerID UserID
229
+ }
230
+
231
+ func CreateUser(identity UserIdentity, placement Placement, password string) (*User, error) { ... }
232
+ ```
233
+
234
+ If 4+ truly independent inputs are required, justify it — the justification must name WHY these inputs cannot be grouped, not just "the function needs them all."
235
+
236
+ ---
237
+
238
+ ## Smell 3 — Redundant verification after a destructive action
239
+
240
+ ### Why this is slop
241
+
242
+ The contract of a destructive operation (delete, remove, clear, drop) IS the verification. If the operation returns without error, the thing is gone. Re-querying to "confirm" is:
243
+
244
+ 1. **Dead code.** The check can never fail unless the operation itself is broken — in which case fix the operation, not the caller.
245
+ 2. **Misleading.** It teaches the next reader (human or AI) that the operation is unreliable.
246
+ 3. **Performance waste.** An unnecessary round-trip to the database, filesystem, or data structure.
247
+
248
+ This pattern is the hallmark of AI-generated defensive bloat. LLMs produce it because they optimize for "looking thorough" over "being correct." **Recognize it. Delete it.**
249
+
250
+ ### Examples
251
+
252
+ ```python
253
+ # SLOP — delete then verify deletion
254
+ db.delete(user)
255
+ db.commit()
256
+ remaining = db.query(User).filter_by(id=user.id).first()
257
+ assert remaining is None # the ORM already guaranteed this
258
+
259
+ # CLEAN
260
+ db.delete(user)
261
+ db.commit()
262
+ ```
263
+
264
+ ```typescript
265
+ // SLOP — remove from array then check it's gone
266
+ items = items.filter(i => i.id !== targetId);
267
+ if (items.find(i => i.id === targetId)) {
268
+ throw new Error("removal failed"); // impossible by construction
269
+ }
270
+
271
+ // CLEAN
272
+ items = items.filter(i => i.id !== targetId);
273
+ ```
274
+
275
+ ```go
276
+ // SLOP — delete row then SELECT to confirm
277
+ _, err := db.ExecContext(ctx, "DELETE FROM users WHERE id = $1", id)
278
+ if err != nil { return err }
279
+ row := db.QueryRowContext(ctx, "SELECT id FROM users WHERE id = $1", id)
280
+ if err := row.Scan(&check); err != sql.ErrNoRows {
281
+ return fmt.Errorf("delete verification failed")
282
+ }
283
+
284
+ // CLEAN
285
+ _, err := db.ExecContext(ctx, "DELETE FROM users WHERE id = $1", id)
286
+ if err != nil { return err }
287
+ ```
288
+
289
+ ```rust
290
+ // SLOP — remove from HashMap then check absence
291
+ map.remove(&key);
292
+ if map.contains_key(&key) {
293
+ panic!("removal failed"); // HashMap::remove is not broken
294
+ }
295
+
296
+ // CLEAN
297
+ map.remove(&key);
298
+ ```
299
+
300
+ ### Broader pattern — same smell, different disguise
301
+
302
+ Any of these are the same defect:
303
+
304
+ - Calling a **setter** then immediately calling the **getter** to "confirm" the value changed.
305
+ - **Writing** a file then **reading** it back to "verify" the write.
306
+ - **Inserting** a row then **SELECT-ing** it to "confirm" the insert.
307
+ - **Pushing** to an array then checking `.length` increased by 1.
308
+ - **Assigning** a variable then asserting the variable equals the assigned value.
309
+
310
+ **The contract of the operation IS the verification.** If you cannot trust the operation's return, the defect is in the operation — fix it there, not at the call site.
311
+
312
+ ---
313
+
314
+ ## Smell 4 — Negative-form names and conditions
315
+
316
+ ### Why positive form wins
317
+
318
+ Every negation forces the reader to mentally invert. One negation is tolerable. Two (`if !isNotReady`) is a logic puzzle. Codebases that default to negative naming accumulate double and triple negations that nobody can review confidently.
319
+
320
+ Positive form reads in the direction of intent: "is this ready?" rather than "is this not-not-ready?"
321
+
322
+ ### Naming
323
+
324
+ | Negative (SMELL) | Positive (CLEAN) |
325
+ |---|---|
326
+ | `isNotValid` | `isValid` (invert branch) |
327
+ | `isDisabled` | `isEnabled` |
328
+ | `noErrors` | `isClean` / `errorsResolved` |
329
+ | `notFound` | `found` (invert branch) |
330
+ | `isNotEmpty` | `hasItems` / `isPopulated` |
331
+ | `missingAuth` | `hasAuth` / `isAuthenticated` |
332
+ | `cannotProceed` | `canProceed` (invert branch) |
333
+
334
+ Name the **presence** of the quality you care about, not the absence of its opposite.
335
+
336
+ ### Conditions
337
+
338
+ ```python
339
+ # SMELL — double negative
340
+ if not is_invalid(token):
341
+ proceed()
342
+
343
+ # CLEAN — single positive check
344
+ if is_valid(token):
345
+ proceed()
346
+ ```
347
+
348
+ ```typescript
349
+ // SMELL — negated boolean in branch
350
+ if (!user.isNotVerified) {
351
+ grantAccess();
352
+ }
353
+
354
+ // CLEAN — positive name, direct check
355
+ if (user.isVerified) {
356
+ grantAccess();
357
+ }
358
+ ```
359
+
360
+ ```go
361
+ // SMELL — inverted negative
362
+ if !config.DisableLogging {
363
+ log.Info("starting")
364
+ }
365
+
366
+ // CLEAN — positive flag
367
+ if config.LoggingEnabled {
368
+ log.Info("starting")
369
+ }
370
+ ```
371
+
372
+ ```rust
373
+ // SMELL — negated negative
374
+ if !skip_validation {
375
+ validate(&input)?;
376
+ }
377
+
378
+ // CLEAN — positive gate
379
+ if should_validate {
380
+ validate(&input)?;
381
+ }
382
+ ```
383
+
384
+ ### When negation IS appropriate
385
+
386
+ - **Early returns / guard clauses:** `if !authorized { return Err(...) }` — the negative form IS the intent (reject the bad case).
387
+ - **Filtering out:** `items.filter(|x| !x.is_expired())` — the negation describes the keep/discard decision directly.
388
+ - **Error state names:** `Error`, `Failed`, `Timeout` are negative concepts by nature — do not force them into positive wrappers like `isSuccessAbsent`.
389
+
390
+ The rule is not "never use negation." The rule is: **when you have a choice between naming the presence and naming the absence, name the presence.** The branch logic follows from the name, not the other way around.
@@ -313,7 +313,7 @@ test("#given marketplace plugin root without install snapshot #when running chec
313
313
  assert.equal(result.reason, "marketplace-flow");
314
314
  assert.equal(result.notices.length, 1);
315
315
  assert.match(result.notices[0], /codex plugin marketplace upgrade sisyphuslabs/);
316
- assert.match(result.notices[0], /re-approve/);
316
+ assert.match(result.notices[0], /hook re-approval/);
317
317
  await assert.rejects(readFile(spawnLogPath, "utf8"), { code: "ENOENT" });
318
318
  const state = JSON.parse(await readFile(env.LAZYCODEX_AUTO_UPDATE_STATE_PATH, "utf8"));
319
319
  assert.equal(state.lastCheckedAt, 123_456);
@@ -127,6 +127,37 @@ test("#given a completed first run #when the worker setup runs again #then confi
127
127
  });
128
128
  });
129
129
 
130
+ test("#given a package-relative CodeGraph MCP path #when worker setup runs #then the path is stamped absolute", async () => {
131
+ await withSetupFixture(async (fixture) => {
132
+ await writeFile(
133
+ join(fixture.pluginRoot, ".mcp.json"),
134
+ `${JSON.stringify(
135
+ {
136
+ mcpServers: {
137
+ codegraph: {
138
+ args: ["components/codegraph/dist/serve.js"],
139
+ command: "node",
140
+ cwd: ".",
141
+ required: false,
142
+ },
143
+ git_bash: { args: ["serve"], command: "node", env: {} },
144
+ },
145
+ },
146
+ null,
147
+ "\t",
148
+ )}\n`,
149
+ );
150
+
151
+ await runWorkerSetup(setupOptions(fixture));
152
+
153
+ const manifest = JSON.parse(await readFile(join(fixture.pluginRoot, ".mcp.json"), "utf8"));
154
+ assert.deepEqual(manifest.mcpServers.codegraph.args, [
155
+ join(fixture.pluginRoot, "components", "codegraph", "dist", "serve.js"),
156
+ ]);
157
+ assert.equal(manifest.mcpServers.codegraph.cwd, ".");
158
+ });
159
+ });
160
+
130
161
  test("#given bootstrap-managed staging #when agents are linked #then nothing is persisted under PLUGIN_ROOT", async () => {
131
162
  await withSetupFixture(async (fixture) => {
132
163
  await runWorkerSetup(setupOptions(fixture));
@@ -5907,7 +5907,7 @@ var package_default;
5907
5907
  var init_package = __esm(() => {
5908
5908
  package_default = {
5909
5909
  name: "@oh-my-opencode/omo-codex",
5910
- version: "4.11.0",
5910
+ version: "4.11.1",
5911
5911
  type: "module",
5912
5912
  private: true,
5913
5913
  description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
@@ -6979,6 +6979,7 @@ async function collectPackageJsonPaths(directory, root, paths) {
6979
6979
  // packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
6980
6980
  import { readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises";
6981
6981
  import { join as join7, sep as sep3 } from "node:path";
6982
+ var CODEGRAPH_RELATIVE_ARGS = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
6982
6983
  async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
6983
6984
  const manifestPath = join7(pluginRoot, ".mcp.json");
6984
6985
  if (!await fileExistsStrict(manifestPath))
@@ -7004,6 +7005,8 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
7004
7005
  const bundledMcpRuntimeArg = resolveBundledMcpRuntimeArg(pluginRoot, arg);
7005
7006
  if (bundledMcpRuntimeArg !== null)
7006
7007
  return bundledMcpRuntimeArg;
7008
+ if (CODEGRAPH_RELATIVE_ARGS.has(arg))
7009
+ return join7(pluginRoot, "components", "codegraph", "dist", "serve.js");
7007
7010
  if (arg.startsWith("./") || arg.startsWith("../"))
7008
7011
  return resolveCachedRuntimePath(pluginRoot, sourceRoot, arg);
7009
7012
  return arg;
@@ -13230,30 +13233,44 @@ function readVersionManifest(path2) {
13230
13233
  import { readFile as readFile17, writeFile as writeFile10 } from "node:fs/promises";
13231
13234
  import { join as join30 } from "node:path";
13232
13235
  var GIT_BASH_ENV_KEY2 = "OMO_CODEX_GIT_BASH_PATH";
13236
+ var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
13233
13237
  async function stampGitBashMcpEnv(input) {
13234
- if (input.platform !== "win32")
13235
- return false;
13236
- const rawOverride = input.env?.[GIT_BASH_ENV_KEY2];
13237
- const override = typeof rawOverride === "string" ? rawOverride.trim() : "";
13238
- if (override === "")
13239
- return false;
13240
13238
  const manifestPath = join30(input.pluginRoot, ".mcp.json");
13241
13239
  if (!await fileExistsStrict(manifestPath))
13242
13240
  return false;
13243
13241
  const parsed = JSON.parse(await readFile17(manifestPath, "utf8"));
13244
13242
  if (!isPlainRecord(parsed) || !isPlainRecord(parsed["mcpServers"]))
13245
13243
  return false;
13246
- const gitBashServer = parsed["mcpServers"]["git_bash"];
13247
- if (!isPlainRecord(gitBashServer))
13248
- return false;
13249
- const serverEnv = isPlainRecord(gitBashServer["env"]) ? gitBashServer["env"] : {};
13250
- if (serverEnv[GIT_BASH_ENV_KEY2] === override)
13244
+ let changed = stampCodegraphMcpPath(parsed["mcpServers"], input.pluginRoot);
13245
+ if (input.platform === "win32") {
13246
+ const rawOverride = input.env?.[GIT_BASH_ENV_KEY2];
13247
+ const override = typeof rawOverride === "string" ? rawOverride.trim() : "";
13248
+ const gitBashServer = parsed["mcpServers"]["git_bash"];
13249
+ if (override !== "" && isPlainRecord(gitBashServer)) {
13250
+ const serverEnv = isPlainRecord(gitBashServer["env"]) ? gitBashServer["env"] : {};
13251
+ if (serverEnv[GIT_BASH_ENV_KEY2] !== override) {
13252
+ gitBashServer["env"] = { ...serverEnv, [GIT_BASH_ENV_KEY2]: override };
13253
+ changed = true;
13254
+ }
13255
+ }
13256
+ }
13257
+ if (!changed)
13251
13258
  return false;
13252
- gitBashServer["env"] = { ...serverEnv, [GIT_BASH_ENV_KEY2]: override };
13253
13259
  await writeFile10(manifestPath, `${JSON.stringify(parsed, null, "\t")}
13254
13260
  `);
13255
13261
  return true;
13256
13262
  }
13263
+ function stampCodegraphMcpPath(mcpServers, pluginRoot) {
13264
+ const codegraphServer = mcpServers["codegraph"];
13265
+ if (!isPlainRecord(codegraphServer) || !Array.isArray(codegraphServer["args"]))
13266
+ return false;
13267
+ const args = codegraphServer["args"];
13268
+ const entrypoint = args[0];
13269
+ if (typeof entrypoint !== "string" || !CODEGRAPH_RELATIVE_ARGS2.has(entrypoint))
13270
+ return false;
13271
+ codegraphServer["args"] = [join30(pluginRoot, "components", "codegraph", "dist", "serve.js"), ...args.slice(1)];
13272
+ return true;
13273
+ }
13257
13274
  // packages/omo-codex/src/install/codex-hook-targets.ts
13258
13275
  import { readFile as readFile18 } from "node:fs/promises";
13259
13276
  import { join as join31, sep as sep8 } from "node:path";
@@ -62,6 +62,30 @@ test("#given a non-Windows install #when stamping #then the manifest stays byte-
62
62
  assert.equal(await readFile(join(pluginRoot, ".mcp.json"), "utf8"), MANIFEST);
63
63
  });
64
64
 
65
+ test("#given a package-relative CodeGraph MCP path #when stamping on non-Windows #then codegraph server arg becomes absolute", async (t) => {
66
+ const pluginRoot = await mkdtemp(join(tmpdir(), "git-bash-mcp-env-"));
67
+ t.after(() => rm(pluginRoot, { recursive: true, force: true }));
68
+ await writeFile(
69
+ join(pluginRoot, ".mcp.json"),
70
+ `${JSON.stringify(
71
+ {
72
+ mcpServers: {
73
+ codegraph: { args: ["components/codegraph/dist/serve.js"], command: "node" },
74
+ git_bash: { command: "node", args: ["../../git-bash-mcp/dist/cli.js", "mcp"] },
75
+ },
76
+ },
77
+ null,
78
+ "\t",
79
+ )}\n`,
80
+ );
81
+
82
+ const changed = await stampGitBashMcpEnv({ pluginRoot, env: {}, platform: "darwin" });
83
+
84
+ assert.equal(changed, true);
85
+ const parsed = JSON.parse(await readFile(join(pluginRoot, ".mcp.json"), "utf8"));
86
+ assert.deepEqual(parsed.mcpServers.codegraph.args, [join(pluginRoot, "components", "codegraph", "dist", "serve.js")]);
87
+ });
88
+
65
89
  test("#given the override already stamped #when stamping again #then nothing changes", async (t) => {
66
90
  const pluginRoot = await createPluginRoot();
67
91
  t.after(() => rm(pluginRoot, { recursive: true, force: true }));
@@ -104,6 +104,42 @@ test("#given plugin-local MCP runtime #when installing cached plugin #then manif
104
104
  assert.deepEqual(cachedMcp.mcpServers.omo.args, [join(result.path, "dist", "cli.js")]);
105
105
  });
106
106
 
107
+ test("#given CodeGraph MCP runtime in plugin cache #when installing cached plugin #then manifest points at cached plugin before bootstrap", async () => {
108
+ const repoRoot = await makeTempDir();
109
+ const codexHome = await makeTempDir();
110
+ const sourceRoot = join(repoRoot, "packages", "omo-codex", "plugin");
111
+
112
+ await writeJson(join(sourceRoot, "package.json"), {
113
+ name: "@example/omo",
114
+ version: "0.1.0",
115
+ });
116
+ await writeJson(join(sourceRoot, ".mcp.json"), {
117
+ mcpServers: {
118
+ codegraph: {
119
+ command: "node",
120
+ args: ["components/codegraph/dist/serve.js"],
121
+ cwd: ".",
122
+ required: false,
123
+ },
124
+ },
125
+ });
126
+ await writeJson(join(sourceRoot, "components", "codegraph", "dist", "serve.js"), { executable: true });
127
+
128
+ const result = await installCachedPlugin({
129
+ codexHome,
130
+ marketplaceName: "sisyphuslabs",
131
+ name: "omo",
132
+ runCommand: async () => {},
133
+ sourcePath: sourceRoot,
134
+ version: "0.1.0",
135
+ });
136
+
137
+ const cachedMcp = JSON.parse(await readFile(join(result.path, ".mcp.json"), "utf8"));
138
+
139
+ assert.deepEqual(cachedMcp.mcpServers.codegraph.args, [join(result.path, "components", "codegraph", "dist", "serve.js")]);
140
+ assert.equal(Object.hasOwn(cachedMcp.mcpServers.codegraph, "cwd"), false);
141
+ });
142
+
107
143
  test("#given external MCP package not in the generated bundled runtime set #when installing cached plugin #then manifest args point at source", async () => {
108
144
  const repoRoot = await makeTempDir();
109
145
  const codexHome = await makeTempDir();