@codeworksh/cli 0.0.1-dev.20260923023259 → 0.0.1-dev.20260923102823

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 (78) hide show
  1. package/README.md +16 -18
  2. package/{add--i7mPR73.mjs → add-D1yPPRz2.mjs} +4 -4
  3. package/{add--i7mPR73.mjs.map → add-D1yPPRz2.mjs.map} +1 -1
  4. package/catalog-BtH_l7f2.mjs +17 -0
  5. package/catalog-BtH_l7f2.mjs.map +1 -0
  6. package/{check-Dq2WOgap.mjs → check-B7Uh_G-l.mjs} +4 -4
  7. package/{check-Dq2WOgap.mjs.map → check-B7Uh_G-l.mjs.map} +1 -1
  8. package/{commonjs-BDiLMfFF.mjs → commonjs-bcl-ngMU.mjs} +3 -3
  9. package/{commonjs-BDiLMfFF.mjs.map → commonjs-bcl-ngMU.mjs.map} +1 -1
  10. package/{definitions-Dfwyyv_K.mjs → definitions-XbglYT7Q.mjs} +3 -3
  11. package/{definitions-Dfwyyv_K.mjs.map → definitions-XbglYT7Q.mjs.map} +1 -1
  12. package/{entries-Gfsq7U4P.mjs → entries-B4tUkrxs.mjs} +2 -2
  13. package/{entries-Gfsq7U4P.mjs.map → entries-B4tUkrxs.mjs.map} +1 -1
  14. package/{error-BrbT9_4g.mjs → error-DG5INUkQ.mjs} +2185 -2090
  15. package/error-DG5INUkQ.mjs.map +1 -0
  16. package/{harness-Bgvrr0ZB.mjs → harness-LSywfXzo.mjs} +2 -2
  17. package/{harness-Bgvrr0ZB.mjs.map → harness-LSywfXzo.mjs.map} +1 -1
  18. package/index.d.mts +1 -5
  19. package/index.mjs +18 -18
  20. package/index.mjs.map +1 -1
  21. package/{install-DoO4D3fk.mjs → install-zXEeTQ8w.mjs} +4 -4
  22. package/{install-DoO4D3fk.mjs.map → install-zXEeTQ8w.mjs.map} +1 -1
  23. package/{lib-CyynPpjH.mjs → lib-BCUUrctP.mjs} +5 -5
  24. package/{lib-CyynPpjH.mjs.map → lib-BCUUrctP.mjs.map} +1 -1
  25. package/{lib-Dw7R2suc.mjs → lib-CNtGmPS7.mjs} +5 -5
  26. package/{lib-Dw7R2suc.mjs.map → lib-CNtGmPS7.mjs.map} +1 -1
  27. package/{lib-JQygPqgO.mjs → lib-CZnS894S.mjs} +3 -3
  28. package/{lib-JQygPqgO.mjs.map → lib-CZnS894S.mjs.map} +1 -1
  29. package/{lib-BkWR53Bz.mjs → lib-DHoZNIet.mjs} +6 -6
  30. package/{lib-BkWR53Bz.mjs.map → lib-DHoZNIet.mjs.map} +1 -1
  31. package/{link-B1zfETsS.mjs → link-DquUj9D6.mjs} +3 -3
  32. package/{link-B1zfETsS.mjs.map → link-DquUj9D6.mjs.map} +1 -1
  33. package/{list-CfPfmfe0.mjs → list-C1ZWDpwI.mjs} +6 -5
  34. package/list-C1ZWDpwI.mjs.map +1 -0
  35. package/{list-3OR68HpY.mjs → list-eorMHI-g.mjs} +4 -4
  36. package/{list-3OR68HpY.mjs.map → list-eorMHI-g.mjs.map} +1 -1
  37. package/{login-GFV3Z9f2.mjs → login-DEjauWkd.mjs} +4 -4
  38. package/{login-GFV3Z9f2.mjs.map → login-DEjauWkd.mjs.map} +1 -1
  39. package/{logout-D17TQUfo.mjs → logout-BUY-ESj_.mjs} +4 -4
  40. package/{logout-D17TQUfo.mjs.map → logout-BUY-ESj_.mjs.map} +1 -1
  41. package/{p-map-C2WSUhyP.mjs → p-map-CMI1i54p.mjs} +2 -2
  42. package/{p-map-C2WSUhyP.mjs.map → p-map-CMI1i54p.mjs.map} +1 -1
  43. package/package.json +2 -2
  44. package/{providers-DLXs9aWZ.mjs → providers-wTGawU9e.mjs} +6 -5
  45. package/providers-wTGawU9e.mjs.map +1 -0
  46. package/refresh-B2jxJmk1.mjs +16 -0
  47. package/refresh-B2jxJmk1.mjs.map +1 -0
  48. package/{refresh-BTNuP1zL.mjs → refresh-C7e_qZit.mjs} +4 -4
  49. package/{refresh-BTNuP1zL.mjs.map → refresh-C7e_qZit.mjs.map} +1 -1
  50. package/{reload-BzwsCBQq.mjs → reload-B5LO2rk9.mjs} +3 -3
  51. package/{reload-BzwsCBQq.mjs.map → reload-B5LO2rk9.mjs.map} +1 -1
  52. package/{remove-DgB3l5JL.mjs → remove-CTVgJKXM.mjs} +4 -4
  53. package/{remove-DgB3l5JL.mjs.map → remove-CTVgJKXM.mjs.map} +1 -1
  54. package/{run-BVo4XsL6.mjs → run-CORFA6op.mjs} +4 -4
  55. package/{run-BVo4XsL6.mjs.map → run-CORFA6op.mjs.map} +1 -1
  56. package/{runtime-Dl621FOp.mjs → runtime-Bp4kILYn.mjs} +12 -19
  57. package/{runtime-Dl621FOp.mjs.map → runtime-Bp4kILYn.mjs.map} +1 -1
  58. package/{serve-Dpep18-A.mjs → serve-DzaOcgKC.mjs} +8 -5
  59. package/{serve-Dpep18-A.mjs.map → serve-DzaOcgKC.mjs.map} +1 -1
  60. package/{settings-C52IrA72.mjs → settings-tMD7Y0ev.mjs} +2 -2
  61. package/{settings-C52IrA72.mjs.map → settings-tMD7Y0ev.mjs.map} +1 -1
  62. package/{shared-Uwjcofff.mjs → shared-D8hbPMPF.mjs} +3 -3
  63. package/{shared-Uwjcofff.mjs.map → shared-D8hbPMPF.mjs.map} +1 -1
  64. package/{status-DPYq2Sx4.mjs → status-CrAKnTHQ.mjs} +4 -4
  65. package/{status-DPYq2Sx4.mjs.map → status-CrAKnTHQ.mjs.map} +1 -1
  66. package/{type-defs-BZxrtlVD.mjs → type-defs-JBxRyl-4.mjs} +3 -3
  67. package/{type-defs-BZxrtlVD.mjs.map → type-defs-JBxRyl-4.mjs.map} +1 -1
  68. package/{update-CJrBbHwq.mjs → update-DK7kAVc3.mjs} +4 -4
  69. package/{update-CJrBbHwq.mjs.map → update-DK7kAVc3.mjs.map} +1 -1
  70. package/{valid-BWgW_TUl.mjs → valid-Bc7tec52.mjs} +2 -2
  71. package/{valid-BWgW_TUl.mjs.map → valid-Bc7tec52.mjs.map} +1 -1
  72. package/catalog-DJxy_lne.mjs +0 -31
  73. package/catalog-DJxy_lne.mjs.map +0 -1
  74. package/error-BrbT9_4g.mjs.map +0 -1
  75. package/generate-DrGYpD3l.mjs +0 -35
  76. package/generate-DrGYpD3l.mjs.map +0 -1
  77. package/list-CfPfmfe0.mjs.map +0 -1
  78. package/providers-DLXs9aWZ.mjs.map +0 -1
package/README.md CHANGED
@@ -76,7 +76,7 @@ codework run --server ws://127.0.0.1:7433/rpc --sandbox-id <sandbox-id> "Start a
76
76
 
77
77
  The default address is `127.0.0.1:7433`; `--port 0` picks an available port and prints the actual URL. Set `--home`, `--database`, and `--user-config-dir` on the server. Model credentials, plugins, and working directories are resolved by the server. A remote run does not boot a local harness.
78
78
 
79
- Events are live and not replayed. The client subscribes before admitting its prompt and waits for execution completion after rendering. Lost connections and overflow fail the command; disconnecting leaves server work running. Ctrl-C sends `session.interrupt`, which interrupts the shared session. Remote runs print the sandbox ID for reuse. `session.interrupt` returns `{ interrupted }` as soon as the stop is accepted; `session.wait` is the separate cleanup barrier. A busy period reports itself as `session.execution.started` followed by exactly one of `succeeded`, `failed`, or `interrupted` -- a failure carries a namespaced category (`provider.auth`, `model.not-found`, `sandbox.mount`, ...) that the client renders, and an interruption carries whether it was the user or a server shutdown. Managed sandboxes remain available until explicitly stopped or server shutdown; external sandboxes are not stopped.
79
+ Events are live and not replayed. The client subscribes before admitting its prompt and waits for execution completion after rendering. Lost connections and overflow fail the command; disconnecting leaves server work running. Ctrl-C sends `session.interrupt`, which interrupts the shared session. Remote runs print the sandbox ID for reuse. `session.interrupt` returns `{ interrupted }` as soon as the stop is accepted; `session.wait` is the separate cleanup barrier. A busy period reports itself as `session.execution.started` followed by exactly one of `succeeded`, `failed`, or `interrupted` -- a failure carries a category (`provider-authentication-error`, `model-not-found-error`, `sandbox-mount-error`, ...) that the client renders, and an interruption carries whether it was the user or a server shutdown. Managed sandboxes remain available until explicitly stopped or server shutdown; external sandboxes are not stopped.
80
80
 
81
81
  The v0 endpoint has no authentication; its default binding is loopback. Plugins publish their own event types by declaring them (`Plugin.define({ events: [...] })`, namespaced `plugin.<plugin-id>.*`); the feed carries those and skips types nothing declared. Invalid payloads for declared types fail with a typed encoding error.
82
82
 
@@ -142,19 +142,16 @@ codework models providers
142
142
 
143
143
  ---
144
144
 
145
- ### `codework models generate`
145
+ ### `codework models refresh`
146
146
 
147
- Generate or update the `models.gen.json` catalog from model registries.
147
+ The model catalog lives at `<home>/models.gen.json` (`~/.codework` unless `--home` says otherwise). Every local command checks it before use and downloads a new one once it is older than 15 minutes (`CODEWORK_MODELS_TTL`, e.g. `"1 hour"`); `codework serve` also re-checks every minute and reloads the file whenever it changes. A failed download keeps the previous catalog.
148
148
 
149
149
  ```bash
150
- # Generate to CODEWORK_MODELS_FILE or ./models.gen.json
151
- codework models generate
150
+ # Download the catalog if it is missing or stale; no network call otherwise
151
+ codework models refresh
152
152
 
153
- # Generate into a specific directory (resolves to ./models.gen.json)
154
- codework models generate .
155
-
156
- # Generate to an explicit file path
157
- codework models generate ./path/to/custom-models.json
153
+ # Download it now
154
+ codework models refresh --force
158
155
  ```
159
156
 
160
157
  ---
@@ -212,14 +209,15 @@ file, with `{ "plugin": "<id>", "enabled": false }`.
212
209
 
213
210
  ## Environment Variables
214
211
 
215
- | Variable | Description |
216
- | :----------------------------- | :--------------------------------------------------- |
217
- | `CODEWORK_MODELS_FILE` | Path to the generated `models.gen.json` catalog file |
218
- | `OPENAI_API_KEY` | API key for OpenAI models |
219
- | `ANTHROPIC_API_KEY` | API key for Anthropic models |
220
- | `OPENROUTER_API_KEY` | API key for OpenRouter models |
221
- | `GOOGLE_GENERATIVE_AI_API_KEY` | API key for Google models |
222
- | `XAI_API_KEY` | API key for xAI models |
212
+ | Variable | Description |
213
+ | :----------------------------- | :------------------------------------------------------------------ |
214
+ | `CODEWORK_MODELS_FILE` | Pin the catalog to a file you manage; never refreshed automatically |
215
+ | `CODEWORK_MODELS_TTL` | How old the catalog may get before a refresh (default `15 minutes`) |
216
+ | `OPENAI_API_KEY` | API key for OpenAI models |
217
+ | `ANTHROPIC_API_KEY` | API key for Anthropic models |
218
+ | `OPENROUTER_API_KEY` | API key for OpenRouter models |
219
+ | `GOOGLE_GENERATIVE_AI_API_KEY` | API key for Google models |
220
+ | `XAI_API_KEY` | API key for xAI models |
223
221
 
224
222
  ---
225
223
 
@@ -1,6 +1,6 @@
1
- import { B as inspect, _t as path, a as reportFailure, at as SessionNotLinkedError, bt as resolve, f as writeOut, gt as layer$2, it as SessionNotFoundError, lt as layer$1, ot as layer, rt as Service, xt as ID } from "./error-BrbT9_4g.mjs";
2
- import { i as Cmd, t as handler } from "./runtime-Dl621FOp.mjs";
3
- import { a as resolveTarget, c as writePlugins, i as readPlugins, l as written, n as matches, o as spellings, s as withPluginsLock, t as identify } from "./settings-C52IrA72.mjs";
1
+ import { Ct as ID, St as resolve, at as Service, ct as layer, d as writeOut, dt as layer$1, i as reportFailure, ot as SessionNotFoundError, st as SessionNotLinkedError, vt as layer$2, yt as path, z as inspect } from "./error-DG5INUkQ.mjs";
2
+ import { i as Cmd, t as handler } from "./runtime-Bp4kILYn.mjs";
3
+ import { a as resolveTarget, c as writePlugins, i as readPlugins, l as written, n as matches, o as spellings, s as withPluginsLock, t as identify } from "./settings-tMD7Y0ev.mjs";
4
4
  import { Effect, Layer, Option, Path } from "effect";
5
5
  //#region src/cli/cmd/handlers/plugin/session.ts
6
6
  /**
@@ -78,4 +78,4 @@ var add_default = handler(Cmd.commands.plugin.commands.add, Effect.fn("CLI.plugi
78
78
  //#endregion
79
79
  export { add_default as default };
80
80
 
81
- //# sourceMappingURL=add--i7mPR73.mjs.map
81
+ //# sourceMappingURL=add-D1yPPRz2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"add--i7mPR73.mjs","names":["Global.resolve","SessionStore.Service","SessionStore.SessionNotFoundError","SessionStore.SessionNotLinkedError","Event.layer","Database.layer","Database.path","Runtime.handler","Global.resolve","Plugin.inspect"],"sources":["../../src/cli/cmd/handlers/plugin/session.ts","../../src/cli/cmd/handlers/plugin/add.ts"],"sourcesContent":["import { Database, Event, Global, Session, SessionStore } from \"@codeworksh/harness/effect\";\nimport { Effect, Layer, Option } from \"effect\";\n\n/**\n * The host directory a session is linked to.\n *\n * **A session ID can answer this and a project ID cannot**, which is why the flag takes one. A\n * `Project` is env-independent by design -- its identity is a repo marker, a remote hash or a root\n * commit, never a path -- and its spaces hold `location`s *inside* an env, which may be a container\n * on another machine. Deriving a host settings file from one would mean walking the host\n * filesystem from a path that means something somewhere else, which is the exact failure the\n * `hostDir` split exists to prevent: it does not error, it finds a stranger's project.\n *\n * A session, by contrast, carries a `hostDir` that was *declared* on the host. Absent is a normal\n * state rather than corruption, and it is the one this refuses.\n */\nexport const linkedDirectory = Effect.fn(\"CLI.plugin.linkedDirectory\")(function* (\n\tsessionId: string,\n\thome: Option.Option<string>,\n) {\n\tconst paths = yield* Global.resolve(Option.isNone(home) ? {} : { home: home.value });\n\tconst id = Session.SessionSchema.ID.ascending(sessionId);\n\n\treturn yield* Effect.gen(function* () {\n\t\tconst sessions = yield* SessionStore.Service;\n\t\tconst found = yield* sessions.get(id);\n\t\tif (Option.isNone(found)) return yield* new SessionStore.SessionNotFoundError({ sessionId: id });\n\t\tconst hostDir = Option.getOrUndefined(found.value.hostDir);\n\t\tif (hostDir === undefined) return yield* new SessionStore.SessionNotLinkedError({ sessionId: id });\n\t\treturn hostDir;\n\t}).pipe(\n\t\t// Only the session row is read, so this needs the database and the event log the store is\n\t\t// built on -- no sandboxes, no control plane, no plugin machinery.\n\t\tEffect.provide(\n\t\t\tSessionStore.layer.pipe(\n\t\t\t\tLayer.provide(Event.layer),\n\t\t\t\tLayer.provide(Database.layer(yield* Database.path(paths.data))),\n\t\t\t),\n\t\t),\n\t);\n});\n","import { Global, Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { linkedDirectory } from \"./session.ts\";\nimport {\n\tidentify,\n\tmatches,\n\treadPlugins,\n\tresolveTarget,\n\tspellings,\n\twithPluginsLock,\n\twritePlugins,\n\twritten,\n} from \"./settings.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.add,\n\tEffect.fn(\"CLI.plugin.add\")(function* ({ package: reference, global: userWide, session }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst path = yield* Path.Path;\n\t\t\tconst paths = yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });\n\n\t\t\t// A session names the project to write into when the shell's directory is not it --\n\t\t\t// a server or a UI acting on a session's behalf, rather than a person standing in the\n\t\t\t// repository. It fails when that session has no project, which is a state `session\n\t\t\t// link` exists to fix.\n\t\t\tconst linked = Option.isNone(session) ? undefined : yield* linkedDirectory(session.value, shared.home);\n\t\t\t/*\n\t\t\t * One directory answers every question this command asks about the reference, and it\n\t\t\t * is resolved before any of them.\n\t\t\t *\n\t\t\t * A relative spec anchors here, the `.npmrc` chain governing the install is read from\n\t\t\t * here, and the entry is written anchored here. Splitting them is not a cosmetic\n\t\t\t * inconsistency: under `--session` the shell's directory is a server's, so validating\n\t\t\t * `./plugins/x.ts` against it imports one file and writes a reference to another, and\n\t\t\t * reading the `.npmrc` chain from it installs from the wrong registry -- a private\n\t\t\t * scope's token lives in the project being written to, not wherever the server runs.\n\t\t\t */\n\t\t\tconst from = linked ?? path.resolve(\".\");\n\n\t\t\t// The file the entry will land in decides the install's registry identity: it is named\n\t\t\t// here -- without creating the marker -- so the store keys the artifact under the same\n\t\t\t// `.npmrc` chain every later resolve of this entry re-derives, and a bad reference\n\t\t\t// still leaves nothing behind.\n\t\t\tconst target = yield* resolveTarget(shared, userWide, linked, false);\n\n\t\t\t// Install and import before touching the file: a spec that turns out not to be a plugin\n\t\t\t// should fail here, with its own error, rather than at the next run from a file the user\n\t\t\t// then has to repair by hand.\n\t\t\tconst plugin = yield* Plugin.inspect(reference, { cache: paths.cache, hostDir: from, file: target.path });\n\t\t\t// What goes in the file, which is not always what was typed: a relative path anchors to\n\t\t\t// the settings file being written, not to the directory the command ran in.\n\t\t\tconst entry = yield* written(reference, {\n\t\t\t\tcwd: from,\n\t\t\t\tfile: target.path,\n\t\t\t\troot: target.root,\n\t\t\t});\n\t\t\tconst spelled = yield* spellings(reference, from);\n\t\t\tconst version = plugin.version === undefined ? \"\" : `@${plugin.version}`;\n\t\t\tyield* withPluginsLock(\n\t\t\t\ttarget.path,\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst { source, plugins } = yield* readPlugins(target.path);\n\t\t\t\t\tconst entries = yield* identify(plugins, target.path, paths.cache);\n\t\t\t\t\t// Configured already if any spelling of an existing entry names this plugin -- the same\n\t\t\t\t\t// package under a different version, the path it was added by, or the ID it declares.\n\t\t\t\t\tconst names = (candidate: (typeof entries)[number]) =>\n\t\t\t\t\t\tmatches(candidate, spelled) || candidate.answers.has(plugin.id);\n\t\t\t\t\tconst existing = entries.findIndex((candidate) => candidate.loads && names(candidate));\n\t\t\t\t\tif (existing >= 0) {\n\t\t\t\t\t\tconst current = entries[existing]?.value;\n\t\t\t\t\t\tif (current === entry) {\n\t\t\t\t\t\t\tyield* writeOut(`Plugin \"${reference}\" is already configured in ${target.path}\\n`);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst replaced = [...plugins];\n\t\t\t\t\t\treplaced[existing] = entry;\n\t\t\t\t\t\tyield* writePlugins(target.path, source, replaced);\n\t\t\t\t\t\tyield* writeOut(\n\t\t\t\t\t\t\t`Updated ${plugin.id} (${String(current)} -> ${entry}${version}) in ${target.path}\\n`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Put the loader before existing configuration so its options apply to the module.\n\t\t\t\t\tconst configured = entries.findIndex((candidate) => !candidate.loads && names(candidate));\n\t\t\t\t\tconst updated = [...plugins];\n\t\t\t\t\tupdated.splice(configured < 0 ? updated.length : configured, 0, entry);\n\t\t\t\t\tyield* writePlugins(target.path, source, updated);\n\t\t\t\t\tyield* writeOut(`Added ${plugin.id} (${entry}${version}) to ${target.path}\\n`);\n\t\t\t\t}),\n\t\t\t);\n\t\t\t// Said after the write, because `resolveTarget` only named the marker: the lock's\n\t\t\t// write is what made it, and \"created\" should be true by the time it is printed.\n\t\t\tif (target.created !== undefined) yield* writeOut(`Created ${target.created}/\\n`);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB,OAAO,GAAG,4BAA4B,CAAC,CAAC,WACtE,WACA,MACC;CACD,MAAM,QAAQ,OAAOA,QAAe,OAAO,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACnF,MAAM,KAAA,GAA8B,UAAU,SAAS;CAEvD,OAAO,OAAO,OAAO,IAAI,aAAa;EAErC,MAAM,QAAQ,QAAO,OADGC,QAAAA,CACM,IAAI,EAAE;EACpC,IAAI,OAAO,OAAO,KAAK,GAAG,OAAO,OAAO,IAAIC,qBAAkC,EAAE,WAAW,GAAG,CAAC;EAC/F,MAAM,UAAU,OAAO,eAAe,MAAM,MAAM,OAAO;EACzD,IAAI,YAAY,KAAA,GAAW,OAAO,OAAO,IAAIC,sBAAmC,EAAE,WAAW,GAAG,CAAC;EACjG,OAAO;CACR,CAAC,CAAC,CAAC,KAGF,OAAO,QAAA,MACa,KAClB,MAAM,QAAQC,OAAW,GACzB,MAAM,QAAQC,QAAe,OAAOC,KAAc,MAAM,IAAI,CAAC,CAAC,CAC/D,CACD,CACD;AACD,CAAC;;;ACtBD,IAAA,cAAeC,QACd,IAAI,SAAS,OAAO,SAAS,KAC7B,OAAO,GAAG,gBAAgB,C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AAM,WAAW,CAAC,GAAG,OAAO;IAC5B,SAAS,YAAY;IACrB,OAAO,aAAa,OAAO,MAAM,QAAQ,QAAQ;IACjD,OAAO,SACN,WAAW,OAAO,GAAG,IAAI,OAAO,OAAO,EAAE,MAAM,QAAQ,QAAQ,OAAO,OAAO,KAAK,GACnF;IACA;GACD;GAGA,MAAM,aAAa,QAAQ,WAAW,cAAc,CAAC,UAAU,SAAS,MAAM,SAAS,CAAC;GACxF,MAAM,UAAU,CAAC,GAAG,OAAO;GAC3B,QAAQ,OAAO,aAAa,IAAI,QAAQ,SAAS,YAAY,GAAG,KAAK;GACrE,OAAO,aAAa,OAAO,MAAM,QAAQ,OAAO;GAChD,OAAO,SAAS,SAAS,OAAO,GAAG,IAAI,QAAQ,QAAQ,OAAO,OAAO,KAAK,GAAG;EAC9E,CAAC,CACF;EAGA,IAAI,OAAO,YAAY,KAAA,GAAW,OAAO,SAAS,WAAW,OAAO,QAAQ,IAAI;CACjF,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
1
+ {"version":3,"file":"add-D1yPPRz2.mjs","names":["Global.resolve","SessionStore.Service","SessionStore.SessionNotFoundError","SessionStore.SessionNotLinkedError","Event.layer","Database.layer","Database.path","Runtime.handler","Global.resolve","Plugin.inspect"],"sources":["../../src/cli/cmd/handlers/plugin/session.ts","../../src/cli/cmd/handlers/plugin/add.ts"],"sourcesContent":["import { Database, Event, Global, Session, SessionStore } from \"@codeworksh/harness/effect\";\nimport { Effect, Layer, Option } from \"effect\";\n\n/**\n * The host directory a session is linked to.\n *\n * **A session ID can answer this and a project ID cannot**, which is why the flag takes one. A\n * `Project` is env-independent by design -- its identity is a repo marker, a remote hash or a root\n * commit, never a path -- and its spaces hold `location`s *inside* an env, which may be a container\n * on another machine. Deriving a host settings file from one would mean walking the host\n * filesystem from a path that means something somewhere else, which is the exact failure the\n * `hostDir` split exists to prevent: it does not error, it finds a stranger's project.\n *\n * A session, by contrast, carries a `hostDir` that was *declared* on the host. Absent is a normal\n * state rather than corruption, and it is the one this refuses.\n */\nexport const linkedDirectory = Effect.fn(\"CLI.plugin.linkedDirectory\")(function* (\n\tsessionId: string,\n\thome: Option.Option<string>,\n) {\n\tconst paths = yield* Global.resolve(Option.isNone(home) ? {} : { home: home.value });\n\tconst id = Session.SessionSchema.ID.ascending(sessionId);\n\n\treturn yield* Effect.gen(function* () {\n\t\tconst sessions = yield* SessionStore.Service;\n\t\tconst found = yield* sessions.get(id);\n\t\tif (Option.isNone(found)) return yield* new SessionStore.SessionNotFoundError({ sessionId: id });\n\t\tconst hostDir = Option.getOrUndefined(found.value.hostDir);\n\t\tif (hostDir === undefined) return yield* new SessionStore.SessionNotLinkedError({ sessionId: id });\n\t\treturn hostDir;\n\t}).pipe(\n\t\t// Only the session row is read, so this needs the database and the event log the store is\n\t\t// built on -- no sandboxes, no control plane, no plugin machinery.\n\t\tEffect.provide(\n\t\t\tSessionStore.layer.pipe(\n\t\t\t\tLayer.provide(Event.layer),\n\t\t\t\tLayer.provide(Database.layer(yield* Database.path(paths.data))),\n\t\t\t),\n\t\t),\n\t);\n});\n","import { Global, Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { linkedDirectory } from \"./session.ts\";\nimport {\n\tidentify,\n\tmatches,\n\treadPlugins,\n\tresolveTarget,\n\tspellings,\n\twithPluginsLock,\n\twritePlugins,\n\twritten,\n} from \"./settings.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.add,\n\tEffect.fn(\"CLI.plugin.add\")(function* ({ package: reference, global: userWide, session }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst path = yield* Path.Path;\n\t\t\tconst paths = yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });\n\n\t\t\t// A session names the project to write into when the shell's directory is not it --\n\t\t\t// a server or a UI acting on a session's behalf, rather than a person standing in the\n\t\t\t// repository. It fails when that session has no project, which is a state `session\n\t\t\t// link` exists to fix.\n\t\t\tconst linked = Option.isNone(session) ? undefined : yield* linkedDirectory(session.value, shared.home);\n\t\t\t/*\n\t\t\t * One directory answers every question this command asks about the reference, and it\n\t\t\t * is resolved before any of them.\n\t\t\t *\n\t\t\t * A relative spec anchors here, the `.npmrc` chain governing the install is read from\n\t\t\t * here, and the entry is written anchored here. Splitting them is not a cosmetic\n\t\t\t * inconsistency: under `--session` the shell's directory is a server's, so validating\n\t\t\t * `./plugins/x.ts` against it imports one file and writes a reference to another, and\n\t\t\t * reading the `.npmrc` chain from it installs from the wrong registry -- a private\n\t\t\t * scope's token lives in the project being written to, not wherever the server runs.\n\t\t\t */\n\t\t\tconst from = linked ?? path.resolve(\".\");\n\n\t\t\t// The file the entry will land in decides the install's registry identity: it is named\n\t\t\t// here -- without creating the marker -- so the store keys the artifact under the same\n\t\t\t// `.npmrc` chain every later resolve of this entry re-derives, and a bad reference\n\t\t\t// still leaves nothing behind.\n\t\t\tconst target = yield* resolveTarget(shared, userWide, linked, false);\n\n\t\t\t// Install and import before touching the file: a spec that turns out not to be a plugin\n\t\t\t// should fail here, with its own error, rather than at the next run from a file the user\n\t\t\t// then has to repair by hand.\n\t\t\tconst plugin = yield* Plugin.inspect(reference, { cache: paths.cache, hostDir: from, file: target.path });\n\t\t\t// What goes in the file, which is not always what was typed: a relative path anchors to\n\t\t\t// the settings file being written, not to the directory the command ran in.\n\t\t\tconst entry = yield* written(reference, {\n\t\t\t\tcwd: from,\n\t\t\t\tfile: target.path,\n\t\t\t\troot: target.root,\n\t\t\t});\n\t\t\tconst spelled = yield* spellings(reference, from);\n\t\t\tconst version = plugin.version === undefined ? \"\" : `@${plugin.version}`;\n\t\t\tyield* withPluginsLock(\n\t\t\t\ttarget.path,\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst { source, plugins } = yield* readPlugins(target.path);\n\t\t\t\t\tconst entries = yield* identify(plugins, target.path, paths.cache);\n\t\t\t\t\t// Configured already if any spelling of an existing entry names this plugin -- the same\n\t\t\t\t\t// package under a different version, the path it was added by, or the ID it declares.\n\t\t\t\t\tconst names = (candidate: (typeof entries)[number]) =>\n\t\t\t\t\t\tmatches(candidate, spelled) || candidate.answers.has(plugin.id);\n\t\t\t\t\tconst existing = entries.findIndex((candidate) => candidate.loads && names(candidate));\n\t\t\t\t\tif (existing >= 0) {\n\t\t\t\t\t\tconst current = entries[existing]?.value;\n\t\t\t\t\t\tif (current === entry) {\n\t\t\t\t\t\t\tyield* writeOut(`Plugin \"${reference}\" is already configured in ${target.path}\\n`);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst replaced = [...plugins];\n\t\t\t\t\t\treplaced[existing] = entry;\n\t\t\t\t\t\tyield* writePlugins(target.path, source, replaced);\n\t\t\t\t\t\tyield* writeOut(\n\t\t\t\t\t\t\t`Updated ${plugin.id} (${String(current)} -> ${entry}${version}) in ${target.path}\\n`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Put the loader before existing configuration so its options apply to the module.\n\t\t\t\t\tconst configured = entries.findIndex((candidate) => !candidate.loads && names(candidate));\n\t\t\t\t\tconst updated = [...plugins];\n\t\t\t\t\tupdated.splice(configured < 0 ? updated.length : configured, 0, entry);\n\t\t\t\t\tyield* writePlugins(target.path, source, updated);\n\t\t\t\t\tyield* writeOut(`Added ${plugin.id} (${entry}${version}) to ${target.path}\\n`);\n\t\t\t\t}),\n\t\t\t);\n\t\t\t// Said after the write, because `resolveTarget` only named the marker: the lock's\n\t\t\t// write is what made it, and \"created\" should be true by the time it is printed.\n\t\t\tif (target.created !== undefined) yield* writeOut(`Created ${target.created}/\\n`);\n\t\t});\n\n\t\treturn yield* program.p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AO,MAAM,QAAQ,OAAO;GAChD,OAAO,SAAS,SAAS,OAAO,GAAG,IAAI,QAAQ,QAAQ,OAAO,OAAO,KAAK,GAAG;EAC9E,CAAC,CACF;EAGA,IAAI,OAAO,YAAY,KAAA,GAAW,OAAO,SAAS,WAAW,OAAO,QAAQ,IAAI;CACjF,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
@@ -0,0 +1,17 @@
1
+ import { St as resolve, et as sync } from "./error-DG5INUkQ.mjs";
2
+ import { i as Cmd } from "./runtime-Bp4kILYn.mjs";
3
+ import { Effect, Option } from "effect";
4
+ //#region src/cli/cmd/handlers/models/catalog.ts
5
+ /** The home `--home` names, or the default one. */
6
+ const home = Effect.gen(function* () {
7
+ const shared = yield* Cmd.spec;
8
+ return (yield* resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value })).home;
9
+ });
10
+ /** Check the home's catalog, as `run` does at boot, before reading it. */
11
+ const synced = Effect.gen(function* () {
12
+ yield* sync(yield* home);
13
+ });
14
+ //#endregion
15
+ export { synced as n, home as t };
16
+
17
+ //# sourceMappingURL=catalog-BtH_l7f2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-BtH_l7f2.mjs","names":["Global.resolve","ModelCatalog.sync"],"sources":["../../src/cli/cmd/handlers/models/catalog.ts"],"sourcesContent":["import { Global, ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport { Cmd } from \"../../cmd.ts\";\n\n/** The home `--home` names, or the default one. */\nexport const home = Effect.gen(function* () {\n\tconst shared = yield* Cmd.spec;\n\treturn (yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value })).home;\n});\n\n/** Check the home's catalog, as `run` does at boot, before reading it. */\nexport const synced = Effect.gen(function* () {\n\tyield* ModelCatalog.sync(yield* home);\n});\n"],"mappings":";;;;;AAKA,MAAa,OAAO,OAAO,IAAI,aAAa;CAC3C,MAAM,SAAS,OAAO,IAAI;CAC1B,QAAQ,OAAOA,QAAe,OAAO,OAAO,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,OAAO,KAAK,MAAM,CAAC,EAAA,CAAG;AAC/F,CAAC;;AAGD,MAAa,SAAS,OAAO,IAAI,aAAa;CAC7C,OAAOC,KAAkB,OAAO,IAAI;AACrC,CAAC"}
@@ -1,6 +1,6 @@
1
- import { V as check, a as reportFailure, f as writeOut } from "./error-BrbT9_4g.mjs";
2
- import { i as Cmd, t as handler } from "./runtime-Dl621FOp.mjs";
3
- import { n as probe, r as read, t as fetchable } from "./entries-Gfsq7U4P.mjs";
1
+ import { B as check, d as writeOut, i as reportFailure } from "./error-DG5INUkQ.mjs";
2
+ import { i as Cmd, t as handler } from "./runtime-Bp4kILYn.mjs";
3
+ import { n as probe, r as read, t as fetchable } from "./entries-B4tUkrxs.mjs";
4
4
  import { Effect } from "effect";
5
5
  //#region src/cli/cmd/handlers/plugin/check.ts
6
6
  /**
@@ -44,4 +44,4 @@ var check_default = handler(Cmd.commands.plugin.commands.check, Effect.fn("CLI.p
44
44
  //#endregion
45
45
  export { check_default as default };
46
46
 
47
- //# sourceMappingURL=check-Dq2WOgap.mjs.map
47
+ //# sourceMappingURL=check-B7Uh_G-l.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"check-Dq2WOgap.mjs","names":["Runtime.handler","Plugin.check"],"sources":["../../src/cli/cmd/handlers/plugin/check.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { fetchable, probe, read } from \"./entries.ts\";\n\n/**\n * Which configured plugins have a newer revision available.\n *\n * A probe failure -- offline, registry down, a remote that refuses -- is **not** an update. It is\n * reported per target and the command exits non-zero, rather than being swallowed into \"you are up\n * to date\": an outage that reads as currency is the one answer this command must never give.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.check,\n\tEffect.fn(\"CLI.plugin.check\")(function* ({ refresh }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache } = yield* read(shared);\n\n\t\t\tlet outdated = 0;\n\t\t\tlet failed = 0;\n\t\t\tfor (const entry of entries) {\n\t\t\t\tconst target = fetchable(entry.target);\n\t\t\t\t// Nothing to compare: a local path has no revision, and `check` skips it rather\n\t\t\t\t// than reporting it as current.\n\t\t\t\tif (target === undefined) continue;\n\n\t\t\t\tconst state = yield* Plugin.check(target, cache, {\n\t\t\t\t\trefresh,\n\t\t\t\t\tprobe: probe(cache, entry.from),\n\t\t\t\t\tfrom: entry.from,\n\t\t\t\t}).pipe(Effect.result);\n\t\t\t\tif (state._tag === \"Failure\") {\n\t\t\t\t\tfailed += 1;\n\t\t\t\t\tyield* writeOut(`${entry.reference} error[${state.failure.reason}]: ${state.failure.message}\\n`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tswitch (state.success._tag) {\n\t\t\t\t\tcase \"outdated\":\n\t\t\t\t\t\toutdated += 1;\n\t\t\t\t\t\tyield* writeOut(`${entry.reference} ${state.success.filed ?? \"?\"} -> ${state.success.available}\\n`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"not-installed\":\n\t\t\t\t\t\tyield* writeOut(`${entry.reference} plugin-not-installed\\n`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t// An exact version and a commit SHA cannot move, so neither is worth a line.\n\t\t\t\t\tcase \"immutable\":\n\t\t\t\t\tcase \"current\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield* writeOut(\n\t\t\t\toutdated === 0 && failed === 0\n\t\t\t\t\t? \"Everything is up to date.\\n\"\n\t\t\t\t\t: `${outdated} update${outdated === 1 ? \"\" : \"s\"} available.\\n`,\n\t\t\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_G-l.mjs","names":["Runtime.handler","Plugin.check"],"sources":["../../src/cli/cmd/handlers/plugin/check.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { fetchable, probe, read } from \"./entries.ts\";\n\n/**\n * Which configured plugins have a newer revision available.\n *\n * A probe failure -- offline, registry down, a remote that refuses -- is **not** an update. It is\n * reported per target and the command exits non-zero, rather than being swallowed into \"you are up\n * to date\": an outage that reads as currency is the one answer this command must never give.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.check,\n\tEffect.fn(\"CLI.plugin.check\")(function* ({ refresh }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache } = yield* read(shared);\n\n\t\t\tlet outdated = 0;\n\t\t\tlet failed = 0;\n\t\t\tfor (const entry of entries) {\n\t\t\t\tconst target = fetchable(entry.target);\n\t\t\t\t// Nothing to compare: a local path has no revision, and `check` skips it rather\n\t\t\t\t// than reporting it as current.\n\t\t\t\tif (target === undefined) continue;\n\n\t\t\t\tconst state = yield* Plugin.check(target, cache, {\n\t\t\t\t\trefresh,\n\t\t\t\t\tprobe: probe(cache, entry.from),\n\t\t\t\t\tfrom: entry.from,\n\t\t\t\t}).pipe(Effect.result);\n\t\t\t\tif (state._tag === \"Failure\") {\n\t\t\t\t\tfailed += 1;\n\t\t\t\t\tyield* writeOut(`${entry.reference} error[${state.failure.reason}]: ${state.failure.message}\\n`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tswitch (state.success._tag) {\n\t\t\t\t\tcase \"outdated\":\n\t\t\t\t\t\toutdated += 1;\n\t\t\t\t\t\tyield* writeOut(`${entry.reference} ${state.success.filed ?? \"?\"} -> ${state.success.available}\\n`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"not-installed\":\n\t\t\t\t\t\tyield* writeOut(`${entry.reference} plugin-not-installed\\n`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t// An exact version and a commit SHA cannot move, so neither is worth a line.\n\t\t\t\t\tcase \"immutable\":\n\t\t\t\t\tcase \"current\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield* writeOut(\n\t\t\t\toutdated === 0 && failed === 0\n\t\t\t\t\t? \"Everything is up to date.\\n\"\n\t\t\t\t\t: `${outdated} update${outdated === 1 ? \"\" : \"s\"} available.\\n`,\n\t\t\t);\n\t\t\tif (failed > 0) process.exitCode = 1;\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;AAeA,IAAA,gBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,OAC7B,OAAO,GAAG,kBAAkB,CAAC,CAAC,WAAW,EAAE,WAAW;CA8CrD,OAAO,OA7CS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,EAAE,SAAS,UAAU,OAAO,KAAK,MAAM;EAE7C,IAAI,WAAW;EACf,IAAI,SAAS;EACb,KAAK,MAAM,SAAS,SAAS;GAC5B,MAAM,SAAS,UAAU,MAAM,MAAM;GAGrC,IAAI,WAAW,KAAA,GAAW;GAE1B,MAAM,QAAQ,OAAOC,MAAa,QAAQ,OAAO;IAChD;IACA,OAAO,MAAM,OAAO,MAAM,IAAI;IAC9B,MAAM,MAAM;GACb,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM;GACrB,IAAI,MAAM,SAAS,WAAW;IAC7B,UAAU;IACV,OAAO,SAAS,GAAG,MAAM,UAAU,UAAU,MAAM,QAAQ,OAAO,KAAK,MAAM,QAAQ,QAAQ,GAAG;IAChG;GACD;GACA,QAAQ,MAAM,QAAQ,MAAtB;IACC,KAAK;KACJ,YAAY;KACZ,OAAO,SAAS,GAAG,MAAM,UAAU,IAAI,MAAM,QAAQ,SAAS,IAAI,MAAM,MAAM,QAAQ,UAAU,GAAG;KACnG;IACD,KAAK,iBACJ,OAAO,SAAS,GAAG,MAAM,UAAU,yBAAyB;GAM9D;EACD;EAEA,OAAO,SACN,aAAa,KAAK,WAAW,IAC1B,gCACA,GAAG,SAAS,SAAS,aAAa,IAAI,KAAK,IAAI,cACnD;EACA,IAAI,SAAS,GAAG,QAAQ,WAAW;CACpC,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
@@ -1,5 +1,5 @@
1
- import { Ct as __commonJSMin, Et as __require } from "./error-BrbT9_4g.mjs";
2
- import { h as require_commonjs$1, t as require_lib$2, u as require_index_min } from "./lib-JQygPqgO.mjs";
1
+ import { Ot as __require, Tt as __commonJSMin } from "./error-DG5INUkQ.mjs";
2
+ import { h as require_commonjs$1, t as require_lib$2, u as require_index_min } from "./lib-CZnS894S.mjs";
3
3
  //#region ../../node_modules/.pnpm/@npmcli+name-from-folder@5.0.0/node_modules/@npmcli/name-from-folder/lib/index.js
4
4
  var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
5
  const { basename, dirname } = __require("path");
@@ -157,4 +157,4 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
157
157
  //#endregion
158
158
  export { require_lib as n, require_lib$1 as r, require_commonjs as t };
159
159
 
160
- //# sourceMappingURL=commonjs-BDiLMfFF.mjs.map
160
+ //# sourceMappingURL=commonjs-bcl-ngMU.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"commonjs-BDiLMfFF.mjs","names":[],"sources":["../../../../node_modules/.pnpm/@npmcli+name-from-folder@5.0.0/node_modules/@npmcli/name-from-folder/lib/index.js","../../../../node_modules/.pnpm/@npmcli+map-workspaces@6.0.0/node_modules/@npmcli/map-workspaces/lib/index.js","../../../../node_modules/.pnpm/walk-up-path@4.0.0/node_modules/walk-up-path/dist/commonjs/index.js"],"sourcesContent":["const { basename, dirname } = require('path')\n\nconst getName = (parent, base) =>\n parent.charAt(0) === '@' ? `${parent}/${base}` : base\n\nmodule.exports = dir => dir ? getName(basename(dirname(dir)), basename(dir))\n : false\n","const path = require('path')\n\nconst getName = require('@npmcli/name-from-folder')\nconst { minimatch } = require('minimatch')\nconst pkgJson = require('@npmcli/package-json')\nconst { glob } = require('glob')\n\nfunction appendNegatedPatterns (allPatterns) {\n const patterns = []\n const negatedPatterns = []\n for (let pattern of allPatterns) {\n const excl = pattern.match(/^!+/)\n if (excl) {\n pattern = pattern.slice(excl[0].length)\n }\n\n // strip off any / or ./ from the start of the pattern. /foo => foo\n pattern = pattern.replace(/^\\.?\\/+/, '')\n\n // an odd number of ! means a negated pattern. !!foo ==> foo\n const negate = excl && excl[0].length % 2 === 1\n if (negate) {\n negatedPatterns.push(pattern)\n } else {\n // remove negated patterns that appeared before this pattern to avoid\n // ignoring paths that were matched afterwards\n // e.g: ['packages/**', '!packages/b/**', 'packages/b/a']\n // in the above list, the last pattern overrides the negated pattern\n // right before it. In effect, the above list would become:\n // ['packages/**', 'packages/b/a']\n // The order matters here which is why we must do it inside the loop\n // as opposed to doing it all together at the end.\n for (let i = 0; i < negatedPatterns.length; ++i) {\n const negatedPattern = negatedPatterns[i]\n if (minimatch(pattern, negatedPattern)) {\n negatedPatterns.splice(i, 1)\n }\n }\n patterns.push(pattern)\n }\n }\n\n // use the negated patterns to eagerly remove all the patterns that\n // can be removed to avoid unnecessary crawling\n for (const negated of negatedPatterns) {\n for (const pattern of minimatch.match(patterns, negated)) {\n patterns.splice(patterns.indexOf(pattern), 1)\n }\n }\n return { patterns, negatedPatterns }\n}\n\nfunction getPatterns (workspaces) {\n const workspacesDeclaration =\n Array.isArray(workspaces.packages)\n ? workspaces.packages\n : workspaces\n\n if (!Array.isArray(workspacesDeclaration)) {\n throw getError({\n message: 'workspaces config expects an Array',\n code: 'EWORKSPACESCONFIG',\n })\n }\n\n return appendNegatedPatterns(workspacesDeclaration)\n}\n\nfunction getPackageName (pkg, pathname) {\n return pkg.name || getName(pathname)\n}\n\n// make sure glob pattern only matches folders\nfunction getGlobPattern (pattern) {\n pattern = pattern.replace(/\\\\/g, '/')\n return pattern.endsWith('/')\n ? pattern\n : `${pattern}/`\n}\n\nfunction getError ({ Type = TypeError, message, code }) {\n return Object.assign(new Type(message), { code })\n}\n\nfunction reverseResultMap (map) {\n return new Map(Array.from(map, item => item.reverse()))\n}\n\nasync function mapWorkspaces (opts = {}) {\n if (!opts || !opts.pkg) {\n throw getError({\n message: 'mapWorkspaces missing pkg info',\n code: 'EMAPWORKSPACESPKG',\n })\n }\n if (!opts.cwd) {\n opts.cwd = process.cwd()\n }\n\n const { workspaces = [] } = opts.pkg\n const { patterns, negatedPatterns } = getPatterns(workspaces)\n const results = new Map()\n\n if (!patterns.length && !negatedPatterns.length) {\n return results\n }\n\n const seen = new Map()\n const getGlobOpts = () => ({\n ...opts,\n ignore: [\n ...opts.ignore || [],\n '**/node_modules/**',\n // just ignore the negated patterns to avoid unnecessary crawling\n ...negatedPatterns,\n ],\n })\n\n let matches = await glob(patterns.map((p) => getGlobPattern(p)), getGlobOpts())\n // preserves glob@8 behavior\n matches = matches.sort((a, b) => a.localeCompare(b, 'en'))\n\n // we must preserve the order of results according to the given list of\n // workspace patterns\n const orderedMatches = []\n for (const pattern of patterns) {\n orderedMatches.push(...matches.filter((m) => {\n return minimatch(m, pattern, { partial: true, windowsPathsNoEscape: true })\n }))\n }\n\n for (const match of orderedMatches) {\n let pkg\n try {\n pkg = await pkgJson.normalize(path.join(opts.cwd, match))\n } catch (err) {\n if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {\n continue\n } else {\n throw err\n }\n }\n\n const name = getPackageName(pkg.content, pkg.path)\n\n let seenPackagePathnames = seen.get(name)\n if (!seenPackagePathnames) {\n seenPackagePathnames = new Set()\n seen.set(name, seenPackagePathnames)\n }\n seenPackagePathnames.add(pkg.path)\n }\n\n const errorMessageArray = ['must not have multiple workspaces with the same name']\n for (const [packageName, seenPackagePathnames] of seen) {\n if (seenPackagePathnames.size > 1) {\n addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames)\n } else {\n results.set(packageName, seenPackagePathnames.values().next().value)\n }\n }\n\n if (errorMessageArray.length > 1) {\n throw getError({\n Type: Error,\n message: errorMessageArray.join('\\n'),\n code: 'EDUPLICATEWORKSPACE',\n })\n }\n\n return results\n}\n\nfunction addDuplicateErrorMessages (messageArray, packageName, packagePathnames) {\n messageArray.push(\n `package '${packageName}' has conflicts in the following paths:`\n )\n\n for (const packagePathname of packagePathnames) {\n messageArray.push(\n ' ' + packagePathname\n )\n }\n}\n\nmapWorkspaces.virtual = function (opts = {}) {\n if (!opts || !opts.lockfile) {\n throw getError({\n message: 'mapWorkspaces.virtual missing lockfile info',\n code: 'EMAPWORKSPACESLOCKFILE',\n })\n }\n if (!opts.cwd) {\n opts.cwd = process.cwd()\n }\n\n const { packages = {} } = opts.lockfile\n const { workspaces = [] } = packages[''] || {}\n // uses a pathname-keyed map in order to negate the exact items\n const results = new Map()\n const { patterns, negatedPatterns } = getPatterns(workspaces)\n if (!patterns.length && !negatedPatterns.length) {\n return results\n }\n negatedPatterns.push('**/node_modules/**')\n\n const packageKeys = Object.keys(packages)\n for (const pattern of negatedPatterns) {\n for (const packageKey of minimatch.match(packageKeys, pattern)) {\n packageKeys.splice(packageKeys.indexOf(packageKey), 1)\n }\n }\n\n for (const pattern of patterns) {\n for (const packageKey of minimatch.match(packageKeys, pattern)) {\n const packagePathname = path.join(opts.cwd, packageKey)\n const name = getPackageName(packages[packageKey], packagePathname)\n results.set(packagePathname, name)\n }\n }\n\n // Invert pathname-keyed to a proper name-to-pathnames Map\n return reverseResultMap(results)\n}\n\nmodule.exports = mapWorkspaces\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.walkUp = void 0;\nconst path_1 = require(\"path\");\nconst walkUp = function* (path) {\n for (path = (0, path_1.resolve)(path); path;) {\n yield path;\n const pp = (0, path_1.dirname)(path);\n if (pp === path) {\n break;\n }\n else {\n path = pp;\n }\n }\n};\nexports.walkUp = walkUp;\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,1,2],"mappings":";;;;CAAA,MAAM,EAAE,UAAU,YAAA,UAAoB,MAAM;CAE5C,MAAM,WAAW,QAAQ,SACvB,OAAO,OAAO,CAAC,MAAM,MAAM,GAAG,OAAO,GAAG,SAAS;CAEnD,OAAO,WAAU,QAAO,MAAM,QAAQ,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,IACvE;;;;;CCNJ,MAAM,OAAA,UAAe,MAAM;CAE3B,MAAM,UAAA,cAAA;CACN,MAAM,EAAE,cAAA,mBAAA;CACR,MAAM,UAAA,cAAA;CACN,MAAM,EAAE,SAAA,kBAAA;CAER,SAAS,sBAAuB,aAAa;EAC3C,MAAM,WAAW,CAAC;EAClB,MAAM,kBAAkB,CAAC;EACzB,KAAK,IAAI,WAAW,aAAa;GAC/B,MAAM,OAAO,QAAQ,MAAM,KAAK;GAChC,IAAI,MACF,UAAU,QAAQ,MAAM,KAAK,EAAE,CAAC,MAAM;GAIxC,UAAU,QAAQ,QAAQ,WAAW,EAAE;GAIvC,IADe,QAAQ,KAAK,EAAE,CAAC,SAAS,MAAM,GAE5C,gBAAgB,KAAK,OAAO;QACvB;IASL,KAAK,IAAI,IAAI,GAAG,IAAI,gBAAgB,QAAQ,EAAE,GAAG;KAC/C,MAAM,iBAAiB,gBAAgB;KACvC,IAAI,UAAU,SAAS,cAAc,GACnC,gBAAgB,OAAO,GAAG,CAAC;IAE/B;IACA,SAAS,KAAK,OAAO;GACvB;EACF;EAIA,KAAK,MAAM,WAAW,iBACpB,KAAK,MAAM,WAAW,UAAU,MAAM,UAAU,OAAO,GACrD,SAAS,OAAO,SAAS,QAAQ,OAAO,GAAG,CAAC;EAGhD,OAAO;GAAE;GAAU;EAAgB;CACrC;CAEA,SAA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der/lib/index.js","../../../../node_modules/.pnpm/@npmcli+map-workspaces@6.0.0/node_modules/@npmcli/map-workspaces/lib/index.js","../../../../node_modules/.pnpm/walk-up-path@4.0.0/node_modules/walk-up-path/dist/commonjs/index.js"],"sourcesContent":["const { basename, dirname } = require('path')\n\nconst getName = (parent, base) =>\n parent.charAt(0) === '@' ? `${parent}/${base}` : base\n\nmodule.exports = dir => dir ? getName(basename(dirname(dir)), basename(dir))\n : false\n","const path = require('path')\n\nconst getName = require('@npmcli/name-from-folder')\nconst { minimatch } = require('minimatch')\nconst pkgJson = require('@npmcli/package-json')\nconst { glob } = require('glob')\n\nfunction appendNegatedPatterns (allPatterns) {\n const patterns = []\n const negatedPatterns = []\n for (let pattern of allPatterns) {\n const excl = pattern.match(/^!+/)\n if (excl) {\n pattern = pattern.slice(excl[0].length)\n }\n\n // strip off any / or ./ from the start of the pattern. /foo => foo\n pattern = pattern.replace(/^\\.?\\/+/, '')\n\n // an odd number of ! means a negated pattern. !!foo ==> foo\n const negate = excl && excl[0].length % 2 === 1\n if (negate) {\n negatedPatterns.push(pattern)\n } else {\n // remove negated patterns that appeared before this pattern to avoid\n // ignoring paths that were matched afterwards\n // e.g: ['packages/**', '!packages/b/**', 'packages/b/a']\n // in the above list, the last pattern overrides the negated pattern\n // right before it. In effect, the above list would become:\n // ['packages/**', 'packages/b/a']\n // The order matters here which is why we must do it inside the loop\n // as opposed to doing it all together at the end.\n for (let i = 0; i < negatedPatterns.length; ++i) {\n const negatedPattern = negatedPatterns[i]\n if (minimatch(pattern, negatedPattern)) {\n negatedPatterns.splice(i, 1)\n }\n }\n patterns.push(pattern)\n }\n }\n\n // use the negated patterns to eagerly remove all the patterns that\n // can be removed to avoid unnecessary crawling\n for (const negated of negatedPatterns) {\n for (const pattern of minimatch.match(patterns, negated)) {\n patterns.splice(patterns.indexOf(pattern), 1)\n }\n }\n return { patterns, negatedPatterns }\n}\n\nfunction getPatterns (workspaces) {\n const workspacesDeclaration =\n Array.isArray(workspaces.packages)\n ? workspaces.packages\n : workspaces\n\n if (!Array.isArray(workspacesDeclaration)) {\n throw getError({\n message: 'workspaces config expects an Array',\n code: 'EWORKSPACESCONFIG',\n })\n }\n\n return appendNegatedPatterns(workspacesDeclaration)\n}\n\nfunction getPackageName (pkg, pathname) {\n return pkg.name || getName(pathname)\n}\n\n// make sure glob pattern only matches folders\nfunction getGlobPattern (pattern) {\n pattern = pattern.replace(/\\\\/g, '/')\n return pattern.endsWith('/')\n ? pattern\n : `${pattern}/`\n}\n\nfunction getError ({ Type = TypeError, message, code }) {\n return Object.assign(new Type(message), { code })\n}\n\nfunction reverseResultMap (map) {\n return new Map(Array.from(map, item => item.reverse()))\n}\n\nasync function mapWorkspaces (opts = {}) {\n if (!opts || !opts.pkg) {\n throw getError({\n message: 'mapWorkspaces missing pkg info',\n code: 'EMAPWORKSPACESPKG',\n })\n }\n if (!opts.cwd) {\n opts.cwd = process.cwd()\n }\n\n const { workspaces = [] } = opts.pkg\n const { patterns, negatedPatterns } = getPatterns(workspaces)\n const results = new Map()\n\n if (!patterns.length && !negatedPatterns.length) {\n return results\n }\n\n const seen = new Map()\n const getGlobOpts = () => ({\n ...opts,\n ignore: [\n ...opts.ignore || [],\n '**/node_modules/**',\n // just ignore the negated patterns to avoid unnecessary crawling\n ...negatedPatterns,\n ],\n })\n\n let matches = await glob(patterns.map((p) => getGlobPattern(p)), getGlobOpts())\n // preserves glob@8 behavior\n matches = matches.sort((a, b) => a.localeCompare(b, 'en'))\n\n // we must preserve the order of results according to the given list of\n // workspace patterns\n const orderedMatches = []\n for (const pattern of patterns) {\n orderedMatches.push(...matches.filter((m) => {\n return minimatch(m, pattern, { partial: true, windowsPathsNoEscape: true })\n }))\n }\n\n for (const match of orderedMatches) {\n let pkg\n try {\n pkg = await pkgJson.normalize(path.join(opts.cwd, match))\n } catch (err) {\n if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {\n continue\n } else {\n throw err\n }\n }\n\n const name = getPackageName(pkg.content, pkg.path)\n\n let seenPackagePathnames = seen.get(name)\n if (!seenPackagePathnames) {\n seenPackagePathnames = new Set()\n seen.set(name, seenPackagePathnames)\n }\n seenPackagePathnames.add(pkg.path)\n }\n\n const errorMessageArray = ['must not have multiple workspaces with the same name']\n for (const [packageName, seenPackagePathnames] of seen) {\n if (seenPackagePathnames.size > 1) {\n addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames)\n } else {\n results.set(packageName, seenPackagePathnames.values().next().value)\n }\n }\n\n if (errorMessageArray.length > 1) {\n throw getError({\n Type: Error,\n message: errorMessageArray.join('\\n'),\n code: 'EDUPLICATEWORKSPACE',\n })\n }\n\n return results\n}\n\nfunction addDuplicateErrorMessages (messageArray, packageName, packagePathnames) {\n messageArray.push(\n `package '${packageName}' has conflicts in the following paths:`\n )\n\n for (const packagePathname of packagePathnames) {\n messageArray.push(\n ' ' + packagePathname\n )\n }\n}\n\nmapWorkspaces.virtual = function (opts = {}) {\n if (!opts || !opts.lockfile) {\n throw getError({\n message: 'mapWorkspaces.virtual missing lockfile info',\n code: 'EMAPWORKSPACESLOCKFILE',\n })\n }\n if (!opts.cwd) {\n opts.cwd = process.cwd()\n }\n\n const { packages = {} } = opts.lockfile\n const { workspaces = [] } = packages[''] || {}\n // uses a pathname-keyed map in order to negate the exact items\n const results = new Map()\n const { patterns, negatedPatterns } = getPatterns(workspaces)\n if (!patterns.length && !negatedPatterns.length) {\n return results\n }\n negatedPatterns.push('**/node_modules/**')\n\n const packageKeys = Object.keys(packages)\n for (const pattern of negatedPatterns) {\n for (const packageKey of minimatch.match(packageKeys, pattern)) {\n packageKeys.splice(packageKeys.indexOf(packageKey), 1)\n }\n }\n\n for (const pattern of patterns) {\n for (const packageKey of minimatch.match(packageKeys, pattern)) {\n const packagePathname = path.join(opts.cwd, packageKey)\n const name = getPackageName(packages[packageKey], packagePathname)\n results.set(packagePathname, name)\n }\n }\n\n // Invert pathname-keyed to a proper name-to-pathnames Map\n return reverseResultMap(results)\n}\n\nmodule.exports = mapWorkspaces\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.walkUp = void 0;\nconst path_1 = require(\"path\");\nconst walkUp = function* (path) {\n for (path = (0, path_1.resolve)(path); path;) {\n yield path;\n const pp = (0, path_1.dirname)(path);\n if (pp === path) {\n break;\n }\n else {\n path = pp;\n }\n }\n};\nexports.walkUp = walkUp;\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,1,2],"mappings":";;;;CAAA,MAAM,EAAE,UAAU,YAAA,UAAoB,MAAM;CAE5C,MAAM,WAAW,QAAQ,SACvB,OAAO,OAAO,CAAC,MAAM,MAAM,GAAG,OAAO,GAAG,SAAS;CAEnD,OAAO,WAAU,QAAO,MAAM,QAAQ,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,IACvE;;;;;CCNJ,MAAM,OAAA,UAAe,MAAM;CAE3B,MAAM,UAAA,cAAA;CACN,MAAM,EAAE,cAAA,mBAAA;CACR,MAAM,UAAA,cAAA;CACN,MAAM,EAAE,SAAA,kBAAA;CAER,SAAS,sBAAuB,aAAa;EAC3C,MAAM,WAAW,CAAC;EAClB,MAAM,kBAAkB,CAAC;EACzB,KAAK,IAAI,WAAW,aAAa;GAC/B,MAAM,OAAO,QAAQ,MAAM,KAAK;GAChC,IAAI,MACF,UAAU,QAAQ,MAAM,KAAK,EAAE,CAAC,MAAM;GAIxC,UAAU,QAAQ,QAAQ,WAAW,EAAE;GAIvC,IADe,QAAQ,KAAK,EAAE,CAAC,SAAS,MAAM,GAE5C,gBAAgB,KAAK,OAAO;QACvB;IASL,KAAK,IAAI,IAAI,GAAG,IAAI,gBAAgB,QAAQ,EAAE,GAAG;KAC/C,MAAM,iBAAiB,gBAAgB;KACvC,IAAI,UAAU,SAAS,cAAc,GACnC,gBAAgB,OAAO,GAAG,CAAC;IAE/B;IACA,SAAS,KAAK,OAAO;GACvB;EACF;EAIA,KAAK,MAAM,WAAW,iBACpB,KAAK,MAAM,WA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QAAQ,SAAS"}
@@ -1,5 +1,5 @@
1
- import { Ct as __commonJSMin, Et as __require } from "./error-BrbT9_4g.mjs";
2
- import { t as require_type_defs } from "./type-defs-BZxrtlVD.mjs";
1
+ import { Ot as __require, Tt as __commonJSMin } from "./error-DG5INUkQ.mjs";
2
+ import { t as require_type_defs } from "./type-defs-JBxRyl-4.mjs";
3
3
  //#region ../../node_modules/.pnpm/@npmcli+config@11.0.1/node_modules/@npmcli/config/lib/definitions/definition.js
4
4
  var require_definition = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
5
  const required = [
@@ -3345,4 +3345,4 @@ var require_definitions = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3345
3345
  export default require_definitions();
3346
3346
  export {};
3347
3347
 
3348
- //# sourceMappingURL=definitions-Dfwyyv_K.mjs.map
3348
+ //# sourceMappingURL=definitions-XbglYT7Q.mjs.map