Commit graph

77 commits

Author SHA1 Message Date
Kit Langton
fce074726f refactor(core): migrate ConfigPermission.Info to Effect Schema canonical
Follow-up to #23716. Moves ConfigPermission.Info from zod-first (with a
preprocess hack) to Effect Schema canonical using Schema.StructWithRest +
Schema.decodeTo, and deletes the now-unused ZodPreprocess plumbing.

Core change: rule precedence in `Permission.fromConfig` now sorts top-level
keys so wildcard permissions (e.g. `*`, `mcp_*`) come before specific
ones (e.g. `bash`, `edit`). Combined with `findLast` in evaluate(),
this gives the intuitive semantic 'specific tool rules override the `*`
fallback' regardless of the user's JSON key order. This silently fixes the
previously-broken case `{bash: "allow", "*": "deny"}` (which under
the old semantics denied bash because `*` came last).

Once rule precedence no longer depends on JSON insertion order, the
`__originalKeys` + ZodPreprocess hack can go — StructWithRest's natural
canonicalisation is fine because fromConfig sorts anyway.

- src/config/permission.ts: rewrite. InputObject is StructWithRest with known
  permission keys (read/edit/bash/... as Rule, todowrite/webfetch/... as
  Action-only for type narrowing) + Record rest. Schema.decodeTo normalises
  the Action shorthand into { "*": action }. .zod is derived — walker
  already carries the decodeTo transform.
- src/config/config.ts, src/config/agent.ts: reference ConfigPermission.Info
  directly instead of via Schema.Any + ZodOverride. The Effect decoder now
  applies the permission transform at load time.
- src/permission/index.ts: fromConfig sorts wildcards-before-specifics at
  top level. Sub-pattern order inside a tool key is preserved (documented
  `*` first, specifics after).
- src/util/effect-zod.ts: delete ZodPreprocess symbol, its walkUncached
  branch, and the TODO comment. Zero remaining consumers.
- test/permission/next.test.ts: 6 new tests pinning the new semantics —
  order-independent precedence, wildcard-as-fallback, sub-pattern order
  preservation, canonical documented-example regression guard.
- test/config/config.test.ts: updated the "preserves key order" test to
  reflect the new canonical output shape (declaration-order known fields,
  then input-order rest keys). Behavioural guarantees live in the new
  permission tests.
- test/util/effect-zod.test.ts: delete the ZodPreprocess describe block
  (~115 lines of tests for the now-removed feature).

SDK diff vs dev:
- Removed `__originalKeys?: Array<string>` (internal leak).
- Catchall cleaned up (no unrelated `Array<string>`).
- Known-field types preserved (autocomplete + narrowing).
- Only shape change: PermissionConfig union order swap (commutative).

Safety audit: no config, test, or doc in the repo (including all 16
translations) exercises the pattern where specifics come before wildcards
at the top level. The only configs whose behaviour changes are ones that
were silently broken.
2026-04-21 17:38:24 -04:00
Kit Langton
ecc06a3d8f
refactor(core): make Config.Info canonical Effect Schema (#23716) 2026-04-21 14:06:47 -04:00
Aiden Cline
2486621ca1
chore: kill unused tool (#23701) 2026-04-21 11:31:20 -04:00
Kit Langton
e7686dbd64
feat(effect-zod): translate Schema.check filters into zod .superRefine + promote LSP refinement to Effect layer (#23173) 2026-04-17 20:46:05 +00:00
Dax
467be08e67
refactor: consolidate npm exports and trace flock acquisition (#23151) 2026-04-17 18:58:37 +00:00
Dax Raad
2f73e73e9d trace npm fully 2026-04-17 14:08:45 -04:00
Dax
220e3e9a2b
refactor: make formatter config opt-in (#22997) 2026-04-17 02:33:09 +00:00
Dax
01bb54a94d
refactor: split config parsing steps (#22996) 2026-04-17 01:57:43 +00:00
Kit Langton
c026e25088
refactor: eliminate account/ barrel, route consumers to sibling files (#22995) 2026-04-17 01:55:50 +00:00
Kit Langton
5d47ea0918
refactor: unwrap ConfigMCP namespace + self-reexport (#22948) 2026-04-16 19:52:04 -04:00
Dax Raad
03e20e6ac1 core: modularize config parsing to improve maintainability
Extract error handling, parsing logic, and variable substitution into dedicated
modules. This reduces duplication between tui.json and opencode.json parsing
and makes the config system easier to extend for future config formats.
2026-04-16 13:29:03 -04:00
Dax Raad
33bb847a1d config: refactor 2026-04-16 12:40:24 -04:00
Dax Raad
bfffc3c2c6 tui: ensure TUI plugins load with proper project context when multiple directories are open
Fixes potential plugin resolution issues when switching between projects by wrapping
plugin loading in Instance.provide(). This ensures each plugin resolves dependencies
relative to its correct project directory instead of inheriting context from whatever
instance happened to be active.

Also reorganizes config loading code into focused modules (command.ts, managed.ts,
plugin.ts) to make the codebase easier to maintain and test.
2026-04-16 12:40:24 -04:00
Dax
ef90b93205
fix: restore .gitignore logic for config dirs and migrate to shared Npm service (#22772) 2026-04-16 03:14:06 -04:00
Dax
675a46e23e
CLI perf: reduce deps (#22652) 2026-04-16 02:03:03 -04:00
Kit Langton
9f4b73b6a3
fix: clean up final 16 no-unused-vars warnings (#22751) 2026-04-16 03:54:21 +00:00
Kit Langton
8aa0f9fe95
feat: enable type-aware no-base-to-string rule, fix 56 violations (#22750) 2026-04-16 03:50:47 +00:00
Kit Langton
1ca257e356
feat: unwrap config namespaces to flat exports + barrel (#22746) 2026-04-15 23:29:14 -04:00
Kit Langton
343a564183
feat: unwrap 11 util namespaces to flat exports + barrel (#22739) 2026-04-15 23:15:58 -04:00
Kit Langton
6c7e9f6f3a
refactor: migrate Effect call sites from Flock to EffectFlock (#22688) 2026-04-16 02:39:59 +00:00
Kit Langton
bbdbc107ae
feat: unwrap Config namespace to flat exports + barrel (#22689) 2026-04-15 21:26:24 -04:00
Dax
be9432a893
shared package (#22626) 2026-04-15 14:26:20 +00:00
Kit Langton
6a99079012
kit/env instance state (#22383) 2026-04-13 22:28:16 -04:00
Kit Langton
14ccff4037
refactor(agent): remove async facade exports (#22341) 2026-04-13 14:54:01 -04:00
Kit Langton
f7c6943817
refactor(config): remove async facade exports (#22325) 2026-04-13 13:11:05 -04:00
Kit Langton
321bf1f8e1
refactor: finish small effect service adoption cleanups (#22094) 2026-04-13 09:17:13 -04:00
Luke Parker
77a462c930
fix(tui): default Ctrl+Z to undo on Windows (#21138) 2026-04-06 02:38:35 +00:00
Kit Langton
6ea108a03b
feat(tui): show console-managed providers (#20956) 2026-04-04 19:05:45 -04:00
Lenny Vaknine
7e32f80d82
feat: add macOS managed preferences support for enterprise MDM deployments (#19178)
Co-authored-by: Lenny Vaknine <lvaknine@gitlab.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
2026-04-02 12:52:49 -05:00
Sebastian
f6fd43e574
Refactor plugin/config loading, add theme-only plugin package support (#20556) 2026-04-01 23:50:22 +00:00
Dax
c9326fc199
refactor: replace BunProc with Npm module using @npmcli/arborist (#18308)
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Brendan Allan <git@brendonovich.dev>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
2026-04-01 21:01:37 +00:00
Sebastian
25a2b739e6
warn only and ignore plugins without entrypoints, default config via exports (#20284) 2026-03-31 17:14:03 +02:00
Sebastian
fa95a61c4e
Refactor into plugin loader and do not enforce (#20112) 2026-03-30 20:36:21 +02:00
Sebastian
ff13524a53
fix flaky plugin tests (no mock.module for bun) (#19445) 2026-03-27 20:55:03 +01:00
Sebastian
6274b0677c
tui plugins (#19347) 2026-03-27 15:00:26 +01:00
Kit Langton
9c6f1edfd7
refactor(effect): yield services instead of promise facades (#19325) 2026-03-26 21:46:38 -04:00
Kit Langton
28f5176ffd
effectify Config service (#19139) 2026-03-26 13:07:01 -04:00
Aiden Cline
77fc88c8ad
chore: remove dead code for todoread tool (#19128) 2026-03-25 16:21:42 +00:00
Kit Langton
38e0dc9ccd
Move service state into InstanceState, flatten service facades (#18483) 2026-03-21 04:51:35 +00:00
Shoubhit Dash
d4ae13f2a0
fix(opencode): serialize config bun installs (#17342) 2026-03-13 17:58:00 +05:30
Kit Langton
dbc00aa8e0
feat(id): brand ProjectID through Drizzle and Zod schemas (#16948) 2026-03-11 16:44:26 -04:00
Dax
613562f504
core: make account login upgrades safe while adding multi-account workspace auth (#15487)
Co-authored-by: Kit Langton <kit.langton@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 12:53:47 -04:00
Luke Parker
8a95be492d
fix(windows): git path resolution for modified files across Git Bash, MSYS2, and Cygwin (#16422) 2026-03-07 15:42:14 +10:00
Matt Silverlock
74ebb4147f
fix(auth): normalize trailing slashes in auth login URLs (#15874) 2026-03-03 13:35:49 -05:00
Sebastian
9d29d692c6
split tui/server config (#13968) 2026-02-25 23:53:09 +01:00
Luke Parker
1af3e9e557
fix(win32): fix plugin resolution with createRequire fallback (#14898) 2026-02-24 22:20:57 +10:00
Luke Parker
659068942e
fix(win32): handle CRLF line endings in markdown frontmatter parsing (#14886) 2026-02-24 20:33:22 +10:00
Dax
02a9495063
Remove use of Bun.file (#14215) 2026-02-19 11:32:32 -05:00
Ariane Emory
1893473148
fix: token substitution in OPENCODE_CONFIG_CONTENT (alternate take) (#14047) 2026-02-18 23:18:24 -06:00
Aiden Cline
1fb6c0b5b3
Revert "fix: token substitution in OPENCODE_CONFIG_CONTENT" (#13429) 2026-02-12 23:24:31 -06:00