@intentius/chant-lexicon-docker 0.6.0 → 0.8.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 (100) hide show
  1. package/dist/codegen/docs-cli.d.ts +6 -0
  2. package/dist/codegen/docs-cli.d.ts.map +1 -0
  3. package/dist/codegen/docs.d.ts +7 -0
  4. package/dist/codegen/docs.d.ts.map +1 -0
  5. package/dist/codegen/generate-cli.d.ts +6 -0
  6. package/dist/codegen/generate-cli.d.ts.map +1 -0
  7. package/dist/codegen/generate-compose.d.ts +12 -0
  8. package/dist/codegen/generate-compose.d.ts.map +1 -0
  9. package/dist/codegen/generate-dockerfile.d.ts +12 -0
  10. package/dist/codegen/generate-dockerfile.d.ts.map +1 -0
  11. package/dist/codegen/generate.d.ts +30 -0
  12. package/dist/codegen/generate.d.ts.map +1 -0
  13. package/dist/codegen/naming.d.ts +27 -0
  14. package/dist/codegen/naming.d.ts.map +1 -0
  15. package/dist/codegen/package.d.ts +10 -0
  16. package/dist/codegen/package.d.ts.map +1 -0
  17. package/dist/codegen/patches.d.ts +22 -0
  18. package/dist/codegen/patches.d.ts.map +1 -0
  19. package/dist/codegen/versions.d.ts +11 -0
  20. package/dist/codegen/versions.d.ts.map +1 -0
  21. package/dist/composites/index.d.ts +7 -0
  22. package/dist/composites/index.d.ts.map +1 -0
  23. package/dist/coverage.d.ts +15 -0
  24. package/dist/coverage.d.ts.map +1 -0
  25. package/dist/default-labels.d.ts +39 -0
  26. package/dist/default-labels.d.ts.map +1 -0
  27. package/dist/detect.d.ts +3 -0
  28. package/dist/detect.d.ts.map +1 -0
  29. package/dist/generated/index.d.ts +7 -0
  30. package/dist/generated/index.d.ts.map +1 -0
  31. package/dist/generated/runtime.d.ts +5 -0
  32. package/dist/generated/runtime.d.ts.map +1 -0
  33. package/dist/import/adapter.d.ts +29 -0
  34. package/dist/import/adapter.d.ts.map +1 -0
  35. package/dist/import/generator.d.ts +17 -0
  36. package/dist/import/generator.d.ts.map +1 -0
  37. package/dist/import/parser.d.ts +61 -0
  38. package/dist/import/parser.d.ts.map +1 -0
  39. package/dist/index.d.ts +14 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/integrity.json +2 -2
  42. package/dist/interpolation.d.ts +51 -0
  43. package/dist/interpolation.d.ts.map +1 -0
  44. package/dist/lint/post-synth/apt-no-recommends.d.ts +9 -0
  45. package/dist/lint/post-synth/apt-no-recommends.d.ts.map +1 -0
  46. package/dist/lint/post-synth/docker-helpers.d.ts +32 -0
  47. package/dist/lint/post-synth/docker-helpers.d.ts.map +1 -0
  48. package/dist/lint/post-synth/index.d.ts +3 -0
  49. package/dist/lint/post-synth/index.d.ts.map +1 -0
  50. package/dist/lint/post-synth/no-latest-image.d.ts +8 -0
  51. package/dist/lint/post-synth/no-latest-image.d.ts.map +1 -0
  52. package/dist/lint/post-synth/no-root-user.d.ts +9 -0
  53. package/dist/lint/post-synth/no-root-user.d.ts.map +1 -0
  54. package/dist/lint/post-synth/prefer-copy.d.ts +9 -0
  55. package/dist/lint/post-synth/prefer-copy.d.ts.map +1 -0
  56. package/dist/lint/post-synth/ssh-port-exposed.d.ts +9 -0
  57. package/dist/lint/post-synth/ssh-port-exposed.d.ts.map +1 -0
  58. package/dist/lint/post-synth/unused-volume.d.ts +8 -0
  59. package/dist/lint/post-synth/unused-volume.d.ts.map +1 -0
  60. package/dist/lint/rules/data/deprecated-images.d.ts +13 -0
  61. package/dist/lint/rules/data/deprecated-images.d.ts.map +1 -0
  62. package/dist/lint/rules/data/known-base-images.d.ts +9 -0
  63. package/dist/lint/rules/data/known-base-images.d.ts.map +1 -0
  64. package/dist/lint/rules/index.d.ts +5 -0
  65. package/dist/lint/rules/index.d.ts.map +1 -0
  66. package/dist/lint/rules/no-latest-tag.d.ts +10 -0
  67. package/dist/lint/rules/no-latest-tag.d.ts.map +1 -0
  68. package/dist/list-artifacts.d.ts +25 -0
  69. package/dist/list-artifacts.d.ts.map +1 -0
  70. package/dist/lsp/completions.d.ts +6 -0
  71. package/dist/lsp/completions.d.ts.map +1 -0
  72. package/dist/lsp/hover.d.ts +6 -0
  73. package/dist/lsp/hover.d.ts.map +1 -0
  74. package/dist/manifest.json +1 -1
  75. package/dist/package-cli.d.ts +3 -0
  76. package/dist/package-cli.d.ts.map +1 -0
  77. package/dist/plugin.d.ts +9 -0
  78. package/dist/plugin.d.ts.map +1 -0
  79. package/dist/serializer.d.ts +13 -0
  80. package/dist/serializer.d.ts.map +1 -0
  81. package/dist/spec/fetch-compose.d.ts +13 -0
  82. package/dist/spec/fetch-compose.d.ts.map +1 -0
  83. package/dist/spec/fetch-engine.d.ts +9 -0
  84. package/dist/spec/fetch-engine.d.ts.map +1 -0
  85. package/dist/spec/parse-compose.d.ts +27 -0
  86. package/dist/spec/parse-compose.d.ts.map +1 -0
  87. package/dist/spec/parse-engine.d.ts +23 -0
  88. package/dist/spec/parse-engine.d.ts.map +1 -0
  89. package/dist/validate-cli.d.ts +3 -0
  90. package/dist/validate-cli.d.ts.map +1 -0
  91. package/dist/validate.d.ts +12 -0
  92. package/dist/validate.d.ts.map +1 -0
  93. package/dist/variables.d.ts +45 -0
  94. package/dist/variables.d.ts.map +1 -0
  95. package/package.json +24 -5
  96. package/src/detect.ts +7 -0
  97. package/src/import/adapter.ts +87 -0
  98. package/src/lint/post-synth/index.ts +17 -0
  99. package/src/plugin.ts +7 -13
  100. package/src/serializer.ts +1 -1
@@ -0,0 +1,9 @@
1
+ /**
2
+ * DKRD003: SSH Port Exposed
3
+ *
4
+ * Detects services exposing port 22 (SSH) on the host.
5
+ * Exposing SSH externally is a security risk.
6
+ */
7
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
8
+ export declare const dkrd003: PostSynthCheck;
9
+ //# sourceMappingURL=ssh-port-exposed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssh-port-exposed.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/ssh-port-exposed.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAgC9G,eAAO,MAAM,OAAO,EAAE,cA4BrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * DKRD002: Unused Named Volume
3
+ *
4
+ * Detects top-level named volumes that are not mounted by any service.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const dkrd002: PostSynthCheck;
8
+ //# sourceMappingURL=unused-volume.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unused-volume.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/unused-volume.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAuCrB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Known deprecated or EOL Docker base images.
3
+ */
4
+ export declare const DEPRECATED_IMAGES: Array<{
5
+ image: string;
6
+ reason: string;
7
+ replacement?: string;
8
+ }>;
9
+ /**
10
+ * Check if an image reference matches a deprecated entry.
11
+ */
12
+ export declare function findDeprecatedImage(imageRef: string): (typeof DEPRECATED_IMAGES)[number] | undefined;
13
+ //# sourceMappingURL=deprecated-images.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated-images.d.ts","sourceRoot":"","sources":["../../../../src/lint/rules/data/deprecated-images.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAgB5F,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAEpG"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Well-known Docker base images for rule validation.
3
+ */
4
+ export declare const KNOWN_BASE_IMAGES: Set<string>;
5
+ /**
6
+ * Images that are safe to use without a tag (they have meaningful `latest`).
7
+ */
8
+ export declare const IMAGES_SAFE_LATEST: Set<string>;
9
+ //# sourceMappingURL=known-base-images.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"known-base-images.d.ts","sourceRoot":"","sources":["../../../../src/lint/rules/data/known-base-images.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,aAE7B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * All imperative lint rules for the Docker lexicon.
3
+ */
4
+ export { noLatestTagRule } from "./no-latest-tag.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * DKRS001: No Latest Tag
3
+ *
4
+ * Warns when a Service's image prop is set to a literal string
5
+ * ending with `:latest` or has no tag (implies latest).
6
+ * Using `:latest` prevents reproducible builds.
7
+ */
8
+ import type { LintRule } from "@intentius/chant/lint/rule";
9
+ export declare const noLatestTagRule: LintRule;
10
+ //# sourceMappingURL=no-latest-tag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-latest-tag.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/no-latest-tag.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAA+B,MAAM,4BAA4B,CAAC;AAexF,eAAO,MAAM,eAAe,EAAE,QAuC7B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Live introspection of a Docker host via three independent CLI queries.
3
+ *
4
+ * The Docker lexicon's chant entities describe Compose / Dockerfile
5
+ * authoring primitives. The runtime concept (running containers, local
6
+ * images, networks) is created by `docker compose up` / `docker run` /
7
+ * `docker network create` outside chant's entity model.
8
+ *
9
+ * docker ps --format '{{json .}}' → running containers
10
+ * docker image ls --format '{{json .}}' → local images
11
+ * docker network ls --format '{{json .}}' → networks
12
+ *
13
+ * Output is one JSON object per line (NDJSON), not a JSON array. Daemon
14
+ * unreachable on any query → that query returns nothing; other queries
15
+ * still proceed.
16
+ */
17
+ import type { ArtifactMetadata } from "@intentius/chant/lexicon";
18
+ export declare function listArtifacts(_options: {
19
+ environment: string;
20
+ entities: Map<string, {
21
+ entityType: string;
22
+ props: Record<string, unknown>;
23
+ }>;
24
+ }): Promise<Record<string, ArtifactMetadata>>;
25
+ //# sourceMappingURL=list-artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-artifacts.d.ts","sourceRoot":"","sources":["../src/list-artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAoIjE,wBAAsB,aAAa,CAAC,QAAQ,EAAE;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/E,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAS5C"}
@@ -0,0 +1,6 @@
1
+ import type { CompletionContext, CompletionItem } from "@intentius/chant/lsp/types";
2
+ /**
3
+ * Provide Docker entity completions based on context.
4
+ */
5
+ export declare function dockerCompletions(ctx: CompletionContext): CompletionItem[];
6
+ //# sourceMappingURL=completions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../../src/lsp/completions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAapF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAE1E"}
@@ -0,0 +1,6 @@
1
+ import type { HoverContext, HoverInfo } from "@intentius/chant/lsp/types";
2
+ /**
3
+ * Provide hover information for Docker entity types.
4
+ */
5
+ export declare function dockerHover(ctx: HoverContext): HoverInfo | undefined;
6
+ //# sourceMappingURL=hover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/lsp/hover.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAa1E;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,CAEpE"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docker",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "Docker",
6
6
  "intrinsics": [
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env tsx
2
+ export {};
3
+ //# sourceMappingURL=package-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-cli.d.ts","sourceRoot":"","sources":["../src/package-cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Docker lexicon plugin.
3
+ *
4
+ * Provides serializer, lint rules, post-synth checks, intrinsics, LSP support,
5
+ * and code generation for Docker Compose and Dockerfile resources.
6
+ */
7
+ import type { LexiconPlugin } from "@intentius/chant/lexicon";
8
+ export declare const dockerPlugin: LexiconPlugin;
9
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,0BAA0B,CAAC;AAa7F,eAAO,MAAM,YAAY,EAAE,aAkO1B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Docker lexicon serializer.
3
+ *
4
+ * Splits entities into two output domains:
5
+ * - Docker::Compose::* → docker-compose.yml (primary output)
6
+ * - Docker::Dockerfile → Dockerfile.{name} (per-file entries in SerializerResult)
7
+ *
8
+ * Default labels (DEFAULT_LABELS_MARKER) are merged into every service's
9
+ * labels map but are not emitted as standalone documents.
10
+ */
11
+ import type { Serializer } from "@intentius/chant/serializer";
12
+ export declare const dockerSerializer: Serializer;
13
+ //# sourceMappingURL=serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,6BAA6B,CAAC;AAgPhF,eAAO,MAAM,gBAAgB,EAAE,UAoE9B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Fetch and cache the Compose Spec JSON Schema.
3
+ */
4
+ export declare function getCachePath(): string;
5
+ /**
6
+ * Fetch the Compose Spec JSON Schema, with local caching.
7
+ */
8
+ export declare function fetchComposeSpec(force?: boolean): Promise<Buffer>;
9
+ /**
10
+ * Fetch compose spec as a Map keyed by entity type — for generatePipeline.
11
+ */
12
+ export declare function fetchComposeSchemas(force?: boolean): Promise<Map<string, Buffer>>;
13
+ //# sourceMappingURL=fetch-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-compose.d.ts","sourceRoot":"","sources":["../../src/spec/fetch-compose.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAQvE;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAKvF"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Fetch and cache the Docker Engine API OpenAPI spec.
3
+ */
4
+ export declare function getCachePath(): string;
5
+ /**
6
+ * Fetch the Docker Engine API swagger YAML, with local caching.
7
+ */
8
+ export declare function fetchEngineApi(force?: boolean): Promise<Buffer>;
9
+ //# sourceMappingURL=fetch-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-engine.d.ts","sourceRoot":"","sources":["../../src/spec/fetch-engine.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAQrE"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Parse the Compose Spec JSON Schema into ParsedResult entries.
3
+ *
4
+ * The Compose spec defines a top-level "services", "volumes", "networks",
5
+ * "configs", and "secrets" map — each value is a typed resource.
6
+ * We model those as the five Compose entity types.
7
+ */
8
+ export interface ComposeParseResult {
9
+ typeName: string;
10
+ shortName: string;
11
+ description?: string;
12
+ properties: ComposeProperty[];
13
+ isResource: boolean;
14
+ }
15
+ export interface ComposeProperty {
16
+ name: string;
17
+ type: string;
18
+ description?: string;
19
+ required?: boolean;
20
+ enum?: string[];
21
+ }
22
+ /**
23
+ * Parse the Compose Spec JSON Schema buffer into ParsedResult entries.
24
+ * Returns one entry per top-level Compose resource type.
25
+ */
26
+ export declare function parseComposeSpec(_data: Buffer): ComposeParseResult[];
27
+ //# sourceMappingURL=parse-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-compose.d.ts","sourceRoot":"","sources":["../../src/spec/parse-compose.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAuFpE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Parse the Docker Engine API OpenAPI spec for Dockerfile-related types.
3
+ *
4
+ * We extract only the image-builder relevant definitions:
5
+ * ContainerConfig, BuildInfo, and related types.
6
+ */
7
+ export interface DockerfileParseResult {
8
+ typeName: string;
9
+ shortName: string;
10
+ description?: string;
11
+ instructions: DockerfileInstruction[];
12
+ }
13
+ export interface DockerfileInstruction {
14
+ name: string;
15
+ description?: string;
16
+ multi?: boolean;
17
+ }
18
+ /**
19
+ * Parse the Docker Engine API YAML buffer for Dockerfile instruction types.
20
+ * Returns a single DockerfileParseResult describing the Dockerfile entity.
21
+ */
22
+ export declare function parseEngineApi(_data: Buffer): DockerfileParseResult;
23
+ //# sourceMappingURL=parse-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-engine.d.ts","sourceRoot":"","sources":["../../src/spec/parse-engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,qBAAqB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAsBnE"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env tsx
2
+ export {};
3
+ //# sourceMappingURL=validate-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-cli.d.ts","sourceRoot":"","sources":["../src/validate-cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Validate generated lexicon-docker artifacts.
3
+ */
4
+ import { type ValidateResult } from "@intentius/chant/codegen/validate";
5
+ export type { ValidateCheck, ValidateResult } from "@intentius/chant/codegen/validate";
6
+ /**
7
+ * Validate the generated lexicon-docker artifacts.
8
+ */
9
+ export declare function validate(opts?: {
10
+ basePath?: string;
11
+ }): Promise<ValidateResult>;
12
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAElG,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAWvF;;GAEG;AACH,wBAAsB,QAAQ,CAAC,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAoBpF"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Well-known Docker and Docker Compose environment variable names.
3
+ *
4
+ * Use with the env() intrinsic for type-safe interpolation.
5
+ *
6
+ * @example
7
+ * import { env, DOCKER_VARS } from "@intentius/chant-lexicon-docker";
8
+ *
9
+ * export const api = new Service({
10
+ * environment: {
11
+ * BUILDKIT_ENABLED: env(DOCKER_VARS.DOCKER_BUILDKIT),
12
+ * },
13
+ * });
14
+ */
15
+ /** Docker daemon and client environment variables */
16
+ export declare const DOCKER_VARS: {
17
+ /** Enable Docker BuildKit: DOCKER_BUILDKIT=1 */
18
+ readonly DOCKER_BUILDKIT: "DOCKER_BUILDKIT";
19
+ /** Docker host socket/address */
20
+ readonly DOCKER_HOST: "DOCKER_HOST";
21
+ /** Docker TLS verify */
22
+ readonly DOCKER_TLS_VERIFY: "DOCKER_TLS_VERIFY";
23
+ /** Docker config directory */
24
+ readonly DOCKER_CONFIG: "DOCKER_CONFIG";
25
+ /** Docker content trust */
26
+ readonly DOCKER_CONTENT_TRUST: "DOCKER_CONTENT_TRUST";
27
+ };
28
+ /** Docker Compose specific environment variables */
29
+ export declare const COMPOSE_VARS: {
30
+ /** Override project name: COMPOSE_PROJECT_NAME */
31
+ readonly COMPOSE_PROJECT_NAME: "COMPOSE_PROJECT_NAME";
32
+ /** Override compose file: COMPOSE_FILE */
33
+ readonly COMPOSE_FILE: "COMPOSE_FILE";
34
+ /** Path separator for COMPOSE_FILE */
35
+ readonly COMPOSE_PATH_SEPARATOR: "COMPOSE_PATH_SEPARATOR";
36
+ /** Docker compose profiles to enable */
37
+ readonly COMPOSE_PROFILES: "COMPOSE_PROFILES";
38
+ /** Compose conversion flag */
39
+ readonly COMPOSE_CONVERT_WINDOWS_PATHS: "COMPOSE_CONVERT_WINDOWS_PATHS";
40
+ /** Docker host for compose */
41
+ readonly DOCKER_DEFAULT_PLATFORM: "DOCKER_DEFAULT_PLATFORM";
42
+ };
43
+ export type DockerVar = (typeof DOCKER_VARS)[keyof typeof DOCKER_VARS];
44
+ export type ComposeVar = (typeof COMPOSE_VARS)[keyof typeof COMPOSE_VARS];
45
+ //# sourceMappingURL=variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../src/variables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,qDAAqD;AACrD,eAAO,MAAM,WAAW;IACtB,gDAAgD;;IAEhD,iCAAiC;;IAEjC,wBAAwB;;IAExB,8BAA8B;;IAE9B,2BAA2B;;CAEnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,YAAY;IACvB,kDAAkD;;IAElD,0CAA0C;;IAE1C,sCAAsC;;IAEtC,wCAAwC;;IAExC,8BAA8B;;IAE9B,8BAA8B;;CAEtB,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AACvE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-docker",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Docker lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -30,8 +30,26 @@
30
30
  "access": "public"
31
31
  },
32
32
  "exports": {
33
- ".": "./src/index.ts",
34
- "./*": "./src/*.ts",
33
+ ".": {
34
+ "development": "./src/index.ts",
35
+ "types": "./dist/index.d.ts",
36
+ "default": "./src/index.ts"
37
+ },
38
+ "./*": {
39
+ "development": "./src/*.ts",
40
+ "types": "./dist/*.d.ts",
41
+ "default": "./src/*.ts"
42
+ },
43
+ "./detect": {
44
+ "development": "./src/detect.ts",
45
+ "types": "./dist/detect.d.ts",
46
+ "default": "./src/detect.ts"
47
+ },
48
+ "./lint/post-synth": {
49
+ "development": "./src/lint/post-synth/index.ts",
50
+ "types": "./dist/lint/post-synth/index.d.ts",
51
+ "default": "./src/lint/post-synth/index.ts"
52
+ },
35
53
  "./manifest": "./dist/manifest.json",
36
54
  "./meta": "./dist/meta.json",
37
55
  "./types": "./dist/types/index.d.ts"
@@ -41,13 +59,14 @@
41
59
  "bundle": "tsx src/package-cli.ts",
42
60
  "validate": "tsx src/validate-cli.ts",
43
61
  "docs": "tsx src/codegen/docs-cli.ts",
44
- "prepack": "npm run generate && npm run bundle && npm run validate"
62
+ "prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
63
+ "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && find dist -type f \\( -name \"*.js\" -o -name \"*.js.map\" \\) -delete"
45
64
  },
46
65
  "devDependencies": {
47
66
  "@intentius/chant": "*",
48
67
  "typescript": "^5.9.3"
49
68
  },
50
69
  "peerDependencies": {
51
- "@intentius/chant": "^0.1.0"
70
+ "@intentius/chant": "^0.8.0"
52
71
  }
53
72
  }
package/src/detect.ts ADDED
@@ -0,0 +1,7 @@
1
+ /** Edge-safe template detection for docker (Compose) — see #426. */
2
+ export function detectTemplate(data: unknown): boolean {
3
+ if (typeof data !== "object" || data === null) return false;
4
+ const obj = data as Record<string, unknown>;
5
+ // Docker Compose files have a services: key
6
+ return "services" in obj;
7
+ }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Adapters bridging the docker-specific DockerParser/DockerGenerator
3
+ * (which speak DockerIR / ParseResult / GenerateResult) to the core
4
+ * TemplateParser / TypeScriptGenerator interfaces consumed by
5
+ * `chant import` (packages/core/src/cli/commands/import.ts).
6
+ *
7
+ * The core import pipeline parses content into a TemplateIR (a flat list of
8
+ * ResourceIR), optionally organizes resources into category files, then asks
9
+ * the generator to emit GeneratedFile[]. We map each DockerIR to a ResourceIR
10
+ * keyed by its `kind` (service/volume/network/config/secret/dockerfile) and
11
+ * reverse the mapping in the generator so DockerGenerator can do the real work.
12
+ */
13
+
14
+ import type { TemplateIR, TemplateParser, ResourceIR } from "@intentius/chant/import/parser";
15
+ import type { GeneratedFile, TypeScriptGenerator } from "@intentius/chant/import/generator";
16
+ import { DockerParser } from "./parser";
17
+ import type { DockerIR, DockerfileStage } from "./parser";
18
+ import { DockerGenerator } from "./generator";
19
+
20
+ /** Convert a DockerIR into the core ResourceIR shape. */
21
+ function dockerIrToResource(entity: DockerIR): ResourceIR {
22
+ if (entity.kind === "dockerfile") {
23
+ return {
24
+ logicalId: entity.name,
25
+ type: entity.kind,
26
+ properties: { stages: entity.stages },
27
+ };
28
+ }
29
+ return {
30
+ logicalId: entity.name,
31
+ type: entity.kind,
32
+ properties: entity.props,
33
+ };
34
+ }
35
+
36
+ /** Convert a core ResourceIR back into a DockerIR for DockerGenerator. */
37
+ function resourceToDockerIr(resource: ResourceIR): DockerIR {
38
+ const name = resource.logicalId;
39
+ switch (resource.type) {
40
+ case "dockerfile":
41
+ return {
42
+ kind: "dockerfile",
43
+ name,
44
+ stages: (resource.properties.stages as DockerfileStage[] | undefined) ?? [],
45
+ };
46
+ case "service":
47
+ case "volume":
48
+ case "network":
49
+ case "config":
50
+ case "secret":
51
+ return {
52
+ kind: resource.type,
53
+ name,
54
+ props: resource.properties,
55
+ };
56
+ default:
57
+ // Unknown types from upstream organization are treated as services so
58
+ // they still round-trip rather than being silently dropped.
59
+ return { kind: "service", name, props: resource.properties };
60
+ }
61
+ }
62
+
63
+ /**
64
+ * TemplateParser adapter — wraps DockerParser.parse and maps its DockerIR
65
+ * entities to a TemplateIR.
66
+ */
67
+ export class DockerTemplateParser implements TemplateParser {
68
+ parse(content: string): TemplateIR {
69
+ const { entities } = new DockerParser().parse(content);
70
+ return {
71
+ resources: entities.map(dockerIrToResource),
72
+ parameters: [],
73
+ };
74
+ }
75
+ }
76
+
77
+ /**
78
+ * TypeScriptGenerator adapter — converts a TemplateIR back into DockerIR[]
79
+ * and delegates to DockerGenerator, returning a single generated file.
80
+ */
81
+ export class DockerTemplateGenerator implements TypeScriptGenerator {
82
+ generate(ir: TemplateIR): GeneratedFile[] {
83
+ const entities = ir.resources.map(resourceToDockerIr);
84
+ const { source } = new DockerGenerator().generate(entities);
85
+ return [{ path: "main.ts", content: source }];
86
+ }
87
+ }
@@ -0,0 +1,17 @@
1
+ // Code generated by chant generate. DO NOT EDIT.
2
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
3
+ import { dkrd001 } from "./no-latest-image";
4
+ import { dkrd002 } from "./unused-volume";
5
+ import { dkrd003 } from "./ssh-port-exposed";
6
+ import { dkrd010 } from "./apt-no-recommends";
7
+ import { dkrd011 } from "./prefer-copy";
8
+ import { dkrd012 } from "./no-root-user";
9
+
10
+ export const postSynthChecks: PostSynthCheck[] = [
11
+ dkrd001,
12
+ dkrd002,
13
+ dkrd003,
14
+ dkrd010,
15
+ dkrd011,
16
+ dkrd012,
17
+ ];
package/src/plugin.ts CHANGED
@@ -6,8 +6,9 @@
6
6
  */
7
7
 
8
8
  import type { LexiconPlugin, IntrinsicDef, InitTemplateSet } from "@intentius/chant/lexicon";
9
+ import { detectTemplate } from "./detect";
9
10
  import type { LintRule } from "@intentius/chant/lint/rule";
10
- import { discoverPostSynthChecks } from "@intentius/chant/lint/discover";
11
+ import { postSynthChecks as postSynthCheckList } from "./lint/post-synth";
11
12
  import { createSkillsLoader, createDiffTool, createCatalogResource } from "@intentius/chant/lexicon-plugin-helpers";
12
13
  import { join, dirname } from "path";
13
14
  import { fileURLToPath } from "url";
@@ -15,8 +16,7 @@ import { dockerSerializer } from "./serializer";
15
16
  import { noLatestTagRule } from "./lint/rules/no-latest-tag";
16
17
  import { dockerCompletions } from "./lsp/completions";
17
18
  import { dockerHover } from "./lsp/hover";
18
- import { DockerParser } from "./import/parser";
19
- import { DockerGenerator } from "./import/generator";
19
+ import { DockerTemplateParser, DockerTemplateGenerator } from "./import/adapter";
20
20
 
21
21
  export const dockerPlugin: LexiconPlugin = {
22
22
  name: "docker",
@@ -27,8 +27,7 @@ export const dockerPlugin: LexiconPlugin = {
27
27
  },
28
28
 
29
29
  postSynthChecks() {
30
- const postSynthDir = join(dirname(fileURLToPath(import.meta.url)), "lint", "post-synth");
31
- return discoverPostSynthChecks(postSynthDir, import.meta.url);
30
+ return postSynthCheckList;
32
31
  },
33
32
 
34
33
  intrinsics(): IntrinsicDef[] {
@@ -88,12 +87,7 @@ export const api = new Service({
88
87
  };
89
88
  },
90
89
 
91
- detectTemplate(data: unknown): boolean {
92
- if (typeof data !== "object" || data === null) return false;
93
- const obj = data as Record<string, unknown>;
94
- // Docker Compose files have a services: key
95
- return "services" in obj;
96
- },
90
+ detectTemplate,
97
91
 
98
92
  completionProvider(ctx: import("@intentius/chant/lsp/types").CompletionContext) {
99
93
  return dockerCompletions(ctx);
@@ -104,11 +98,11 @@ export const api = new Service({
104
98
  },
105
99
 
106
100
  templateParser() {
107
- return new DockerParser();
101
+ return new DockerTemplateParser();
108
102
  },
109
103
 
110
104
  templateGenerator() {
111
- return new DockerGenerator();
105
+ return new DockerTemplateGenerator();
112
106
  },
113
107
 
114
108
  async generate(options?: { verbose?: boolean }): Promise<void> {
package/src/serializer.ts CHANGED
@@ -286,7 +286,7 @@ export const dockerSerializer: Serializer = {
286
286
  continue;
287
287
  }
288
288
 
289
- const et = (entity as Record<string, unknown>).entityType as string;
289
+ const et = (entity as unknown as Record<string, unknown>).entityType as string;
290
290
 
291
291
  if (et === "Docker::Compose::Service") {
292
292
  services.set(name, entity);