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

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 (84) hide show
  1. package/README.md +16 -18
  2. package/{add--i7mPR73.mjs → add-CIQSfxan.mjs} +5 -5
  3. package/{add--i7mPR73.mjs.map → add-CIQSfxan.mjs.map} +1 -1
  4. package/catalog-C5fDCgtx.mjs +17 -0
  5. package/catalog-C5fDCgtx.mjs.map +1 -0
  6. package/{check-Dq2WOgap.mjs → check-B7bP5lRI.mjs} +15 -9
  7. package/check-B7bP5lRI.mjs.map +1 -0
  8. package/entries-CSY5N6jH.mjs +89 -0
  9. package/entries-CSY5N6jH.mjs.map +1 -0
  10. package/{error-BrbT9_4g.mjs → error-D0C5K2Av.mjs} +2307 -2157
  11. package/error-D0C5K2Av.mjs.map +1 -0
  12. package/{harness-Bgvrr0ZB.mjs → harness-DXAwGk0B.mjs} +2 -2
  13. package/{harness-Bgvrr0ZB.mjs.map → harness-DXAwGk0B.mjs.map} +1 -1
  14. package/index.d.mts +1 -5
  15. package/index.mjs +18 -18
  16. package/index.mjs.map +1 -1
  17. package/{install-DoO4D3fk.mjs → install-B02SIXwF.mjs} +4 -4
  18. package/{install-DoO4D3fk.mjs.map → install-B02SIXwF.mjs.map} +1 -1
  19. package/{link-B1zfETsS.mjs → link-CA9XdPwj.mjs} +3 -3
  20. package/{link-B1zfETsS.mjs.map → link-CA9XdPwj.mjs.map} +1 -1
  21. package/{list-3OR68HpY.mjs → list-Bbo4XnG_.mjs} +4 -4
  22. package/{list-3OR68HpY.mjs.map → list-Bbo4XnG_.mjs.map} +1 -1
  23. package/{list-CfPfmfe0.mjs → list-Ce1Ry4JN.mjs} +6 -5
  24. package/list-Ce1Ry4JN.mjs.map +1 -0
  25. package/{login-GFV3Z9f2.mjs → login-CagARGqW.mjs} +4 -4
  26. package/{login-GFV3Z9f2.mjs.map → login-CagARGqW.mjs.map} +1 -1
  27. package/{logout-D17TQUfo.mjs → logout-CYYtjZL3.mjs} +4 -4
  28. package/{logout-D17TQUfo.mjs.map → logout-CYYtjZL3.mjs.map} +1 -1
  29. package/package.json +5 -5
  30. package/{providers-DLXs9aWZ.mjs → providers-CoYj1SYv.mjs} +6 -5
  31. package/providers-CoYj1SYv.mjs.map +1 -0
  32. package/{refresh-BTNuP1zL.mjs → refresh-8_nfeYNZ.mjs} +4 -4
  33. package/{refresh-BTNuP1zL.mjs.map → refresh-8_nfeYNZ.mjs.map} +1 -1
  34. package/refresh-D2a1ikea.mjs +16 -0
  35. package/refresh-D2a1ikea.mjs.map +1 -0
  36. package/{reload-BzwsCBQq.mjs → reload-C5ysPM58.mjs} +3 -3
  37. package/{reload-BzwsCBQq.mjs.map → reload-C5ysPM58.mjs.map} +1 -1
  38. package/{remove-DgB3l5JL.mjs → remove-BkbspSED.mjs} +4 -4
  39. package/{remove-DgB3l5JL.mjs.map → remove-BkbspSED.mjs.map} +1 -1
  40. package/{run-BVo4XsL6.mjs → run-CnxjZIGy.mjs} +4 -4
  41. package/{run-BVo4XsL6.mjs.map → run-CnxjZIGy.mjs.map} +1 -1
  42. package/{runtime-Dl621FOp.mjs → runtime-B3dlWGfs.mjs} +36 -30
  43. package/runtime-B3dlWGfs.mjs.map +1 -0
  44. package/{serve-Dpep18-A.mjs → serve-DaD7Eijz.mjs} +8 -5
  45. package/{serve-Dpep18-A.mjs.map → serve-DaD7Eijz.mjs.map} +1 -1
  46. package/{settings-C52IrA72.mjs → settings-BZXmb54m.mjs} +23 -18
  47. package/settings-BZXmb54m.mjs.map +1 -0
  48. package/{shared-Uwjcofff.mjs → shared-BaTfajJ2.mjs} +3 -3
  49. package/{shared-Uwjcofff.mjs.map → shared-BaTfajJ2.mjs.map} +1 -1
  50. package/{status-DPYq2Sx4.mjs → status-qJImmv6V.mjs} +4 -4
  51. package/{status-DPYq2Sx4.mjs.map → status-qJImmv6V.mjs.map} +1 -1
  52. package/{update-CJrBbHwq.mjs → update-CxcNv_t0.mjs} +15 -9
  53. package/update-CxcNv_t0.mjs.map +1 -0
  54. package/catalog-DJxy_lne.mjs +0 -31
  55. package/catalog-DJxy_lne.mjs.map +0 -1
  56. package/check-Dq2WOgap.mjs.map +0 -1
  57. package/commonjs-BDiLMfFF.mjs +0 -160
  58. package/commonjs-BDiLMfFF.mjs.map +0 -1
  59. package/definitions-Dfwyyv_K.mjs +0 -3348
  60. package/definitions-Dfwyyv_K.mjs.map +0 -1
  61. package/entries-Gfsq7U4P.mjs +0 -48
  62. package/entries-Gfsq7U4P.mjs.map +0 -1
  63. package/error-BrbT9_4g.mjs.map +0 -1
  64. package/generate-DrGYpD3l.mjs +0 -35
  65. package/generate-DrGYpD3l.mjs.map +0 -1
  66. package/lib-BkWR53Bz.mjs +0 -37659
  67. package/lib-BkWR53Bz.mjs.map +0 -1
  68. package/lib-CyynPpjH.mjs +0 -846
  69. package/lib-CyynPpjH.mjs.map +0 -1
  70. package/lib-Dw7R2suc.mjs +0 -16078
  71. package/lib-Dw7R2suc.mjs.map +0 -1
  72. package/lib-JQygPqgO.mjs +0 -10868
  73. package/lib-JQygPqgO.mjs.map +0 -1
  74. package/list-CfPfmfe0.mjs.map +0 -1
  75. package/p-map-C2WSUhyP.mjs +0 -116
  76. package/p-map-C2WSUhyP.mjs.map +0 -1
  77. package/providers-DLXs9aWZ.mjs.map +0 -1
  78. package/runtime-Dl621FOp.mjs.map +0 -1
  79. package/settings-C52IrA72.mjs.map +0 -1
  80. package/type-defs-BZxrtlVD.mjs +0 -538
  81. package/type-defs-BZxrtlVD.mjs.map +0 -1
  82. package/update-CJrBbHwq.mjs.map +0 -1
  83. package/valid-BWgW_TUl.mjs +0 -354
  84. package/valid-BWgW_TUl.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"shared-Uwjcofff.mjs","names":["Global.resolve","Client.layer"],"sources":["../../src/cli/cmd/handlers/auth/shared.ts"],"sourcesContent":["/* @effect-diagnostics nodeBuiltinImport:off -- OAuth login opens the system browser. */\n/* @effect-diagnostics globalDate:off -- Stored expiry timestamps are rendered for the user. */\n/* oxlint-disable effecttsgo/async-function -- Aikit OAuth callbacks require Promise-returning functions. */\nimport {\n\tGitHubCopilotOAuthClient,\n\tJsonGitHubCopilotAuthStorage,\n\ttype GitHubCopilotAuthStorage,\n} from \"@codeworksh/aikit/oauth/github/copilot\";\nimport {\n\tJsonOpenAICodexAuthStorage,\n\tOpenAICodexOAuthClient,\n\ttype OpenAICodexAuthStorage,\n} from \"@codeworksh/aikit/oauth/openai/codex\";\nimport { openBrowser, promptLine } from \"@codeworksh/aikit/oauth/interactive\";\nimport {\n\tcheckOAuthProvider,\n\toauthProviderLabel,\n\tsummarizeGitHubCopilot,\n\tsummarizeOpenAICodex,\n\ttype OAuthSummary,\n} from \"@codeworksh/aikit/oauth/summary\";\nimport { Global } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport { Client } from \"../../../../server/client.ts\";\nimport type { Contract } from \"../../../../server/contract.ts\";\nimport { InvalidInputError, OAuthError } from \"../../../error.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport type Provider = Contract.OAuthProvider;\n\n// The wire shape and aikit's summary are the same record.\nexport type Summary = Contract.OAuthInfo & OAuthSummary;\n\nconst announce = (\n\tinfo: { url: string; userCode?: string | undefined; instructions?: string | undefined },\n\tbrowser: boolean,\n): void => {\n\tprocess.stderr.write(\n\t\t`${info.instructions ?? \"Complete authentication in your browser.\"}\\n${\n\t\t\tinfo.userCode === undefined ? \"\" : `Enter code: ${info.userCode}\\n`\n\t\t}${info.url}\\n`,\n\t);\n\tif (browser) {\n\t\tvoid openBrowser(info.url, (error) => void process.stderr.write(`Failed to open browser: ${error.message}\\n`));\n\t}\n};\n\nexport interface LoginOptions {\n\treadonly browser: boolean;\n\treadonly device: boolean;\n\treadonly enterprise: Option.Option<string>;\n\treadonly enableModels: boolean;\n}\n\nexport interface Ops {\n\treadonly path: string;\n\treadonly login: (options: LoginOptions) => Promise<{ wire: Contract.OAuthCredentials; summary: Summary }>;\n\treadonly stored: () => Promise<Summary | undefined>;\n\treadonly refreshed: () => Promise<Summary | undefined>;\n\treadonly logout: () => Promise<void>;\n}\n\n/** Holds nothing: a server's credentials live on the server, not on this disk. */\nconst transient: OpenAICodexAuthStorage & GitHubCopilotAuthStorage = {\n\tget: async () => undefined,\n\tset: async () => {},\n\tclear: async () => {},\n};\n\nconst codexOps = (storage: OpenAICodexAuthStorage, path: string): Ops => {\n\tconst client = new OpenAICodexOAuthClient({ storage });\n\treturn {\n\t\tpath,\n\t\tlogin: async (options) => {\n\t\t\tconst credentials = await client.login({\n\t\t\t\tdevice: options.device,\n\t\t\t\tonAuth: (info) => announce(info, options.browser),\n\t\t\t\tonProgress: (message) => void process.stderr.write(`${message}\\n`),\n\t\t\t\tonPrompt: (prompt) => promptLine(prompt.message),\n\t\t\t});\n\t\t\treturn { wire: { provider: \"openai-codex\", ...credentials }, summary: summarizeOpenAICodex(credentials) };\n\t\t},\n\t\tstored: async () => {\n\t\t\tconst credentials = await storage.get();\n\t\t\treturn credentials && summarizeOpenAICodex(credentials);\n\t\t},\n\t\trefreshed: async () => {\n\t\t\tconst credentials = await client.getCredentials();\n\t\t\treturn credentials && summarizeOpenAICodex(credentials);\n\t\t},\n\t\tlogout: () => client.logout(),\n\t};\n};\n\nconst copilotOps = (storage: GitHubCopilotAuthStorage, path: string): Ops => {\n\tconst client = new GitHubCopilotOAuthClient({ storage });\n\tconst read = async () => {\n\t\tconst credentials = await storage.get();\n\t\treturn credentials && summarizeGitHubCopilot(credentials);\n\t};\n\treturn {\n\t\tpath,\n\t\tlogin: async (options) => {\n\t\t\tconst credentials = await client.login({\n\t\t\t\t...(Option.isSome(options.enterprise) && { enterpriseUrl: options.enterprise.value }),\n\t\t\t\tenableModels: options.enableModels,\n\t\t\t\tonAuth: (info) => announce(info, options.browser),\n\t\t\t\tonProgress: (message) => void process.stderr.write(`${message}\\n`),\n\t\t\t});\n\t\t\treturn { wire: { provider: \"github-copilot\", ...credentials }, summary: summarizeGitHubCopilot(credentials) };\n\t\t},\n\t\tstored: read,\n\t\t// GitHub OAuth tokens never expire, so there is nothing to refresh.\n\t\trefreshed: read,\n\t\tlogout: () => client.logout(),\n\t};\n};\n\nexport const makeOps = (provider: Provider, options: { path?: string | undefined; persist?: boolean } = {}): Ops => {\n\tconst file = options.path === undefined ? {} : { path: options.path };\n\tif (provider === \"openai-codex\") {\n\t\tconst storage = options.persist === false ? undefined : new JsonOpenAICodexAuthStorage(file);\n\t\treturn codexOps(storage ?? transient, storage?.path ?? \"\");\n\t}\n\tconst storage = options.persist === false ? undefined : new JsonGitHubCopilotAuthStorage(file);\n\treturn copilotOps(storage ?? transient, storage?.path ?? \"\");\n};\n\nexport const attempt = <A>(message: string, run: () => Promise<A>) =>\n\tEffect.tryPromise({ try: run, catch: (cause) => new OAuthError({ message, cause }) });\n\n/** The provider named by the two mutually exclusive flags. */\nexport const selectProvider = (flags: {\n\treadonly openaiCodex: boolean;\n\treadonly githubCopilot: boolean;\n}): Effect.Effect<Provider, InvalidInputError> => {\n\tconst checked = checkOAuthProvider(flags);\n\treturn checked.ok\n\t\t? Effect.succeed(checked.provider)\n\t\t: Effect.fail(new InvalidInputError({ message: checked.message }));\n};\n\n/** Reject the local-credential flags when the credentials live on a server. */\nexport const assertServerScope = (authFile: Option.Option<string>) =>\n\tEffect.gen(function* () {\n\t\tconst shared = yield* Cmd.spec;\n\t\tif (Option.isSome(authFile) || Option.isSome(shared.home)) {\n\t\t\treturn yield* new InvalidInputError({\n\t\t\t\tmessage: \"--auth-file and --home belong on codework serve when using --server\",\n\t\t\t});\n\t\t}\n\t});\n\n/** Credential operations against this machine's auth.json. */\nexport const localOps = (provider: Provider, authFile: Option.Option<string>) =>\n\tEffect.gen(function* () {\n\t\tconst shared = yield* Cmd.spec;\n\t\tconst path = yield* Path.Path;\n\t\tconst file = Option.isSome(authFile)\n\t\t\t? authFile.value\n\t\t\t: Option.isSome(shared.home)\n\t\t\t\t? path.join((yield* Global.resolve({ home: shared.home.value })).home, \"aikit\", \"auth.json\")\n\t\t\t\t: undefined;\n\t\treturn makeOps(provider, file === undefined ? {} : { path: file });\n\t});\n\n/** Run an effect against the RPC server at `url`, discharging the client. */\nexport const withServer = <A, E, R>(url: string, program: Effect.Effect<A, E, R>) =>\n\tprogram.pipe(Effect.provide(Client.layer(url)), Effect.scoped);\n\nexport { Client, oauthProviderLabel };\n"],"mappings":";;;;;;;;AAiCA,MAAM,YACL,MACA,YACU;CACV,QAAQ,OAAO,MACd,GAAG,KAAK,gBAAgB,2CAA2C,IAClE,KAAK,aAAa,KAAA,IAAY,KAAK,eAAe,KAAK,SAAS,MAC9D,KAAK,IAAI,GACb;CACA,IAAI,SACH,YAAiB,KAAK,MAAM,UAAU,KAAK,QAAQ,OAAO,MAAM,2BAA2B,MAAM,QAAQ,GAAG,CAAC;AAE/G;;AAkBA,MAAM,YAA+D;CACpE,KAAK,YAAY,KAAA;CACjB,KAAK,YAAY,CAAC;CAClB,OAAO,YAAY,CAAC;AACrB;AAEA,MAAM,YAAY,SAAiC,SAAsB;CACxE,MAAM,SAAS,IAAI,uBAAuB,EAAE,QAAQ,CAAC;CACrD,OAAO;EACN;EACA,OAAO,OAAO,YAAY;GACzB,MAAM,cAAc,MAAM,OAAO,MAAM;IACtC,QAAQ,QAAQ;IAChB,SAAS,SAAS,SAAS,MAAM,QAAQ,OAAO;IAChD,aAAa,YAAY,KAAK,QAAQ,OAAO,MAAM,GAAG,QAAQ,GAAG;IACjE,WAAW,WAAW,WAAW,OAAO,OAAO;GAChD,CAAC;GACD,OAAO;IAAE,MAAM;KAAE,UAAU;KAAgB,GAAG;IAAY;IAAG,SAAS,qBAAqB,WAAW;GAAE;EACzG;EACA,QAAQ,YAAY;GACnB,MAAM,cAAc,MAAM,QAAQ,IAAI;GACtC,OAAO,eAAe,qBAAqB,WAAW;EACvD;EACA,WAAW,YAAY;GACtB,MAAM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AM,CAAC;AAAE,CAAC;;AAGrF,MAAa,kBAAkB,UAGmB;CACjD,MAAM,UAAU,mBAAmB,KAAK;CACxC,OAAO,QAAQ,KACZ,OAAO,QAAQ,QAAQ,QAAQ,IAC/B,OAAO,KAAK,IAAI,kBAAkB,EAAE,SAAS,QAAQ,QAAQ,CAAC,CAAC;AACnE;;AAGA,MAAa,qBAAqB,aACjC,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,IAAI;CAC1B,IAAI,OAAO,OAAO,QAAQ,KAAK,OAAO,OAAO,OAAO,IAAI,GACvD,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,sEACV,CAAC;AAEH,CAAC;;AAGF,MAAa,YAAY,UAAoB,aAC5C,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,IAAI;CAC1B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,OAAO,OAAO,OAAO,QAAQ,IAChC,SAAS,QACT,OAAO,OAAO,OAAO,IAAI,IACxB,KAAK,MAAM,OAAOA,QAAe,EAAE,MAAM,OAAO,KAAK,MAAM,CAAC,EAAA,CAAG,MAAM,SAAS,WAAW,IACzF,KAAA;CACJ,OAAO,QAAQ,UAAU,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC;AAClE,CAAC;;AAGF,MAAa,cAAuB,KAAa,YAChD,QAAQ,KAAK,OAAO,QAAQC,MAAa,GAAG,CAAC,GAAG,OAAO,MAAM"}
1
+ {"version":3,"file":"shared-BaTfajJ2.mjs","names":["Global.resolve","Client.layer"],"sources":["../../src/cli/cmd/handlers/auth/shared.ts"],"sourcesContent":["/* @effect-diagnostics nodeBuiltinImport:off -- OAuth login opens the system browser. */\n/* @effect-diagnostics globalDate:off -- Stored expiry timestamps are rendered for the user. */\n/* oxlint-disable effecttsgo/async-function -- Aikit OAuth callbacks require Promise-returning functions. */\nimport {\n\tGitHubCopilotOAuthClient,\n\tJsonGitHubCopilotAuthStorage,\n\ttype GitHubCopilotAuthStorage,\n} from \"@codeworksh/aikit/oauth/github/copilot\";\nimport {\n\tJsonOpenAICodexAuthStorage,\n\tOpenAICodexOAuthClient,\n\ttype OpenAICodexAuthStorage,\n} from \"@codeworksh/aikit/oauth/openai/codex\";\nimport { openBrowser, promptLine } from \"@codeworksh/aikit/oauth/interactive\";\nimport {\n\tcheckOAuthProvider,\n\toauthProviderLabel,\n\tsummarizeGitHubCopilot,\n\tsummarizeOpenAICodex,\n\ttype OAuthSummary,\n} from \"@codeworksh/aikit/oauth/summary\";\nimport { Global } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport { Client } from \"../../../../server/client.ts\";\nimport type { Contract } from \"../../../../server/contract.ts\";\nimport { InvalidInputError, OAuthError } from \"../../../error.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport type Provider = Contract.OAuthProvider;\n\n// The wire shape and aikit's summary are the same record.\nexport type Summary = Contract.OAuthInfo & OAuthSummary;\n\nconst announce = (\n\tinfo: { url: string; userCode?: string | undefined; instructions?: string | undefined },\n\tbrowser: boolean,\n): void => {\n\tprocess.stderr.write(\n\t\t`${info.instructions ?? \"Complete authentication in your browser.\"}\\n${\n\t\t\tinfo.userCode === undefined ? \"\" : `Enter code: ${info.userCode}\\n`\n\t\t}${info.url}\\n`,\n\t);\n\tif (browser) {\n\t\tvoid openBrowser(info.url, (error) => void process.stderr.write(`Failed to open browser: ${error.message}\\n`));\n\t}\n};\n\nexport interface LoginOptions {\n\treadonly browser: boolean;\n\treadonly device: boolean;\n\treadonly enterprise: Option.Option<string>;\n\treadonly enableModels: boolean;\n}\n\nexport interface Ops {\n\treadonly path: string;\n\treadonly login: (options: LoginOptions) => Promise<{ wire: Contract.OAuthCredentials; summary: Summary }>;\n\treadonly stored: () => Promise<Summary | undefined>;\n\treadonly refreshed: () => Promise<Summary | undefined>;\n\treadonly logout: () => Promise<void>;\n}\n\n/** Holds nothing: a server's credentials live on the server, not on this disk. */\nconst transient: OpenAICodexAuthStorage & GitHubCopilotAuthStorage = {\n\tget: async () => undefined,\n\tset: async () => {},\n\tclear: async () => {},\n};\n\nconst codexOps = (storage: OpenAICodexAuthStorage, path: string): Ops => {\n\tconst client = new OpenAICodexOAuthClient({ storage });\n\treturn {\n\t\tpath,\n\t\tlogin: async (options) => {\n\t\t\tconst credentials = await client.login({\n\t\t\t\tdevice: options.device,\n\t\t\t\tonAuth: (info) => announce(info, options.browser),\n\t\t\t\tonProgress: (message) => void process.stderr.write(`${message}\\n`),\n\t\t\t\tonPrompt: (prompt) => promptLine(prompt.message),\n\t\t\t});\n\t\t\treturn { wire: { provider: \"openai-codex\", ...credentials }, summary: summarizeOpenAICodex(credentials) };\n\t\t},\n\t\tstored: async () => {\n\t\t\tconst credentials = await storage.get();\n\t\t\treturn credentials && summarizeOpenAICodex(credentials);\n\t\t},\n\t\trefreshed: async () => {\n\t\t\tconst credentials = await client.getCredentials();\n\t\t\treturn credentials && summarizeOpenAICodex(credentials);\n\t\t},\n\t\tlogout: () => client.logout(),\n\t};\n};\n\nconst copilotOps = (storage: GitHubCopilotAuthStorage, path: string): Ops => {\n\tconst client = new GitHubCopilotOAuthClient({ storage });\n\tconst read = async () => {\n\t\tconst credentials = await storage.get();\n\t\treturn credentials && summarizeGitHubCopilot(credentials);\n\t};\n\treturn {\n\t\tpath,\n\t\tlogin: async (options) => {\n\t\t\tconst credentials = await client.login({\n\t\t\t\t...(Option.isSome(options.enterprise) && { enterpriseUrl: options.enterprise.value }),\n\t\t\t\tenableModels: options.enableModels,\n\t\t\t\tonAuth: (info) => announce(info, options.browser),\n\t\t\t\tonProgress: (message) => void process.stderr.write(`${message}\\n`),\n\t\t\t});\n\t\t\treturn { wire: { provider: \"github-copilot\", ...credentials }, summary: summarizeGitHubCopilot(credentials) };\n\t\t},\n\t\tstored: read,\n\t\t// GitHub OAuth tokens never expire, so there is nothing to refresh.\n\t\trefreshed: read,\n\t\tlogout: () => client.logout(),\n\t};\n};\n\nexport const makeOps = (provider: Provider, options: { path?: string | undefined; persist?: boolean } = {}): Ops => {\n\tconst file = options.path === undefined ? {} : { path: options.path };\n\tif (provider === \"openai-codex\") {\n\t\tconst storage = options.persist === false ? undefined : new JsonOpenAICodexAuthStorage(file);\n\t\treturn codexOps(storage ?? transient, storage?.path ?? \"\");\n\t}\n\tconst storage = options.persist === false ? undefined : new JsonGitHubCopilotAuthStorage(file);\n\treturn copilotOps(storage ?? transient, storage?.path ?? \"\");\n};\n\nexport const attempt = <A>(message: string, run: () => Promise<A>) =>\n\tEffect.tryPromise({ try: run, catch: (cause) => new OAuthError({ message, cause }) });\n\n/** The provider named by the two mutually exclusive flags. */\nexport const selectProvider = (flags: {\n\treadonly openaiCodex: boolean;\n\treadonly githubCopilot: boolean;\n}): Effect.Effect<Provider, InvalidInputError> => {\n\tconst checked = checkOAuthProvider(flags);\n\treturn checked.ok\n\t\t? Effect.succeed(checked.provider)\n\t\t: Effect.fail(new InvalidInputError({ message: checked.message }));\n};\n\n/** Reject the local-credential flags when the credentials live on a server. */\nexport const assertServerScope = (authFile: Option.Option<string>) =>\n\tEffect.gen(function* () {\n\t\tconst shared = yield* Cmd.spec;\n\t\tif (Option.isSome(authFile) || Option.isSome(shared.home)) {\n\t\t\treturn yield* new InvalidInputError({\n\t\t\t\tmessage: \"--auth-file and --home belong on codework serve when using --server\",\n\t\t\t});\n\t\t}\n\t});\n\n/** Credential operations against this machine's auth.json. */\nexport const localOps = (provider: Provider, authFile: Option.Option<string>) =>\n\tEffect.gen(function* () {\n\t\tconst shared = yield* Cmd.spec;\n\t\tconst path = yield* Path.Path;\n\t\tconst file = Option.isSome(authFile)\n\t\t\t? authFile.value\n\t\t\t: Option.isSome(shared.home)\n\t\t\t\t? path.join((yield* Global.resolve({ home: shared.home.value })).home, \"aikit\", \"auth.json\")\n\t\t\t\t: undefined;\n\t\treturn makeOps(provider, file === undefined ? {} : { path: file });\n\t});\n\n/** Run an effect against the RPC server at `url`, discharging the client. */\nexport const withServer = <A, E, R>(url: string, program: Effect.Effect<A, E, R>) =>\n\tprogram.pipe(Effect.provide(Client.layer(url)), Effect.scoped);\n\nexport { Client, oauthProviderLabel };\n"],"mappings":";;;;;;;;AAiCA,MAAM,YACL,MACA,YACU;CACV,QAAQ,OAAO,MACd,GAAG,KAAK,gBAAgB,2CAA2C,IAClE,KAAK,aAAa,KAAA,IAAY,KAAK,eAAe,KAAK,SAAS,MAC9D,KAAK,IAAI,GACb;CACA,IAAI,SACH,YAAiB,KAAK,MAAM,UAAU,KAAK,QAAQ,OAAO,MAAM,2BAA2B,MAAM,QAAQ,GAAG,CAAC;AAE/G;;AAkBA,MAAM,YAA+D;CACpE,KAAK,YAAY,KAAA;CACjB,KAAK,YAAY,CAAC;CAClB,OAAO,YAAY,CAAC;AACrB;AAEA,MAAM,YAAY,SAAiC,SAAsB;CACxE,MAAM,SAAS,IAAI,uBAAuB,EAAE,QAAQ,CAAC;CACrD,OAAO;EACN;EACA,OAAO,OAAO,YAAY;GACzB,MAAM,cAAc,MAAM,OAAO,MAAM;IACtC,QAAQ,QAAQ;IAChB,SAAS,SAAS,SAAS,MAAM,QAAQ,OAAO;IAChD,aAAa,YAAY,KAAK,QAAQ,OAAO,MAAM,GAAG,QAAQ,GAAG;IACjE,WAAW,WAAW,WAAW,OAAO,OAAO;GAChD,CAAC;GACD,OAAO;IAAE,MAAM;KAAE,UAAU;KAAgB,GAAG;IAAY;IAAG,SAAS,qBAAqB,WAAW;GAAE;EACzG;EACA,QAAQ,YAAY;GACnB,MAAM,cAAc,MAAM,QAAQ,IAAI;GACtC,OAAO,eAAe,qBAAqB,WAAW;EACvD;EACA,WAAW,YAAY;GACtB,MAAM,cAAc,MAAM,OAAO,eAAe;GAChD,OAAO,eAAe,qBAAqB,WAAW;EACvD;EACA,cAAc,OAAO,OAAO;CAC7B;AACD;AAEA,MAAM,cAAc,SAAmC,SAAsB;CAC5E,MAAM,SAAS,IAAI,yBAAyB,EAAE,QAAQ,CAAC;CACvD,MAAM,OAAO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C,CAAC;AACnE;;AAGA,MAAa,qBAAqB,aACjC,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,IAAI;CAC1B,IAAI,OAAO,OAAO,QAAQ,KAAK,OAAO,OAAO,OAAO,IAAI,GACvD,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,sEACV,CAAC;AAEH,CAAC;;AAGF,MAAa,YAAY,UAAoB,aAC5C,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,IAAI;CAC1B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,OAAO,OAAO,OAAO,QAAQ,IAChC,SAAS,QACT,OAAO,OAAO,OAAO,IAAI,IACxB,KAAK,MAAM,OAAOA,QAAe,EAAE,MAAM,OAAO,KAAK,MAAM,CAAC,EAAA,CAAG,MAAM,SAAS,WAAW,IACzF,KAAA;CACJ,OAAO,QAAQ,UAAU,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC;AAClE,CAAC;;AAGF,MAAa,cAAuB,KAAa,YAChD,QAAQ,KAAK,OAAO,QAAQC,MAAa,GAAG,CAAC,GAAG,OAAO,MAAM"}
@@ -1,6 +1,6 @@
1
- import { a as reportFailure, f as writeOut, m as make, r as OAuthError } from "./error-BrbT9_4g.mjs";
2
- import { i as Cmd, t as handler } from "./runtime-Dl621FOp.mjs";
3
- import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-Uwjcofff.mjs";
1
+ import { d as writeOut, i as reportFailure, n as OAuthError, p as make } from "./error-D0C5K2Av.mjs";
2
+ import { i as Cmd, t as handler } from "./runtime-B3dlWGfs.mjs";
3
+ import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-BaTfajJ2.mjs";
4
4
  import { Effect, Option } from "effect";
5
5
  import { formatOAuthSummary, oauthNotice } from "@codeworksh/aikit/oauth/summary";
6
6
  //#region src/cli/cmd/handlers/auth/status.ts
@@ -28,4 +28,4 @@ var status_default = handler(Cmd.commands.auth.commands.status, Effect.fn("CLI.a
28
28
  //#endregion
29
29
  export { status_default as default };
30
30
 
31
- //# sourceMappingURL=status-DPYq2Sx4.mjs.map
31
+ //# sourceMappingURL=status-qJImmv6V.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"status-DPYq2Sx4.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/status.ts"],"sourcesContent":["import { formatOAuthSummary, oauthNotice } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { OAuthError, reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport {\n\tassertServerScope,\n\tattempt,\n\tClient,\n\tlocalOps,\n\toauthProviderLabel,\n\tselectProvider,\n\twithServer,\n} from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.auth.commands.status,\n\tEffect.fn(\"CLI.auth.status\")(function* ({ server, openaiCodex, githubCopilot, authFile, json }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst provider = yield* selectProvider({ openaiCodex, githubCopilot });\n\t\t\tconst name = oauthProviderLabel(provider);\n\n\t\t\tif (Option.isSome(server)) {\n\t\t\t\tyield* assertServerScope(authFile);\n\t\t\t\treturn yield* withServer(\n\t\t\t\t\tserver.value,\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst rpc = yield* Client.make;\n\t\t\t\t\t\tconst info = yield* rpc[\"auth.status\"]({ provider });\n\t\t\t\t\t\tif (info === null) {\n\t\t\t\t\t\t\treturn yield* new OAuthError({ message: oauthNotice(\"missing\", provider, \"the server\") });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tyield* writeOut(formatOAuthSummary(info, { json }));\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst ops = yield* localOps(provider, authFile);\n\t\t\tconst summary = yield* attempt(`failed to read ${name} credentials`, () => ops.stored());\n\t\t\tif (summary === undefined) {\n\t\t\t\treturn yield* new OAuthError({ message: oauthNotice(\"missing\", provider, ops.path) });\n\t\t\t}\n\t\t\tyield* writeOut(formatOAuthSummary(summary, { json }));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAgBA,IAAA,iBAAeA,QACd,IAAI,SAAS,KAAK,SAAS,QAC3B,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,QAAQ,aAAa,eAAe,UAAU,QAAQ;CA4B/F,OAAO,OA3BS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,eAAe;GAAE;GAAa;EAAc,CAAC;EACrE,MAAM,OAAO,mBAAmB,QAAQ;EAExC,IAAI,OAAO,OAAO,MAAM,GAAG;GAC1B,OAAO,kBAAkB,QAAQ;GACjC,OAAO,OAAO,WACb,OAAO,OACP,OAAO,IAAI,aAAa;IAEvB,MAAM,OAAO,QAAO,OADDC,KAAAA,CACK,cAAc,CAAC,EAAE,SAAS,CAAC;IACnD,IAAI,SAAS,MACZ,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,YAAY,EAAE,CAAC;IAEzF,OAAO,SAAS,mBAAmB,MAAM,EAAE,KAAK,CAAC,CAAC;GACnD,CAAC,CACF;EACD;EAEA,MAAM,MAAM,OAAO,SAAS,UAAU,QAAQ;EAC9C,MAAM,UAAU,OAAO,QAAQ,kBAAkB,KAAK,qBAAqB,IAAI,OAAO,CAAC;EACvF,IAAI,YAAY,KAAA,GACf,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,IAAI,IAAI,EAAE,CAAC;EAErF,OAAO,SAAS,mBAAmB,SAAS,EAAE,KAAK,CAAC,CAAC;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
1
+ {"version":3,"file":"status-qJImmv6V.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/status.ts"],"sourcesContent":["import { formatOAuthSummary, oauthNotice } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { OAuthError, reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport {\n\tassertServerScope,\n\tattempt,\n\tClient,\n\tlocalOps,\n\toauthProviderLabel,\n\tselectProvider,\n\twithServer,\n} from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.auth.commands.status,\n\tEffect.fn(\"CLI.auth.status\")(function* ({ server, openaiCodex, githubCopilot, authFile, json }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst provider = yield* selectProvider({ openaiCodex, githubCopilot });\n\t\t\tconst name = oauthProviderLabel(provider);\n\n\t\t\tif (Option.isSome(server)) {\n\t\t\t\tyield* assertServerScope(authFile);\n\t\t\t\treturn yield* withServer(\n\t\t\t\t\tserver.value,\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst rpc = yield* Client.make;\n\t\t\t\t\t\tconst info = yield* rpc[\"auth.status\"]({ provider });\n\t\t\t\t\t\tif (info === null) {\n\t\t\t\t\t\t\treturn yield* new OAuthError({ message: oauthNotice(\"missing\", provider, \"the server\") });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tyield* writeOut(formatOAuthSummary(info, { json }));\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst ops = yield* localOps(provider, authFile);\n\t\t\tconst summary = yield* attempt(`failed to read ${name} credentials`, () => ops.stored());\n\t\t\tif (summary === undefined) {\n\t\t\t\treturn yield* new OAuthError({ message: oauthNotice(\"missing\", provider, ops.path) });\n\t\t\t}\n\t\t\tyield* writeOut(formatOAuthSummary(summary, { json }));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAgBA,IAAA,iBAAeA,QACd,IAAI,SAAS,KAAK,SAAS,QAC3B,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,QAAQ,aAAa,eAAe,UAAU,QAAQ;CA4B/F,OAAO,OA3BS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,eAAe;GAAE;GAAa;EAAc,CAAC;EACrE,MAAM,OAAO,mBAAmB,QAAQ;EAExC,IAAI,OAAO,OAAO,MAAM,GAAG;GAC1B,OAAO,kBAAkB,QAAQ;GACjC,OAAO,OAAO,WACb,OAAO,OACP,OAAO,IAAI,aAAa;IAEvB,MAAM,OAAO,QAAO,OADDC,KAAAA,CACK,cAAc,CAAC,EAAE,SAAS,CAAC;IACnD,IAAI,SAAS,MACZ,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,YAAY,EAAE,CAAC;IAEzF,OAAO,SAAS,mBAAmB,MAAM,EAAE,KAAK,CAAC,CAAC;GACnD,CAAC,CACF;EACD;EAEA,MAAM,MAAM,OAAO,SAAS,UAAU,QAAQ;EAC9C,MAAM,UAAU,OAAO,QAAQ,kBAAkB,KAAK,qBAAqB,IAAI,OAAO,CAAC;EACvF,IAAI,YAAY,KAAA,GACf,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,IAAI,IAAI,EAAE,CAAC;EAErF,OAAO,SAAS,mBAAmB,SAAS,EAAE,KAAK,CAAC,CAAC;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
@@ -1,7 +1,7 @@
1
- import { W as update, a as reportFailure, f as writeOut, z as definition } 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
- import { Effect } from "effect";
1
+ import { B as definition, d as writeOut, i as reportFailure, q as update } from "./error-D0C5K2Av.mjs";
2
+ import { i as Cmd, t as handler } from "./runtime-B3dlWGfs.mjs";
3
+ import { a as targeted, i as read, n as local, r as probe, t as fetchable } from "./entries-CSY5N6jH.mjs";
4
+ import { Effect, Option } from "effect";
5
5
  //#region src/cli/cmd/handlers/plugin/update.ts
6
6
  /**
7
7
  * Take whatever `check` found.
@@ -10,15 +10,20 @@ import { Effect } from "effect";
10
10
  * `plugin install` is the verb for that. Each refresh publishes a new generation, which a running
11
11
  * session picks up at its next exchange -- so this command never has to reach into a server.
12
12
  */
13
- var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI.plugin.update")(function* () {
13
+ var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI.plugin.update")(function* ({ spec }) {
14
14
  return yield* Effect.gen(function* () {
15
15
  const shared = yield* Cmd.spec;
16
- const { entries, cache } = yield* read(shared);
16
+ const { entries, cache, hostDir } = yield* read(shared);
17
+ const selected = yield* targeted(entries, spec, hostDir);
18
+ if (selected.length === 0 && Option.isSome(spec)) return;
17
19
  let updated = 0;
18
20
  let failed = 0;
19
- for (const entry of entries) {
21
+ for (const entry of selected) {
20
22
  const target = fetchable(entry.target);
21
- if (target === void 0) continue;
23
+ if (target === void 0) {
24
+ yield* local(entry, spec);
25
+ continue;
26
+ }
22
27
  const result = yield* update(target, cache, {
23
28
  probe: probe(cache, entry.from),
24
29
  from: entry.from,
@@ -34,6 +39,7 @@ var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI
34
39
  yield* writeOut(`Updated ${entry.reference} to ${result.success.entry.revision ?? "a new revision"}\n`);
35
40
  }
36
41
  }
42
+ if (Option.isSome(spec) && selected.every((entry) => fetchable(entry.target) === void 0)) return;
37
43
  yield* writeOut(updated === 0 ? "Nothing to update.\n" : `${updated} updated.\n`);
38
44
  if (failed > 0) process.exitCode = 1;
39
45
  }).pipe(Effect.catch(reportFailure));
@@ -41,4 +47,4 @@ var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI
41
47
  //#endregion
42
48
  export { update_default as default };
43
49
 
44
- //# sourceMappingURL=update-CJrBbHwq.mjs.map
50
+ //# sourceMappingURL=update-CxcNv_t0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-CxcNv_t0.mjs","names":["Runtime.handler","Plugin.update","Plugin.definition"],"sources":["../../src/cli/cmd/handlers/plugin/update.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } 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, local, probe, read, targeted } from \"./entries.ts\";\n\n/**\n * Take whatever `check` found.\n *\n * Only a plugin that is **already installed** is refreshed: \"not installed\" is not \"outdated\", and\n * `plugin install` is the verb for that. Each refresh publishes a new generation, which a running\n * session picks up at its next exchange -- so this command never has to reach into a server.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.update,\n\tEffect.fn(\"CLI.plugin.update\")(function* ({ spec }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache, hostDir } = yield* read(shared);\n\t\t\tconst selected = yield* targeted(entries, spec, hostDir);\n\t\t\tif (selected.length === 0 && Option.isSome(spec)) return;\n\n\t\t\tlet updated = 0;\n\t\t\tlet failed = 0;\n\t\t\tfor (const entry of selected) {\n\t\t\t\tconst target = fetchable(entry.target);\n\t\t\t\t// A local plugin has no revision to compare and is never copied into the store.\n\t\t\t\tif (target === undefined) {\n\t\t\t\t\tyield* local(entry, spec);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst result = yield* Plugin.update(target, cache, {\n\t\t\t\t\tprobe: probe(cache, entry.from),\n\t\t\t\t\tfrom: entry.from,\n\t\t\t\t\t// Validated while staged, so a refresh that fetches something broken leaves\n\t\t\t\t\t// the generation already in use as the answer. Preserve the loader's reason:\n\t\t\t\t\t// an import failure or invalid definition is not a missing entrypoint.\n\t\t\t\t\tvalidate: (fetched) => Plugin.definition(fetched.entrypoint, entry.reference).pipe(Effect.asVoid),\n\t\t\t\t}).pipe(Effect.result);\n\n\t\t\t\tif (result._tag === \"Failure\") {\n\t\t\t\t\tfailed += 1;\n\t\t\t\t\tyield* writeOut(`${entry.reference} error[${result.failure.reason}]: ${result.failure.message}\\n`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (result.success._tag === \"updated\") {\n\t\t\t\t\tupdated += 1;\n\t\t\t\t\tyield* writeOut(`Updated ${entry.reference} to ${result.success.entry.revision ?? \"a new revision\"}\\n`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// A spec that named only local plugins compared nothing, so there is nothing to sum up.\n\t\t\tif (Option.isSome(spec) && selected.every((entry) => fetchable(entry.target) === undefined)) return;\n\t\t\tyield* writeOut(updated === 0 ? \"Nothing to update.\\n\" : `${updated} updated.\\n`);\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,iBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,QAC7B,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,EAAE,QAAQ;CA2CnD,OAAO,OA1CS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,EAAE,SAAS,OAAO,YAAY,OAAO,KAAK,MAAM;EACtD,MAAM,WAAW,OAAO,SAAS,SAAS,MAAM,OAAO;EACvD,IAAI,SAAS,WAAW,KAAK,OAAO,OAAO,IAAI,GAAG;EAElD,IAAI,UAAU;EACd,IAAI,SAAS;EACb,KAAK,MAAM,SAAS,UAAU;GAC7B,MAAM,SAAS,UAAU,MAAM,MAAM;GAErC,IAAI,WAAW,KAAA,GAAW;IACzB,OAAO,MAAM,OAAO,IAAI;IACxB;GACD;GAEA,MAAM,SAAS,OAAOC,OAAc,QAAQ,OAAO;IAClD,OAAO,MAAM,OAAO,MAAM,IAAI;IAC9B,MAAM,MAAM;IAIZ,WAAW,YAAYC,WAAkB,QAAQ,YAAY,MAAM,SAAS,CAAC,CAAC,KAAK,OAAO,MAAM;GACjG,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM;GAErB,IAAI,OAAO,SAAS,WAAW;IAC9B,UAAU;IACV,OAAO,SAAS,GAAG,MAAM,UAAU,UAAU,OAAO,QAAQ,OAAO,KAAK,OAAO,QAAQ,QAAQ,GAAG;IAClG;GACD;GACA,IAAI,OAAO,QAAQ,SAAS,WAAW;IACtC,WAAW;IACX,OAAO,SAAS,WAAW,MAAM,UAAU,MAAM,OAAO,QAAQ,MAAM,YAAY,iBAAiB,GAAG;GACvG;EACD;EAGA,IAAI,OAAO,OAAO,IAAI,KAAK,SAAS,OAAO,UAAU,UAAU,MAAM,MAAM,MAAM,KAAA,CAAS,GAAG;EAC7F,OAAO,SAAS,YAAY,IAAI,yBAAyB,GAAG,QAAQ,YAAY;EAChF,IAAI,SAAS,GAAG,QAAQ,WAAW;CACpC,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
@@ -1,31 +0,0 @@
1
- import { et as ModelCatalogError } from "./error-BrbT9_4g.mjs";
2
- import { Effect } from "effect";
3
- import { Model } from "@codeworksh/aikit";
4
- //#region src/cli/cmd/handlers/models/catalog.ts
5
- const catalogError = (cause) => {
6
- if (typeof cause === "object" && cause !== null && "name" in cause && cause.name === "ModelCatalogLoadError" && "data" in cause && typeof cause.data === "object" && cause.data !== null) {
7
- const data = cause.data;
8
- if ("path" in data && typeof data.path === "string" && "message" in data && typeof data.message === "string" && "reason" in data && (data.reason === "missing" || data.reason === "unreadable" || data.reason === "empty" || data.reason === "invalid")) return new ModelCatalogError({
9
- path: data.path,
10
- reason: data.reason,
11
- detail: data.message
12
- });
13
- }
14
- return new ModelCatalogError({
15
- path: "",
16
- reason: "unreadable",
17
- detail: cause instanceof Error ? cause.message : "failed to load the model catalog"
18
- });
19
- };
20
- const loadCatalog = Effect.tryPromise({
21
- try: () => Model.getBuiltInModels(),
22
- catch: catalogError
23
- });
24
- const loadProviders = Effect.tryPromise({
25
- try: () => Model.getProviders(),
26
- catch: catalogError
27
- });
28
- //#endregion
29
- export { loadProviders as n, loadCatalog as t };
30
-
31
- //# sourceMappingURL=catalog-DJxy_lne.mjs.map
@@ -1 +0,0 @@
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 +0,0 @@
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,160 +0,0 @@
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
- //#region ../../node_modules/.pnpm/@npmcli+name-from-folder@5.0.0/node_modules/@npmcli/name-from-folder/lib/index.js
4
- var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- const { basename, dirname } = __require("path");
6
- const getName = (parent, base) => parent.charAt(0) === "@" ? `${parent}/${base}` : base;
7
- module.exports = (dir) => dir ? getName(basename(dirname(dir)), basename(dir)) : false;
8
- }));
9
- //#endregion
10
- //#region ../../node_modules/.pnpm/@npmcli+map-workspaces@6.0.0/node_modules/@npmcli/map-workspaces/lib/index.js
11
- var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12
- const path = __require("path");
13
- const getName = require_lib$1();
14
- const { minimatch } = require_commonjs$1();
15
- const pkgJson = require_lib$2();
16
- const { glob } = require_index_min();
17
- function appendNegatedPatterns(allPatterns) {
18
- const patterns = [];
19
- const negatedPatterns = [];
20
- for (let pattern of allPatterns) {
21
- const excl = pattern.match(/^!+/);
22
- if (excl) pattern = pattern.slice(excl[0].length);
23
- pattern = pattern.replace(/^\.?\/+/, "");
24
- if (excl && excl[0].length % 2 === 1) negatedPatterns.push(pattern);
25
- else {
26
- for (let i = 0; i < negatedPatterns.length; ++i) {
27
- const negatedPattern = negatedPatterns[i];
28
- if (minimatch(pattern, negatedPattern)) negatedPatterns.splice(i, 1);
29
- }
30
- patterns.push(pattern);
31
- }
32
- }
33
- for (const negated of negatedPatterns) for (const pattern of minimatch.match(patterns, negated)) patterns.splice(patterns.indexOf(pattern), 1);
34
- return {
35
- patterns,
36
- negatedPatterns
37
- };
38
- }
39
- function getPatterns(workspaces) {
40
- const workspacesDeclaration = Array.isArray(workspaces.packages) ? workspaces.packages : workspaces;
41
- if (!Array.isArray(workspacesDeclaration)) throw getError({
42
- message: "workspaces config expects an Array",
43
- code: "EWORKSPACESCONFIG"
44
- });
45
- return appendNegatedPatterns(workspacesDeclaration);
46
- }
47
- function getPackageName(pkg, pathname) {
48
- return pkg.name || getName(pathname);
49
- }
50
- function getGlobPattern(pattern) {
51
- pattern = pattern.replace(/\\/g, "/");
52
- return pattern.endsWith("/") ? pattern : `${pattern}/`;
53
- }
54
- function getError({ Type = TypeError, message, code }) {
55
- return Object.assign(new Type(message), { code });
56
- }
57
- function reverseResultMap(map) {
58
- return new Map(Array.from(map, (item) => item.reverse()));
59
- }
60
- async function mapWorkspaces(opts = {}) {
61
- if (!opts || !opts.pkg) throw getError({
62
- message: "mapWorkspaces missing pkg info",
63
- code: "EMAPWORKSPACESPKG"
64
- });
65
- if (!opts.cwd) opts.cwd = process.cwd();
66
- const { workspaces = [] } = opts.pkg;
67
- const { patterns, negatedPatterns } = getPatterns(workspaces);
68
- const results = /* @__PURE__ */ new Map();
69
- if (!patterns.length && !negatedPatterns.length) return results;
70
- const seen = /* @__PURE__ */ new Map();
71
- const getGlobOpts = () => ({
72
- ...opts,
73
- ignore: [
74
- ...opts.ignore || [],
75
- "**/node_modules/**",
76
- ...negatedPatterns
77
- ]
78
- });
79
- let matches = await glob(patterns.map((p) => getGlobPattern(p)), getGlobOpts());
80
- matches = matches.sort((a, b) => a.localeCompare(b, "en"));
81
- const orderedMatches = [];
82
- for (const pattern of patterns) orderedMatches.push(...matches.filter((m) => {
83
- return minimatch(m, pattern, {
84
- partial: true,
85
- windowsPathsNoEscape: true
86
- });
87
- }));
88
- for (const match of orderedMatches) {
89
- let pkg;
90
- try {
91
- pkg = await pkgJson.normalize(path.join(opts.cwd, match));
92
- } catch (err) {
93
- if (err.code === "ENOENT" || err.code === "ENOTDIR") continue;
94
- else throw err;
95
- }
96
- const name = getPackageName(pkg.content, pkg.path);
97
- let seenPackagePathnames = seen.get(name);
98
- if (!seenPackagePathnames) {
99
- seenPackagePathnames = /* @__PURE__ */ new Set();
100
- seen.set(name, seenPackagePathnames);
101
- }
102
- seenPackagePathnames.add(pkg.path);
103
- }
104
- const errorMessageArray = ["must not have multiple workspaces with the same name"];
105
- for (const [packageName, seenPackagePathnames] of seen) if (seenPackagePathnames.size > 1) addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames);
106
- else results.set(packageName, seenPackagePathnames.values().next().value);
107
- if (errorMessageArray.length > 1) throw getError({
108
- Type: Error,
109
- message: errorMessageArray.join("\n"),
110
- code: "EDUPLICATEWORKSPACE"
111
- });
112
- return results;
113
- }
114
- function addDuplicateErrorMessages(messageArray, packageName, packagePathnames) {
115
- messageArray.push(`package '${packageName}' has conflicts in the following paths:`);
116
- for (const packagePathname of packagePathnames) messageArray.push(" " + packagePathname);
117
- }
118
- mapWorkspaces.virtual = function(opts = {}) {
119
- if (!opts || !opts.lockfile) throw getError({
120
- message: "mapWorkspaces.virtual missing lockfile info",
121
- code: "EMAPWORKSPACESLOCKFILE"
122
- });
123
- if (!opts.cwd) opts.cwd = process.cwd();
124
- const { packages = {} } = opts.lockfile;
125
- const { workspaces = [] } = packages[""] || {};
126
- const results = /* @__PURE__ */ new Map();
127
- const { patterns, negatedPatterns } = getPatterns(workspaces);
128
- if (!patterns.length && !negatedPatterns.length) return results;
129
- negatedPatterns.push("**/node_modules/**");
130
- const packageKeys = Object.keys(packages);
131
- for (const pattern of negatedPatterns) for (const packageKey of minimatch.match(packageKeys, pattern)) packageKeys.splice(packageKeys.indexOf(packageKey), 1);
132
- for (const pattern of patterns) for (const packageKey of minimatch.match(packageKeys, pattern)) {
133
- const packagePathname = path.join(opts.cwd, packageKey);
134
- const name = getPackageName(packages[packageKey], packagePathname);
135
- results.set(packagePathname, name);
136
- }
137
- return reverseResultMap(results);
138
- };
139
- module.exports = mapWorkspaces;
140
- }));
141
- //#endregion
142
- //#region ../../node_modules/.pnpm/walk-up-path@4.0.0/node_modules/walk-up-path/dist/commonjs/index.js
143
- var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
144
- Object.defineProperty(exports, "__esModule", { value: true });
145
- exports.walkUp = void 0;
146
- const path_1 = __require("path");
147
- const walkUp = function* (path) {
148
- for (path = (0, path_1.resolve)(path); path;) {
149
- yield path;
150
- const pp = (0, path_1.dirname)(path);
151
- if (pp === path) break;
152
- else path = pp;
153
- }
154
- };
155
- exports.walkUp = walkUp;
156
- }));
157
- //#endregion
158
- export { require_lib as n, require_lib$1 as r, require_commonjs as t };
159
-
160
- //# sourceMappingURL=commonjs-BDiLMfFF.mjs.map
@@ -1 +0,0 @@
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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