@codeworksh/cli 0.0.1-dev.20260922135856 → 0.0.1-dev.20260922184805

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 (74) hide show
  1. package/README.md +43 -0
  2. package/{add-D7X5BuCv.mjs → add--i7mPR73.mjs} +4 -4
  3. package/{add-D7X5BuCv.mjs.map → add--i7mPR73.mjs.map} +1 -1
  4. package/{catalog-DL8yWdvI.mjs → catalog-DJxy_lne.mjs} +2 -2
  5. package/{catalog-DL8yWdvI.mjs.map → catalog-DJxy_lne.mjs.map} +1 -1
  6. package/{check-M9CqztTk.mjs → check-Dq2WOgap.mjs} +4 -4
  7. package/{check-M9CqztTk.mjs.map → check-Dq2WOgap.mjs.map} +1 -1
  8. package/{commonjs-CiyyOsS6.mjs → commonjs-BDiLMfFF.mjs} +3 -3
  9. package/{commonjs-CiyyOsS6.mjs.map → commonjs-BDiLMfFF.mjs.map} +1 -1
  10. package/{definitions-ClJIBYEm.mjs → definitions-Dfwyyv_K.mjs} +3 -3
  11. package/{definitions-ClJIBYEm.mjs.map → definitions-Dfwyyv_K.mjs.map} +1 -1
  12. package/{entries-DBdy6ahj.mjs → entries-Gfsq7U4P.mjs} +2 -2
  13. package/{entries-DBdy6ahj.mjs.map → entries-Gfsq7U4P.mjs.map} +1 -1
  14. package/{error-DTXBm1nO.mjs → error-BrbT9_4g.mjs} +119 -9
  15. package/error-BrbT9_4g.mjs.map +1 -0
  16. package/{generate-C5NElYXe.mjs → generate-DrGYpD3l.mjs} +3 -3
  17. package/{generate-C5NElYXe.mjs.map → generate-DrGYpD3l.mjs.map} +1 -1
  18. package/{harness-DQxbts5f.mjs → harness-Bgvrr0ZB.mjs} +2 -2
  19. package/{harness-DQxbts5f.mjs.map → harness-Bgvrr0ZB.mjs.map} +1 -1
  20. package/index.d.mts +6 -1
  21. package/index.mjs +20 -14
  22. package/index.mjs.map +1 -1
  23. package/{install-CJEnZ9dx.mjs → install-DoO4D3fk.mjs} +4 -4
  24. package/{install-CJEnZ9dx.mjs.map → install-DoO4D3fk.mjs.map} +1 -1
  25. package/{lib-CVW4jqJ3.mjs → lib-BkWR53Bz.mjs} +6 -6
  26. package/{lib-CVW4jqJ3.mjs.map → lib-BkWR53Bz.mjs.map} +1 -1
  27. package/{lib-HXZBVLKt.mjs → lib-CyynPpjH.mjs} +5 -5
  28. package/{lib-HXZBVLKt.mjs.map → lib-CyynPpjH.mjs.map} +1 -1
  29. package/{lib-5d-Jmuz2.mjs → lib-Dw7R2suc.mjs} +5 -5
  30. package/{lib-5d-Jmuz2.mjs.map → lib-Dw7R2suc.mjs.map} +1 -1
  31. package/{lib-vrwKjvzk.mjs → lib-JQygPqgO.mjs} +3 -3
  32. package/{lib-vrwKjvzk.mjs.map → lib-JQygPqgO.mjs.map} +1 -1
  33. package/{link-D8V3E5iZ.mjs → link-B1zfETsS.mjs} +3 -3
  34. package/{link-D8V3E5iZ.mjs.map → link-B1zfETsS.mjs.map} +1 -1
  35. package/{list-DS9BJ3dD.mjs → list-3OR68HpY.mjs} +4 -4
  36. package/{list-DS9BJ3dD.mjs.map → list-3OR68HpY.mjs.map} +1 -1
  37. package/{list-BMUDpLRf.mjs → list-CfPfmfe0.mjs} +4 -4
  38. package/{list-BMUDpLRf.mjs.map → list-CfPfmfe0.mjs.map} +1 -1
  39. package/login-GFV3Z9f2.mjs +45 -0
  40. package/login-GFV3Z9f2.mjs.map +1 -0
  41. package/logout-D17TQUfo.mjs +29 -0
  42. package/logout-D17TQUfo.mjs.map +1 -0
  43. package/{p-map-LZ99xLhZ.mjs → p-map-C2WSUhyP.mjs} +2 -2
  44. package/{p-map-LZ99xLhZ.mjs.map → p-map-C2WSUhyP.mjs.map} +1 -1
  45. package/package.json +3 -3
  46. package/{providers-DT5BfXJV.mjs → providers-DLXs9aWZ.mjs} +4 -4
  47. package/{providers-DT5BfXJV.mjs.map → providers-DLXs9aWZ.mjs.map} +1 -1
  48. package/refresh-BTNuP1zL.mjs +35 -0
  49. package/refresh-BTNuP1zL.mjs.map +1 -0
  50. package/{reload-2GZ_8UBW.mjs → reload-BzwsCBQq.mjs} +3 -3
  51. package/{reload-2GZ_8UBW.mjs.map → reload-BzwsCBQq.mjs.map} +1 -1
  52. package/{remove-t8FHVGC0.mjs → remove-DgB3l5JL.mjs} +4 -4
  53. package/{remove-t8FHVGC0.mjs.map → remove-DgB3l5JL.mjs.map} +1 -1
  54. package/{run-CP7aAfkf.mjs → run-BVo4XsL6.mjs} +4 -4
  55. package/{run-CP7aAfkf.mjs.map → run-BVo4XsL6.mjs.map} +1 -1
  56. package/{runtime-CDSh4qOj.mjs → runtime-Dl621FOp.mjs} +76 -1
  57. package/runtime-Dl621FOp.mjs.map +1 -0
  58. package/{serve-DewC8gvV.mjs → serve-Dpep18-A.mjs} +79 -16
  59. package/serve-Dpep18-A.mjs.map +1 -0
  60. package/{settings-Bn2pmQXX.mjs → settings-C52IrA72.mjs} +2 -2
  61. package/{settings-Bn2pmQXX.mjs.map → settings-C52IrA72.mjs.map} +1 -1
  62. package/shared-Uwjcofff.mjs +115 -0
  63. package/shared-Uwjcofff.mjs.map +1 -0
  64. package/status-DPYq2Sx4.mjs +31 -0
  65. package/status-DPYq2Sx4.mjs.map +1 -0
  66. package/{type-defs-xvRvQI4T.mjs → type-defs-BZxrtlVD.mjs} +3 -3
  67. package/{type-defs-xvRvQI4T.mjs.map → type-defs-BZxrtlVD.mjs.map} +1 -1
  68. package/{update-CLfU-oh7.mjs → update-CJrBbHwq.mjs} +4 -4
  69. package/{update-CLfU-oh7.mjs.map → update-CJrBbHwq.mjs.map} +1 -1
  70. package/{valid-BXe5q7ao.mjs → valid-BWgW_TUl.mjs} +2 -2
  71. package/{valid-BXe5q7ao.mjs.map → valid-BWgW_TUl.mjs.map} +1 -1
  72. package/error-DTXBm1nO.mjs.map +0 -1
  73. package/runtime-CDSh4qOj.mjs.map +0 -1
  74. package/serve-DewC8gvV.mjs.map +0 -1
package/README.md CHANGED
@@ -82,6 +82,49 @@ The v0 endpoint has no authentication; its default binding is loopback. Plugins
82
82
 
83
83
  ---
84
84
 
85
+ ### `codework auth login|status|refresh|logout`
86
+
87
+ Sign in to OpenAI Codex with your ChatGPT account, or to GitHub Copilot with your GitHub account. Credentials are
88
+ stored under the selected Codework home and are loaded automatically when a run uses an `openai-codex` or
89
+ `github-copilot` model.
90
+
91
+ ```bash
92
+ # Sign in
93
+ codework auth login --openai-codex
94
+ codework auth login --github-copilot
95
+
96
+ # Codex without a local callback port (SSH, containers, port 1455 in use)
97
+ codework auth login --openai-codex --device
98
+
99
+ # Inspect credential metadata without printing tokens
100
+ codework auth status --openai-codex
101
+ codework auth status --github-copilot
102
+
103
+ # Renew an expired login, or clear one
104
+ codework auth refresh --openai-codex
105
+ codework auth logout --github-copilot
106
+
107
+ # Authenticate the home owned by a running RPC server
108
+ codework auth login --openai-codex --server ws://127.0.0.1:7433/rpc
109
+ ```
110
+
111
+ `--home` keeps authentication alongside the rest of that Codework installation; `--auth-file` overrides the credential
112
+ file directly. Both providers share one `auth.json`, keyed by provider, so signing out of one leaves the other alone.
113
+ With `--server`, the CLI runs the interactive login locally -- a browser callback and a device prompt both need this
114
+ terminal -- and sends only the resulting credentials to the RPC server for storage.
115
+
116
+ **OpenAI Codex** has two flows. The default keeps Aikit's registered `http://localhost:1455/auth/callback` redirect,
117
+ and falls back to asking for the redirect URL if the callback never arrives. `--device` instead prints a code to enter
118
+ at `auth.openai.com/codex/device` and needs no local port at all — use it over SSH, inside a container, or when another
119
+ sign-in already holds 1455. That port is fixed by the redirect registered against the OAuth client, so it cannot move.
120
+
121
+ **GitHub Copilot** uses the GitHub device flow: the CLI prints a user code, opens `github.com/login/device`, and waits.
122
+ The token does not expire, so there is no `--refresh` -- sign in again on persistent 401s. `--enterprise <domain>`
123
+ logs into a GitHub Enterprise host, and `--enable-models` turns on catalog models the account has left unconfigured.
124
+ Login records the plan-specific Copilot API host, which later runs use in place of the catalog default.
125
+
126
+ ---
127
+
85
128
  ### `codework models`
86
129
 
87
130
  List catalog models as `provider/model`, one per line.
@@ -1,6 +1,6 @@
1
- import { R as inspect, _t as ID, d as writeOut, gt as resolve, ht as path, i as reportFailure, it as layer, mt as layer$2, nt as SessionNotFoundError, rt as SessionNotLinkedError, st as layer$1, tt as Service } from "./error-DTXBm1nO.mjs";
2
- import { i as Cmd, t as handler } from "./runtime-CDSh4qOj.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-Bn2pmQXX.mjs";
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";
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-D7X5BuCv.mjs.map
81
+ //# sourceMappingURL=add--i7mPR73.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-D7X5BuCv.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,CAAC,CAAC,WAAW,EAAE,SAAS,WAAW,QAAQ,UAAU,WAAW;CAiFzF,OAAO,OAhFS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,OAAO,OAAO,KAAK;EACzB,M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,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--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,O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AAS,WAAW,OAAO,QAAQ,IAAI;CACjF,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
@@ -1,4 +1,4 @@
1
- import { Q as ModelCatalogError } from "./error-DTXBm1nO.mjs";
1
+ import { et as ModelCatalogError } from "./error-BrbT9_4g.mjs";
2
2
  import { Effect } from "effect";
3
3
  import { Model } from "@codeworksh/aikit";
4
4
  //#region src/cli/cmd/handlers/models/catalog.ts
@@ -28,4 +28,4 @@ const loadProviders = Effect.tryPromise({
28
28
  //#endregion
29
29
  export { loadProviders as n, loadCatalog as t };
30
30
 
31
- //# sourceMappingURL=catalog-DL8yWdvI.mjs.map
31
+ //# sourceMappingURL=catalog-DJxy_lne.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalog-DL8yWdvI.mjs","names":["Runner.ModelCatalogError"],"sources":["../../src/cli/cmd/handlers/models/catalog.ts"],"sourcesContent":["import { Model } from \"@codeworksh/aikit\";\nimport { Runner } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\n\nconst catalogError = (cause: unknown): Runner.ModelCatalogError => {\n\tif (\n\t\ttypeof cause === \"object\" &&\n\t\tcause !== null &&\n\t\t\"name\" in cause &&\n\t\tcause.name === \"ModelCatalogLoadError\" &&\n\t\t\"data\" in cause &&\n\t\ttypeof cause.data === \"object\" &&\n\t\tcause.data !== null\n\t) {\n\t\tconst data = cause.data;\n\t\tif (\n\t\t\t\"path\" in data &&\n\t\t\ttypeof data.path === \"string\" &&\n\t\t\t\"message\" in data &&\n\t\t\ttypeof data.message === \"string\" &&\n\t\t\t\"reason\" in data &&\n\t\t\t(data.reason === \"missing\" ||\n\t\t\t\tdata.reason === \"unreadable\" ||\n\t\t\t\tdata.reason === \"empty\" ||\n\t\t\t\tdata.reason === \"invalid\")\n\t\t) {\n\t\t\treturn new Runner.ModelCatalogError({\n\t\t\t\tpath: data.path,\n\t\t\t\treason: data.reason,\n\t\t\t\tdetail: data.message,\n\t\t\t});\n\t\t}\n\t}\n\treturn new Runner.ModelCatalogError({\n\t\tpath: \"\",\n\t\treason: \"unreadable\",\n\t\tdetail: cause instanceof Error ? cause.message : \"failed to load the model catalog\",\n\t});\n};\n\nexport const loadCatalog = Effect.tryPromise({\n\ttry: () => Model.getBuiltInModels(),\n\tcatch: catalogError,\n});\n\nexport const loadProviders = Effect.tryPromise({\n\ttry: () => Model.getProviders(),\n\tcatch: catalogError,\n});\n"],"mappings":";;;;AAIA,MAAM,gBAAgB,UAA6C;CAClE,IACC,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,MAAM,SAAS,2BACf,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,SAAS,MACd;EACD,MAAM,OAAO,MAAM;EACnB,IACC,UAAU,QACV,OAAO,KAAK,SAAS,YACrB,aAAa,QACb,OAAO,KAAK,YAAY,YACxB,YAAY,SACX,KAAK,WAAW,aAChB,KAAK,WAAW,gBAChB,KAAK,WAAW,WAChB,KAAK,WAAW,YAEjB,OAAO,IAAIA,kBAAyB;GACnC,MAAM,KAAK;GACX,QAAQ,KAAK;GACb,QAAQ,KAAK;EACd,CAAC;CAEH;CACA,OAAO,IAAIA,kBAAyB;EACnC,MAAM;EACN,QAAQ;EACR,QAAQ,iBAAiB,QAAQ,MAAM,UAAU;CAClD,CAAC;AACF;AAEA,MAAa,cAAc,OAAO,WAAW;CAC5C,WAAW,MAAM,iBAAiB;CAClC,OAAO;AACR,CAAC;AAED,MAAa,gBAAgB,OAAO,WAAW;CAC9C,WAAW,MAAM,aAAa;CAC9B,OAAO;AACR,CAAC"}
1
+ {"version":3,"file":"catalog-DJxy_lne.mjs","names":["Runner.ModelCatalogError"],"sources":["../../src/cli/cmd/handlers/models/catalog.ts"],"sourcesContent":["import { Model } from \"@codeworksh/aikit\";\nimport { Runner } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\n\nconst catalogError = (cause: unknown): Runner.ModelCatalogError => {\n\tif (\n\t\ttypeof cause === \"object\" &&\n\t\tcause !== null &&\n\t\t\"name\" in cause &&\n\t\tcause.name === \"ModelCatalogLoadError\" &&\n\t\t\"data\" in cause &&\n\t\ttypeof cause.data === \"object\" &&\n\t\tcause.data !== null\n\t) {\n\t\tconst data = cause.data;\n\t\tif (\n\t\t\t\"path\" in data &&\n\t\t\ttypeof data.path === \"string\" &&\n\t\t\t\"message\" in data &&\n\t\t\ttypeof data.message === \"string\" &&\n\t\t\t\"reason\" in data &&\n\t\t\t(data.reason === \"missing\" ||\n\t\t\t\tdata.reason === \"unreadable\" ||\n\t\t\t\tdata.reason === \"empty\" ||\n\t\t\t\tdata.reason === \"invalid\")\n\t\t) {\n\t\t\treturn new Runner.ModelCatalogError({\n\t\t\t\tpath: data.path,\n\t\t\t\treason: data.reason,\n\t\t\t\tdetail: data.message,\n\t\t\t});\n\t\t}\n\t}\n\treturn new Runner.ModelCatalogError({\n\t\tpath: \"\",\n\t\treason: \"unreadable\",\n\t\tdetail: cause instanceof Error ? cause.message : \"failed to load the model catalog\",\n\t});\n};\n\nexport const loadCatalog = Effect.tryPromise({\n\ttry: () => Model.getBuiltInModels(),\n\tcatch: catalogError,\n});\n\nexport const loadProviders = Effect.tryPromise({\n\ttry: () => Model.getProviders(),\n\tcatch: catalogError,\n});\n"],"mappings":";;;;AAIA,MAAM,gBAAgB,UAA6C;CAClE,IACC,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,MAAM,SAAS,2BACf,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,SAAS,MACd;EACD,MAAM,OAAO,MAAM;EACnB,IACC,UAAU,QACV,OAAO,KAAK,SAAS,YACrB,aAAa,QACb,OAAO,KAAK,YAAY,YACxB,YAAY,SACX,KAAK,WAAW,aAChB,KAAK,WAAW,gBAChB,KAAK,WAAW,WAChB,KAAK,WAAW,YAEjB,OAAO,IAAIA,kBAAyB;GACnC,MAAM,KAAK;GACX,QAAQ,KAAK;GACb,QAAQ,KAAK;EACd,CAAC;CAEH;CACA,OAAO,IAAIA,kBAAyB;EACnC,MAAM;EACN,QAAQ;EACR,QAAQ,iBAAiB,QAAQ,MAAM,UAAU;CAClD,CAAC;AACF;AAEA,MAAa,cAAc,OAAO,WAAW;CAC5C,WAAW,MAAM,iBAAiB;CAClC,OAAO;AACR,CAAC;AAED,MAAa,gBAAgB,OAAO,WAAW;CAC9C,WAAW,MAAM,aAAa;CAC9B,OAAO;AACR,CAAC"}
@@ -1,6 +1,6 @@
1
- import { d as writeOut, i as reportFailure, z as check } from "./error-DTXBm1nO.mjs";
2
- import { i as Cmd, t as handler } from "./runtime-CDSh4qOj.mjs";
3
- import { n as probe, r as read, t as fetchable } from "./entries-DBdy6ahj.mjs";
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";
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-M9CqztTk.mjs.map
47
+ //# sourceMappingURL=check-Dq2WOgap.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"check-M9CqztTk.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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vD,CAAC,CACF"}
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\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 { St as __require, yt as __commonJSMin } from "./error-DTXBm1nO.mjs";
2
- import { h as require_commonjs$1, t as require_lib$2, u as require_index_min } from "./lib-vrwKjvzk.mjs";
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";
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-CiyyOsS6.mjs.map
160
+ //# sourceMappingURL=commonjs-BDiLMfFF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"commonjs-CiyyOsS6.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,O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mcli+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,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OAAO,MACP;QAGA,OAAO;EAEf;CACJ;CACA,QAAQ,SAAS"}
@@ -1,5 +1,5 @@
1
- import { St as __require, yt as __commonJSMin } from "./error-DTXBm1nO.mjs";
2
- import { t as require_type_defs } from "./type-defs-xvRvQI4T.mjs";
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";
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-ClJIBYEm.mjs.map
3348
+ //# sourceMappingURL=definitions-Dfwyyv_K.mjs.map