@vibesdotdev/integrations-kubernetes 0.0.0-stage → 1.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +19 -2
  2. package/dist/helm-chart.d.ts +13 -0
  3. package/dist/helm-chart.d.ts.map +1 -0
  4. package/dist/helm-chart.js +508 -0
  5. package/dist/helm-chart.js.map +1 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +2 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/k8s-configmap.d.ts +25 -0
  11. package/dist/k8s-configmap.d.ts.map +1 -0
  12. package/dist/k8s-configmap.js +168 -0
  13. package/dist/k8s-configmap.js.map +1 -0
  14. package/dist/k8s-gpu-operator.d.ts +3 -0
  15. package/dist/k8s-gpu-operator.d.ts.map +1 -0
  16. package/dist/k8s-gpu-operator.js +53 -0
  17. package/dist/k8s-gpu-operator.js.map +1 -0
  18. package/dist/k8s-namespace.d.ts +51 -0
  19. package/dist/k8s-namespace.d.ts.map +1 -0
  20. package/dist/k8s-namespace.js +280 -0
  21. package/dist/k8s-namespace.js.map +1 -0
  22. package/dist/k8s-pod-health.d.ts +60 -0
  23. package/dist/k8s-pod-health.d.ts.map +1 -0
  24. package/dist/k8s-pod-health.js +376 -0
  25. package/dist/k8s-pod-health.js.map +1 -0
  26. package/dist/k8s-secret.d.ts +55 -0
  27. package/dist/k8s-secret.d.ts.map +1 -0
  28. package/dist/k8s-secret.js +391 -0
  29. package/dist/k8s-secret.js.map +1 -0
  30. package/dist/kind-cluster.d.ts +84 -0
  31. package/dist/kind-cluster.d.ts.map +1 -0
  32. package/dist/kind-cluster.js +694 -0
  33. package/dist/kind-cluster.js.map +1 -0
  34. package/dist/kubectl-budget.client.d.ts +13 -0
  35. package/dist/kubectl-budget.client.d.ts.map +1 -0
  36. package/dist/kubectl-budget.client.js +38 -0
  37. package/dist/kubectl-budget.client.js.map +1 -0
  38. package/dist/kubectl.d.ts +59 -0
  39. package/dist/kubectl.d.ts.map +1 -0
  40. package/dist/kubectl.js +121 -0
  41. package/dist/kubectl.js.map +1 -0
  42. package/dist/port-forward-command.d.ts +6 -0
  43. package/dist/port-forward-command.d.ts.map +1 -0
  44. package/dist/port-forward-command.js +24 -0
  45. package/dist/port-forward-command.js.map +1 -0
  46. package/dist/port-forward-compat.d.ts +11 -0
  47. package/dist/port-forward-compat.d.ts.map +1 -0
  48. package/dist/port-forward-compat.js +21 -0
  49. package/dist/port-forward-compat.js.map +1 -0
  50. package/dist/port-forward-identity.d.ts +23 -0
  51. package/dist/port-forward-identity.d.ts.map +1 -0
  52. package/dist/port-forward-identity.js +72 -0
  53. package/dist/port-forward-identity.js.map +1 -0
  54. package/dist/port-forward.consumer.plugin.d.ts +3 -0
  55. package/dist/port-forward.consumer.plugin.d.ts.map +1 -0
  56. package/dist/port-forward.consumer.plugin.js +10 -0
  57. package/dist/port-forward.consumer.plugin.js.map +1 -0
  58. package/dist/port-forward.d.ts +18 -0
  59. package/dist/port-forward.d.ts.map +1 -0
  60. package/dist/port-forward.descriptor.d.ts +7 -0
  61. package/dist/port-forward.descriptor.d.ts.map +1 -0
  62. package/dist/port-forward.descriptor.js +3 -0
  63. package/dist/port-forward.descriptor.js.map +1 -0
  64. package/dist/port-forward.impl.consumer.d.ts +22 -0
  65. package/dist/port-forward.impl.consumer.d.ts.map +1 -0
  66. package/dist/port-forward.impl.consumer.js +32 -0
  67. package/dist/port-forward.impl.consumer.js.map +1 -0
  68. package/dist/port-forward.js +26 -0
  69. package/dist/port-forward.js.map +1 -0
  70. package/dist/port-forward.kind.d.ts +13 -0
  71. package/dist/port-forward.kind.d.ts.map +1 -0
  72. package/dist/port-forward.kind.js +12 -0
  73. package/dist/port-forward.kind.js.map +1 -0
  74. package/dist/resource-providers.consumer.plugin.d.ts +3 -0
  75. package/dist/resource-providers.consumer.plugin.d.ts.map +1 -0
  76. package/dist/resource-providers.consumer.plugin.js +56 -0
  77. package/dist/resource-providers.consumer.plugin.js.map +1 -0
  78. package/dist/schemas/helm-chart.d.ts +14 -0
  79. package/dist/schemas/helm-chart.d.ts.map +1 -0
  80. package/dist/schemas/helm-chart.js +12 -0
  81. package/dist/schemas/helm-chart.js.map +1 -0
  82. package/dist/schemas/k8s-pod-health.d.ts +17 -0
  83. package/dist/schemas/k8s-pod-health.d.ts.map +1 -0
  84. package/dist/schemas/k8s-pod-health.js +21 -0
  85. package/dist/schemas/k8s-pod-health.js.map +1 -0
  86. package/dist/schemas/port-forward.d.ts +62 -0
  87. package/dist/schemas/port-forward.d.ts.map +1 -0
  88. package/dist/schemas/port-forward.js +24 -0
  89. package/dist/schemas/port-forward.js.map +1 -0
  90. package/dist/tool-env.d.ts +19 -0
  91. package/dist/tool-env.d.ts.map +1 -0
  92. package/dist/tool-env.js +32 -0
  93. package/dist/tool-env.js.map +1 -0
  94. package/package.json +80 -4
package/README.md CHANGED
@@ -1,3 +1,20 @@
1
- # Temporary Holding Version
1
+ # Kubernetes integration
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Kubernetes vendor logic for the Vibes runtime. See [SPEC.md](./SPEC.md) for the
4
+ contract and typed refusals.
5
+
6
+ - `.` exports only `PortForwardConfigSchema` and `PortForwardConfig`.
7
+ - `./port-forward` exports schemas, the `kubernetes/port-forward` kind and
8
+ descriptor, `buildPortForwardPlan(config)`, `preparePortForward(runtime, config)`
9
+ and `readPortForwardConfig(command, args, labelSelector?)`. The default
10
+ readiness selector is `app.kubernetes.io/instance=<service>`.
11
+ - `./port-forward.consumer.plugin` composes the lazy consumer implementation.
12
+ - `./resource-providers.consumer.plugin` contributes the `pm/resource-provider`
13
+ descriptors `kind/cluster`, `k8s/namespace`, `k8s/secret`, `k8s/secret-tls`,
14
+ `k8s/secret-docker-registry`, `k8s/configmap`, `k8s/pod-health`,
15
+ `k8s/gpu-operator` and `helm/chart`.
16
+ - `./kubectl` exports `createPortForwardProcess` and `createMultiplePortForwards`.
17
+
18
+ From this package directory run `bun run lint`, `bun run check`,
19
+ `bun run test`, and `bun run build`. Run the fifth configured check through
20
+ `workspace-rules {action: "check", paths: ["repos/platform/integrations/integrations/kubernetes"]}`.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Helm Chart Resource Provider
3
+ * Manages Helm chart installations via template + kubectl apply
4
+ */
5
+ import type { ResourceProvider } from '@vibesdotdev/pm/resources/provider';
6
+ import { type HelmChartConfig } from './schemas/helm-chart.ts';
7
+ export { HelmChartConfigSchema, type HelmChartConfig } from './schemas/helm-chart.ts';
8
+ /**
9
+ * Helm Chart Provider
10
+ * Uses `helm template` + `kubectl apply` for declarative deployments
11
+ */
12
+ export declare const helmChartProvider: ResourceProvider<HelmChartConfig>;
13
+ //# sourceMappingURL=helm-chart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helm-chart.d.ts","sourceRoot":"","sources":["../src/helm-chart.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EACX,gBAAgB,EAKhB,MAAM,oCAAoC,CAAC;AAW5C,OAAO,EAAyB,KAAK,eAAe,EAAmB,MAAM,yBAAyB,CAAC;AAyBvG,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAWtF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,CAAC,eAAe,CAgM/D,CAAC"}
@@ -0,0 +1,508 @@
1
+ /**
2
+ * Helm Chart Resource Provider
3
+ * Manages Helm chart installations via template + kubectl apply
4
+ */
5
+ import { CapabilityError, requireRuntimeCwd, valueFreeFailure } from '@vibesdotdev/kernel';
6
+ import { getLogger } from '@vibesdotdev/logging';
7
+ import { createSha256 } from '@vibesdotdev/shared/hashing';
8
+ import * as z from 'zod/v4';
9
+ import { attempt } from '@vibesdotdev/pm/utils/attempt';
10
+ import { listNamesIfPresent, pmFileSystem, readBytesFileIfPresent, statFollowingLinks } from '@vibesdotdev/pm/helpers/runtime-files';
11
+ import { providerFailureText, setupErrorResult, toolFailure, toolOutputExcerpt } from '@vibesdotdev/pm/resources/tool-env';
12
+ import { HelmChartConfigSchema } from "./schemas/helm-chart.js";
13
+ import { runKubeCapture } from "./tool-env.js";
14
+ /** The pods `kubectl get pods -o json` lists: only each pod's conditions are read. */
15
+ const HelmPodListSchema = z.object({
16
+ items: z
17
+ .array(z
18
+ .object({
19
+ status: z
20
+ .object({
21
+ conditions: z.array(z.object({ type: z.string().optional(), status: z.string().optional() })).optional()
22
+ })
23
+ .optional()
24
+ })
25
+ .catch({}))
26
+ .catch([])
27
+ });
28
+ /** The objects `kubectl get all -o json` lists: only how many are read. */
29
+ const KubectlItemListSchema = z.object({ items: z.array(z.unknown()).optional() });
30
+ const KUBECTL_REQUEST_TIMEOUT = '5s';
31
+ export { HelmChartConfigSchema } from "./schemas/helm-chart.js";
32
+ /** The inline `values` that are text: what a helm failure must not repeat. */
33
+ function inlineValueStrings(config) {
34
+ return Object.values(config.values ?? {}).map(String).filter((value) => value.length >= 4);
35
+ }
36
+ function validateConfig(config) {
37
+ return HelmChartConfigSchema.parse(config);
38
+ }
39
+ /**
40
+ * Helm Chart Provider
41
+ * Uses `helm template` + `kubectl apply` for declarative deployments
42
+ */
43
+ export const helmChartProvider = {
44
+ type: 'helm/chart',
45
+ async setup(config, { runtime }) {
46
+ const helmConfig = validateConfig(config.config);
47
+ const applied = await attempt(() => applyRelease(runtime, config, helmConfig));
48
+ return applied.ok ? applied.value : setupErrorResult(config, applied.failure);
49
+ },
50
+ async stop(id, state, { runtime }) {
51
+ if (!state || !state.config) {
52
+ // Cannot stop without config
53
+ return;
54
+ }
55
+ const helmConfig = validateConfig(state.config);
56
+ // Scale all deployments and statefulsets to 0 replicas
57
+ // This stops the pods without deleting the resources
58
+ const resourceTypes = ['deployment', 'statefulset'];
59
+ for (const resourceType of resourceTypes) {
60
+ // Get all resources of this type for the release
61
+ const getCmd = [
62
+ 'kubectl',
63
+ 'get',
64
+ resourceType,
65
+ `--selector=app.kubernetes.io/instance=${helmConfig.release}`,
66
+ '--namespace',
67
+ helmConfig.namespace,
68
+ '--output',
69
+ 'jsonpath={.items[*].metadata.name}'
70
+ ];
71
+ if (helmConfig.context) {
72
+ getCmd.push('--context', helmConfig.context);
73
+ }
74
+ const { stdout: output } = await runKubeCapture(runtime, getCmd[0], getCmd.slice(1));
75
+ const names = output.trim().split(/\s+/).filter(Boolean);
76
+ // Scale each resource to 0
77
+ for (const name of names) {
78
+ const scaleCmd = [
79
+ 'kubectl',
80
+ 'scale',
81
+ `${resourceType}/${name}`,
82
+ '--replicas=0',
83
+ '--namespace',
84
+ helmConfig.namespace
85
+ ];
86
+ if (helmConfig.context) {
87
+ scaleCmd.push('--context', helmConfig.context);
88
+ }
89
+ await runKubeCapture(runtime, scaleCmd[0], scaleCmd.slice(1));
90
+ // Ignore scale errors - resource might not exist
91
+ }
92
+ }
93
+ },
94
+ async resume(id, state, { runtime }) {
95
+ if (!state || !state.config) {
96
+ // Cannot resume without config
97
+ return;
98
+ }
99
+ const helmConfig = validateConfig(state.config);
100
+ // Restore deployments and statefulsets to 1 replica (default)
101
+ // For proper replica counts, we'd need to store the original count in state
102
+ // For now, scale to 1 which is a reasonable default
103
+ const resourceTypes = ['deployment', 'statefulset'];
104
+ for (const resourceType of resourceTypes) {
105
+ // Get all resources of this type for the release
106
+ const getCmd = [
107
+ 'kubectl',
108
+ 'get',
109
+ resourceType,
110
+ `--selector=app.kubernetes.io/instance=${helmConfig.release}`,
111
+ '--namespace',
112
+ helmConfig.namespace,
113
+ '--output',
114
+ 'jsonpath={.items[*].metadata.name}'
115
+ ];
116
+ if (helmConfig.context) {
117
+ getCmd.push('--context', helmConfig.context);
118
+ }
119
+ const { stdout: output } = await runKubeCapture(runtime, getCmd[0], getCmd.slice(1));
120
+ const names = output.trim().split(/\s+/).filter(Boolean);
121
+ // Scale each resource to 1
122
+ for (const name of names) {
123
+ const scaleCmd = [
124
+ 'kubectl',
125
+ 'scale',
126
+ `${resourceType}/${name}`,
127
+ '--replicas=1',
128
+ '--namespace',
129
+ helmConfig.namespace
130
+ ];
131
+ if (helmConfig.context) {
132
+ scaleCmd.push('--context', helmConfig.context);
133
+ }
134
+ await runKubeCapture(runtime, scaleCmd[0], scaleCmd.slice(1));
135
+ // Ignore scale errors - resource might not exist
136
+ }
137
+ }
138
+ },
139
+ async teardown(id, state, { runtime, config }) {
140
+ const declared = state?.config ?? config?.config;
141
+ if (!declared) {
142
+ // No config names the release: the teardown cannot run, and says so.
143
+ throw new CapabilityError(`Helm resource '${id}' has no config naming its release to tear down.`, 'NOT_FOUND', {
144
+ reason: 'pm-helm-teardown-unconfigured',
145
+ details: { resourceId: id }
146
+ });
147
+ }
148
+ const helmConfig = validateConfig(declared);
149
+ // Delete using label selector for the release
150
+ const cmd = [
151
+ 'kubectl',
152
+ 'delete',
153
+ 'all',
154
+ `--selector=app.kubernetes.io/instance=${helmConfig.release}`,
155
+ '--namespace',
156
+ helmConfig.namespace,
157
+ '--wait'
158
+ ];
159
+ if (helmConfig.context) {
160
+ cmd.push('--context', helmConfig.context);
161
+ }
162
+ // Teardown reports its outcome: a refused delete is the resource
163
+ // manager's typed failure (it records the error state), never ignored.
164
+ const { exitCode, stderr } = await runKubeCapture(runtime, cmd[0], cmd.slice(1));
165
+ if (exitCode !== 0 && !/not found/i.test(stderr)) {
166
+ throw new CapabilityError(`Helm release '${helmConfig.release}' teardown failed: ${toolOutputExcerpt(stderr) || `exit ${exitCode}`}`, 'UNAVAILABLE', {
167
+ reason: 'pm-helm-teardown-failed',
168
+ details: { release: helmConfig.release, namespace: helmConfig.namespace, exitCode }
169
+ });
170
+ }
171
+ },
172
+ async status(id, { runtime, config: providerConfig }) {
173
+ const config = providerConfig;
174
+ if (!config) {
175
+ return { status: 'missing' };
176
+ }
177
+ const helmConfig = validateConfig(config.config);
178
+ const probed = await attempt(() => probeReleaseStatus(runtime, helmConfig));
179
+ return probed.ok ? probed.value : { status: 'error', error: providerFailureText(probed.failure) };
180
+ },
181
+ async checkReady(config, _state, { runtime }) {
182
+ const helmConfig = validateConfig(config.config);
183
+ const ready = await checkPodsReady(runtime, helmConfig);
184
+ if (ready) {
185
+ return { ready: true };
186
+ }
187
+ return {
188
+ ready: false,
189
+ reason: 'Waiting for Helm release pods to become Ready',
190
+ retryAfter: 2000
191
+ };
192
+ },
193
+ validateConfig(config) {
194
+ return validateConfig(config);
195
+ },
196
+ async computeSourceHash(config, { runtime }) {
197
+ // An invalid config or unreadable source is a failure, never "no hash".
198
+ const helmConfig = validateConfig(config.config);
199
+ return hashHelmSource(await pmFileSystem(runtime), helmConfig, requireRuntimeCwd(runtime));
200
+ }
201
+ };
202
+ /** `helm template` then `kubectl apply` of the release, and the rollout restart that refreshes mounted config. */
203
+ async function applyRelease(runtime, config, helmConfig) {
204
+ // Build helm template command
205
+ const helmCmd = buildHelmTemplateCommand(helmConfig);
206
+ // Execute helm template
207
+ const helmRun = await runKubeCapture(runtime, helmCmd[0], helmCmd.slice(1));
208
+ const helmOutput = helmRun.stdout;
209
+ if (helmRun.exitCode !== 0) {
210
+ throw toolFailure({ tool: 'helm', action: 'template', outcome: helmRun, secrets: inlineValueStrings(helmConfig) });
211
+ }
212
+ // Apply the templated manifests
213
+ const kubectlCmd = buildKubectlApplyCommand(helmConfig);
214
+ const kubectlRun = await runKubeCapture(runtime, kubectlCmd[0], kubectlCmd.slice(1), {
215
+ stdin: helmOutput
216
+ });
217
+ const kubectlOutput = kubectlRun.stdout;
218
+ if (kubectlRun.exitCode !== 0) {
219
+ // The rendered manifests carry values from values files PM never read: keep none of the output.
220
+ throw toolFailure({ tool: 'kubectl', action: 'apply', outcome: kubectlRun, secrets: 'value-free' });
221
+ }
222
+ // Force a rollout of every deployment in the release so pods
223
+ // pick up ConfigMap/Secret changes immediately. This matters
224
+ // for charts that mount configmaps via `subPath` — K8s does
225
+ // NOT refresh subPath mounts in-place, and `kubectl apply` of
226
+ // a changed configmap doesn't touch the deployment spec, so
227
+ // pods would otherwise keep running with stale config until
228
+ // manually restarted.
229
+ //
230
+ // Safe for charts that don't mount configmaps: a rollout
231
+ // restart just bumps the deployment's pod template hash,
232
+ // causing at most a brief stop/start (bounded by the
233
+ // chart's update strategy).
234
+ const restarted = await attempt(() => rolloutRestartRelease(runtime, helmConfig));
235
+ if (!restarted.ok) {
236
+ getLogger('pm:helm-chart', runtime).warn('helm release rollout restart failed', {
237
+ release: helmConfig.release,
238
+ failure: valueFreeFailure(restarted.failure)
239
+ });
240
+ }
241
+ return {
242
+ state: {
243
+ id: config.id,
244
+ type: config.type,
245
+ status: 'ready',
246
+ createdAt: new Date(),
247
+ lastChecked: new Date(),
248
+ metadata: {
249
+ chart: helmConfig.chart,
250
+ release: helmConfig.release,
251
+ namespace: helmConfig.namespace,
252
+ appliedAt: new Date().toISOString()
253
+ },
254
+ config: { ...helmConfig }
255
+ },
256
+ metadata: { output: kubectlOutput }
257
+ };
258
+ }
259
+ /** What `kubectl get all` finds for the release, and whether its pods are ready. */
260
+ async function probeReleaseStatus(runtime, helmConfig) {
261
+ const cmd = [
262
+ 'kubectl',
263
+ 'get',
264
+ 'all',
265
+ `--selector=app.kubernetes.io/instance=${helmConfig.release}`,
266
+ '--namespace',
267
+ helmConfig.namespace,
268
+ '--request-timeout',
269
+ KUBECTL_REQUEST_TIMEOUT,
270
+ '--output',
271
+ 'json'
272
+ ];
273
+ if (helmConfig.context) {
274
+ cmd.push('--context', helmConfig.context);
275
+ }
276
+ const { exitCode, stdout: output } = await runKubeCapture(runtime, cmd[0], cmd.slice(1));
277
+ if (exitCode !== 0) {
278
+ return { status: 'missing', error: 'Resources not found' };
279
+ }
280
+ const resources = KubectlItemListSchema.parse(JSON.parse(output));
281
+ const itemCount = resources.items?.length || 0;
282
+ if (itemCount === 0) {
283
+ return { status: 'missing', error: 'No resources deployed' };
284
+ }
285
+ const podsReady = await checkPodsReady(runtime, helmConfig);
286
+ return {
287
+ status: podsReady ? 'ready' : 'creating',
288
+ metadata: { resourceCount: itemCount }
289
+ };
290
+ }
291
+ /**
292
+ * Compute a stable SHA-256 hash over:
293
+ * 1. Every file under the chart directory (sorted by relative path)
294
+ * 2. Every values file referenced in valuesFiles (sorted by path)
295
+ * 3. Inline `values` and `createNamespace` serialized as JSON
296
+ *
297
+ * Non-local charts (foo/bar references to a helm repo) hash only the
298
+ * metadata — we can't cheaply fetch the registry, and the chart name
299
+ * change would trip the hash anyway. The returned hash is hex-encoded
300
+ * and stable across runs so the manager can detect drift.
301
+ */
302
+ async function hashHelmSource(files, config, cwd) {
303
+ const hash = createSha256();
304
+ // Include chart identity + ancillary config so a name/namespace change
305
+ // invalidates the hash even when file contents are identical.
306
+ hash.update(`chart:${config.chart}\n`);
307
+ hash.update(`release:${config.release}\n`);
308
+ hash.update(`namespace:${config.namespace}\n`);
309
+ if (config.context)
310
+ hash.update(`context:${config.context}\n`);
311
+ if (config.createNamespace !== undefined) {
312
+ hash.update(`createNamespace:${config.createNamespace}\n`);
313
+ }
314
+ if (config.values) {
315
+ hash.update(`values:${JSON.stringify(sortObject(config.values))}\n`);
316
+ }
317
+ // Heuristic: look at the path. If it exists on disk as a directory, treat it as local and walk it;
318
+ // a repository chart name is not on disk (absence).
319
+ const resolvedChartPath = files.resolve(cwd, config.chart);
320
+ const chartStat = await statFollowingLinks(files, resolvedChartPath);
321
+ if (chartStat?.kind === 'directory') {
322
+ await hashDirectory(files, resolvedChartPath, resolvedChartPath, hash);
323
+ }
324
+ if (config.valuesFiles?.length) {
325
+ for (const valuesFile of [...config.valuesFiles].sort()) {
326
+ const abs = files.resolve(cwd, valuesFile);
327
+ const content = await readBytesFileIfPresent(files, abs);
328
+ if (content === undefined) {
329
+ // Missing values file — include its absence in the hash so
330
+ // creating the file later trips a re-apply.
331
+ hash.update(`valuesFile:${valuesFile}:missing\n`);
332
+ }
333
+ else {
334
+ hash.update(`valuesFile:${valuesFile}\n`);
335
+ hash.update(content);
336
+ }
337
+ }
338
+ }
339
+ return hash.digestHex();
340
+ }
341
+ /**
342
+ * Walk `dir` recursively and feed every file's relative path + contents
343
+ * into the provided hasher. Entries are visited in sorted order so the
344
+ * output is deterministic across platforms.
345
+ */
346
+ async function hashDirectory(files, dir, rootDir, hash) {
347
+ // Removed while walking: absence.
348
+ const entries = await listNamesIfPresent(files, dir);
349
+ if (entries === undefined)
350
+ return;
351
+ for (const entry of entries) {
352
+ // Skip hidden + build artifacts that don't affect rendered output.
353
+ if (entry === '.DS_Store' || entry === '.git' || entry === 'node_modules')
354
+ continue;
355
+ const full = files.join(dir, entry);
356
+ const stat = await statFollowingLinks(files, full);
357
+ if (stat === undefined)
358
+ continue;
359
+ if (stat.kind === 'directory') {
360
+ await hashDirectory(files, full, rootDir, hash);
361
+ }
362
+ else if (stat.kind === 'file') {
363
+ const rel = full.slice(rootDir.length + 1);
364
+ hash.update(`file:${rel}\n`);
365
+ const content = await readBytesFileIfPresent(files, full);
366
+ hash.update(content ?? '<missing>');
367
+ }
368
+ }
369
+ }
370
+ function sortObject(obj) {
371
+ const keys = Object.keys(obj).sort();
372
+ const out = {};
373
+ for (const k of keys)
374
+ out[k] = obj[k];
375
+ return out;
376
+ }
377
+ /**
378
+ * Force a rollout on every deployment & statefulset in the release.
379
+ * Used after a successful helm apply so pods pick up ConfigMap and
380
+ * Secret changes even when the deployment spec itself hasn't changed
381
+ * (subPath mounts don't auto-refresh).
382
+ */
383
+ async function rolloutRestartRelease(runtime, config) {
384
+ const resourceKinds = ['deployment', 'statefulset', 'daemonset'];
385
+ for (const kind of resourceKinds) {
386
+ const cmd = [
387
+ 'kubectl',
388
+ 'rollout',
389
+ 'restart',
390
+ kind,
391
+ `--selector=app.kubernetes.io/instance=${config.release}`,
392
+ '--namespace',
393
+ config.namespace
394
+ ];
395
+ if (config.context)
396
+ cmd.push('--context', config.context);
397
+ await runKubeCapture(runtime, cmd[0], cmd.slice(1));
398
+ // Ignore non-zero exits — "no resources found" is expected when
399
+ // the release has no deployments of a given kind.
400
+ }
401
+ }
402
+ /**
403
+ * Build helm template command
404
+ */
405
+ function buildHelmTemplateCommand(config) {
406
+ const cmd = ['helm', 'template', config.release];
407
+ // Add chart (with ./ prefix for local charts)
408
+ if (config.chart.startsWith('./') || config.chart.startsWith('/')) {
409
+ cmd.push(config.chart);
410
+ }
411
+ else if (!config.chart.includes('/')) {
412
+ // Local relative path needs ./ prefix for Helm v4
413
+ cmd.push(`./${config.chart}`);
414
+ }
415
+ else {
416
+ cmd.push(config.chart);
417
+ }
418
+ // Add namespace
419
+ cmd.push('--namespace', config.namespace);
420
+ // Add values files
421
+ if (config.valuesFiles) {
422
+ for (const file of config.valuesFiles) {
423
+ cmd.push('--values', file);
424
+ }
425
+ }
426
+ // Add inline values
427
+ if (config.values) {
428
+ for (const [key, value] of Object.entries(config.values)) {
429
+ cmd.push('--set', `${key}=${value}`);
430
+ }
431
+ }
432
+ return cmd;
433
+ }
434
+ /**
435
+ * Build kubectl apply command
436
+ */
437
+ function buildKubectlApplyCommand(config) {
438
+ const cmd = ['kubectl', 'apply', '-f', '-', '--namespace', config.namespace];
439
+ if (config.context) {
440
+ cmd.push('--context', config.context);
441
+ }
442
+ return cmd;
443
+ }
444
+ /**
445
+ * Check if all pods for the release are ready
446
+ */
447
+ async function checkPodsReady(runtime, config) {
448
+ const cmd = [
449
+ 'kubectl',
450
+ 'get',
451
+ 'pods',
452
+ `--selector=app.kubernetes.io/instance=${config.release}`,
453
+ '--namespace',
454
+ config.namespace,
455
+ '--request-timeout',
456
+ KUBECTL_REQUEST_TIMEOUT,
457
+ '--output',
458
+ 'json'
459
+ ];
460
+ if (config.context) {
461
+ cmd.push('--context', config.context);
462
+ }
463
+ const { exitCode, stdout: output } = await runKubeCapture(runtime, cmd[0], cmd.slice(1));
464
+ if (exitCode !== 0) {
465
+ return false;
466
+ }
467
+ {
468
+ // Unparseable kubectl output is a failure, never "not ready".
469
+ const pods = HelmPodListSchema.parse(JSON.parse(output)).items;
470
+ if (pods.length === 0) {
471
+ // No pods yet — check if there are deployments expecting pods
472
+ const deployCmd = [
473
+ 'kubectl',
474
+ 'get',
475
+ 'deployments',
476
+ `--selector=app.kubernetes.io/instance=${config.release}`,
477
+ '--namespace',
478
+ config.namespace,
479
+ '--request-timeout',
480
+ KUBECTL_REQUEST_TIMEOUT,
481
+ '--output',
482
+ 'jsonpath={.items[*].spec.replicas}'
483
+ ];
484
+ if (config.context) {
485
+ deployCmd.push('--context', config.context);
486
+ }
487
+ const { stdout: deployOutput } = await runKubeCapture(runtime, deployCmd[0], deployCmd.slice(1));
488
+ const totalReplicas = deployOutput
489
+ .trim()
490
+ .split(/\s+/)
491
+ .filter(Boolean)
492
+ .reduce((sum, n) => sum + Number(n), 0);
493
+ if (totalReplicas > 0) {
494
+ // Deployments exist expecting pods but none are running yet
495
+ return false;
496
+ }
497
+ // No deployments or all scaled to 0 — consider ready
498
+ return true;
499
+ }
500
+ // Check if all pods are ready
501
+ return pods.every((pod) => {
502
+ const conditions = pod.status?.conditions || [];
503
+ const readyCondition = conditions.find((c) => c.type === 'Ready');
504
+ return readyCondition?.status === 'True';
505
+ });
506
+ }
507
+ }
508
+ //# sourceMappingURL=helm-chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helm-chart.js","sourceRoot":"","sources":["../src/helm-chart.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAS5B,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAElB,MAAM,uCAAuC,CAAC;AAC/C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EAAE,CAAC;gBACpB,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7C,CAAC;YACD,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAE,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAClG,MAAM,aAAa,GAAG,YAAY;iBAChC,IAAI,EAAE;iBACN,KAAK,CAAC,KAAK,CAAC;iBACZ,MAAM,CAAC,OAAO,CAAC;iBACf,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACzC,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;gBACvB,4DAA4D;gBAC5D,OAAO,KAAK,CAAC;YACd,CAAC;YACD,qDAAqD;YACrD,OAAO,IAAI,CAAC;QACb,CAAC;QAED,8BAA8B;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACzB,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI,EAAE,CAAC;YAChD,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;YAClE,OAAO,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;QAC1C,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { PortForwardConfigSchema, type PortForwardConfig } from './schemas/port-forward.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { PortForwardConfigSchema } from "./schemas/port-forward.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAA0B,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Kubernetes ConfigMap Resource Provider (k8s/configmap)
3
+ *
4
+ * Creates a ConfigMap from key/value pairs. The manifest is built in-process
5
+ * and applied on stdin (`kubectl apply -f -`, idempotent): a value never goes
6
+ * on a command line, where every process on the host can read it (SPEC:153).
7
+ *
8
+ * Readiness verifies the configmap exists by name AND that every declared
9
+ * data key is present — so a partial apply (e.g., a key dropped from the
10
+ * descriptor between deploys) surfaces as an error rather than silent drift.
11
+ */
12
+ import * as z from 'zod/v4';
13
+ import type { ResourceProvider } from '@vibesdotdev/pm/resources/provider';
14
+ declare const ConfigMapConfigSchema: z.ZodObject<{
15
+ name: z.ZodString;
16
+ namespace: z.ZodString;
17
+ context: z.ZodOptional<z.ZodString>;
18
+ data: z.ZodRecord<z.ZodString, z.ZodString>;
19
+ }, z.core.$strip>;
20
+ type ConfigMapConfig = z.infer<typeof ConfigMapConfigSchema>;
21
+ /** A ConfigMap manifest built in-process, applied on stdin (never `--from-literal` argv). */
22
+ export declare function buildConfigMapManifest(name: string, namespace: string, data: Record<string, string>): string;
23
+ export declare const k8sConfigMapProvider: ResourceProvider<ConfigMapConfig>;
24
+ export {};
25
+ //# sourceMappingURL=k8s-configmap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"k8s-configmap.d.ts","sourceRoot":"","sources":["../src/k8s-configmap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EACX,gBAAgB,EAKhB,MAAM,oCAAoC,CAAC;AAS5C,QAAA,MAAM,qBAAqB;;;;;iBAOzB,CAAC;AAEH,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AA0C7D,6FAA6F;AAC7F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAE5G;AA8CD,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,CAAC,eAAe,CAoElE,CAAC"}