@intentius/chant-lexicon-cpln 0.124.31 → 0.124.33

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 (75) hide show
  1. package/dist/api.js +88 -0
  2. package/dist/codegen/docs-cli.js +6 -0
  3. package/dist/codegen/docs.js +85 -0
  4. package/dist/codegen/generate-cli.js +25 -0
  5. package/dist/codegen/generate-lexicon.js +50 -0
  6. package/dist/codegen/generate-typescript.js +48 -0
  7. package/dist/codegen/generate.js +86 -0
  8. package/dist/codegen/naming.js +43 -0
  9. package/dist/codegen/package.js +31 -0
  10. package/dist/composites/catalog.js +556 -0
  11. package/dist/composites/cron-job.js +52 -0
  12. package/dist/composites/gvc-environment.js +49 -0
  13. package/dist/composites/index.js +6 -0
  14. package/dist/composites/public-domain.js +70 -0
  15. package/dist/composites/secret-access.js +82 -0
  16. package/dist/composites/serverless-service.js +58 -0
  17. package/dist/composites/stateful-service.js +87 -0
  18. package/dist/coverage.js +104 -0
  19. package/dist/describe-resources.js +264 -0
  20. package/dist/detect.js +52 -0
  21. package/dist/entity-props.js +100 -0
  22. package/dist/generated/index.js +169 -0
  23. package/dist/generated/runtime.js +4 -0
  24. package/dist/index.js +14 -0
  25. package/dist/init-templates.js +125 -0
  26. package/dist/integrity.json +2 -2
  27. package/dist/kinds.js +134 -0
  28. package/dist/lint/audit-catalog.js +90 -0
  29. package/dist/lint/audit-lineage.js +32 -0
  30. package/dist/lint/post-synth/cpl010-unrestricted-outbound.js +34 -0
  31. package/dist/lint/post-synth/cpl011-internal-firewall-scope.js +32 -0
  32. package/dist/lint/post-synth/cpl012-no-literal-credential-env.js +51 -0
  33. package/dist/lint/post-synth/cpl013-qualified-identity-principal.js +40 -0
  34. package/dist/lint/post-synth/cpl014-qualified-secret-ref.js +47 -0
  35. package/dist/lint/post-synth/cpl020-serverless-single-port.js +51 -0
  36. package/dist/lint/post-synth/cpl021-cron-job-shape.js +55 -0
  37. package/dist/lint/post-synth/cpl022-container-ports.js +53 -0
  38. package/dist/lint/post-synth/cpl023-container-resources.js +73 -0
  39. package/dist/lint/post-synth/cpl024-probe-handler.js +43 -0
  40. package/dist/lint/post-synth/cpl025-autoscaling-shape.js +84 -0
  41. package/dist/lint/post-synth/cpl026-scale-to-zero.js +59 -0
  42. package/dist/lint/post-synth/cpl027-capacity-ai-conflict.js +67 -0
  43. package/dist/lint/post-synth/cpl028-volume-set.js +155 -0
  44. package/dist/lint/post-synth/cpl029-link-targets.js +140 -0
  45. package/dist/lint/post-synth/cpl030-domain-routing.js +114 -0
  46. package/dist/lint/post-synth/cpl040-pinned-image.js +41 -0
  47. package/dist/lint/post-synth/cpl041-image-reference-form.js +52 -0
  48. package/dist/lint/post-synth/cpl042-gvc-placement.js +49 -0
  49. package/dist/lint/post-synth/cpl043-policy-scope.js +0 -0
  50. package/dist/lint/post-synth/helpers.js +102 -0
  51. package/dist/lint/post-synth/index.js +42 -0
  52. package/dist/lint/rules/cpl001-no-secret-literals.js +73 -0
  53. package/dist/lint/rules/cpl002-prefer-resource-reference.js +60 -0
  54. package/dist/lint/rules/index.js +6 -0
  55. package/dist/lsp/completions.d.ts.map +1 -1
  56. package/dist/lsp/completions.js +24 -0
  57. package/dist/lsp/hover.d.ts.map +1 -1
  58. package/dist/lsp/hover.js +106 -0
  59. package/dist/manifest.json +1 -1
  60. package/dist/ownership.js +25 -0
  61. package/dist/package-cli.js +21 -0
  62. package/dist/plugin.js +141 -0
  63. package/dist/reference-catalog.js +99 -0
  64. package/dist/serializer.js +217 -0
  65. package/dist/spec/fetch.d.ts.map +1 -1
  66. package/dist/spec/fetch.js +70 -0
  67. package/dist/spec/parse.js +338 -0
  68. package/dist/spec/snapshot-cli.js +60 -0
  69. package/dist/validate-cli.js +7 -0
  70. package/dist/validate.js +88 -0
  71. package/package.json +7 -7
  72. package/src/codegen/package.ts +2 -2
  73. package/src/lsp/completions.ts +2 -1
  74. package/src/lsp/hover.ts +2 -1
  75. package/src/spec/fetch.ts +2 -2
package/dist/detect.js ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Detect whether a template is a Control Plane manifest.
3
+ *
4
+ * cpln manifests are structurally light — `kind`, `name`, and usually `spec` —
5
+ * which is not a lot to go on, and `kind`/`name`/`spec` alone would also match a
6
+ * Kubernetes manifest. The discriminator is that a cpln manifest's `kind` is one
7
+ * of a small closed set of lowercase strings and it has **no `apiVersion`**,
8
+ * which every Kubernetes object has and no cpln manifest does.
9
+ */
10
+ import { KIND_NAMES } from "./kinds.js";
11
+ const KINDS = new Set(KIND_NAMES);
12
+ /**
13
+ * Every kind `cpln apply` accepts, not only the ones this lexicon models — a
14
+ * file of `group` and `serviceaccount` documents is still recognisably a
15
+ * Control Plane manifest, and answering "no" to it would be wrong.
16
+ */
17
+ const ALL_CPLN_KINDS = new Set([
18
+ ...KIND_NAMES,
19
+ "agent",
20
+ "auditctx",
21
+ "cloudaccount",
22
+ "group",
23
+ "image",
24
+ "location",
25
+ "mk8s",
26
+ "org",
27
+ "quota",
28
+ "serviceaccount",
29
+ "user",
30
+ ]);
31
+ /** True when `data` is a cpln manifest document, or a list of them. */
32
+ export function detectCplnTemplate(data) {
33
+ if (Array.isArray(data)) {
34
+ return data.length > 0 && data.every((doc) => detectCplnTemplate(doc));
35
+ }
36
+ if (!data || typeof data !== "object")
37
+ return false;
38
+ const doc = data;
39
+ // A Kubernetes object. Same three keys, different platform.
40
+ if (typeof doc.apiVersion === "string")
41
+ return false;
42
+ const kind = doc.kind;
43
+ if (typeof kind !== "string" || !ALL_CPLN_KINDS.has(kind))
44
+ return false;
45
+ // `name` is the one field every cpln manifest carries. A bare `{ kind }` is
46
+ // more likely a fragment than a manifest.
47
+ return typeof doc.name === "string";
48
+ }
49
+ /** True when the document is a kind this lexicon can generate types for. */
50
+ export function isModelledKind(kind) {
51
+ return KINDS.has(kind);
52
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Read an entity's authored props regardless of representation, and walk the
3
+ * shapes cpln's checks keep needing.
4
+ *
5
+ * Real runtime instances (`createResource`/`createProperty`) keep authored
6
+ * props under a non-enumerable `.props` — enumerating the instance yields its
7
+ * `AttrRef`s, not its inputs. Plain objects (test fixtures, parsed manifests)
8
+ * carry props as own fields. Every cpln consumer goes through here so both
9
+ * shapes behave identically.
10
+ *
11
+ * A cpln spec is also nested property declarables all the way down: a
12
+ * `Workload`'s `spec.containers[0].readinessProbe` may be a plain object, a
13
+ * `WorkloadSpecContainersReadinessProbe` instance, or a mix, depending on how
14
+ * the author wrote it. {@link readProp} unwraps at every level so a check can
15
+ * be written against one shape.
16
+ */
17
+ /** Reserved instance fields core installs; never authored props. */
18
+ const RESERVED = new Set(["entityType", "lexicon", "kind", "attributes", "props", "Ref"]);
19
+ /** Read an entity's or property declarable's authored props. */
20
+ export function propsOf(entity) {
21
+ if (!entity || typeof entity !== "object")
22
+ return {};
23
+ const anyEntity = entity;
24
+ if (anyEntity.props && typeof anyEntity.props === "object" && !Array.isArray(anyEntity.props)) {
25
+ return anyEntity.props;
26
+ }
27
+ const out = {};
28
+ for (const [key, value] of Object.entries(anyEntity)) {
29
+ if (RESERVED.has(key))
30
+ continue;
31
+ out[key] = value;
32
+ }
33
+ return out;
34
+ }
35
+ /** Read a named property, unwrapping a nested property declarable. */
36
+ export function readProp(source, key) {
37
+ const props = propsOf(source);
38
+ const value = props[key];
39
+ return wrapsProps(value) ? propsOf(value) : value;
40
+ }
41
+ /** Read a nested path, unwrapping declarables at each step. `readPath(w, "spec", "job")`. */
42
+ export function readPath(source, ...keys) {
43
+ let current = source;
44
+ for (const key of keys) {
45
+ if (current === undefined || current === null)
46
+ return undefined;
47
+ current = readProp(current, key);
48
+ }
49
+ return current;
50
+ }
51
+ /** Read a property expected to be an array, unwrapping each element. */
52
+ export function readArray(source, ...keys) {
53
+ const value = readPath(source, ...keys);
54
+ if (!Array.isArray(value))
55
+ return [];
56
+ return value.map((item) => (wrapsProps(item) ? propsOf(item) : item));
57
+ }
58
+ /** Read a property expected to be a string. */
59
+ export function readString(source, ...keys) {
60
+ const value = readPath(source, ...keys);
61
+ return typeof value === "string" ? value : undefined;
62
+ }
63
+ /** Read a property expected to be a number. */
64
+ export function readNumber(source, ...keys) {
65
+ const value = readPath(source, ...keys);
66
+ return typeof value === "number" ? value : undefined;
67
+ }
68
+ /** Read a property expected to be a boolean. */
69
+ export function readBoolean(source, ...keys) {
70
+ const value = readPath(source, ...keys);
71
+ return typeof value === "boolean" ? value : undefined;
72
+ }
73
+ /**
74
+ * A value that carries authored props under `.props`.
75
+ *
76
+ * chant#2444 — deliberately NOT `isDeclarable`, and deliberately not named as
77
+ * though it were. This answers "does this wrap props that should be unwrapped",
78
+ * which is a different question from "is this an entity", and it has to match
79
+ * markerless objects: swapping it for core's marker test fails 85 of this
80
+ * lexicon's tests, because cpln's nested property shapes carry `.props` without
81
+ * carrying an entity marker.
82
+ *
83
+ * The old name invited exactly that swap. It is one of three readings of
84
+ * "declarable" chant#2444 found in the tree, and the only one that was never a
85
+ * divergent copy of the entity test — the other, in `forgejo/src/dialect.ts`,
86
+ * was and is now core's.
87
+ */
88
+ function wrapsProps(value) {
89
+ return (!!value &&
90
+ typeof value === "object" &&
91
+ !Array.isArray(value) &&
92
+ typeof value.props === "object");
93
+ }
94
+ /** Iterate the entities of one cpln kind, yielding `[name, entity]`. */
95
+ export function* entitiesOfType(entities, typeName) {
96
+ for (const [name, entity] of entities) {
97
+ if (entity.entityType === typeName)
98
+ yield [name, entity];
99
+ }
100
+ }
@@ -0,0 +1,169 @@
1
+ // Code generated by chant generate. DO NOT EDIT.
2
+ import { createResource, createProperty } from "./runtime.js";
3
+ export const Domain = /* @__PURE__ */ createResource("Cpln::Core::Domain", "cpln", { "id": "id", "version": "version", "created": "created", "lastModified": "lastModified", "links": "links", "status": "status" });
4
+ export const Gvc = /* @__PURE__ */ createResource("Cpln::Core::Gvc", "cpln", { "id": "id", "version": "version", "created": "created", "lastModified": "lastModified", "links": "links", "alias": "alias", "status": "status" });
5
+ export const Identity = /* @__PURE__ */ createResource("Cpln::Core::Identity", "cpln", { "id": "id", "version": "version", "created": "created", "lastModified": "lastModified", "links": "links", "status": "status" });
6
+ export const IpSet = /* @__PURE__ */ createResource("Cpln::Core::IpSet", "cpln", { "id": "id", "version": "version", "created": "created", "lastModified": "lastModified", "links": "links", "status": "status" });
7
+ export const Policy = /* @__PURE__ */ createResource("Cpln::Core::Policy", "cpln", { "id": "id", "version": "version", "created": "created", "lastModified": "lastModified", "links": "links" });
8
+ export const Secret = /* @__PURE__ */ createResource("Cpln::Core::Secret", "cpln", { "id": "id", "version": "version", "created": "created", "lastModified": "lastModified", "links": "links" });
9
+ export const VolumeSet = /* @__PURE__ */ createResource("Cpln::Core::VolumeSet", "cpln", { "id": "id", "version": "version", "created": "created", "lastModified": "lastModified", "links": "links", "status": "status" });
10
+ export const Workload = /* @__PURE__ */ createResource("Cpln::Core::Workload", "cpln", { "id": "id", "version": "version", "created": "created", "lastModified": "lastModified", "links": "links", "health": "health", "status": "status" });
11
+ export const DomainSpec = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpec", "cpln");
12
+ export const DomainSpecPorts = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPorts", "cpln");
13
+ export const DomainSpecPortsCors = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsCors", "cpln");
14
+ export const DomainSpecPortsCorsAllowOrigins = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsCorsAllowOrigins", "cpln");
15
+ export const DomainSpecPortsRoutes = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsRoutes", "cpln");
16
+ export const DomainSpecPortsRoutesCanaries = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsRoutesCanaries", "cpln");
17
+ export const DomainSpecPortsRoutesHeaders = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsRoutesHeaders", "cpln");
18
+ export const DomainSpecPortsRoutesHeadersRequest = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsRoutesHeadersRequest", "cpln");
19
+ export const DomainSpecPortsRoutesMirror = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsRoutesMirror", "cpln");
20
+ export const DomainSpecPortsTls = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsTls", "cpln");
21
+ export const DomainSpecPortsTlsClientCertificate = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsTlsClientCertificate", "cpln");
22
+ export const DomainSpecPortsTlsServerCertificate = /* @__PURE__ */ createProperty("Cpln::Core::DomainSpecPortsTlsServerCertificate", "cpln");
23
+ export const GvcSpec = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpec", "cpln");
24
+ export const GvcSpecEnv = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecEnv", "cpln");
25
+ export const GvcSpecKeda = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecKeda", "cpln");
26
+ export const GvcSpecLoadBalancer = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecLoadBalancer", "cpln");
27
+ export const GvcSpecLoadBalancerMultiZone = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecLoadBalancerMultiZone", "cpln");
28
+ export const GvcSpecLoadBalancerRedirect = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecLoadBalancerRedirect", "cpln");
29
+ export const GvcSpecLoadBalancerRedirectClass = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecLoadBalancerRedirectClass", "cpln");
30
+ export const GvcSpecSidecar = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecSidecar", "cpln");
31
+ export const GvcSpecStaticPlacement = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecStaticPlacement", "cpln");
32
+ export const GvcSpecStaticPlacementLocationOptions = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecStaticPlacementLocationOptions", "cpln");
33
+ export const GvcSpecStaticPlacementLocationQuery = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecStaticPlacementLocationQuery", "cpln");
34
+ export const GvcSpecStaticPlacementLocationQuerySpec = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecStaticPlacementLocationQuerySpec", "cpln");
35
+ export const GvcSpecStaticPlacementLocationQuerySpecSort = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecStaticPlacementLocationQuerySpecSort", "cpln");
36
+ export const GvcSpecStaticPlacementLocationQuerySpecTerms = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecStaticPlacementLocationQuerySpecTerms", "cpln");
37
+ export const GvcSpecTracing = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecTracing", "cpln");
38
+ export const GvcSpecTracingLightstep = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecTracingLightstep", "cpln");
39
+ export const GvcSpecTracingProvider = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecTracingProvider", "cpln");
40
+ export const GvcSpecTracingProviderLightstep = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecTracingProviderLightstep", "cpln");
41
+ export const GvcSpecTracingProviderOtel = /* @__PURE__ */ createProperty("Cpln::Core::GvcSpecTracingProviderOtel", "cpln");
42
+ export const IdentityAws = /* @__PURE__ */ createProperty("Cpln::Core::IdentityAws", "cpln");
43
+ export const IdentityAwsTrustPolicy = /* @__PURE__ */ createProperty("Cpln::Core::IdentityAwsTrustPolicy", "cpln");
44
+ export const IdentityAzure = /* @__PURE__ */ createProperty("Cpln::Core::IdentityAzure", "cpln");
45
+ export const IdentityAzureRoleAssignments = /* @__PURE__ */ createProperty("Cpln::Core::IdentityAzureRoleAssignments", "cpln");
46
+ export const IdentityGcp = /* @__PURE__ */ createProperty("Cpln::Core::IdentityGcp", "cpln");
47
+ export const IdentityGcpBindings = /* @__PURE__ */ createProperty("Cpln::Core::IdentityGcpBindings", "cpln");
48
+ export const IdentityMemcacheAccess = /* @__PURE__ */ createProperty("Cpln::Core::IdentityMemcacheAccess", "cpln");
49
+ export const IdentityNativeNetworkResources = /* @__PURE__ */ createProperty("Cpln::Core::IdentityNativeNetworkResources", "cpln");
50
+ export const IdentityNativeNetworkResourcesAwsPrivateLink = /* @__PURE__ */ createProperty("Cpln::Core::IdentityNativeNetworkResourcesAwsPrivateLink", "cpln");
51
+ export const IdentityNativeNetworkResourcesGcpServiceConnect = /* @__PURE__ */ createProperty("Cpln::Core::IdentityNativeNetworkResourcesGcpServiceConnect", "cpln");
52
+ export const IdentityNgs = /* @__PURE__ */ createProperty("Cpln::Core::IdentityNgs", "cpln");
53
+ export const IdentityNgsPub = /* @__PURE__ */ createProperty("Cpln::Core::IdentityNgsPub", "cpln");
54
+ export const IdentityNgsResp = /* @__PURE__ */ createProperty("Cpln::Core::IdentityNgsResp", "cpln");
55
+ export const IdentityNgsSub = /* @__PURE__ */ createProperty("Cpln::Core::IdentityNgsSub", "cpln");
56
+ export const IdentitySpicedbAccess = /* @__PURE__ */ createProperty("Cpln::Core::IdentitySpicedbAccess", "cpln");
57
+ export const IpSetLocation = /* @__PURE__ */ createProperty("Cpln::Core::IpSetLocation", "cpln");
58
+ export const IpSetSpec = /* @__PURE__ */ createProperty("Cpln::Core::IpSetSpec", "cpln");
59
+ export const NetworkResource = /* @__PURE__ */ createProperty("Cpln::Core::NetworkResource", "cpln");
60
+ export const PolicyBinding = /* @__PURE__ */ createProperty("Cpln::Core::PolicyBinding", "cpln");
61
+ export const Query = /* @__PURE__ */ createProperty("Cpln::Core::Query", "cpln");
62
+ export const QuerySpec = /* @__PURE__ */ createProperty("Cpln::Core::QuerySpec", "cpln");
63
+ export const QuerySpecSort = /* @__PURE__ */ createProperty("Cpln::Core::QuerySpecSort", "cpln");
64
+ export const QuerySpecTerms = /* @__PURE__ */ createProperty("Cpln::Core::QuerySpecTerms", "cpln");
65
+ export const SecretAwskey = /* @__PURE__ */ createProperty("Cpln::Core::SecretAwskey", "cpln");
66
+ export const SecretKeypair = /* @__PURE__ */ createProperty("Cpln::Core::SecretKeypair", "cpln");
67
+ export const SecretOpaque = /* @__PURE__ */ createProperty("Cpln::Core::SecretOpaque", "cpln");
68
+ export const SecretTls = /* @__PURE__ */ createProperty("Cpln::Core::SecretTls", "cpln");
69
+ export const SecretUserpass = /* @__PURE__ */ createProperty("Cpln::Core::SecretUserpass", "cpln");
70
+ export const VolumeSetSpec = /* @__PURE__ */ createProperty("Cpln::Core::VolumeSetSpec", "cpln");
71
+ export const VolumeSetSpecAutoscaling = /* @__PURE__ */ createProperty("Cpln::Core::VolumeSetSpecAutoscaling", "cpln");
72
+ export const VolumeSetSpecAutoscalingPredictive = /* @__PURE__ */ createProperty("Cpln::Core::VolumeSetSpecAutoscalingPredictive", "cpln");
73
+ export const VolumeSetSpecCustomEncryption = /* @__PURE__ */ createProperty("Cpln::Core::VolumeSetSpecCustomEncryption", "cpln");
74
+ export const VolumeSetSpecMountOptions = /* @__PURE__ */ createProperty("Cpln::Core::VolumeSetSpecMountOptions", "cpln");
75
+ export const VolumeSetSpecMountOptionsResources = /* @__PURE__ */ createProperty("Cpln::Core::VolumeSetSpecMountOptionsResources", "cpln");
76
+ export const VolumeSetSpecSnapshots = /* @__PURE__ */ createProperty("Cpln::Core::VolumeSetSpecSnapshots", "cpln");
77
+ export const WorkloadSpec = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpec", "cpln");
78
+ export const WorkloadSpecContainers = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainers", "cpln");
79
+ export const WorkloadSpecContainersEnv = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersEnv", "cpln");
80
+ export const WorkloadSpecContainersGpu = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersGpu", "cpln");
81
+ export const WorkloadSpecContainersGpuCustom = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersGpuCustom", "cpln");
82
+ export const WorkloadSpecContainersGpuNvidia = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersGpuNvidia", "cpln");
83
+ export const WorkloadSpecContainersLifecycle = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLifecycle", "cpln");
84
+ export const WorkloadSpecContainersLifecyclePostStart = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLifecyclePostStart", "cpln");
85
+ export const WorkloadSpecContainersLifecyclePostStartExec = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLifecyclePostStartExec", "cpln");
86
+ export const WorkloadSpecContainersLifecyclePreStop = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLifecyclePreStop", "cpln");
87
+ export const WorkloadSpecContainersLifecyclePreStopExec = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLifecyclePreStopExec", "cpln");
88
+ export const WorkloadSpecContainersLivenessProbe = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLivenessProbe", "cpln");
89
+ export const WorkloadSpecContainersLivenessProbeExec = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLivenessProbeExec", "cpln");
90
+ export const WorkloadSpecContainersLivenessProbeGrpc = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLivenessProbeGrpc", "cpln");
91
+ export const WorkloadSpecContainersLivenessProbeHttpGet = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLivenessProbeHttpGet", "cpln");
92
+ export const WorkloadSpecContainersLivenessProbeHttpGetHttpHeaders = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLivenessProbeHttpGetHttpHeaders", "cpln");
93
+ export const WorkloadSpecContainersLivenessProbeTcpSocket = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersLivenessProbeTcpSocket", "cpln");
94
+ export const WorkloadSpecContainersMetrics = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersMetrics", "cpln");
95
+ export const WorkloadSpecContainersPorts = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersPorts", "cpln");
96
+ export const WorkloadSpecContainersReadinessProbe = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersReadinessProbe", "cpln");
97
+ export const WorkloadSpecContainersReadinessProbeExec = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersReadinessProbeExec", "cpln");
98
+ export const WorkloadSpecContainersReadinessProbeGrpc = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersReadinessProbeGrpc", "cpln");
99
+ export const WorkloadSpecContainersReadinessProbeHttpGet = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersReadinessProbeHttpGet", "cpln");
100
+ export const WorkloadSpecContainersReadinessProbeHttpGetHttpHeaders = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersReadinessProbeHttpGetHttpHeaders", "cpln");
101
+ export const WorkloadSpecContainersReadinessProbeTcpSocket = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersReadinessProbeTcpSocket", "cpln");
102
+ export const WorkloadSpecContainersVolumes = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecContainersVolumes", "cpln");
103
+ export const WorkloadSpecDefaultOptions = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptions", "cpln");
104
+ export const WorkloadSpecDefaultOptionsAutoscaling = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscaling", "cpln");
105
+ export const WorkloadSpecDefaultOptionsAutoscalingKeda = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKeda", "cpln");
106
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaAdvanced = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaAdvanced", "cpln");
107
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfig = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfig", "cpln");
108
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehavior = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehavior", "cpln");
109
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleDown = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleDown", "cpln");
110
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleDownPolicies = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleDownPolicies", "cpln");
111
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleUp = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleUp", "cpln");
112
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleUpPolicies = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleUpPolicies", "cpln");
113
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedScalingModifiers = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaAdvancedScalingModifiers", "cpln");
114
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaFallback = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaFallback", "cpln");
115
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaTriggers = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaTriggers", "cpln");
116
+ export const WorkloadSpecDefaultOptionsAutoscalingKedaTriggersAuthenticationRef = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingKedaTriggersAuthenticationRef", "cpln");
117
+ export const WorkloadSpecDefaultOptionsAutoscalingMulti = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsAutoscalingMulti", "cpln");
118
+ export const WorkloadSpecDefaultOptionsMultiZone = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecDefaultOptionsMultiZone", "cpln");
119
+ export const WorkloadSpecExtras = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecExtras", "cpln");
120
+ export const WorkloadSpecExtrasMetadata = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecExtrasMetadata", "cpln");
121
+ export const WorkloadSpecFirewallConfig = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecFirewallConfig", "cpln");
122
+ export const WorkloadSpecFirewallConfigExternal = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecFirewallConfigExternal", "cpln");
123
+ export const WorkloadSpecFirewallConfigExternalHttp = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecFirewallConfigExternalHttp", "cpln");
124
+ export const WorkloadSpecFirewallConfigExternalHttpInboundHeaderFilter = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecFirewallConfigExternalHttpInboundHeaderFilter", "cpln");
125
+ export const WorkloadSpecFirewallConfigExternalOutboundAllowPort = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecFirewallConfigExternalOutboundAllowPort", "cpln");
126
+ export const WorkloadSpecFirewallConfigInternal = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecFirewallConfigInternal", "cpln");
127
+ export const WorkloadSpecJob = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecJob", "cpln");
128
+ export const WorkloadSpecLoadBalancer = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLoadBalancer", "cpln");
129
+ export const WorkloadSpecLoadBalancerDirect = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLoadBalancerDirect", "cpln");
130
+ export const WorkloadSpecLoadBalancerDirectPorts = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLoadBalancerDirectPorts", "cpln");
131
+ export const WorkloadSpecLoadBalancerGeoLocation = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLoadBalancerGeoLocation", "cpln");
132
+ export const WorkloadSpecLoadBalancerGeoLocationHeaders = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLoadBalancerGeoLocationHeaders", "cpln");
133
+ export const WorkloadSpecLocalOptions = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptions", "cpln");
134
+ export const WorkloadSpecLocalOptionsAutoscaling = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscaling", "cpln");
135
+ export const WorkloadSpecLocalOptionsAutoscalingKeda = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKeda", "cpln");
136
+ export const WorkloadSpecLocalOptionsAutoscalingKedaAdvanced = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaAdvanced", "cpln");
137
+ export const WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfig = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfig", "cpln");
138
+ export const WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehavior = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehavior", "cpln");
139
+ export const WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleDown = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleDown", "cpln");
140
+ export const WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleDownPolicies = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleDownPolicies", "cpln");
141
+ export const WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleUp = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleUp", "cpln");
142
+ export const WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleUpPolicies = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaAdvancedHorizontalPodAutoscalerConfigBehaviorScaleUpPolicies", "cpln");
143
+ export const WorkloadSpecLocalOptionsAutoscalingKedaAdvancedScalingModifiers = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaAdvancedScalingModifiers", "cpln");
144
+ export const WorkloadSpecLocalOptionsAutoscalingKedaFallback = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaFallback", "cpln");
145
+ export const WorkloadSpecLocalOptionsAutoscalingKedaTriggers = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaTriggers", "cpln");
146
+ export const WorkloadSpecLocalOptionsAutoscalingKedaTriggersAuthenticationRef = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingKedaTriggersAuthenticationRef", "cpln");
147
+ export const WorkloadSpecLocalOptionsAutoscalingMulti = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsAutoscalingMulti", "cpln");
148
+ export const WorkloadSpecLocalOptionsMultiZone = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecLocalOptionsMultiZone", "cpln");
149
+ export const WorkloadSpecNetworking = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecNetworking", "cpln");
150
+ export const WorkloadSpecRequestRetryPolicy = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecRequestRetryPolicy", "cpln");
151
+ export const WorkloadSpecRolloutOptions = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecRolloutOptions", "cpln");
152
+ export const WorkloadSpecSandbox = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecSandbox", "cpln");
153
+ export const WorkloadSpecSandboxVolume = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecSandboxVolume", "cpln");
154
+ export const WorkloadSpecSecurityOptions = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecSecurityOptions", "cpln");
155
+ export const WorkloadSpecSidecar = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecSidecar", "cpln");
156
+ export const WorkloadSpecVm = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVm", "cpln");
157
+ export const WorkloadSpecVmAccessCredentials = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmAccessCredentials", "cpln");
158
+ export const WorkloadSpecVmBootDisk = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmBootDisk", "cpln");
159
+ export const WorkloadSpecVmBootDiskPersist = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmBootDiskPersist", "cpln");
160
+ export const WorkloadSpecVmBootDiskSource = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmBootDiskSource", "cpln");
161
+ export const WorkloadSpecVmBootDiskSourceHttp = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmBootDiskSourceHttp", "cpln");
162
+ export const WorkloadSpecVmBootDiskSourceOci = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmBootDiskSourceOci", "cpln");
163
+ export const WorkloadSpecVmClock = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmClock", "cpln");
164
+ export const WorkloadSpecVmCloudInit = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmCloudInit", "cpln");
165
+ export const WorkloadSpecVmCpu = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmCpu", "cpln");
166
+ export const WorkloadSpecVmFirmware = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmFirmware", "cpln");
167
+ export const WorkloadSpecVmFirmwareSmbios = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmFirmwareSmbios", "cpln");
168
+ export const WorkloadSpecVmNetworks = /* @__PURE__ */ createProperty("Cpln::Core::WorkloadSpecVmNetworks", "cpln");
169
+ // Re-exports for convenience
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Runtime factory constructors — re-exported from core.
3
+ */
4
+ export { createResource, createProperty } from "@intentius/chant/runtime";
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ // Plugin
2
+ export { cplnPlugin } from "./plugin.js";
3
+ // Serializer
4
+ export { cplnSerializer, cplnLink } from "./serializer.js";
5
+ // The modelled kinds and the link/path helpers built on them. Useful to
6
+ // consumers writing their own tooling against a chant-declared cpln estate.
7
+ export { KINDS, KIND_NAMES, kindByName, kindByTypeName, kindByClassName, isCplnResourceType, collectionPath, resourcePath, NAMESPACE, SERVICE, } from "./kinds.js";
8
+ // Ownership marker convention (cpln `tags` keys).
9
+ export { CPLN_TAG_OWNERSHIP_KEYS } from "./ownership.js";
10
+ // Composites — opinionated bundles over the generated resources.
11
+ export * from "./composites/index.js";
12
+ // Generated resources — `Gvc`, `Workload`, `Identity`, `VolumeSet`, `Secret`,
13
+ // `Policy`, `Domain`, `IpSet` and the property types their specs reach.
14
+ export * from "./generated/index.js";
@@ -0,0 +1,125 @@
1
+ /**
2
+ * `chant init` scaffolding for cpln projects.
3
+ *
4
+ * Three templates, chosen so the default is the shape most people actually
5
+ * start with and the other two are the two directions it grows in. Each is
6
+ * written to pass this lexicon's own checks as scaffolded — a template that
7
+ * emits CPL findings on first build teaches the wrong lesson about what the
8
+ * findings mean.
9
+ */
10
+ const DEFAULT = `import { GvcEnvironment, ServerlessService } from "@intentius/chant-lexicon-cpln";
11
+
12
+ // A GVC and one public serverless service.
13
+ //
14
+ // Placement lives on the GVC, not the workload — locationLinks is what decides
15
+ // where anything in this environment runs. Set CPLN_ORG to your org name.
16
+ const org = process.env.CPLN_ORG ?? "my-org";
17
+
18
+ export const { gvc } = GvcEnvironment({
19
+ name: "prod",
20
+ org,
21
+ locations: ["aws-us-east-1"],
22
+ });
23
+
24
+ // Serverless requires exactly one HTTP port, and the external firewall starts
25
+ // closed in both directions — so a public service says so explicitly. Egress is
26
+ // left closed; open it to the hosts this actually calls.
27
+ export const { workload } = ServerlessService({
28
+ name: "web",
29
+ gvc: "prod",
30
+ image: "nginx:1.27",
31
+ port: 8080,
32
+ inboundAllowCidr: ["0.0.0.0/0"],
33
+ });
34
+ `;
35
+ const WITH_SECRETS = `import {
36
+ GvcEnvironment,
37
+ ServerlessService,
38
+ SecretAccess,
39
+ Secret,
40
+ secretRef,
41
+ } from "@intentius/chant-lexicon-cpln";
42
+
43
+ // A service that reads a secret at runtime.
44
+ //
45
+ // Reading a secret takes three things, and missing any one fails *silently* at
46
+ // runtime rather than at apply: an identity on the workload, a policy granting
47
+ // that identity \`reveal\`, and a field-qualified reference. SecretAccess owns
48
+ // the first two; secretRef() is the third.
49
+ const org = process.env.CPLN_ORG ?? "my-org";
50
+
51
+ export const { gvc } = GvcEnvironment({
52
+ name: "prod",
53
+ org,
54
+ locations: ["aws-us-east-1"],
55
+ });
56
+
57
+ // The value is a placeholder. Set the real one with \`cpln secret edit\`, or
58
+ // point this at a value read from the environment at build time — never a
59
+ // literal in source (CPL001).
60
+ export const dbPassword = new Secret({
61
+ name: "db-password",
62
+ type: "opaque",
63
+ data: { payload: process.env.DB_PASSWORD ?? "changeme", encoding: "plain" },
64
+ });
65
+
66
+ export const { identity, policy } = SecretAccess({
67
+ name: "web-identity",
68
+ gvc: "prod",
69
+ secrets: ["db-password"],
70
+ });
71
+
72
+ export const { workload } = ServerlessService({
73
+ name: "web",
74
+ gvc: "prod",
75
+ image: "nginx:1.27",
76
+ port: 8080,
77
+ inboundAllowCidr: ["0.0.0.0/0"],
78
+ identityLink: "//gvc/prod/identity/web-identity",
79
+ env: {
80
+ DATABASE_PASSWORD: secretRef("db-password", "payload"),
81
+ },
82
+ });
83
+ `;
84
+ const STATEFUL = `import { GvcEnvironment, StatefulService } from "@intentius/chant-lexicon-cpln";
85
+
86
+ // A stateful service with persistent storage.
87
+ //
88
+ // Both fileSystemType and performanceClass are immutable — changing either
89
+ // later means delete, recreate, and data loss — so they are worth settling
90
+ // before the first apply. ext4 binds to exactly one stateful workload; use
91
+ // "shared" if several workloads need the same volume.
92
+ const org = process.env.CPLN_ORG ?? "my-org";
93
+
94
+ export const { gvc } = GvcEnvironment({
95
+ name: "prod",
96
+ org,
97
+ locations: ["aws-us-east-1"],
98
+ });
99
+
100
+ export const { workload, volumeSet } = StatefulService({
101
+ name: "db",
102
+ gvc: "prod",
103
+ image: "postgres:17",
104
+ mountPath: "/var/lib/postgresql/data",
105
+ capacityGb: 20,
106
+ fileSystemType: "ext4",
107
+ performanceClass: "general-purpose-ssd",
108
+ ports: [{ number: 5432, protocol: "tcp" }],
109
+ env: { POSTGRES_DB: "app" },
110
+ });
111
+ `;
112
+ /**
113
+ * Return the scaffold for a template name. Unknown names fall back to the
114
+ * default rather than erroring — `chant init` treats the name as a hint.
115
+ */
116
+ export function cplnInitTemplates(template) {
117
+ switch (template) {
118
+ case "secrets":
119
+ return { src: { "infra.ts": WITH_SECRETS } };
120
+ case "stateful":
121
+ return { src: { "infra.ts": STATEFUL } };
122
+ default:
123
+ return { src: { "infra.ts": DEFAULT } };
124
+ }
125
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "5c4d30348a558b762acffa81f2a974cccc68b9dfa1ea23df67156ca32d5204cc",
4
+ "manifest.json": "d73b66bc6b722baf3d22e5d024a01452b09b9cf82ad9e15a26adf158a03a68ec",
5
5
  "meta.json": "b6a66263e39a7f7664cdc0eb2966c5ae6876113cbf8e842925670a3de330c71a",
6
6
  "types/index.d.ts": "5ae9a3a7320d9c42006af9881a07768e0838a1b5124f4aafc32acdea16d6dc05",
7
7
  "rules/cpl001-no-secret-literals.ts": "d7895ebd78b3604d765370e6aa983a5c1a5b9e10d89349685a54b8f5b0a990db",
@@ -31,5 +31,5 @@
31
31
  "skills/chant-cpln-workloads.md": "8353909ff18f244f4d4389e74b8d95b04359e97a46ddacb18d669d41d62b6080",
32
32
  "skills/chant-cpln-secrets.md": "8628c2286a7e8e14aa78224fe22ff266dc54b996f4fdb64002fa433213de13a0"
33
33
  },
34
- "composite": "2428eb50add9921506492179883e59d91bf962fb84f8b03fefa877496b1a7d7b"
34
+ "composite": "b6e14820ea1f3de2735a7582f3e6d3ea5627a80849a7cbf3b1b4b5e177d6e47f"
35
35
  }
package/dist/kinds.js ADDED
@@ -0,0 +1,134 @@
1
+ /**
2
+ * The Control Plane kinds this lexicon models, and the facts about each that
3
+ * more than one subsystem needs.
4
+ *
5
+ * Codegen, the serializer, observation, the LSP providers, the MCP catalog and
6
+ * the docs generator all need to agree on the same three things: which schema
7
+ * in the OpenAPI document backs a kind, what its chant type name is, and
8
+ * whether it is scoped to a GVC. Each of those was, in an earlier draft, a
9
+ * literal repeated in five files — so a kind added in one place quietly went
10
+ * missing from the others. This table is the single place a kind is declared.
11
+ *
12
+ * Coverage is deliberately the *workload* surface rather than every kind the
13
+ * API exposes. The org-administration kinds (`group`, `serviceaccount`,
14
+ * `cloudaccount`, `auditctx`, `user`, `agent`) and `mk8s` are all modellable
15
+ * from the same spec by adding rows here; they are out of the first pass, not
16
+ * out of reach. `chant cpln coverage` reports the gap rather than hiding it.
17
+ */
18
+ /** The chant namespace segment for every generated cpln type. */
19
+ export const NAMESPACE = "Cpln";
20
+ /** The single service segment. The Control Plane Core API is one service. */
21
+ export const SERVICE = "Core";
22
+ export const KINDS = [
23
+ {
24
+ kind: "gvc",
25
+ schema: "gvc",
26
+ typeName: `${NAMESPACE}::${SERVICE}::Gvc`,
27
+ className: "Gvc",
28
+ gvcScoped: false,
29
+ summary: "Global Virtual Cloud — the placement and networking boundary every workload, identity and volume set belongs to.",
30
+ },
31
+ {
32
+ kind: "workload",
33
+ schema: "workload",
34
+ typeName: `${NAMESPACE}::${SERVICE}::Workload`,
35
+ className: "Workload",
36
+ gvcScoped: true,
37
+ summary: "A running unit of work — serverless, standard, cron, stateful or vm — with its containers, firewall and autoscaling.",
38
+ },
39
+ {
40
+ kind: "identity",
41
+ schema: "identity",
42
+ typeName: `${NAMESPACE}::${SERVICE}::Identity`,
43
+ className: "Identity",
44
+ gvcScoped: true,
45
+ summary: "A workload's identity, carrying its cloud-provider access (AWS/GCP/Azure) and network resource grants.",
46
+ },
47
+ {
48
+ kind: "volumeset",
49
+ schema: "volumeset",
50
+ typeName: `${NAMESPACE}::${SERVICE}::VolumeSet`,
51
+ className: "VolumeSet",
52
+ gvcScoped: true,
53
+ summary: "Persistent storage attached to stateful workloads, with its performance class and snapshot policy.",
54
+ },
55
+ {
56
+ kind: "secret",
57
+ schema: "secret",
58
+ typeName: `${NAMESPACE}::${SERVICE}::Secret`,
59
+ className: "Secret",
60
+ gvcScoped: false,
61
+ summary: "An org-scoped secret — opaque, TLS, keypair, dictionary, or a cloud-provider credential.",
62
+ },
63
+ {
64
+ kind: "policy",
65
+ schema: "policy",
66
+ typeName: `${NAMESPACE}::${SERVICE}::Policy`,
67
+ className: "Policy",
68
+ gvcScoped: false,
69
+ summary: "An access policy binding permissions to principals over a target kind, link set, or query.",
70
+ },
71
+ {
72
+ kind: "domain",
73
+ schema: "domain",
74
+ typeName: `${NAMESPACE}::${SERVICE}::Domain`,
75
+ className: "Domain",
76
+ gvcScoped: false,
77
+ summary: "A custom domain with its TLS, CORS and per-port routing to workloads.",
78
+ },
79
+ {
80
+ kind: "ipset",
81
+ schema: "ipset",
82
+ typeName: `${NAMESPACE}::${SERVICE}::IpSet`,
83
+ className: "IpSet",
84
+ gvcScoped: false,
85
+ summary: "A set of dedicated IP addresses reserved in named locations and bound to a workload.",
86
+ },
87
+ ];
88
+ /** Every modelled kind string, in declaration order. */
89
+ export const KIND_NAMES = KINDS.map((k) => k.kind);
90
+ const BY_KIND = new Map(KINDS.map((k) => [k.kind, k]));
91
+ const BY_TYPE_NAME = new Map(KINDS.map((k) => [k.typeName, k]));
92
+ const BY_CLASS_NAME = new Map(KINDS.map((k) => [k.className, k]));
93
+ /** Look up a kind by its `kind` discriminator (`"workload"`). */
94
+ export function kindByName(kind) {
95
+ return BY_KIND.get(kind);
96
+ }
97
+ /** Look up a kind by chant type name (`"Cpln::Core::Workload"`). */
98
+ export function kindByTypeName(typeName) {
99
+ return BY_TYPE_NAME.get(typeName);
100
+ }
101
+ /** Look up a kind by generated class name (`"Workload"`). */
102
+ export function kindByClassName(className) {
103
+ return BY_CLASS_NAME.get(className);
104
+ }
105
+ /** Whether a chant type name belongs to a modelled cpln resource (not a property type). */
106
+ export function isCplnResourceType(typeName) {
107
+ return BY_TYPE_NAME.has(typeName);
108
+ }
109
+ /**
110
+ * The REST collection path for a kind, relative to the API root.
111
+ *
112
+ * GVC-scoped kinds have two: the writable collection nested under their GVC,
113
+ * and an org-wide read-only rollup. Observation uses the rollup (one request
114
+ * per kind instead of one per GVC); apply uses the nested one.
115
+ */
116
+ export function collectionPath(kind, org, gvc) {
117
+ if (kind.gvcScoped && gvc)
118
+ return `/org/${org}/gvc/${gvc}/${kind.kind}`;
119
+ return `/org/${org}/${kind.kind}`;
120
+ }
121
+ /** The path of a single named resource. */
122
+ export function resourcePath(kind, org, name, gvc) {
123
+ return `${collectionPath(kind, org, gvc)}/${name}`;
124
+ }
125
+ /** Extract the short name from a chant type name: `Cpln::Core::Workload` → `Workload`. */
126
+ export function cplnShortName(typeName) {
127
+ const parts = typeName.split("::");
128
+ return parts[parts.length - 1];
129
+ }
130
+ /** Extract the service segment: `Cpln::Core::Workload` → `Core`. */
131
+ export function cplnServiceName(typeName) {
132
+ const parts = typeName.split("::");
133
+ return parts.length >= 2 ? parts[1] : SERVICE;
134
+ }