@kb-labs/marketplace-entry 2.116.13 → 2.117.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/http.ts","../../src/scope.ts","../../src/commands/update.ts"],"names":["current","projectRoot"],"mappings":";;;;;AAQA,IAAM,mBAAA,GAAsB,uBAAA;AAC5B,IAAM,kBAAA,GAAqB,qBAAA;AAC3B,IAAM,gBAAA,GAAmB,GAAA;AAQzB,eAAe,QAAA,GAAsC;AACnD,EAAA,MAAM,cAAA,GAAiB,IAAI,cAAA,EAAe;AAC1C,EAAA,MAAM,OAAA,GAAU,MAAM,cAAA,CAAe,IAAA,EAAK;AAC1C,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,MAAMA,QAAAA,GAAU,eAAe,SAAA,CAAU,OAAO,IAAI,MAAM,cAAA,CAAe,OAAA,CAAQ,OAAO,CAAA,GAAI,OAAA;AAC5F,IAAA,OAAO,UAAUA,QAAAA,EAAS,MAAM,cAAA,CAAe,OAAA,CAAQA,QAAO,CAAC,CAAA;AAAA,EACjE;AAEA,EAAA,MAAM,kBAAA,GAAqB,IAAI,kBAAA,EAAmB;AAClD,EAAA,MAAM,WAAA,GAAc,MAAM,kBAAA,CAAmB,IAAA,EAAK;AAClD,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,MAAM,OAAA,GAAU,mBAAmB,SAAA,CAAU,WAAW,IAAI,MAAM,kBAAA,CAAmB,OAAA,CAAQ,WAAW,CAAA,GAAI,WAAA;AAC5G,EAAA,OAAO,UAAU,OAAA,EAAS,MAAM,kBAAA,CAAmB,OAAA,CAAQ,OAAO,CAAC,CAAA;AACrE;AAEA,SAAS,SAAA,CAAU,aAAsD,OAAA,EAA4E;AACnJ,EAAA,OAAO;AAAA,IACL,YAAY,WAAA,CAAY,UAAA;AAAA,IACxB,aAAa,WAAA,CAAY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EAAqB,QAAA,CAAS,KAAK,CAAA,CAAA,CAAA,EAAK;AAAA,YACxD,QAAA,EAAU;AAAA,cACR;AAAA,gBACE,MAAA,EAAQ,SAAA;AAAA,gBACR,KAAA,EAAO,MAAA,CAAO,SAAA,CAAU,GAAA,CAAI,OAAK,CAAA,EAAG,CAAA,CAAE,EAAE,CAAA,CAAA,EAAI,CAAA,CAAE,OAAO,CAAA,EAAA,EAAK,CAAA,CAAE,WAAW,CAAA,CAAA,CAAG;AAAA,eAC5E;AAAA,cACA,GAAI,MAAA,CAAO,QAAA,CAAS,MAAA,GAAS,IAAI,CAAC,EAAE,MAAA,EAAQ,UAAA,EAAY,KAAA,EAAO,MAAA,CAAO,QAAA,EAAU,IAAI;AAAC;AACvF,WACD,CAAA;AAAA,QACH;AAEA,QAAA,OAAO,EAAE,EAAA,EAAI,IAAA,EAAM,MAAA,EAAO;AAAA,MAC5B,SAAS,GAAA,EAAK;AACZ,QAAA,WAAA,CAAY,GAAA,EAAK,GAAA,EAAK,KAAA,CAAM,IAAI,CAAA;AAChC,QAAA,OAAO,EAAE,IAAI,KAAA,EAAO,KAAA,EAAO,eAAe,KAAA,GAAQ,GAAA,CAAI,UAAU,MAAA,CAAO,GAAG,GAAG,MAAA,EAAQ,EAAE,WAAW,EAAC,EAAG,UAAU,EAAC,EAAG,KAAA,EAAO,EAAA,EAAG,EAAE;AAAA,MAClI;AAAA,IACF;AAAA;AAEJ,CAAC","file":"update.js","sourcesContent":["/**\n * HTTP client for marketplace service via Gateway.\n */\n\nimport { useEnv } from '@kb-labs/sdk';\nimport { CredentialsManager, SessionManager } from '@kb-labs/cli-runtime/gateway';\nimport type { GatewayCredentials, SessionCredentials } from '@kb-labs/cli-runtime/gateway';\n\nconst DEFAULT_GATEWAY_URL = 'http://127.0.0.1:4000';\nconst MARKETPLACE_PREFIX = '/api/v1/marketplace';\nconst FETCH_TIMEOUT_MS = 30_000;\n\ntype AuthState = {\n gatewayUrl: string;\n accessToken: string;\n refresh: () => Promise<AuthState>;\n};\n\nasync function loadAuth(): Promise<AuthState | null> {\n const sessionManager = new SessionManager();\n const session = await sessionManager.load();\n if (session) {\n const current = sessionManager.isExpired(session) ? await sessionManager.refresh(session) : session;\n return authState(current, () => sessionManager.refresh(current));\n }\n\n const credentialsManager = new CredentialsManager();\n const credentials = await credentialsManager.load();\n if (!credentials) {\n return null;\n }\n const current = credentialsManager.isExpired(credentials) ? await credentialsManager.refresh(credentials) : credentials;\n return authState(current, () => credentialsManager.refresh(current));\n}\n\nfunction authState(credentials: GatewayCredentials | SessionCredentials, refresh: () => Promise<GatewayCredentials | SessionCredentials>): AuthState {\n return {\n gatewayUrl: credentials.gatewayUrl,\n accessToken: credentials.accessToken,\n refresh: async () => {\n const updated = await refresh();\n return authState(updated, refresh);\n },\n };\n}\n\nfunction getBaseUrl(gatewayUrl?: string): string {\n const marketplaceUrl = useEnv('KB_MARKETPLACE_URL');\n if (marketplaceUrl) {\n return `${marketplaceUrl}${MARKETPLACE_PREFIX}`;\n }\n const gateway = gatewayUrl ?? useEnv('KB_GATEWAY_URL') ?? DEFAULT_GATEWAY_URL;\n return `${gateway}${MARKETPLACE_PREFIX}`;\n}\n\nasync function request<T>(method: string, path: string, body?: Record<string, unknown>, params?: Record<string, string>): Promise<T> {\n let auth = await loadAuth();\n const url = new URL(`${getBaseUrl(auth?.gatewayUrl)}${path}`);\n if (params) {\n for (const [key, value] of Object.entries(params)) { url.searchParams.set(key, value); }\n }\n\n for (let attempt = 0; attempt < 2; attempt += 1) {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);\n try {\n const headers: Record<string, string> = {};\n if (body) { headers['Content-Type'] = 'application/json'; }\n if (auth) { headers.Authorization = `Bearer ${auth.accessToken}`; }\n const response = await fetch(url.toString(), {\n method,\n headers,\n body: body ? JSON.stringify(body) : undefined,\n signal: controller.signal,\n });\n if (response.status === 401 && auth && attempt === 0) {\n auth = await auth.refresh();\n continue;\n }\n if (!response.ok) {\n const text = await response.text();\n throw new Error(`Marketplace ${path} failed (${response.status}): ${text}`);\n }\n if (response.status === 204) { return undefined as T; }\n return await response.json() as T;\n } catch (err) {\n if ((err as Error).name === 'AbortError') {\n throw new Error(`Marketplace ${path} timed out — is the marketplace service running? (kb-dev start marketplace)`);\n }\n throw err;\n } finally {\n clearTimeout(timer);\n }\n }\n throw new Error(`Marketplace ${path} failed after refreshing authentication`);\n}\n\nexport async function post<T = unknown>(path: string, body: Record<string, unknown>): Promise<T> {\n return request<T>('POST', path, body);\n}\n\nexport async function patch<T = unknown>(path: string, body: Record<string, unknown>): Promise<T> {\n return request<T>('PATCH', path, body);\n}\n\nexport async function del<T = unknown>(path: string, body?: Record<string, unknown>): Promise<T> {\n return request<T>('DELETE', path, body);\n}\n\nexport async function get<T = unknown>(path: string, params?: Record<string, string>): Promise<T> {\n return request<T>('GET', path, undefined, params);\n}\n","/**\n * @module @kb-labs/marketplace-entry/scope\n *\n * Client-side scope resolution for marketplace CLI commands. Uses the\n * canonical `findProjectConfigRoot` helper from `@kb-labs/core-workspace`\n * so the detection rules (which filenames count, how walk-up stops) match\n * what the config loader and the marketplace daemon enforce.\n *\n * Rules:\n * - `project` is the default if cwd (or any ancestor up to the filesystem\n * root) contains `.kb/kb.config.{json,jsonc}`.\n * - Otherwise the default is `platform`.\n * - `--scope` always overrides detection.\n * - For scope=\"project\" we return the absolute projectRoot so the daemon\n * doesn't need to re-discover it.\n */\n\nimport { findProjectConfigRoot } from '@kb-labs/core-workspace';\nimport type { MarketplaceScope, MarketplaceQueryScope } from '@kb-labs/marketplace-contracts';\n\nexport const SCOPE_FLAG_CHOICES: readonly MarketplaceScope[] = ['platform', 'project'];\nexport const QUERY_SCOPE_FLAG_CHOICES: readonly MarketplaceQueryScope[] = ['platform', 'project', 'all'];\n\nexport interface ResolvedCliScope {\n scope: MarketplaceScope;\n projectRoot?: string;\n /** How the scope was determined — surfaces in --verbose logs. */\n reason: 'flag' | 'auto-detect' | 'fallback';\n}\n\nexport interface ResolvedCliQueryScope extends Omit<ResolvedCliScope, 'scope'> {\n scope: MarketplaceQueryScope;\n}\n\n/**\n * Resolve the effective scope for a mutating command (`link`, `unlink`,\n * `install`, ...). `flag` is the value of `--scope` (if supplied). The\n * helper never returns `'all'` for mutating commands — callers restrict\n * choices via `SCOPE_FLAG_CHOICES`.\n */\nexport async function resolveCliScope(\n cwd: string,\n flag: string | undefined,\n): Promise<ResolvedCliScope> {\n if (flag) {\n assertMutatingScope(flag);\n if (flag === 'project') {\n const projectRoot = await findProjectConfigRoot(cwd);\n if (!projectRoot) {\n throw new CliScopeError(\n 'SCOPE_PROJECT_ROOT_NOT_FOUND',\n `--scope=project requires a .kb/kb.config.{json,jsonc} ancestor of ${cwd} — none found.`,\n );\n }\n return { scope: 'project', projectRoot, reason: 'flag' };\n }\n return { scope: 'platform', reason: 'flag' };\n }\n\n const projectRoot = await findProjectConfigRoot(cwd);\n if (projectRoot) {\n return { scope: 'project', projectRoot, reason: 'auto-detect' };\n }\n return { scope: 'platform', reason: 'fallback' };\n}\n\n/**\n * Resolve the effective scope for a read-only command (`list`). Accepts\n * `'all'` as an explicit flag value.\n */\nexport async function resolveCliQueryScope(\n cwd: string,\n flag: string | undefined,\n): Promise<ResolvedCliQueryScope> {\n if (flag === 'all') {\n const projectRoot = await findProjectConfigRoot(cwd);\n return { scope: 'all', projectRoot, reason: 'flag' };\n }\n const base = await resolveCliScope(cwd, flag);\n return { scope: base.scope, projectRoot: base.projectRoot, reason: base.reason };\n}\n\nfunction assertMutatingScope(value: string): asserts value is MarketplaceScope {\n if (!SCOPE_FLAG_CHOICES.includes(value as MarketplaceScope)) {\n throw new CliScopeError(\n 'SCOPE_INVALID',\n `--scope must be one of: ${SCOPE_FLAG_CHOICES.join(', ')} (got ${JSON.stringify(value)})`,\n );\n }\n}\n\nexport class CliScopeError extends Error {\n readonly code: string;\n constructor(code: string, message: string) {\n super(message);\n this.code = code;\n this.name = 'CliScopeError';\n }\n}\n\n/**\n * Build the body-payload fragment expected by `parseMutatingScope` on the\n * API side: `{ scope, projectRoot? }`. Kept as a helper so every command\n * sends the same shape and nothing drifts out-of-sync with the server.\n */\nexport function scopeBody(ctx: ResolvedCliScope | ResolvedCliQueryScope): {\n scope: MarketplaceScope | MarketplaceQueryScope;\n projectRoot?: string;\n} {\n return {\n scope: ctx.scope,\n ...(ctx.projectRoot ? { projectRoot: ctx.projectRoot } : {}),\n };\n}\n","import { defineCommand, handleError, validationError, type PluginContextV3, type CommandResult } from '@kb-labs/sdk';\nimport { post } from '../http.js';\nimport { resolveCliScope, scopeBody, CliScopeError } from '../scope.js';\n\ninterface UpdateFlags {\n json?: boolean;\n scope?: string;\n 'dry-run'?: boolean;\n}\n\ninterface UpdateInput {\n argv?: string[];\n flags?: UpdateFlags;\n}\n\ninterface PackageEntry {\n id: string;\n version: string;\n primaryKind: string;\n}\n\ninterface UpdateResultData {\n installed: PackageEntry[];\n warnings: string[];\n scope: string;\n}\n\nexport default defineCommand<unknown, UpdateInput, UpdateResultData>({\n id: 'marketplace:update',\n description: 'Update marketplace package(s)',\n\n handler: {\n async intent(_ctx: PluginContextV3, input: UpdateInput) {\n const argv = input.argv ?? [];\n const targets = argv.length > 0 ? argv : ['all installed packages'];\n return {\n summary: `Update ${targets.join(', ')}`,\n operations: targets.map(pkg => ({\n type: 'update' as const,\n resource: 'marketplace-package',\n details: { package: pkg },\n })),\n };\n },\n\n async execute(ctx: PluginContextV3, input: UpdateInput): Promise<CommandResult<UpdateResultData>> {\n const argv = input.argv ?? [];\n const flags = (input.flags ?? input) as UpdateFlags;\n\n let scopeCtx;\n try {\n scopeCtx = await resolveCliScope(ctx.cwd, flags.scope);\n } catch (err) {\n if (err instanceof CliScopeError) {\n validationError(ctx, err.message, undefined, flags.json);\n } else {\n handleError(ctx, err, flags.json);\n }\n return { ok: false, error: 'Please specify at least one package to update', result: { installed: [], warnings: [], scope: '' } };\n }\n\n try {\n // Server-side update accepts a single body with the ids (or all\n // installed when omitted). No client-side loop; the server handles\n // per-package failures and reports them in `warnings`.\n const body: Record<string, unknown> = { ...scopeBody(scopeCtx) };\n if (argv.length > 0) {\n body.packageIds = argv;\n }\n const result = await post<UpdateResultData>('/packages/update', body);\n\n if (flags.json) {\n ctx.ui?.json?.(result);\n } else if (result.installed.length === 0) {\n ctx.ui?.info?.(`Nothing to update (${scopeCtx.scope})`);\n } else {\n ctx.ui?.success?.(`Update completed (${scopeCtx.scope})`, {\n sections: [\n {\n header: 'Updated',\n items: result.installed.map(p => `${p.id}@${p.version} (${p.primaryKind})`),\n },\n ...(result.warnings.length > 0 ? [{ header: 'Warnings', items: result.warnings }] : []),\n ],\n });\n }\n\n return { ok: true, result };\n } catch (err) {\n handleError(ctx, err, flags.json);\n return { ok: false, error: err instanceof Error ? err.message : String(err), result: { installed: [], warnings: [], scope: '' } };\n }\n },\n },\n});\n"]}
1
+ {"version":3,"sources":["../../src/http.ts","../../src/scope.ts","../../src/commands/update.ts"],"names":["current","projectRoot"],"mappings":";;;;;AAQA,IAAM,mBAAA,GAAsB,uBAAA;AAC5B,IAAM,kBAAA,GAAqB,qBAAA;AAC3B,IAAM,gBAAA,GAAmB,GAAA;AAQzB,eAAe,QAAA,GAAsC;AACnD,EAAA,MAAM,cAAA,GAAiB,IAAI,cAAA,EAAe;AAC1C,EAAA,MAAM,OAAA,GAAU,MAAM,cAAA,CAAe,IAAA,EAAK;AAC1C,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,MAAMA,QAAAA,GAAU,eAAe,SAAA,CAAU,OAAO,IAAI,MAAM,cAAA,CAAe,OAAA,CAAQ,OAAO,CAAA,GAAI,OAAA;AAC5F,IAAA,OAAO,UAAUA,QAAAA,EAAS,MAAM,cAAA,CAAe,OAAA,CAAQA,QAAO,CAAC,CAAA;AAAA,EACjE;AAEA,EAAA,MAAM,kBAAA,GAAqB,IAAI,kBAAA,EAAmB;AAClD,EAAA,MAAM,WAAA,GAAc,MAAM,kBAAA,CAAmB,IAAA,EAAK;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KAAA,EAAO,eAAe,KAAA,GAAQ,GAAA,CAAI,UAAU,MAAA,CAAO,GAAG,GAAG,MAAA,EAAQ,EAAE,WAAW,EAAC,EAAG,UAAU,EAAC,EAAG,KAAA,EAAO,EAAA,EAAG,EAAE;AAAA,MAClI;AAAA,IACF;AAAA;AAEJ,CAAC","file":"update.js","sourcesContent":["/**\n * HTTP client for marketplace service via Gateway.\n */\n\nimport { useEnv } from '@kb-labs/sdk';\nimport { CredentialsManager, SessionManager } from '@kb-labs/cli-runtime/gateway';\nimport type { GatewayCredentials, SessionCredentials } from '@kb-labs/cli-runtime/gateway';\n\nconst DEFAULT_GATEWAY_URL = 'http://127.0.0.1:4000';\nconst MARKETPLACE_PREFIX = '/api/v1/marketplace';\nconst FETCH_TIMEOUT_MS = 30_000;\n\ntype AuthState = {\n gatewayUrl: string;\n accessToken: string;\n refresh: () => Promise<AuthState>;\n};\n\nasync function loadAuth(): Promise<AuthState | null> {\n const sessionManager = new SessionManager();\n const session = await sessionManager.load();\n if (session) {\n const current = sessionManager.isExpired(session) ? await sessionManager.refresh(session) : session;\n return authState(current, () => sessionManager.refresh(current));\n }\n\n const credentialsManager = new CredentialsManager();\n const credentials = await credentialsManager.load();\n if (!credentials) {\n return null;\n }\n const current = credentialsManager.isExpired(credentials) ? await credentialsManager.refresh(credentials) : credentials;\n return authState(current, () => credentialsManager.refresh(current));\n}\n\nfunction authState(credentials: GatewayCredentials | SessionCredentials, refresh: () => Promise<GatewayCredentials | SessionCredentials>): AuthState {\n return {\n gatewayUrl: credentials.gatewayUrl,\n accessToken: credentials.accessToken,\n refresh: async () => {\n const updated = await refresh();\n return authState(updated, refresh);\n },\n };\n}\n\nfunction getBaseUrl(gatewayUrl?: string): string {\n const marketplaceUrl = useEnv('KB_MARKETPLACE_URL');\n if (marketplaceUrl) {\n return `${marketplaceUrl}${MARKETPLACE_PREFIX}`;\n }\n const gateway = gatewayUrl ?? useEnv('KB_GATEWAY_URL') ?? DEFAULT_GATEWAY_URL;\n return `${gateway}${MARKETPLACE_PREFIX}`;\n}\n\nasync function request<T>(method: string, path: string, body?: Record<string, unknown>, params?: Record<string, string>): Promise<T> {\n let auth = await loadAuth();\n const url = new URL(`${getBaseUrl(auth?.gatewayUrl)}${path}`);\n if (params) {\n for (const [key, value] of Object.entries(params)) { url.searchParams.set(key, value); }\n }\n\n for (let attempt = 0; attempt < 2; attempt += 1) {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);\n try {\n const headers: Record<string, string> = {};\n if (body) { headers['Content-Type'] = 'application/json'; }\n if (auth) { headers.Authorization = `Bearer ${auth.accessToken}`; }\n const response = await fetch(url.toString(), {\n method,\n headers,\n body: body ? JSON.stringify(body) : undefined,\n signal: controller.signal,\n });\n if (response.status === 401 && auth && attempt === 0) {\n auth = await auth.refresh();\n continue;\n }\n if (response.status === 401 && !auth) {\n throw new Error('Marketplace authentication is required. Run `kb auth login` or choose local no-auth mode during installation.');\n }\n if (!response.ok) {\n const text = await response.text();\n throw new Error(`Marketplace ${path} failed (${response.status}): ${text}`);\n }\n if (response.status === 204) { return undefined as T; }\n return await response.json() as T;\n } catch (err) {\n if ((err as Error).name === 'AbortError') {\n throw new Error(`Marketplace ${path} timed out — is the marketplace service running? (kb-dev start marketplace)`);\n }\n throw err;\n } finally {\n clearTimeout(timer);\n }\n }\n throw new Error(`Marketplace ${path} failed after refreshing authentication`);\n}\n\nexport async function post<T = unknown>(path: string, body: Record<string, unknown>): Promise<T> {\n return request<T>('POST', path, body);\n}\n\nexport async function patch<T = unknown>(path: string, body: Record<string, unknown>): Promise<T> {\n return request<T>('PATCH', path, body);\n}\n\nexport async function del<T = unknown>(path: string, body?: Record<string, unknown>): Promise<T> {\n return request<T>('DELETE', path, body);\n}\n\nexport async function get<T = unknown>(path: string, params?: Record<string, string>): Promise<T> {\n return request<T>('GET', path, undefined, params);\n}\n","/**\n * @module @kb-labs/marketplace-entry/scope\n *\n * Client-side scope resolution for marketplace CLI commands. Uses the\n * canonical `findProjectConfigRoot` helper from `@kb-labs/core-workspace`\n * so the detection rules (which filenames count, how walk-up stops) match\n * what the config loader and the marketplace daemon enforce.\n *\n * Rules:\n * - `project` is the default if cwd (or any ancestor up to the filesystem\n * root) contains `.kb/kb.config.{json,jsonc}`.\n * - Otherwise the default is `platform`.\n * - `--scope` always overrides detection.\n * - For scope=\"project\" we return the absolute projectRoot so the daemon\n * doesn't need to re-discover it.\n */\n\nimport { findProjectConfigRoot } from '@kb-labs/core-workspace';\nimport type { MarketplaceScope, MarketplaceQueryScope } from '@kb-labs/marketplace-contracts';\n\nexport const SCOPE_FLAG_CHOICES: readonly MarketplaceScope[] = ['platform', 'project'];\nexport const QUERY_SCOPE_FLAG_CHOICES: readonly MarketplaceQueryScope[] = ['platform', 'project', 'all'];\n\nexport interface ResolvedCliScope {\n scope: MarketplaceScope;\n projectRoot?: string;\n /** How the scope was determined — surfaces in --verbose logs. */\n reason: 'flag' | 'auto-detect' | 'fallback';\n}\n\nexport interface ResolvedCliQueryScope extends Omit<ResolvedCliScope, 'scope'> {\n scope: MarketplaceQueryScope;\n}\n\n/**\n * Resolve the effective scope for a mutating command (`link`, `unlink`,\n * `install`, ...). `flag` is the value of `--scope` (if supplied). The\n * helper never returns `'all'` for mutating commands — callers restrict\n * choices via `SCOPE_FLAG_CHOICES`.\n */\nexport async function resolveCliScope(\n cwd: string,\n flag: string | undefined,\n): Promise<ResolvedCliScope> {\n if (flag) {\n assertMutatingScope(flag);\n if (flag === 'project') {\n const projectRoot = await findProjectConfigRoot(cwd);\n if (!projectRoot) {\n throw new CliScopeError(\n 'SCOPE_PROJECT_ROOT_NOT_FOUND',\n `--scope=project requires a .kb/kb.config.{json,jsonc} ancestor of ${cwd} — none found.`,\n );\n }\n return { scope: 'project', projectRoot, reason: 'flag' };\n }\n return { scope: 'platform', reason: 'flag' };\n }\n\n const projectRoot = await findProjectConfigRoot(cwd);\n if (projectRoot) {\n return { scope: 'project', projectRoot, reason: 'auto-detect' };\n }\n return { scope: 'platform', reason: 'fallback' };\n}\n\n/**\n * Resolve the effective scope for a read-only command (`list`). Accepts\n * `'all'` as an explicit flag value.\n */\nexport async function resolveCliQueryScope(\n cwd: string,\n flag: string | undefined,\n): Promise<ResolvedCliQueryScope> {\n if (flag === 'all') {\n const projectRoot = await findProjectConfigRoot(cwd);\n return { scope: 'all', projectRoot, reason: 'flag' };\n }\n const base = await resolveCliScope(cwd, flag);\n return { scope: base.scope, projectRoot: base.projectRoot, reason: base.reason };\n}\n\nfunction assertMutatingScope(value: string): asserts value is MarketplaceScope {\n if (!SCOPE_FLAG_CHOICES.includes(value as MarketplaceScope)) {\n throw new CliScopeError(\n 'SCOPE_INVALID',\n `--scope must be one of: ${SCOPE_FLAG_CHOICES.join(', ')} (got ${JSON.stringify(value)})`,\n );\n }\n}\n\nexport class CliScopeError extends Error {\n readonly code: string;\n constructor(code: string, message: string) {\n super(message);\n this.code = code;\n this.name = 'CliScopeError';\n }\n}\n\n/**\n * Build the body-payload fragment expected by `parseMutatingScope` on the\n * API side: `{ scope, projectRoot? }`. Kept as a helper so every command\n * sends the same shape and nothing drifts out-of-sync with the server.\n */\nexport function scopeBody(ctx: ResolvedCliScope | ResolvedCliQueryScope): {\n scope: MarketplaceScope | MarketplaceQueryScope;\n projectRoot?: string;\n} {\n return {\n scope: ctx.scope,\n ...(ctx.projectRoot ? { projectRoot: ctx.projectRoot } : {}),\n };\n}\n","import { defineCommand, handleError, validationError, type PluginContextV3, type CommandResult } from '@kb-labs/sdk';\nimport { post } from '../http.js';\nimport { resolveCliScope, scopeBody, CliScopeError } from '../scope.js';\n\ninterface UpdateFlags {\n json?: boolean;\n scope?: string;\n 'dry-run'?: boolean;\n}\n\ninterface UpdateInput {\n argv?: string[];\n flags?: UpdateFlags;\n}\n\ninterface PackageEntry {\n id: string;\n version: string;\n primaryKind: string;\n}\n\ninterface UpdateResultData {\n installed: PackageEntry[];\n warnings: string[];\n scope: string;\n}\n\nexport default defineCommand<unknown, UpdateInput, UpdateResultData>({\n id: 'marketplace:update',\n description: 'Update marketplace package(s)',\n\n handler: {\n async intent(_ctx: PluginContextV3, input: UpdateInput) {\n const argv = input.argv ?? [];\n const targets = argv.length > 0 ? argv : ['all installed packages'];\n return {\n summary: `Update ${targets.join(', ')}`,\n operations: targets.map(pkg => ({\n type: 'update' as const,\n resource: 'marketplace-package',\n details: { package: pkg },\n })),\n };\n },\n\n async execute(ctx: PluginContextV3, input: UpdateInput): Promise<CommandResult<UpdateResultData>> {\n const argv = input.argv ?? [];\n const flags = (input.flags ?? input) as UpdateFlags;\n\n let scopeCtx;\n try {\n scopeCtx = await resolveCliScope(ctx.cwd, flags.scope);\n } catch (err) {\n if (err instanceof CliScopeError) {\n validationError(ctx, err.message, undefined, flags.json);\n } else {\n handleError(ctx, err, flags.json);\n }\n return { ok: false, error: 'Please specify at least one package to update', result: { installed: [], warnings: [], scope: '' } };\n }\n\n try {\n // Server-side update accepts a single body with the ids (or all\n // installed when omitted). No client-side loop; the server handles\n // per-package failures and reports them in `warnings`.\n const body: Record<string, unknown> = { ...scopeBody(scopeCtx) };\n if (argv.length > 0) {\n body.packageIds = argv;\n }\n const result = await post<UpdateResultData>('/packages/update', body);\n\n if (flags.json) {\n ctx.ui?.json?.(result);\n } else if (result.installed.length === 0) {\n ctx.ui?.info?.(`Nothing to update (${scopeCtx.scope})`);\n } else {\n ctx.ui?.success?.(`Update completed (${scopeCtx.scope})`, {\n sections: [\n {\n header: 'Updated',\n items: result.installed.map(p => `${p.id}@${p.version} (${p.primaryKind})`),\n },\n ...(result.warnings.length > 0 ? [{ header: 'Warnings', items: result.warnings }] : []),\n ],\n });\n }\n\n return { ok: true, result };\n } catch (err) {\n handleError(ctx, err, flags.json);\n return { ok: false, error: err instanceof Error ? err.message : String(err), result: { installed: [], warnings: [], scope: '' } };\n }\n },\n },\n});\n"]}
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var manifest = {
22
22
  { path: "marketplace uninstall", operationType: "mutate", describe: "Uninstall package(s)", handler: "./commands/uninstall.js#default" },
23
23
  { path: "marketplace update", operationType: "mutate", describe: "Update package(s)", handler: "./commands/update.js#default" },
24
24
  { path: "marketplace sync", operationType: "mutate", describe: "Sync workspace to lock", handler: "./commands/sync.js#default" },
25
+ { path: "marketplace rehash", operationType: "mutate", describe: "Rebuild discovery hashes", handler: "./commands/rehash.js#default" },
25
26
  // Subgroup: kb marketplace plugins <cmd>
26
27
  { path: "marketplace plugins list", operationType: "read", describe: "List installed plugins", handler: "./commands/plugins/list.js#default" },
27
28
  { path: "marketplace plugins enable", operationType: "mutate", describe: "Enable a plugin", handler: "./commands/plugins/enable.js#default" },
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAQA,IAAM,iBAAA,GAAoB,kBAAA,EAAmB,CAC1C,IAAA,CAAK,gBAAgB,CAAA,CACrB,OAAA,CAAQ,CAAC,oBAAA,EAAsB,gBAAA,EAAkB,UAAU,CAAC,EAC5D,KAAA,EAAM;AAEF,IAAM,QAAA,GAAW;AAAA,EACtB,MAAA,EAAQ,aAAA;AAAA,EACR,EAAA,EAAI,sBAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,aAAA;AAAA,IACN,WAAA,EAAa,8CAAA;AAAA,IACb,IAAA,EAAM,CAAC,aAAA,EAAe,SAAA,EAAW,UAAU;AAAA,GAC7C;AAAA,EACA,GAAA,EAAK;AAAA,IACH,SAAA,EAAW;AAAA,MACT,EAAE,IAAA,EAAM,aAAA,EAAe,QAAA,EAAU,iCAAA,EAAkC;AAAA,MACnE,EAAE,IAAA,EAAM,qBAAA,EAAuB,QAAA,EAAU,mBAAA;AAAoB,KAC/D;AAAA,IACA,QAAA,EAAU;AAAA;AAAA,MAER,EAAE,MAAM,qBAAA,EAAyB,aAAA,EAAe,UAAmB,QAAA,EAAU,oBAAA,EAAgD,SAAS,+BAAA,EAAgC;AAAA,MACtK,EAAE,MAAM,uBAAA,EAAyB,aAAA,EAAe,UAAmB,QAAA,EAAU,sBAAA,EAAgD,SAAS,iCAAA,EAAkC;AAAA,MACxK,EAAE,MAAM,oBAAA,EAAyB,aAAA,EAAe,UAAmB,QAAA,EAAU,mBAAA,EAAgD,SAAS,8BAAA,EAA+B;AAAA,MACrK,EAAE,MAAM,kBAAA,EAAyB,aAAA,EAAe,UAAmB,QAAA,EAAU,wBAAA,EAAgD,SAAS,4BAAA,EAA6B;AAAA;AAAA,MAEnK,EAAE,MAAM,0BAAA,EAA+B,aAAA,EAAe,QAAoB,QAAA,EAAU,wBAAA,EAA6B,SAAS,oCAAA,EAAqC;AAAA,MAC/J,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,6BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,kBAAA,EAA4B,SAAS,uCAAA,EAAwC;AAAA,MACjK,EAAE,MAAM,0BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,qBAAA,EAA4B,SAAS,oCAAA,EAAqC;AAAA,MAC9J,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,WAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,6BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,2BAAA,EAA6B,SAAS,uCAAA;AAAwC;AACpK,GACF;AAAA,EACA,WAAA,EAAa;AACf","file":"index.js","sourcesContent":["/**\n * @module @kb-labs/marketplace-cli/manifest\n * ManifestV3 for marketplace CLI plugin.\n * Declares commands with subgroups for nested routing.\n */\n\nimport { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';\n\nconst pluginPermissions = combinePermissions()\n .with(kbPlatformPreset)\n .withEnv(['KB_MARKETPLACE_URL', 'KB_GATEWAY_URL', 'NODE_ENV'])\n .build();\n\nexport const manifest = {\n schema: 'kb.plugin/3' as const,\n id: '@kb-labs/marketplace',\n version: '0.1.0',\n display: {\n name: 'Marketplace',\n description: 'Unified marketplace for plugins and adapters',\n tags: ['marketplace', 'plugins', 'adapters'],\n },\n cli: {\n groupMeta: [\n { path: 'marketplace', describe: 'Marketplace management commands' },\n { path: 'marketplace plugins', describe: 'Plugin management' },\n ],\n commands: [\n // Top-level: kb marketplace <cmd>\n { path: 'marketplace install', operationType: 'mutate' as const, describe: 'Install package(s)', handler: './commands/install.js#default' },\n { path: 'marketplace uninstall', operationType: 'mutate' as const, describe: 'Uninstall package(s)', handler: './commands/uninstall.js#default' },\n { path: 'marketplace update', operationType: 'mutate' as const, describe: 'Update package(s)', handler: './commands/update.js#default' },\n { path: 'marketplace sync', operationType: 'mutate' as const, describe: 'Sync workspace to lock', handler: './commands/sync.js#default' },\n // Subgroup: kb marketplace plugins <cmd>\n { path: 'marketplace plugins list', operationType: 'read' as const, describe: 'List installed plugins', handler: './commands/plugins/list.js#default' },\n { path: 'marketplace plugins enable', operationType: 'mutate' as const, describe: 'Enable a plugin', handler: './commands/plugins/enable.js#default' },\n { path: 'marketplace plugins disable', operationType: 'mutate' as const, describe: 'Disable a plugin', handler: './commands/plugins/disable.js#default' },\n { path: 'marketplace plugins link', operationType: 'mutate' as const, describe: 'Link a local plugin', handler: './commands/plugins/link.js#default' },\n { path: 'marketplace plugins unlink', operationType: 'mutate' as const, describe: 'Unlink a plugin', handler: './commands/plugins/unlink.js#default' },\n { path: 'marketplace plugins doctor', operationType: 'analyze' as const, describe: 'Diagnose issues', handler: './commands/plugins/doctor.js#default' },\n { path: 'marketplace plugins refresh', operationType: 'mutate' as const, describe: 'Clear CLI discovery cache', handler: './commands/plugins/refresh.js#default' },\n ],\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A,EAA+C,SAAS,8BAAA,EAA+B;AAAA;AAAA,MAEpK,EAAE,MAAM,0BAAA,EAA+B,aAAA,EAAe,QAAoB,QAAA,EAAU,wBAAA,EAA6B,SAAS,oCAAA,EAAqC;AAAA,MAC/J,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,6BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,kBAAA,EAA4B,SAAS,uCAAA,EAAwC;AAAA,MACjK,EAAE,MAAM,0BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,qBAAA,EAA4B,SAAS,oCAAA,EAAqC;AAAA,MAC9J,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,WAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,6BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,2BAAA,EAA6B,SAAS,uCAAA;AAAwC;AACpK,GACF;AAAA,EACA,WAAA,EAAa;AACf","file":"index.js","sourcesContent":["/**\n * @module @kb-labs/marketplace-cli/manifest\n * ManifestV3 for marketplace CLI plugin.\n * Declares commands with subgroups for nested routing.\n */\n\nimport { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';\n\nconst pluginPermissions = combinePermissions()\n .with(kbPlatformPreset)\n .withEnv(['KB_MARKETPLACE_URL', 'KB_GATEWAY_URL', 'NODE_ENV'])\n .build();\n\nexport const manifest = {\n schema: 'kb.plugin/3' as const,\n id: '@kb-labs/marketplace',\n version: '0.1.0',\n display: {\n name: 'Marketplace',\n description: 'Unified marketplace for plugins and adapters',\n tags: ['marketplace', 'plugins', 'adapters'],\n },\n cli: {\n groupMeta: [\n { path: 'marketplace', describe: 'Marketplace management commands' },\n { path: 'marketplace plugins', describe: 'Plugin management' },\n ],\n commands: [\n // Top-level: kb marketplace <cmd>\n { path: 'marketplace install', operationType: 'mutate' as const, describe: 'Install package(s)', handler: './commands/install.js#default' },\n { path: 'marketplace uninstall', operationType: 'mutate' as const, describe: 'Uninstall package(s)', handler: './commands/uninstall.js#default' },\n { path: 'marketplace update', operationType: 'mutate' as const, describe: 'Update package(s)', handler: './commands/update.js#default' },\n { path: 'marketplace sync', operationType: 'mutate' as const, describe: 'Sync workspace to lock', handler: './commands/sync.js#default' },\n { path: 'marketplace rehash', operationType: 'mutate' as const, describe: 'Rebuild discovery hashes', handler: './commands/rehash.js#default' },\n // Subgroup: kb marketplace plugins <cmd>\n { path: 'marketplace plugins list', operationType: 'read' as const, describe: 'List installed plugins', handler: './commands/plugins/list.js#default' },\n { path: 'marketplace plugins enable', operationType: 'mutate' as const, describe: 'Enable a plugin', handler: './commands/plugins/enable.js#default' },\n { path: 'marketplace plugins disable', operationType: 'mutate' as const, describe: 'Disable a plugin', handler: './commands/plugins/disable.js#default' },\n { path: 'marketplace plugins link', operationType: 'mutate' as const, describe: 'Link a local plugin', handler: './commands/plugins/link.js#default' },\n { path: 'marketplace plugins unlink', operationType: 'mutate' as const, describe: 'Unlink a plugin', handler: './commands/plugins/unlink.js#default' },\n { path: 'marketplace plugins doctor', operationType: 'analyze' as const, describe: 'Diagnose issues', handler: './commands/plugins/doctor.js#default' },\n { path: 'marketplace plugins refresh', operationType: 'mutate' as const, describe: 'Clear CLI discovery cache', handler: './commands/plugins/refresh.js#default' },\n ],\n },\n permissions: pluginPermissions,\n};\n\nexport default manifest;\n"]}
package/dist/manifest.js CHANGED
@@ -22,6 +22,7 @@ var manifest = {
22
22
  { path: "marketplace uninstall", operationType: "mutate", describe: "Uninstall package(s)", handler: "./commands/uninstall.js#default" },
23
23
  { path: "marketplace update", operationType: "mutate", describe: "Update package(s)", handler: "./commands/update.js#default" },
24
24
  { path: "marketplace sync", operationType: "mutate", describe: "Sync workspace to lock", handler: "./commands/sync.js#default" },
25
+ { path: "marketplace rehash", operationType: "mutate", describe: "Rebuild discovery hashes", handler: "./commands/rehash.js#default" },
25
26
  // Subgroup: kb marketplace plugins <cmd>
26
27
  { path: "marketplace plugins list", operationType: "read", describe: "List installed plugins", handler: "./commands/plugins/list.js#default" },
27
28
  { path: "marketplace plugins enable", operationType: "mutate", describe: "Enable a plugin", handler: "./commands/plugins/enable.js#default" },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAQA,IAAM,iBAAA,GAAoB,kBAAA,EAAmB,CAC1C,IAAA,CAAK,gBAAgB,CAAA,CACrB,OAAA,CAAQ,CAAC,oBAAA,EAAsB,gBAAA,EAAkB,UAAU,CAAC,EAC5D,KAAA,EAAM;AAEF,IAAM,QAAA,GAAW;AAAA,EACtB,MAAA,EAAQ,aAAA;AAAA,EACR,EAAA,EAAI,sBAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,aAAA;AAAA,IACN,WAAA,EAAa,8CAAA;AAAA,IACb,IAAA,EAAM,CAAC,aAAA,EAAe,SAAA,EAAW,UAAU;AAAA,GAC7C;AAAA,EACA,GAAA,EAAK;AAAA,IACH,SAAA,EAAW;AAAA,MACT,EAAE,IAAA,EAAM,aAAA,EAAe,QAAA,EAAU,iCAAA,EAAkC;AAAA,MACnE,EAAE,IAAA,EAAM,qBAAA,EAAuB,QAAA,EAAU,mBAAA;AAAoB,KAC/D;AAAA,IACA,QAAA,EAAU;AAAA;AAAA,MAER,EAAE,MAAM,qBAAA,EAAyB,aAAA,EAAe,UAAmB,QAAA,EAAU,oBAAA,EAAgD,SAAS,+BAAA,EAAgC;AAAA,MACtK,EAAE,MAAM,uBAAA,EAAyB,aAAA,EAAe,UAAmB,QAAA,EAAU,sBAAA,EAAgD,SAAS,iCAAA,EAAkC;AAAA,MACxK,EAAE,MAAM,oBAAA,EAAyB,aAAA,EAAe,UAAmB,QAAA,EAAU,mBAAA,EAAgD,SAAS,8BAAA,EAA+B;AAAA,MACrK,EAAE,MAAM,kBAAA,EAAyB,aAAA,EAAe,UAAmB,QAAA,EAAU,wBAAA,EAAgD,SAAS,4BAAA,EAA6B;AAAA;AAAA,MAEnK,EAAE,MAAM,0BAAA,EAA+B,aAAA,EAAe,QAAoB,QAAA,EAAU,wBAAA,EAA6B,SAAS,oCAAA,EAAqC;AAAA,MAC/J,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,6BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,kBAAA,EAA4B,SAAS,uCAAA,EAAwC;AAAA,MACjK,EAAE,MAAM,0BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,qBAAA,EAA4B,SAAS,oCAAA,EAAqC;AAAA,MAC9J,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,WAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,6BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,2BAAA,EAA6B,SAAS,uCAAA;AAAwC;AACpK,GACF;AAAA,EACA,WAAA,EAAa;AACf;AAEA,IAAO,gBAAA,GAAQ","file":"manifest.js","sourcesContent":["/**\n * @module @kb-labs/marketplace-cli/manifest\n * ManifestV3 for marketplace CLI plugin.\n * Declares commands with subgroups for nested routing.\n */\n\nimport { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';\n\nconst pluginPermissions = combinePermissions()\n .with(kbPlatformPreset)\n .withEnv(['KB_MARKETPLACE_URL', 'KB_GATEWAY_URL', 'NODE_ENV'])\n .build();\n\nexport const manifest = {\n schema: 'kb.plugin/3' as const,\n id: '@kb-labs/marketplace',\n version: '0.1.0',\n display: {\n name: 'Marketplace',\n description: 'Unified marketplace for plugins and adapters',\n tags: ['marketplace', 'plugins', 'adapters'],\n },\n cli: {\n groupMeta: [\n { path: 'marketplace', describe: 'Marketplace management commands' },\n { path: 'marketplace plugins', describe: 'Plugin management' },\n ],\n commands: [\n // Top-level: kb marketplace <cmd>\n { path: 'marketplace install', operationType: 'mutate' as const, describe: 'Install package(s)', handler: './commands/install.js#default' },\n { path: 'marketplace uninstall', operationType: 'mutate' as const, describe: 'Uninstall package(s)', handler: './commands/uninstall.js#default' },\n { path: 'marketplace update', operationType: 'mutate' as const, describe: 'Update package(s)', handler: './commands/update.js#default' },\n { path: 'marketplace sync', operationType: 'mutate' as const, describe: 'Sync workspace to lock', handler: './commands/sync.js#default' },\n // Subgroup: kb marketplace plugins <cmd>\n { path: 'marketplace plugins list', operationType: 'read' as const, describe: 'List installed plugins', handler: './commands/plugins/list.js#default' },\n { path: 'marketplace plugins enable', operationType: 'mutate' as const, describe: 'Enable a plugin', handler: './commands/plugins/enable.js#default' },\n { path: 'marketplace plugins disable', operationType: 'mutate' as const, describe: 'Disable a plugin', handler: './commands/plugins/disable.js#default' },\n { path: 'marketplace plugins link', operationType: 'mutate' as const, describe: 'Link a local plugin', handler: './commands/plugins/link.js#default' },\n { path: 'marketplace plugins unlink', operationType: 'mutate' as const, describe: 'Unlink a plugin', handler: './commands/plugins/unlink.js#default' },\n { path: 'marketplace plugins doctor', operationType: 'analyze' as const, describe: 'Diagnose issues', handler: './commands/plugins/doctor.js#default' },\n { path: 'marketplace plugins refresh', operationType: 'mutate' as const, describe: 'Clear CLI discovery cache', handler: './commands/plugins/refresh.js#default' },\n ],\n },\n permissions: pluginPermissions,\n};\n\nexport default manifest;\n"]}
1
+ {"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAQA,IA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A,EAAU,wBAAA,EAA6B,SAAS,oCAAA,EAAqC;AAAA,MAC/J,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,6BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,kBAAA,EAA4B,SAAS,uCAAA,EAAwC;AAAA,MACjK,EAAE,MAAM,0BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,qBAAA,EAA4B,SAAS,oCAAA,EAAqC;AAAA,MAC9J,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,4BAAA,EAA+B,aAAA,EAAe,WAAoB,QAAA,EAAU,iBAAA,EAA4B,SAAS,sCAAA,EAAuC;AAAA,MAChK,EAAE,MAAM,6BAAA,EAA+B,aAAA,EAAe,UAAoB,QAAA,EAAU,2BAAA,EAA6B,SAAS,uCAAA;AAAwC;AACpK,GACF;AAAA,EACA,WAAA,EAAa;AACf;AAEA,IAAO,gBAAA,GAAQ","file":"manifest.js","sourcesContent":["/**\n * @module @kb-labs/marketplace-cli/manifest\n * ManifestV3 for marketplace CLI plugin.\n * Declares commands with subgroups for nested routing.\n */\n\nimport { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';\n\nconst pluginPermissions = combinePermissions()\n .with(kbPlatformPreset)\n .withEnv(['KB_MARKETPLACE_URL', 'KB_GATEWAY_URL', 'NODE_ENV'])\n .build();\n\nexport const manifest = {\n schema: 'kb.plugin/3' as const,\n id: '@kb-labs/marketplace',\n version: '0.1.0',\n display: {\n name: 'Marketplace',\n description: 'Unified marketplace for plugins and adapters',\n tags: ['marketplace', 'plugins', 'adapters'],\n },\n cli: {\n groupMeta: [\n { path: 'marketplace', describe: 'Marketplace management commands' },\n { path: 'marketplace plugins', describe: 'Plugin management' },\n ],\n commands: [\n // Top-level: kb marketplace <cmd>\n { path: 'marketplace install', operationType: 'mutate' as const, describe: 'Install package(s)', handler: './commands/install.js#default' },\n { path: 'marketplace uninstall', operationType: 'mutate' as const, describe: 'Uninstall package(s)', handler: './commands/uninstall.js#default' },\n { path: 'marketplace update', operationType: 'mutate' as const, describe: 'Update package(s)', handler: './commands/update.js#default' },\n { path: 'marketplace sync', operationType: 'mutate' as const, describe: 'Sync workspace to lock', handler: './commands/sync.js#default' },\n { path: 'marketplace rehash', operationType: 'mutate' as const, describe: 'Rebuild discovery hashes', handler: './commands/rehash.js#default' },\n // Subgroup: kb marketplace plugins <cmd>\n { path: 'marketplace plugins list', operationType: 'read' as const, describe: 'List installed plugins', handler: './commands/plugins/list.js#default' },\n { path: 'marketplace plugins enable', operationType: 'mutate' as const, describe: 'Enable a plugin', handler: './commands/plugins/enable.js#default' },\n { path: 'marketplace plugins disable', operationType: 'mutate' as const, describe: 'Disable a plugin', handler: './commands/plugins/disable.js#default' },\n { path: 'marketplace plugins link', operationType: 'mutate' as const, describe: 'Link a local plugin', handler: './commands/plugins/link.js#default' },\n { path: 'marketplace plugins unlink', operationType: 'mutate' as const, describe: 'Unlink a plugin', handler: './commands/plugins/unlink.js#default' },\n { path: 'marketplace plugins doctor', operationType: 'analyze' as const, describe: 'Diagnose issues', handler: './commands/plugins/doctor.js#default' },\n { path: 'marketplace plugins refresh', operationType: 'mutate' as const, describe: 'Clear CLI discovery cache', handler: './commands/plugins/refresh.js#default' },\n ],\n },\n permissions: pluginPermissions,\n};\n\nexport default manifest;\n"]}
@@ -47,6 +47,12 @@
47
47
  "describe": "Sync workspace to lock",
48
48
  "handler": "./commands/sync.js#default"
49
49
  },
50
+ {
51
+ "path": "marketplace rehash",
52
+ "operationType": "mutate",
53
+ "describe": "Rebuild discovery hashes",
54
+ "handler": "./commands/rehash.js#default"
55
+ },
50
56
  {
51
57
  "path": "marketplace plugins list",
52
58
  "operationType": "read",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kb-labs/marketplace-entry",
3
3
  "description": "Marketplace CLI plugin — commands for managing plugins, adapters, and other marketplace entities",
4
- "version": "2.116.13",
4
+ "version": "2.117.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -18,18 +18,18 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@kb-labs/marketplace-contracts": "2.116.13",
22
- "@kb-labs/sdk": "2.115.1",
23
- "@kb-labs/cli-runtime": "2.116.13",
24
- "@kb-labs/core-workspace": "2.116.13"
21
+ "@kb-labs/core-workspace": "2.117.0",
22
+ "@kb-labs/marketplace-contracts": "2.117.0",
23
+ "@kb-labs/cli-runtime": "2.117.0",
24
+ "@kb-labs/sdk": "2.115.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^24.3.3",
28
28
  "tsup": "^8.5.0",
29
29
  "typescript": "^5",
30
30
  "vitest": "^3.2.6",
31
- "@kb-labs/devkit": "2.116.13",
32
- "@kb-labs/shared-testing-e2e": "2.116.13"
31
+ "@kb-labs/devkit": "2.117.0",
32
+ "@kb-labs/shared-testing-e2e": "2.117.0"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=22.0.0",