@better-openclaw/core 1.0.8 → 1.0.9

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 (96) hide show
  1. package/dist/bare-metal-partition.d.mts.map +1 -1
  2. package/dist/bare-metal-partition.mjs +1 -0
  3. package/dist/bare-metal-partition.mjs.map +1 -1
  4. package/dist/composer.d.mts.map +1 -1
  5. package/dist/composer.mjs +11 -1
  6. package/dist/composer.mjs.map +1 -1
  7. package/dist/errors.d.mts +17 -0
  8. package/dist/errors.d.mts.map +1 -0
  9. package/dist/errors.mjs +24 -0
  10. package/dist/errors.mjs.map +1 -0
  11. package/dist/generate.d.mts +4 -3
  12. package/dist/generate.d.mts.map +1 -1
  13. package/dist/generate.mjs +13 -5
  14. package/dist/generate.mjs.map +1 -1
  15. package/dist/generators/traefik.d.mts +19 -0
  16. package/dist/generators/traefik.d.mts.map +1 -0
  17. package/dist/generators/traefik.mjs +86 -0
  18. package/dist/generators/traefik.mjs.map +1 -0
  19. package/dist/generators/traefik.test.d.mts +1 -0
  20. package/dist/generators/traefik.test.mjs +69 -0
  21. package/dist/generators/traefik.test.mjs.map +1 -0
  22. package/dist/index.d.mts +4 -2
  23. package/dist/index.mjs +4 -2
  24. package/dist/migrations.d.mts +14 -0
  25. package/dist/migrations.d.mts.map +1 -0
  26. package/dist/migrations.mjs +33 -0
  27. package/dist/migrations.mjs.map +1 -0
  28. package/dist/migrations.test.d.mts +1 -0
  29. package/dist/migrations.test.mjs +42 -0
  30. package/dist/migrations.test.mjs.map +1 -0
  31. package/dist/resolver.d.mts +6 -1
  32. package/dist/resolver.d.mts.map +1 -1
  33. package/dist/resolver.mjs +21 -3
  34. package/dist/resolver.mjs.map +1 -1
  35. package/dist/schema.d.mts +1 -0
  36. package/dist/schema.d.mts.map +1 -1
  37. package/dist/schema.mjs +1 -0
  38. package/dist/schema.mjs.map +1 -1
  39. package/dist/services/definitions/caddy.mjs +20 -1
  40. package/dist/services/definitions/caddy.mjs.map +1 -1
  41. package/dist/services/definitions/cal-com.d.mts +7 -0
  42. package/dist/services/definitions/cal-com.d.mts.map +1 -0
  43. package/dist/services/definitions/cal-com.mjs +88 -0
  44. package/dist/services/definitions/cal-com.mjs.map +1 -0
  45. package/dist/services/definitions/grafana.mjs +13 -1
  46. package/dist/services/definitions/grafana.mjs.map +1 -1
  47. package/dist/services/definitions/index.d.mts +4 -1
  48. package/dist/services/definitions/index.d.mts.map +1 -1
  49. package/dist/services/definitions/index.mjs +8 -2
  50. package/dist/services/definitions/index.mjs.map +1 -1
  51. package/dist/services/definitions/neo4j.d.mts +7 -0
  52. package/dist/services/definitions/neo4j.d.mts.map +1 -0
  53. package/dist/services/definitions/neo4j.mjs +91 -0
  54. package/dist/services/definitions/neo4j.mjs.map +1 -0
  55. package/dist/services/definitions/traefik.mjs +0 -1
  56. package/dist/services/definitions/traefik.mjs.map +1 -1
  57. package/dist/services/definitions/xyops.d.mts +7 -0
  58. package/dist/services/definitions/xyops.d.mts.map +1 -0
  59. package/dist/services/definitions/xyops.mjs +86 -0
  60. package/dist/services/definitions/xyops.mjs.map +1 -0
  61. package/dist/types.d.mts +8 -1
  62. package/dist/types.d.mts.map +1 -1
  63. package/dist/types.mjs.map +1 -1
  64. package/dist/validator.mjs +11 -0
  65. package/dist/validator.mjs.map +1 -1
  66. package/dist/version-manager.d.mts +1 -1
  67. package/dist/version-manager.d.mts.map +1 -1
  68. package/dist/version-manager.mjs +11 -5
  69. package/dist/version-manager.mjs.map +1 -1
  70. package/dist/version-manager.test.d.mts +1 -0
  71. package/dist/version-manager.test.mjs +102 -0
  72. package/dist/version-manager.test.mjs.map +1 -0
  73. package/package.json +1 -1
  74. package/src/__snapshots__/composer.snapshot.test.ts.snap +15 -1
  75. package/src/bare-metal-partition.ts +1 -0
  76. package/src/composer.ts +22 -1
  77. package/src/errors.ts +23 -0
  78. package/src/generate.ts +22 -4
  79. package/src/generators/traefik.test.ts +97 -0
  80. package/src/generators/traefik.ts +104 -0
  81. package/src/index.ts +7 -1
  82. package/src/migrations.test.ts +36 -0
  83. package/src/migrations.ts +49 -0
  84. package/src/resolver.ts +37 -3
  85. package/src/schema.ts +1 -0
  86. package/src/services/definitions/caddy.ts +23 -1
  87. package/src/services/definitions/cal-com.ts +91 -0
  88. package/src/services/definitions/grafana.ts +16 -1
  89. package/src/services/definitions/index.ts +9 -0
  90. package/src/services/definitions/neo4j.ts +96 -0
  91. package/src/services/definitions/traefik.ts +0 -2
  92. package/src/services/definitions/xyops.ts +94 -0
  93. package/src/types.ts +5 -1
  94. package/src/validator.ts +16 -0
  95. package/src/version-manager.test.ts +134 -0
  96. package/src/version-manager.ts +12 -5
package/src/resolver.ts CHANGED
@@ -10,6 +10,18 @@ import type {
10
10
  Warning,
11
11
  } from "./types.js";
12
12
 
13
+ export interface MemoryThresholds {
14
+ info: number;
15
+ warning: number;
16
+ critical: number;
17
+ }
18
+
19
+ const DEFAULT_MEMORY_THRESHOLDS: MemoryThresholds = {
20
+ info: 2048,
21
+ warning: 4096,
22
+ critical: 8192,
23
+ };
24
+
13
25
  /**
14
26
  * Resolves user selections into a complete, valid service list.
15
27
  *
@@ -128,6 +140,27 @@ export function resolve(input: ResolverInput): ResolverOutput {
128
140
  }
129
141
  }
130
142
 
143
+ if (iteration >= maxIterations) {
144
+ warnings.push({
145
+ type: "resolution",
146
+ message: `Dependency resolution reached maximum iterations (${maxIterations}). Some transitive dependencies may not be fully resolved.`,
147
+ });
148
+ }
149
+
150
+ // Check recommended services
151
+ for (const id of serviceIds) {
152
+ const def = getServiceById(id);
153
+ if (!def) continue;
154
+ for (const recId of def.recommends) {
155
+ if (!serviceIds.has(recId) && getServiceById(recId)) {
156
+ warnings.push({
157
+ type: "recommendation",
158
+ message: `${def.name} recommends "${recId}" for enhanced functionality`,
159
+ });
160
+ }
161
+ }
162
+ }
163
+
131
164
  // 3. Detect conflicts
132
165
  const resolvedDefs: ServiceDefinition[] = [];
133
166
  for (const id of serviceIds) {
@@ -178,17 +211,18 @@ export function resolve(input: ResolverInput): ResolverOutput {
178
211
  }
179
212
 
180
213
  // Memory warnings
181
- if (estimatedMemoryMB > 8192) {
214
+ const thresholds = input.memoryThresholds ?? DEFAULT_MEMORY_THRESHOLDS;
215
+ if (estimatedMemoryMB > thresholds.critical) {
182
216
  warnings.push({
183
217
  type: "memory",
184
218
  message: `Estimated ${(estimatedMemoryMB / 1024).toFixed(1)}GB RAM required. Ensure your server has sufficient resources.`,
185
219
  });
186
- } else if (estimatedMemoryMB > 4096) {
220
+ } else if (estimatedMemoryMB > thresholds.warning) {
187
221
  warnings.push({
188
222
  type: "memory",
189
223
  message: `Estimated ${(estimatedMemoryMB / 1024).toFixed(1)}GB RAM required. A server with at least 8GB RAM is recommended.`,
190
224
  });
191
- } else if (estimatedMemoryMB > 2048) {
225
+ } else if (estimatedMemoryMB > thresholds.info) {
192
226
  warnings.push({
193
227
  type: "memory",
194
228
  message: `Estimated ${(estimatedMemoryMB / 1024).toFixed(1)}GB RAM required.`,
package/src/schema.ts CHANGED
@@ -201,6 +201,7 @@ export const PresetSchema = z.object({
201
201
  // ─── Generation Input ───────────────────────────────────────────────────────
202
202
 
203
203
  export const GenerationInputSchema = z.object({
204
+ configVersion: z.number().int().min(1).optional(),
204
205
  projectName: z
205
206
  .string()
206
207
  .min(1)
@@ -37,12 +37,34 @@ export const caddyDefinition: ServiceDefinition = {
37
37
  },
38
38
  ],
39
39
  environment: [],
40
+ healthcheck: {
41
+ test: "wget -q --spider http://localhost:80 || exit 1",
42
+ interval: "30s",
43
+ timeout: "10s",
44
+ retries: 3,
45
+ startPeriod: "5s",
46
+ },
40
47
  dependsOn: [],
41
48
  restartPolicy: "unless-stopped",
42
49
  networks: ["openclaw-network"],
43
50
 
44
51
  skills: [],
45
- openclawEnvVars: [],
52
+ openclawEnvVars: [
53
+ {
54
+ key: "CADDY_HOST",
55
+ defaultValue: "caddy",
56
+ secret: false,
57
+ description: "Caddy reverse proxy hostname",
58
+ required: false,
59
+ },
60
+ {
61
+ key: "CADDY_HTTP_PORT",
62
+ defaultValue: "80",
63
+ secret: false,
64
+ description: "Caddy HTTP port",
65
+ required: false,
66
+ },
67
+ ],
46
68
 
47
69
  docsUrl: "https://caddyserver.com/docs/",
48
70
  tags: ["reverse-proxy", "auto-https", "ssl"],
@@ -0,0 +1,91 @@
1
+ import type { ServiceDefinition } from "../../types.js";
2
+
3
+ export const calComDefinition: ServiceDefinition = {
4
+ id: "cal-com",
5
+ name: "Cal.com",
6
+ description:
7
+ "Open-source scheduling platform for appointments, meetings, and booking management with calendar integrations and customizable workflows.",
8
+ category: "automation",
9
+ icon: "📅",
10
+
11
+ image: "calcom/cal.com",
12
+ imageTag: "latest",
13
+ ports: [
14
+ {
15
+ host: 3005,
16
+ container: 3000,
17
+ description: "Cal.com web UI",
18
+ exposed: true,
19
+ },
20
+ ],
21
+ volumes: [],
22
+ environment: [
23
+ {
24
+ key: "DATABASE_URL",
25
+ defaultValue: "postgresql://calcom:${CALCOM_DB_PASSWORD}@postgresql:5432/calcom",
26
+ secret: true,
27
+ description: "PostgreSQL connection URL for Cal.com",
28
+ required: true,
29
+ },
30
+ {
31
+ key: "NEXTAUTH_SECRET",
32
+ defaultValue: "",
33
+ secret: true,
34
+ description: "NextAuth.js session encryption secret",
35
+ required: true,
36
+ },
37
+ {
38
+ key: "CALENDSO_ENCRYPTION_KEY",
39
+ defaultValue: "",
40
+ secret: true,
41
+ description: "Encryption key for calendar data at rest",
42
+ required: true,
43
+ },
44
+ {
45
+ key: "NEXT_PUBLIC_WEBAPP_URL",
46
+ defaultValue: "http://localhost:3005",
47
+ secret: false,
48
+ description: "Public URL of the Cal.com instance",
49
+ required: true,
50
+ },
51
+ ],
52
+ healthcheck: {
53
+ test: "wget -q --spider http://localhost:3000 || exit 1",
54
+ interval: "30s",
55
+ timeout: "10s",
56
+ retries: 3,
57
+ startPeriod: "60s",
58
+ },
59
+ dependsOn: [],
60
+ restartPolicy: "unless-stopped",
61
+ networks: ["openclaw-network"],
62
+
63
+ skills: [],
64
+ openclawEnvVars: [
65
+ {
66
+ key: "CALCOM_HOST",
67
+ defaultValue: "cal-com",
68
+ secret: false,
69
+ description: "Cal.com hostname for OpenClaw",
70
+ required: true,
71
+ },
72
+ {
73
+ key: "CALCOM_PORT",
74
+ defaultValue: "3000",
75
+ secret: false,
76
+ description: "Cal.com port for OpenClaw",
77
+ required: true,
78
+ },
79
+ ],
80
+
81
+ docsUrl: "https://cal.com/docs",
82
+ tags: ["calendar", "scheduling", "booking", "appointments"],
83
+ maturity: "beta",
84
+
85
+ requires: ["postgresql"],
86
+ recommends: ["redis"],
87
+ conflictsWith: [],
88
+
89
+ minMemoryMB: 512,
90
+ gpuRequired: false,
91
+ };
@@ -53,7 +53,22 @@ export const grafanaDefinition: ServiceDefinition = {
53
53
  networks: ["openclaw-network"],
54
54
 
55
55
  skills: [],
56
- openclawEnvVars: [],
56
+ openclawEnvVars: [
57
+ {
58
+ key: "GRAFANA_HOST",
59
+ defaultValue: "grafana",
60
+ secret: false,
61
+ description: "Grafana hostname",
62
+ required: false,
63
+ },
64
+ {
65
+ key: "GRAFANA_PORT",
66
+ defaultValue: "3000",
67
+ secret: false,
68
+ description: "Grafana internal port",
69
+ required: false,
70
+ },
71
+ ],
57
72
 
58
73
  docsUrl: "https://grafana.com/docs/grafana/latest/",
59
74
  tags: ["dashboards", "visualization", "metrics", "monitoring"],
@@ -3,6 +3,7 @@ export { appflowyDefinition } from "./appflowy.js";
3
3
  export { beszelDefinition } from "./beszel.js";
4
4
  export { browserlessDefinition } from "./browserless.js";
5
5
  export { caddyDefinition } from "./caddy.js";
6
+ export { calComDefinition } from "./cal-com.js";
6
7
  export { chromadbDefinition } from "./chromadb.js";
7
8
  export { claudeCodeDefinition } from "./claude-code.js";
8
9
  export { codeServerDefinition } from "./code-server.js";
@@ -39,6 +40,7 @@ export { minioDefinition } from "./minio.js";
39
40
  export { mixpostDefinition } from "./mixpost.js";
40
41
  export { motionCanvasDefinition } from "./motion-canvas.js";
41
42
  export { n8nDefinition } from "./n8n.js";
43
+ export { neo4jDefinition } from "./neo4j.js";
42
44
  export { nocodbDefinition } from "./nocodb.js";
43
45
  export { ntfyDefinition } from "./ntfy.js";
44
46
  export { ollamaDefinition } from "./ollama.js";
@@ -70,6 +72,7 @@ export { valkeyDefinition } from "./valkey.js";
70
72
  export { watchtowerDefinition } from "./watchtower.js";
71
73
  export { weaviateDefinition } from "./weaviate.js";
72
74
  export { whisperDefinition } from "./whisper.js";
75
+ export { xyopsDefinition } from "./xyops.js";
73
76
 
74
77
  import type { ServiceDefinition } from "../../types.js";
75
78
  import { anythingLlmDefinition } from "./anything-llm.js";
@@ -77,6 +80,7 @@ import { appflowyDefinition } from "./appflowy.js";
77
80
  import { beszelDefinition } from "./beszel.js";
78
81
  import { browserlessDefinition } from "./browserless.js";
79
82
  import { caddyDefinition } from "./caddy.js";
83
+ import { calComDefinition } from "./cal-com.js";
80
84
  import { chromadbDefinition } from "./chromadb.js";
81
85
  import { claudeCodeDefinition } from "./claude-code.js";
82
86
  import { codeServerDefinition } from "./code-server.js";
@@ -113,6 +117,7 @@ import { minioDefinition } from "./minio.js";
113
117
  import { mixpostDefinition } from "./mixpost.js";
114
118
  import { motionCanvasDefinition } from "./motion-canvas.js";
115
119
  import { n8nDefinition } from "./n8n.js";
120
+ import { neo4jDefinition } from "./neo4j.js";
116
121
  import { nocodbDefinition } from "./nocodb.js";
117
122
  import { ntfyDefinition } from "./ntfy.js";
118
123
  import { ollamaDefinition } from "./ollama.js";
@@ -144,6 +149,7 @@ import { valkeyDefinition } from "./valkey.js";
144
149
  import { watchtowerDefinition } from "./watchtower.js";
145
150
  import { weaviateDefinition } from "./weaviate.js";
146
151
  import { whisperDefinition } from "./whisper.js";
152
+ import { xyopsDefinition } from "./xyops.js";
147
153
 
148
154
  export const allServiceDefinitions: ServiceDefinition[] = [
149
155
  redisDefinition,
@@ -218,4 +224,7 @@ export const allServiceDefinitions: ServiceDefinition[] = [
218
224
  lasuiteMeetAgentsDefinition,
219
225
  desktopEnvironmentDefinition,
220
226
  streamGatewayDefinition,
227
+ neo4jDefinition,
228
+ calComDefinition,
229
+ xyopsDefinition,
221
230
  ];
@@ -0,0 +1,96 @@
1
+ import type { ServiceDefinition } from "../../types.js";
2
+
3
+ export const neo4jDefinition: ServiceDefinition = {
4
+ id: "neo4j",
5
+ name: "Neo4j",
6
+ description:
7
+ "Graph database platform for connected data, enabling knowledge graphs, fraud detection, and relationship-driven queries with the Cypher query language.",
8
+ category: "database",
9
+ icon: "🔵",
10
+
11
+ image: "neo4j",
12
+ imageTag: "5-community",
13
+ ports: [
14
+ {
15
+ host: 7474,
16
+ container: 7474,
17
+ description: "Neo4j Browser (HTTP)",
18
+ exposed: true,
19
+ },
20
+ {
21
+ host: 7687,
22
+ container: 7687,
23
+ description: "Bolt protocol",
24
+ exposed: true,
25
+ },
26
+ ],
27
+ volumes: [
28
+ {
29
+ name: "neo4j-data",
30
+ containerPath: "/data",
31
+ description: "Persistent Neo4j data",
32
+ },
33
+ ],
34
+ environment: [
35
+ {
36
+ key: "NEO4J_AUTH",
37
+ defaultValue: "neo4j/${NEO4J_PASSWORD}",
38
+ secret: true,
39
+ description: "Neo4j authentication credentials (user/password)",
40
+ required: true,
41
+ },
42
+ ],
43
+ healthcheck: {
44
+ test: "wget -q --spider http://localhost:7474 || exit 1",
45
+ interval: "30s",
46
+ timeout: "10s",
47
+ retries: 3,
48
+ startPeriod: "30s",
49
+ },
50
+ dependsOn: [],
51
+ restartPolicy: "unless-stopped",
52
+ networks: ["openclaw-network"],
53
+
54
+ skills: [],
55
+ openclawEnvVars: [
56
+ {
57
+ key: "NEO4J_HOST",
58
+ defaultValue: "neo4j",
59
+ secret: false,
60
+ description: "Neo4j hostname for OpenClaw",
61
+ required: true,
62
+ },
63
+ {
64
+ key: "NEO4J_BOLT_PORT",
65
+ defaultValue: "7687",
66
+ secret: false,
67
+ description: "Neo4j Bolt protocol port for OpenClaw",
68
+ required: true,
69
+ },
70
+ {
71
+ key: "NEO4J_HTTP_PORT",
72
+ defaultValue: "7474",
73
+ secret: false,
74
+ description: "Neo4j HTTP port for OpenClaw",
75
+ required: true,
76
+ },
77
+ {
78
+ key: "NEO4J_PASSWORD",
79
+ defaultValue: "",
80
+ secret: true,
81
+ description: "Neo4j password for OpenClaw",
82
+ required: true,
83
+ },
84
+ ],
85
+
86
+ docsUrl: "https://neo4j.com/docs/",
87
+ tags: ["graph", "database", "knowledge-graph", "cypher"],
88
+ maturity: "stable",
89
+
90
+ requires: [],
91
+ recommends: [],
92
+ conflictsWith: [],
93
+
94
+ minMemoryMB: 512,
95
+ gpuRequired: false,
96
+ };
@@ -38,8 +38,6 @@ export const traefikDefinition: ServiceDefinition = {
38
38
  },
39
39
  ],
40
40
  environment: [],
41
- command:
42
- "--api.dashboard=true --providers.docker=true --entrypoints.web.address=:80 --entrypoints.websecure.address=:443",
43
41
  dependsOn: [],
44
42
  restartPolicy: "unless-stopped",
45
43
  networks: ["openclaw-network"],
@@ -0,0 +1,94 @@
1
+ import type { ServiceDefinition } from "../../types.js";
2
+
3
+ export const xyopsDefinition: ServiceDefinition = {
4
+ id: "xyops",
5
+ name: "xyOps",
6
+ description:
7
+ "Job scheduling, workflow automation, server monitoring, alerting, and incident response platform with a visual workflow editor and fleet management.",
8
+ category: "automation",
9
+ icon: "⚙️",
10
+
11
+ image: "ghcr.io/pixlcore/xyops",
12
+ imageTag: "latest",
13
+ ports: [
14
+ {
15
+ host: 5522,
16
+ container: 5522,
17
+ description: "xyOps web interface",
18
+ exposed: true,
19
+ },
20
+ {
21
+ host: 5523,
22
+ container: 5523,
23
+ description: "xyOps secondary service",
24
+ exposed: false,
25
+ },
26
+ ],
27
+ volumes: [
28
+ {
29
+ name: "xyops-data",
30
+ containerPath: "/opt/xyops/data",
31
+ description: "Persistent xyOps data and configuration",
32
+ },
33
+ {
34
+ name: "/var/run/docker.sock",
35
+ containerPath: "/var/run/docker.sock",
36
+ description: "Docker socket for container management",
37
+ },
38
+ ],
39
+ environment: [
40
+ {
41
+ key: "TZ",
42
+ defaultValue: "UTC",
43
+ secret: false,
44
+ description: "Timezone for xyOps",
45
+ required: false,
46
+ },
47
+ {
48
+ key: "XYOPS_xysat_local",
49
+ defaultValue: "1",
50
+ secret: false,
51
+ description: "Enable local satellite mode for monitoring the host",
52
+ required: false,
53
+ },
54
+ ],
55
+ healthcheck: {
56
+ test: "wget -q --spider http://localhost:5522 || exit 1",
57
+ interval: "30s",
58
+ timeout: "10s",
59
+ retries: 3,
60
+ startPeriod: "30s",
61
+ },
62
+ dependsOn: [],
63
+ restartPolicy: "unless-stopped",
64
+ networks: ["openclaw-network"],
65
+
66
+ skills: [],
67
+ openclawEnvVars: [
68
+ {
69
+ key: "XYOPS_HOST",
70
+ defaultValue: "xyops",
71
+ secret: false,
72
+ description: "xyOps hostname for OpenClaw",
73
+ required: true,
74
+ },
75
+ {
76
+ key: "XYOPS_PORT",
77
+ defaultValue: "5522",
78
+ secret: false,
79
+ description: "xyOps port for OpenClaw",
80
+ required: true,
81
+ },
82
+ ],
83
+
84
+ docsUrl: "https://github.com/pixlcore/xyops",
85
+ tags: ["scheduling", "automation", "monitoring", "alerting", "incident-response", "workflow"],
86
+ maturity: "stable",
87
+
88
+ requires: [],
89
+ recommends: [],
90
+ conflictsWith: [],
91
+
92
+ minMemoryMB: 256,
93
+ gpuRequired: false,
94
+ };
package/src/types.ts CHANGED
@@ -58,7 +58,10 @@ export type SkillPack = z.infer<typeof SkillPackSchema>;
58
58
  export type Preset = z.infer<typeof PresetSchema>;
59
59
 
60
60
  export type GenerationInput = z.infer<typeof GenerationInputSchema>;
61
- export type ComposeOptions = z.infer<typeof ComposeOptionsSchema>;
61
+ export type ComposeOptions = z.infer<typeof ComposeOptionsSchema> & {
62
+ /** Dynamic Traefik labels per service, computed by the Traefik generator. */
63
+ traefikLabels?: Map<string, Record<string, string>>;
64
+ };
62
65
  export type ResolvedService = z.infer<typeof ResolvedServiceSchema>;
63
66
  export type AddedDependency = z.infer<typeof AddedDependencySchema>;
64
67
  export type Warning = z.infer<typeof WarningSchema>;
@@ -78,6 +81,7 @@ export interface ResolverInput {
78
81
  gpu?: boolean;
79
82
  platform?: Platform;
80
83
  monitoring?: boolean;
84
+ memoryThresholds?: { info: number; warning: number; critical: number };
81
85
  }
82
86
 
83
87
  export interface GeneratedFiles {
package/src/validator.ts CHANGED
@@ -93,6 +93,22 @@ function checkEnvCompleteness(
93
93
  message: `Secret "${envVar.key}" for "${svc.definition.name}" needs to be configured manually`,
94
94
  });
95
95
  }
96
+ if (envVar.validation && envVar.defaultValue) {
97
+ try {
98
+ const regex = new RegExp(envVar.validation);
99
+ if (!regex.test(envVar.defaultValue)) {
100
+ warnings.push({
101
+ type: "env_validation",
102
+ message: `Environment variable "${envVar.key}" for "${svc.definition.name}" default value does not match validation pattern: ${envVar.validation}`,
103
+ });
104
+ }
105
+ } catch {
106
+ warnings.push({
107
+ type: "env_validation",
108
+ message: `Environment variable "${envVar.key}" for "${svc.definition.name}" has invalid validation regex: ${envVar.validation}`,
109
+ });
110
+ }
111
+ }
96
112
  }
97
113
  }
98
114
  }
@@ -0,0 +1,134 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { resolve } from "./resolver.js";
3
+ import { getAllServices, getServiceById } from "./services/registry.js";
4
+ import { checkCompatibility, getImageReference, getImageTag, pinImageTags } from "./version-manager.js";
5
+
6
+ describe("getImageTag", () => {
7
+ it("returns the tag for a known service", () => {
8
+ const tag = getImageTag("redis");
9
+ expect(tag).toBeDefined();
10
+ expect(typeof tag).toBe("string");
11
+ });
12
+
13
+ it("returns undefined for an unknown service", () => {
14
+ expect(getImageTag("nonexistent-service-xyz")).toBeUndefined();
15
+ });
16
+ });
17
+
18
+ describe("getImageReference", () => {
19
+ it("returns image:tag for a known service", () => {
20
+ const ref = getImageReference("redis");
21
+ expect(ref).toBeDefined();
22
+ expect(ref).toContain(":");
23
+ expect(ref).toMatch(/^.+:.+$/);
24
+ });
25
+
26
+ it("returns undefined for an unknown service", () => {
27
+ expect(getImageReference("nonexistent-service-xyz")).toBeUndefined();
28
+ });
29
+ });
30
+
31
+ describe("pinImageTags", () => {
32
+ it("pins image tags from the registry for all services", () => {
33
+ const resolved = resolve({
34
+ services: ["redis", "postgresql"],
35
+ skillPacks: [],
36
+ proxy: "none",
37
+ gpu: false,
38
+ platform: "linux/amd64",
39
+ });
40
+
41
+ const pinned = pinImageTags(resolved);
42
+
43
+ expect(pinned.services).toHaveLength(resolved.services.length);
44
+
45
+ for (const svc of pinned.services) {
46
+ expect(svc.definition.imageTag).toBeDefined();
47
+ expect(typeof svc.definition.imageTag).toBe("string");
48
+ expect(svc.definition.imageTag.length).toBeGreaterThan(0);
49
+ }
50
+ });
51
+
52
+ it("does not mutate the original resolved output", () => {
53
+ const resolved = resolve({
54
+ services: ["redis"],
55
+ skillPacks: [],
56
+ proxy: "none",
57
+ gpu: false,
58
+ platform: "linux/amd64",
59
+ });
60
+
61
+ const originalTag = resolved.services[0]?.definition.imageTag;
62
+ pinImageTags(resolved);
63
+
64
+ expect(resolved.services[0]?.definition.imageTag).toBe(originalTag);
65
+ });
66
+
67
+ it("preserves non-tag properties", () => {
68
+ const resolved = resolve({
69
+ services: ["redis"],
70
+ skillPacks: [],
71
+ proxy: "none",
72
+ gpu: false,
73
+ platform: "linux/amd64",
74
+ });
75
+
76
+ const pinned = pinImageTags(resolved);
77
+ expect(pinned.services[0]?.definition.id).toBe("redis");
78
+ expect(pinned.services[0]?.definition.name).toBe("Redis");
79
+ expect(pinned.estimatedMemoryMB).toBe(resolved.estimatedMemoryMB);
80
+ });
81
+ });
82
+
83
+ describe("checkCompatibility", () => {
84
+ it("warns when Redis and Valkey are both selected", () => {
85
+ const all = getAllServices();
86
+ const redis = all.find((s) => s.id === "redis");
87
+ const valkey = all.find((s) => s.id === "valkey");
88
+
89
+ if (redis && valkey) {
90
+ const warnings = checkCompatibility([redis, valkey]);
91
+ expect(warnings.some((w) => w.message.includes("Redis") && w.message.includes("Valkey"))).toBe(true);
92
+ }
93
+ });
94
+
95
+ it("warns when Caddy and Traefik are both selected", () => {
96
+ const all = getAllServices();
97
+ const caddy = all.find((s) => s.id === "caddy");
98
+ const traefik = all.find((s) => s.id === "traefik");
99
+
100
+ if (caddy && traefik) {
101
+ const warnings = checkCompatibility([caddy, traefik]);
102
+ expect(warnings.some((w) => w.message.includes("Caddy") && w.message.includes("Traefik"))).toBe(true);
103
+ }
104
+ });
105
+
106
+ it("warns about multiple vector databases", () => {
107
+ const all = getAllServices();
108
+ const qdrant = all.find((s) => s.id === "qdrant");
109
+ const chromadb = all.find((s) => s.id === "chromadb");
110
+
111
+ if (qdrant && chromadb) {
112
+ const warnings = checkCompatibility([qdrant, chromadb]);
113
+ expect(warnings.some((w) => w.message.includes("vector database"))).toBe(true);
114
+ }
115
+ });
116
+
117
+ it("warns about GPU services", () => {
118
+ const all = getAllServices();
119
+ const gpuService = all.find((s) => s.gpuRequired);
120
+
121
+ if (gpuService) {
122
+ const warnings = checkCompatibility([gpuService]);
123
+ expect(warnings.some((w) => w.message.includes("GPU"))).toBe(true);
124
+ }
125
+ });
126
+
127
+ it("returns no warnings for a single non-conflicting service", () => {
128
+ const redis = getServiceById("redis");
129
+ if (redis) {
130
+ const warnings = checkCompatibility([redis]);
131
+ expect(warnings.filter((w) => w.type === "compatibility" && !w.message.includes("GPU"))).toHaveLength(0);
132
+ }
133
+ });
134
+ });
@@ -14,14 +14,21 @@ export function getImageReference(serviceId: string): string | undefined {
14
14
  return `${svc.image}:${svc.imageTag}`;
15
15
  }
16
16
 
17
- /** Pin all service image tags in a resolved output (returns a copy) */
17
+ /** Pin all service image tags to the registry-defined versions (returns a copy) */
18
18
  export function pinImageTags(resolved: ResolverOutput): ResolverOutput {
19
19
  return {
20
20
  ...resolved,
21
- services: resolved.services.map((s) => ({
22
- ...s,
23
- definition: { ...s.definition },
24
- })),
21
+ services: resolved.services.map((s) => {
22
+ const registryDef = getServiceById(s.definition.id);
23
+ const pinnedTag = registryDef?.imageTag ?? s.definition.imageTag;
24
+ return {
25
+ ...s,
26
+ definition: {
27
+ ...s.definition,
28
+ imageTag: pinnedTag,
29
+ },
30
+ };
31
+ }),
25
32
  };
26
33
  }
27
34