@kb-labs/infra-worker-core 2.94.0 → 2.96.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.
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/manifest.v3.js +11 -10
- package/dist/manifest.v3.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -142,7 +142,7 @@ var manifest = {
|
|
|
142
142
|
version: "0.1.0",
|
|
143
143
|
display: {
|
|
144
144
|
name: "Infra Worker",
|
|
145
|
-
description: "Provision infra capabilities
|
|
145
|
+
description: "Provision infra capabilities for orchestrators",
|
|
146
146
|
tags: ["infra", "workspace", "environment", "snapshot"]
|
|
147
147
|
},
|
|
148
148
|
permissions: {
|
|
@@ -173,13 +173,16 @@ var manifest = {
|
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
175
|
cli: {
|
|
176
|
+
groupMeta: [
|
|
177
|
+
{ path: "infra", describe: "Infrastructure provisioning commands" },
|
|
178
|
+
{ path: "infra snapshot", describe: "Workspace and environment snapshot management" }
|
|
179
|
+
],
|
|
176
180
|
commands: [
|
|
177
181
|
{
|
|
178
|
-
|
|
179
|
-
|
|
182
|
+
path: "infra prepare",
|
|
183
|
+
operationType: "execute",
|
|
180
184
|
describe: "Materialize workspace, optional environment, and optional snapshot.",
|
|
181
185
|
handler: "./cli/commands/prepare-infra.js#default",
|
|
182
|
-
handlerPath: "./cli/commands/prepare-infra.js",
|
|
183
186
|
flags: defineCommandFlags({
|
|
184
187
|
sourceRef: { type: "string", description: "Workspace source reference (repo/branch/etc)" },
|
|
185
188
|
basePath: { type: "string", description: "Workspace base path" },
|
|
@@ -191,11 +194,10 @@ var manifest = {
|
|
|
191
194
|
})
|
|
192
195
|
},
|
|
193
196
|
{
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
path: "infra snapshot capture",
|
|
198
|
+
operationType: "execute",
|
|
196
199
|
describe: "Capture snapshot for workspace/environment.",
|
|
197
200
|
handler: "./cli/commands/capture-snapshot.js#default",
|
|
198
|
-
handlerPath: "./cli/commands/capture-snapshot.js",
|
|
199
201
|
flags: defineCommandFlags({
|
|
200
202
|
workspaceId: { type: "string", description: "Workspace ID" },
|
|
201
203
|
environmentId: { type: "string", description: "Environment ID" },
|
|
@@ -204,11 +206,10 @@ var manifest = {
|
|
|
204
206
|
})
|
|
205
207
|
},
|
|
206
208
|
{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
path: "infra snapshot restore",
|
|
210
|
+
operationType: "execute",
|
|
209
211
|
describe: "Restore snapshot to workspace/environment target.",
|
|
210
212
|
handler: "./cli/commands/restore-snapshot.js#default",
|
|
211
|
-
handlerPath: "./cli/commands/restore-snapshot.js",
|
|
212
213
|
flags: defineCommandFlags({
|
|
213
214
|
snapshotId: { type: "string", required: true, description: "Snapshot ID to restore" },
|
|
214
215
|
workspaceId: { type: "string", description: "Workspace ID target" },
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/prepare-infra.ts","../src/cli/commands/capture-snapshot.ts","../src/cli/commands/restore-snapshot.ts","../src/manifest.v3.ts"],"names":["defineCommand"],"mappings":";;;AAuBA,SAAS,UAAU,KAAA,EAAqC;AACtD,EAAA,IAAI,OAAO,UAAU,SAAA,EAAW;AAC9B,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,MAAM,UAAA,GAAa,KAAA,CAAM,IAAA,EAAK,CAAE,WAAA,EAAY;AAC5C,IAAA,IAAI,eAAe,MAAA,EAAQ;AAAC,MAAA,OAAO,IAAA;AAAA,IAAK;AACxC,IAAA,IAAI,eAAe,OAAA,EAAS;AAAC,MAAA,OAAO,KAAA;AAAA,IAAM;AAAA,EAC5C;AACA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,SAAS,KAAA,EAAoC;AACpD,EAAA,IAAI,OAAO,KAAA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AA,EAAM,QAAA,EAAU,aAAa,0BAAA;AAA2B,SACvE;AAAA,OACH;AAAA,MACA;AAAA,QACE,EAAA,EAAI,+BAAA;AAAA,QACJ,KAAA,EAAO,cAAA;AAAA,QACP,QAAA,EAAU,mDAAA;AAAA,QACV,OAAA,EAAS,4CAAA;AAAA,QACT,WAAA,EAAa,oCAAA;AAAA,QACb,OAAO,kBAAA,CAAmB;AAAA,UACxB,YAAY,EAAE,IAAA,EAAM,UAAU,QAAA,EAAU,IAAA,EAAM,aAAa,wBAAA,EAAyB;AAAA,UACpF,WAAA,EAAa,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,qBAAA,EAAsB;AAAA,UAClE,aAAA,EAAe,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,uBAAA,EAAwB;AAAA,UACtE,UAAA,EAAY,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,qBAAA,EAAsB;AAAA,UACjE,WAAW,EAAE,IAAA,EAAM,WAAW,OAAA,EAAS,KAAA,EAAO,aAAa,0BAAA;AAA2B,SACvF;AAAA;AACH;AACF;AAEJ","file":"index.js","sourcesContent":["import { defineCommand, type CommandResult, type PluginContextV3 } from '@kb-labs/sdk';\n\ninterface PrepareInfraFlags {\n sourceRef?: string;\n basePath?: string;\n createEnvironment?: boolean;\n templateId?: string;\n ttlMs?: number;\n captureSnapshot?: boolean;\n namespace?: string;\n}\n\ninterface PrepareInfraInput {\n argv: string[];\n flags: PrepareInfraFlags;\n}\n\ninterface PrepareInfraResult {\n workspaceId: string;\n environmentId?: string;\n snapshotId?: string;\n}\n\nfunction toBoolean(value: unknown): boolean | undefined {\n if (typeof value === 'boolean') {\n return value;\n }\n if (typeof value === 'string') {\n const normalized = value.trim().toLowerCase();\n if (normalized === 'true') {return true;}\n if (normalized === 'false') {return false;}\n }\n return undefined;\n}\n\nfunction toNumber(value: unknown): number | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n if (typeof value === 'string' && value.trim().length > 0) {\n const parsed = Number(value);\n if (Number.isFinite(parsed)) {return parsed;}\n }\n return undefined;\n}\n\nexport default defineCommand<unknown, PrepareInfraInput, PrepareInfraResult>({\n id: 'infra-worker:prepare',\n description: 'Materialize workspace, optionally provision environment, optionally capture snapshot.',\n handler: {\n async execute(\n ctx: PluginContextV3<unknown>,\n input: PrepareInfraInput\n ): Promise<CommandResult<PrepareInfraResult>> {\n const flags = input.flags;\n const createEnvironment = toBoolean(flags.createEnvironment) ?? false;\n const captureSnapshot = toBoolean(flags.captureSnapshot) ?? false;\n const ttlMs = toNumber(flags.ttlMs);\n\n const workspace = await ctx.api.workspace.materialize({\n sourceRef: flags.sourceRef,\n basePath: flags.basePath,\n });\n\n let environmentId: string | undefined;\n if (createEnvironment) {\n const environment = await ctx.api.environment.create({\n templateId: flags.templateId,\n ttlMs,\n workspacePath: workspace.rootPath ?? flags.basePath,\n });\n environmentId = environment.environmentId;\n await ctx.api.workspace.attach({\n workspaceId: workspace.workspaceId,\n environmentId,\n });\n }\n\n let snapshotId: string | undefined;\n if (captureSnapshot) {\n const snapshot = await ctx.api.snapshot.capture({\n workspaceId: workspace.workspaceId,\n environmentId,\n namespace: flags.namespace,\n });\n snapshotId = snapshot.snapshotId;\n }\n\n const result: PrepareInfraResult = {\n workspaceId: workspace.workspaceId,\n environmentId,\n snapshotId,\n };\n\n ctx.ui.success('Infrastructure prepared', {\n sections: [\n {\n header: 'Identifiers',\n items: [\n `workspaceId: ${result.workspaceId}`,\n `environmentId: ${result.environmentId ?? '-'}`,\n `snapshotId: ${result.snapshotId ?? '-'}`,\n ],\n },\n ],\n });\n\n return {\n exitCode: 0,\n result,\n };\n },\n },\n});\n","import { defineCommand, type CommandResult, type PluginContextV3 } from '@kb-labs/sdk';\n\ninterface CaptureSnapshotFlags {\n workspaceId?: string;\n environmentId?: string;\n namespace?: string;\n sourcePath?: string;\n}\n\ninterface CaptureSnapshotInput {\n argv: string[];\n flags: CaptureSnapshotFlags;\n}\n\ninterface CaptureSnapshotResult {\n snapshotId: string;\n}\n\nexport default defineCommand<unknown, CaptureSnapshotInput, CaptureSnapshotResult>({\n id: 'infra-worker:capture-snapshot',\n description: 'Capture snapshot from workspace/environment.',\n handler: {\n async execute(\n ctx: PluginContextV3<unknown>,\n input: CaptureSnapshotInput\n ): Promise<CommandResult<CaptureSnapshotResult>> {\n const flags = input.flags;\n const snapshot = await ctx.api.snapshot.capture({\n workspaceId: flags.workspaceId,\n environmentId: flags.environmentId,\n namespace: flags.namespace,\n sourcePath: flags.sourcePath,\n });\n\n const result: CaptureSnapshotResult = { snapshotId: snapshot.snapshotId };\n ctx.ui.success(`Snapshot captured: ${result.snapshotId}`);\n\n return {\n exitCode: 0,\n result,\n };\n },\n },\n});\n","import { defineCommand, type CommandResult, type PluginContextV3 } from '@kb-labs/sdk';\n\ninterface RestoreSnapshotFlags {\n snapshotId?: string;\n workspaceId?: string;\n environmentId?: string;\n targetPath?: string;\n overwrite?: boolean;\n}\n\ninterface RestoreSnapshotInput {\n argv: string[];\n flags: RestoreSnapshotFlags;\n}\n\ninterface RestoreSnapshotResult {\n snapshotId: string;\n restoredAt: string;\n}\n\nexport default defineCommand<unknown, RestoreSnapshotInput, RestoreSnapshotResult>({\n id: 'infra-worker:restore-snapshot',\n description: 'Restore snapshot to workspace/environment.',\n handler: {\n async execute(\n ctx: PluginContextV3<unknown>,\n input: RestoreSnapshotInput\n ): Promise<CommandResult<RestoreSnapshotResult>> {\n const flags = input.flags;\n if (!flags.snapshotId) {\n throw new Error('Missing required flag: snapshotId');\n }\n\n const restored = await ctx.api.snapshot.restore({\n snapshotId: flags.snapshotId,\n workspaceId: flags.workspaceId,\n environmentId: flags.environmentId,\n targetPath: flags.targetPath,\n overwrite: flags.overwrite,\n });\n\n const result: RestoreSnapshotResult = {\n snapshotId: restored.snapshotId,\n restoredAt: restored.restoredAt,\n };\n ctx.ui.success(`Snapshot restored: ${result.snapshotId}`);\n\n return {\n exitCode: 0,\n result,\n };\n },\n },\n});\n","import type { ManifestV3 } from '@kb-labs/plugin-contracts';\nimport { defineCommandFlags } from '@kb-labs/sdk';\n\nexport const manifest: ManifestV3 = {\n schema: 'kb.plugin/3',\n id: '@kb-labs/infra-worker',\n version: '0.1.0',\n display: {\n name: 'Infra Worker',\n description: 'Provision infra capabilities and return stable IDs for orchestrators.',\n tags: ['infra', 'workspace', 'environment', 'snapshot'],\n },\n permissions: {\n platform: {\n environment: {\n create: true,\n read: true,\n destroy: true,\n renewLease: true,\n templates: ['*'],\n },\n workspace: {\n materialize: true,\n attach: true,\n release: true,\n read: true,\n sources: ['*'],\n paths: ['*'],\n },\n snapshot: {\n capture: true,\n restore: true,\n delete: true,\n read: true,\n garbageCollect: true,\n namespaces: ['*'],\n },\n },\n },\n cli: {\n commands: [\n {\n id: 'infra-worker:prepare',\n group: 'infra-worker',\n describe: 'Materialize workspace, optional environment, and optional snapshot.',\n handler: './cli/commands/prepare-infra.js#default',\n handlerPath: './cli/commands/prepare-infra.js',\n flags: defineCommandFlags({\n sourceRef: { type: 'string', description: 'Workspace source reference (repo/branch/etc)' },\n basePath: { type: 'string', description: 'Workspace base path' },\n createEnvironment: { type: 'boolean', default: false, description: 'Provision environment after workspace materialize' },\n templateId: { type: 'string', description: 'Environment template ID' },\n ttlMs: { type: 'number', description: 'Environment lease TTL in milliseconds' },\n captureSnapshot: { type: 'boolean', default: false, description: 'Capture snapshot after prepare' },\n namespace: { type: 'string', description: 'Snapshot namespace' },\n }),\n },\n {\n id: 'infra-worker:capture-snapshot',\n group: 'infra-worker',\n describe: 'Capture snapshot for workspace/environment.',\n handler: './cli/commands/capture-snapshot.js#default',\n handlerPath: './cli/commands/capture-snapshot.js',\n flags: defineCommandFlags({\n workspaceId: { type: 'string', description: 'Workspace ID' },\n environmentId: { type: 'string', description: 'Environment ID' },\n namespace: { type: 'string', description: 'Snapshot namespace' },\n sourcePath: { type: 'string', description: 'Source path for snapshot' },\n }),\n },\n {\n id: 'infra-worker:restore-snapshot',\n group: 'infra-worker',\n describe: 'Restore snapshot to workspace/environment target.',\n handler: './cli/commands/restore-snapshot.js#default',\n handlerPath: './cli/commands/restore-snapshot.js',\n flags: defineCommandFlags({\n snapshotId: { type: 'string', required: true, description: 'Snapshot ID to restore' },\n workspaceId: { type: 'string', description: 'Workspace ID target' },\n environmentId: { type: 'string', description: 'Environment ID target' },\n targetPath: { type: 'string', description: 'Restore target path' },\n overwrite: { type: 'boolean', default: false, description: 'Overwrite existing files' },\n }),\n },\n ],\n },\n};\n\nexport default manifest;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/prepare-infra.ts","../src/cli/commands/capture-snapshot.ts","../src/cli/commands/restore-snapshot.ts","../src/manifest.v3.ts"],"names":["defineCommand"],"mappings":";;;AAuBA,SAAS,UAAU,KAAA,EAAqC;AACtD,EAAA,IAAI,OAAO,UAAU,SAAA,EAAW;AAC9B,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,MAAM,UAAA,GAAa,KAAA,CAAM,IAAA,EAAK,CAAE,WAAA,EAAY;AAC5C,IAAA,IAAI,eAAe,MAAA,EAAQ;AAAC,MAAA,OAAO,IAAA;AAAA,IAAK;AACxC,IAAA,IAAI,eAAe,OAAA,EAAS;AAAC,MAAA,OAAO,KAAA;AAAA,IAAM;AAAA,EAC5C;AACA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,SAAS,KAAA,EAAoC;AACpD,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,MAAA,CAAO,QAAA,CAAS,KAAK,CAAA,EAAG;AACvD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,MAAM,IAAA,EAAK,CAAE,SAAS,CAAA,EAAG;AACxD,IAAA,MAAM,MAAA,GAAS,OAAO,KAAK,CAAA;AAC3B,IAAA,IAAI,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,EAAG;AAAC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ACT,OAAO,kBAAA,CAAmB;AAAA,UACxB,YAAY,EAAE,IAAA,EAAM,UAAU,QAAA,EAAU,IAAA,EAAM,aAAa,wBAAA,EAAyB;AAAA,UACpF,WAAA,EAAa,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,qBAAA,EAAsB;AAAA,UAClE,aAAA,EAAe,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,uBAAA,EAAwB;AAAA,UACtE,UAAA,EAAY,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,qBAAA,EAAsB;AAAA,UACjE,WAAW,EAAE,IAAA,EAAM,WAAW,OAAA,EAAS,KAAA,EAAO,aAAa,0BAAA;AAA2B,SACvF;AAAA;AACH;AACF;AAEJ","file":"index.js","sourcesContent":["import { defineCommand, type CommandResult, type PluginContextV3 } from '@kb-labs/sdk';\n\ninterface PrepareInfraFlags {\n sourceRef?: string;\n basePath?: string;\n createEnvironment?: boolean;\n templateId?: string;\n ttlMs?: number;\n captureSnapshot?: boolean;\n namespace?: string;\n}\n\ninterface PrepareInfraInput {\n argv: string[];\n flags: PrepareInfraFlags;\n}\n\ninterface PrepareInfraResult {\n workspaceId: string;\n environmentId?: string;\n snapshotId?: string;\n}\n\nfunction toBoolean(value: unknown): boolean | undefined {\n if (typeof value === 'boolean') {\n return value;\n }\n if (typeof value === 'string') {\n const normalized = value.trim().toLowerCase();\n if (normalized === 'true') {return true;}\n if (normalized === 'false') {return false;}\n }\n return undefined;\n}\n\nfunction toNumber(value: unknown): number | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n if (typeof value === 'string' && value.trim().length > 0) {\n const parsed = Number(value);\n if (Number.isFinite(parsed)) {return parsed;}\n }\n return undefined;\n}\n\nexport default defineCommand<unknown, PrepareInfraInput, PrepareInfraResult>({\n id: 'infra-worker:prepare',\n description: 'Materialize workspace, optionally provision environment, optionally capture snapshot.',\n handler: {\n async execute(\n ctx: PluginContextV3<unknown>,\n input: PrepareInfraInput\n ): Promise<CommandResult<PrepareInfraResult>> {\n const flags = input.flags;\n const createEnvironment = toBoolean(flags.createEnvironment) ?? false;\n const captureSnapshot = toBoolean(flags.captureSnapshot) ?? false;\n const ttlMs = toNumber(flags.ttlMs);\n\n const workspace = await ctx.api.workspace.materialize({\n sourceRef: flags.sourceRef,\n basePath: flags.basePath,\n });\n\n let environmentId: string | undefined;\n if (createEnvironment) {\n const environment = await ctx.api.environment.create({\n templateId: flags.templateId,\n ttlMs,\n workspacePath: workspace.rootPath ?? flags.basePath,\n });\n environmentId = environment.environmentId;\n await ctx.api.workspace.attach({\n workspaceId: workspace.workspaceId,\n environmentId,\n });\n }\n\n let snapshotId: string | undefined;\n if (captureSnapshot) {\n const snapshot = await ctx.api.snapshot.capture({\n workspaceId: workspace.workspaceId,\n environmentId,\n namespace: flags.namespace,\n });\n snapshotId = snapshot.snapshotId;\n }\n\n const result: PrepareInfraResult = {\n workspaceId: workspace.workspaceId,\n environmentId,\n snapshotId,\n };\n\n ctx.ui.success('Infrastructure prepared', {\n sections: [\n {\n header: 'Identifiers',\n items: [\n `workspaceId: ${result.workspaceId}`,\n `environmentId: ${result.environmentId ?? '-'}`,\n `snapshotId: ${result.snapshotId ?? '-'}`,\n ],\n },\n ],\n });\n\n return {\n exitCode: 0,\n result,\n };\n },\n },\n});\n","import { defineCommand, type CommandResult, type PluginContextV3 } from '@kb-labs/sdk';\n\ninterface CaptureSnapshotFlags {\n workspaceId?: string;\n environmentId?: string;\n namespace?: string;\n sourcePath?: string;\n}\n\ninterface CaptureSnapshotInput {\n argv: string[];\n flags: CaptureSnapshotFlags;\n}\n\ninterface CaptureSnapshotResult {\n snapshotId: string;\n}\n\nexport default defineCommand<unknown, CaptureSnapshotInput, CaptureSnapshotResult>({\n id: 'infra-worker:capture-snapshot',\n description: 'Capture snapshot from workspace/environment.',\n handler: {\n async execute(\n ctx: PluginContextV3<unknown>,\n input: CaptureSnapshotInput\n ): Promise<CommandResult<CaptureSnapshotResult>> {\n const flags = input.flags;\n const snapshot = await ctx.api.snapshot.capture({\n workspaceId: flags.workspaceId,\n environmentId: flags.environmentId,\n namespace: flags.namespace,\n sourcePath: flags.sourcePath,\n });\n\n const result: CaptureSnapshotResult = { snapshotId: snapshot.snapshotId };\n ctx.ui.success(`Snapshot captured: ${result.snapshotId}`);\n\n return {\n exitCode: 0,\n result,\n };\n },\n },\n});\n","import { defineCommand, type CommandResult, type PluginContextV3 } from '@kb-labs/sdk';\n\ninterface RestoreSnapshotFlags {\n snapshotId?: string;\n workspaceId?: string;\n environmentId?: string;\n targetPath?: string;\n overwrite?: boolean;\n}\n\ninterface RestoreSnapshotInput {\n argv: string[];\n flags: RestoreSnapshotFlags;\n}\n\ninterface RestoreSnapshotResult {\n snapshotId: string;\n restoredAt: string;\n}\n\nexport default defineCommand<unknown, RestoreSnapshotInput, RestoreSnapshotResult>({\n id: 'infra-worker:restore-snapshot',\n description: 'Restore snapshot to workspace/environment.',\n handler: {\n async execute(\n ctx: PluginContextV3<unknown>,\n input: RestoreSnapshotInput\n ): Promise<CommandResult<RestoreSnapshotResult>> {\n const flags = input.flags;\n if (!flags.snapshotId) {\n throw new Error('Missing required flag: snapshotId');\n }\n\n const restored = await ctx.api.snapshot.restore({\n snapshotId: flags.snapshotId,\n workspaceId: flags.workspaceId,\n environmentId: flags.environmentId,\n targetPath: flags.targetPath,\n overwrite: flags.overwrite,\n });\n\n const result: RestoreSnapshotResult = {\n snapshotId: restored.snapshotId,\n restoredAt: restored.restoredAt,\n };\n ctx.ui.success(`Snapshot restored: ${result.snapshotId}`);\n\n return {\n exitCode: 0,\n result,\n };\n },\n },\n});\n","import type { ManifestV3 } from '@kb-labs/plugin-contracts';\nimport { defineCommandFlags } from '@kb-labs/sdk';\n\nexport const manifest: ManifestV3 = {\n schema: 'kb.plugin/3',\n id: '@kb-labs/infra-worker',\n version: '0.1.0',\n display: {\n name: 'Infra Worker',\n description: 'Provision infra capabilities for orchestrators',\n tags: ['infra', 'workspace', 'environment', 'snapshot'],\n },\n permissions: {\n platform: {\n environment: {\n create: true,\n read: true,\n destroy: true,\n renewLease: true,\n templates: ['*'],\n },\n workspace: {\n materialize: true,\n attach: true,\n release: true,\n read: true,\n sources: ['*'],\n paths: ['*'],\n },\n snapshot: {\n capture: true,\n restore: true,\n delete: true,\n read: true,\n garbageCollect: true,\n namespaces: ['*'],\n },\n },\n },\n cli: {\n groupMeta: [\n { path: 'infra', describe: 'Infrastructure provisioning commands' },\n { path: 'infra snapshot', describe: 'Workspace and environment snapshot management' },\n ],\n commands: [\n {\n path: 'infra prepare',\n operationType: 'execute' as const,\n describe: 'Materialize workspace, optional environment, and optional snapshot.',\n handler: './cli/commands/prepare-infra.js#default',\n flags: defineCommandFlags({\n sourceRef: { type: 'string', description: 'Workspace source reference (repo/branch/etc)' },\n basePath: { type: 'string', description: 'Workspace base path' },\n createEnvironment: { type: 'boolean', default: false, description: 'Provision environment after workspace materialize' },\n templateId: { type: 'string', description: 'Environment template ID' },\n ttlMs: { type: 'number', description: 'Environment lease TTL in milliseconds' },\n captureSnapshot: { type: 'boolean', default: false, description: 'Capture snapshot after prepare' },\n namespace: { type: 'string', description: 'Snapshot namespace' },\n }),\n },\n {\n path: 'infra snapshot capture',\n operationType: 'execute' as const,\n describe: 'Capture snapshot for workspace/environment.',\n handler: './cli/commands/capture-snapshot.js#default',\n flags: defineCommandFlags({\n workspaceId: { type: 'string', description: 'Workspace ID' },\n environmentId: { type: 'string', description: 'Environment ID' },\n namespace: { type: 'string', description: 'Snapshot namespace' },\n sourcePath: { type: 'string', description: 'Source path for snapshot' },\n }),\n },\n {\n path: 'infra snapshot restore',\n operationType: 'execute' as const,\n describe: 'Restore snapshot to workspace/environment target.',\n handler: './cli/commands/restore-snapshot.js#default',\n flags: defineCommandFlags({\n snapshotId: { type: 'string', required: true, description: 'Snapshot ID to restore' },\n workspaceId: { type: 'string', description: 'Workspace ID target' },\n environmentId: { type: 'string', description: 'Environment ID target' },\n targetPath: { type: 'string', description: 'Restore target path' },\n overwrite: { type: 'boolean', default: false, description: 'Overwrite existing files' },\n }),\n },\n ],\n },\n};\n\nexport default manifest;\n"]}
|
package/dist/manifest.v3.js
CHANGED
|
@@ -7,7 +7,7 @@ var manifest = {
|
|
|
7
7
|
version: "0.1.0",
|
|
8
8
|
display: {
|
|
9
9
|
name: "Infra Worker",
|
|
10
|
-
description: "Provision infra capabilities
|
|
10
|
+
description: "Provision infra capabilities for orchestrators",
|
|
11
11
|
tags: ["infra", "workspace", "environment", "snapshot"]
|
|
12
12
|
},
|
|
13
13
|
permissions: {
|
|
@@ -38,13 +38,16 @@ var manifest = {
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
cli: {
|
|
41
|
+
groupMeta: [
|
|
42
|
+
{ path: "infra", describe: "Infrastructure provisioning commands" },
|
|
43
|
+
{ path: "infra snapshot", describe: "Workspace and environment snapshot management" }
|
|
44
|
+
],
|
|
41
45
|
commands: [
|
|
42
46
|
{
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
path: "infra prepare",
|
|
48
|
+
operationType: "execute",
|
|
45
49
|
describe: "Materialize workspace, optional environment, and optional snapshot.",
|
|
46
50
|
handler: "./cli/commands/prepare-infra.js#default",
|
|
47
|
-
handlerPath: "./cli/commands/prepare-infra.js",
|
|
48
51
|
flags: defineCommandFlags({
|
|
49
52
|
sourceRef: { type: "string", description: "Workspace source reference (repo/branch/etc)" },
|
|
50
53
|
basePath: { type: "string", description: "Workspace base path" },
|
|
@@ -56,11 +59,10 @@ var manifest = {
|
|
|
56
59
|
})
|
|
57
60
|
},
|
|
58
61
|
{
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
path: "infra snapshot capture",
|
|
63
|
+
operationType: "execute",
|
|
61
64
|
describe: "Capture snapshot for workspace/environment.",
|
|
62
65
|
handler: "./cli/commands/capture-snapshot.js#default",
|
|
63
|
-
handlerPath: "./cli/commands/capture-snapshot.js",
|
|
64
66
|
flags: defineCommandFlags({
|
|
65
67
|
workspaceId: { type: "string", description: "Workspace ID" },
|
|
66
68
|
environmentId: { type: "string", description: "Environment ID" },
|
|
@@ -69,11 +71,10 @@ var manifest = {
|
|
|
69
71
|
})
|
|
70
72
|
},
|
|
71
73
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
path: "infra snapshot restore",
|
|
75
|
+
operationType: "execute",
|
|
74
76
|
describe: "Restore snapshot to workspace/environment target.",
|
|
75
77
|
handler: "./cli/commands/restore-snapshot.js#default",
|
|
76
|
-
handlerPath: "./cli/commands/restore-snapshot.js",
|
|
77
78
|
flags: defineCommandFlags({
|
|
78
79
|
snapshotId: { type: "string", required: true, description: "Snapshot ID to restore" },
|
|
79
80
|
workspaceId: { type: "string", description: "Workspace ID target" },
|
package/dist/manifest.v3.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/manifest.v3.ts"],"names":[],"mappings":";;;AAGO,IAAM,QAAA,GAAuB;AAAA,EAClC,MAAA,EAAQ,aAAA;AAAA,EACR,EAAA,EAAI,uBAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,cAAA;AAAA,IACN,WAAA,EAAa,
|
|
1
|
+
{"version":3,"sources":["../src/manifest.v3.ts"],"names":[],"mappings":";;;AAGO,IAAM,QAAA,GAAuB;AAAA,EAClC,MAAA,EAAQ,aAAA;AAAA,EACR,EAAA,EAAI,uBAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,cAAA;AAAA,IACN,WAAA,EAAa,gDAAA;AAAA,IACb,IAAA,EAAM,CAAC,OAAA,EAAS,WAAA,EAAa,eAAe,UAAU;AAAA,GACxD;AAAA,EACA,WAAA,EAAa;AAAA,IACX,QAAA,EAAU;AAAA,MACR,WAAA,EAAa;AAAA,QACX,MAAA,EAAQ,IAAA;AAAA,QACR,IAAA,EAAM,IAAA;AAAA,QACN,OAAA,EAAS,IAA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AW,OAAA,EAAS,KAAA,EAAO,aAAa,0BAAA;AAA2B,SACvF;AAAA;AACH;AACF;AAEJ;AAEA,IAAO,mBAAA,GAAQ","file":"manifest.v3.js","sourcesContent":["import type { ManifestV3 } from '@kb-labs/plugin-contracts';\nimport { defineCommandFlags } from '@kb-labs/sdk';\n\nexport const manifest: ManifestV3 = {\n schema: 'kb.plugin/3',\n id: '@kb-labs/infra-worker',\n version: '0.1.0',\n display: {\n name: 'Infra Worker',\n description: 'Provision infra capabilities for orchestrators',\n tags: ['infra', 'workspace', 'environment', 'snapshot'],\n },\n permissions: {\n platform: {\n environment: {\n create: true,\n read: true,\n destroy: true,\n renewLease: true,\n templates: ['*'],\n },\n workspace: {\n materialize: true,\n attach: true,\n release: true,\n read: true,\n sources: ['*'],\n paths: ['*'],\n },\n snapshot: {\n capture: true,\n restore: true,\n delete: true,\n read: true,\n garbageCollect: true,\n namespaces: ['*'],\n },\n },\n },\n cli: {\n groupMeta: [\n { path: 'infra', describe: 'Infrastructure provisioning commands' },\n { path: 'infra snapshot', describe: 'Workspace and environment snapshot management' },\n ],\n commands: [\n {\n path: 'infra prepare',\n operationType: 'execute' as const,\n describe: 'Materialize workspace, optional environment, and optional snapshot.',\n handler: './cli/commands/prepare-infra.js#default',\n flags: defineCommandFlags({\n sourceRef: { type: 'string', description: 'Workspace source reference (repo/branch/etc)' },\n basePath: { type: 'string', description: 'Workspace base path' },\n createEnvironment: { type: 'boolean', default: false, description: 'Provision environment after workspace materialize' },\n templateId: { type: 'string', description: 'Environment template ID' },\n ttlMs: { type: 'number', description: 'Environment lease TTL in milliseconds' },\n captureSnapshot: { type: 'boolean', default: false, description: 'Capture snapshot after prepare' },\n namespace: { type: 'string', description: 'Snapshot namespace' },\n }),\n },\n {\n path: 'infra snapshot capture',\n operationType: 'execute' as const,\n describe: 'Capture snapshot for workspace/environment.',\n handler: './cli/commands/capture-snapshot.js#default',\n flags: defineCommandFlags({\n workspaceId: { type: 'string', description: 'Workspace ID' },\n environmentId: { type: 'string', description: 'Environment ID' },\n namespace: { type: 'string', description: 'Snapshot namespace' },\n sourcePath: { type: 'string', description: 'Source path for snapshot' },\n }),\n },\n {\n path: 'infra snapshot restore',\n operationType: 'execute' as const,\n describe: 'Restore snapshot to workspace/environment target.',\n handler: './cli/commands/restore-snapshot.js#default',\n flags: defineCommandFlags({\n snapshotId: { type: 'string', required: true, description: 'Snapshot ID to restore' },\n workspaceId: { type: 'string', description: 'Workspace ID target' },\n environmentId: { type: 'string', description: 'Environment ID target' },\n targetPath: { type: 'string', description: 'Restore target path' },\n overwrite: { type: 'boolean', default: false, description: 'Overwrite existing files' },\n }),\n },\n ],\n },\n};\n\nexport default manifest;\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kb-labs/infra-worker-core",
|
|
3
3
|
"description": "Infra worker plugin core for workspace/environment/snapshot lifecycle operations.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.96.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"react": "^19.0.0",
|
|
27
27
|
"zod": "^3.25.76",
|
|
28
|
-
"@kb-labs/plugin-contracts": "2.94.0",
|
|
29
28
|
"@kb-labs/sdk": "2.21.2",
|
|
30
|
-
"@kb-labs/
|
|
29
|
+
"@kb-labs/plugin-contracts": "2.96.0",
|
|
30
|
+
"@kb-labs/infra-worker-contracts": "2.96.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^24.3.3",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"rimraf": "^6.0.1",
|
|
37
37
|
"tsup": "^8.5.0",
|
|
38
38
|
"typescript": "^5.6.3",
|
|
39
|
-
"vitest": "^3.2.
|
|
40
|
-
"@kb-labs/devkit": "2.
|
|
41
|
-
"@kb-labs/plugin-runtime": "2.
|
|
39
|
+
"vitest": "^3.2.6",
|
|
40
|
+
"@kb-labs/devkit": "2.96.0",
|
|
41
|
+
"@kb-labs/plugin-runtime": "2.96.0"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=20.0.0",
|