@nextclaw/service 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli/commands/agent/agent-runtime.utils.d.ts +15 -0
  3. package/dist/cli/commands/agent/agent-runtime.utils.js +85 -0
  4. package/dist/cli/commands/agent/cli-agent-runner.utils.d.ts +21 -0
  5. package/dist/cli/commands/agent/cli-agent-runner.utils.js +89 -0
  6. package/dist/cli/commands/agent/index.d.ts +3 -0
  7. package/dist/cli/commands/agent/index.js +3 -0
  8. package/dist/cli/commands/agent/services/agent-commands.service.d.ts +17 -0
  9. package/dist/cli/commands/agent/services/agent-commands.service.js +112 -0
  10. package/dist/cli/commands/companion/index.d.ts +15 -0
  11. package/dist/cli/commands/companion/index.js +24 -0
  12. package/dist/cli/commands/companion/services/companion-process.service.d.ts +17 -0
  13. package/dist/cli/commands/companion/services/companion-process.service.js +49 -0
  14. package/dist/cli/commands/config/index.d.ts +2 -0
  15. package/dist/cli/commands/config/index.js +2 -0
  16. package/dist/cli/commands/config/services/config-commands.service.d.ts +18 -0
  17. package/dist/cli/commands/config/services/config-commands.service.js +133 -0
  18. package/dist/cli/commands/cron/index.d.ts +2 -0
  19. package/dist/cli/commands/cron/index.js +2 -0
  20. package/dist/cli/commands/cron/services/cron-commands.service.d.ts +22 -0
  21. package/dist/cli/commands/cron/services/cron-commands.service.js +107 -0
  22. package/dist/cli/commands/cron/services/cron-local.service.d.ts +25 -0
  23. package/dist/cli/commands/cron/services/cron-local.service.js +95 -0
  24. package/dist/cli/commands/cron/utils/cron-job.utils.d.ts +31 -0
  25. package/dist/cli/commands/cron/utils/cron-job.utils.js +15 -0
  26. package/dist/cli/commands/diagnostics/index.d.ts +2 -0
  27. package/dist/cli/commands/diagnostics/index.js +2 -0
  28. package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.d.ts +22 -0
  29. package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.js +319 -0
  30. package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.d.ts +23 -0
  31. package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.js +66 -0
  32. package/dist/cli/commands/gateway/index.d.ts +14 -0
  33. package/dist/cli/commands/gateway/index.js +15 -0
  34. package/dist/cli/commands/logs/index.d.ts +12 -0
  35. package/dist/cli/commands/logs/index.js +29 -0
  36. package/dist/cli/commands/mcp/index.d.ts +14 -0
  37. package/dist/cli/commands/mcp/index.js +193 -0
  38. package/dist/cli/commands/restart/index.d.ts +20 -0
  39. package/dist/cli/commands/restart/index.js +88 -0
  40. package/dist/cli/commands/secrets/index.d.ts +22 -0
  41. package/dist/cli/commands/secrets/index.js +280 -0
  42. package/dist/cli/commands/serve/index.d.ts +14 -0
  43. package/dist/cli/commands/serve/index.js +19 -0
  44. package/dist/cli/commands/skills/index.d.ts +26 -0
  45. package/dist/cli/commands/skills/index.js +147 -0
  46. package/dist/cli/commands/skills/marketplace-client.d.ts +31 -0
  47. package/dist/cli/commands/skills/marketplace-client.js +84 -0
  48. package/dist/cli/commands/skills/marketplace-command-options.utils.d.ts +25 -0
  49. package/dist/cli/commands/skills/marketplace-command-options.utils.js +31 -0
  50. package/dist/cli/commands/skills/marketplace-identity.utils.d.ts +14 -0
  51. package/dist/cli/commands/skills/marketplace-identity.utils.js +77 -0
  52. package/dist/cli/commands/skills/marketplace-network-retry.d.ts +4 -0
  53. package/dist/cli/commands/skills/marketplace-network-retry.js +32 -0
  54. package/dist/cli/commands/skills/marketplace.metadata.d.ts +29 -0
  55. package/dist/cli/commands/skills/marketplace.metadata.js +158 -0
  56. package/dist/cli/commands/skills/marketplace.service.d.ts +46 -0
  57. package/dist/cli/commands/skills/marketplace.service.js +238 -0
  58. package/dist/cli/commands/skills/skills-query.service.d.ts +141 -0
  59. package/dist/cli/commands/skills/skills-query.service.js +212 -0
  60. package/dist/cli/commands/start/index.d.ts +18 -0
  61. package/dist/cli/commands/start/index.js +25 -0
  62. package/dist/cli/commands/stop/index.d.ts +12 -0
  63. package/dist/cli/commands/stop/index.js +11 -0
  64. package/dist/cli/commands/ui/index.d.ts +14 -0
  65. package/dist/cli/commands/ui/index.js +17 -0
  66. package/dist/cli/commands/usage/index.d.ts +2 -0
  67. package/dist/cli/commands/usage/index.js +2 -0
  68. package/dist/cli/commands/usage/services/llm-usage-command.service.d.ts +22 -0
  69. package/dist/cli/commands/usage/services/llm-usage-command.service.js +160 -0
  70. package/dist/cli/commands/usage/services/llm-usage-query.service.d.ts +43 -0
  71. package/dist/cli/commands/usage/services/llm-usage-query.service.js +85 -0
  72. package/dist/commands/channel/channel-config-view.d.ts +7 -0
  73. package/dist/commands/channel/channel-config-view.js +7 -0
  74. package/dist/commands/channel/index.d.ts +28 -0
  75. package/dist/commands/channel/index.js +224 -0
  76. package/dist/commands/platform-auth/index.d.ts +2 -0
  77. package/dist/commands/platform-auth/index.js +2 -0
  78. package/dist/commands/platform-auth/services/account-status.service.d.ts +18 -0
  79. package/dist/commands/platform-auth/services/account-status.service.js +34 -0
  80. package/dist/commands/platform-auth/services/platform-auth-commands.service.d.ts +77 -0
  81. package/dist/commands/platform-auth/services/platform-auth-commands.service.js +295 -0
  82. package/dist/commands/platform-auth/utils/payload.utils.d.ts +28 -0
  83. package/dist/commands/platform-auth/utils/payload.utils.js +87 -0
  84. package/dist/commands/plugin/development-source/dev-plugin-overrides.utils.d.ts +18 -0
  85. package/dist/commands/plugin/development-source/dev-plugin-overrides.utils.js +111 -0
  86. package/dist/commands/plugin/development-source/first-party-plugin-load-paths.d.ts +9 -0
  87. package/dist/commands/plugin/development-source/first-party-plugin-load-paths.js +183 -0
  88. package/dist/commands/plugin/index.d.ts +30 -0
  89. package/dist/commands/plugin/index.js +266 -0
  90. package/dist/commands/plugin/plugin-command-utils.d.ts +13 -0
  91. package/dist/commands/plugin/plugin-command-utils.js +37 -0
  92. package/dist/commands/plugin/plugin-extension-registry.d.ts +10 -0
  93. package/dist/commands/plugin/plugin-extension-registry.js +35 -0
  94. package/dist/commands/plugin/plugin-mutation-actions.d.ts +15 -0
  95. package/dist/commands/plugin/plugin-mutation-actions.js +162 -0
  96. package/dist/commands/plugin/plugin-registry-loader.d.ts +15 -0
  97. package/dist/commands/plugin/plugin-registry-loader.js +43 -0
  98. package/dist/commands/plugin/plugin-reload.d.ts +13 -0
  99. package/dist/commands/plugin/plugin-reload.js +42 -0
  100. package/dist/commands/remote/index.d.ts +47 -0
  101. package/dist/commands/remote/index.js +174 -0
  102. package/dist/commands/remote/services/remote-access-host.service.d.ts +41 -0
  103. package/dist/commands/remote/services/remote-access-host.service.js +126 -0
  104. package/dist/commands/remote/services/remote-runtime-support.service.d.ts +15 -0
  105. package/dist/commands/remote/services/remote-runtime-support.service.js +79 -0
  106. package/dist/commands/remote/services/remote-service-control.service.d.ts +33 -0
  107. package/dist/commands/remote/services/remote-service-control.service.js +188 -0
  108. package/dist/commands/remote/utils/platform-api-base.utils.d.ts +14 -0
  109. package/dist/commands/remote/utils/platform-api-base.utils.js +39 -0
  110. package/dist/commands/service/index.d.ts +16 -0
  111. package/dist/commands/service/index.js +31 -0
  112. package/dist/commands/service/services/autostart/host-autostart-command.service.d.ts +29 -0
  113. package/dist/commands/service/services/autostart/host-autostart-command.service.js +158 -0
  114. package/dist/commands/service/services/autostart/host-autostart-runtime.service.d.ts +23 -0
  115. package/dist/commands/service/services/autostart/host-autostart-runtime.service.js +53 -0
  116. package/dist/commands/service/services/autostart/host-autostart.service.d.ts +41 -0
  117. package/dist/commands/service/services/autostart/host-autostart.service.js +48 -0
  118. package/dist/commands/service/services/autostart/linux-systemd-autostart.service.d.ts +48 -0
  119. package/dist/commands/service/services/autostart/linux-systemd-autostart.service.js +433 -0
  120. package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.d.ts +54 -0
  121. package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.js +405 -0
  122. package/dist/commands/service/services/autostart/windows-task-autostart.service.d.ts +54 -0
  123. package/dist/commands/service/services/autostart/windows-task-autostart.service.js +403 -0
  124. package/dist/commands/service/types/autostart/host-autostart.types.d.ts +64 -0
  125. package/dist/commands/service/types/autostart/host-autostart.types.js +1 -0
  126. package/dist/index.d.ts +4 -0
  127. package/dist/index.js +3 -0
  128. package/dist/launcher/npm-runtime-bundle-layout.store.d.ts +23 -0
  129. package/dist/launcher/npm-runtime-bundle-layout.store.js +37 -0
  130. package/dist/launcher/npm-runtime-bundle-manifest.service.d.ts +9 -0
  131. package/dist/launcher/npm-runtime-bundle-manifest.service.js +39 -0
  132. package/dist/launcher/npm-runtime-bundle.service.d.ts +47 -0
  133. package/dist/launcher/npm-runtime-bundle.service.js +150 -0
  134. package/dist/launcher/npm-runtime-bundle.types.d.ts +49 -0
  135. package/dist/launcher/npm-runtime-bundle.types.js +1 -0
  136. package/dist/launcher/npm-runtime-launcher.service.d.ts +19 -0
  137. package/dist/launcher/npm-runtime-launcher.service.js +57 -0
  138. package/dist/launcher/npm-runtime-update-command.service.d.ts +12 -0
  139. package/dist/launcher/npm-runtime-update-command.service.js +87 -0
  140. package/dist/launcher/npm-runtime-update-source.service.d.ts +19 -0
  141. package/dist/launcher/npm-runtime-update-source.service.js +57 -0
  142. package/dist/launcher/npm-runtime-update-state.store.d.ts +17 -0
  143. package/dist/launcher/npm-runtime-update-state.store.js +92 -0
  144. package/dist/launcher/npm-runtime-update.manager.d.ts +42 -0
  145. package/dist/launcher/npm-runtime-update.manager.js +179 -0
  146. package/dist/launcher/npm-runtime-update.service.d.ts +54 -0
  147. package/dist/launcher/npm-runtime-update.service.js +183 -0
  148. package/dist/service-runtime.service.d.ts +91 -0
  149. package/dist/service-runtime.service.js +392 -0
  150. package/dist/shared/controllers/gateway.controller.d.ts +61 -0
  151. package/dist/shared/controllers/gateway.controller.js +318 -0
  152. package/dist/shared/services/extensions/extension-lifecycle.service.d.ts +56 -0
  153. package/dist/shared/services/extensions/extension-lifecycle.service.js +143 -0
  154. package/dist/shared/services/extensions/service-extension-runtime.service.d.ts +51 -0
  155. package/dist/shared/services/extensions/service-extension-runtime.service.js +338 -0
  156. package/dist/shared/services/gateway/cron-job-handler.service.d.ts +26 -0
  157. package/dist/shared/services/gateway/cron-job-handler.service.js +100 -0
  158. package/dist/shared/services/gateway/gateway-restart-wake.service.d.ts +12 -0
  159. package/dist/shared/services/gateway/gateway-restart-wake.service.js +91 -0
  160. package/dist/shared/services/gateway/managers/gateway-plugin.manager.d.ts +37 -0
  161. package/dist/shared/services/gateway/managers/gateway-plugin.manager.js +218 -0
  162. package/dist/shared/services/gateway/managers/gateway-remote.manager.d.ts +20 -0
  163. package/dist/shared/services/gateway/managers/gateway-remote.manager.js +25 -0
  164. package/dist/shared/services/gateway/nextclaw-app.service.d.ts +22 -0
  165. package/dist/shared/services/gateway/nextclaw-app.service.js +53 -0
  166. package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts +89 -0
  167. package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js +337 -0
  168. package/dist/shared/services/gateway/service-bootstrap-status.d.ts +33 -0
  169. package/dist/shared/services/gateway/service-bootstrap-status.js +152 -0
  170. package/dist/shared/services/gateway/service-startup-support.service.d.ts +42 -0
  171. package/dist/shared/services/gateway/service-startup-support.service.js +96 -0
  172. package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts +9 -0
  173. package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js +10 -0
  174. package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts +31 -0
  175. package/dist/shared/services/marketplace/service-marketplace-installer.service.js +99 -0
  176. package/dist/shared/services/marketplace/service-mcp-marketplace-ops.d.ts +39 -0
  177. package/dist/shared/services/marketplace/service-mcp-marketplace-ops.js +67 -0
  178. package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.d.ts +24 -0
  179. package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.js +117 -0
  180. package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.d.ts +6 -0
  181. package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.js +96 -0
  182. package/dist/shared/services/restart/restart-coordinator.service.d.ts +30 -0
  183. package/dist/shared/services/restart/restart-coordinator.service.js +51 -0
  184. package/dist/shared/services/restart/restart-sentinel.service.d.ts +39 -0
  185. package/dist/shared/services/restart/restart-sentinel.service.js +88 -0
  186. package/dist/shared/services/restart/runtime-restart-request.service.d.ts +24 -0
  187. package/dist/shared/services/restart/runtime-restart-request.service.js +42 -0
  188. package/dist/shared/services/runtime/runtime-command.service.d.ts +37 -0
  189. package/dist/shared/services/runtime/runtime-command.service.js +163 -0
  190. package/dist/shared/services/runtime/runtime-config-init.service.d.ts +4 -0
  191. package/dist/shared/services/runtime/runtime-config-init.service.js +10 -0
  192. package/dist/shared/services/runtime/service-managed-startup.service.d.ts +146 -0
  193. package/dist/shared/services/runtime/service-managed-startup.service.js +426 -0
  194. package/dist/shared/services/runtime/service-remote-runtime.service.d.ts +53 -0
  195. package/dist/shared/services/runtime/service-remote-runtime.service.js +173 -0
  196. package/dist/shared/services/runtime/utils/skills-loader.utils.d.ts +12 -0
  197. package/dist/shared/services/runtime/utils/skills-loader.utils.js +9 -0
  198. package/dist/shared/services/session/service-deferred-ncp-agent.service.d.ts +14 -0
  199. package/dist/shared/services/session/service-deferred-ncp-agent.service.js +85 -0
  200. package/dist/shared/services/ui/companion-runtime.service.d.ts +33 -0
  201. package/dist/shared/services/ui/companion-runtime.service.js +145 -0
  202. package/dist/shared/services/ui/local-ui-discovery.service.d.ts +19 -0
  203. package/dist/shared/services/ui/local-ui-discovery.service.js +41 -0
  204. package/dist/shared/services/ui/npm-runtime-update-host.service.d.ts +40 -0
  205. package/dist/shared/services/ui/npm-runtime-update-host.service.js +181 -0
  206. package/dist/shared/services/ui/runtime-control-host.service.d.ts +28 -0
  207. package/dist/shared/services/ui/runtime-control-host.service.js +89 -0
  208. package/dist/shared/services/ui/service-remote-access.service.d.ts +25 -0
  209. package/dist/shared/services/ui/service-remote-access.service.js +38 -0
  210. package/dist/shared/services/ui/ui-bridge-api.service.d.ts +16 -0
  211. package/dist/shared/services/ui/ui-bridge-api.service.js +43 -0
  212. package/dist/shared/services/workspace/workspace-manager.service.d.ts +19 -0
  213. package/dist/shared/services/workspace/workspace-manager.service.js +135 -0
  214. package/dist/shared/stores/companion-runtime.store.d.ts +15 -0
  215. package/dist/shared/stores/companion-runtime.store.js +27 -0
  216. package/dist/shared/stores/local-ui-runtime.store.d.ts +25 -0
  217. package/dist/shared/stores/local-ui-runtime.store.js +54 -0
  218. package/dist/shared/stores/managed-service-state.store.d.ts +28 -0
  219. package/dist/shared/stores/managed-service-state.store.js +38 -0
  220. package/dist/shared/stores/pending-restart.store.d.ts +21 -0
  221. package/dist/shared/stores/pending-restart.store.js +35 -0
  222. package/dist/shared/types/cli.types.d.ts +295 -0
  223. package/dist/shared/types/cli.types.js +1 -0
  224. package/dist/shared/utils/cli.utils.d.ts +34 -0
  225. package/dist/shared/utils/cli.utils.js +262 -0
  226. package/dist/shared/utils/config-path.d.ts +15 -0
  227. package/dist/shared/utils/config-path.js +167 -0
  228. package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.d.ts +16 -0
  229. package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.js +46 -0
  230. package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.d.ts +9 -0
  231. package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.js +33 -0
  232. package/dist/shared/utils/package/package-manifest.utils.d.ts +8 -0
  233. package/dist/shared/utils/package/package-manifest.utils.js +48 -0
  234. package/dist/shared/utils/runtime-helpers.d.ts +14 -0
  235. package/dist/shared/utils/runtime-helpers.js +26 -0
  236. package/dist/shared/utils/service-port-probe.utils.d.ts +41 -0
  237. package/dist/shared/utils/service-port-probe.utils.js +164 -0
  238. package/dist/shared/utils/startup-trace.d.ts +7 -0
  239. package/dist/shared/utils/startup-trace.js +37 -0
  240. package/dist/shared/utils/top-level-nextclaw-command-env.utils.d.ts +4 -0
  241. package/dist/shared/utils/top-level-nextclaw-command-env.utils.js +10 -0
  242. package/package.json +68 -0
@@ -0,0 +1,280 @@
1
+ import { getAtConfigPath, parseRequiredConfigPath } from "../../../shared/utils/config-path.js";
2
+ import { buildReloadPlan, diffConfigPaths, getConfigPath, loadConfig, resolveConfigSecrets, saveConfig } from "@nextclaw/core";
3
+ import { readFileSync } from "node:fs";
4
+ //#region src/cli/commands/secrets/index.ts
5
+ const SECRET_SOURCES = [
6
+ "env",
7
+ "file",
8
+ "exec"
9
+ ];
10
+ function normalizeSecretSource(value) {
11
+ if (typeof value !== "string") return null;
12
+ const normalized = value.trim().toLowerCase();
13
+ return SECRET_SOURCES.includes(normalized) ? normalized : null;
14
+ }
15
+ function normalizeOptionalString(value) {
16
+ if (typeof value !== "string") return;
17
+ return value.trim() || void 0;
18
+ }
19
+ function parseTimeoutMs(value) {
20
+ if (value === void 0 || value === null || value === "") return;
21
+ const parsed = Number(value);
22
+ if (!Number.isFinite(parsed) || parsed <= 0) throw new Error(`invalid timeout: ${String(value)}`);
23
+ return Math.trunc(parsed);
24
+ }
25
+ function inferProviderAlias(config, ref) {
26
+ const explicit = normalizeOptionalString(ref.provider);
27
+ if (explicit) return explicit;
28
+ const defaultAlias = normalizeOptionalString(config.secrets.defaults[ref.source]);
29
+ if (defaultAlias) return defaultAlias;
30
+ return ref.source;
31
+ }
32
+ function summarizeAudit(items) {
33
+ const ok = items.filter((item) => item.ok).length;
34
+ return {
35
+ total: items.length,
36
+ ok,
37
+ failed: items.length - ok
38
+ };
39
+ }
40
+ function parseRefsPatch(raw) {
41
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new Error("refs patch must be an object");
42
+ const output = {};
43
+ for (const [path, value] of Object.entries(raw)) {
44
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`invalid ref for ${path}`);
45
+ const source = normalizeSecretSource(value.source);
46
+ const id = normalizeOptionalString(value.id);
47
+ const provider = normalizeOptionalString(value.provider);
48
+ if (!source || !id) throw new Error(`invalid ref for ${path}: source/id is required`);
49
+ output[path] = {
50
+ source,
51
+ ...provider ? { provider } : {},
52
+ id
53
+ };
54
+ }
55
+ return output;
56
+ }
57
+ function parseApplyFile(raw) {
58
+ const data = JSON.parse(raw);
59
+ if (!data || typeof data !== "object" || Array.isArray(data)) throw new Error("apply file must be an object");
60
+ const record = data;
61
+ if (record.refs || record.providers || record.defaults || Object.prototype.hasOwnProperty.call(record, "enabled")) {
62
+ const patch = {};
63
+ if (Object.prototype.hasOwnProperty.call(record, "enabled")) patch.enabled = Boolean(record.enabled);
64
+ if (record.defaults && typeof record.defaults === "object" && !Array.isArray(record.defaults)) patch.defaults = record.defaults;
65
+ if (record.providers && typeof record.providers === "object" && !Array.isArray(record.providers)) patch.providers = record.providers;
66
+ if (record.refs) patch.refs = parseRefsPatch(record.refs);
67
+ return patch;
68
+ }
69
+ return { refs: parseRefsPatch(record) };
70
+ }
71
+ var SecretsCommands = class {
72
+ constructor(deps) {
73
+ this.deps = deps;
74
+ }
75
+ audit = (opts = {}) => {
76
+ const config = loadConfig();
77
+ const configPath = getConfigPath();
78
+ const refs = config.secrets.refs;
79
+ const items = [];
80
+ for (const [path, ref] of Object.entries(refs)) {
81
+ const provider = inferProviderAlias(config, ref);
82
+ const scopedConfig = structuredClone(config);
83
+ scopedConfig.secrets.refs = { [path]: ref };
84
+ try {
85
+ const target = getAtConfigPath(resolveConfigSecrets(scopedConfig, { configPath }), parseRequiredConfigPath(path));
86
+ if (!target.found) {
87
+ items.push({
88
+ path,
89
+ source: ref.source,
90
+ provider,
91
+ id: ref.id,
92
+ ok: false,
93
+ detail: "resolved but path not found"
94
+ });
95
+ continue;
96
+ }
97
+ const resolvedValue = target.value;
98
+ const detail = typeof resolvedValue === "string" ? `resolved (length=${resolvedValue.length})` : `resolved (${typeof resolvedValue})`;
99
+ items.push({
100
+ path,
101
+ source: ref.source,
102
+ provider,
103
+ id: ref.id,
104
+ ok: true,
105
+ detail
106
+ });
107
+ } catch (error) {
108
+ items.push({
109
+ path,
110
+ source: ref.source,
111
+ provider,
112
+ id: ref.id,
113
+ ok: false,
114
+ detail: String(error)
115
+ });
116
+ }
117
+ }
118
+ const summary = summarizeAudit(items);
119
+ if (opts.json) console.log(JSON.stringify({
120
+ summary,
121
+ items
122
+ }, null, 2));
123
+ else if (!items.length) console.log("No secret refs configured.");
124
+ else {
125
+ for (const item of items) {
126
+ const status = item.ok ? "OK" : "ERROR";
127
+ console.log(`[${status}] ${item.path} <- ${item.source}:${item.provider}:${item.id} (${item.detail})`);
128
+ }
129
+ console.log(`Summary: total=${summary.total}, ok=${summary.ok}, failed=${summary.failed}`);
130
+ }
131
+ if (Boolean(opts.strict) && summary.failed > 0) process.exitCode = 1;
132
+ };
133
+ configure = async (opts) => {
134
+ const alias = normalizeOptionalString(opts.provider);
135
+ if (!alias) throw new Error("provider alias is required");
136
+ const prevConfig = loadConfig();
137
+ const nextConfig = structuredClone(prevConfig);
138
+ const remove = Boolean(opts.remove);
139
+ if (remove) this.removeProvider(nextConfig, alias);
140
+ else this.configureProvider(nextConfig, alias, opts);
141
+ resolveConfigSecrets(nextConfig, { configPath: getConfigPath() });
142
+ saveConfig(nextConfig);
143
+ await this.requestRestartForConfigDiff({
144
+ prevConfig,
145
+ nextConfig,
146
+ reason: `secrets.configure ${alias}`,
147
+ manualMessage: "Secrets provider updated. Restart the gateway if required."
148
+ });
149
+ if (opts.json) {
150
+ console.log(JSON.stringify({
151
+ ok: true,
152
+ providers: nextConfig.secrets.providers,
153
+ defaults: nextConfig.secrets.defaults
154
+ }, null, 2));
155
+ return;
156
+ }
157
+ console.log(`Secrets provider ${remove ? "removed" : "configured"}: ${alias}`);
158
+ };
159
+ apply = async (opts) => {
160
+ const prevConfig = loadConfig();
161
+ const nextConfig = structuredClone(prevConfig);
162
+ this.applyEnabledPatch(nextConfig, opts);
163
+ this.applyFilePatch(nextConfig, opts);
164
+ this.applySingleRefPatch(nextConfig, opts);
165
+ resolveConfigSecrets(nextConfig, { configPath: getConfigPath() });
166
+ saveConfig(nextConfig);
167
+ await this.requestRestartForConfigDiff({
168
+ prevConfig,
169
+ nextConfig,
170
+ reason: "secrets.apply",
171
+ manualMessage: "Secrets updated. Restart the gateway if required."
172
+ });
173
+ if (opts.json) {
174
+ console.log(JSON.stringify({
175
+ ok: true,
176
+ secrets: nextConfig.secrets
177
+ }, null, 2));
178
+ return;
179
+ }
180
+ console.log("Secrets applied.");
181
+ };
182
+ reload = async (opts = {}) => {
183
+ const config = loadConfig();
184
+ resolveConfigSecrets(config, { configPath: getConfigPath() });
185
+ saveConfig(config);
186
+ if (opts.json) {
187
+ console.log(JSON.stringify({
188
+ ok: true,
189
+ message: "secrets reload signal emitted"
190
+ }, null, 2));
191
+ return;
192
+ }
193
+ console.log("Secrets reload signal emitted.");
194
+ };
195
+ removeProvider = (config, alias) => {
196
+ delete config.secrets.providers[alias];
197
+ for (const source of SECRET_SOURCES) if (config.secrets.defaults[source] === alias) delete config.secrets.defaults[source];
198
+ };
199
+ configureProvider = (config, alias, opts) => {
200
+ const source = normalizeSecretSource(opts.source);
201
+ if (!source) throw new Error("source is required and must be one of env/file/exec");
202
+ config.secrets.providers[alias] = this.buildProviderConfig(source, opts);
203
+ if (opts.setDefault) config.secrets.defaults[source] = alias;
204
+ };
205
+ buildProviderConfig = (source, opts) => {
206
+ if (source === "env") return {
207
+ source,
208
+ ...normalizeOptionalString(opts.prefix) ? { prefix: normalizeOptionalString(opts.prefix) } : {}
209
+ };
210
+ if (source === "file") {
211
+ const path = normalizeOptionalString(opts.path);
212
+ if (!path) throw new Error("file source requires --path");
213
+ return {
214
+ source,
215
+ path,
216
+ format: "json"
217
+ };
218
+ }
219
+ const command = normalizeOptionalString(opts.command);
220
+ if (!command) throw new Error("exec source requires --command");
221
+ return {
222
+ source,
223
+ command,
224
+ args: Array.isArray(opts.arg) ? opts.arg : [],
225
+ ...normalizeOptionalString(opts.cwd) ? { cwd: normalizeOptionalString(opts.cwd) } : {},
226
+ timeoutMs: parseTimeoutMs(opts.timeoutMs) ?? 5e3
227
+ };
228
+ };
229
+ applyEnabledPatch = (config, opts) => {
230
+ const { disable, enable } = opts;
231
+ if (enable && disable) throw new Error("cannot set --enable and --disable at the same time");
232
+ if (enable || disable) config.secrets.enabled = Boolean(enable);
233
+ };
234
+ applyFilePatch = (config, opts) => {
235
+ if (!opts.file) return;
236
+ const { defaults, providers, refs } = parseApplyFile(readFileSync(opts.file, "utf-8"));
237
+ if (defaults) config.secrets.defaults = defaults;
238
+ if (providers) config.secrets.providers = providers;
239
+ if (refs) config.secrets.refs = {
240
+ ...config.secrets.refs,
241
+ ...refs
242
+ };
243
+ };
244
+ applySingleRefPatch = (config, opts) => {
245
+ if (!opts.path) {
246
+ if (opts.remove && !opts.file) throw new Error("--remove requires --path");
247
+ return;
248
+ }
249
+ const path = opts.path.trim();
250
+ if (!path) throw new Error("path is empty");
251
+ if (opts.remove) {
252
+ delete config.secrets.refs[path];
253
+ return;
254
+ }
255
+ const source = normalizeSecretSource(opts.source);
256
+ const id = normalizeOptionalString(opts.id);
257
+ if (!source || !id) throw new Error("apply single ref requires --source and --id");
258
+ const provider = normalizeOptionalString(opts.provider);
259
+ config.secrets.refs[path] = {
260
+ source,
261
+ id,
262
+ ...provider ? { provider } : {}
263
+ };
264
+ };
265
+ requestRestartForConfigDiff = async (params) => {
266
+ const { manualMessage, nextConfig, prevConfig, reason } = params;
267
+ const changedPaths = diffConfigPaths(prevConfig, nextConfig);
268
+ if (!changedPaths.length) return;
269
+ const plan = buildReloadPlan(changedPaths);
270
+ if (plan.restartRequired.length === 0) return;
271
+ await this.deps.requestRestart({
272
+ changedPaths: plan.restartRequired,
273
+ mode: "notify",
274
+ reason: `${reason} (${plan.restartRequired.join(", ")})`,
275
+ manualMessage
276
+ });
277
+ };
278
+ };
279
+ //#endregion
280
+ export { SecretsCommands };
@@ -0,0 +1,14 @@
1
+ import { StartCommandOptions } from "../../../shared/types/cli.types.js";
2
+ import { RuntimeCommandService } from "../../../shared/services/runtime/runtime-command.service.js";
3
+
4
+ //#region src/cli/commands/serve/index.d.ts
5
+ declare class ServeCommands {
6
+ private readonly deps;
7
+ constructor(deps: {
8
+ runtimeCommandService: RuntimeCommandService;
9
+ forcedPublicHost: string;
10
+ });
11
+ run: (opts: StartCommandOptions) => Promise<void>;
12
+ }
13
+ //#endregion
14
+ export { ServeCommands };
@@ -0,0 +1,19 @@
1
+ import { resolveManagedServiceUiOverrides } from "../../../shared/utils/runtime-helpers.js";
2
+ //#region src/cli/commands/serve/index.ts
3
+ var ServeCommands = class {
4
+ constructor(deps) {
5
+ this.deps = deps;
6
+ }
7
+ run = async (opts) => {
8
+ const uiOverrides = resolveManagedServiceUiOverrides({
9
+ uiPort: opts.uiPort,
10
+ forcedPublicHost: this.deps.forcedPublicHost
11
+ });
12
+ await this.deps.runtimeCommandService.runForeground({
13
+ uiOverrides,
14
+ open: Boolean(opts.open)
15
+ });
16
+ };
17
+ };
18
+ //#endregion
19
+ export { ServeCommands };
@@ -0,0 +1,26 @@
1
+ import { MarketplaceSkillsRecommendCommandOptions, MarketplaceSkillsSearchCommandOptions, SkillsInfoCommandOptions, SkillsInstalledCommandOptions } from "../../../shared/types/cli.types.js";
2
+ import { MarketplacePublishCommandOptions } from "./marketplace-command-options.utils.js";
3
+
4
+ //#region src/cli/commands/skills/index.d.ts
5
+ declare class SkillsCommands {
6
+ private readonly skillsQueryService;
7
+ installed: (options?: SkillsInstalledCommandOptions) => Promise<void>;
8
+ info: (selector: string, options?: SkillsInfoCommandOptions) => Promise<void>;
9
+ install: (options: {
10
+ slug: string;
11
+ workdir?: string;
12
+ dir?: string;
13
+ force?: boolean;
14
+ apiBaseUrl?: string;
15
+ }) => Promise<void>;
16
+ marketplaceSearch: (options?: MarketplaceSkillsSearchCommandOptions) => Promise<void>;
17
+ marketplaceInfo: (slug: string, options?: {
18
+ apiBase?: string;
19
+ json?: boolean;
20
+ }) => Promise<void>;
21
+ marketplaceRecommend: (options?: MarketplaceSkillsRecommendCommandOptions) => Promise<void>;
22
+ publish: (options: MarketplacePublishCommandOptions) => Promise<void>;
23
+ update: (options: Omit<MarketplacePublishCommandOptions, "publishedAt">) => Promise<void>;
24
+ }
25
+ //#endregion
26
+ export { SkillsCommands };
@@ -0,0 +1,147 @@
1
+ import { resolveSkillsInstallWorkdir } from "../../../shared/utils/runtime-helpers.js";
2
+ import { buildMarketplacePublishOptions, buildMarketplaceUpdateOptions } from "./marketplace-command-options.utils.js";
3
+ import { installMarketplaceSkill, publishMarketplaceSkill } from "./marketplace.service.js";
4
+ import { SkillsQueryService } from "./skills-query.service.js";
5
+ import { loadConfig } from "@nextclaw/core";
6
+ //#region src/cli/commands/skills/index.ts
7
+ var SkillsCommands = class {
8
+ skillsQueryService = new SkillsQueryService();
9
+ installed = async (options = {}) => {
10
+ const config = loadConfig();
11
+ const workdir = resolveSkillsInstallWorkdir({
12
+ explicitWorkdir: options.workdir,
13
+ configuredWorkspace: config.agents.defaults.workspace
14
+ });
15
+ const result = this.skillsQueryService.listInstalled({
16
+ workdir,
17
+ scope: options.scope,
18
+ query: options.query
19
+ });
20
+ if (options.json) {
21
+ console.log(JSON.stringify(result, null, 2));
22
+ return;
23
+ }
24
+ if (result.skills.length === 0) {
25
+ console.log("No installed skills found.");
26
+ return;
27
+ }
28
+ for (const skill of result.skills) {
29
+ console.log(`${skill.name} (${skill.scope})`);
30
+ console.log(` ref: ${skill.ref}`);
31
+ console.log(` path: ${skill.path}`);
32
+ console.log(` summary: ${skill.summary ?? "-"}`);
33
+ console.log(` description: ${skill.description ?? "-"}`);
34
+ console.log(` tags: ${skill.tags.join(", ") || "-"}`);
35
+ console.log(` always: ${skill.always ? "yes" : "no"}`);
36
+ }
37
+ };
38
+ info = async (selector, options = {}) => {
39
+ const config = loadConfig();
40
+ const workdir = resolveSkillsInstallWorkdir({
41
+ explicitWorkdir: options.workdir,
42
+ configuredWorkspace: config.agents.defaults.workspace
43
+ });
44
+ const result = this.skillsQueryService.getInstalledInfo({
45
+ workdir,
46
+ selector
47
+ });
48
+ if (options.json) {
49
+ console.log(JSON.stringify(result, null, 2));
50
+ return;
51
+ }
52
+ console.log(`${result.name} (${result.scope})`);
53
+ console.log(` ref: ${result.ref}`);
54
+ console.log(` path: ${result.path}`);
55
+ console.log(` summary: ${result.summary ?? "-"}`);
56
+ console.log(` description: ${result.description ?? "-"}`);
57
+ console.log(` author: ${result.author ?? "-"}`);
58
+ console.log(` tags: ${result.tags.join(", ") || "-"}`);
59
+ console.log(` always: ${result.always ? "yes" : "no"}`);
60
+ };
61
+ install = async (options) => {
62
+ const { apiBaseUrl, dir, force, slug, workdir: explicitWorkdir } = options;
63
+ const result = await installMarketplaceSkill({
64
+ slug,
65
+ workdir: resolveSkillsInstallWorkdir({
66
+ explicitWorkdir,
67
+ configuredWorkspace: loadConfig().agents.defaults.workspace
68
+ }),
69
+ dir,
70
+ force,
71
+ apiBaseUrl
72
+ });
73
+ if (result.alreadyInstalled) console.log(`✓ ${result.slug} is already installed`);
74
+ else console.log(`✓ Installed ${result.slug} (${result.source})`);
75
+ console.log(` Path: ${result.destinationDir}`);
76
+ };
77
+ marketplaceSearch = async (options = {}) => {
78
+ const result = await this.skillsQueryService.searchMarketplaceSkills({
79
+ apiBaseUrl: options.apiBase,
80
+ query: options.query,
81
+ tag: options.tag,
82
+ sort: options.sort,
83
+ page: options.page,
84
+ pageSize: options.pageSize
85
+ });
86
+ if (options.json) {
87
+ console.log(JSON.stringify(result, null, 2));
88
+ return;
89
+ }
90
+ if (result.items.length === 0) {
91
+ console.log("No marketplace skills found.");
92
+ return;
93
+ }
94
+ for (const item of result.items) {
95
+ console.log(`${item.name} (${item.slug})`);
96
+ console.log(` summary: ${item.summary}`);
97
+ console.log(` author: ${item.author}`);
98
+ console.log(` tags: ${item.tags.join(", ") || "-"}`);
99
+ console.log(` install: ${item.install.command}`);
100
+ }
101
+ };
102
+ marketplaceInfo = async (slug, options = {}) => {
103
+ const result = await this.skillsQueryService.getMarketplaceSkillInfo({
104
+ apiBaseUrl: options.apiBase,
105
+ slug
106
+ });
107
+ if (options.json) {
108
+ console.log(JSON.stringify(result, null, 2));
109
+ return;
110
+ }
111
+ console.log(`${result.item.name} (${result.item.slug})`);
112
+ console.log(` summary: ${result.item.summary}`);
113
+ console.log(` description: ${result.item.description ?? "-"}`);
114
+ console.log(` author: ${result.item.author}`);
115
+ console.log(` tags: ${result.item.tags.join(", ") || "-"}`);
116
+ console.log(` install: ${result.item.install.command}`);
117
+ console.log(` content: ${result.content ? "available" : "unavailable"}`);
118
+ if (result.content) console.log(` source: ${result.content.source}`);
119
+ else if (result.contentUnavailableReason) console.log(` reason: ${result.contentUnavailableReason}`);
120
+ };
121
+ marketplaceRecommend = async (options = {}) => {
122
+ const result = await this.skillsQueryService.recommendMarketplaceSkills({
123
+ apiBaseUrl: options.apiBase,
124
+ scene: options.scene,
125
+ limit: options.limit
126
+ });
127
+ if (options.json) {
128
+ console.log(JSON.stringify(result, null, 2));
129
+ return;
130
+ }
131
+ console.log(`${result.title} (${result.sceneId})`);
132
+ if (result.description) console.log(` ${result.description}`);
133
+ for (const item of result.items) console.log(`- ${item.name} (${item.slug})`);
134
+ };
135
+ publish = async (options) => {
136
+ const result = await publishMarketplaceSkill(buildMarketplacePublishOptions(options));
137
+ console.log(`${result.created ? `✓ Published new skill: ${result.packageName}` : `✓ Updated skill: ${result.packageName}`}\n Alias: ${result.slug}\n Files: ${result.fileCount}`);
138
+ };
139
+ update = async (options) => {
140
+ const result = await publishMarketplaceSkill(buildMarketplaceUpdateOptions(options));
141
+ console.log(`✓ Updated skill: ${result.packageName}`);
142
+ console.log(` Alias: ${result.slug}`);
143
+ console.log(` Files: ${result.fileCount}`);
144
+ };
145
+ };
146
+ //#endregion
147
+ export { SkillsCommands };
@@ -0,0 +1,31 @@
1
+ //#region src/cli/commands/skills/marketplace-client.d.ts
2
+ type MarketplaceEnvelope<T> = {
3
+ ok: boolean;
4
+ data?: T;
5
+ error?: {
6
+ code?: string;
7
+ message?: string;
8
+ };
9
+ };
10
+ type MarketplaceSkillInstallKind = "builtin" | "marketplace";
11
+ type MarketplaceSkillFileManifestEntry = {
12
+ path: string;
13
+ downloadPath?: string;
14
+ contentBase64?: string;
15
+ };
16
+ declare function resolveMarketplaceApiBase(explicitBase: string | undefined): string;
17
+ declare function resolveMarketplaceAdminToken(explicitToken: string | undefined): string | undefined;
18
+ declare function fetchMarketplaceSkillItem(apiBase: string, slug: string): Promise<{
19
+ slug: string;
20
+ packageName?: string;
21
+ install: {
22
+ kind: MarketplaceSkillInstallKind;
23
+ };
24
+ }>;
25
+ declare function fetchMarketplaceSkillFiles(apiBase: string, slug: string): Promise<{
26
+ files: MarketplaceSkillFileManifestEntry[];
27
+ }>;
28
+ declare function fetchMarketplaceSkillFileBlob(apiBase: string, slug: string, file: MarketplaceSkillFileManifestEntry): Promise<Buffer>;
29
+ declare function readMarketplaceEnvelope<T>(response: Response): Promise<MarketplaceEnvelope<T>>;
30
+ //#endregion
31
+ export { MarketplaceSkillFileManifestEntry, fetchMarketplaceSkillFileBlob, fetchMarketplaceSkillFiles, fetchMarketplaceSkillItem, readMarketplaceEnvelope, resolveMarketplaceAdminToken, resolveMarketplaceApiBase };
@@ -0,0 +1,84 @@
1
+ import { runWithMarketplaceNetworkRetry } from "./marketplace-network-retry.js";
2
+ //#region src/cli/commands/skills/marketplace-client.ts
3
+ const DEFAULT_MARKETPLACE_API_BASE = "https://marketplace-api.nextclaw.io";
4
+ function resolveMarketplaceApiBase(explicitBase) {
5
+ return (explicitBase?.trim() || process.env.NEXTCLAW_MARKETPLACE_API_BASE?.trim() || DEFAULT_MARKETPLACE_API_BASE).replace(/\/+$/, "");
6
+ }
7
+ function resolveMarketplaceAdminToken(explicitToken) {
8
+ const token = explicitToken?.trim() || process.env.NEXTCLAW_MARKETPLACE_ADMIN_TOKEN?.trim();
9
+ return token && token.length > 0 ? token : void 0;
10
+ }
11
+ async function fetchMarketplaceSkillItem(apiBase, slug) {
12
+ return runWithMarketplaceNetworkRetry(async () => {
13
+ const response = await fetch(`${apiBase}/api/v1/skills/items/${encodeURIComponent(slug)}`, { headers: { Accept: "application/json" } });
14
+ const payload = await readMarketplaceEnvelope(response);
15
+ if (!payload.ok || !payload.data) {
16
+ const message = payload.error?.message || `marketplace skill fetch failed: ${response.status}`;
17
+ throw new Error(message);
18
+ }
19
+ const kind = payload.data.install?.kind;
20
+ if (kind !== "builtin" && kind !== "marketplace") throw new Error(`Unsupported skill install kind from marketplace: ${String(kind)}`);
21
+ return {
22
+ slug: typeof payload.data.slug === "string" && payload.data.slug.trim() ? payload.data.slug.trim() : slug,
23
+ packageName: typeof payload.data.packageName === "string" && payload.data.packageName.trim() ? payload.data.packageName.trim() : void 0,
24
+ install: { kind }
25
+ };
26
+ });
27
+ }
28
+ async function fetchMarketplaceSkillFiles(apiBase, slug) {
29
+ return runWithMarketplaceNetworkRetry(async () => {
30
+ const response = await fetch(`${apiBase}/api/v1/skills/items/${encodeURIComponent(slug)}/files`, { headers: { Accept: "application/json" } });
31
+ const payload = await readMarketplaceEnvelope(response);
32
+ if (!payload.ok || !payload.data) {
33
+ const message = payload.error?.message || `marketplace skill file fetch failed: ${response.status}`;
34
+ throw new Error(message);
35
+ }
36
+ if (!isRecord(payload.data) || !Array.isArray(payload.data.files)) throw new Error("Invalid marketplace skill file manifest response");
37
+ return { files: payload.data.files.map((entry, index) => {
38
+ if (!isRecord(entry) || typeof entry.path !== "string" || entry.path.trim().length === 0) throw new Error(`Invalid marketplace skill file manifest at index ${index}`);
39
+ const normalized = { path: entry.path.trim() };
40
+ if (typeof entry.downloadPath === "string" && entry.downloadPath.trim().length > 0) normalized.downloadPath = entry.downloadPath.trim();
41
+ if (typeof entry.contentBase64 === "string" && entry.contentBase64.trim().length > 0) normalized.contentBase64 = entry.contentBase64.trim();
42
+ return normalized;
43
+ }) };
44
+ });
45
+ }
46
+ async function fetchMarketplaceSkillFileBlob(apiBase, slug, file) {
47
+ const downloadUrl = resolveSkillFileDownloadUrl(apiBase, slug, file);
48
+ return runWithMarketplaceNetworkRetry(async () => {
49
+ const response = await fetch(downloadUrl, { headers: { Accept: "application/octet-stream" } });
50
+ if (!response.ok) {
51
+ const message = extractMarketplaceErrorMessage(await response.text(), response.status) || `marketplace skill file download failed: ${response.status}`;
52
+ throw new Error(message);
53
+ }
54
+ return Buffer.from(await response.arrayBuffer());
55
+ });
56
+ }
57
+ async function readMarketplaceEnvelope(response) {
58
+ const raw = await response.text();
59
+ let payload;
60
+ try {
61
+ payload = raw.length > 0 ? JSON.parse(raw) : null;
62
+ } catch {
63
+ throw new Error(`Invalid marketplace response: ${response.status}`);
64
+ }
65
+ if (!isRecord(payload) || typeof payload.ok !== "boolean") throw new Error(`Invalid marketplace response shape: ${response.status}`);
66
+ return payload;
67
+ }
68
+ function resolveSkillFileDownloadUrl(apiBase, slug, file) {
69
+ if (file.downloadPath) return file.downloadPath.startsWith("http://") || file.downloadPath.startsWith("https://") ? file.downloadPath : `${apiBase}${file.downloadPath}`;
70
+ return `${apiBase}/api/v1/skills/items/${encodeURIComponent(slug)}/files/blob?path=${encodeURIComponent(file.path)}`;
71
+ }
72
+ function extractMarketplaceErrorMessage(raw, fallbackStatus) {
73
+ if (!raw) return;
74
+ try {
75
+ return JSON.parse(raw).error?.message;
76
+ } catch {
77
+ return raw || `Request failed (${fallbackStatus})`;
78
+ }
79
+ }
80
+ function isRecord(value) {
81
+ return typeof value === "object" && value !== null && !Array.isArray(value);
82
+ }
83
+ //#endregion
84
+ export { fetchMarketplaceSkillFileBlob, fetchMarketplaceSkillFiles, fetchMarketplaceSkillItem, readMarketplaceEnvelope, resolveMarketplaceAdminToken, resolveMarketplaceApiBase };
@@ -0,0 +1,25 @@
1
+ import { MarketplaceSkillPublishOptions } from "./marketplace.service.js";
2
+
3
+ //#region src/cli/commands/skills/marketplace-command-options.utils.d.ts
4
+ type MarketplacePublishCommandOptions = {
5
+ dir: string;
6
+ meta?: string;
7
+ slug?: string;
8
+ packageName?: string;
9
+ scope?: string;
10
+ name?: string;
11
+ summary?: string;
12
+ description?: string;
13
+ author?: string;
14
+ tag?: string[];
15
+ sourceRepo?: string;
16
+ homepage?: string;
17
+ publishedAt?: string;
18
+ updatedAt?: string;
19
+ apiBaseUrl?: string;
20
+ token?: string;
21
+ };
22
+ declare function buildMarketplacePublishOptions(options: MarketplacePublishCommandOptions): MarketplaceSkillPublishOptions;
23
+ declare function buildMarketplaceUpdateOptions(options: Omit<MarketplacePublishCommandOptions, "publishedAt">): MarketplaceSkillPublishOptions;
24
+ //#endregion
25
+ export { MarketplacePublishCommandOptions, buildMarketplacePublishOptions, buildMarketplaceUpdateOptions };
@@ -0,0 +1,31 @@
1
+ import { expandHome } from "@nextclaw/core";
2
+ //#region src/cli/commands/skills/marketplace-command-options.utils.ts
3
+ function buildMarketplacePublishOptions(options) {
4
+ const { apiBaseUrl, author, description, dir, homepage, meta, name, packageName, publishedAt, scope, slug, sourceRepo, summary, tag, token, updatedAt } = options;
5
+ return {
6
+ skillDir: expandHome(dir),
7
+ metaFile: meta ? expandHome(meta) : void 0,
8
+ slug,
9
+ packageName,
10
+ scope,
11
+ name,
12
+ summary,
13
+ description,
14
+ author,
15
+ tags: tag,
16
+ sourceRepo,
17
+ homepage,
18
+ publishedAt,
19
+ updatedAt,
20
+ apiBaseUrl,
21
+ token
22
+ };
23
+ }
24
+ function buildMarketplaceUpdateOptions(options) {
25
+ return {
26
+ ...buildMarketplacePublishOptions(options),
27
+ requireExisting: true
28
+ };
29
+ }
30
+ //#endregion
31
+ export { buildMarketplacePublishOptions, buildMarketplaceUpdateOptions };
@@ -0,0 +1,14 @@
1
+ import { PlatformMeResult } from "../../../commands/platform-auth/services/platform-auth-commands.service.js";
2
+ //#region src/cli/commands/skills/marketplace-identity.utils.d.ts
3
+ declare function resolvePublishPackageName(params: {
4
+ explicitPackageName?: string;
5
+ explicitScope?: string;
6
+ slug: string;
7
+ adminTokenPresent: boolean;
8
+ currentUser: PlatformMeResult | null;
9
+ }): string;
10
+ declare function validateSkillSlug(raw: string, fieldName: string): string;
11
+ declare function validateSkillSelector(raw: string, fieldName: string): string;
12
+ declare function normalizeTags(rawTags: string[] | undefined): string[];
13
+ //#endregion
14
+ export { normalizeTags, resolvePublishPackageName, validateSkillSelector, validateSkillSlug };