@intentius/chant-lexicon-k3s 0.44.14 → 0.45.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 k3s lexicon.
2
+ * Documentation generation for the k3s lexicon.
3
+ *
4
+ * Generates Starlight MDX pages for k3s 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;AAgEH,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-k3s",
3
- "version": "0.44.14",
3
+ "version": "0.45.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/",
@@ -45,7 +45,7 @@
45
45
  "access": "public"
46
46
  },
47
47
  "peerDependencies": {
48
- "@intentius/chant": "^0.44.14",
48
+ "@intentius/chant": "^0.45.0",
49
49
  "typescript": "^5.9.3"
50
50
  },
51
51
  "description": "k3s lexicon for chant — the k3s distro's host configuration 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,90 @@
1
- import { docsPipeline, writeDocsSite } from "@intentius/chant/codegen/docs";
2
-
3
1
  /**
4
- * Generate documentation site for the k3s lexicon.
2
+ * Documentation generation for the k3s lexicon.
3
+ *
4
+ * Generates Starlight MDX pages for k3s 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] : "K3s";
15
+ }
16
+
17
+ const overview = `The k3s lexicon declares the files k3s itself consumes: \`config.yaml\` for
18
+ \`k3s server\` / \`k3s agent\`, and \`registries.yaml\` for the embedded
19
+ containerd. The emitted files are exactly what the native tool accepts —
20
+ drop them at \`/etc/rancher/k3s/\` (or pass \`--config\`) and chant is nowhere
21
+ in sight. That walk-away property is the reason this is a lexicon at all.
22
+
23
+ \`\`\`bash
24
+ npm install --save-dev @intentius/chant @intentius/chant-lexicon-k3s
25
+ \`\`\`
26
+
27
+ \`\`\`typescript
28
+ // chant.config.ts
29
+ export default {
30
+ lexicons: ["k3s"],
31
+ };
32
+ \`\`\`
33
+
34
+ ## A two-node cluster
35
+
36
+ \`\`\`typescript
37
+ import { Agent, Server } from "@intentius/chant-lexicon-k3s";
38
+
39
+ export const controlPlane = new Server({
40
+ "cluster-init": true,
41
+ "tls-san": ["10.0.0.10", "cp.example.internal"],
42
+ "write-kubeconfig-mode": "0600",
43
+ });
44
+
45
+ export const worker = new Agent({
46
+ server: "https://cp.example.internal:6443",
47
+ "token-file": "/etc/rancher/k3s/agent-token",
48
+ });
49
+ \`\`\`
50
+
51
+ ## The token boundary
52
+
53
+ There is no \`token\` property, on purpose. The join secret reaches a node
54
+ as a file (\`token-file\`, \`agent-token-file\`) or as \`K3S_TOKEN\` /
55
+ \`K3S_TOKEN_FILE\` in the installer's environment — never as a value in
56
+ source. A literal that arrives through raw props anyway fails K3S001 at
57
+ lint and K3S101 at build; the same wall covers the etcd S3 snapshot
58
+ credentials (\`etcd-s3-config-secret\` is the reference form upstream
59
+ provides).
60
+
61
+ ## Relationship to k3d
62
+
63
+ The [k3d lexicon](/chant/lexicons/k3d/) declares a k3d-managed cluster —
64
+ k3s wrapped in Docker, config consumed by the \`k3d\` CLI. This lexicon
65
+ declares k3s on real hosts: Lima VMs, bare metal, cloud instances. The
66
+ acceptance test for both is the same idea — the native tool consuming the
67
+ emitted file is the proof.
68
+ `;
69
+
70
+ export async function generateDocs(opts?: { verbose?: boolean }): Promise<void> {
71
+ const pkgDir = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
72
+
73
+ const config: DocsConfig = {
8
74
  name: "k3s",
9
75
  displayName: "K3s",
10
- description: "k3s 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}`,
76
+ description: "k3s host configuration (server/agent config.yaml and registries.yaml) as typed chant source",
77
+ distDir: join(pkgDir, "dist"),
78
+ outDir: join(pkgDir, "docs"),
79
+ basePath: process.env.DOCS_BASE_PATH ?? "/chant/lexicons/k3s/",
80
+ overview,
81
+ serviceFromType,
17
82
  };
18
83
 
19
84
  const result = docsPipeline(config);
20
85
  writeDocsSite(config, result);
21
86
 
22
- if (options?.verbose) {
23
- console.error("Documentation generated");
87
+ if (opts?.verbose) {
88
+ console.error(`Generated ${result.pages.size} documentation pages`);
24
89
  }
25
90
  }