@skaile/workspaces 6.8.0 → 6.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{asset-feeds-NU5UOO5F.js → asset-feeds-R75MH2WW.js} +6 -6
  3. package/dist/{asset-feeds-NU5UOO5F.js.map → asset-feeds-R75MH2WW.js.map} +1 -1
  4. package/dist/asset-manager/index.js +1 -1
  5. package/dist/{chunk-757G6TTZ.js → chunk-56PIAGD6.js} +2 -2
  6. package/dist/{chunk-757G6TTZ.js.map → chunk-56PIAGD6.js.map} +1 -1
  7. package/dist/{chunk-YZD7DUEF.js → chunk-62NNP7LU.js} +3 -3
  8. package/dist/{chunk-YZD7DUEF.js.map → chunk-62NNP7LU.js.map} +1 -1
  9. package/dist/{chunk-K6HCOTOZ.js → chunk-7O2CR5SZ.js} +5 -5
  10. package/dist/{chunk-K6HCOTOZ.js.map → chunk-7O2CR5SZ.js.map} +1 -1
  11. package/dist/{chunk-KHWGUXSF.js → chunk-7RBFYW24.js} +3 -3
  12. package/dist/{chunk-KHWGUXSF.js.map → chunk-7RBFYW24.js.map} +1 -1
  13. package/dist/{chunk-E3KABQS3.js → chunk-BGATDUYX.js} +3 -3
  14. package/dist/{chunk-E3KABQS3.js.map → chunk-BGATDUYX.js.map} +1 -1
  15. package/dist/{chunk-3NJFPGEB.js → chunk-DXBHGNSI.js} +3 -3
  16. package/dist/{chunk-3NJFPGEB.js.map → chunk-DXBHGNSI.js.map} +1 -1
  17. package/dist/{chunk-PMZMG3HC.js → chunk-E5AZA2FL.js} +3 -3
  18. package/dist/{chunk-PMZMG3HC.js.map → chunk-E5AZA2FL.js.map} +1 -1
  19. package/dist/{chunk-YGP6XEPA.js → chunk-EDKTS44C.js} +3 -3
  20. package/dist/{chunk-YGP6XEPA.js.map → chunk-EDKTS44C.js.map} +1 -1
  21. package/dist/{chunk-2I5HNM7K.js → chunk-I4DI5DAX.js} +8 -8
  22. package/dist/{chunk-2I5HNM7K.js.map → chunk-I4DI5DAX.js.map} +1 -1
  23. package/dist/{chunk-XCGDRLMH.js → chunk-JAGBPHXB.js} +3 -3
  24. package/dist/{chunk-XCGDRLMH.js.map → chunk-JAGBPHXB.js.map} +1 -1
  25. package/dist/{chunk-7YOHUX2M.js → chunk-LZ3E6TML.js} +4 -4
  26. package/dist/{chunk-7YOHUX2M.js.map → chunk-LZ3E6TML.js.map} +1 -1
  27. package/dist/{chunk-5TLMHB2U.js → chunk-N2W7OJC6.js} +6 -3
  28. package/dist/chunk-N2W7OJC6.js.map +1 -0
  29. package/dist/{chunk-DRHJRTAS.js → chunk-N65H7YYI.js} +3 -3
  30. package/dist/{chunk-DRHJRTAS.js.map → chunk-N65H7YYI.js.map} +1 -1
  31. package/dist/{chunk-LJ6PLEDU.js → chunk-NAEXYRHR.js} +309 -44
  32. package/dist/chunk-NAEXYRHR.js.map +1 -0
  33. package/dist/{chunk-K7ZGY2BY.js → chunk-OLZE4IHX.js} +17 -9
  34. package/dist/chunk-OLZE4IHX.js.map +1 -0
  35. package/dist/{chunk-RDIGVPXX.js → chunk-PKC2AHOB.js} +2 -2
  36. package/dist/{chunk-RDIGVPXX.js.map → chunk-PKC2AHOB.js.map} +1 -1
  37. package/dist/{chunk-ZBA4P5TD.js → chunk-SAL72A7T.js} +2 -2
  38. package/dist/{chunk-ZBA4P5TD.js.map → chunk-SAL72A7T.js.map} +1 -1
  39. package/dist/{chunk-HKRME377.js → chunk-SVMIUCTT.js} +3 -3
  40. package/dist/{chunk-HKRME377.js.map → chunk-SVMIUCTT.js.map} +1 -1
  41. package/dist/{chunk-3QX2X77G.js → chunk-VQFA5DR7.js} +3 -3
  42. package/dist/{chunk-3QX2X77G.js.map → chunk-VQFA5DR7.js.map} +1 -1
  43. package/dist/{chunk-YHNPWSSH.js → chunk-YMO4ZDLC.js} +8 -8
  44. package/dist/{chunk-YHNPWSSH.js.map → chunk-YMO4ZDLC.js.map} +1 -1
  45. package/dist/{chunk-Q6FKWPRO.js → chunk-Z5EPCIB6.js} +5 -5
  46. package/dist/{chunk-Q6FKWPRO.js.map → chunk-Z5EPCIB6.js.map} +1 -1
  47. package/dist/{claude-code-AESK7XO4.js → claude-code-DS26HI3K.js} +4 -4
  48. package/dist/{claude-code-AESK7XO4.js.map → claude-code-DS26HI3K.js.map} +1 -1
  49. package/dist/cli/index.js +45 -45
  50. package/dist/connectors/config.js +1 -1
  51. package/dist/connectors/index.js +2 -2
  52. package/dist/connectors/src/connector-manager.d.ts +66 -2
  53. package/dist/connectors/src/connector-manager.d.ts.map +1 -1
  54. package/dist/connectors/src/connector-prompt.d.ts.map +1 -1
  55. package/dist/connectors/src/connector-types.d.ts +6 -0
  56. package/dist/connectors/src/connector-types.d.ts.map +1 -1
  57. package/dist/connectors/src/fleet-utils.d.ts +33 -0
  58. package/dist/connectors/src/fleet-utils.d.ts.map +1 -1
  59. package/dist/connectors/src/index.d.ts +2 -2
  60. package/dist/connectors/src/index.d.ts.map +1 -1
  61. package/dist/{connectors-5ZZRVAPD.js → connectors-3ST6PGWP.js} +5 -5
  62. package/dist/{connectors-5ZZRVAPD.js.map → connectors-3ST6PGWP.js.map} +1 -1
  63. package/dist/{ensure-sources-VLJ7AUUK.js → ensure-sources-VELKRM6X.js} +4 -4
  64. package/dist/{ensure-sources-VLJ7AUUK.js.map → ensure-sources-VELKRM6X.js.map} +1 -1
  65. package/dist/factory-assets/connectors/box.js +2 -2
  66. package/dist/factory-assets/connectors/deploy.js +2 -2
  67. package/dist/factory-assets/connectors/devserver.js +2 -2
  68. package/dist/factory-assets/connectors/flow/adapter.js +2 -2
  69. package/dist/factory-assets/connectors/flow/run-flow.js +3 -3
  70. package/dist/factory-assets/connectors/flow.js +2 -2
  71. package/dist/factory-assets/connectors/git.js +2 -2
  72. package/dist/factory-assets/connectors/gmail.js +2 -2
  73. package/dist/factory-assets/connectors/googledrive.js +2 -2
  74. package/dist/factory-assets/connectors/local.js +2 -2
  75. package/dist/factory-assets/connectors/mattermost.js +2 -2
  76. package/dist/factory-assets/connectors/memory.js +2 -2
  77. package/dist/factory-assets/connectors/minio.js +2 -2
  78. package/dist/factory-assets/connectors/postgres.js +2 -2
  79. package/dist/factory-assets/connectors/s3.js +2 -2
  80. package/dist/factory-assets/connectors/sharepoint.js +2 -2
  81. package/dist/factory-assets/connectors/sqlite.js +2 -2
  82. package/dist/factory-assets/connectors/static-server.js +2 -2
  83. package/dist/factory-assets/connectors/tunnel.js +2 -2
  84. package/dist/factory-assets/connectors/webdav.js +2 -2
  85. package/dist/factory-assets/connectors/xstate-store.js +2 -2
  86. package/dist/factory-assets/connectors/xstate.js +2 -2
  87. package/dist/{helpers-APXGTZ5A.js → helpers-LWNKX56Y.js} +4 -4
  88. package/dist/{helpers-APXGTZ5A.js.map → helpers-LWNKX56Y.js.map} +1 -1
  89. package/dist/{library-publish-B5HL4OBE.js → library-publish-WJVCT2IK.js} +17 -17
  90. package/dist/{library-publish-B5HL4OBE.js.map → library-publish-WJVCT2IK.js.map} +1 -1
  91. package/dist/{open-library-F56D46K7.js → open-library-Q7QZJY5D.js} +5 -5
  92. package/dist/{open-library-F56D46K7.js.map → open-library-Q7QZJY5D.js.map} +1 -1
  93. package/dist/{project-GLTP6VFV.js → project-WVPRL7CP.js} +13 -13
  94. package/dist/{project-GLTP6VFV.js.map → project-WVPRL7CP.js.map} +1 -1
  95. package/dist/runner/index.js +7 -7
  96. package/dist/runner/src/resource-handler.d.ts +1 -1
  97. package/dist/runner/src/resource-handler.d.ts.map +1 -1
  98. package/dist/runner/src/resources.d.ts +1 -0
  99. package/dist/runner/src/resources.d.ts.map +1 -1
  100. package/dist/runner/src/session-resource-handlers.d.ts.map +1 -1
  101. package/dist/sdk/asset-manager.js +1 -1
  102. package/dist/sdk/index.js +7 -7
  103. package/dist/sdk/runner.js +7 -7
  104. package/dist/{serve-preflight-EHLBSNUE.js → serve-preflight-24YWWYUG.js} +6 -6
  105. package/dist/{serve-preflight-EHLBSNUE.js.map → serve-preflight-24YWWYUG.js.map} +1 -1
  106. package/dist/{setup-PMZLMFCD.js → setup-F5JX64UP.js} +5 -5
  107. package/dist/{setup-PMZLMFCD.js.map → setup-F5JX64UP.js.map} +1 -1
  108. package/dist/{source-QNSGAM3S.js → source-DG5IAAGZ.js} +14 -14
  109. package/dist/{source-QNSGAM3S.js.map → source-DG5IAAGZ.js.map} +1 -1
  110. package/dist/{source-manifest-publish-AI725AVE.js → source-manifest-publish-76S2JD3O.js} +16 -16
  111. package/dist/{source-manifest-publish-AI725AVE.js.map → source-manifest-publish-76S2JD3O.js.map} +1 -1
  112. package/dist/tui/index.js +7 -7
  113. package/dist/workspace-plugin/adapters/mcp.js +4 -4
  114. package/dist/workspace-plugin/adapters/omp.js +7 -7
  115. package/dist/workspace-plugin/index.js +1 -1
  116. package/dist/workspace-plugin/src/tools/connectors.d.ts.map +1 -1
  117. package/package.json +1 -1
  118. package/dist/chunk-5TLMHB2U.js.map +0 -1
  119. package/dist/chunk-K7ZGY2BY.js.map +0 -1
  120. package/dist/chunk-LJ6PLEDU.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/open-library.ts"],"names":["source"],"mappings":";;;;;AAkBO,IAAM,yBAAA,GAAN,cAAwC,KAAA,CAAM;AAAA,EACnD,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,2BAAA;AAAA,EACd;AACF;AASA,eAAsB,WAAA,GAAc;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,UAAA,EAAW,GAAI,MAAM,OAAO,oBAA4B,CAAA;AAChE,IAAA,OAAO,IAAI,UAAA,CAAW,EAAE,YAAA,EAAc,eAAA,IAAmB,CAAA;AAAA,EAC3D,SAAS,GAAA,EAAK;AACZ,IAAA,MAAA,CAAO,CAAA,2BAAA,EAA8B,eAAe,KAAA,GAAQ,GAAA,CAAI,UAAU,M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AC,CAAA;AAAA,MAC/D;AAEA,MAAA,MAAMA,OAAAA,GAAS,IAAI,kBAAA,CAAmB,OAAA,EAAS,QAAQ,EAAA,EAAI,OAAA,CAAQ,IAAA,EAAM,eAAA,EAAiB,CAAA;AAC1F,MAAA,OAAO,EAAE,MAAA,EAAAA,OAAAA,EAAQ,OAAO,MAAM,OAAA,CAAQ,OAAM,EAAE;AAAA,IAChD,SAAS,GAAA,EAAK;AAGZ,MAAA,OAAA,CAAQ,KAAA,EAAM;AACd,MAAA,MAAM,GAAA;AAAA,IACR;AAAA,EACF;AAEA,EAAA,MAAM,UAAA,GAAa,GAAA,CAAI,OAAA,CAAQ,SAAA,GAAY,GAAA;AAC3C,EAAA,MAAM,SACJ,GAAA,CAAI,OAAA,CAAQ,OAAA,KAAY,MAAA,GACpB,IAAI,iBAAA,CAAkB,EAAE,OAAA,EAAS,UAAA,EAAY,CAAA,GAC7C,IAAI,oBAAoB,EAAE,OAAA,EAAS,YAAY,CAAA;AACrD,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,MAAM;AAAA,EAAC,CAAA,EAAE;AACnC;AASA,eAAsB,kBAAA,GAInB;AACD,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,MAAM,OAAO,oBAA4B,CAAA;AACpE,EAAA,MAAM,OAAA,GAAU,MAAM,WAAA,EAAY;AAClC,EAAA,MAAM,OAAA,GAAU,IAAI,cAAA,CAAe,OAAO,CAAA;AAC1C,EAAA,OAAO,EAAE,OAAA,EAAS,OAAA,EAAS,OAAO,MAAM,OAAA,CAAQ,OAAM,EAAE;AAC1D","file":"chunk-HKRME377.js","sourcesContent":["/**\n * open-library.ts — shared helpers to open the LocalIndex and the configured\n * Catalog source.\n *\n * Lazy-loads the `@skaile/workspaces/library` subpath and returns the\n * LocalIndex instance (backed by `@libsql/client`; runs on Node and Bun).\n * The catalog-source helper reads\n * `~/.skaile/config.yaml` (and project-level overlay if `projectDir` is given)\n * to decide between {@link RemoteCatalogSource} (default — points at\n * `https://skaile.store`) and a {@link LocalCatalogSource} bound to the most\n * recent local library registered via `skaile source add`.\n */\n\nimport { userConfigPath } from \"@skaile/workspaces/core\";\nimport { logErr } from \"./helpers.ts\";\nimport { getKindRegistry } from \"./open-registry.ts\";\n\n/** Thrown by {@link openCatalogSource} when `catalog.url` is the `local` sentinel. */\nexport class LocalCatalogDisabledError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"LocalCatalogDisabledError\";\n }\n}\n\n/**\n * Open the LocalIndex with the full kind registry. Exits with code 1\n * if the library directory cannot be created.\n *\n * @returns A `LocalIndex` instance ready for use.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibrary() {\n try {\n const { LocalIndex } = await import(\"@skaile/workspaces/library\");\n return new LocalIndex({ kindRegistry: getKindRegistry() });\n } catch (err) {\n logErr(`Could not open LocalIndex: ${err instanceof Error ? err.message : String(err)}`);\n process.exit(1);\n }\n}\n\n/**\n * Resolve the configured **remote** Catalog source for the CLI.\n *\n * Reads `~/.skaile/config.yaml` (plus the optional project-level overlay) and\n * returns a {@link RemoteCatalogSource} pointing at `catalog.url` (default:\n * `https://skaile.store`). The `cache_ttl: 0` config flag flips the source\n * into air-gapped mode: network reads are disabled, only `skaile update`\n * performs refreshes.\n *\n * **Local-mode rejection.** If the resolved config has `catalog.url: local`\n * this helper throws — callers wanting the dispatched local-or-remote source\n * must use {@link resolveCatalogSource}. Remote-only consumers like\n * `skaile update --catalog-only` rely on this strict behaviour.\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A configured {@link RemoteCatalogSource}.\n * @throws When `catalog.url` is the `local` sentinel.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<\n | import(\"@skaile/workspaces/library\").RemoteCatalogSource\n | import(\"@skaile/workspaces/library\").RestCatalogSource\n> {\n const { resolveConfig, RemoteCatalogSource, RestCatalogSource, isLocalCatalogUrl } = await import(\n \"@skaile/workspaces/library\"\n );\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n if (isLocalCatalogUrl(baseUrl)) {\n throw new LocalCatalogDisabledError(\n \"catalog.url is set to 'local' — remote catalog is disabled. \" +\n \"Use `skaile library init <name> --path <dir>` for a local folder, \" +\n `or set \\`catalog.url: https://skaile.store\\` in ${userConfigPath()}.`,\n );\n }\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n if (cfg.catalog.framing === \"rest\") {\n return new RestCatalogSource({ baseUrl, cacheTtlMs });\n }\n return new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n}\n\n/**\n * Resolved catalog source plus a close handle for releasing any underlying\n * resources (e.g. the `LocalIndex` SQLite connection in local mode).\n *\n * Callers MUST invoke `close()` when done — typically in a `finally` block.\n * For remote-mode sources `close()` is a no-op, but the contract is uniform\n * so consumers don't have to branch.\n *\n * @docLink cli/dev-guide#open-library\n */\nexport interface ResolvedCatalogSource {\n /** The {@link ICatalogSource} ready for use. */\n source: import(\"@skaile/workspaces/library\").ICatalogSource;\n /** Release any underlying resources (SQLite handle in local mode). */\n close(): void;\n}\n\n/**\n * Resolve the configured Catalog source — local or remote — based on\n * `~/.skaile/config.yaml`.\n *\n * Dispatch:\n * - `catalog.url: local` → opens {@link LocalIndex}, picks the most recently\n * registered local library whose `path` still exists on disk, and returns a\n * {@link LocalCatalogSource} bound to that library. Throws if no usable\n * local library is registered.\n * - any URL → returns {@link RemoteCatalogSource} (same as\n * {@link openCatalogSource}).\n *\n * The returned `close()` releases the underlying `LocalIndex` SQLite handle\n * in local mode (no-op in remote mode). Callers MUST invoke it — typically in\n * a `finally` block — to satisfy `library/CLAUDE.md` § \"Notes for Consumers\".\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A `ResolvedCatalogSource` carrying the source and a close handle.\n * @throws When `local` is configured but no usable local library is registered.\n * @docLink cli/dev-guide#open-library\n */\nexport async function resolveCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<ResolvedCatalogSource> {\n const {\n resolveConfig,\n RemoteCatalogSource,\n RestCatalogSource,\n LocalCatalogSource,\n isLocalCatalogUrl,\n libraryDirMissing,\n missingLibraryDirMessage,\n } = await import(\"@skaile/workspaces/library\");\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n\n if (isLocalCatalogUrl(baseUrl)) {\n const fs = await import(\"node:fs\");\n const library = await openLibrary();\n try {\n const sources = await library.listSources();\n type LibraryRow = (typeof sources)[number];\n // Type-narrow: `path` is required for local libraries after the filter.\n const usable = sources\n .filter(\n (s): s is LibraryRow & { path: string } =>\n s.backend === \"local\" && typeof s.path === \"string\" && s.path.length > 0,\n )\n .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());\n\n // A registered library whose directory is gone has one wording everywhere.\n const gone = sources.filter(libraryDirMissing);\n if (usable.length === 0) {\n if (gone.length > 0) throw new Error(gone.map(missingLibraryDirMessage).join(\"\\n\"));\n throw new Error(\n \"catalog.url is set to 'local' but no local library is registered. \" +\n \"Run `skaile library init <name> --path <dir>` first (a git repo: `skaile source add <git-url>`).\",\n );\n }\n\n // Prefer the most recently added library whose path still exists.\n const present = usable.find((s) => fs.existsSync(s.path));\n if (!present) {\n throw new Error(gone.map(missingLibraryDirMessage).join(\"\\n\"));\n }\n\n const source = new LocalCatalogSource(library, present.id, present.path, getKindRegistry());\n return { source, close: () => library.close() };\n } catch (err) {\n // Release the handle on any failure during dispatch — otherwise the\n // SQLite WAL state leaks for the lifetime of the process.\n library.close();\n throw err;\n }\n }\n\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n const source =\n cfg.catalog.framing === \"rest\"\n ? new RestCatalogSource({ baseUrl, cacheTtlMs })\n : new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n return { source, close: () => {} };\n}\n\n/**\n * Open the LibraryManager bound to the active LocalIndex.\n * Caller owns lifetime — must call `close()` (returned helper closes the\n * underlying LocalIndex).\n *\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibraryManager(): Promise<{\n manager: import(\"@skaile/workspaces/library\").LibraryManager;\n library: import(\"@skaile/workspaces/library\").LocalIndex;\n close: () => void;\n}> {\n const { LibraryManager } = await import(\"@skaile/workspaces/library\");\n const library = await openLibrary();\n const manager = new LibraryManager(library);\n return { manager, library, close: () => library.close() };\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/open-library.ts"],"names":["source"],"mappings":";;;;;AAkBO,IAAM,yBAAA,GAAN,cAAwC,KAAA,CAAM;AAAA,EACnD,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,2BAAA;AAAA,EACd;AACF;AASA,eAAsB,WAAA,GAAc;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,UAAA,EAAW,GAAI,MAAM,OAAO,oBAA4B,CAAA;AAChE,IAAA,OAAO,IAAI,UAAA,CAAW,EAAE,YAAA,EAAc,eAAA,IAAmB,CAAA;AAAA,EAC3D,SAAS,GAAA,EAAK;AACZ,IAAA,MAAA,CAAO,CAAA,2BAAA,EAA8B,eAAe,KAAA,GAAQ,GAAA,CAAI,UAAU,MAAA,CAAO,GAAG,CAAC,CAAA,CAAE,CAAA;AACvF,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACF;AAqBA,eAAsB,kBAAkB,IAAA,EAQtC;AACA,EAAA,MAAM,EAAE,eAAe,mBAAA,EAAqB,iBAAA,EAAmB,mBAAkB,GAAI,MAAM,OACzF,oBACF,CAAA;AACA,EAAA,MAAM,MAAM,aAAA,CAAc;AAAA,IACxB,YAAY,IAAA,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AAQ,KAAA,EAAM;AACd,MAAA,MAAM,GAAA;AAAA,IACR;AAAA,EACF;AAEA,EAAA,MAAM,UAAA,GAAa,GAAA,CAAI,OAAA,CAAQ,SAAA,GAAY,GAAA;AAC3C,EAAA,MAAM,SACJ,GAAA,CAAI,OAAA,CAAQ,OAAA,KAAY,MAAA,GACpB,IAAI,iBAAA,CAAkB,EAAE,OAAA,EAAS,UAAA,EAAY,CAAA,GAC7C,IAAI,oBAAoB,EAAE,OAAA,EAAS,YAAY,CAAA;AACrD,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,MAAM;AAAA,EAAC,CAAA,EAAE;AACnC;AASA,eAAsB,kBAAA,GAInB;AACD,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,MAAM,OAAO,oBAA4B,CAAA;AACpE,EAAA,MAAM,OAAA,GAAU,MAAM,WAAA,EAAY;AAClC,EAAA,MAAM,OAAA,GAAU,IAAI,cAAA,CAAe,OAAO,CAAA;AAC1C,EAAA,OAAO,EAAE,OAAA,EAAS,OAAA,EAAS,OAAO,MAAM,OAAA,CAAQ,OAAM,EAAE;AAC1D","file":"chunk-SVMIUCTT.js","sourcesContent":["/**\n * open-library.ts — shared helpers to open the LocalIndex and the configured\n * Catalog source.\n *\n * Lazy-loads the `@skaile/workspaces/library` subpath and returns the\n * LocalIndex instance (backed by `@libsql/client`; runs on Node and Bun).\n * The catalog-source helper reads\n * `~/.skaile/config.yaml` (and project-level overlay if `projectDir` is given)\n * to decide between {@link RemoteCatalogSource} (default — points at\n * `https://skaile.store`) and a {@link LocalCatalogSource} bound to the most\n * recent local library registered via `skaile source add`.\n */\n\nimport { userConfigPath } from \"@skaile/workspaces/core\";\nimport { logErr } from \"./helpers.ts\";\nimport { getKindRegistry } from \"./open-registry.ts\";\n\n/** Thrown by {@link openCatalogSource} when `catalog.url` is the `local` sentinel. */\nexport class LocalCatalogDisabledError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"LocalCatalogDisabledError\";\n }\n}\n\n/**\n * Open the LocalIndex with the full kind registry. Exits with code 1\n * if the library directory cannot be created.\n *\n * @returns A `LocalIndex` instance ready for use.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibrary() {\n try {\n const { LocalIndex } = await import(\"@skaile/workspaces/library\");\n return new LocalIndex({ kindRegistry: getKindRegistry() });\n } catch (err) {\n logErr(`Could not open LocalIndex: ${err instanceof Error ? err.message : String(err)}`);\n process.exit(1);\n }\n}\n\n/**\n * Resolve the configured **remote** Catalog source for the CLI.\n *\n * Reads `~/.skaile/config.yaml` (plus the optional project-level overlay) and\n * returns a {@link RemoteCatalogSource} pointing at `catalog.url` (default:\n * `https://skaile.store`). The `cache_ttl: 0` config flag flips the source\n * into air-gapped mode: network reads are disabled, only `skaile update`\n * performs refreshes.\n *\n * **Local-mode rejection.** If the resolved config has `catalog.url: local`\n * this helper throws — callers wanting the dispatched local-or-remote source\n * must use {@link resolveCatalogSource}. Remote-only consumers like\n * `skaile update --catalog-only` rely on this strict behaviour.\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A configured {@link RemoteCatalogSource}.\n * @throws When `catalog.url` is the `local` sentinel.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<\n | import(\"@skaile/workspaces/library\").RemoteCatalogSource\n | import(\"@skaile/workspaces/library\").RestCatalogSource\n> {\n const { resolveConfig, RemoteCatalogSource, RestCatalogSource, isLocalCatalogUrl } = await import(\n \"@skaile/workspaces/library\"\n );\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n if (isLocalCatalogUrl(baseUrl)) {\n throw new LocalCatalogDisabledError(\n \"catalog.url is set to 'local' — remote catalog is disabled. \" +\n \"Use `skaile library init <name> --path <dir>` for a local folder, \" +\n `or set \\`catalog.url: https://skaile.store\\` in ${userConfigPath()}.`,\n );\n }\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n if (cfg.catalog.framing === \"rest\") {\n return new RestCatalogSource({ baseUrl, cacheTtlMs });\n }\n return new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n}\n\n/**\n * Resolved catalog source plus a close handle for releasing any underlying\n * resources (e.g. the `LocalIndex` SQLite connection in local mode).\n *\n * Callers MUST invoke `close()` when done — typically in a `finally` block.\n * For remote-mode sources `close()` is a no-op, but the contract is uniform\n * so consumers don't have to branch.\n *\n * @docLink cli/dev-guide#open-library\n */\nexport interface ResolvedCatalogSource {\n /** The {@link ICatalogSource} ready for use. */\n source: import(\"@skaile/workspaces/library\").ICatalogSource;\n /** Release any underlying resources (SQLite handle in local mode). */\n close(): void;\n}\n\n/**\n * Resolve the configured Catalog source — local or remote — based on\n * `~/.skaile/config.yaml`.\n *\n * Dispatch:\n * - `catalog.url: local` → opens {@link LocalIndex}, picks the most recently\n * registered local library whose `path` still exists on disk, and returns a\n * {@link LocalCatalogSource} bound to that library. Throws if no usable\n * local library is registered.\n * - any URL → returns {@link RemoteCatalogSource} (same as\n * {@link openCatalogSource}).\n *\n * The returned `close()` releases the underlying `LocalIndex` SQLite handle\n * in local mode (no-op in remote mode). Callers MUST invoke it — typically in\n * a `finally` block — to satisfy `library/CLAUDE.md` § \"Notes for Consumers\".\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A `ResolvedCatalogSource` carrying the source and a close handle.\n * @throws When `local` is configured but no usable local library is registered.\n * @docLink cli/dev-guide#open-library\n */\nexport async function resolveCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<ResolvedCatalogSource> {\n const {\n resolveConfig,\n RemoteCatalogSource,\n RestCatalogSource,\n LocalCatalogSource,\n isLocalCatalogUrl,\n libraryDirMissing,\n missingLibraryDirMessage,\n } = await import(\"@skaile/workspaces/library\");\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n\n if (isLocalCatalogUrl(baseUrl)) {\n const fs = await import(\"node:fs\");\n const library = await openLibrary();\n try {\n const sources = await library.listSources();\n type LibraryRow = (typeof sources)[number];\n // Type-narrow: `path` is required for local libraries after the filter.\n const usable = sources\n .filter(\n (s): s is LibraryRow & { path: string } =>\n s.backend === \"local\" && typeof s.path === \"string\" && s.path.length > 0,\n )\n .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());\n\n // A registered library whose directory is gone has one wording everywhere.\n const gone = sources.filter(libraryDirMissing);\n if (usable.length === 0) {\n if (gone.length > 0) throw new Error(gone.map(missingLibraryDirMessage).join(\"\\n\"));\n throw new Error(\n \"catalog.url is set to 'local' but no local library is registered. \" +\n \"Run `skaile library init <name> --path <dir>` first (a git repo: `skaile source add <git-url>`).\",\n );\n }\n\n // Prefer the most recently added library whose path still exists.\n const present = usable.find((s) => fs.existsSync(s.path));\n if (!present) {\n throw new Error(gone.map(missingLibraryDirMessage).join(\"\\n\"));\n }\n\n const source = new LocalCatalogSource(library, present.id, present.path, getKindRegistry());\n return { source, close: () => library.close() };\n } catch (err) {\n // Release the handle on any failure during dispatch — otherwise the\n // SQLite WAL state leaks for the lifetime of the process.\n library.close();\n throw err;\n }\n }\n\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n const source =\n cfg.catalog.framing === \"rest\"\n ? new RestCatalogSource({ baseUrl, cacheTtlMs })\n : new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n return { source, close: () => {} };\n}\n\n/**\n * Open the LibraryManager bound to the active LocalIndex.\n * Caller owns lifetime — must call `close()` (returned helper closes the\n * underlying LocalIndex).\n *\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibraryManager(): Promise<{\n manager: import(\"@skaile/workspaces/library\").LibraryManager;\n library: import(\"@skaile/workspaces/library\").LocalIndex;\n close: () => void;\n}> {\n const { LibraryManager } = await import(\"@skaile/workspaces/library\");\n const library = await openLibrary();\n const manager = new LibraryManager(library);\n return { manager, library, close: () => library.close() };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { getStoreConfig, getStoreToken, storeFetch } from './chunk-E3KABQS3.js';
1
+ import { getStoreConfig, getStoreToken, storeFetch } from './chunk-BGATDUYX.js';
2
2
 
3
3
  // cli/src/store-publisher.ts
4
4
  function makeHttpPublisherClient(config = getStoreConfig(), timeoutMs = 2e4) {
@@ -25,5 +25,5 @@ function makeHttpPublisherClient(config = getStoreConfig(), timeoutMs = 2e4) {
25
25
  }
26
26
 
27
27
  export { makeHttpPublisherClient };
28
- //# sourceMappingURL=chunk-3QX2X77G.js.map
29
- //# sourceMappingURL=chunk-3QX2X77G.js.map
28
+ //# sourceMappingURL=chunk-VQFA5DR7.js.map
29
+ //# sourceMappingURL=chunk-VQFA5DR7.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/store-publisher.ts"],"names":[],"mappings":";;;AA+FO,SAAS,uBAAA,CACd,MAAA,GAAsB,cAAA,EAAe,EACrC,YAAY,GAAA,EACK;AAGjB,EAAA,MAAM,IAAA,GAAO,OACX,IAAA,EACA,IAAA,KACe;AACf,IAAA,MAAM,GAAA,GAAM,MAAM,aAAA,EAAc;AAChC,IAAA,OAAO,UAAA,CAAc,EAAE,GAAG,MAAA,EAAQ,GAAA,EAAI,EAAG,IAAA,EAAM,EAAE,SAAA,EAAW,GAAG,IAAA,EAAM,CAAA;AAAA,EACvE,CAAA;AACA,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,MAAM,IAAA,CAAK,YAAY,CAAA;AAAA,IAC3B,UAAA,EAAY,CAAC,IAAA,KAAS,IAAA,CAAK,mBAAmB,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,CAAA;AAAA,IACtE,WAAA,EAAa,MAAM,IAAA,CAAK,iBAAiB,CAAA;AAAA,IACzC,UAAA,EAAY,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,gBAAA,EAAmB,EAAE,CAAA,KAAA,CAAA,EAAS,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,IACnF,QAAQ,CAAC,KAAA,KAAU,IAAA,CAAK,CAAA,aAAA,EAAgB,KAAK,CAAA,CAAE,CAAA;AAAA,IAC/C,kBAAkB,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,gBAAA,EAAmB,EAAE,CAAA,WAAA,CAAa,CAAA;AAAA,IACjE,cAAc,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,QAAA,CAAU,CAAA;AAAA,IACzD,YAAA,EAAc,CAAC,EAAA,EAAI,IAAA,EAAM,WACvB,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,QAAA,CAAA,EAAY;AAAA,MACnC,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA;AAAA,MACA,GAAI,SAAS,EAAE,MAAA,EAAQ,EAAE,MAAA,EAAQ,GAAA,EAAI,EAAE,GAAI;AAAC,KAC7C,CAAA;AAAA,IACH,cAAA,EAAgB,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,UAAA,CAAA,EAAc,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,IAC3F,qBAAA,EAAuB,CAAC,EAAA,KACtB,IAAA,CAAK,sBAAsB,kBAAA,CAAmB,EAAE,CAAC,CAAA,aAAA,CAAe;AAAA,GACpE;AACF","file":"chunk-3QX2X77G.js","sourcesContent":["/**\n * Typed REST client for the AI Asset Store **publisher** surface — the\n * curator-publish flow (`skaile source manifest publish` / `yank`). Thin\n * wrappers over {@link storeFetch}; every method maps 1:1 to an `/api/v1/…`\n * endpoint. The {@link PublisherClient} interface is injectable so the\n * orchestration in `commands/source-manifest-publish.ts` can be unit-tested\n * against a fake without a live store.\n *\n * @docLink cli/dev-guide#store-publisher\n */\n\nimport { getStoreConfig, getStoreToken, type StoreConfig, storeFetch } from \"./store-client.ts\";\n\n/**\n * The publisher REST surface used by the curator-publish flow. Kept minimal —\n * only the endpoints `runPublish` / `runYank` actually call. Response shapes\n * are narrowed to the fields the orchestration reads (the server returns more).\n */\nexport interface PublisherClient {\n /**\n * Identity of the caller. `username` is the Keycloak login (personal-tier\n * namespace); `githubLogin` is the verified GitHub handle when connected —\n * the namespace to publish under when it differs from the login.\n */\n me(): Promise<{ username: string; githubLogin?: string | null }>;\n /** Register (or re-register) a source; returns the created/existing row id. */\n sourcesAdd(body: {\n url: string;\n ref: string;\n sidecarUrl?: string;\n sidecarRef?: string;\n /**\n * Target publisher namespace (the manifest's `publisher`). When it differs\n * from the caller's login username, the store resolves the CLAIMED Publisher\n * for it (the store must already have the claim). Omitted → the store\n * defaults to `@<username>` (personal).\n */\n namespace?: string;\n }): Promise<{ id: string }>;\n /** List sources — used to recover an id when `sourcesAdd` rejects a dup url. */\n sourcesList(): Promise<Array<{ id: string; url: string }>>;\n /** Kick off a source sync; returns the async job id to poll. */\n sourceSync(id: string): Promise<{ jobId: string }>;\n /** Poll a job's terminal status + per-item results. */\n jobGet(\n jobId: string,\n ): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string }> }>;\n /** Discovered publishable candidates for a synced source. */\n sourceCandidates(id: string): Promise<\n Array<{\n id: string;\n name: string;\n version: string;\n kind: string;\n published: boolean;\n assetRoot: string;\n }>\n >;\n /** Per-asset preview — the discovered file set + resolved candidate metadata. */\n assetPreview(id: string): Promise<{\n discoveredFiles: string[];\n candidate: { name: string; version: string; kind: string; publisherNamespace: string };\n }>;\n /**\n * Publish one asset. `dryRun` returns the would-be `{ manifest }` without\n * launching a job; the normal path returns `{ jobId }`.\n */\n assetPublish(\n id: string,\n body: { ref: string; files: string[] },\n dryRun?: boolean,\n ): Promise<{ jobId?: string; manifest?: unknown }>;\n /** Retract a published asset. Response body is ignored. */\n assetUnpublish(id: string): Promise<unknown>;\n /**\n * Read-only \"can I publish under `@<ns>` right now, and if not, what's the\n * path?\" probe. Backs the `publish --dry-run` namespace status line; its\n * `message` is store-authored and meant to be surfaced verbatim.\n */\n namespaceAvailability(ns: string): Promise<{\n namespace: string;\n status: \"owned-by-you\" | \"claimable-by-you\" | \"reserved\" | \"available\";\n claimMethod?: string;\n message: string;\n }>;\n}\n\n/**\n * Construct the real HTTP-backed {@link PublisherClient}. Every call carries a\n * longer timeout than the default store client because publish/sync trigger\n * server-side clone work.\n *\n * @param config - Store connection config; defaults to {@link getStoreConfig}.\n * @param timeoutMs - Per-request abort timeout (default 20s).\n */\nexport function makeHttpPublisherClient(\n config: StoreConfig = getStoreConfig(),\n timeoutMs = 20_000,\n): PublisherClient {\n // Acquire a fresh Keycloak token per call (device-flow session in\n // ~/.skaile/auth.json, refreshed on demand) rather than a static config.jwt.\n const call = async <T>(\n path: string,\n opts?: { method?: string; body?: unknown; params?: Record<string, string> },\n ): Promise<T> => {\n const jwt = await getStoreToken();\n return storeFetch<T>({ ...config, jwt }, path, { timeoutMs, ...opts });\n };\n return {\n me: () => call(\"/api/v1/me\"),\n sourcesAdd: (body) => call(\"/api/v1/sources\", { method: \"POST\", body }),\n sourcesList: () => call(\"/api/v1/sources\"),\n sourceSync: (id) => call(`/api/v1/sources/${id}/sync`, { method: \"POST\", body: {} }),\n jobGet: (jobId) => call(`/api/v1/jobs/${jobId}`),\n sourceCandidates: (id) => call(`/api/v1/sources/${id}/candidates`),\n assetPreview: (id) => call(`/api/v1/assets/${id}/preview`),\n assetPublish: (id, body, dryRun) =>\n call(`/api/v1/assets/${id}/publish`, {\n method: \"POST\",\n body,\n ...(dryRun ? { params: { dryRun: \"1\" } } : {}),\n }),\n assetUnpublish: (id) => call(`/api/v1/assets/${id}/unpublish`, { method: \"POST\", body: {} }),\n namespaceAvailability: (ns) =>\n call(`/api/v1/namespaces/${encodeURIComponent(ns)}/availability`),\n };\n}\n"]}
1
+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AAA;AAAA,MACA,GAAI,SAAS,EAAE,MAAA,EAAQ,EAAE,MAAA,EAAQ,GAAA,EAAI,EAAE,GAAI;AAAC,KAC7C,CAAA;AAAA,IACH,cAAA,EAAgB,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,UAAA,CAAA,EAAc,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,IAC3F,qBAAA,EAAuB,CAAC,EAAA,KACtB,IAAA,CAAK,sBAAsB,kBAAA,CAAmB,EAAE,CAAC,CAAA,aAAA,CAAe;AAAA,GACpE;AACF","file":"chunk-VQFA5DR7.js","sourcesContent":["/**\n * Typed REST client for the AI Asset Store **publisher** surface — the\n * curator-publish flow (`skaile source manifest publish` / `yank`). Thin\n * wrappers over {@link storeFetch}; every method maps 1:1 to an `/api/v1/…`\n * endpoint. The {@link PublisherClient} interface is injectable so the\n * orchestration in `commands/source-manifest-publish.ts` can be unit-tested\n * against a fake without a live store.\n *\n * @docLink cli/dev-guide#store-publisher\n */\n\nimport { getStoreConfig, getStoreToken, type StoreConfig, storeFetch } from \"./store-client.ts\";\n\n/**\n * The publisher REST surface used by the curator-publish flow. Kept minimal —\n * only the endpoints `runPublish` / `runYank` actually call. Response shapes\n * are narrowed to the fields the orchestration reads (the server returns more).\n */\nexport interface PublisherClient {\n /**\n * Identity of the caller. `username` is the Keycloak login (personal-tier\n * namespace); `githubLogin` is the verified GitHub handle when connected —\n * the namespace to publish under when it differs from the login.\n */\n me(): Promise<{ username: string; githubLogin?: string | null }>;\n /** Register (or re-register) a source; returns the created/existing row id. */\n sourcesAdd(body: {\n url: string;\n ref: string;\n sidecarUrl?: string;\n sidecarRef?: string;\n /**\n * Target publisher namespace (the manifest's `publisher`). When it differs\n * from the caller's login username, the store resolves the CLAIMED Publisher\n * for it (the store must already have the claim). Omitted → the store\n * defaults to `@<username>` (personal).\n */\n namespace?: string;\n }): Promise<{ id: string }>;\n /** List sources — used to recover an id when `sourcesAdd` rejects a dup url. */\n sourcesList(): Promise<Array<{ id: string; url: string }>>;\n /** Kick off a source sync; returns the async job id to poll. */\n sourceSync(id: string): Promise<{ jobId: string }>;\n /** Poll a job's terminal status + per-item results. */\n jobGet(\n jobId: string,\n ): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string }> }>;\n /** Discovered publishable candidates for a synced source. */\n sourceCandidates(id: string): Promise<\n Array<{\n id: string;\n name: string;\n version: string;\n kind: string;\n published: boolean;\n assetRoot: string;\n }>\n >;\n /** Per-asset preview — the discovered file set + resolved candidate metadata. */\n assetPreview(id: string): Promise<{\n discoveredFiles: string[];\n candidate: { name: string; version: string; kind: string; publisherNamespace: string };\n }>;\n /**\n * Publish one asset. `dryRun` returns the would-be `{ manifest }` without\n * launching a job; the normal path returns `{ jobId }`.\n */\n assetPublish(\n id: string,\n body: { ref: string; files: string[] },\n dryRun?: boolean,\n ): Promise<{ jobId?: string; manifest?: unknown }>;\n /** Retract a published asset. Response body is ignored. */\n assetUnpublish(id: string): Promise<unknown>;\n /**\n * Read-only \"can I publish under `@<ns>` right now, and if not, what's the\n * path?\" probe. Backs the `publish --dry-run` namespace status line; its\n * `message` is store-authored and meant to be surfaced verbatim.\n */\n namespaceAvailability(ns: string): Promise<{\n namespace: string;\n status: \"owned-by-you\" | \"claimable-by-you\" | \"reserved\" | \"available\";\n claimMethod?: string;\n message: string;\n }>;\n}\n\n/**\n * Construct the real HTTP-backed {@link PublisherClient}. Every call carries a\n * longer timeout than the default store client because publish/sync trigger\n * server-side clone work.\n *\n * @param config - Store connection config; defaults to {@link getStoreConfig}.\n * @param timeoutMs - Per-request abort timeout (default 20s).\n */\nexport function makeHttpPublisherClient(\n config: StoreConfig = getStoreConfig(),\n timeoutMs = 20_000,\n): PublisherClient {\n // Acquire a fresh Keycloak token per call (device-flow session in\n // ~/.skaile/auth.json, refreshed on demand) rather than a static config.jwt.\n const call = async <T>(\n path: string,\n opts?: { method?: string; body?: unknown; params?: Record<string, string> },\n ): Promise<T> => {\n const jwt = await getStoreToken();\n return storeFetch<T>({ ...config, jwt }, path, { timeoutMs, ...opts });\n };\n return {\n me: () => call(\"/api/v1/me\"),\n sourcesAdd: (body) => call(\"/api/v1/sources\", { method: \"POST\", body }),\n sourcesList: () => call(\"/api/v1/sources\"),\n sourceSync: (id) => call(`/api/v1/sources/${id}/sync`, { method: \"POST\", body: {} }),\n jobGet: (jobId) => call(`/api/v1/jobs/${jobId}`),\n sourceCandidates: (id) => call(`/api/v1/sources/${id}/candidates`),\n assetPreview: (id) => call(`/api/v1/assets/${id}/preview`),\n assetPublish: (id, body, dryRun) =>\n call(`/api/v1/assets/${id}/publish`, {\n method: \"POST\",\n body,\n ...(dryRun ? { params: { dryRun: \"1\" } } : {}),\n }),\n assetUnpublish: (id) => call(`/api/v1/assets/${id}/unpublish`, { method: \"POST\", body: {} }),\n namespaceAvailability: (ns) =>\n call(`/api/v1/namespaces/${encodeURIComponent(ns)}/availability`),\n };\n}\n"]}
@@ -1,9 +1,9 @@
1
- import { agentInstanceWarningLines, agentInstanceErrorLines, reportUnknownHarnesses, reportProjectConfig } from './chunk-PMZMG3HC.js';
1
+ import { agentInstanceWarningLines, agentInstanceErrorLines, reportUnknownHarnesses, reportProjectConfig } from './chunk-E5AZA2FL.js';
2
2
  import { createSpinner } from './chunk-NESV47MF.js';
3
3
  import { getKindRegistry } from './chunk-QCR5AE5E.js';
4
- import { logInfo, logWarn, S, logErr, TARGET_DEFAULT_HINT, logOk, colorRef, parseHarnessFilter, requireProjectConfig, deferredWarnings, warnPlaceholderBodies, warnFilesOnlyDelegates, warnStaleHarnessCopies, formatSoftDepHint, reportLegacyOmpCopies } from './chunk-3NJFPGEB.js';
5
- import { loadAgentManifest, createCompositionContentSource, hashAgentFiles, isCompilePinCurrent, compileComposition, CompositionError, loadCompileManifestFromDir, verifyConventionItems, resolveAgentInstance, isCompositionError, resolveBinding } from './chunk-K7ZGY2BY.js';
6
- import { AssetManager } from './chunk-757G6TTZ.js';
4
+ import { logInfo, logWarn, S, logErr, TARGET_DEFAULT_HINT, logOk, colorRef, parseHarnessFilter, requireProjectConfig, deferredWarnings, warnPlaceholderBodies, warnFilesOnlyDelegates, warnStaleHarnessCopies, formatSoftDepHint, reportLegacyOmpCopies } from './chunk-DXBHGNSI.js';
5
+ import { loadAgentManifest, createCompositionContentSource, hashAgentFiles, isCompilePinCurrent, compileComposition, CompositionError, loadCompileManifestFromDir, verifyConventionItems, resolveAgentInstance, isCompositionError, resolveBinding } from './chunk-OLZE4IHX.js';
6
+ import { AssetManager } from './chunk-56PIAGD6.js';
7
7
  import { effectiveComposes } from './chunk-VT6G5AJV.js';
8
8
  import { readLock } from './chunk-TMJBEGS4.js';
9
9
  import { agentSourceCacheDir, SourceEntryError, effectiveAgentInstances, resolveSkWorkspaceConfig, resolveAgentDefinitionDir, AgentRefResolutionError } from './chunk-O7ADRMCR.js';
@@ -242,7 +242,7 @@ async function runRefInstall(ref, opts) {
242
242
  const spinner = createSpinner();
243
243
  spinner.start(`Installing ${ref}`);
244
244
  try {
245
- const { openCatalogSource, openLibrary } = await import('./open-library-F56D46K7.js');
245
+ const { openCatalogSource, openLibrary } = await import('./open-library-Q7QZJY5D.js');
246
246
  const catalog = await openCatalogSource({ projectDir: path2.resolve(opts.projectDir) });
247
247
  if (!supportsInstallManifest(catalog)) {
248
248
  throw new Error(
@@ -296,7 +296,7 @@ async function runYamlInstall(opts) {
296
296
  }
297
297
  if (await reportUnknownHarnesses(projectDir) > 0) process.exit(1);
298
298
  try {
299
- const { ensureSourcesCloned } = await import('./ensure-sources-VLJ7AUUK.js');
299
+ const { ensureSourcesCloned } = await import('./ensure-sources-VELKRM6X.js');
300
300
  const hydrate = ensureSourcesCloned(projectDir, { quiet: true });
301
301
  if (hydrate.cloned.length > 0) {
302
302
  logOk(`Cloned source(s): ${hydrate.cloned.join(", ")}`);
@@ -618,5 +618,5 @@ function makeCleanCommand() {
618
618
  }
619
619
 
620
620
  export { REF_HINT, editedConventionFiles, globalProblems, makeCheckCommand, makeCleanCommand, makeInstallCommand, pinComposedAgents, reportAgentInstances, reportContentHeld, reportInferredHarnesses, reportInstalledSoftDeps, reportMoved, reportPresetExpansions, reportRelocked, reportReplaced, reportRewritten, reportStoreNotChecked, reportStoreNotCheckedForUpdates, runPointerOnlyInstall, runYamlInstall, supportsInstallManifest };
621
- //# sourceMappingURL=chunk-YHNPWSSH.js.map
622
- //# sourceMappingURL=chunk-YHNPWSSH.js.map
621
+ //# sourceMappingURL=chunk-YMO4ZDLC.js.map
622
+ //# sourceMappingURL=chunk-YMO4ZDLC.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/agent-pins.ts","../cli/src/commands/project.ts"],"names":["path","confirm"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,SAAS,SAAS,QAAA,EAAgD;AAChE,EAAA,IAAI;AACF,IAAA,OAAO,SAAS,IAAA,CAAK,CAAC,SAAS,cAAA,CAAe,IAAI,MAAM,iBAAiB,CAAA;AAAA,EAC3E,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AASA,eAAsB,iBAAA,CACpB,UAAA,EACA,IAAA,GAA4B,EAAC,EACV;AACnB,EAAA,OAAA,CAAQ,MAAM,uBAAA,CAAwB,UAAA,EAAY,IAAI,CAAA,EAAG,MAAA;AAC3D;AAMA,SAAS,WAAA,CAAY,KAAuB,SAAA,EAA2B;AACrE,EAAA,IAAI,IAAI,KAAA,EAAO;AACb,IAAA,MAAM,IAAI,GAAA,CAAI,KAAA;AACd,IAAA,OAAO,CAAA,EAAG,CAAA,CAAE,GAAG,CAAA,WAAA,EAAc,CAAA,CAAE,OAAO,CAAA,QAAA,EAAW,CAAA,CAAE,cAAc,CAAA,SAAA,EAAY,CAAA,CAAE,aAAa,CAAA,yCAAA,CAAA;AAAA,EAC9F;AACA,EAAA,OAAO,CAAA,EAAG,IAAI,GAAA,IAAO,SAAS,WAAW,SAAS,CAAA,E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AAA,OAAA,CAAQ,YAAY,CAAA;AACpB,QAAA;AAAA,MACF;AAAA,IACF;AAEA,IAAA,MAAM,SAAS,EAAA,CAAG,KAAA,CAAM,EAAE,GAAA,EAAK,IAAA,CAAK,KAAK,CAAA;AAEzC,IAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,KAAA,CAAM,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AAAA,IACtB;AACA,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,OAAA,CAAQ,WAAW,CAAA,CAAE,GAAG,CAAA,EAAA,EAAK,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,IACzC;AACA,IAAA,IAAI,MAAA,CAAO,SAAA,CAAU,MAAA,GAAS,CAAA,EAAG;AAC/B,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,OAAA,CAAQ,CAAA,KAAA,EAAQ,MAAA,CAAO,SAAA,CAAU,MAAM,CAAA,oBAAA,CAAsB,CAAA;AAC7D,MAAA,KAAA,MAAW,CAAA,IAAK,OAAO,SAAA,EAAW;AAChC,QAAA,OAAA,CAAQ,IAAI,CAAA,IAAA,EAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,CAAA,CAAE,CAAA;AAAA,MAC/B;AAAA,IACF;AACA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-YHNPWSSH.js","sourcesContent":["/**\n * The compile pin of the agents `skaile add` keeps under `.skaile/cache/agents/<name>/`.\n *\n * An agent that composes an `inline-snapshot` item (a persona, a ruleset, …) runs from\n * `compile_manifest.json`, so it cannot run without one. `add`, `install` and `update` pin\n * such an agent themselves, once per lock revision: a pin that still matches the bytes the\n * lock serves (one `skaile rebuild` wrote, or an earlier add/install) is left alone, and\n * `skaile rebuild` only refreshes it. `update` also re-runs the rebuild for any\n * agent that holds a pin, a convention-only agent (SOUL.md) included, because the update\n * moved the bytes the pin hashes.\n */\n\nimport { existsSync, readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { agentSourceCacheDir } from \"@skaile/workspaces/core\";\nimport {\n CompositionError,\n type CompositionContentSource,\n compileComposition,\n createCompositionContentSource,\n hashAgentFiles,\n isCompilePinCurrent,\n loadAgentManifest,\n loadCompileManifestFromDir,\n resolveBinding,\n} from \"@skaile/workspaces/runner\";\nimport { type AgentComposeItem, effectiveComposes } from \"@skaile/workspaces/types/manifests\";\nimport { logInfo, logWarn } from \"./helpers.ts\";\nimport { getKindRegistry } from \"./open-registry.ts\";\n\n/**\n * Whether `run` cannot start the agent without a compile pin: it declares an `inline-snapshot`\n * item (a persona, a ruleset bound so, ...). The convention files and the other bindings read\n * their source when no pin exists, so such an agent is left unpinned until `skaile rebuild`.\n */\nfunction needsPin(composes: readonly AgentComposeItem[]): boolean {\n try {\n return composes.some((item) => resolveBinding(item) === \"inline-snapshot\");\n } catch {\n // An item of a kind that has no binding: `run` and `rebuild` name it; nothing to pin here.\n return false;\n }\n}\n\n/**\n * Compile every cached agent of the project that declares an `inline-snapshot` composition item\n * and has no current pin. A compile that fails (an item no library or lock serves) is a warning\n * here: `skaile check` and `skaile run` raise the same error for the agent.\n *\n * @returns The names of the agents that were compiled.\n */\nexport async function pinComposedAgents(\n projectDir: string,\n opts: { repin?: boolean } = {},\n): Promise<string[]> {\n return (await pinComposedAgentsReport(projectDir, opts)).pinned;\n}\n\n/**\n * The `Missing:` line `install` prints for a composed asset the lock pins but no copy serves:\n * the same words as for a locked skill the library moved past (p1510).\n */\nfunction missingLine(err: CompositionError, agentName: string): string {\n if (err.moved) {\n const m = err.moved;\n return `${m.key} (library \"${m.library}\" is at ${m.libraryVersion}, locked ${m.lockedVersion}; \\`skaile update\\` moves the lock to it)`;\n }\n return `${err.ref ?? agentName} (agent ${agentName}: ${err.message})`;\n}\n\n/**\n * {@link pinComposedAgents}, plus the agents `run` could not start. An agent with no usable pin\n * whose locked persona or ruleset no library copy serves any more (the library moved on, or the\n * project is a fresh clone) is a `missing` line, not a warning: `install` exits 1 for it and\n * names `skaile update`, the only command that moves the lock (p1510). An agent that still has\n * its pin keeps running from it, so a library bump alone is silent.\n */\nexport async function pinComposedAgentsReport(\n projectDir: string,\n opts: { repin?: boolean } = {},\n): Promise<{ pinned: string[]; missing: string[] }> {\n const cacheDir = agentSourceCacheDir(projectDir);\n const pinned: string[] = [];\n const missing: string[] = [];\n if (!existsSync(cacheDir)) return { pinned, missing };\n for (const entry of readdirSync(cacheDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n const agentDir = path.join(cacheDir, entry.name);\n const manifest = await loadAgentManifest(agentDir);\n if (!manifest) continue;\n const wanted = !!manifest.composes?.length && needsPin(manifest.composes);\n // `update` re-runs the rebuild for an agent that was pinned: the pin hashes bytes it moved.\n if (!wanted && !(opts.repin && (await hasCompilePin(agentDir)))) continue;\n const composes = manifest.composes ?? [];\n let items: AgentComposeItem[] = [];\n const source = createCompositionContentSource({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n try {\n const files = await hashAgentFiles(agentDir);\n items = effectiveComposes(\n composes,\n files.map((f) => f.path),\n );\n if (await isCompilePinCurrent({ agentDir, items, source })) continue;\n const result = await compileComposition({ agentDir, items, source });\n pinned.push(entry.name);\n logInfo(\n `Compiled agent ${manifest.name ?? entry.name} (${result.resolvedCount} composition items) → prompt v${result.manifest.prompt_version}`,\n );\n } catch (err) {\n if (err instanceof CompositionError && err.code === \"composition_asset_missing\") {\n // The bytes the lock pins are gone, but the pin that was compiled from them still\n // serves `run`: nothing for install to report.\n if (await hasCompilePin(agentDir)) continue;\n for (const line of await missingLines(items, source, err, entry.name)) {\n if (!missing.includes(line)) missing.push(line);\n }\n continue;\n }\n const reason = err instanceof Error ? err.message : String(err);\n const code = err && typeof err === \"object\" && \"code\" in err ? `${String(err.code)}: ` : \"\";\n logWarn(`Could not compile agent ${entry.name}: ${code}${reason}`);\n }\n }\n return { pinned, missing };\n}\n\n/** Whether the agent folder holds a readable compile pin. */\nasync function hasCompilePin(agentDir: string): Promise<boolean> {\n try {\n return (await loadCompileManifestFromDir(agentDir)) !== undefined;\n } catch {\n return false;\n }\n}\n\n/** One line per item the source cannot serve (the compile names only the first). */\nasync function missingLines(\n items: readonly AgentComposeItem[],\n source: CompositionContentSource,\n first: CompositionError,\n agentName: string,\n): Promise<string[]> {\n const lines = [missingLine(first, agentName)];\n for (const item of items) {\n try {\n await source.load(item.ref, item.kind);\n } catch (err) {\n if (err instanceof CompositionError && err.code === \"composition_asset_missing\") {\n lines.push(missingLine(err, agentName));\n }\n }\n }\n return [...new Set(lines)];\n}\n","import { homedir } from \"node:os\";\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n AssetManager,\n type ContentHeld,\n type InstalledAgentInstance,\n type LibraryMove,\n type ReplacedAsset,\n type RewrittenAgent,\n} from \"@skaile/workspaces/asset-manager\";\nimport {\n type AgentInstanceConfig,\n AgentRefResolutionError,\n type HarnessName,\n effectiveAgentInstances,\n globalSkaileDir,\n type PresetExpansion,\n parseAssetRef,\n readLock,\n resolveAgentDefinitionDir,\n resolveSkWorkspaceConfig,\n SourceEntryError,\n userConfigPath,\n} from \"@skaile/workspaces/core\";\nimport {\n isCompositionError,\n loadAgentManifest,\n resolveAgentInstance,\n verifyConventionItems,\n} from \"@skaile/workspaces/runner\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport {\n colorRef,\n requireProjectConfig,\n formatSoftDepHint,\n deferredWarnings,\n logErr,\n logInfo,\n logOk,\n logWarn,\n parseHarnessFilter,\n reportLegacyOmpCopies,\n S,\n TARGET_DEFAULT_HINT,\n warnFilesOnlyDelegates,\n warnStaleHarnessCopies,\n warnPlaceholderBodies,\n} from \"../helpers.ts\";\nimport {\n agentInstanceErrorLines,\n agentInstanceWarningLines,\n reportProjectConfig,\n reportUnknownHarnesses,\n} from \"../config-checks.ts\";\nimport { createSpinner } from \"../spinner.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport { pinComposedAgentsReport } from \"../agent-pins.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nexport const REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile-ai/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Canonical asset ref (`kind:@<publisher>/<name>#<version>`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Print one summary line per `preset:` dependency `skaile install` expanded: how many\n * asset items joined the install set and how many instance items (`library://`,\n * placeholders) were skipped, which only `skaile preset apply` materialises.\n */\nexport function reportPresetExpansions(\n presets: readonly PresetExpansion[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const preset of presets ?? []) {\n onLine(\n `preset ${preset.ref}: ${preset.assets} assets, ${preset.skipped} instance items skipped (apply with skaile preset apply)`,\n );\n }\n}\n\n/**\n * Print one line per agent instance `skaile install` rendered (with the files\n * written) and one per native agent file removed because its instance left `skaile.yaml`.\n */\nexport function reportAgentInstances(\n instances: readonly InstalledAgentInstance[] | undefined,\n removedFiles: readonly string[] | undefined,\n onLine: (line: string) => void = logInfo,\n onRemoved: (line: string) => void = logWarn,\n): void {\n for (const instance of instances ?? []) {\n onLine(`agent ${instance.id}: ${instance.files.join(\", \")}`);\n }\n for (const file of removedFiles ?? []) onRemoved(`Removed: ${file}`);\n}\n\n/** One `Re-locked` line per lock entry `install`/`update` rewrote for an already-locked asset. */\nexport function reportRelocked(\n relocked: string[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const ref of relocked ?? []) onLine(`Re-locked ${ref}`);\n}\n\n/**\n * One line per locked library asset whose library holds the locked version with other bytes.\n * `install` keeps the lock and the deployed copy; only `update` takes the edit (OQ13, p1911).\n * The project does not match its library, as `check` says, so the run exits 1.\n */\nexport function reportContentHeld(\n held: ContentHeld[] | undefined,\n onLine: (line: string) => void = logWarn,\n): void {\n for (const h of held ?? []) {\n onLine(\n `${h.ref.split(\"#\")[0]}: library \"${h.library}\" changed since lock (same version ${h.version}). Run ${S.cmd(\"skaile update\")} to take the change.`,\n );\n process.exitCode = 1;\n }\n}\n\n/** One line per global entry `install --global` limited to the one harness that holds its copy (p1442). */\nexport function reportInferredHarnesses(\n inferred: readonly { ref: string; harnesses: readonly string[] }[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const i of inferred ?? []) {\n onLine(\n `${i.ref} stays on ${i.harnesses.join(\", \")} (its only copy); add it to another harness with \\`skaile add ${i.ref} --global --harness <id>\\``,\n );\n }\n}\n\n/** One `! <ref> moved from <a> to <b>` line per locked asset that now resolves from another library. */\nexport function reportMoved(\n moved: readonly LibraryMove[] | undefined,\n onLine: (line: string) => void = logWarn,\n): void {\n for (const m of moved ?? []) onLine(`${m.ref} moved from ${m.from} to ${m.to}`);\n}\n\n/** One `replaced <old> → <new>` line per asset `install`/`update` moved to another locked version. */\nexport function reportReplaced(\n replaced: readonly ReplacedAsset[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of replaced ?? []) onLine(`${r.ref} replaced ${r.from} → ${r.to}`);\n}\n\n/** One `Rewrote <file> (agent render changed)` line per rendered agent file whose bytes the CLI's render changed. */\nexport function reportRewritten(\n rewritten: readonly RewrittenAgent[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of rewritten ?? []) {\n for (const f of r.files) onLine(`Rewrote ${f} (agent render changed)`);\n }\n}\n\n/**\n * Say which locked store assets `install`/`update` did not check against the store (p792,\n * p799). A chosen mode (air-gapped, `--no-catalog`) is one info line per asset; a store that\n * did not answer is an error line `store unreachable: could not check <ref> for updates`.\n *\n * @returns Whether any asset could not be checked because the store was unreachable: the\n * command then ends `Failed` with exit 1.\n */\nexport function reportStoreNotChecked(\n notChecked: readonly { ref: string; reason: string; detail: string }[] | undefined,\n): boolean {\n let unreachable = false;\n for (const n of notChecked ?? []) {\n if (n.reason === \"unreachable\") {\n unreachable = true;\n logErr(`store unreachable: could not check ${n.ref} for updates (${n.detail})`);\n } else if (n.reason === \"air-gapped\") {\n logInfo(`${n.ref} kept as locked (air-gapped: not checked against the store)`);\n } else {\n logInfo(`${n.ref} kept as locked (${n.detail})`);\n }\n }\n return unreachable;\n}\n\n/**\n * Say which refs `outdated`, `check` or `doctor` could not check against the store\n * (`AssetManager.takeStoreNotChecked`). A store that did not answer is one error\n * line per ref (`store unreachable: <ref> not checked (<why>)`); an air-gapped client\n * (`catalog.cache_ttl: 0`) chose not to ask, so its refs are one info line each.\n *\n * @returns Whether any ref was not checked because the store was unreachable: the command then\n * exits 1, as `install` and `update` do.\n */\nexport function reportStoreNotCheckedForUpdates(\n notChecked: readonly { ref: string; reason: string; detail: string }[],\n): boolean {\n let unreachable = false;\n for (const n of notChecked) {\n if (n.reason === \"air-gapped\") {\n logInfo(`${n.ref} not checked (air-gapped: the store was not asked)`);\n } else {\n unreachable = true;\n logErr(`store unreachable: ${n.ref} not checked (${n.detail})`);\n }\n }\n return unreachable;\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * harness target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install kind:@<publisher>/<name>#<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global harness\",\n )\n .option(\n \"--harness <ids>\",\n \"Comma-separated global harnesses to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .option(\n \"--force\",\n \"Deploy over a folder no lock entry owns (a hand-made skill of the same name), and prune an undeclared asset whose folder holds your edits, instead of refusing\",\n )\n .option(\n \"--verbose\",\n \"also print the resolver's searched directories for an agent it cannot find\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\nexport interface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target?: string;\n global?: boolean;\n harness?: string;\n link?: boolean;\n force?: boolean;\n verbose?: boolean;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n // The store installs one exact version; without `#<version>` it answers a bare 400, so say\n // what is missing before the call.\n if (!parseAssetRef(ref).pin) {\n logErr(\n `${ref} needs a version: use ${ref}#<version>. A library asset is deployed with \\`skaile add ${ref}\\`, not \\`skaile install\\`.`,\n );\n process.exit(1);\n }\n const spinner = createSpinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n `in ${userConfigPath()}.`,\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(\n `Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`,\n ),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/failed: 404\\b/.test(msg)) {\n logErr(\n `${ref} is not in the store. For a library asset use \\`skaile add ${ref.replace(/#.*$/, \"\")}\\`.`,\n );\n } else if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). Also runs `skaile harness set`. */\nexport async function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const harnesses = parseHarnessFilter(opts.harness);\n // `--harness` implies `--global`.\n if (opts.global || harnesses) {\n await runGlobalInstall(opts, harnesses);\n return;\n }\n\n // A project without a readable skaile.yaml stops here, before sources are cloned, assets\n // are deployed or undeployed, or the lock is written.\n requireProjectConfig(projectDir);\n\n // Refuse what `validate` rejects for the `agents:` map, before anything is written (p1512);\n // a key of `agent:` or `agents:` that nothing reads warns (p1712).\n for (const line of agentInstanceWarningLines(projectDir)) logWarn(line);\n const instanceErrors = agentInstanceErrorLines(projectDir);\n if (instanceErrors.length > 0) {\n for (const line of instanceErrors) logErr(line);\n process.exit(1);\n }\n // A `harness:` nothing registers fails as in `validate` and `check` (p1754).\n if ((await reportUnknownHarnesses(projectDir)) > 0) process.exit(1);\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const warnings = deferredWarnings();\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir,\n harness: opts.target as HarnessName,\n onLibraryCollision: warnings.push,\n });\n const spinner = createSpinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link, force: opts.force });\n const storeUnreachable = result.storeNotChecked?.some((n) => n.reason === \"unreachable\");\n spinner.stop(\n result.agentInstanceErrors?.length ||\n result.missing.length > 0 ||\n storeUnreachable ||\n result.contentHeld?.length\n ? \"Failed\"\n : \"Done\",\n );\n warnings.flush();\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n warnPlaceholderBodies(result.placeholderBodies, result.placeholderDescriptions);\n for (const r of result.restored ?? []) {\n for (const f of r.restored) logInfo(`Restored ${f}`);\n for (const f of r.removed) logInfo(`Removed ${f} (not part of ${r.ref})`);\n }\n reportRewritten(result.rewritten);\n for (const line of result.libraryNotices ?? []) logInfo(line);\n reportPresetExpansions(result.presets);\n reportAgentInstances(result.agentInstances, result.agentFilesRemoved);\n // Said when this install wrote an agent file (a fresh clone, a changed agent), not when it only\n // restored a skill or did nothing (p1673).\n if (\n result.deployed.some((d) => d.startsWith(\"agent:\")) ||\n result.replaced?.some((r) => r.ref.startsWith(\"agent:\")) ||\n result.agentInstancesChanged?.length\n ) {\n warnFilesOnlyDelegates(am.projectDir, am.harness);\n }\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n reportMoved(result.moved);\n reportContentHeld(result.contentHeld);\n const pins = await pinComposedAgentsReport(projectDir);\n const missing = [...result.missing, ...pins.missing];\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n missing.length === 0 &&\n !result.storeNotChecked?.length &&\n !result.restored?.length &&\n !result.relocked?.length &&\n !result.contentHeld?.length &&\n !result.moved?.length &&\n !result.agentInstanceErrors?.length\n ) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.agentInstanceErrors?.length) {\n if (opts.verbose) for (const d of result.agentInstanceDetails ?? []) logInfo(S.dim(d));\n logErr(\n `${result.agentInstanceErrors.length} agent instance(s) could not be rendered (see above)`,\n );\n process.exitCode = 1;\n }\n if (missing.length > 0) {\n for (const m of missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (reportStoreNotChecked(result.storeNotChecked)) process.exitCode = 1;\n // A ref that only resolved once the assets were installed (a catalog agent) is checked now.\n const lateInstanceErrors = agentInstanceErrorLines(projectDir);\n for (const line of lateInstanceErrors) logErr(line);\n if (lateInstanceErrors.length > 0) process.exitCode = 1;\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n warnStaleHarnessCopies(am);\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(err instanceof SourceEntryError ? err.message : String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-harness install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global harness's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-harness\n * state. `harnesses` is the `--harness` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n harnesses: HarnessName[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses,\n });\n const spinner = createSpinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link, force: opts.force });\n const storeUnreachable = result.storeNotChecked?.some((n) => n.reason === \"unreachable\");\n spinner.stop(\n result.missing.length > 0 || storeUnreachable || result.contentHeld?.length\n ? \"Failed\"\n : \"Done\",\n );\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n warnPlaceholderBodies(result.placeholderBodies, result.placeholderDescriptions);\n reportPresetExpansions(result.presets);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n reportInferredHarnesses(result.inferredHarnesses);\n reportMoved(result.moved);\n reportContentHeld(result.contentHeld);\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n result.missing.length === 0 &&\n !result.storeNotChecked?.length &&\n !result.relocked?.length &&\n !result.contentHeld?.length &&\n !result.moved?.length\n )\n logInfo(\"Nothing to install (already up to date).\");\n if (reportStoreNotChecked(result.storeNotChecked)) process.exitCode = 1;\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n reportLegacyOmpCopies(am.takeLegacyCopiesRemoved(), am.takeLegacyCopiesKept());\n\n // Per-harness reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byHarness = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byHarness.set(s.harness, (byHarness.get(s.harness) ?? 0) + 1);\n for (const [harness, n] of byHarness) logInfo(`${harness}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/** The `--global` options of `check`, `doctor` and `clean`. */\ninterface GlobalScopeOptions {\n global?: boolean;\n harness?: string;\n projectDir: string;\n}\n\n/** A manager over the user-scope SSOT (`~/.skaile`), limited to `--harness` when given. */\nfunction globalManager(opts: GlobalScopeOptions): AssetManager {\n return new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses: parseHarnessFilter(opts.harness),\n });\n}\n\n/**\n * What is wrong with the global install: one line per declared asset a harness does not hold\n * (`list --global` calls these `declared` and `drift`), per invalid entry, and per old\n * `~/.omp/<dir>` copy a 5.12.0 install left behind. Empty when the global state is clean (p911).\n */\nexport function globalProblems(am: AssetManager): string[] {\n const lines = new Set<string>();\n for (const row of am.globalState({})) {\n if (row.state === \"declared\") {\n lines.add(\n `${row.ref} is declared in ~/.skaile/skaile.yaml but not installed: run skaile install --global`,\n );\n } else if (row.state === \"drift\") {\n lines.add(\n `${row.ref} is missing from ${row.harness}: run skaile install --global --harness ${row.harness}`,\n );\n } else if (row.state === \"invalid\") {\n lines.add(`${row.ref} in ~/.skaile/skaile.yaml is not a valid asset ref`);\n }\n }\n for (const stale of am.staleLegacyOmpCopies()) {\n lines.add(\n `${stale.path.replace(homedir(), \"~\")} is an old omp copy of ${stale.ref} (omp reads ~/.omp/agent): run skaile install --global --harness omp, or delete it`,\n );\n }\n return [...lines];\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Fails (exit 1) on every problem {@link AssetManager.projectState} reports: unmet\n * requirements of deployed assets, a declared dep that never resolved into the lock (its\n * library or source is gone, like `skaile list` showing it as `declared`) or never\n * materialized (e.g. a store-sourced `mcp-server`, #462), a locked asset whose library is\n * gone or whose deployed copy or files are missing, a locked library asset whose files\n * changed since the lock (or whose lock hash predates the shared asset hash), and an\n * `agents.<id>.ref` that binds to no agent. `doctor`, `outdated`, `diff` and\n * `install --locked` take their verdict from the same state.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--global\", \"Check the global install (~/.skaile) instead of the project\")\n .option(\"--harness <ids>\", \"With --global: only these harnesses (comma-separated)\")\n .action(async (opts) => {\n if (opts.global || opts.harness) {\n const problems = globalProblems(globalManager({ ...opts, global: true }));\n if (problems.length === 0) {\n logOk(\"All global dependencies satisfied.\");\n return;\n }\n for (const line of problems) logErr(line);\n process.exit(1);\n }\n requireProjectConfig(opts.projectDir);\n // A mistyped key warns; a `harness:` nothing registers fails like a gap (p1474, p1022).\n const configErrors = await reportProjectConfig(path.resolve(opts.projectDir), {\n harness: true,\n instances: true,\n });\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n });\n const { gaps } = await am.projectState();\n const edited = await editedConventionFiles(path.resolve(opts.projectDir));\n // A skipped `mcp-server` or an unset required field fails nothing: a `!` line each.\n const notices = [\n ...(await am.mcpNotices()).map((n) => n.text),\n // A library that went back past the lock is no drift either (p1257).\n ...(await am.libraryOlderNotices()),\n // A lock written before it listed the instance files: the next write replaces them.\n ...am.legacyLockNotices(),\n ];\n // A store-origin ref the store could not be asked about is not \"satisfied\".\n await am.probeStoreOrigins();\n const notChecked = am.takeStoreNotChecked();\n const storeUnreachable = notChecked.some((n) => n.reason === \"unreachable\");\n if (gaps.length === 0 && edited.length === 0 && configErrors === 0 && !storeUnreachable) {\n logOk(\"All dependencies satisfied.\");\n for (const n of notices) logWarn(n);\n reportStoreNotCheckedForUpdates(notChecked);\n } else {\n for (const g of gaps) logErr(g.message);\n for (const e of edited) logErr(e);\n for (const n of notices) logWarn(n);\n reportStoreNotCheckedForUpdates(notChecked);\n process.exit(1);\n }\n });\n}\n\n/**\n * One message per convention file (SOUL.md, knowledge/, …) of a bound agent that was edited\n * after `skaile rebuild` pinned it: the compile manifest, not the file, is what the agent\n * runs from, so the edit never reaches it. Also one message per bound agent that `skaile run`\n * would refuse with `composition_rebuild_required` (an `inline-snapshot` item with no compile\n * pin, or a pin that is stale or malformed), in the words `run` prints (p1310). Instances bound\n * to the same agent directory share the files, so one message names every instance that runs\n * from them. A binding that resolves to no agent is a `projectState` gap, not reported here.\n * Shared by `check` and `doctor`.\n */\nexport async function editedConventionFiles(projectDir: string): Promise<string[]> {\n const instances = effectiveAgentInstances(resolveSkWorkspaceConfig(projectDir));\n const byDir = new Map<string, { ref: string; ids: string[]; instance: AgentInstanceConfig }>();\n for (const [id, instance] of Object.entries(instances)) {\n let agentDir: string | undefined;\n try {\n agentDir = resolveAgentDefinitionDir(projectDir, instance.ref);\n } catch (err) {\n if (err instanceof AgentRefResolutionError) continue;\n throw err;\n }\n if (!agentDir) continue;\n if (path.basename(agentDir) === \"agent.yaml\") agentDir = path.dirname(agentDir);\n const bound = byDir.get(agentDir);\n if (bound) bound.ids.push(id);\n else byDir.set(agentDir, { ref: instance.ref, ids: [id], instance });\n }\n const messages: string[] = [];\n for (const [agentDir, { ref, ids, instance }] of byDir) {\n const label = `${ids.length === 1 ? \"instance\" : \"instances\"} ${ids.join(\", \")}`;\n try {\n const drifted = await verifyConventionItems({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n for (const err of drifted) messages.push(`${ref} (${label}): ${err.message}`);\n const manifest = await loadAgentManifest(agentDir);\n if (manifest) {\n await resolveAgentInstance({\n instanceId: ids[0]!,\n instance,\n asset: { manifest, dir: agentDir },\n projectDir,\n registry: getKindRegistry(),\n host: { nativeSubagents: true },\n dryRun: true,\n });\n }\n } catch (err) {\n if (!isCompositionError(err)) throw err;\n // Only the error `run` raises for a missing pin; other composition errors are not `check`'s.\n if (err.code === \"composition_rebuild_required\") {\n messages.push(`${ref} (${label}): ${err.code}: ${err.message}`);\n }\n }\n }\n return messages;\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\"--global\", \"Clean the global install (~/.skaile and every global harness)\")\n .option(\"--harness <ids>\", \"With --global: only these harnesses (comma-separated)\")\n .action(async (opts) => {\n const isGlobal = Boolean(opts.global || opts.harness);\n // A skaile.yaml that does not parse stops `clean` with one `✗` line (p910).\n if (!isGlobal) requireProjectConfig(opts.projectDir, { allowMissing: true });\n const am = isGlobal\n ? globalManager({ ...opts, global: true })\n : new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n harness: opts.target as HarnessName,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(\n isGlobal\n ? path.join(globalSkaileDir(), \"skaile.lock.yaml\")\n : path.resolve(opts.projectDir, \"skaile.lock.yaml\"),\n );\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n if (!isGlobal) {\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n }\n console.log(` ${S.dim(isGlobal ? \"~/.skaile/skaile.lock.yaml\" : \"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/agent-pins.ts","../cli/src/commands/project.ts"],"names":["path","confirm"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,SAAS,SAAS,QAAA,EAAgD;AAChE,EAAA,IAAI;AACF,IAAA,OAAO,SAAS,IAAA,CAAK,CAAC,SAAS,cAAA,CAAe,IAAI,MAAM,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A,CAAQ,CAAA,KAAA,EAAQ,MAAA,CAAO,SAAA,CAAU,MAAM,CAAA,oBAAA,CAAsB,CAAA;AAC7D,MAAA,KAAA,MAAW,CAAA,IAAK,OAAO,SAAA,EAAW;AAChC,QAAA,OAAA,CAAQ,IAAI,CAAA,IAAA,EAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,CAAA,CAAE,CAAA;AAAA,MAC/B;AAAA,IACF;AACA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-YMO4ZDLC.js","sourcesContent":["/**\n * The compile pin of the agents `skaile add` keeps under `.skaile/cache/agents/<name>/`.\n *\n * An agent that composes an `inline-snapshot` item (a persona, a ruleset, …) runs from\n * `compile_manifest.json`, so it cannot run without one. `add`, `install` and `update` pin\n * such an agent themselves, once per lock revision: a pin that still matches the bytes the\n * lock serves (one `skaile rebuild` wrote, or an earlier add/install) is left alone, and\n * `skaile rebuild` only refreshes it. `update` also re-runs the rebuild for any\n * agent that holds a pin, a convention-only agent (SOUL.md) included, because the update\n * moved the bytes the pin hashes.\n */\n\nimport { existsSync, readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { agentSourceCacheDir } from \"@skaile/workspaces/core\";\nimport {\n CompositionError,\n type CompositionContentSource,\n compileComposition,\n createCompositionContentSource,\n hashAgentFiles,\n isCompilePinCurrent,\n loadAgentManifest,\n loadCompileManifestFromDir,\n resolveBinding,\n} from \"@skaile/workspaces/runner\";\nimport { type AgentComposeItem, effectiveComposes } from \"@skaile/workspaces/types/manifests\";\nimport { logInfo, logWarn } from \"./helpers.ts\";\nimport { getKindRegistry } from \"./open-registry.ts\";\n\n/**\n * Whether `run` cannot start the agent without a compile pin: it declares an `inline-snapshot`\n * item (a persona, a ruleset bound so, ...). The convention files and the other bindings read\n * their source when no pin exists, so such an agent is left unpinned until `skaile rebuild`.\n */\nfunction needsPin(composes: readonly AgentComposeItem[]): boolean {\n try {\n return composes.some((item) => resolveBinding(item) === \"inline-snapshot\");\n } catch {\n // An item of a kind that has no binding: `run` and `rebuild` name it; nothing to pin here.\n return false;\n }\n}\n\n/**\n * Compile every cached agent of the project that declares an `inline-snapshot` composition item\n * and has no current pin. A compile that fails (an item no library or lock serves) is a warning\n * here: `skaile check` and `skaile run` raise the same error for the agent.\n *\n * @returns The names of the agents that were compiled.\n */\nexport async function pinComposedAgents(\n projectDir: string,\n opts: { repin?: boolean } = {},\n): Promise<string[]> {\n return (await pinComposedAgentsReport(projectDir, opts)).pinned;\n}\n\n/**\n * The `Missing:` line `install` prints for a composed asset the lock pins but no copy serves:\n * the same words as for a locked skill the library moved past (p1510).\n */\nfunction missingLine(err: CompositionError, agentName: string): string {\n if (err.moved) {\n const m = err.moved;\n return `${m.key} (library \"${m.library}\" is at ${m.libraryVersion}, locked ${m.lockedVersion}; \\`skaile update\\` moves the lock to it)`;\n }\n return `${err.ref ?? agentName} (agent ${agentName}: ${err.message})`;\n}\n\n/**\n * {@link pinComposedAgents}, plus the agents `run` could not start. An agent with no usable pin\n * whose locked persona or ruleset no library copy serves any more (the library moved on, or the\n * project is a fresh clone) is a `missing` line, not a warning: `install` exits 1 for it and\n * names `skaile update`, the only command that moves the lock (p1510). An agent that still has\n * its pin keeps running from it, so a library bump alone is silent.\n */\nexport async function pinComposedAgentsReport(\n projectDir: string,\n opts: { repin?: boolean } = {},\n): Promise<{ pinned: string[]; missing: string[] }> {\n const cacheDir = agentSourceCacheDir(projectDir);\n const pinned: string[] = [];\n const missing: string[] = [];\n if (!existsSync(cacheDir)) return { pinned, missing };\n for (const entry of readdirSync(cacheDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n const agentDir = path.join(cacheDir, entry.name);\n const manifest = await loadAgentManifest(agentDir);\n if (!manifest) continue;\n const wanted = !!manifest.composes?.length && needsPin(manifest.composes);\n // `update` re-runs the rebuild for an agent that was pinned: the pin hashes bytes it moved.\n if (!wanted && !(opts.repin && (await hasCompilePin(agentDir)))) continue;\n const composes = manifest.composes ?? [];\n let items: AgentComposeItem[] = [];\n const source = createCompositionContentSource({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n try {\n const files = await hashAgentFiles(agentDir);\n items = effectiveComposes(\n composes,\n files.map((f) => f.path),\n );\n if (await isCompilePinCurrent({ agentDir, items, source })) continue;\n const result = await compileComposition({ agentDir, items, source });\n pinned.push(entry.name);\n logInfo(\n `Compiled agent ${manifest.name ?? entry.name} (${result.resolvedCount} composition items) → prompt v${result.manifest.prompt_version}`,\n );\n } catch (err) {\n if (err instanceof CompositionError && err.code === \"composition_asset_missing\") {\n // The bytes the lock pins are gone, but the pin that was compiled from them still\n // serves `run`: nothing for install to report.\n if (await hasCompilePin(agentDir)) continue;\n for (const line of await missingLines(items, source, err, entry.name)) {\n if (!missing.includes(line)) missing.push(line);\n }\n continue;\n }\n const reason = err instanceof Error ? err.message : String(err);\n const code = err && typeof err === \"object\" && \"code\" in err ? `${String(err.code)}: ` : \"\";\n logWarn(`Could not compile agent ${entry.name}: ${code}${reason}`);\n }\n }\n return { pinned, missing };\n}\n\n/** Whether the agent folder holds a readable compile pin. */\nasync function hasCompilePin(agentDir: string): Promise<boolean> {\n try {\n return (await loadCompileManifestFromDir(agentDir)) !== undefined;\n } catch {\n return false;\n }\n}\n\n/** One line per item the source cannot serve (the compile names only the first). */\nasync function missingLines(\n items: readonly AgentComposeItem[],\n source: CompositionContentSource,\n first: CompositionError,\n agentName: string,\n): Promise<string[]> {\n const lines = [missingLine(first, agentName)];\n for (const item of items) {\n try {\n await source.load(item.ref, item.kind);\n } catch (err) {\n if (err instanceof CompositionError && err.code === \"composition_asset_missing\") {\n lines.push(missingLine(err, agentName));\n }\n }\n }\n return [...new Set(lines)];\n}\n","import { homedir } from \"node:os\";\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n AssetManager,\n type ContentHeld,\n type InstalledAgentInstance,\n type LibraryMove,\n type ReplacedAsset,\n type RewrittenAgent,\n} from \"@skaile/workspaces/asset-manager\";\nimport {\n type AgentInstanceConfig,\n AgentRefResolutionError,\n type HarnessName,\n effectiveAgentInstances,\n globalSkaileDir,\n type PresetExpansion,\n parseAssetRef,\n readLock,\n resolveAgentDefinitionDir,\n resolveSkWorkspaceConfig,\n SourceEntryError,\n userConfigPath,\n} from \"@skaile/workspaces/core\";\nimport {\n isCompositionError,\n loadAgentManifest,\n resolveAgentInstance,\n verifyConventionItems,\n} from \"@skaile/workspaces/runner\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport {\n colorRef,\n requireProjectConfig,\n formatSoftDepHint,\n deferredWarnings,\n logErr,\n logInfo,\n logOk,\n logWarn,\n parseHarnessFilter,\n reportLegacyOmpCopies,\n S,\n TARGET_DEFAULT_HINT,\n warnFilesOnlyDelegates,\n warnStaleHarnessCopies,\n warnPlaceholderBodies,\n} from \"../helpers.ts\";\nimport {\n agentInstanceErrorLines,\n agentInstanceWarningLines,\n reportProjectConfig,\n reportUnknownHarnesses,\n} from \"../config-checks.ts\";\nimport { createSpinner } from \"../spinner.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport { pinComposedAgentsReport } from \"../agent-pins.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nexport const REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile-ai/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Canonical asset ref (`kind:@<publisher>/<name>#<version>`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Print one summary line per `preset:` dependency `skaile install` expanded: how many\n * asset items joined the install set and how many instance items (`library://`,\n * placeholders) were skipped, which only `skaile preset apply` materialises.\n */\nexport function reportPresetExpansions(\n presets: readonly PresetExpansion[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const preset of presets ?? []) {\n onLine(\n `preset ${preset.ref}: ${preset.assets} assets, ${preset.skipped} instance items skipped (apply with skaile preset apply)`,\n );\n }\n}\n\n/**\n * Print one line per agent instance `skaile install` rendered (with the files\n * written) and one per native agent file removed because its instance left `skaile.yaml`.\n */\nexport function reportAgentInstances(\n instances: readonly InstalledAgentInstance[] | undefined,\n removedFiles: readonly string[] | undefined,\n onLine: (line: string) => void = logInfo,\n onRemoved: (line: string) => void = logWarn,\n): void {\n for (const instance of instances ?? []) {\n onLine(`agent ${instance.id}: ${instance.files.join(\", \")}`);\n }\n for (const file of removedFiles ?? []) onRemoved(`Removed: ${file}`);\n}\n\n/** One `Re-locked` line per lock entry `install`/`update` rewrote for an already-locked asset. */\nexport function reportRelocked(\n relocked: string[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const ref of relocked ?? []) onLine(`Re-locked ${ref}`);\n}\n\n/**\n * One line per locked library asset whose library holds the locked version with other bytes.\n * `install` keeps the lock and the deployed copy; only `update` takes the edit (OQ13, p1911).\n * The project does not match its library, as `check` says, so the run exits 1.\n */\nexport function reportContentHeld(\n held: ContentHeld[] | undefined,\n onLine: (line: string) => void = logWarn,\n): void {\n for (const h of held ?? []) {\n onLine(\n `${h.ref.split(\"#\")[0]}: library \"${h.library}\" changed since lock (same version ${h.version}). Run ${S.cmd(\"skaile update\")} to take the change.`,\n );\n process.exitCode = 1;\n }\n}\n\n/** One line per global entry `install --global` limited to the one harness that holds its copy (p1442). */\nexport function reportInferredHarnesses(\n inferred: readonly { ref: string; harnesses: readonly string[] }[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const i of inferred ?? []) {\n onLine(\n `${i.ref} stays on ${i.harnesses.join(\", \")} (its only copy); add it to another harness with \\`skaile add ${i.ref} --global --harness <id>\\``,\n );\n }\n}\n\n/** One `! <ref> moved from <a> to <b>` line per locked asset that now resolves from another library. */\nexport function reportMoved(\n moved: readonly LibraryMove[] | undefined,\n onLine: (line: string) => void = logWarn,\n): void {\n for (const m of moved ?? []) onLine(`${m.ref} moved from ${m.from} to ${m.to}`);\n}\n\n/** One `replaced <old> → <new>` line per asset `install`/`update` moved to another locked version. */\nexport function reportReplaced(\n replaced: readonly ReplacedAsset[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of replaced ?? []) onLine(`${r.ref} replaced ${r.from} → ${r.to}`);\n}\n\n/** One `Rewrote <file> (agent render changed)` line per rendered agent file whose bytes the CLI's render changed. */\nexport function reportRewritten(\n rewritten: readonly RewrittenAgent[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of rewritten ?? []) {\n for (const f of r.files) onLine(`Rewrote ${f} (agent render changed)`);\n }\n}\n\n/**\n * Say which locked store assets `install`/`update` did not check against the store (p792,\n * p799). A chosen mode (air-gapped, `--no-catalog`) is one info line per asset; a store that\n * did not answer is an error line `store unreachable: could not check <ref> for updates`.\n *\n * @returns Whether any asset could not be checked because the store was unreachable: the\n * command then ends `Failed` with exit 1.\n */\nexport function reportStoreNotChecked(\n notChecked: readonly { ref: string; reason: string; detail: string }[] | undefined,\n): boolean {\n let unreachable = false;\n for (const n of notChecked ?? []) {\n if (n.reason === \"unreachable\") {\n unreachable = true;\n logErr(`store unreachable: could not check ${n.ref} for updates (${n.detail})`);\n } else if (n.reason === \"air-gapped\") {\n logInfo(`${n.ref} kept as locked (air-gapped: not checked against the store)`);\n } else {\n logInfo(`${n.ref} kept as locked (${n.detail})`);\n }\n }\n return unreachable;\n}\n\n/**\n * Say which refs `outdated`, `check` or `doctor` could not check against the store\n * (`AssetManager.takeStoreNotChecked`). A store that did not answer is one error\n * line per ref (`store unreachable: <ref> not checked (<why>)`); an air-gapped client\n * (`catalog.cache_ttl: 0`) chose not to ask, so its refs are one info line each.\n *\n * @returns Whether any ref was not checked because the store was unreachable: the command then\n * exits 1, as `install` and `update` do.\n */\nexport function reportStoreNotCheckedForUpdates(\n notChecked: readonly { ref: string; reason: string; detail: string }[],\n): boolean {\n let unreachable = false;\n for (const n of notChecked) {\n if (n.reason === \"air-gapped\") {\n logInfo(`${n.ref} not checked (air-gapped: the store was not asked)`);\n } else {\n unreachable = true;\n logErr(`store unreachable: ${n.ref} not checked (${n.detail})`);\n }\n }\n return unreachable;\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * harness target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install kind:@<publisher>/<name>#<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global harness\",\n )\n .option(\n \"--harness <ids>\",\n \"Comma-separated global harnesses to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .option(\n \"--force\",\n \"Deploy over a folder no lock entry owns (a hand-made skill of the same name), and prune an undeclared asset whose folder holds your edits, instead of refusing\",\n )\n .option(\n \"--verbose\",\n \"also print the resolver's searched directories for an agent it cannot find\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\nexport interface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target?: string;\n global?: boolean;\n harness?: string;\n link?: boolean;\n force?: boolean;\n verbose?: boolean;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n // The store installs one exact version; without `#<version>` it answers a bare 400, so say\n // what is missing before the call.\n if (!parseAssetRef(ref).pin) {\n logErr(\n `${ref} needs a version: use ${ref}#<version>. A library asset is deployed with \\`skaile add ${ref}\\`, not \\`skaile install\\`.`,\n );\n process.exit(1);\n }\n const spinner = createSpinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n `in ${userConfigPath()}.`,\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(\n `Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`,\n ),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/failed: 404\\b/.test(msg)) {\n logErr(\n `${ref} is not in the store. For a library asset use \\`skaile add ${ref.replace(/#.*$/, \"\")}\\`.`,\n );\n } else if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). Also runs `skaile harness set`. */\nexport async function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const harnesses = parseHarnessFilter(opts.harness);\n // `--harness` implies `--global`.\n if (opts.global || harnesses) {\n await runGlobalInstall(opts, harnesses);\n return;\n }\n\n // A project without a readable skaile.yaml stops here, before sources are cloned, assets\n // are deployed or undeployed, or the lock is written.\n requireProjectConfig(projectDir);\n\n // Refuse what `validate` rejects for the `agents:` map, before anything is written (p1512);\n // a key of `agent:` or `agents:` that nothing reads warns (p1712).\n for (const line of agentInstanceWarningLines(projectDir)) logWarn(line);\n const instanceErrors = agentInstanceErrorLines(projectDir);\n if (instanceErrors.length > 0) {\n for (const line of instanceErrors) logErr(line);\n process.exit(1);\n }\n // A `harness:` nothing registers fails as in `validate` and `check` (p1754).\n if ((await reportUnknownHarnesses(projectDir)) > 0) process.exit(1);\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const warnings = deferredWarnings();\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir,\n harness: opts.target as HarnessName,\n onLibraryCollision: warnings.push,\n });\n const spinner = createSpinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link, force: opts.force });\n const storeUnreachable = result.storeNotChecked?.some((n) => n.reason === \"unreachable\");\n spinner.stop(\n result.agentInstanceErrors?.length ||\n result.missing.length > 0 ||\n storeUnreachable ||\n result.contentHeld?.length\n ? \"Failed\"\n : \"Done\",\n );\n warnings.flush();\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n warnPlaceholderBodies(result.placeholderBodies, result.placeholderDescriptions);\n for (const r of result.restored ?? []) {\n for (const f of r.restored) logInfo(`Restored ${f}`);\n for (const f of r.removed) logInfo(`Removed ${f} (not part of ${r.ref})`);\n }\n reportRewritten(result.rewritten);\n for (const line of result.libraryNotices ?? []) logInfo(line);\n reportPresetExpansions(result.presets);\n reportAgentInstances(result.agentInstances, result.agentFilesRemoved);\n // Said when this install wrote an agent file (a fresh clone, a changed agent), not when it only\n // restored a skill or did nothing (p1673).\n if (\n result.deployed.some((d) => d.startsWith(\"agent:\")) ||\n result.replaced?.some((r) => r.ref.startsWith(\"agent:\")) ||\n result.agentInstancesChanged?.length\n ) {\n warnFilesOnlyDelegates(am.projectDir, am.harness);\n }\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n reportMoved(result.moved);\n reportContentHeld(result.contentHeld);\n const pins = await pinComposedAgentsReport(projectDir);\n const missing = [...result.missing, ...pins.missing];\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n missing.length === 0 &&\n !result.storeNotChecked?.length &&\n !result.restored?.length &&\n !result.relocked?.length &&\n !result.contentHeld?.length &&\n !result.moved?.length &&\n !result.agentInstanceErrors?.length\n ) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.agentInstanceErrors?.length) {\n if (opts.verbose) for (const d of result.agentInstanceDetails ?? []) logInfo(S.dim(d));\n logErr(\n `${result.agentInstanceErrors.length} agent instance(s) could not be rendered (see above)`,\n );\n process.exitCode = 1;\n }\n if (missing.length > 0) {\n for (const m of missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (reportStoreNotChecked(result.storeNotChecked)) process.exitCode = 1;\n // A ref that only resolved once the assets were installed (a catalog agent) is checked now.\n const lateInstanceErrors = agentInstanceErrorLines(projectDir);\n for (const line of lateInstanceErrors) logErr(line);\n if (lateInstanceErrors.length > 0) process.exitCode = 1;\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n warnStaleHarnessCopies(am);\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(err instanceof SourceEntryError ? err.message : String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-harness install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global harness's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-harness\n * state. `harnesses` is the `--harness` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n harnesses: HarnessName[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses,\n });\n const spinner = createSpinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link, force: opts.force });\n const storeUnreachable = result.storeNotChecked?.some((n) => n.reason === \"unreachable\");\n spinner.stop(\n result.missing.length > 0 || storeUnreachable || result.contentHeld?.length\n ? \"Failed\"\n : \"Done\",\n );\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n warnPlaceholderBodies(result.placeholderBodies, result.placeholderDescriptions);\n reportPresetExpansions(result.presets);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n reportInferredHarnesses(result.inferredHarnesses);\n reportMoved(result.moved);\n reportContentHeld(result.contentHeld);\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n result.missing.length === 0 &&\n !result.storeNotChecked?.length &&\n !result.relocked?.length &&\n !result.contentHeld?.length &&\n !result.moved?.length\n )\n logInfo(\"Nothing to install (already up to date).\");\n if (reportStoreNotChecked(result.storeNotChecked)) process.exitCode = 1;\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n reportLegacyOmpCopies(am.takeLegacyCopiesRemoved(), am.takeLegacyCopiesKept());\n\n // Per-harness reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byHarness = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byHarness.set(s.harness, (byHarness.get(s.harness) ?? 0) + 1);\n for (const [harness, n] of byHarness) logInfo(`${harness}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/** The `--global` options of `check`, `doctor` and `clean`. */\ninterface GlobalScopeOptions {\n global?: boolean;\n harness?: string;\n projectDir: string;\n}\n\n/** A manager over the user-scope SSOT (`~/.skaile`), limited to `--harness` when given. */\nfunction globalManager(opts: GlobalScopeOptions): AssetManager {\n return new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses: parseHarnessFilter(opts.harness),\n });\n}\n\n/**\n * What is wrong with the global install: one line per declared asset a harness does not hold\n * (`list --global` calls these `declared` and `drift`), per invalid entry, and per old\n * `~/.omp/<dir>` copy a 5.12.0 install left behind. Empty when the global state is clean (p911).\n */\nexport function globalProblems(am: AssetManager): string[] {\n const lines = new Set<string>();\n for (const row of am.globalState({})) {\n if (row.state === \"declared\") {\n lines.add(\n `${row.ref} is declared in ~/.skaile/skaile.yaml but not installed: run skaile install --global`,\n );\n } else if (row.state === \"drift\") {\n lines.add(\n `${row.ref} is missing from ${row.harness}: run skaile install --global --harness ${row.harness}`,\n );\n } else if (row.state === \"invalid\") {\n lines.add(`${row.ref} in ~/.skaile/skaile.yaml is not a valid asset ref`);\n }\n }\n for (const stale of am.staleLegacyOmpCopies()) {\n lines.add(\n `${stale.path.replace(homedir(), \"~\")} is an old omp copy of ${stale.ref} (omp reads ~/.omp/agent): run skaile install --global --harness omp, or delete it`,\n );\n }\n return [...lines];\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Fails (exit 1) on every problem {@link AssetManager.projectState} reports: unmet\n * requirements of deployed assets, a declared dep that never resolved into the lock (its\n * library or source is gone, like `skaile list` showing it as `declared`) or never\n * materialized (e.g. a store-sourced `mcp-server`, #462), a locked asset whose library is\n * gone or whose deployed copy or files are missing, a locked library asset whose files\n * changed since the lock (or whose lock hash predates the shared asset hash), and an\n * `agents.<id>.ref` that binds to no agent. `doctor`, `outdated`, `diff` and\n * `install --locked` take their verdict from the same state.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--global\", \"Check the global install (~/.skaile) instead of the project\")\n .option(\"--harness <ids>\", \"With --global: only these harnesses (comma-separated)\")\n .action(async (opts) => {\n if (opts.global || opts.harness) {\n const problems = globalProblems(globalManager({ ...opts, global: true }));\n if (problems.length === 0) {\n logOk(\"All global dependencies satisfied.\");\n return;\n }\n for (const line of problems) logErr(line);\n process.exit(1);\n }\n requireProjectConfig(opts.projectDir);\n // A mistyped key warns; a `harness:` nothing registers fails like a gap (p1474, p1022).\n const configErrors = await reportProjectConfig(path.resolve(opts.projectDir), {\n harness: true,\n instances: true,\n });\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n });\n const { gaps } = await am.projectState();\n const edited = await editedConventionFiles(path.resolve(opts.projectDir));\n // A skipped `mcp-server` or an unset required field fails nothing: a `!` line each.\n const notices = [\n ...(await am.mcpNotices()).map((n) => n.text),\n // A library that went back past the lock is no drift either (p1257).\n ...(await am.libraryOlderNotices()),\n // A lock written before it listed the instance files: the next write replaces them.\n ...am.legacyLockNotices(),\n ];\n // A store-origin ref the store could not be asked about is not \"satisfied\".\n await am.probeStoreOrigins();\n const notChecked = am.takeStoreNotChecked();\n const storeUnreachable = notChecked.some((n) => n.reason === \"unreachable\");\n if (gaps.length === 0 && edited.length === 0 && configErrors === 0 && !storeUnreachable) {\n logOk(\"All dependencies satisfied.\");\n for (const n of notices) logWarn(n);\n reportStoreNotCheckedForUpdates(notChecked);\n } else {\n for (const g of gaps) logErr(g.message);\n for (const e of edited) logErr(e);\n for (const n of notices) logWarn(n);\n reportStoreNotCheckedForUpdates(notChecked);\n process.exit(1);\n }\n });\n}\n\n/**\n * One message per convention file (SOUL.md, knowledge/, …) of a bound agent that was edited\n * after `skaile rebuild` pinned it: the compile manifest, not the file, is what the agent\n * runs from, so the edit never reaches it. Also one message per bound agent that `skaile run`\n * would refuse with `composition_rebuild_required` (an `inline-snapshot` item with no compile\n * pin, or a pin that is stale or malformed), in the words `run` prints (p1310). Instances bound\n * to the same agent directory share the files, so one message names every instance that runs\n * from them. A binding that resolves to no agent is a `projectState` gap, not reported here.\n * Shared by `check` and `doctor`.\n */\nexport async function editedConventionFiles(projectDir: string): Promise<string[]> {\n const instances = effectiveAgentInstances(resolveSkWorkspaceConfig(projectDir));\n const byDir = new Map<string, { ref: string; ids: string[]; instance: AgentInstanceConfig }>();\n for (const [id, instance] of Object.entries(instances)) {\n let agentDir: string | undefined;\n try {\n agentDir = resolveAgentDefinitionDir(projectDir, instance.ref);\n } catch (err) {\n if (err instanceof AgentRefResolutionError) continue;\n throw err;\n }\n if (!agentDir) continue;\n if (path.basename(agentDir) === \"agent.yaml\") agentDir = path.dirname(agentDir);\n const bound = byDir.get(agentDir);\n if (bound) bound.ids.push(id);\n else byDir.set(agentDir, { ref: instance.ref, ids: [id], instance });\n }\n const messages: string[] = [];\n for (const [agentDir, { ref, ids, instance }] of byDir) {\n const label = `${ids.length === 1 ? \"instance\" : \"instances\"} ${ids.join(\", \")}`;\n try {\n const drifted = await verifyConventionItems({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n for (const err of drifted) messages.push(`${ref} (${label}): ${err.message}`);\n const manifest = await loadAgentManifest(agentDir);\n if (manifest) {\n await resolveAgentInstance({\n instanceId: ids[0]!,\n instance,\n asset: { manifest, dir: agentDir },\n projectDir,\n registry: getKindRegistry(),\n host: { nativeSubagents: true },\n dryRun: true,\n });\n }\n } catch (err) {\n if (!isCompositionError(err)) throw err;\n // Only the error `run` raises for a missing pin; other composition errors are not `check`'s.\n if (err.code === \"composition_rebuild_required\") {\n messages.push(`${ref} (${label}): ${err.code}: ${err.message}`);\n }\n }\n }\n return messages;\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\"--global\", \"Clean the global install (~/.skaile and every global harness)\")\n .option(\"--harness <ids>\", \"With --global: only these harnesses (comma-separated)\")\n .action(async (opts) => {\n const isGlobal = Boolean(opts.global || opts.harness);\n // A skaile.yaml that does not parse stops `clean` with one `✗` line (p910).\n if (!isGlobal) requireProjectConfig(opts.projectDir, { allowMissing: true });\n const am = isGlobal\n ? globalManager({ ...opts, global: true })\n : new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n harness: opts.target as HarnessName,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(\n isGlobal\n ? path.join(globalSkaileDir(), \"skaile.lock.yaml\")\n : path.resolve(opts.projectDir, \"skaile.lock.yaml\"),\n );\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n if (!isGlobal) {\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n }\n console.log(` ${S.dim(isGlobal ? \"~/.skaile/skaile.lock.yaml\" : \"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { openLibrary } from './chunk-HKRME377.js';
1
+ import { openLibrary } from './chunk-SVMIUCTT.js';
2
2
  import { getKindRegistry } from './chunk-QCR5AE5E.js';
3
- import { S, logErr, logWarn, logOk, logInfo } from './chunk-3NJFPGEB.js';
4
- import { resolveBinding, UnknownCompositionKindError } from './chunk-K7ZGY2BY.js';
3
+ import { S, logErr, logWarn, logOk, logInfo } from './chunk-DXBHGNSI.js';
4
+ import { resolveBinding, UnknownCompositionKindError } from './chunk-OLZE4IHX.js';
5
5
  import { filesEntryPaths, assetRootProblem, stampManifestPublisher, upsertManifestAsset, resolveIndexPath, LocalIndex } from './chunk-G44FFUMA.js';
6
6
  import { SEMVER_RE, invalidSemverMessage, flowFileNameError, parseManifestFile, requiresSyntaxErrors } from './chunk-O5Y7VMVQ.js';
7
7
  import { parseFlowDefinition } from './chunk-JRN5QF4C.js';
@@ -1391,5 +1391,5 @@ function warnUntrackedAssetFiles(libPath) {
1391
1391
  }
1392
1392
 
1393
1393
  export { DEFAULT_VERSION, DOMAIN_REMOVED_HINT, MANIFEST_GLOBS, assetEntryRef, assetNamespace, bareName, checkAsset, checkAssetFile, checkComposeKinds, composeRefContext, declaredVersion, deviceLogin, duplicateAssetMessage, exitOnEmptyAsset, exitOnLibrarySymlinks, exitOnManifestPathProblems, exitOnManifestPublisherProblems, findAssetManifestFile, findEntryManifestFile, formatNamespaceAvailability, getAccessToken, getStoreIdentity, hasStoredAuth, indexLibrary, invalidPublisherMessage, invalidSemverText, libraryAssetRefusals, loadStoreAuthConfig, logout, manifestDependencyProblems, manifestEntryFilesRefusals, manifestEntryNameProblems, manifestEntryRenames, manifestEntryRootRefusals, manifestFilesProblems, manifestNamespaces, manifestParseErrorText, manifestParseFailureLine, manifestPublisherProblems, manifestRequiresProblems, manifestRootProblems, manifestVersionMismatchMessage, plannedRefs, preflightNamespace, publishToStore, refFor, registerLibraryAsset, registeredAssetKeys, rejectRemovedDomainOption, removedDomainOption, reportLibrarySymlinks, requireValidPublisherOrExit, resolveLibraryPublisherDetailed, unheldRequiresOfFile, unresolvedManifestDependencies, warnIgnoredDomainFiles, warnLegacyBundleFiles, warnLibraryNameFallback, warnUntrackedAssetFiles };
1394
- //# sourceMappingURL=chunk-Q6FKWPRO.js.map
1395
- //# sourceMappingURL=chunk-Q6FKWPRO.js.map
1394
+ //# sourceMappingURL=chunk-Z5EPCIB6.js.map
1395
+ //# sourceMappingURL=chunk-Z5EPCIB6.js.map