@intentius/chant-lexicon-k3d 0.44.14 → 0.46.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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env tsx
2
+ export {};
3
+ //# sourceMappingURL=docs-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-cli.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-cli.ts"],"names":[],"mappings":""}
@@ -1,7 +1,10 @@
1
1
  /**
2
- * Generate documentation site for the k3d lexicon.
2
+ * Documentation generation for the k3d lexicon.
3
+ *
4
+ * Generates Starlight MDX pages for k3d entities using the core docs pipeline.
5
+ * The overview prose lives here; authored pages live under docs/pages/.
3
6
  */
4
- export declare function generateDocs(options?: {
7
+ export declare function generateDocs(opts?: {
5
8
  verbose?: boolean;
6
9
  }): Promise<void>;
7
10
  //# sourceMappingURL=docs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBjF"}
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgFH,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB9E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-k3d",
3
- "version": "0.44.14",
3
+ "version": "0.46.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/",
@@ -52,7 +52,7 @@
52
52
  "access": "public"
53
53
  },
54
54
  "peerDependencies": {
55
- "@intentius/chant": "^0.44.14",
55
+ "@intentius/chant": "^0.46.0",
56
56
  "typescript": "^5.9.3"
57
57
  },
58
58
  "description": "k3d lexicon for chant — a local Kubernetes cluster as declarable data",
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env tsx
2
+ import { generateDocs } from "./docs";
3
+
4
+ await generateDocs({ verbose: true });
@@ -1,25 +1,106 @@
1
- import { docsPipeline, writeDocsSite } from "@intentius/chant/codegen/docs";
2
-
3
1
  /**
4
- * Generate documentation site for the k3d lexicon.
2
+ * Documentation generation for the k3d lexicon.
3
+ *
4
+ * Generates Starlight MDX pages for k3d entities using the core docs pipeline.
5
+ * The overview prose lives here; authored pages live under docs/pages/.
5
6
  */
6
- export async function generateDocs(options?: { verbose?: boolean }): Promise<void> {
7
- const config = {
7
+
8
+ import { dirname, join } from "path";
9
+ import { fileURLToPath } from "url";
10
+ import { docsPipeline, writeDocsSite, type DocsConfig } from "@intentius/chant/codegen/docs";
11
+
12
+ function serviceFromType(resourceType: string): string {
13
+ const parts = resourceType.split("::");
14
+ return parts.length >= 2 ? parts[1] : "K3d";
15
+ }
16
+
17
+ const overview = `The k3d lexicon types [k3d](https://k3d.io)'s own declarative config —
18
+ \`k3d.io/v1alpha5\` SimpleConfig, generated from upstream's published JSON
19
+ Schema, pinned at **k3d v5.9.0**. \`chant build\` emits a YAML file that
20
+ \`k3d cluster create --config\` consumes verbatim, so the walk-away cost is
21
+ zero: the artifact is a file the native tool accepts with chant nowhere in
22
+ sight.
23
+
24
+ \`\`\`ts
25
+ import { Cluster, K3dOptions, Options } from "@intentius/chant-lexicon-k3d";
26
+
27
+ export const devCluster = new Cluster({
28
+ metadata: { name: "chant-dev" },
29
+ servers: 1,
30
+ agents: 0,
31
+ options: new Options({
32
+ k3d: new K3dOptions({ disableLoadbalancer: true }),
33
+ }),
34
+ });
35
+ \`\`\`
36
+
37
+ ## The kubeconfig default is chant's, not upstream's
38
+
39
+ k3d's own defaults rewrite \`~/.kube/config\` and switch your active context
40
+ on every cluster create. When a declaration says nothing about
41
+ \`options.kubeconfig\`, the emitted config pins both off:
42
+
43
+ \`\`\`yaml
44
+ options:
45
+ kubeconfig:
46
+ updateDefaultKubeconfig: false
47
+ switchCurrentContext: false
48
+ \`\`\`
49
+
50
+ This is deliberate: a tool that reconciles infrastructure must not repoint
51
+ your shell as a side effect — an unrelated \`k3d cluster create\` switching
52
+ the ambient context mid-run produces convincingly false failures. Declare
53
+ \`options.kubeconfig\` yourself to opt back into upstream behaviour; what you
54
+ write is emitted exactly as written. The \`k3dUp\` activity reports the
55
+ context name and kubeconfig path it produced either way, so whatever
56
+ applies manifests afterwards knows what to talk to.
57
+
58
+ ## Lifecycle is an Op activity pair
59
+
60
+ Cluster creation is procedural, not desired-state — nobody expects
61
+ \`chant lifecycle diff\` to reconcile a laptop. \`k3dUp\` / \`k3dDown\` shell out
62
+ to k3d with the emitted config and are idempotent; add \`"k3d"\` to your
63
+ project's \`lexicons\` so \`loadActivities\` finds them.
64
+
65
+ ## Ownership and observation
66
+
67
+ With ownership configured, the serializer stamps chant's marker as Docker
68
+ labels on every node via \`options.runtime.labels\`; the labels survive
69
+ \`k3d cluster stop\`/\`start\`. \`chant lifecycle diff --live\` reports each
70
+ declared cluster as present, absent, or not-observed-with-a-reason — Docker
71
+ being down reads as *not observed*, never as *absent*, so a stopped daemon
72
+ cannot masquerade as a missing cluster. There is no property-level drift on
73
+ purpose: the config is an input to creation, not a spec k3d reconciles
74
+ against.
75
+
76
+ ## Checks
77
+
78
+ - **K3D001** (lint, error) — a literal \`registries.create.proxy.password\`
79
+ in source. A committed cluster config is a leaked registry credential.
80
+ - **K3D101** (post-synth, error) — a \`nodeFilter\` that matches no node.
81
+ k3d applies an unmatched filter to nothing and says nothing.
82
+ - **K3D102** (post-synth, error) — a registry proxy password that reached
83
+ the emitted config, whatever route it took through the source.
84
+ `;
85
+
86
+ export async function generateDocs(opts?: { verbose?: boolean }): Promise<void> {
87
+ const pkgDir = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
88
+
89
+ const config: DocsConfig = {
8
90
  name: "k3d",
9
91
  displayName: "K3d",
10
- description: "k3d lexicon documentation",
11
- distDir: "./dist",
12
- outDir: "./docs",
13
- // TODO: Implement service grouping for your provider
14
- serviceFromType: (type: string) => type.split("::")[1] ?? type,
15
- // TODO: Implement resource documentation URLs
16
- resourceTypeUrl: (type: string) => `#${type}`,
92
+ description: "Declare a local k3d cluster as data; the config is the artifact",
93
+ distDir: join(pkgDir, "dist"),
94
+ outDir: join(pkgDir, "docs"),
95
+ basePath: process.env.DOCS_BASE_PATH ?? "/chant/lexicons/k3d/",
96
+ overview,
97
+ serviceFromType,
17
98
  };
18
99
 
19
100
  const result = docsPipeline(config);
20
101
  writeDocsSite(config, result);
21
102
 
22
- if (options?.verbose) {
23
- console.error("Documentation generated");
103
+ if (opts?.verbose) {
104
+ console.error(`Generated ${result.pages.size} documentation pages`);
24
105
  }
25
106
  }