@skaile/workspaces 1.6.0 → 1.7.0

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 (156) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/dist/app-sdk/index.js +22 -7
  3. package/dist/app-sdk/index.js.map +1 -1
  4. package/dist/app-sdk/src/connection-params.d.ts +7 -0
  5. package/dist/app-sdk/src/connection-params.d.ts.map +1 -1
  6. package/dist/{asset-feeds-T35ELX2O.js → asset-feeds-Y66NCOQZ.js} +11 -11
  7. package/dist/asset-feeds-Y66NCOQZ.js.map +1 -0
  8. package/dist/asset-manager/index.js +6 -6
  9. package/dist/asset-manager/installer.js +4 -4
  10. package/dist/asset-manager/src/index.d.ts +18 -0
  11. package/dist/asset-manager/src/index.d.ts.map +1 -1
  12. package/dist/{chunk-HY33RMEA.js → chunk-5NZ56R63.js} +3 -3
  13. package/dist/{chunk-HY33RMEA.js.map → chunk-5NZ56R63.js.map} +1 -1
  14. package/dist/{chunk-ZBZQC5R7.js → chunk-7J7LQP6T.js} +3 -3
  15. package/dist/{chunk-ZBZQC5R7.js.map → chunk-7J7LQP6T.js.map} +1 -1
  16. package/dist/{chunk-WYGXYGJH.js → chunk-7VGRRH2L.js} +9 -9
  17. package/dist/{chunk-WYGXYGJH.js.map → chunk-7VGRRH2L.js.map} +1 -1
  18. package/dist/{chunk-RDYOU6N6.js → chunk-BSXBOKL6.js} +2 -2
  19. package/dist/{chunk-RDYOU6N6.js.map → chunk-BSXBOKL6.js.map} +1 -1
  20. package/dist/{chunk-UQKYT4V6.js → chunk-ISA7R7PK.js} +3 -3
  21. package/dist/{chunk-UQKYT4V6.js.map → chunk-ISA7R7PK.js.map} +1 -1
  22. package/dist/{chunk-J5TI55E7.js → chunk-MB6563TL.js} +37 -8
  23. package/dist/chunk-MB6563TL.js.map +1 -0
  24. package/dist/{chunk-FDE7XRQA.js → chunk-MWE7DEGC.js} +3 -3
  25. package/dist/{chunk-FDE7XRQA.js.map → chunk-MWE7DEGC.js.map} +1 -1
  26. package/dist/{chunk-KMY7HVQ6.js → chunk-O3D4KYFG.js} +3 -3
  27. package/dist/{chunk-KMY7HVQ6.js.map → chunk-O3D4KYFG.js.map} +1 -1
  28. package/dist/{chunk-JIDKX7GC.js → chunk-PP2LOT4W.js} +43 -7
  29. package/dist/chunk-PP2LOT4W.js.map +1 -0
  30. package/dist/{chunk-2DWXGUZA.js → chunk-QHU6TM7D.js} +2 -2
  31. package/dist/{chunk-2DWXGUZA.js.map → chunk-QHU6TM7D.js.map} +1 -1
  32. package/dist/{chunk-6NR2BEIY.js → chunk-STQOPWPS.js} +4 -4
  33. package/dist/{chunk-6NR2BEIY.js.map → chunk-STQOPWPS.js.map} +1 -1
  34. package/dist/{chunk-BEO6KN7P.js → chunk-SZY7X4M2.js} +5 -5
  35. package/dist/{chunk-BEO6KN7P.js.map → chunk-SZY7X4M2.js.map} +1 -1
  36. package/dist/{chunk-CBA2XIBF.js → chunk-TC3GLA5D.js} +31 -16
  37. package/dist/chunk-TC3GLA5D.js.map +1 -0
  38. package/dist/{chunk-RSYV7XEN.js → chunk-TITPPC54.js} +4 -4
  39. package/dist/{chunk-RSYV7XEN.js.map → chunk-TITPPC54.js.map} +1 -1
  40. package/dist/{chunk-DMG6NJH7.js → chunk-VBRXFLIP.js} +4 -4
  41. package/dist/{chunk-DMG6NJH7.js.map → chunk-VBRXFLIP.js.map} +1 -1
  42. package/dist/{chunk-2ZMO4CFG.js → chunk-VK24PIAB.js} +5 -4
  43. package/dist/chunk-VK24PIAB.js.map +1 -0
  44. package/dist/{chunk-3CHARYD4.js → chunk-Y3UCU4ZK.js} +99 -28
  45. package/dist/chunk-Y3UCU4ZK.js.map +1 -0
  46. package/dist/{chunk-KEQ4GLVM.js → chunk-Y6FV73IH.js} +58 -4
  47. package/dist/chunk-Y6FV73IH.js.map +1 -0
  48. package/dist/cli/index.js +589 -194
  49. package/dist/cli/index.js.map +1 -1
  50. package/dist/cli/src/asset-feeds.d.ts.map +1 -1
  51. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  52. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  53. package/dist/cli/src/commands/library-index.d.ts +59 -0
  54. package/dist/cli/src/commands/library-index.d.ts.map +1 -0
  55. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  56. package/dist/cli/src/commands/manage.d.ts +22 -1
  57. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  58. package/dist/cli/src/commands/publish-core.d.ts +24 -0
  59. package/dist/cli/src/commands/publish-core.d.ts.map +1 -1
  60. package/dist/cli/src/commands/session-logs/remote-query.d.ts.map +1 -1
  61. package/dist/cli/src/commands/session-logs/remote-tail.d.ts.map +1 -1
  62. package/dist/cli/src/commands/session-logs/superjson-transformer.d.ts +12 -0
  63. package/dist/cli/src/commands/session-logs/superjson-transformer.d.ts.map +1 -0
  64. package/dist/cli/src/commands/source-manifest-publish.d.ts.map +1 -1
  65. package/dist/cli/src/commands/store.d.ts.map +1 -1
  66. package/dist/cli/src/paths.d.ts.map +1 -1
  67. package/dist/cli/src/store-auth.d.ts +11 -0
  68. package/dist/cli/src/store-auth.d.ts.map +1 -1
  69. package/dist/cli/src/store-client.d.ts.map +1 -1
  70. package/dist/cli/src/store-publisher.d.ts +24 -1
  71. package/dist/cli/src/store-publisher.d.ts.map +1 -1
  72. package/dist/connectors/config.js +4 -4
  73. package/dist/connectors/index.js +5 -5
  74. package/dist/connectors/src/config.d.ts +21 -0
  75. package/dist/connectors/src/config.d.ts.map +1 -1
  76. package/dist/connectors/src/index.d.ts +1 -1
  77. package/dist/connectors/src/index.d.ts.map +1 -1
  78. package/dist/core/index.js +3 -3
  79. package/dist/core/runtime-assets.js +2 -2
  80. package/dist/core/src/index.d.ts +1 -1
  81. package/dist/core/src/index.d.ts.map +1 -1
  82. package/dist/core/src/repo-manager.d.ts +4 -0
  83. package/dist/core/src/repo-manager.d.ts.map +1 -1
  84. package/dist/core/workspace-config.js +1 -1
  85. package/dist/deploy/index.js +3 -3
  86. package/dist/{ensure-sources-QDVFUIUP.js → ensure-sources-NXBYK5GP.js} +9 -9
  87. package/dist/{ensure-sources-QDVFUIUP.js.map → ensure-sources-NXBYK5GP.js.map} +1 -1
  88. package/dist/factory-assets/connectors/box.js +5 -5
  89. package/dist/factory-assets/connectors/deploy.js +5 -5
  90. package/dist/factory-assets/connectors/devserver.js +5 -5
  91. package/dist/factory-assets/connectors/flow/adapter.js +5 -5
  92. package/dist/factory-assets/connectors/flow/engine.js +3 -3
  93. package/dist/factory-assets/connectors/flow/run-flow.js +6 -6
  94. package/dist/factory-assets/connectors/flow.js +5 -5
  95. package/dist/factory-assets/connectors/git.js +5 -5
  96. package/dist/factory-assets/connectors/gmail.js +5 -5
  97. package/dist/factory-assets/connectors/googledrive.js +5 -5
  98. package/dist/factory-assets/connectors/local.js +5 -5
  99. package/dist/factory-assets/connectors/mattermost.js +5 -5
  100. package/dist/factory-assets/connectors/memory.js +5 -5
  101. package/dist/factory-assets/connectors/minio.js +5 -5
  102. package/dist/factory-assets/connectors/postgres.js +5 -5
  103. package/dist/factory-assets/connectors/s3.js +5 -5
  104. package/dist/factory-assets/connectors/sharepoint.js +5 -5
  105. package/dist/factory-assets/connectors/sqlite.js +5 -5
  106. package/dist/factory-assets/connectors/static-server.js +5 -5
  107. package/dist/factory-assets/connectors/tunnel.js +5 -5
  108. package/dist/factory-assets/connectors/webdav.js +5 -5
  109. package/dist/factory-assets/connectors/xstate-store.js +5 -5
  110. package/dist/factory-assets/connectors/xstate.js +5 -5
  111. package/dist/{flows-MRVXTYWC.js → flows-RR6R3WBL.js} +3 -3
  112. package/dist/{flows-MRVXTYWC.js.map → flows-RR6R3WBL.js.map} +1 -1
  113. package/dist/{helpers-TF7GCBRQ.js → helpers-DN4MWOHB.js} +9 -9
  114. package/dist/{helpers-TF7GCBRQ.js.map → helpers-DN4MWOHB.js.map} +1 -1
  115. package/dist/library/index.js +4 -4
  116. package/dist/library/install.js +3 -3
  117. package/dist/{library-publish-K5IBE44D.js → library-publish-TPWFSO3Q.js} +44 -20
  118. package/dist/library-publish-TPWFSO3Q.js.map +1 -0
  119. package/dist/{open-library-4HMIDK3N.js → open-library-ST2VFQTK.js} +10 -10
  120. package/dist/{open-library-4HMIDK3N.js.map → open-library-ST2VFQTK.js.map} +1 -1
  121. package/dist/paths-KOKCMBL5.js +21 -0
  122. package/dist/{paths-P3DWFUPS.js.map → paths-KOKCMBL5.js.map} +1 -1
  123. package/dist/{plugin-store-S7OMGI7N.js → plugin-store-QMJ2B3VM.js} +5 -5
  124. package/dist/{plugin-store-S7OMGI7N.js.map → plugin-store-QMJ2B3VM.js.map} +1 -1
  125. package/dist/runner/index.js +7 -7
  126. package/dist/runner/src/resources.d.ts +8 -2
  127. package/dist/runner/src/resources.d.ts.map +1 -1
  128. package/dist/runner/src/serve.d.ts.map +1 -1
  129. package/dist/runner/src/session-builder.d.ts +10 -0
  130. package/dist/runner/src/session-builder.d.ts.map +1 -1
  131. package/dist/sdk/asset-manager.js +6 -6
  132. package/dist/sdk/core.js +3 -3
  133. package/dist/sdk/flow.js +3 -3
  134. package/dist/sdk/index.js +7 -7
  135. package/dist/sdk/runner.js +7 -7
  136. package/dist/{setup-2CCS63L6.js → setup-ETGRXSZG.js} +5 -5
  137. package/dist/{setup-2CCS63L6.js.map → setup-ETGRXSZG.js.map} +1 -1
  138. package/dist/{source-LOAM7IIQ.js → source-R4TWF424.js} +11 -11
  139. package/dist/{source-LOAM7IIQ.js.map → source-R4TWF424.js.map} +1 -1
  140. package/dist/{source-manifest-publish-TGVZ6KMC.js → source-manifest-publish-FXDK2BCI.js} +17 -15
  141. package/dist/source-manifest-publish-FXDK2BCI.js.map +1 -0
  142. package/dist/tui/index.js +7 -7
  143. package/dist/workspace-plugin/adapters/mcp.js +1 -1
  144. package/dist/workspace-plugin/adapters/omp.js +3 -3
  145. package/dist/workspace-plugin/index.js +1 -1
  146. package/package.json +1 -1
  147. package/dist/asset-feeds-T35ELX2O.js.map +0 -1
  148. package/dist/chunk-2ZMO4CFG.js.map +0 -1
  149. package/dist/chunk-3CHARYD4.js.map +0 -1
  150. package/dist/chunk-CBA2XIBF.js.map +0 -1
  151. package/dist/chunk-J5TI55E7.js.map +0 -1
  152. package/dist/chunk-JIDKX7GC.js.map +0 -1
  153. package/dist/chunk-KEQ4GLVM.js.map +0 -1
  154. package/dist/library-publish-K5IBE44D.js.map +0 -1
  155. package/dist/paths-P3DWFUPS.js +0 -15
  156. package/dist/source-manifest-publish-TGVZ6KMC.js.map +0 -1
package/dist/cli/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { AI_RESOURCES, aiResourceRoots } from '../chunk-2ZMO4CFG.js';
3
- import { getStoreConfig, storeFetch, deviceLogin, loadStoreAuthConfig, logout, hasStoredAuth, isStoreAuthenticated, getStoreToken } from '../chunk-J5TI55E7.js';
4
- import { makeSourceCommand, syncProjectSources } from '../chunk-WYGXYGJH.js';
5
- import { openCatalogSource, openLibraryManager, createFullRegistry, openLibrary } from '../chunk-RSYV7XEN.js';
6
- import { logErr, S, logOk, logInfo, colorRef, logWarn, kindColorPad, kindColor, formatSoftDepSection, bareSoftDepName, formatSoftDepHint, formatRelativeTime, fitWidth, formatSoftDepRemovePreview, formatSoftDepAddPreview } from '../chunk-KMY7HVQ6.js';
2
+ import { AI_RESOURCES, aiResourceRoots } from '../chunk-VK24PIAB.js';
3
+ import { getStoreConfig, storeFetch, deviceLogin, loadStoreAuthConfig, logout, hasStoredAuth, isStoreAuthenticated, getStoreToken, getStoreIdentity } from '../chunk-MB6563TL.js';
4
+ import { makeSourceCommand, syncProjectSources } from '../chunk-7VGRRH2L.js';
5
+ import { openCatalogSource, openLibraryManager, createFullRegistry, openLibrary } from '../chunk-TITPPC54.js';
6
+ import { logErr, S, logOk, logInfo, colorRef, logWarn, kindColorPad, kindColor, formatSoftDepSection, bareSoftDepName, formatSoftDepHint, formatRelativeTime, formatSoftDepRemovePreview, formatSoftDepAddPreview, fitWidth } from '../chunk-O3D4KYFG.js';
7
7
  import { LocalSecretsProvider } from '../chunk-6BEGKO2Q.js';
8
- import { runFlow, resumeFlow } from '../chunk-BEO6KN7P.js';
8
+ import { runFlow, resumeFlow } from '../chunk-SZY7X4M2.js';
9
9
  import '../chunk-4R6DROGN.js';
10
10
  import { validateFlowVersions, parseSkillFrontmatter } from '../chunk-GXC3TYMQ.js';
11
- import { runAgentChat, loadSessionById, loadSession, listSessions, setCurrentSession, deleteSession, clearSession, loadAgentManifest, compileComposition, MarkdownStreamer, resolveMixin } from '../chunk-CBA2XIBF.js';
12
- import { buildClaudePluginFiles } from '../chunk-RDYOU6N6.js';
11
+ import { runAgentChat, loadSessionById, loadSession, listSessions, setCurrentSession, deleteSession, clearSession, loadAgentManifest, compileComposition, MarkdownStreamer, resolveMixin } from '../chunk-TC3GLA5D.js';
12
+ import { buildClaudePluginFiles } from '../chunk-BSXBOKL6.js';
13
13
  import '../chunk-X5YPJV4N.js';
14
14
  import '../chunk-O7SG5PC2.js';
15
15
  import '../chunk-7QBNJTTQ.js';
@@ -24,27 +24,27 @@ import '../chunk-BMQKMOQY.js';
24
24
  import '../chunk-GAH4YRCI.js';
25
25
  import '../chunk-TNSCHS4I.js';
26
26
  import '../chunk-LV2HPH3C.js';
27
- import '../chunk-DMG6NJH7.js';
28
- import '../chunk-KEQ4GLVM.js';
27
+ import '../chunk-VBRXFLIP.js';
28
+ import '../chunk-Y6FV73IH.js';
29
29
  import '../chunk-6E6PKKAD.js';
30
30
  import { loadFlow, loadAllFlows } from '../chunk-4N5XR5DQ.js';
31
31
  import '../chunk-DEYYRFQU.js';
32
32
  import '../chunk-IFGTRL2I.js';
33
33
  import '../chunk-PK7Q7MC7.js';
34
- import { AssetManager, NON_DEPLOYABLE_KINDS, MissingManifestError, normalizeRepoUrl, FACTORY_SOURCE_URL } from '../chunk-3CHARYD4.js';
35
- import { resolveLibraryDir, getStoreManifestsDir, getDefaultValue, isSecretPlaceholder } from '../chunk-FDE7XRQA.js';
34
+ import { AssetManager, NON_DEPLOYABLE_KINDS, MissingManifestError, normalizeRepoUrl, FACTORY_SOURCE_URL } from '../chunk-Y3UCU4ZK.js';
35
+ import { resolveLibraryDir, getStoreManifestsDir, getDefaultValue, isSecretPlaceholder } from '../chunk-MWE7DEGC.js';
36
36
  import '../chunk-MZV6WCF3.js';
37
37
  import '../chunk-JXT46QFC.js';
38
38
  import '../chunk-UKJMQZV6.js';
39
39
  import '../chunk-R7FOF242.js';
40
- import '../chunk-6NR2BEIY.js';
40
+ import '../chunk-STQOPWPS.js';
41
41
  import '../chunk-CGYEHQOX.js';
42
- import { readLock, resolveSettings, globalSettingsPath, projectSettingsPath, loadSettings, saveSettings, portableSpawn, portableSpawnSync, WorkspaceYamlEditor, checkAgentSkillConformance } from '../chunk-HY33RMEA.js';
42
+ import { readLock, resolveSettings, globalSettingsPath, projectSettingsPath, loadSettings, saveSettings, portableSpawn, portableSpawnSync, WorkspaceYamlEditor, checkAgentSkillConformance } from '../chunk-5NZ56R63.js';
43
43
  import { assetSearchDirs, detectDomains } from '../chunk-ZAP2BDHG.js';
44
- import { factoryAssetRoots } from '../chunk-ZBZQC5R7.js';
45
- import { globalCacheRoot, sourceCacheKey, getGlobalCacheDir, resolveAgentDir, loadSkWorkspaceConfig, resolveSkWorkspaceConfig, storeManifestSlug } from '../chunk-UQKYT4V6.js';
44
+ import { factoryAssetRoots } from '../chunk-7J7LQP6T.js';
45
+ import { globalCacheRoot, sourceCacheKey, getGlobalCacheDir, resolveAgentDir, matchPin, coerceVersion, loadSkWorkspaceConfig, resolveSkWorkspaceConfig, storeManifestSlug } from '../chunk-ISA7R7PK.js';
46
46
  import { SKAILE_MANIFEST_FILENAME, decodeSkaileManifest, loadSkPublishManifest, saveSkPublishManifest } from '../chunk-P4VHQA4N.js';
47
- import { parseFrontmatter } from '../chunk-BQCGFPHW.js';
47
+ import { parseFrontmatter, scanDirectory } from '../chunk-BQCGFPHW.js';
48
48
  import { parseAssetRef, ASSET_KINDS, isValidAssetName, slugifyAssetName, ASSET_NAME_HINT, assetRefToStr } from '../chunk-GEEW6SY2.js';
49
49
  import '../chunk-F3HNW354.js';
50
50
  import { SUPPORTED_DRIVER_TARGETS } from '../chunk-MENCWIHW.js';
@@ -55,12 +55,13 @@ import '../chunk-UQ6LFBPZ.js';
55
55
  import '../chunk-IEX5YV4R.js';
56
56
  import { validatePreset } from '../chunk-IRORTHGA.js';
57
57
  import '../chunk-NSBPE2FW.js';
58
- import * as fs12 from 'fs';
59
- import fs12__default, { readFileSync, existsSync, mkdirSync, writeFileSync, lstatSync, rmSync, readdirSync, statSync } from 'fs';
58
+ import * as fs13 from 'fs';
59
+ import fs13__default, { readFileSync, existsSync, mkdirSync, writeFileSync, lstatSync, rmSync, readdirSync, statSync } from 'fs';
60
60
  import * as path14 from 'path';
61
61
  import path14__default, { resolve, join } from 'path';
62
62
  import { fileURLToPath } from 'url';
63
63
  import { Help, Command, Option } from 'commander';
64
+ import { rcompare } from 'semver';
64
65
  import * as p6 from '@clack/prompts';
65
66
  import pc5 from 'picocolors';
66
67
  import * as os from 'os';
@@ -104,7 +105,7 @@ async function runSearch(kind, query, opts) {
104
105
  }
105
106
  }
106
107
  async function searchIndex(query, kind) {
107
- const { openLibrary: openLibrary2 } = await import('../open-library-4HMIDK3N.js');
108
+ const { openLibrary: openLibrary2 } = await import('../open-library-ST2VFQTK.js');
108
109
  const library = await openLibrary2();
109
110
  try {
110
111
  const defs = await library.listAssetDefs(kind ? { kind } : {});
@@ -156,7 +157,7 @@ async function searchLocal(query, kind, opts, showStore, airGapped) {
156
157
  const factory = searchFactory(projectDir, query, kind);
157
158
  let entries = unionEntries(await searchIndex(query, kind), factory);
158
159
  if (entries.length === 0 && !query && !kind && !airGapped) {
159
- const { autoSyncForSearch } = await import('../source-LOAM7IIQ.js');
160
+ const { autoSyncForSearch } = await import('../source-R4TWF424.js');
160
161
  if (await autoSyncForSearch(projectDir)) {
161
162
  entries = unionEntries(await searchIndex(query, kind), factory);
162
163
  }
@@ -210,7 +211,7 @@ async function searchStore(query, kind, opts, airGapped) {
210
211
  logInfo("air-gapped (cache_ttl: 0) \u2014 local sources only");
211
212
  return;
212
213
  }
213
- const { openCatalogSource: openCatalogSource2, LocalCatalogDisabledError } = await import('../open-library-4HMIDK3N.js');
214
+ const { openCatalogSource: openCatalogSource2, LocalCatalogDisabledError } = await import('../open-library-ST2VFQTK.js');
214
215
  try {
215
216
  const remote = await openCatalogSource2({ projectDir: path14__default.resolve(opts.projectDir) });
216
217
  const assets = await remote.listAssets(kind ? { kind } : {});
@@ -575,16 +576,16 @@ function claudeSkillRoots() {
575
576
  }
576
577
  function resolveImportSource(nameOrPath) {
577
578
  const asPath = path14.resolve(nameOrPath);
578
- if (fs12.existsSync(asPath)) {
579
- const dir = fs12.statSync(asPath).isDirectory() ? asPath : path14.dirname(asPath);
579
+ if (fs13.existsSync(asPath)) {
580
+ const dir = fs13.statSync(asPath).isDirectory() ? asPath : path14.dirname(asPath);
580
581
  const skillFile = path14.join(dir, "SKILL.md");
581
- if (fs12.existsSync(skillFile)) return { dir, skillFile, via: "path" };
582
+ if (fs13.existsSync(skillFile)) return { dir, skillFile, via: "path" };
582
583
  }
583
584
  if (!nameOrPath.includes(path14.sep) && !nameOrPath.startsWith(".")) {
584
585
  for (const root of claudeSkillRoots()) {
585
586
  const dir = path14.join(root, nameOrPath);
586
587
  const skillFile = path14.join(dir, "SKILL.md");
587
- if (fs12.existsSync(skillFile)) return { dir, skillFile, via: "claude-skills" };
588
+ if (fs13.existsSync(skillFile)) return { dir, skillFile, via: "claude-skills" };
588
589
  }
589
590
  }
590
591
  return null;
@@ -652,17 +653,17 @@ function ensureDomain(libraryPath, domain, opts = {}) {
652
653
  const dir = path14.join(libraryPath, domain);
653
654
  const domainFile = path14.join(dir, "DOMAIN.md");
654
655
  const publisher = opts.publisher ?? slugifyAssetName(domain);
655
- if (fs12.existsSync(domainFile)) {
656
+ if (fs13.existsSync(domainFile)) {
656
657
  return { dir, publisher, created: false };
657
658
  }
658
- fs12.mkdirSync(dir, { recursive: true });
659
+ fs13.mkdirSync(dir, { recursive: true });
659
660
  const description = opts.description ?? `The ${domain} domain.`;
660
- fs12.writeFileSync(domainFile, DOMAIN_TEMPLATE(domain, publisher, description), "utf8");
661
+ fs13.writeFileSync(domainFile, DOMAIN_TEMPLATE(domain, publisher, description), "utf8");
661
662
  return { dir, publisher, created: true };
662
663
  }
663
664
  function listDomains(libraryPath) {
664
- if (!fs12.existsSync(libraryPath)) return [];
665
- return fs12.readdirSync(libraryPath, { withFileTypes: true }).filter((e) => e.isDirectory() && fs12.existsSync(path14.join(libraryPath, e.name, "DOMAIN.md"))).map((e) => e.name).sort();
665
+ if (!fs13.existsSync(libraryPath)) return [];
666
+ return fs13.readdirSync(libraryPath, { withFileTypes: true }).filter((e) => e.isDirectory() && fs13.existsSync(path14.join(libraryPath, e.name, "DOMAIN.md"))).map((e) => e.name).sort();
666
667
  }
667
668
  function upsertManifestAsset(libraryPath, input) {
668
669
  const manifest = loadSkPublishManifest(libraryPath) ?? { assets: [] };
@@ -684,6 +685,25 @@ function upsertManifestAsset(libraryPath, input) {
684
685
  }
685
686
 
686
687
  // cli/src/commands/asset-cmd.ts
688
+ async function resolveDefByRef(library, ref, opts) {
689
+ const inScope = (d) => !opts?.fromLibraryId || d.libraryId === opts.fromLibraryId;
690
+ const direct = await library.getAssetDef(ref);
691
+ if (direct && inScope(direct)) return direct;
692
+ let parsed;
693
+ try {
694
+ parsed = parseAssetRef(ref);
695
+ } catch {
696
+ return null;
697
+ }
698
+ const wantPublisher = parsed.publisher?.replace(/^@/, "");
699
+ const defs = await library.listAssetDefs({ kind: parsed.kind });
700
+ const matches = defs.filter(
701
+ (d) => d.name === parsed.name && inScope(d) && (wantPublisher === void 0 || d.publisher.replace(/^@/, "") === wantPublisher) && matchPin(parsed.pin, d.version)
702
+ );
703
+ if (matches.length === 0) return null;
704
+ matches.sort((a, b) => rcompare(coerceVersion(a.version), coerceVersion(b.version)));
705
+ return matches[0];
706
+ }
687
707
  function makeAssetCommand() {
688
708
  const cmd = new Command("asset").description("Author and install AI assets");
689
709
  cmd.command("import <name-or-path>").description("Import + skailify an existing coding-agent skill into a library").option("--to <library>", "Target library (default: auto / personal)").option("--domain <name>", "Place under this domain's skills/ (created if missing)").option("--version <semver>", "Version to stamp when the skill ships none").option("--stage <stage>", "Lifecycle stage to stamp (default: alpha)").option("--no-normalize", "Copy verbatim \u2014 skip frontmatter normalization").option("--commit", "Auto-commit in git-backed libraries", false).action(
@@ -712,7 +732,7 @@ function makeAssetCommand() {
712
732
  logErr(`Library "${target.name}" is read-only (ownership=reader). Choose --to.`);
713
733
  process.exit(1);
714
734
  }
715
- const rawSkill = fs12.readFileSync(src.skillFile, "utf8");
735
+ const rawSkill = fs13.readFileSync(src.skillFile, "utf8");
716
736
  const norm = opts.normalize ? normalizeSkillContent(rawSkill, {
717
737
  fallbackName: path14.basename(src.dir),
718
738
  version: opts.version,
@@ -731,14 +751,14 @@ function makeAssetCommand() {
731
751
  destParent = path14.join(dom.dir, "skills");
732
752
  publisher = dom.publisher;
733
753
  }
734
- fs12.mkdirSync(destParent, { recursive: true });
754
+ fs13.mkdirSync(destParent, { recursive: true });
735
755
  const destDir = path14.join(destParent, norm.name);
736
- if (fs12.existsSync(destDir)) {
756
+ if (fs13.existsSync(destDir)) {
737
757
  logErr(`Destination already exists: ${destDir}`);
738
758
  process.exit(1);
739
759
  }
740
- fs12.cpSync(src.dir, destDir, { recursive: true });
741
- fs12.writeFileSync(path14.join(destDir, "SKILL.md"), norm.content, "utf8");
760
+ fs13.cpSync(src.dir, destDir, { recursive: true });
761
+ fs13.writeFileSync(path14.join(destDir, "SKILL.md"), norm.content, "utf8");
742
762
  for (const note of norm.notes) logInfo(` \u2022 ${note}`);
743
763
  const fm = parseFrontmatter(norm.content).data;
744
764
  const descRaw = fm.description;
@@ -780,7 +800,7 @@ function makeAssetCommand() {
780
800
  logErr(`Invalid --mode "${opts.mode}". Expected: copy | move | link.`);
781
801
  process.exit(1);
782
802
  }
783
- if (!fs12.existsSync(srcPath)) {
803
+ if (!fs13.existsSync(srcPath)) {
784
804
  logErr(`Source path does not exist: ${srcPath}`);
785
805
  process.exit(1);
786
806
  }
@@ -809,21 +829,21 @@ function makeAssetCommand() {
809
829
  }
810
830
  const basename2 = path14.basename(srcPath);
811
831
  const destDir = target.structure === "domain" && opts.domain ? path14.join(target.path, opts.domain) : target.path;
812
- fs12.mkdirSync(destDir, { recursive: true });
832
+ fs13.mkdirSync(destDir, { recursive: true });
813
833
  const destPath = path14.join(destDir, basename2);
814
- if (fs12.existsSync(destPath)) {
834
+ if (fs13.existsSync(destPath)) {
815
835
  logErr(`Destination already exists: ${destPath}`);
816
836
  process.exit(1);
817
837
  }
818
838
  switch (opts.mode) {
819
839
  case "copy":
820
- fs12.cpSync(srcPath, destPath, { recursive: true });
840
+ fs13.cpSync(srcPath, destPath, { recursive: true });
821
841
  break;
822
842
  case "move":
823
- fs12.renameSync(srcPath, destPath);
843
+ fs13.renameSync(srcPath, destPath);
824
844
  break;
825
845
  case "link":
826
- fs12.symlinkSync(path14.resolve(srcPath), destPath);
846
+ fs13.symlinkSync(path14.resolve(srcPath), destPath);
827
847
  break;
828
848
  }
829
849
  if (target.backend === "git" && opts.commit) {
@@ -858,7 +878,16 @@ function makeAssetCommand() {
858
878
  }
859
879
  const { manager, library, close } = await openLibraryManager();
860
880
  try {
861
- const def = await library.getAssetDef(ref);
881
+ let fromLibraryId;
882
+ if (opts.from) {
883
+ const match = (await manager.listLibraries()).find((l) => l.name === opts.from);
884
+ if (!match) {
885
+ logErr(`Unknown library "${opts.from}". Run \`skaile library list\`.`);
886
+ process.exit(1);
887
+ }
888
+ fromLibraryId = match.id;
889
+ }
890
+ const def = await resolveDefByRef(library, ref, { fromLibraryId });
862
891
  if (!def) {
863
892
  logErr(`No asset found for ref "${ref}". Try \`skaile search\`.`);
864
893
  process.exit(1);
@@ -869,22 +898,19 @@ function makeAssetCommand() {
869
898
  logErr(`Asset has no associated library; install path unknown.`);
870
899
  process.exit(1);
871
900
  }
872
- if (opts.from && lib.name !== opts.from) {
873
- logWarn(`Asset belongs to "${lib.name}", but --from=${opts.from} was specified.`);
874
- }
875
901
  const manifestPath = def.manifest.path;
876
902
  const candidateSubpath = typeof manifestPath === "string" && manifestPath.length > 0 ? manifestPath : def.name;
877
903
  const srcPath = path14.join(lib.path, candidateSubpath);
878
- if (!fs12.existsSync(srcPath)) {
904
+ if (!fs13.existsSync(srcPath)) {
879
905
  logErr(`Asset path not found: ${srcPath}`);
880
906
  process.exit(1);
881
907
  }
882
908
  const destPath = path14.join(target, candidateSubpath);
883
- fs12.mkdirSync(path14.dirname(destPath), { recursive: true });
909
+ fs13.mkdirSync(path14.dirname(destPath), { recursive: true });
884
910
  if (opts.mode === "copy") {
885
- fs12.cpSync(srcPath, destPath, { recursive: true });
911
+ fs13.cpSync(srcPath, destPath, { recursive: true });
886
912
  } else {
887
- fs12.symlinkSync(path14.resolve(srcPath), destPath);
913
+ fs13.symlinkSync(path14.resolve(srcPath), destPath);
888
914
  }
889
915
  logOk(`Installed ${ref} \u2192 ${destPath} (${opts.mode})`);
890
916
  } finally {
@@ -896,7 +922,7 @@ function makeAssetCommand() {
896
922
  cmd.command("show <ref>").description("Show details for an asset by canonical ref").action(async (ref) => {
897
923
  const { library, close } = await openLibraryManager();
898
924
  try {
899
- const def = await library.getAssetDef(ref);
925
+ const def = await resolveDefByRef(library, ref);
900
926
  if (!def) {
901
927
  logErr(`Not found: ${ref}`);
902
928
  process.exit(1);
@@ -1074,7 +1100,7 @@ function makeCatalogCommand() {
1074
1100
  return catalog;
1075
1101
  }
1076
1102
  async function runLocalCatalogTest(projectDir) {
1077
- const { resolveCatalogSource } = await import('../open-library-4HMIDK3N.js');
1103
+ const { resolveCatalogSource } = await import('../open-library-ST2VFQTK.js');
1078
1104
  let resolved;
1079
1105
  try {
1080
1106
  resolved = await resolveCatalogSource({ projectDir });
@@ -1208,7 +1234,7 @@ function findFlowFile(flowId, priorityRoots = []) {
1208
1234
  for (const { dir } of assetSearchDirs(root, "flows")) {
1209
1235
  for (const ext of [".flow.yaml", ".flow.json", ".json"]) {
1210
1236
  const candidate = path14__default.join(dir, `${flowId}${ext}`);
1211
- if (fs12__default.existsSync(candidate)) return candidate;
1237
+ if (fs13__default.existsSync(candidate)) return candidate;
1212
1238
  }
1213
1239
  }
1214
1240
  }
@@ -1218,7 +1244,7 @@ function findSkills(domain) {
1218
1244
  const found = [];
1219
1245
  for (const root of aiResourceRoots()) {
1220
1246
  for (const { dir, domain: dirDomain } of assetSearchDirs(root, "skills")) {
1221
- if (fs12__default.existsSync(dir)) walkSkills(dir, dirDomain, found);
1247
+ if (fs13__default.existsSync(dir)) walkSkills(dir, dirDomain, found);
1222
1248
  }
1223
1249
  }
1224
1250
  const seen = /* @__PURE__ */ new Set();
@@ -1231,11 +1257,11 @@ function findSkills(domain) {
1231
1257
  return deduped;
1232
1258
  }
1233
1259
  function walkSkills(dir, domain, out) {
1234
- for (const entry of fs12__default.readdirSync(dir, { withFileTypes: true })) {
1260
+ for (const entry of fs13__default.readdirSync(dir, { withFileTypes: true })) {
1235
1261
  const full = path14__default.join(dir, entry.name);
1236
1262
  if (entry.isDirectory()) {
1237
1263
  const skillMd = path14__default.join(full, "SKILL.md");
1238
- if (fs12__default.existsSync(skillMd)) {
1264
+ if (fs13__default.existsSync(skillMd)) {
1239
1265
  out.push({ name: entry.name, path: full, skillPath: skillMd, domain });
1240
1266
  } else {
1241
1267
  walkSkills(full, domain, out);
@@ -1264,9 +1290,9 @@ function resolveFlowIds() {
1264
1290
  }
1265
1291
  function resolveSessionIds(projectDir) {
1266
1292
  const sessionsDir = path14__default.join(projectDir, ".skaile", "sessions");
1267
- if (!fs12__default.existsSync(sessionsDir)) return [];
1293
+ if (!fs13__default.existsSync(sessionsDir)) return [];
1268
1294
  try {
1269
- return fs12__default.readdirSync(sessionsDir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length));
1295
+ return fs13__default.readdirSync(sessionsDir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length));
1270
1296
  } catch {
1271
1297
  return [];
1272
1298
  }
@@ -1582,10 +1608,10 @@ function parsePositiveIntOption(value) {
1582
1608
  }
1583
1609
  return n;
1584
1610
  }
1585
- function scanFactoryConnectors(scanDirectory, roots) {
1611
+ function scanFactoryConnectors(scanDirectory2, roots) {
1586
1612
  const byName = /* @__PURE__ */ new Map();
1587
1613
  for (const dir of roots) {
1588
- for (const e of scanDirectory(dir, "factory-assets")) {
1614
+ for (const e of scanDirectory2(dir, "factory-assets")) {
1589
1615
  if (e.kind === "connector" && !byName.has(e.name)) byName.set(e.name, e);
1590
1616
  }
1591
1617
  }
@@ -1693,8 +1719,8 @@ async function promptField(field) {
1693
1719
  function makeConnectorCommand() {
1694
1720
  const cmd = new Command("connector").description("Operate on connectors in a workspace");
1695
1721
  cmd.command("catalog").description("List all available connector drivers and their dependencies").action(async () => {
1696
- const { scanDirectory, factoryAssetRoots: factoryAssetRoots2 } = await import('../core/index.js');
1697
- const entries = scanFactoryConnectors(scanDirectory, factoryAssetRoots2());
1722
+ const { scanDirectory: scanDirectory2, factoryAssetRoots: factoryAssetRoots2 } = await import('../core/index.js');
1723
+ const entries = scanFactoryConnectors(scanDirectory2, factoryAssetRoots2());
1698
1724
  if (entries.length === 0) {
1699
1725
  console.log("No connector descriptors found.");
1700
1726
  return;
@@ -1718,14 +1744,14 @@ function makeConnectorCommand() {
1718
1744
  cmd.command("add <driver>").option("--id <id>", "Connector instance ID (defaults to driver name)").option("--access <level>", "Access level: read-only | read-write", "read-only").option("--no-install", "Skip npm dependency installation").option("--project-dir <path>", "Workspace directory", process.cwd()).description("Add a connector to skaile.yaml and install its npm deps").action(
1719
1745
  async (driver, opts) => {
1720
1746
  const { installNpmPackages } = await import('../connectors/index.js');
1721
- const { scanDirectory, factoryAssetRoots: factoryAssetRoots2, WorkspaceYamlEditor: WorkspaceYamlEditor2 } = await import('../core/index.js');
1747
+ const { scanDirectory: scanDirectory2, factoryAssetRoots: factoryAssetRoots2, WorkspaceYamlEditor: WorkspaceYamlEditor2 } = await import('../core/index.js');
1722
1748
  const projectDir = path14__default.resolve(opts.projectDir);
1723
1749
  const yamlPath = path14__default.join(projectDir, "skaile.yaml");
1724
1750
  if (!existsSync(yamlPath)) {
1725
1751
  logErr("No skaile.yaml found in current directory. Run 'skaile init' first.");
1726
1752
  process.exit(1);
1727
1753
  }
1728
- const entries = scanFactoryConnectors(scanDirectory, factoryAssetRoots2());
1754
+ const entries = scanFactoryConnectors(scanDirectory2, factoryAssetRoots2());
1729
1755
  const entry = entries.find((e) => e.name === driver);
1730
1756
  if (!entry) {
1731
1757
  logErr(
@@ -2064,7 +2090,7 @@ async function ensureTargetsRegistered(projectDir) {
2064
2090
  const { resolveSkWorkspaceConfig: resolveSkWorkspaceConfig2 } = await import('../core/index.js');
2065
2091
  const config = resolveSkWorkspaceConfig2(projectDir);
2066
2092
  if (config.plugins && config.plugins.length > 0) {
2067
- const { ensurePluginsLoaded } = await import('../plugin-store-S7OMGI7N.js');
2093
+ const { ensurePluginsLoaded } = await import('../plugin-store-QMJ2B3VM.js');
2068
2094
  const result = await ensurePluginsLoaded(projectDir, config.plugins, pluginRegistry);
2069
2095
  for (const f of result.failed) logWarn(f.error);
2070
2096
  }
@@ -2869,6 +2895,48 @@ function makeIntegrationCommand() {
2869
2895
  cmd.action(() => cmd.help());
2870
2896
  return cmd;
2871
2897
  }
2898
+ async function indexLibrary(lib, index) {
2899
+ const { LocalCatalogSource } = await import('../library/index.js');
2900
+ const own = index ?? await openLibrary();
2901
+ try {
2902
+ const source = new LocalCatalogSource(own, lib.id, lib.path, createFullRegistry());
2903
+ const res = await source.sync();
2904
+ return {
2905
+ assetsFound: res.assetsFound,
2906
+ assetsUpdated: res.assetsUpdated,
2907
+ errors: res.errors
2908
+ };
2909
+ } finally {
2910
+ if (!index) own.close();
2911
+ }
2912
+ }
2913
+ function domainPublisher(libraryPath, domain) {
2914
+ const domainFile = path14.join(libraryPath, domain, "DOMAIN.md");
2915
+ if (!fs13.existsSync(domainFile)) return void 0;
2916
+ try {
2917
+ const { data } = parseFrontmatter(fs13.readFileSync(domainFile, "utf8"));
2918
+ const pub = data.publisher;
2919
+ return typeof pub === "string" && pub.trim() ? pub.trim() : void 0;
2920
+ } catch {
2921
+ return void 0;
2922
+ }
2923
+ }
2924
+ function resolveLibraryPublisher(lib, opts, domain, storeIdentity) {
2925
+ if (opts.publisher?.trim()) return opts.publisher.trim();
2926
+ if (domain) {
2927
+ const fromDomain = domainPublisher(lib.path, domain);
2928
+ if (fromDomain) return fromDomain;
2929
+ }
2930
+ const identity = (storeIdentity?.githubLogin ?? storeIdentity?.username)?.trim();
2931
+ if (identity) return identity;
2932
+ try {
2933
+ return slugifyAssetName(lib.name);
2934
+ } catch {
2935
+ return "library";
2936
+ }
2937
+ }
2938
+
2939
+ // cli/src/commands/library-cmd.ts
2872
2940
  function makeLibraryCommand() {
2873
2941
  const cmd = new Command("library").description("Manage user authoring libraries (local / git)");
2874
2942
  cmd.command("list").description("List all registered libraries").option("--json", "Output as JSON").action(async (opts) => {
@@ -2931,7 +2999,7 @@ function makeLibraryCommand() {
2931
2999
  const { manager, close } = await openLibraryManager();
2932
3000
  try {
2933
3001
  if (opts.git) {
2934
- fs12.mkdirSync(libPath, { recursive: true });
3002
+ fs13.mkdirSync(libPath, { recursive: true });
2935
3003
  await manager.addLibrary({
2936
3004
  name,
2937
3005
  path: libPath,
@@ -2940,7 +3008,7 @@ function makeLibraryCommand() {
2940
3008
  ownership
2941
3009
  });
2942
3010
  } else {
2943
- fs12.mkdirSync(libPath, { recursive: true });
3011
+ fs13.mkdirSync(libPath, { recursive: true });
2944
3012
  await manager.addLibrary({
2945
3013
  name,
2946
3014
  path: libPath,
@@ -2974,13 +3042,13 @@ function makeLibraryCommand() {
2974
3042
  close();
2975
3043
  }
2976
3044
  });
2977
- cmd.command("create <kind> <name>").description("Scaffold a new asset inside the default (or named) library").addOption(new Option("--kind <kind>", "Asset kind override").choices([...ASSET_KINDS])).option("--library <name>", "Target library (default: the default-marked one)").option("--dir <dir>", "Target directory inside the library (default: library root)").action(
3045
+ cmd.command("create <kind> <name>").description("Scaffold a new asset inside the default (or named) library").addOption(new Option("--kind <kind>", "Asset kind override").choices([...ASSET_KINDS])).option("--library <name>", "Target library (default: the default-marked one)").option("--dir <dir>", "Target directory inside the library (default: library root)").option("--publisher <name>", "Publisher for the new asset (default: the library's default)").action(
2978
3046
  async (kind, name, opts) => {
2979
3047
  if (!ASSET_KINDS.includes(kind)) {
2980
3048
  logErr(`Unknown asset kind "${kind}". Expected: ${ASSET_KINDS.join(", ")}.`);
2981
3049
  process.exit(1);
2982
3050
  }
2983
- const { manager, close } = await openLibraryManager();
3051
+ const { manager, library, close } = await openLibraryManager();
2984
3052
  try {
2985
3053
  let target;
2986
3054
  if (opts.library) {
@@ -2996,15 +3064,28 @@ function makeLibraryCommand() {
2996
3064
  }
2997
3065
  target = def;
2998
3066
  }
3067
+ const effectiveKind = opts.kind ?? kind;
2999
3068
  const am2 = new AssetManager({ projectDir: process.cwd() });
3000
3069
  const destDir = opts.dir ? path14.join(target.path, opts.dir) : target.path;
3001
- const res = am2.create(name, opts.kind ?? kind, destDir);
3002
- if (res.ok) {
3003
- logOk(`Created ${opts.kind ?? kind}: ${pc5.dim(res.path)}`);
3004
- } else {
3070
+ const res = am2.create(name, effectiveKind, destDir);
3071
+ if (!res.ok) {
3005
3072
  logErr(res.path);
3006
3073
  process.exit(1);
3007
3074
  }
3075
+ logOk(`Created ${effectiveKind}: ${pc5.dim(res.path)}`);
3076
+ const domain2 = opts.dir ? opts.dir.split(path14.sep)[0] : void 0;
3077
+ const publisher = resolveLibraryPublisher(target, opts, domain2, getStoreIdentity());
3078
+ stampAssetPublisher(res.path, publisher);
3079
+ ensureManifestPublisher(target.path, publisher);
3080
+ upsertManifestAsset(target.path, {
3081
+ kind: effectiveKind,
3082
+ name,
3083
+ root: path14.relative(target.path, res.path) || name,
3084
+ version: "0.1.0"
3085
+ });
3086
+ const idx = await indexLibrary(target, library);
3087
+ for (const e of idx.errors) logWarn(e);
3088
+ logOk(`Indexed \u2014 add it with \`skaile add ${effectiveKind}:@${publisher}/${name}\``);
3008
3089
  } finally {
3009
3090
  close();
3010
3091
  }
@@ -3079,7 +3160,7 @@ function makeLibraryCommand() {
3079
3160
  logErr(`Domain "${name}" not found in "${target.name}" (no ${domainFile}).`);
3080
3161
  process.exit(1);
3081
3162
  }
3082
- console.log(fs12.readFileSync(domainFile, "utf8"));
3163
+ console.log(fs13.readFileSync(domainFile, "utf8"));
3083
3164
  } finally {
3084
3165
  close();
3085
3166
  }
@@ -3099,11 +3180,11 @@ function makeLibraryCommand() {
3099
3180
  const lib = await manager.requireLibrary(oldName);
3100
3181
  const parent = path14.dirname(lib.path);
3101
3182
  const newPath = path14.join(parent, newName);
3102
- if (fs12.existsSync(newPath)) {
3183
+ if (fs13.existsSync(newPath)) {
3103
3184
  logErr(`Target directory already exists: ${newPath}`);
3104
3185
  process.exit(1);
3105
3186
  }
3106
- fs12.renameSync(lib.path, newPath);
3187
+ fs13.renameSync(lib.path, newPath);
3107
3188
  await manager.updateLibrary(lib.id, { name: newName, path: newPath });
3108
3189
  logOk(`Renamed ${oldName} \u2192 ${newName}`);
3109
3190
  } finally {
@@ -3169,6 +3250,18 @@ function makeLibraryCommand() {
3169
3250
  close();
3170
3251
  }
3171
3252
  });
3253
+ cmd.command("index <name>").description("(Re)index a library's assets into the local index").action(async (name) => {
3254
+ const { manager, library, close } = await openLibraryManager();
3255
+ try {
3256
+ const lib = await manager.requireLibrary(name);
3257
+ syncManifestWithDisk(lib.path, lib.name);
3258
+ const res = await indexLibrary(lib, library);
3259
+ for (const e of res.errors) logWarn(e);
3260
+ logOk(`Indexed ${res.assetsUpdated} asset(s) from ${name}.`);
3261
+ } finally {
3262
+ close();
3263
+ }
3264
+ });
3172
3265
  cmd.command("pull <name>").description("Pull from remote").action(async (name) => {
3173
3266
  const { manager, close } = await openLibraryManager();
3174
3267
  try {
@@ -3246,20 +3339,70 @@ function makeLibraryCommand() {
3246
3339
  });
3247
3340
  cmd.command("publish <lib>").description("Push + register the library's manifest atomically (needs git backend)").option("--asset <ref>", "Publish only the single asset matching this ref/name").option("--create-repo", "Provision + link a public github repo if the library has no remote").option("--ref <gitref>", "Git ref to ingest (default: the library branch or main)").option("--dry-run", "Print the plan; push nothing and call no store endpoint").action(
3248
3341
  async (lib, opts) => {
3249
- const { runLibraryPublish } = await import('../library-publish-K5IBE44D.js');
3250
- await runLibraryPublish(lib, opts);
3342
+ const { runLibraryPublish } = await import('../library-publish-TPWFSO3Q.js');
3343
+ await withStoreErrorHandling(() => runLibraryPublish(lib, opts));
3251
3344
  }
3252
3345
  );
3253
3346
  cmd.command("register <lib>").description("Register the library's manifest without pushing (bytes already on github)").option("--asset <ref>", "Publish only the single asset matching this ref/name").option("--ref <gitref>", "Git ref to ingest (default: the library branch or main)").option("--dry-run", "Print the plan; call no store endpoint").action(async (lib, opts) => {
3254
- const { runLibraryRegister } = await import('../library-publish-K5IBE44D.js');
3255
- await runLibraryRegister(lib, opts);
3347
+ const { runLibraryRegister } = await import('../library-publish-TPWFSO3Q.js');
3348
+ await withStoreErrorHandling(() => runLibraryRegister(lib, opts));
3256
3349
  });
3257
3350
  cmd.command("yank <lib>").description("Retract the library's published assets from the store").option("--asset <ref>", "Yank only the single asset matching this ref/name").action(async (lib, opts) => {
3258
- const { runLibraryYank } = await import('../library-publish-K5IBE44D.js');
3259
- await runLibraryYank(lib, opts);
3351
+ const { runLibraryYank } = await import('../library-publish-TPWFSO3Q.js');
3352
+ await withStoreErrorHandling(() => runLibraryYank(lib, opts));
3260
3353
  });
3261
3354
  return cmd;
3262
3355
  }
3356
+ async function withStoreErrorHandling(fn) {
3357
+ try {
3358
+ await fn();
3359
+ } catch (err) {
3360
+ logErr(err instanceof Error ? err.message : String(err));
3361
+ process.exit(1);
3362
+ }
3363
+ }
3364
+ function stampAssetPublisher(assetDir, publisher) {
3365
+ const markers = ["SKILL.md", "AGENT.md", "CONTRACT.md"];
3366
+ let markerFile;
3367
+ for (const m of markers) {
3368
+ if (fs13.existsSync(path14.join(assetDir, m))) {
3369
+ markerFile = path14.join(assetDir, m);
3370
+ break;
3371
+ }
3372
+ }
3373
+ if (!markerFile) {
3374
+ const promptMd = fs13.readdirSync(assetDir).find((f) => f.endsWith(".prompt.md"));
3375
+ if (promptMd) markerFile = path14.join(assetDir, promptMd);
3376
+ }
3377
+ if (!markerFile) return;
3378
+ try {
3379
+ const { data, body } = parseFrontmatter(fs13.readFileSync(markerFile, "utf8"));
3380
+ const meta = data.metadata && typeof data.metadata === "object" && !Array.isArray(data.metadata) ? { ...data.metadata } : {};
3381
+ if (meta.publisher != null) return;
3382
+ meta.publisher = publisher;
3383
+ data.metadata = meta;
3384
+ const fm = stringify(data).trimEnd();
3385
+ fs13.writeFileSync(markerFile, `---
3386
+ ${fm}
3387
+ ---
3388
+
3389
+ ${body}
3390
+ `, "utf8");
3391
+ } catch {
3392
+ }
3393
+ }
3394
+ function ensureManifestPublisher(libraryPath, publisher) {
3395
+ const manifest = loadSkPublishManifest(libraryPath) ?? { assets: [] };
3396
+ if (manifest.publisher) return;
3397
+ saveSkPublishManifest(libraryPath, { ...manifest, publisher });
3398
+ }
3399
+ function syncManifestWithDisk(libraryPath, libraryName) {
3400
+ const publisher = loadSkPublishManifest(libraryPath)?.publisher ?? slugifyAssetName(libraryName);
3401
+ for (const e of scanDirectory(libraryPath, publisher)) {
3402
+ const root = path14.relative(libraryPath, path14.dirname(e.source)) || e.name;
3403
+ upsertManifestAsset(libraryPath, { kind: e.kind, name: e.name, root, version: e.version });
3404
+ }
3405
+ }
3263
3406
  async function printPerLibraryStatus(name, asJson) {
3264
3407
  const { manager, close } = await openLibraryManager();
3265
3408
  try {
@@ -3514,6 +3657,7 @@ var srcKey = (origin, publisher) => `${origin}:${publisher}`;
3514
3657
  var domainKey = (origin, publisher, slug) => `${origin}:${publisher}:dom:${slug}`;
3515
3658
  var repoKey = (org, repo) => `${org}/${repo}`;
3516
3659
  var srcDomainKey = (org, repo, slug) => `${org}/${repo}:dom:${slug}`;
3660
+ var libDomainKey = (group, slug) => `${group}:dom:${slug}`;
3517
3661
  var NO_DOMAIN = "";
3518
3662
  var domainRegistry = /* @__PURE__ */ new Map();
3519
3663
  function relationBadge(relation) {
@@ -3544,6 +3688,8 @@ var state = {
3544
3688
  visibleRows: [],
3545
3689
  sourceTreeRows: [],
3546
3690
  visibleSourceRows: [],
3691
+ libraryTreeRows: [],
3692
+ visibleLibraryRows: [],
3547
3693
  pendingAdds: /* @__PURE__ */ new Set(),
3548
3694
  pendingRemoves: /* @__PURE__ */ new Set(),
3549
3695
  collapsedOrigins: /* @__PURE__ */ new Set(),
@@ -3556,6 +3702,10 @@ var state = {
3556
3702
  collapsedSourceDomains: /* @__PURE__ */ new Set(),
3557
3703
  expandedSourceDomainInfo: /* @__PURE__ */ new Set(),
3558
3704
  seenSourceDomains: /* @__PURE__ */ new Set(),
3705
+ collapsedLibraryGroups: /* @__PURE__ */ new Set(),
3706
+ collapsedLibraryDomains: /* @__PURE__ */ new Set(),
3707
+ expandedLibraryDomainInfo: /* @__PURE__ */ new Set(),
3708
+ seenLibraryDomains: /* @__PURE__ */ new Set(),
3559
3709
  seenOrigins: /* @__PURE__ */ new Set(),
3560
3710
  originFilter: null,
3561
3711
  message: "",
@@ -3663,6 +3813,59 @@ function sourceDomainRefs(rows, org, repo, slug) {
3663
3813
  )
3664
3814
  );
3665
3815
  }
3816
+ function buildLibraryTreeRows(assetRows, registered = []) {
3817
+ const byGroup = /* @__PURE__ */ new Map();
3818
+ const ensure = (group) => {
3819
+ if (!byGroup.has(group)) byGroup.set(group, /* @__PURE__ */ new Map());
3820
+ return byGroup.get(group);
3821
+ };
3822
+ for (const r of assetRows) {
3823
+ if (!isAsset(r) || rowOrigin(r) !== "library") continue;
3824
+ const group = rowGroup(r);
3825
+ const slug = rowDomain(r);
3826
+ const byDomain = ensure(group);
3827
+ if (!byDomain.has(slug)) byDomain.set(slug, []);
3828
+ byDomain.get(slug).push(r);
3829
+ }
3830
+ for (const group of registered) ensure(group);
3831
+ if (byGroup.size === 0) return [];
3832
+ const rows = [{ type: "library-root" }];
3833
+ for (const group of [...byGroup.keys()].sort((a, b) => a.localeCompare(b))) {
3834
+ rows.push({ type: "library-header", origin: "library", source: group });
3835
+ const byDomain = byGroup.get(group);
3836
+ const loose = byDomain.get(NO_DOMAIN);
3837
+ if (loose) for (const a of loose) rows.push({ ...a });
3838
+ for (const slug of sortedDomainSlugs([...byDomain.keys()])) {
3839
+ const meta = domainRegistry.get(slug);
3840
+ rows.push({ type: "domain-header", origin: "library", source: group, domainSlug: slug });
3841
+ if (meta?.description) {
3842
+ rows.push({ type: "domain-info", origin: "library", source: group, domainSlug: slug });
3843
+ }
3844
+ for (const a of byDomain.get(slug)) rows.push({ ...a });
3845
+ }
3846
+ }
3847
+ return rows;
3848
+ }
3849
+ function buildVisibleLibraryRows(rows, collapsedGroups, collapsedDomains) {
3850
+ return rows.filter((row) => {
3851
+ if (row.type === "library-root" || row.type === "library-header") return true;
3852
+ const group = row.source ?? rowGroup(row);
3853
+ if (collapsedGroups.has(group)) return false;
3854
+ if (row.type === "domain-header") return true;
3855
+ if (row.type === "domain-info") {
3856
+ return !collapsedDomains.has(libDomainKey(group, row.domainSlug ?? NO_DOMAIN));
3857
+ }
3858
+ if (row.underDomain) {
3859
+ return !collapsedDomains.has(libDomainKey(rowGroup(row), rowDomain(row)));
3860
+ }
3861
+ return true;
3862
+ });
3863
+ }
3864
+ function libraryGroupRefs(rows, group) {
3865
+ return refsOf(
3866
+ rows.filter((r) => isAsset(r) && rowOrigin(r) === "library" && rowGroup(r) === group)
3867
+ );
3868
+ }
3666
3869
  function isAsset(r) {
3667
3870
  return r.type === "asset";
3668
3871
  }
@@ -3786,7 +3989,7 @@ async function previewSoftDepsUnderCursor() {
3786
3989
  }
3787
3990
  async function loadAssets() {
3788
3991
  softDepPreviewCache.clear();
3789
- const { gatherAssetFeeds } = await import('../asset-feeds-T35ELX2O.js');
3992
+ const { gatherAssetFeeds } = await import('../asset-feeds-Y66NCOQZ.js');
3790
3993
  const { entries, domains, notes } = await gatherAssetFeeds(am, am.projectDir);
3791
3994
  if (notes.length > 0) {
3792
3995
  state.message = notes.map((n) => `[${n.feed}] ${n.message}`).join(" \u2022 ");
@@ -3799,6 +4002,7 @@ async function loadAssets() {
3799
4002
  reconcileCollapsedSets(rows);
3800
4003
  rebuildVisible();
3801
4004
  rebuildSourceTree();
4005
+ rebuildLibraryTree();
3802
4006
  }
3803
4007
  function rebuildSourceTree() {
3804
4008
  const registered = state.sourceRows.map((s) => sourceOrgRepo(s)).filter((x) => x !== null);
@@ -3848,6 +4052,44 @@ function rebuildVisibleSources() {
3848
4052
  );
3849
4053
  clampCursor();
3850
4054
  }
4055
+ function rebuildLibraryTree() {
4056
+ state.libraryTreeRows = buildLibraryTreeRows(
4057
+ state.assetRows,
4058
+ state.libraryRows.map((l) => l.name)
4059
+ );
4060
+ reconcileLibraryCollapsedSets(state.libraryTreeRows);
4061
+ rebuildVisibleLibraries();
4062
+ }
4063
+ function reconcileLibraryCollapsedSets(rows) {
4064
+ const groupKeys = new Set(rows.filter((r) => r.type === "library-header").map((r) => r.source));
4065
+ const domainKeys = new Set(
4066
+ rows.filter((r) => r.type === "domain-header").map((r) => libDomainKey(r.source, r.domainSlug ?? NO_DOMAIN))
4067
+ );
4068
+ for (const k of state.collapsedLibraryGroups)
4069
+ if (!groupKeys.has(k)) state.collapsedLibraryGroups.delete(k);
4070
+ for (const k of domainKeys) {
4071
+ if (!state.seenLibraryDomains.has(k)) {
4072
+ state.collapsedLibraryDomains.add(k);
4073
+ state.seenLibraryDomains.add(k);
4074
+ }
4075
+ }
4076
+ for (const k of state.collapsedLibraryDomains) {
4077
+ if (!domainKeys.has(k)) state.collapsedLibraryDomains.delete(k);
4078
+ }
4079
+ for (const k of state.expandedLibraryDomainInfo) {
4080
+ if (!domainKeys.has(k)) state.expandedLibraryDomainInfo.delete(k);
4081
+ }
4082
+ for (const k of state.seenLibraryDomains)
4083
+ if (!domainKeys.has(k)) state.seenLibraryDomains.delete(k);
4084
+ }
4085
+ function rebuildVisibleLibraries() {
4086
+ state.visibleLibraryRows = buildVisibleLibraryRows(
4087
+ state.libraryTreeRows,
4088
+ state.collapsedLibraryGroups,
4089
+ state.collapsedLibraryDomains
4090
+ );
4091
+ clampCursor();
4092
+ }
3851
4093
  function groupEntriesByOriginPublisherDomain(entries) {
3852
4094
  const byOrigin = /* @__PURE__ */ new Map();
3853
4095
  for (const { origin, entry, group } of entries) {
@@ -3917,7 +4159,7 @@ function reconcileCollapsedSets(rows) {
3917
4159
  const presentOrigins = new Set(rows.filter((r) => r.type === "origin-header").map(rowOrigin));
3918
4160
  for (const o of presentOrigins) {
3919
4161
  if (!state.seenOrigins.has(o)) {
3920
- if (o === "store") state.collapsedOrigins.add(o);
4162
+ if (o !== "factory") state.collapsedOrigins.add(o);
3921
4163
  state.seenOrigins.add(o);
3922
4164
  }
3923
4165
  }
@@ -3953,7 +4195,7 @@ function reconcileCollapsedSets(rows) {
3953
4195
  async function loadSourcesAndLibraries() {
3954
4196
  try {
3955
4197
  const [{ openLibraryManager: openLibraryManager2 }, { skaileHomeDir }, { getGlobalCacheDir: getGlobalCacheDir2 }] = await Promise.all([
3956
- import('../open-library-4HMIDK3N.js'),
4198
+ import('../open-library-ST2VFQTK.js'),
3957
4199
  import('../library/index.js'),
3958
4200
  import('../core/index.js')
3959
4201
  ]);
@@ -3990,6 +4232,7 @@ async function loadSourcesAndLibraries() {
3990
4232
  state.libraryRows = [];
3991
4233
  }
3992
4234
  rebuildSourceTree();
4235
+ rebuildLibraryTree();
3993
4236
  }
3994
4237
  function rebuildVisible() {
3995
4238
  state.visibleRows = buildVisibleRows(
@@ -4033,11 +4276,11 @@ var TABS = {
4033
4276
  },
4034
4277
  libraries: {
4035
4278
  label: "Libraries",
4036
- rowCount: () => state.libraryRows.length,
4037
- selectableCount: () => state.libraryRows.length,
4279
+ rowCount: () => state.visibleLibraryRows.length,
4280
+ selectableCount: () => state.libraryTreeRows.filter(isAsset).length,
4038
4281
  emptyMsg: " No libraries registered. Run `skaile library init <name>` from the shell to author your own.",
4039
- renderRow: (i, sel) => renderLibraryRow(state.libraryRows[i], sel),
4040
- footer: " \u2191\u2193 navigate Tab switch q quit (use `skaile library \u2026` from the shell for CRUD)"
4282
+ renderRow: (i, sel) => renderLibraryTreeRow(state.visibleLibraryRows[i], sel),
4283
+ footer: " \u2191\u2193/jk nav \u2190/\u2192 collapse/expand [space/+/-] select [a/\u21B5] apply [d] domain info [i] info Tab [q] quit"
4041
4284
  },
4042
4285
  pending: {
4043
4286
  label: "Pending",
@@ -4246,6 +4489,57 @@ function renderSourceTreeRow(row, selected) {
4246
4489
  }
4247
4490
  return renderAssetLeaf(row, selected, 7);
4248
4491
  }
4492
+ function renderLibraryTreeRow(row, selected) {
4493
+ if (row.type === "library-root") {
4494
+ const total = state.libraryTreeRows.filter(isAsset).length;
4495
+ const meta = ORIGIN_META.library;
4496
+ const line = ` \u25BC ${meta.icon} ${pc5.bold(pc5.cyan(meta.label))} (${total} assets)`;
4497
+ return selected ? pc5.bgWhite(pc5.black(`${line} `.padEnd(state.cols))) : line;
4498
+ }
4499
+ if (row.type === "library-header") {
4500
+ const group = row.source;
4501
+ return renderHeaderLine({
4502
+ indent: " ".repeat(3),
4503
+ collapsed: state.collapsedLibraryGroups.has(group),
4504
+ match: (r) => isAsset(r) && rowOrigin(r) === "library" && rowGroup(r) === group,
4505
+ refs: libraryGroupRefs(state.libraryTreeRows, group),
4506
+ label: pc5.bold(pc5.cyan(group)),
4507
+ selected,
4508
+ rows: state.libraryTreeRows
4509
+ });
4510
+ }
4511
+ if (row.type === "domain-header") {
4512
+ const group = row.source;
4513
+ const slug = row.domainSlug ?? NO_DOMAIN;
4514
+ const meta = domainRegistry.get(slug);
4515
+ const title = meta?.title || slug || "(no domain)";
4516
+ const badge = relationBadge(meta?.relation);
4517
+ const label = `${pc5.magenta("\u25C8")} ${pc5.bold(title)}${badge ? ` ${badge}` : ""}`;
4518
+ return renderHeaderLine({
4519
+ indent: " ".repeat(5),
4520
+ collapsed: state.collapsedLibraryDomains.has(libDomainKey(group, slug)),
4521
+ match: (r) => isAsset(r) && inDomain(r, "library", group, slug),
4522
+ refs: domainAssetRefs(state.libraryTreeRows, "library", group, slug),
4523
+ label,
4524
+ selected,
4525
+ rows: state.libraryTreeRows
4526
+ });
4527
+ }
4528
+ if (row.type === "domain-info") {
4529
+ const group = row.source;
4530
+ const slug = row.domainSlug ?? NO_DOMAIN;
4531
+ const meta = domainRegistry.get(slug);
4532
+ const members = domainAssetRefs(state.libraryTreeRows, "library", group, slug).length;
4533
+ const key = libDomainKey(group, slug);
4534
+ const line = renderSourceDomainInfoLine(
4535
+ meta,
4536
+ members,
4537
+ state.expandedLibraryDomainInfo.has(key)
4538
+ );
4539
+ return selected ? pc5.inverse(line.padEnd(state.cols)) : line;
4540
+ }
4541
+ return renderAssetLeaf(row, selected, 5);
4542
+ }
4249
4543
  function renderSourceDomainInfoLine(meta, members, expanded) {
4250
4544
  const indent = " ".repeat(9);
4251
4545
  const desc = meta?.description ?? "";
@@ -4279,11 +4573,6 @@ function renderDomainInfoLine(meta, origin, publisher, slug, expanded) {
4279
4573
  const shown = full.length > budget ? `${full.slice(0, Math.max(0, budget - 1))}\u2026` : full;
4280
4574
  return pc5.dim(`${indent}\u24D8 ${shown}`);
4281
4575
  }
4282
- function renderLibraryRow(row, selected) {
4283
- const mark = row.isDefault ? pc5.green("\u25B8") : " ";
4284
- const line = `${mark} ${S.cmd(fitWidth(row.name, 16))} ${pc5.dim(row.backend.padEnd(7))} ${pc5.dim(row.ownership.padEnd(12))} ${pc5.dim(`${row.assetCount} assets`)}`;
4285
- return selected ? pc5.inverse(line.padEnd(state.cols)) : line;
4286
- }
4287
4576
  function computeMaxBodyRows() {
4288
4577
  const pendingLines = state.pendingAdds.size > 0 || state.pendingRemoves.size > 0 ? 1 + (state.pendingAdds.size > 0 ? 1 : 0) + (state.pendingRemoves.size > 0 ? 1 : 0) : 0;
4289
4578
  const msgLines = state.message ? 2 : 0;
@@ -4401,14 +4690,9 @@ async function syncAll() {
4401
4690
  "Sync is not yet driven from the manage TUI. Run `skaile source sync` (sources) or `skaile library sync <name>` (git-backed libraries) from the shell."
4402
4691
  );
4403
4692
  }
4404
- function libraryShellHint(action3) {
4405
- state.message = pc5.yellow(
4406
- `${action3} is a shell command. Run \`skaile library \u2026\` from the shell.`
4407
- );
4408
- }
4409
4693
  async function showInfo() {
4410
- const rows = state.tab === "sources" ? state.visibleSourceRows : state.visibleRows;
4411
- if (state.tab !== "assets" && state.tab !== "sources") return;
4694
+ const rows = state.tab === "sources" ? state.visibleSourceRows : state.tab === "libraries" ? state.visibleLibraryRows : state.visibleRows;
4695
+ if (state.tab !== "assets" && state.tab !== "sources" && state.tab !== "libraries") return;
4412
4696
  const row = rows[state.cursor];
4413
4697
  if (row?.type !== "asset") return;
4414
4698
  const e = row.entry;
@@ -4646,6 +4930,97 @@ function toggleSourceDomainInfoUnderCursor() {
4646
4930
  else state.expandedSourceDomainInfo.add(key);
4647
4931
  rebuildVisibleSources();
4648
4932
  }
4933
+ function actOnLibraryHeader(row, action3) {
4934
+ if (row.type === "library-header") {
4935
+ bulkSelection(libraryGroupRefs(state.libraryTreeRows, row.source), action3);
4936
+ return true;
4937
+ }
4938
+ return row.type === "library-root" || row.type === "domain-header" || row.type === "domain-info";
4939
+ }
4940
+ function selectLibraryUnderCursor(action3) {
4941
+ const row = state.visibleLibraryRows[state.cursor];
4942
+ if (!row) return;
4943
+ if (actOnLibraryHeader(row, action3)) return;
4944
+ const ref = assetRefOf(row);
4945
+ if (!ref) return;
4946
+ if (action3 === "toggle") {
4947
+ setSelection(ref, "toggle");
4948
+ } else if (action3 === "add") {
4949
+ setSelection(ref, state.pendingAdds.has(ref) ? "clear" : "add");
4950
+ } else {
4951
+ setSelection(ref, state.pendingRemoves.has(ref) ? "clear" : "remove");
4952
+ }
4953
+ }
4954
+ function expandLibraryUnderCursor() {
4955
+ const row = state.visibleLibraryRows[state.cursor];
4956
+ if (!row) return;
4957
+ if (row.type === "library-header" && state.collapsedLibraryGroups.has(row.source)) {
4958
+ state.collapsedLibraryGroups.delete(row.source);
4959
+ rebuildVisibleLibraries();
4960
+ } else if (row.type === "domain-header") {
4961
+ const k = libDomainKey(row.source, row.domainSlug ?? NO_DOMAIN);
4962
+ if (state.collapsedLibraryDomains.has(k)) {
4963
+ state.collapsedLibraryDomains.delete(k);
4964
+ rebuildVisibleLibraries();
4965
+ }
4966
+ }
4967
+ }
4968
+ function collapseOrJumpLibraryUnderCursor() {
4969
+ const row = state.visibleLibraryRows[state.cursor];
4970
+ if (!row) return;
4971
+ if (row.type === "library-header") {
4972
+ if (!state.collapsedLibraryGroups.has(row.source)) {
4973
+ state.collapsedLibraryGroups.add(row.source);
4974
+ rebuildVisibleLibraries();
4975
+ } else {
4976
+ const idx2 = findLastIndex(
4977
+ state.visibleLibraryRows,
4978
+ state.cursor,
4979
+ (r) => r.type === "library-root"
4980
+ );
4981
+ if (idx2 >= 0) state.cursor = idx2;
4982
+ }
4983
+ return;
4984
+ }
4985
+ if (row.type === "domain-header") {
4986
+ const k = libDomainKey(row.source, row.domainSlug ?? NO_DOMAIN);
4987
+ if (!state.collapsedLibraryDomains.has(k)) {
4988
+ state.collapsedLibraryDomains.add(k);
4989
+ rebuildVisibleLibraries();
4990
+ } else {
4991
+ const idx2 = findLastIndex(
4992
+ state.visibleLibraryRows,
4993
+ state.cursor,
4994
+ (r) => r.type === "library-header"
4995
+ );
4996
+ if (idx2 >= 0) state.cursor = idx2;
4997
+ }
4998
+ return;
4999
+ }
5000
+ const idx = findLastIndex(
5001
+ state.visibleLibraryRows,
5002
+ state.cursor,
5003
+ (r) => r.type === "domain-header" || r.type === "library-header"
5004
+ );
5005
+ if (idx >= 0) state.cursor = idx;
5006
+ }
5007
+ function toggleLibraryDomainInfoUnderCursor() {
5008
+ const row = state.visibleLibraryRows[state.cursor];
5009
+ if (!row) return;
5010
+ let key = null;
5011
+ if (row.type === "domain-header" || row.type === "domain-info") {
5012
+ key = libDomainKey(row.source, row.domainSlug ?? NO_DOMAIN);
5013
+ } else if (row.type === "asset" && row.underDomain) {
5014
+ key = libDomainKey(rowGroup(row), rowDomain(row));
5015
+ }
5016
+ if (!key) {
5017
+ state.message = pc5.dim("No domain here \u2014 [d] opens a domain's info region.");
5018
+ return;
5019
+ }
5020
+ if (state.expandedLibraryDomainInfo.has(key)) state.expandedLibraryDomainInfo.delete(key);
5021
+ else state.expandedLibraryDomainInfo.add(key);
5022
+ rebuildVisibleLibraries();
5023
+ }
4649
5024
  function findLastIndex(arr, endExclusive, pred) {
4650
5025
  for (let i = Math.min(endExclusive, arr.length) - 1; i >= 0; i--) {
4651
5026
  if (pred(arr[i])) return i;
@@ -4691,6 +5066,9 @@ var KEYMAP = [
4691
5066
  // Collapse / expand — sources tab
4692
5067
  { keys: ["\x1B[C"], when: TAB_SOURCES, run: expandSourceUnderCursor },
4693
5068
  { keys: ["\x1B[D"], when: TAB_SOURCES, run: collapseOrJumpSourceUnderCursor },
5069
+ // Collapse / expand — libraries tab
5070
+ { keys: ["\x1B[C"], when: TAB_LIBRARIES, run: expandLibraryUnderCursor },
5071
+ { keys: ["\x1B[D"], when: TAB_LIBRARIES, run: collapseOrJumpLibraryUnderCursor },
4694
5072
  // + : assets → bulk-add or single-add toggle
4695
5073
  {
4696
5074
  keys: ["+"],
@@ -4712,23 +5090,13 @@ var KEYMAP = [
4712
5090
  { keys: ["a", "\r", "\n"], when: TAB_SOURCES, run: applyChanges },
4713
5091
  { keys: ["i"], when: TAB_SOURCES, run: showInfo },
4714
5092
  { keys: ["d"], when: TAB_SOURCES, run: toggleSourceDomainInfoUnderCursor },
4715
- // Libraries tab: +/-/n/r/x/d/enter map to shell hints in the minimal scaffold.
4716
- {
4717
- keys: ["+", "n", "a"],
4718
- when: TAB_LIBRARIES,
4719
- run: () => libraryShellHint("Adding a library")
4720
- },
4721
- {
4722
- keys: ["-", "r", "x"],
4723
- when: TAB_LIBRARIES,
4724
- run: () => libraryShellHint("Removing a library")
4725
- },
4726
- {
4727
- keys: ["d"],
4728
- when: TAB_LIBRARIES,
4729
- run: () => libraryShellHint("Setting the default library")
4730
- },
4731
- { keys: ["\r", "\n"], when: TAB_LIBRARIES, run: () => libraryShellHint("Library actions") },
5093
+ // Libraries tab: + / - / space select (asset leaf or library bulk header).
5094
+ { keys: ["+"], when: TAB_LIBRARIES, run: () => selectLibraryUnderCursor("add") },
5095
+ { keys: ["-"], when: TAB_LIBRARIES, run: () => selectLibraryUnderCursor("remove") },
5096
+ { keys: [" "], when: TAB_LIBRARIES, run: () => selectLibraryUnderCursor("toggle") },
5097
+ { keys: ["a", "\r", "\n"], when: TAB_LIBRARIES, run: applyChanges },
5098
+ { keys: ["i"], when: TAB_LIBRARIES, run: showInfo },
5099
+ { keys: ["d"], when: TAB_LIBRARIES, run: toggleLibraryDomainInfoUnderCursor },
4732
5100
  // - : assets → bulk-remove or single-remove toggle
4733
5101
  {
4734
5102
  keys: ["-"],
@@ -4796,6 +5164,10 @@ async function handleExitConfirm(key) {
4796
5164
  return "skip-render";
4797
5165
  }
4798
5166
  async function run(projectDir) {
5167
+ if (!process.stdin.isTTY || typeof process.stdin.setRawMode !== "function") {
5168
+ console.error("skaile manage requires an interactive terminal (TTY). Run it directly in your shell.");
5169
+ process.exit(1);
5170
+ }
4799
5171
  am = new AssetManager({ projectDir });
4800
5172
  await loadAssets();
4801
5173
  await loadSourcesAndLibraries();
@@ -4822,8 +5194,8 @@ function makeManageCommand() {
4822
5194
  }
4823
5195
  function makeMcpServerCommand() {
4824
5196
  return new Command("mcp-server").description("Start skaile workspace MCP server (stdio transport)").option("--project-dir <path>", "Project directory (default: cwd)", process.cwd()).action(async (opts) => {
4825
- const path37 = await import('path');
4826
- const projectDir = path37.default.resolve(opts.projectDir);
5197
+ const path38 = await import('path');
5198
+ const projectDir = path38.default.resolve(opts.projectDir);
4827
5199
  const { LogStore, StdoutSink, registerLogStore } = await import('../core/logging.js');
4828
5200
  registerLogStore(
4829
5201
  new LogStore({
@@ -5039,7 +5411,7 @@ function action2(fn) {
5039
5411
  };
5040
5412
  }
5041
5413
  async function reconcileAndReport(projectDir, plugins) {
5042
- const { reconcilePlugins } = await import('../plugin-store-S7OMGI7N.js');
5414
+ const { reconcilePlugins } = await import('../plugin-store-QMJ2B3VM.js');
5043
5415
  if (plugins.length === 0) {
5044
5416
  logInfo("No plugins declared \u2014 nothing to reconcile.");
5045
5417
  return;
@@ -5055,7 +5427,7 @@ async function reconcileAndReport(projectDir, plugins) {
5055
5427
  async function runInstall2(spec, opts) {
5056
5428
  const projectDir = path14__default.resolve(opts.projectDir);
5057
5429
  const { WorkspaceYamlEditor: WorkspaceYamlEditor2 } = await import('../core/index.js');
5058
- const { specName } = await import('../plugin-store-S7OMGI7N.js');
5430
+ const { specName } = await import('../plugin-store-QMJ2B3VM.js');
5059
5431
  const yamlPath = path14__default.join(projectDir, "skaile.yaml");
5060
5432
  const editor = WorkspaceYamlEditor2.load(yamlPath);
5061
5433
  const replaced = editor.addPlugin(spec, specName);
@@ -5067,7 +5439,7 @@ async function runInstall2(spec, opts) {
5067
5439
  async function runRemove(name, opts) {
5068
5440
  const projectDir = path14__default.resolve(opts.projectDir);
5069
5441
  const { WorkspaceYamlEditor: WorkspaceYamlEditor2 } = await import('../core/index.js');
5070
- const { specName } = await import('../plugin-store-S7OMGI7N.js');
5442
+ const { specName } = await import('../plugin-store-QMJ2B3VM.js');
5071
5443
  const yamlPath = path14__default.join(projectDir, "skaile.yaml");
5072
5444
  const editor = WorkspaceYamlEditor2.load(yamlPath);
5073
5445
  const removed = editor.removePlugin(name, specName);
@@ -5095,7 +5467,7 @@ async function runList(opts) {
5095
5467
  const registry = createPluginRegistry();
5096
5468
  if (declared.length > 0) {
5097
5469
  try {
5098
- const { loadPlugins } = await import('../plugin-store-S7OMGI7N.js');
5470
+ const { loadPlugins } = await import('../plugin-store-QMJ2B3VM.js');
5099
5471
  const result = await loadPlugins(projectDir, declared, registry);
5100
5472
  for (const f of result.failed) logWarn(f.error);
5101
5473
  } catch (err) {
@@ -5292,7 +5664,7 @@ async function runRefInstall(ref, opts) {
5292
5664
  const spinner5 = p6.spinner();
5293
5665
  spinner5.start(`Installing ${ref}`);
5294
5666
  try {
5295
- const { openCatalogSource: openCatalogSource2, openLibrary: openLibrary2 } = await import('../open-library-4HMIDK3N.js');
5667
+ const { openCatalogSource: openCatalogSource2, openLibrary: openLibrary2 } = await import('../open-library-ST2VFQTK.js');
5296
5668
  const catalog = await openCatalogSource2({ projectDir: path14__default.resolve(opts.projectDir) });
5297
5669
  if (!supportsInstallManifest(catalog)) {
5298
5670
  throw new Error(
@@ -5332,7 +5704,7 @@ async function runYamlInstall(opts) {
5332
5704
  return;
5333
5705
  }
5334
5706
  try {
5335
- const { ensureSourcesCloned } = await import('../ensure-sources-QDVFUIUP.js');
5707
+ const { ensureSourcesCloned } = await import('../ensure-sources-NXBYK5GP.js');
5336
5708
  const hydrate = ensureSourcesCloned(projectDir, { quiet: true });
5337
5709
  if (hydrate.cloned.length > 0) {
5338
5710
  logOk(`Cloned source(s): ${hydrate.cloned.join(", ")}`);
@@ -5633,8 +6005,8 @@ function redactSecrets(preset, findings) {
5633
6005
  }
5634
6006
  return { preset: next, keys };
5635
6007
  }
5636
- function placeholderKey(itemId, path37) {
5637
- return `${itemId}_${path37}`.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
6008
+ function placeholderKey(itemId, path38) {
6009
+ return `${itemId}_${path38}`.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
5638
6010
  }
5639
6011
  function setAtPath(root, segments, value) {
5640
6012
  let node = root;
@@ -6085,16 +6457,6 @@ name: "${name}"
6085
6457
  version: "1.0.0"
6086
6458
  description: "TODO: describe what this preset configures"
6087
6459
 
6088
- # Placeholders \u2014 values the user provides at apply-time.
6089
- # Types: text, multiline, secret, number, boolean, enum, oauth, instance-picker
6090
- placeholders:
6091
- - key: EXAMPLE_KEY
6092
- type: text
6093
- label: "Example placeholder"
6094
- required: true
6095
- # default: "some-value"
6096
- # hint: "Help text shown to the user"
6097
-
6098
6460
  # Items \u2014 each becomes a Library Instance when the preset is applied.
6099
6461
  # Ref types:
6100
6462
  # - Asset ref (kind:publisher/name@pin) \u2192 creates new Instance
@@ -6103,10 +6465,27 @@ placeholders:
6103
6465
  items:
6104
6466
  - id: example-item
6105
6467
  ref: "skill:@skaile/example-skill@^1.0"
6468
+ # Placeholders \u2014 values the user provides at apply-time, declared on the item
6469
+ # that uses them. Types: text, multiline, secret, number, boolean, enum, oauth,
6470
+ # instance-picker
6471
+ placeholders:
6472
+ - key: EXAMPLE_KEY
6473
+ type: text
6474
+ label: "Example placeholder"
6475
+ required: true
6476
+ # default: "some-value"
6477
+ # hint: "Help text shown to the user"
6106
6478
  config:
6107
6479
  # Use \${INPUT:EXAMPLE_KEY} for placeholder interpolation
6108
6480
  setting: "\${INPUT:EXAMPLE_KEY}"
6109
6481
  # credential_ref: "\${SECRET:EXAMPLE_KEY}" # for secret placeholders
6482
+
6483
+ # Preset-level inputs shared across items (rare) \u2014 top-level \`inputs:\`, not
6484
+ # \`placeholders:\` (that key lives on items). Same shape as a placeholder:
6485
+ # inputs:
6486
+ # - key: SHARED_KEY
6487
+ # type: text
6488
+ # label: "Shared across all items"
6110
6489
  `;
6111
6490
  }
6112
6491
  function makeRebuildCommand() {
@@ -6247,7 +6626,7 @@ function makeRunCommand() {
6247
6626
  let dir = projectDir;
6248
6627
  for (let i = 0; i < 6; i++) {
6249
6628
  const candidate = path14__default.join(dir, "ai-assets");
6250
- if (fs12__default.existsSync(candidate)) {
6629
+ if (fs13__default.existsSync(candidate)) {
6251
6630
  priorityRoots.push(candidate);
6252
6631
  break;
6253
6632
  }
@@ -6406,13 +6785,13 @@ function makeReplCommand() {
6406
6785
  p6.cancel("Cancelled.");
6407
6786
  process.exit(0);
6408
6787
  }
6409
- const tmpDir = fs12__default.mkdtempSync(path14__default.join(os2.tmpdir(), "skaile-repl-"));
6788
+ const tmpDir = fs13__default.mkdtempSync(path14__default.join(os2.tmpdir(), "skaile-repl-"));
6410
6789
  projectDir = tmpDir;
6411
6790
  agentCwd = userCwd;
6412
6791
  logOk(`Temporary workspace: ${S.cmd(tmpDir)}`);
6413
6792
  if (!driverOverride) {
6414
6793
  const claudeDir = path14__default.join(os2.homedir(), ".claude");
6415
- if (fs12__default.existsSync(claudeDir)) {
6794
+ if (fs13__default.existsSync(claudeDir)) {
6416
6795
  driverOverride = "claude-sdk";
6417
6796
  logInfo(`Detected ${S.cmd("~/.claude")} \u2192 using ${S.cmd("claude-sdk")} backend`);
6418
6797
  } else {
@@ -6458,12 +6837,12 @@ function makeServeCommand() {
6458
6837
  );
6459
6838
  }
6460
6839
  async function ensurePluginsLoadedForServe(projectDir) {
6461
- const { logInfo: logInfo2, logWarn: logWarn2 } = await import('../helpers-TF7GCBRQ.js');
6840
+ const { logInfo: logInfo2, logWarn: logWarn2 } = await import('../helpers-DN4MWOHB.js');
6462
6841
  try {
6463
6842
  const { resolveSkWorkspaceConfig: resolveSkWorkspaceConfig2 } = await import('../core/index.js');
6464
6843
  const config = resolveSkWorkspaceConfig2(projectDir);
6465
6844
  if (!config.plugins || config.plugins.length === 0) return;
6466
- const { ensurePluginsLoaded } = await import('../plugin-store-S7OMGI7N.js');
6845
+ const { ensurePluginsLoaded } = await import('../plugin-store-QMJ2B3VM.js');
6467
6846
  const { pluginRegistry } = await import('../plugin-registry/index.js');
6468
6847
  const result = await ensurePluginsLoaded(projectDir, config.plugins, pluginRegistry);
6469
6848
  if (result.loaded.length > 0) {
@@ -6477,21 +6856,21 @@ async function ensurePluginsLoadedForServe(projectDir) {
6477
6856
  }
6478
6857
  }
6479
6858
  async function runCompileTest(opts) {
6480
- const { logOk: logOk2, logErr: logErr2, logInfo: logInfo2, S: S2 } = await import('../helpers-TF7GCBRQ.js');
6859
+ const { logOk: logOk2, logErr: logErr2, logInfo: logInfo2, S: S2 } = await import('../helpers-DN4MWOHB.js');
6481
6860
  const { tmpdir } = await import('os');
6482
- const { dirname: dirname4, join: join6, resolve: resolve5 } = await import('path');
6861
+ const { dirname: dirname4, join: join7, resolve: resolve5 } = await import('path');
6483
6862
  const { fileURLToPath: fileURLToPath2 } = await import('url');
6484
- const { unlinkSync, existsSync: existsSync14 } = await import('fs');
6863
+ const { unlinkSync, existsSync: existsSync15 } = await import('fs');
6485
6864
  const { spawn } = await import('child_process');
6486
6865
  const { portableSpawnSync: portableSpawnSync2 } = await import('../core/index.js');
6487
- const { MONOREPO_ROOT } = await import('../paths-P3DWFUPS.js');
6866
+ const { MONOREPO_ROOT } = await import('../paths-KOKCMBL5.js');
6488
6867
  if (MONOREPO_ROOT === null) {
6489
6868
  logErr2("--compile-test is only available inside the skaile-dev workspace.");
6490
6869
  logInfo2("Run it from a checkout of skaile-ai/skaile-dev (the monorepo shell).");
6491
6870
  process.exitCode = 2;
6492
6871
  return;
6493
6872
  }
6494
- const outfile = join6(tmpdir(), `skaile-compile-test-${Date.now()}`);
6873
+ const outfile = join7(tmpdir(), `skaile-compile-test-${Date.now()}`);
6495
6874
  const __thisFile = fileURLToPath2(import.meta.url);
6496
6875
  const entryPoint = resolve5(dirname4(__thisFile), "..", "index.ts");
6497
6876
  logInfo2(`Building compiled binary...`);
@@ -6543,7 +6922,7 @@ async function runCompileTest(opts) {
6543
6922
  } catch {
6544
6923
  }
6545
6924
  try {
6546
- if (existsSync14(outfile)) unlinkSync(outfile);
6925
+ if (existsSync15(outfile)) unlinkSync(outfile);
6547
6926
  } catch {
6548
6927
  }
6549
6928
  }
@@ -6849,12 +7228,21 @@ function unitMs(unit) {
6849
7228
  throw new Error(`Unknown time unit: ${unit}`);
6850
7229
  }
6851
7230
  }
7231
+
7232
+ // cli/src/commands/session-logs/superjson-transformer.ts
7233
+ var superjsonLite = {
7234
+ serialize: (object) => ({ json: object }),
7235
+ deserialize: (payload) => payload && typeof payload === "object" && "json" in payload ? payload.json : payload
7236
+ };
7237
+
7238
+ // cli/src/commands/session-logs/remote-query.ts
6852
7239
  async function remoteQuery(args) {
6853
7240
  const trpcUrl = normalizeTrpcUrl(args.url);
6854
7241
  const client = createTRPCUntypedClient({
6855
7242
  links: [
6856
7243
  httpLink({
6857
7244
  url: trpcUrl,
7245
+ transformer: superjsonLite,
6858
7246
  headers: () => args.token ? { authorization: `Bearer ${args.token}` } : {}
6859
7247
  })
6860
7248
  ]
@@ -6877,6 +7265,7 @@ async function remoteTail(opts) {
6877
7265
  links: [
6878
7266
  httpSubscriptionLink({
6879
7267
  url: trpcUrl,
7268
+ transformer: superjsonLite,
6880
7269
  eventSourceOptions: () => ({
6881
7270
  // EventSource init dict; Bun ignores unknown fields.
6882
7271
  ...opts.token ? { headers: { authorization: `Bearer ${opts.token}` } } : {}
@@ -7265,12 +7654,12 @@ function showOverview(am2) {
7265
7654
  }
7266
7655
  function showAsset(am2, kind, name) {
7267
7656
  const entry = am2.info(`${kind}:${name}`);
7268
- if (entry?.source && fs12__default.existsSync(entry.source)) {
7657
+ if (entry?.source && fs13__default.existsSync(entry.source)) {
7269
7658
  console.log();
7270
7659
  console.log(` ${kindColor(entry.kind)} ${S.heading(entry.name)}`);
7271
7660
  console.log(` ${S.rule(40)}`);
7272
7661
  console.log();
7273
- console.log(fs12__default.readFileSync(entry.source, "utf-8"));
7662
+ console.log(fs13__default.readFileSync(entry.source, "utf-8"));
7274
7663
  return;
7275
7664
  }
7276
7665
  logErr(`Asset not found: ${kind}:${name}`);
@@ -7306,8 +7695,12 @@ function makeStoreCommand() {
7306
7695
  store.command("login").description("Sign in to the store (Keycloak device flow \u2014 approve in your browser)").action(async () => {
7307
7696
  try {
7308
7697
  await deviceLogin(loadStoreAuthConfig());
7309
- const me = await fetchIdentity().catch(() => ({}));
7310
- logOk(`Signed in${me.username ? ` as ${S.brand(`@${me.username}`)}` : "."}`);
7698
+ const me = await fetchIdentity().catch(
7699
+ () => ({})
7700
+ );
7701
+ logOk(
7702
+ `Signed in${me.username ? ` as ${S.brand(me.username)}${me.githubLogin ? ` \u2014 publishing as ${S.brand(`@${me.githubLogin}`)}` : ""}` : "."}`
7703
+ );
7311
7704
  } catch (e) {
7312
7705
  logErr(e.message);
7313
7706
  process.exit(1);
@@ -7325,8 +7718,10 @@ function makeStoreCommand() {
7325
7718
  try {
7326
7719
  const me = await fetchIdentity();
7327
7720
  console.log();
7328
- console.log(` ${S.heading("Publisher")} ${S.brand(`@${me.username ?? "?"}`)}`);
7329
- if (me.githubLogin) console.log(` ${S.label("GitHub")} ${me.githubLogin}`);
7721
+ console.log(` ${S.label("Login")} ${S.brand(me.username ?? "?")}`);
7722
+ console.log(
7723
+ ` ${S.label("Publisher")} ${me.githubLogin ? S.brand(`@${me.githubLogin}`) : S.dim("\u2014 connect GitHub in the store to publish")}`
7724
+ );
7330
7725
  if (me.roles?.length) console.log(` ${S.label("Roles")} ${me.roles.join(", ")}`);
7331
7726
  console.log();
7332
7727
  } catch (e) {
@@ -7497,7 +7892,7 @@ function findManifestCandidates(rootPath) {
7497
7892
  function walk(dir) {
7498
7893
  let entries;
7499
7894
  try {
7500
- entries = fs12__default.readdirSync(dir, { withFileTypes: true });
7895
+ entries = fs13__default.readdirSync(dir, { withFileTypes: true });
7501
7896
  } catch {
7502
7897
  return;
7503
7898
  }
@@ -7543,7 +7938,7 @@ function checkManifestIdentity(kind, parsed) {
7543
7938
  return null;
7544
7939
  }
7545
7940
  function parseManifestCandidate(c, absRoot) {
7546
- const content = fs12__default.readFileSync(c.filePath, "utf-8");
7941
+ const content = fs13__default.readFileSync(c.filePath, "utf-8");
7547
7942
  if (c.filePath.endsWith(".md")) {
7548
7943
  const parsed = parseMdFrontmatter(content);
7549
7944
  if (parsed === null) {
@@ -7599,7 +7994,7 @@ function validateManifestCandidate(c, parsed, absRoot, registry, strictConforman
7599
7994
  }
7600
7995
  function validateManifests(rootPath, strictConformance) {
7601
7996
  const absRoot = path14__default.resolve(rootPath);
7602
- if (!fs12__default.existsSync(absRoot)) {
7997
+ if (!fs13__default.existsSync(absRoot)) {
7603
7998
  logErr(`Path does not exist: ${absRoot}`);
7604
7999
  return { total: 0, errors: 1, warnings: 0 };
7605
8000
  }
@@ -7631,7 +8026,7 @@ function findWorkspaceManifests(rootPath) {
7631
8026
  function walk(dir) {
7632
8027
  let entries;
7633
8028
  try {
7634
- entries = fs12__default.readdirSync(dir, { withFileTypes: true });
8029
+ entries = fs13__default.readdirSync(dir, { withFileTypes: true });
7635
8030
  } catch {
7636
8031
  return;
7637
8032
  }
@@ -7706,7 +8101,7 @@ function validateWorkspaceManifests(rootPath) {
7706
8101
  const relPath = path14__default.relative(absRoot, file);
7707
8102
  let parsed;
7708
8103
  try {
7709
- parsed = parse(fs12__default.readFileSync(file, "utf-8")) ?? {};
8104
+ parsed = parse(fs13__default.readFileSync(file, "utf-8")) ?? {};
7710
8105
  } catch (e) {
7711
8106
  logErr(`${relPath} \u2014 parse error: ${e instanceof Error ? e.message : String(e)}`);
7712
8107
  errors++;
@@ -7720,34 +8115,34 @@ function validateWorkspaceManifests(rootPath) {
7720
8115
  var EXCLUDED_DOMAINS = /* @__PURE__ */ new Set(["skaileup-shared", "external", "docs"]);
7721
8116
  function collectAssetVersions() {
7722
8117
  const assets = [];
7723
- if (!fs12__default.existsSync(AI_RESOURCES)) return assets;
7724
- const domains = fs12__default.readdirSync(AI_RESOURCES, { withFileTypes: true }).filter((d) => d.isDirectory() && !EXCLUDED_DOMAINS.has(d.name));
8118
+ if (!fs13__default.existsSync(AI_RESOURCES)) return assets;
8119
+ const domains = fs13__default.readdirSync(AI_RESOURCES, { withFileTypes: true }).filter((d) => d.isDirectory() && !EXCLUDED_DOMAINS.has(d.name));
7725
8120
  for (const d of domains) {
7726
8121
  const domainDir = path14__default.join(AI_RESOURCES, d.name);
7727
8122
  const skillsDir = path14__default.join(domainDir, "skills");
7728
- if (fs12__default.existsSync(skillsDir)) {
8123
+ if (fs13__default.existsSync(skillsDir)) {
7729
8124
  collectSkillVersions(skillsDir, d.name, assets);
7730
8125
  }
7731
8126
  const agentsDir = path14__default.join(domainDir, "agents");
7732
- if (fs12__default.existsSync(agentsDir)) {
8127
+ if (fs13__default.existsSync(agentsDir)) {
7733
8128
  collectAgentVersions(agentsDir, d.name, assets);
7734
8129
  }
7735
8130
  const flowsDir = path14__default.join(domainDir, "flows");
7736
- if (fs12__default.existsSync(flowsDir)) {
8131
+ if (fs13__default.existsSync(flowsDir)) {
7737
8132
  collectFlowVersions(flowsDir, d.name, assets);
7738
8133
  }
7739
8134
  const promptsDir = path14__default.join(domainDir, "prompts");
7740
- if (fs12__default.existsSync(promptsDir)) {
8135
+ if (fs13__default.existsSync(promptsDir)) {
7741
8136
  collectPromptVersions(promptsDir, d.name, assets);
7742
8137
  }
7743
8138
  }
7744
8139
  return assets;
7745
8140
  }
7746
8141
  function collectFlowVersions(dir, domain, out) {
7747
- for (const f of fs12__default.readdirSync(dir)) {
8142
+ for (const f of fs13__default.readdirSync(dir)) {
7748
8143
  if (!f.endsWith(".flow.yaml")) continue;
7749
8144
  const fp = path14__default.join(dir, f);
7750
- const content = fs12__default.readFileSync(fp, "utf-8");
8145
+ const content = fs13__default.readFileSync(fp, "utf-8");
7751
8146
  const parsed = parse(content);
7752
8147
  out.push({
7753
8148
  kind: "flow",
@@ -7759,10 +8154,10 @@ function collectFlowVersions(dir, domain, out) {
7759
8154
  }
7760
8155
  }
7761
8156
  function collectPromptVersions(dir, domain, out) {
7762
- for (const f of fs12__default.readdirSync(dir)) {
8157
+ for (const f of fs13__default.readdirSync(dir)) {
7763
8158
  if (!f.endsWith(".prompt.md")) continue;
7764
8159
  const fp = path14__default.join(dir, f);
7765
- const content = fs12__default.readFileSync(fp, "utf-8");
8160
+ const content = fs13__default.readFileSync(fp, "utf-8");
7766
8161
  const fm = parseSkillFrontmatter(content);
7767
8162
  out.push({
7768
8163
  kind: "prompt",
@@ -7774,12 +8169,12 @@ function collectPromptVersions(dir, domain, out) {
7774
8169
  }
7775
8170
  }
7776
8171
  function collectSkillVersions(dir, domain, out) {
7777
- for (const entry of fs12__default.readdirSync(dir, { withFileTypes: true })) {
8172
+ for (const entry of fs13__default.readdirSync(dir, { withFileTypes: true })) {
7778
8173
  if (!entry.isDirectory()) continue;
7779
8174
  const full = path14__default.join(dir, entry.name);
7780
8175
  const skillMd = path14__default.join(full, "SKILL.md");
7781
- if (fs12__default.existsSync(skillMd)) {
7782
- const content = fs12__default.readFileSync(skillMd, "utf-8");
8176
+ if (fs13__default.existsSync(skillMd)) {
8177
+ const content = fs13__default.readFileSync(skillMd, "utf-8");
7783
8178
  const fm = parseSkillFrontmatter(content);
7784
8179
  out.push({
7785
8180
  kind: "skill",
@@ -7794,11 +8189,11 @@ function collectSkillVersions(dir, domain, out) {
7794
8189
  }
7795
8190
  }
7796
8191
  function collectAgentVersions(dir, domain, out) {
7797
- for (const entry of fs12__default.readdirSync(dir, { withFileTypes: true })) {
8192
+ for (const entry of fs13__default.readdirSync(dir, { withFileTypes: true })) {
7798
8193
  if (!entry.isDirectory()) continue;
7799
8194
  const agentYaml = path14__default.join(dir, entry.name, "agent.yaml");
7800
- if (!fs12__default.existsSync(agentYaml)) continue;
7801
- const content = fs12__default.readFileSync(agentYaml, "utf-8");
8195
+ if (!fs13__default.existsSync(agentYaml)) continue;
8196
+ const content = fs13__default.readFileSync(agentYaml, "utf-8");
7802
8197
  const parsed = parse(content);
7803
8198
  out.push({
7804
8199
  kind: "agent",
@@ -7881,7 +8276,7 @@ function checkFlowVersionPins(assets) {
7881
8276
  }
7882
8277
  let errors = 0;
7883
8278
  for (const f of flows) {
7884
- const content = fs12__default.readFileSync(f.filePath, "utf-8");
8279
+ const content = fs13__default.readFileSync(f.filePath, "utf-8");
7885
8280
  const parsed = parse(content);
7886
8281
  const nodes = (parsed?.nodes ?? []).filter((n) => n.type === "skill" && n.data?.version).map((n) => ({
7887
8282
  nodeId: n.id,
@@ -8242,7 +8637,7 @@ program.command("init [project-dir]").description("Initialize a project director
8242
8637
  (projectDir, opts) => runInit(projectDir, opts)
8243
8638
  );
8244
8639
  async function runInit(projectDir, opts) {
8245
- const { mkdirSync: mkdirSync5, writeFileSync: writeFileSync4 } = await import('fs');
8640
+ const { mkdirSync: mkdirSync5, writeFileSync: writeFileSync5 } = await import('fs');
8246
8641
  const { stringify: stringify2 } = await import('yaml');
8247
8642
  const { DRIVER_TARGETS, SUPPORTED_DRIVER_TARGETS: SUPPORTED_DRIVER_TARGETS2 } = await import('../core/index.js');
8248
8643
  const backend = opts.backend;
@@ -8254,29 +8649,29 @@ async function runInit(projectDir, opts) {
8254
8649
  const resolved = path14__default.resolve(projectDir ?? ".");
8255
8650
  const projectName = path14__default.basename(resolved);
8256
8651
  const created = [];
8257
- const { existsSync: existsSync14 } = await import('fs');
8258
- if (!existsSync14(resolved)) {
8652
+ const { existsSync: existsSync15 } = await import('fs');
8653
+ if (!existsSync15(resolved)) {
8259
8654
  mkdirSync5(resolved, { recursive: true });
8260
8655
  created.push(".");
8261
8656
  }
8262
8657
  const skaileDir = path14__default.join(resolved, ".skaile");
8263
- if (!existsSync14(skaileDir)) {
8658
+ if (!existsSync15(skaileDir)) {
8264
8659
  mkdirSync5(path14__default.join(skaileDir, "sessions"), { recursive: true });
8265
8660
  created.push(".skaile/");
8266
8661
  }
8267
8662
  const settingsPath = path14__default.join(skaileDir, "settings.json");
8268
- if (!existsSync14(settingsPath)) {
8269
- writeFileSync4(settingsPath, "{}\n");
8663
+ if (!existsSync15(settingsPath)) {
8664
+ writeFileSync5(settingsPath, "{}\n");
8270
8665
  created.push(".skaile/settings.json");
8271
8666
  }
8272
8667
  const wsConfigPath = path14__default.join(resolved, "skaile.yaml");
8273
- if (!existsSync14(wsConfigPath)) {
8274
- writeFileSync4(wsConfigPath, stringify2(buildInitWorkspaceConfig(projectName, backend)));
8668
+ if (!existsSync15(wsConfigPath)) {
8669
+ writeFileSync5(wsConfigPath, stringify2(buildInitWorkspaceConfig(projectName, backend)));
8275
8670
  created.push("skaile.yaml");
8276
8671
  }
8277
8672
  for (const dir of new Set(Object.values(DRIVER_TARGETS[backend].local))) {
8278
8673
  const full = path14__default.join(resolved, dir);
8279
- if (!existsSync14(full)) {
8674
+ if (!existsSync15(full)) {
8280
8675
  mkdirSync5(full, { recursive: true });
8281
8676
  created.push(`${dir}/`);
8282
8677
  }
@@ -8307,7 +8702,7 @@ function buildInitWorkspaceConfig(projectName, backend) {
8307
8702
  }
8308
8703
  async function initGitScaffold(resolved, created) {
8309
8704
  const { execSync: execSync3 } = await import('child_process');
8310
- const { existsSync: existsSync14, readFileSync: readFileSync8, writeFileSync: writeFileSync4 } = await import('fs');
8705
+ const { existsSync: existsSync15, readFileSync: readFileSync9, writeFileSync: writeFileSync5 } = await import('fs');
8311
8706
  const gitignorePath = path14__default.join(resolved, ".gitignore");
8312
8707
  const entries = [
8313
8708
  "node_modules/",
@@ -8323,16 +8718,16 @@ async function initGitScaffold(resolved, created) {
8323
8718
  ".env",
8324
8719
  ".env.local"
8325
8720
  ];
8326
- const existing = existsSync14(gitignorePath) ? readFileSync8(gitignorePath, "utf-8") : "";
8721
+ const existing = existsSync15(gitignorePath) ? readFileSync9(gitignorePath, "utf-8") : "";
8327
8722
  const have = new Set(existing.split("\n").map((l) => l.trim()));
8328
8723
  const append = entries.filter((e) => !have.has(e));
8329
8724
  if (append.length > 0) {
8330
8725
  const prefix = existing && !existing.endsWith("\n") ? "\n" : "";
8331
- writeFileSync4(gitignorePath, `${existing + prefix}${append.join("\n")}
8726
+ writeFileSync5(gitignorePath, `${existing + prefix}${append.join("\n")}
8332
8727
  `);
8333
8728
  if (!existing) created.push(".gitignore");
8334
8729
  }
8335
- if (!existsSync14(path14__default.join(resolved, ".git"))) {
8730
+ if (!existsSync15(path14__default.join(resolved, ".git"))) {
8336
8731
  try {
8337
8732
  execSync3("git init", { cwd: resolved, stdio: "pipe" });
8338
8733
  created.push(".git/");
@@ -8344,10 +8739,10 @@ async function initGitScaffold(resolved, created) {
8344
8739
  }
8345
8740
  async function bootstrapUserConfig() {
8346
8741
  try {
8347
- const fs13 = await import('fs');
8742
+ const fs14 = await import('fs');
8348
8743
  const { userConfigPath, saveConfig, getConfigDefaults } = await import('../library/index.js');
8349
8744
  const userCfgPath = userConfigPath();
8350
- if (!fs13.existsSync(userCfgPath)) {
8745
+ if (!fs14.existsSync(userCfgPath)) {
8351
8746
  const defaults = getConfigDefaults();
8352
8747
  saveConfig(userCfgPath, {
8353
8748
  catalog: { url: defaults.catalog.url, cache_ttl: defaults.catalog.cache_ttl }
@@ -8362,7 +8757,7 @@ async function bootstrapUserConfig() {
8362
8757
  }
8363
8758
  async function hydrateInitSources(resolved, created) {
8364
8759
  try {
8365
- const { ensureSourcesCloned } = await import('../ensure-sources-QDVFUIUP.js');
8760
+ const { ensureSourcesCloned } = await import('../ensure-sources-NXBYK5GP.js');
8366
8761
  const hydrate = ensureSourcesCloned(resolved, { quiet: true });
8367
8762
  for (const n of hydrate.cloned) created.push(`~/.skaile/cache/sources/${n}/`);
8368
8763
  if (hydrate.failed.length > 0) {
@@ -8402,7 +8797,7 @@ function printInitSummary(resolved, projectDir, created) {
8402
8797
  console.log();
8403
8798
  }
8404
8799
  program.command("setup").description("Interactive provider setup wizard").action(async () => {
8405
- const { cmdSetup } = await import('../setup-2CCS63L6.js');
8800
+ const { cmdSetup } = await import('../setup-ETGRXSZG.js');
8406
8801
  await cmdSetup([], { projectDir: process.cwd() });
8407
8802
  });
8408
8803
  program.addCommand(makeInstallCommand());