@intentius/chant-lexicon-docker 0.124.22 → 0.124.23

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 (35) hide show
  1. package/dist/codegen/generate.d.ts.map +1 -1
  2. package/dist/generated/index.d.ts +582 -6
  3. package/dist/generated/index.d.ts.map +1 -1
  4. package/dist/integrity.json +7 -7
  5. package/dist/lint/post-synth/cache-busting-copy.d.ts.map +1 -1
  6. package/dist/manifest.json +1 -1
  7. package/dist/meta.json +438 -86
  8. package/dist/okf/types/DockerConfig.md +7 -5
  9. package/dist/okf/types/DockerSecret.md +8 -4
  10. package/dist/okf/types/Network.md +10 -6
  11. package/dist/okf/types/Service.md +93 -15
  12. package/dist/okf/types/Volume.md +5 -5
  13. package/dist/rules/cache-busting-copy.ts +2 -1
  14. package/dist/skills/chant-docker-patterns.md +2 -2
  15. package/dist/skills/chant-docker.md +1 -0
  16. package/dist/spec/parse-compose.d.ts +29 -2
  17. package/dist/spec/parse-compose.d.ts.map +1 -1
  18. package/dist/types/index.d.ts +263 -41
  19. package/package.json +3 -3
  20. package/src/codegen/__snapshots__/okf.test.ts.snap +123 -35
  21. package/src/codegen/generate.ts +53 -14
  22. package/src/codegen/okf.test.ts +1 -1
  23. package/src/generated/index.d.ts +263 -41
  24. package/src/generated/index.ts +279 -6
  25. package/src/generated/lexicon-docker.json +438 -86
  26. package/src/import/generator.test.ts +4 -4
  27. package/src/import/generator.ts +4 -4
  28. package/src/import/roundtrip.test.ts +62 -2
  29. package/src/import/testdata/configs-secrets.yaml +15 -0
  30. package/src/lint/post-synth/cache-busting-copy.ts +2 -1
  31. package/src/skills/chant-docker-patterns.md +2 -2
  32. package/src/skills/chant-docker.md +1 -0
  33. package/src/spec/parse-compose.ts +167 -95
  34. package/src/typecheck.e2e.test.ts +107 -0
  35. package/src/typed-props.test.ts +60 -0
@@ -11,7 +11,7 @@ import { generateComposePipeline } from "./generate-compose";
11
11
  import { generateDockerfilePipeline } from "./generate-dockerfile";
12
12
  import { entityTypeToTsName } from "./naming";
13
13
  import { PER_KIND_ORDER } from "../dockerfile-order";
14
- import type { ComposeParseResult } from "../spec/parse-compose";
14
+ import { COMPOSE_STRING, type ComposeParseResult } from "../spec/parse-compose";
15
15
  import type { DockerfileParseResult, DockerfileInstruction } from "../spec/parse-engine";
16
16
 
17
17
  export interface DockerGenerateResult {
@@ -90,23 +90,23 @@ function generateTypesDTS(compose: ComposeParseResult[], dockerfile: DockerfileP
90
90
  "// Code generated by chant generate. DO NOT EDIT.",
91
91
  'import type { Declarable } from "@intentius/chant/declarable";',
92
92
  "",
93
+ // This file is type-checked on its own (validate's types-compile), so it
94
+ // can't import the interpolation module; an env() value is matched by shape.
95
+ "/** An `env()` interpolation, as returned by the lexicon's `env`. */",
96
+ "interface EnvIntrinsic { toJSON(): string; toString(): string; }",
97
+ "",
93
98
  ];
94
99
 
100
+ lines.push(...composeTypeLines(compose));
95
101
  for (const c of compose) {
96
102
  const tsName = entityTypeToTsName(c.typeName);
97
- lines.push(`export interface ${tsName}Props {`);
98
- for (const p of c.properties) {
99
- const opt = p.required ? "" : "?";
100
- lines.push(` ${p.name}${opt}: ${p.type};`);
101
- }
102
- lines.push(`}`);
103
- lines.push(`export declare const ${tsName}: new (props?: ${tsName}Props) => Declarable;`);
104
- lines.push("");
103
+ lines.push(`export declare const ${tsName}: new (props?: ${tsName}Props, attributes?: Record<string, unknown>) => Declarable;`);
105
104
  }
105
+ lines.push("");
106
106
 
107
107
  const dfName = entityTypeToTsName(dockerfile.typeName);
108
108
  lines.push(...dockerfileTypeLines(dockerfile));
109
- lines.push(`export declare const ${dfName}: new (props?: DockerfileProps) => Declarable;`);
109
+ lines.push(`export declare const ${dfName}: new (props?: DockerfileProps, attributes?: Record<string, unknown>) => Declarable;`);
110
110
  lines.push("");
111
111
 
112
112
  return lines.join("\n");
@@ -116,27 +116,66 @@ function generateIndexTS(compose: ComposeParseResult[], dockerfile: DockerfilePa
116
116
  const lines: string[] = [
117
117
  "// Code generated by chant generate. DO NOT EDIT.",
118
118
  'import { createResource } from "./runtime";',
119
+ 'import type { Declarable } from "@intentius/chant/declarable";',
120
+ 'import type { EnvIntrinsic } from "../interpolation";',
121
+ "",
122
+ // createResource returns a constructor with untyped props. Each constructor
123
+ // below is cast to one that takes its props type, so a misspelled key or a
124
+ // wrong field type is a compile error where the resource is written, and
125
+ // the editor completes the fields (#3934).
126
+ "/** A docker resource constructor whose props are type-checked. */",
127
+ "export type DockerResourceConstructor<P> = new (props?: P, attributes?: Record<string, unknown>) => InstanceType<ReturnType<typeof createResource>>;",
119
128
  "",
120
129
  ];
121
130
 
131
+ lines.push(...composeTypeLines(compose));
122
132
  for (const c of compose) {
123
133
  const tsName = entityTypeToTsName(c.typeName);
124
- lines.push(`export const ${tsName} = createResource("${c.typeName}", "docker", {});`);
134
+ lines.push(
135
+ `export const ${tsName} = createResource("${c.typeName}", "docker", {}) as unknown as DockerResourceConstructor<${tsName}Props>;`,
136
+ );
125
137
  }
126
138
 
127
- lines.push("");
128
- const dfName = entityTypeToTsName(dockerfile.typeName);
129
- lines.push(`export const ${dfName} = createResource("${dockerfile.typeName}", "docker", {});`);
130
139
  lines.push("");
131
140
  // The Dockerfile prop types are exported from here too (not only from
132
141
  // index.d.ts, which index.ts shadows) so a module can type a shared stage
133
142
  // or step list: `export const install: DockerfileStep[] = [...]`.
134
143
  lines.push(...dockerfileTypeLines(dockerfile));
135
144
  lines.push("");
145
+ const dfName = entityTypeToTsName(dockerfile.typeName);
146
+ lines.push(
147
+ `export const ${dfName} = createResource("${dockerfile.typeName}", "docker", {}) as unknown as DockerResourceConstructor<DockerfileProps>;`,
148
+ );
149
+ lines.push("");
136
150
 
137
151
  return lines.join("\n");
138
152
  }
139
153
 
154
+ /** One props interface per Compose entity. */
155
+ function composeTypeLines(compose: ComposeParseResult[]): string[] {
156
+ const lines: string[] = [
157
+ "/**",
158
+ " * A Compose string value: a string, an `env()` interpolation, or an entity",
159
+ " * (service, network, volume, config, secret or Dockerfile), which is written as its name.",
160
+ " */",
161
+ `export type ${COMPOSE_STRING} = string | EnvIntrinsic | Declarable;`,
162
+ "",
163
+ ];
164
+ for (const c of compose) {
165
+ const tsName = entityTypeToTsName(c.typeName);
166
+ if (c.description) lines.push(`/** ${c.description} */`);
167
+ lines.push(`export interface ${tsName}Props {`);
168
+ for (const p of c.properties) {
169
+ const opt = p.required ? "" : "?";
170
+ if (p.description) lines.push(` /** ${p.description} */`);
171
+ lines.push(` ${p.name}${opt}: ${p.type};`);
172
+ }
173
+ lines.push(`}`);
174
+ lines.push("");
175
+ }
176
+ return lines;
177
+ }
178
+
140
179
  /**
141
180
  * The Dockerfile prop types: one `DockerfileStep` variant per instruction,
142
181
  * the stage, and the props. The per-kind fields keep the instructions they
@@ -25,7 +25,7 @@ describe("docker OKF bundle", () => {
25
25
  expect(front.type).toBe("resource-type");
26
26
  expect(front.resource_type).toBe("Docker::Compose::Service");
27
27
  // Registry-carried property description reaches the concept body.
28
- expect(service.body).toContain("- `image` (`string`): Container image to use");
28
+ expect(service.body).toContain("- `image` (`ComposeString`): Specify the image to start the container from.");
29
29
  // The no-latest-tag rule governs Service…
30
30
  expect(service.body).toContain("[DKRS001](/rules/DKRS001.md)");
31
31
  // …and points back at it.
@@ -1,60 +1,282 @@
1
1
  // Code generated by chant generate. DO NOT EDIT.
2
2
  import type { Declarable } from "@intentius/chant/declarable";
3
3
 
4
+ /** An `env()` interpolation, as returned by the lexicon's `env`. */
5
+ interface EnvIntrinsic { toJSON(): string; toString(): string; }
6
+
7
+ /**
8
+ * A Compose string value: a string, an `env()` interpolation, or an entity
9
+ * (service, network, volume, config, secret or Dockerfile), which is written as its name.
10
+ */
11
+ export type ComposeString = string | EnvIntrinsic | Declarable;
12
+
13
+ /** A containerized service definition in Docker Compose */
4
14
  export interface ServiceProps {
5
- image?: string;
6
- build?: object;
7
- command?: string | string[];
8
- entrypoint?: string | string[];
9
- environment?: Record<string, string>;
10
- ports?: string[];
11
- volumes?: string[];
12
- networks?: string[];
13
- depends_on?: string[] | Record<string, { condition: "service_started" | "service_healthy" | "service_completed_successfully"; restart?: boolean; required?: boolean }>;
14
- restart?: string;
15
- labels?: Record<string, string>;
16
- healthcheck?: object;
17
- deploy?: object;
18
- secrets?: string[];
19
- configs?: Array<string | { source: string | Declarable; target?: string; uid?: string; gid?: string; mode?: number }>;
15
+ develop?: { watch?: Array<{ ignore?: ComposeString | Array<ComposeString>; include?: ComposeString | Array<ComposeString>; path: ComposeString; action: "rebuild" | "sync" | "restart" | "sync+restart" | "sync+exec"; target?: ComposeString; exec?: { command: null | ComposeString | Array<ComposeString>; user?: ComposeString; privileged?: boolean | ComposeString; working_dir?: ComposeString; environment?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; [key: `x-${string}`]: unknown }; initial_sync?: boolean; [key: `x-${string}`]: unknown }>; [key: `x-${string}`]: unknown } | null;
16
+ deploy?: { mode?: ComposeString; endpoint_mode?: ComposeString; replicas?: number | ComposeString; labels?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; rollback_config?: { parallelism?: number | ComposeString; delay?: ComposeString; failure_action?: ComposeString; monitor?: ComposeString; max_failure_ratio?: number | ComposeString; order?: "start-first" | "stop-first"; [key: `x-${string}`]: unknown }; update_config?: { parallelism?: number | ComposeString; delay?: ComposeString; failure_action?: ComposeString; monitor?: ComposeString; max_failure_ratio?: number | ComposeString; order?: "start-first" | "stop-first"; [key: `x-${string}`]: unknown }; resources?: { limits?: { cpus?: number | ComposeString; memory?: ComposeString; pids?: number | ComposeString; [key: `x-${string}`]: unknown }; reservations?: { cpus?: number | ComposeString; memory?: ComposeString; generic_resources?: Array<{ discrete_resource_spec?: { kind?: ComposeString; value?: number | ComposeString; [key: `x-${string}`]: unknown }; [key: `x-${string}`]: unknown }>; devices?: Array<{ capabilities: Array<ComposeString>; count?: ComposeString | number; device_ids?: Array<ComposeString>; driver?: ComposeString; options?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; [key: `x-${string}`]: unknown }>; [key: `x-${string}`]: unknown }; [key: `x-${string}`]: unknown }; restart_policy?: { condition?: ComposeString; delay?: ComposeString; max_attempts?: number | ComposeString; window?: ComposeString; [key: `x-${string}`]: unknown }; placement?: { constraints?: Array<ComposeString>; preferences?: Array<{ spread?: ComposeString; [key: `x-${string}`]: unknown }>; max_replicas_per_node?: number | ComposeString; [key: `x-${string}`]: unknown }; [key: `x-${string}`]: unknown } | null;
17
+ annotations?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>;
18
+ attach?: boolean | ComposeString;
19
+ /** Configuration options for building the service's image. */
20
+ build?: ComposeString | { context?: ComposeString; dockerfile?: ComposeString; dockerfile_inline?: ComposeString; entitlements?: Array<ComposeString>; args?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; ssh?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; labels?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; cache_from?: Array<ComposeString>; cache_to?: Array<ComposeString>; no_cache?: boolean | ComposeString; no_cache_filter?: ComposeString | Array<ComposeString>; additional_contexts?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; network?: ComposeString; provenance?: ComposeString | boolean; sbom?: ComposeString | boolean; pull?: boolean | ComposeString; target?: ComposeString; shm_size?: number | ComposeString; extra_hosts?: Record<string, ComposeString | Array<ComposeString>> | Array<ComposeString>; isolation?: ComposeString; privileged?: boolean | ComposeString; secrets?: Array<ComposeString | { source?: ComposeString; target?: ComposeString; uid?: ComposeString; gid?: ComposeString; mode?: number | ComposeString; [key: `x-${string}`]: unknown }>; tags?: Array<ComposeString>; ulimits?: Record<string, number | ComposeString | { hard: number | ComposeString; soft: number | ComposeString; [key: `x-${string}`]: unknown }>; platforms?: Array<ComposeString>; [key: `x-${string}`]: unknown };
21
+ /** Block IO configuration for the service. */
22
+ blkio_config?: { device_read_bps?: Array<{ path?: ComposeString; rate?: number | ComposeString }>; device_read_iops?: Array<{ path?: ComposeString; rate?: number | ComposeString }>; device_write_bps?: Array<{ path?: ComposeString; rate?: number | ComposeString }>; device_write_iops?: Array<{ path?: ComposeString; rate?: number | ComposeString }>; weight?: number | ComposeString; weight_device?: Array<{ path?: ComposeString; weight?: number | ComposeString }> };
23
+ /** Add Linux capabilities. For example, 'CAP_SYS_ADMIN', 'SYS_ADMIN', or 'NET_ADMIN'. */
24
+ cap_add?: Array<ComposeString>;
25
+ /** Drop Linux capabilities. For example, 'CAP_SYS_ADMIN', 'SYS_ADMIN', or 'NET_ADMIN'. */
26
+ cap_drop?: Array<ComposeString>;
27
+ /** Specify the cgroup namespace to join. Use 'host' to use the host's cgroup namespace, or 'private' to use a private cgroup namespace. */
28
+ cgroup?: "host" | "private";
29
+ /** Specify an optional parent cgroup for the container. */
30
+ cgroup_parent?: ComposeString;
31
+ /** Override the default command declared by the container image, for example 'CMD' in Dockerfile. */
32
+ command?: null | ComposeString | Array<ComposeString>;
33
+ /** Grant access to Configs on a per-service basis. */
34
+ configs?: Array<ComposeString | { source?: ComposeString; target?: ComposeString; uid?: ComposeString; gid?: ComposeString; mode?: number | ComposeString; [key: `x-${string}`]: unknown }>;
35
+ /** Specify a custom container name, rather than a generated default name. */
36
+ container_name?: ComposeString;
37
+ /** Number of usable CPUs. */
38
+ cpu_count?: ComposeString | number;
39
+ /** Percentage of CPU resources to use. */
40
+ cpu_percent?: ComposeString | number;
41
+ /** CPU shares (relative weight) for the container. */
42
+ cpu_shares?: number | ComposeString;
43
+ /** Limit the CPU CFS (Completely Fair Scheduler) quota. */
44
+ cpu_quota?: number | ComposeString;
45
+ /** Limit the CPU CFS (Completely Fair Scheduler) period. */
46
+ cpu_period?: number | ComposeString;
47
+ /** Limit the CPU real-time period in microseconds or a duration. */
48
+ cpu_rt_period?: number | ComposeString;
49
+ /** Limit the CPU real-time runtime in microseconds or a duration. */
50
+ cpu_rt_runtime?: number | ComposeString;
51
+ /** Number of CPUs to use. A floating-point value is supported to request partial CPUs. */
52
+ cpus?: number | ComposeString;
53
+ /** CPUs in which to allow execution (0-3, 0,1). */
54
+ cpuset?: ComposeString;
55
+ /** Configure the credential spec for managed service account. */
56
+ credential_spec?: { config?: ComposeString; file?: ComposeString; registry?: ComposeString; [key: `x-${string}`]: unknown };
57
+ /** Express dependency between services. Service dependencies cause services to be started in dependency order. The dependent service will wait for the dependency to be ready before starting. */
58
+ depends_on?: Array<ComposeString> | Record<string, { restart?: boolean | ComposeString; required?: boolean; condition: "service_started" | "service_healthy" | "service_completed_successfully"; [key: `x-${string}`]: unknown }>;
59
+ /** Add rules to the cgroup allowed devices list. */
60
+ device_cgroup_rules?: Array<ComposeString>;
61
+ /** List of device mappings for the container. */
62
+ devices?: Array<ComposeString | { source: ComposeString; target?: ComposeString; permissions?: ComposeString; [key: `x-${string}`]: unknown }>;
63
+ /** Custom DNS servers to set for the service container. */
64
+ dns?: ComposeString | Array<ComposeString>;
65
+ /** Custom DNS options to be passed to the container's DNS resolver. */
66
+ dns_opt?: Array<ComposeString>;
67
+ /** Custom DNS search domains to set on the service container. */
68
+ dns_search?: ComposeString | Array<ComposeString>;
69
+ /** Custom domain name to use for the service container. */
70
+ domainname?: ComposeString;
71
+ /** Override the default entrypoint declared by the container image, for example 'ENTRYPOINT' in Dockerfile. */
72
+ entrypoint?: null | ComposeString | Array<ComposeString>;
73
+ /** Add environment variables from a file or multiple files. Can be a single file path or a list of file paths. */
74
+ env_file?: ComposeString | Array<ComposeString | { path: ComposeString; format?: ComposeString; required?: boolean | ComposeString }>;
75
+ /** Add metadata to containers using files containing Docker labels. */
76
+ label_file?: ComposeString | Array<ComposeString>;
77
+ /** Add environment variables. You can use either an array or a list of KEY=VAL pairs. */
78
+ environment?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>;
79
+ /** Expose ports without publishing them to the host machine - they'll only be accessible to linked services. */
80
+ expose?: Array<ComposeString | number>;
81
+ /** Extend another service, in the current file or another file. */
82
+ extends?: ComposeString | { service: ComposeString; file?: ComposeString };
83
+ /** Specify a service which will not be manage by Compose directly, and delegate its management to an external provider. */
84
+ provider?: { type: ComposeString; options?: Record<string, ComposeString | number | boolean | Array<ComposeString | number | boolean>>; [key: `x-${string}`]: unknown };
85
+ /** Link to services started outside this Compose application. Specify services as <service_name>:<alias>. */
86
+ external_links?: Array<ComposeString>;
87
+ /** Add hostname mappings to the container network interface configuration. */
88
+ extra_hosts?: Record<string, ComposeString | Array<ComposeString>> | Array<ComposeString>;
89
+ /** Define GPU devices to use. Can be set to 'all' to use all GPUs, or a list of specific GPU devices. */
90
+ gpus?: "all" | Array<{ capabilities?: Array<ComposeString>; count?: ComposeString | number; device_ids?: Array<ComposeString>; driver?: ComposeString; options?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString> }>;
91
+ /** Add additional groups which user inside the container should be member of. */
92
+ group_add?: Array<ComposeString | number>;
93
+ /** Configure a health check for the container to monitor its health status. */
94
+ healthcheck?: { disable?: boolean | ComposeString; interval?: ComposeString; retries?: number | ComposeString; test?: ComposeString | Array<ComposeString>; timeout?: ComposeString; start_period?: ComposeString; start_interval?: ComposeString; [key: `x-${string}`]: unknown };
95
+ /** Define a custom hostname for the service container. */
96
+ hostname?: ComposeString;
97
+ /** Specify the image to start the container from. Can be a repository/tag, a digest, or a local image ID. */
98
+ image?: ComposeString;
99
+ /** Run as an init process inside the container that forwards signals and reaps processes. */
100
+ init?: boolean | ComposeString;
101
+ /** IPC sharing mode for the service container. Use 'host' to share the host's IPC namespace, 'service:[service_name]' to share with another service, or 'shareable' to allow other services to share this service's IPC namespace. */
102
+ ipc?: ComposeString;
103
+ /** Container isolation technology to use. Supported values are platform-specific. */
104
+ isolation?: ComposeString;
105
+ /** Add metadata to containers using Docker labels. You can use either an array or a list. */
106
+ labels?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>;
107
+ /** Link to containers in another service. Either specify both the service name and a link alias (SERVICE:ALIAS), or just the service name. */
108
+ links?: Array<ComposeString>;
109
+ /** Logging configuration for the service. */
110
+ logging?: { driver?: ComposeString; options?: Record<string, ComposeString | number | null>; [key: `x-${string}`]: unknown };
111
+ /** Container MAC address to set. */
112
+ mac_address?: ComposeString;
113
+ /** Memory limit for the container. A string value can use suffix like '2g' for 2 gigabytes. */
114
+ mem_limit?: number | ComposeString;
115
+ /** Memory reservation for the container. */
116
+ mem_reservation?: ComposeString | number;
117
+ /** Container memory swappiness as percentage (0 to 100). */
118
+ mem_swappiness?: number | ComposeString;
119
+ /** Amount of memory the container is allowed to swap to disk. Set to -1 to enable unlimited swap. */
120
+ memswap_limit?: number | ComposeString;
121
+ /** Network mode. Values can be 'bridge', 'host', 'none', 'service:[service name]', or 'container:[container name]'. */
122
+ network_mode?: ComposeString;
123
+ /** AI Models to use, referencing entries under the top-level models key. */
124
+ models?: Array<ComposeString> | Record<string, { endpoint_var?: ComposeString; model_var?: ComposeString; [key: `x-${string}`]: unknown } | null>;
125
+ /** Networks to join, referencing entries under the top-level networks key. Can be a list of network names or a mapping of network name to network configuration. */
126
+ networks?: Array<ComposeString> | Record<string, { aliases?: Array<ComposeString>; interface_name?: ComposeString; ipv4_address?: ComposeString; ipv6_address?: ComposeString; link_local_ips?: Array<ComposeString>; mac_address?: ComposeString; driver_opts?: Record<string, ComposeString | number>; priority?: number; gw_priority?: number; [key: `x-${string}`]: unknown } | null>;
127
+ /** Disable OOM Killer for the container. */
128
+ oom_kill_disable?: boolean | ComposeString;
129
+ /** Tune host's OOM preferences for the container (accepts -1000 to 1000). */
130
+ oom_score_adj?: ComposeString | number;
131
+ /** PID mode for container. */
132
+ pid?: ComposeString | null;
133
+ /** Tune a container's PIDs limit. Set to -1 for unlimited PIDs. */
134
+ pids_limit?: number | ComposeString;
135
+ /** Target platform to run on, e.g., 'linux/amd64', 'linux/arm64', or 'windows/amd64'. */
136
+ platform?: ComposeString;
137
+ /** Expose container ports. Short format ([HOST:]CONTAINER[/PROTOCOL]). */
138
+ ports?: Array<number | ComposeString | { name?: ComposeString; mode?: ComposeString; host_ip?: ComposeString; target?: number | ComposeString; published?: ComposeString | number; protocol?: ComposeString; app_protocol?: ComposeString; [key: `x-${string}`]: unknown }>;
139
+ /** Init containers to run to completion before the service container is started. Each step runs in its own ephemeral container, in declared order; a non-zero exit fails the bring-up of the service and its dependents. */
140
+ pre_start?: Array<{ command?: null | ComposeString | Array<ComposeString>; image?: ComposeString; user?: ComposeString; privileged?: boolean | ComposeString; working_dir?: ComposeString; environment?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; per_replica?: boolean | ComposeString; [key: `x-${string}`]: unknown }>;
141
+ /** Commands to run after the container starts. If any command fails, the container stops. */
142
+ post_start?: Array<{ command: null | ComposeString | Array<ComposeString>; user?: ComposeString; privileged?: boolean | ComposeString; working_dir?: ComposeString; environment?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; [key: `x-${string}`]: unknown }>;
143
+ /** Commands to run before the container stops. If any command fails, the container stop is aborted. */
144
+ pre_stop?: Array<{ command: null | ComposeString | Array<ComposeString>; user?: ComposeString; privileged?: boolean | ComposeString; working_dir?: ComposeString; environment?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; [key: `x-${string}`]: unknown }>;
145
+ /** Give extended privileges to the service container. */
146
+ privileged?: boolean | ComposeString;
147
+ /** List of profiles for this service. When profiles are specified, services are only started when the profile is activated. */
148
+ profiles?: Array<ComposeString>;
149
+ /** Policy for pulling images. Options include: 'always', 'never', 'if_not_present', 'missing', 'build', or time-based refresh policies. */
150
+ pull_policy?: ComposeString;
151
+ /** Time after which to refresh the image. Used with pull_policy=refresh. */
152
+ pull_refresh_after?: ComposeString;
153
+ /** Mount the container's filesystem as read only. */
154
+ read_only?: boolean | ComposeString;
155
+ /** Restart policy for the service container. Options include: 'no', 'always', 'on-failure', and 'unless-stopped'. */
156
+ restart?: ComposeString;
157
+ /** Runtime to use for this container, e.g., 'runc'. */
158
+ runtime?: ComposeString;
159
+ /** Number of containers to deploy for this service. */
160
+ scale?: number | ComposeString;
161
+ /** Override the default labeling scheme for each container. */
162
+ security_opt?: Array<ComposeString>;
163
+ /** Size of /dev/shm. A string value can use suffix like '2g' for 2 gigabytes. */
164
+ shm_size?: number | ComposeString;
165
+ /** Grant access to Secrets on a per-service basis. */
166
+ secrets?: Array<ComposeString | { source?: ComposeString; target?: ComposeString; uid?: ComposeString; gid?: ComposeString; mode?: number | ComposeString; [key: `x-${string}`]: unknown }>;
167
+ /** Kernel parameters to set in the container. You can use either an array or a list. */
168
+ sysctls?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>;
169
+ /** Keep STDIN open even if not attached. */
170
+ stdin_open?: boolean | ComposeString;
171
+ /** Time to wait for the container to stop gracefully before sending SIGKILL (e.g., '1s', '1m30s'). */
172
+ stop_grace_period?: ComposeString;
173
+ /** Signal to stop the container (e.g., 'SIGTERM', 'SIGINT'). */
174
+ stop_signal?: ComposeString;
175
+ /** Storage driver options for the container. */
176
+ storage_opt?: Record<string, unknown>;
177
+ /** Mount a temporary filesystem (tmpfs) into the container. Can be a single value or a list. */
178
+ tmpfs?: ComposeString | Array<ComposeString>;
179
+ /** Allocate a pseudo-TTY to service container. */
180
+ tty?: boolean | ComposeString;
181
+ /** Override the default ulimits for a container. */
182
+ ulimits?: Record<string, number | ComposeString | { hard: number | ComposeString; soft: number | ComposeString; [key: `x-${string}`]: unknown }>;
183
+ /** Bind mount Docker API socket and required auth. */
184
+ use_api_socket?: boolean;
185
+ /** Username or UID to run the container process as. */
186
+ user?: ComposeString;
187
+ /** UTS namespace to use. 'host' shares the host's UTS namespace. */
188
+ uts?: ComposeString;
189
+ /** User namespace to use. 'host' shares the host's user namespace. */
190
+ userns_mode?: ComposeString;
191
+ /** Mount host paths or named volumes accessible to the container. Short syntax (VOLUME:CONTAINER_PATH[:MODE]) */
192
+ volumes?: Array<ComposeString | { type: "bind" | "volume" | "tmpfs" | "cluster" | "npipe" | "image"; source?: ComposeString; target?: ComposeString; read_only?: boolean | ComposeString; consistency?: ComposeString; bind?: { propagation?: ComposeString; create_host_path?: boolean | ComposeString; recursive?: "enabled" | "disabled" | "writable" | "readonly"; selinux?: "z" | "Z"; [key: `x-${string}`]: unknown }; volume?: { labels?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>; nocopy?: boolean | ComposeString; subpath?: ComposeString; [key: `x-${string}`]: unknown }; tmpfs?: { size?: number | ComposeString; mode?: number | ComposeString; [key: `x-${string}`]: unknown }; image?: { subpath?: ComposeString; [key: `x-${string}`]: unknown }; [key: `x-${string}`]: unknown }>;
193
+ /** Mount volumes from another service or container. Optionally specify read-only access (ro) or read-write (rw). */
194
+ volumes_from?: Array<ComposeString>;
195
+ /** The working directory in which the entrypoint or command will be run */
196
+ working_dir?: ComposeString;
20
197
  }
21
- export declare const Service: new (props?: ServiceProps) => Declarable;
22
198
 
199
+ /** A named volume definition in Docker Compose */
23
200
  export interface VolumeProps {
24
- driver?: string;
25
- driver_opts?: Record<string, string>;
26
- external?: boolean;
27
- labels?: Record<string, string>;
28
- name?: string;
201
+ /** Custom name for this volume. */
202
+ name?: ComposeString;
203
+ /** Specify which volume driver should be used for this volume. */
204
+ driver?: ComposeString;
205
+ /** Specify driver-specific options. */
206
+ driver_opts?: Record<string, ComposeString | number>;
207
+ /** Specifies that this volume already exists and was created outside of Compose. */
208
+ external?: boolean | ComposeString | { name?: ComposeString; [key: `x-${string}`]: unknown };
209
+ /** Add metadata to the volume using labels. */
210
+ labels?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>;
29
211
  }
30
- export declare const Volume: new (props?: VolumeProps) => Declarable;
31
212
 
213
+ /** A network definition in Docker Compose */
32
214
  export interface NetworkProps {
33
- driver?: string;
34
- driver_opts?: Record<string, string>;
35
- external?: boolean;
36
- labels?: Record<string, string>;
37
- internal?: boolean;
38
- ipam?: object;
215
+ /** Custom name for this network. */
216
+ name?: ComposeString;
217
+ /** Specify which driver should be used for this network. Default is 'bridge'. */
218
+ driver?: ComposeString;
219
+ /** Specify driver-specific options defined as key/value pairs. */
220
+ driver_opts?: Record<string, ComposeString | number>;
221
+ /** Custom IP Address Management configuration for this network. */
222
+ ipam?: { driver?: ComposeString; config?: Array<{ subnet?: ComposeString; ip_range?: ComposeString; gateway?: ComposeString; aux_addresses?: Record<string, ComposeString>; [key: `x-${string}`]: unknown }>; options?: Record<string, ComposeString>; [key: `x-${string}`]: unknown };
223
+ /** Specifies that this network already exists and was created outside of Compose. */
224
+ external?: boolean | ComposeString | { name?: ComposeString; [key: `x-${string}`]: unknown };
225
+ /** Create an externally isolated network. */
226
+ internal?: boolean | ComposeString;
227
+ /** Enable IPv4 networking. */
228
+ enable_ipv4?: boolean | ComposeString;
229
+ /** Enable IPv6 networking. */
230
+ enable_ipv6?: boolean | ComposeString;
231
+ /** If true, standalone containers can attach to this network. */
232
+ attachable?: boolean | ComposeString;
233
+ /** Add metadata to the network using labels. */
234
+ labels?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>;
39
235
  }
40
- export declare const Network: new (props?: NetworkProps) => Declarable;
41
236
 
237
+ /** A config definition in Docker Compose */
42
238
  export interface DockerConfigProps {
43
- file?: string;
44
- content?: string;
45
- external?: boolean;
46
- labels?: Record<string, string>;
47
- name?: string;
239
+ /** Custom name for this config. */
240
+ name?: ComposeString;
241
+ /** Inline content of the config. */
242
+ content?: ComposeString;
243
+ /** Name of an environment variable from which to get the config value. */
244
+ environment?: ComposeString;
245
+ /** Path to a file containing the config value. */
246
+ file?: ComposeString;
247
+ /** Specifies that this config already exists and was created outside of Compose. */
248
+ external?: boolean | ComposeString | { name?: ComposeString };
249
+ /** Add metadata to the config using labels. */
250
+ labels?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>;
251
+ /** Driver to use for templating the config's value. */
252
+ template_driver?: ComposeString;
48
253
  }
49
- export declare const DockerConfig: new (props?: DockerConfigProps) => Declarable;
50
254
 
255
+ /** A secret definition in Docker Compose */
51
256
  export interface DockerSecretProps {
52
- file?: string;
53
- external?: boolean;
54
- labels?: Record<string, string>;
55
- name?: string;
257
+ /** Custom name for this secret. */
258
+ name?: ComposeString;
259
+ /** Name of an environment variable from which to get the secret value. */
260
+ environment?: ComposeString;
261
+ /** Path to a file containing the secret value. */
262
+ file?: ComposeString;
263
+ /** Specifies that this secret already exists and was created outside of Compose. */
264
+ external?: boolean | ComposeString | { name?: ComposeString };
265
+ /** Add metadata to the secret using labels. */
266
+ labels?: Record<string, ComposeString | number | boolean | null> | Array<ComposeString>;
267
+ /** Specify which secret driver should be used for this secret. */
268
+ driver?: ComposeString;
269
+ /** Specify driver-specific options. */
270
+ driver_opts?: Record<string, ComposeString | number>;
271
+ /** Driver to use for templating the secret's value. */
272
+ template_driver?: ComposeString;
56
273
  }
57
- export declare const DockerSecret: new (props?: DockerSecretProps) => Declarable;
274
+
275
+ export declare const Service: new (props?: ServiceProps, attributes?: Record<string, unknown>) => Declarable;
276
+ export declare const Volume: new (props?: VolumeProps, attributes?: Record<string, unknown>) => Declarable;
277
+ export declare const Network: new (props?: NetworkProps, attributes?: Record<string, unknown>) => Declarable;
278
+ export declare const DockerConfig: new (props?: DockerConfigProps, attributes?: Record<string, unknown>) => Declarable;
279
+ export declare const DockerSecret: new (props?: DockerSecretProps, attributes?: Record<string, unknown>) => Declarable;
58
280
 
59
281
  /** The Dockerfile instructions a step can name. FROM is the stage's own `from` field. */
60
282
  export type DockerfileInstructionName = "arg" | "env" | "run" | "copy" | "add" | "workdir" | "user" | "expose" | "volume" | "label" | "entrypoint" | "cmd" | "healthcheck" | "shell" | "stopsignal" | "onbuild";
@@ -172,4 +394,4 @@ export interface DockerfileProps {
172
394
  /** HEALTHCHECK as a per-kind field, written in the fixed order. Use `steps` to choose the order. */
173
395
  healthcheck?: string;
174
396
  }
175
- export declare const Dockerfile: new (props?: DockerfileProps) => Declarable;
397
+ export declare const Dockerfile: new (props?: DockerfileProps, attributes?: Record<string, unknown>) => Declarable;