@better-openclaw/core 1.0.13 → 1.0.14

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 (39) hide show
  1. package/dist/composer.mjs.map +1 -1
  2. package/dist/generate.d.mts.map +1 -1
  3. package/dist/generate.mjs +11 -0
  4. package/dist/generate.mjs.map +1 -1
  5. package/dist/generators/env.d.mts.map +1 -1
  6. package/dist/generators/env.mjs +21 -1
  7. package/dist/generators/env.mjs.map +1 -1
  8. package/dist/generators/get-shit-done.d.mts +10 -0
  9. package/dist/generators/get-shit-done.d.mts.map +1 -0
  10. package/dist/generators/get-shit-done.mjs +38 -0
  11. package/dist/generators/get-shit-done.mjs.map +1 -0
  12. package/dist/generators/openclaw-json.d.mts +11 -0
  13. package/dist/generators/openclaw-json.d.mts.map +1 -0
  14. package/dist/generators/openclaw-json.mjs +410 -0
  15. package/dist/generators/openclaw-json.mjs.map +1 -0
  16. package/dist/index.d.mts +2 -2
  17. package/dist/resolver.mjs +3 -1
  18. package/dist/resolver.mjs.map +1 -1
  19. package/dist/schema.d.mts +81 -1
  20. package/dist/schema.d.mts.map +1 -1
  21. package/dist/schema.mjs +28 -2
  22. package/dist/schema.mjs.map +1 -1
  23. package/dist/services/definitions/pentagi.mjs.map +1 -1
  24. package/dist/services/definitions/pentestagent.mjs.map +1 -1
  25. package/dist/types.d.mts +6 -2
  26. package/dist/types.d.mts.map +1 -1
  27. package/dist/types.mjs.map +1 -1
  28. package/package.json +1 -1
  29. package/src/composer.ts +1 -1
  30. package/src/generate.ts +15 -0
  31. package/src/generators/env.ts +26 -0
  32. package/src/generators/get-shit-done.ts +43 -0
  33. package/src/generators/openclaw-json.ts +406 -0
  34. package/src/index.ts +2 -0
  35. package/src/resolver.ts +10 -8
  36. package/src/schema.ts +23 -0
  37. package/src/services/definitions/pentagi.ts +2 -1
  38. package/src/services/definitions/pentestagent.ts +2 -1
  39. package/src/types.ts +6 -0
@@ -1 +1 @@
1
- {"version":3,"file":"composer.mjs","names":[],"sources":["../src/composer.ts"],"sourcesContent":["import { stringify } from \"yaml\";\nimport type { ComposeOptions, ResolverOutput, ServiceCategory } from \"./types.js\";\n\n// ── Public Types ────────────────────────────────────────────────────────────\n\nexport interface ComposeResult {\n\tfiles: Record<string, string>; // filename -> YAML content\n\tmainFile: string; // \"docker-compose.yml\"\n\tprofiles: string[]; // list of profiles used\n}\n\n// ── Category → Profile Mapping ──────────────────────────────────────────────\n\nconst CATEGORY_PROFILE_MAP: Partial<Record<ServiceCategory, { file: string; profile: string }>> = {\n\tai: { file: \"docker-compose.ai.yml\", profile: \"ai\" },\n\t\"ai-platform\": { file: \"docker-compose.ai.yml\", profile: \"ai\" },\n\tmedia: { file: \"docker-compose.media.yml\", profile: \"media\" },\n\tmonitoring: { file: \"docker-compose.monitoring.yml\", profile: \"monitoring\" },\n\tanalytics: { file: \"docker-compose.monitoring.yml\", profile: \"monitoring\" },\n\t\"dev-tools\": { file: \"docker-compose.tools.yml\", profile: \"tools\" },\n\t\"coding-agent\": { file: \"docker-compose.tools.yml\", profile: \"tools\" },\n\t\"social-media\": { file: \"docker-compose.social.yml\", profile: \"social\" },\n\tknowledge: { file: \"docker-compose.knowledge.yml\", profile: \"knowledge\" },\n\tcommunication: { file: \"docker-compose.communication.yml\", profile: \"communication\" },\n};\n\nconst YAML_OPTIONS = { lineWidth: 120, nullStr: \"\" };\n\n// ── Shared Gateway Builder ──────────────────────────────────────────────────\n\ninterface GatewayBuildResult {\n\tgatewayService: Record<string, unknown>;\n\tcliService: Record<string, unknown>;\n\tallVolumes: Set<string>;\n}\n\n/**\n * Builds the OpenClaw gateway and CLI service entries.\n * Matches the real OpenClaw docker-compose.yml structure:\n * - Bridge port 18790 for ACP/WebSocket\n * - Bind-mount volumes (not named volumes)\n * - Claude web-provider session env vars\n * - Gateway bind mode (--bind lan)\n * - CLI companion service with stdin/tty\n */\nfunction buildGatewayServices(\n\tresolved: ResolverOutput,\n\toptions: ComposeOptions,\n\tdependsOn?: Record<string, { condition: string }>,\n): GatewayBuildResult {\n\tconst allVolumes = new Set<string>();\n\n\t// Gateway environment\n\tconst gatewayEnv: Record<string, string> = {\n\t\tHOME: \"/home/node\",\n\t\tTERM: \"xterm-256color\",\n\t\tOPENCLAW_GATEWAY_TOKEN: \"${OPENCLAW_GATEWAY_TOKEN}\",\n\t\t// Claude web-provider session vars (optional, user fills in .env)\n\t\tCLAUDE_AI_SESSION_KEY: \"${CLAUDE_AI_SESSION_KEY}\",\n\t\tCLAUDE_WEB_SESSION_KEY: \"${CLAUDE_WEB_SESSION_KEY}\",\n\t\tCLAUDE_WEB_COOKIE: \"${CLAUDE_WEB_COOKIE}\",\n\t};\n\n\t// Gateway volumes (bind-mount style matching real docker-setup.sh)\n\tconst gatewayVolumes: string[] = [\n\t\t\"${OPENCLAW_CONFIG_DIR:-./openclaw/config}:/home/node/.openclaw\",\n\t\t\"${OPENCLAW_WORKSPACE_DIR:-./openclaw/workspace}:/home/node/.openclaw/workspace\",\n\t];\n\n\t// Collect env vars and volume mounts from companion services\n\tfor (const { definition: def } of resolved.services) {\n\t\tfor (const env of def.openclawEnvVars) {\n\t\t\tgatewayEnv[env.key] = env.secret ? `\\${${env.key}}` : env.defaultValue;\n\t\t}\n\t\tif (def.openclawVolumeMounts) {\n\t\t\tfor (const vol of def.openclawVolumeMounts) {\n\t\t\t\tconst isBindMount =\n\t\t\t\t\tvol.name.startsWith(\"./\") || vol.name.startsWith(\"/\") || vol.name.startsWith(\"~\");\n\t\t\t\tif (!isBindMount) {\n\t\t\t\t\tallVolumes.add(vol.name);\n\t\t\t\t}\n\t\t\t\tgatewayVolumes.push(`${vol.name}:${vol.containerPath}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Gateway service\n\tconst gateway: Record<string, unknown> = {\n\t\timage: `\\${OPENCLAW_IMAGE:-ghcr.io/openclaw/openclaw:${options.openclawVersion}}`,\n\t\tenvironment: gatewayEnv,\n\t\tvolumes: gatewayVolumes,\n\t\tports: [\"${OPENCLAW_GATEWAY_PORT:-18789}:18789\", \"${OPENCLAW_BRIDGE_PORT:-18790}:18790\"],\n\t\tnetworks: [\"openclaw-network\"],\n\t\tinit: true,\n\t\trestart: \"unless-stopped\",\n\t\tcommand: [\n\t\t\t\"node\",\n\t\t\t\"dist/index.js\",\n\t\t\t\"gateway\",\n\t\t\t\"--bind\",\n\t\t\t\"${OPENCLAW_GATEWAY_BIND:-lan}\",\n\t\t\t\"--port\",\n\t\t\t\"18789\",\n\t\t],\n\t};\n\n\t// Traefik labels for the gateway\n\tconst gwTraefikLabels = options.traefikLabels?.get(\"openclaw-gateway\");\n\tif (gwTraefikLabels) {\n\t\tgateway.labels = gwTraefikLabels;\n\t}\n\n\tif (options.bareMetalNativeHost) {\n\t\tgateway.extra_hosts = [\"host.docker.internal:host-gateway\"];\n\t}\n\n\tif (dependsOn && Object.keys(dependsOn).length > 0) {\n\t\tgateway.depends_on = dependsOn;\n\t}\n\n\t// CLI companion service (matching real OpenClaw docker-compose.yml)\n\tconst cliService: Record<string, unknown> = {\n\t\timage: `\\${OPENCLAW_IMAGE:-ghcr.io/openclaw/openclaw:${options.openclawVersion}}`,\n\t\tenvironment: {\n\t\t\tHOME: \"/home/node\",\n\t\t\tTERM: \"xterm-256color\",\n\t\t\tOPENCLAW_GATEWAY_TOKEN: \"${OPENCLAW_GATEWAY_TOKEN}\",\n\t\t\tBROWSER: \"echo\",\n\t\t\tCLAUDE_AI_SESSION_KEY: \"${CLAUDE_AI_SESSION_KEY}\",\n\t\t\tCLAUDE_WEB_SESSION_KEY: \"${CLAUDE_WEB_SESSION_KEY}\",\n\t\t\tCLAUDE_WEB_COOKIE: \"${CLAUDE_WEB_COOKIE}\",\n\t\t},\n\t\tvolumes: [\n\t\t\t\"${OPENCLAW_CONFIG_DIR:-./openclaw/config}:/home/node/.openclaw\",\n\t\t\t\"${OPENCLAW_WORKSPACE_DIR:-./openclaw/workspace}:/home/node/.openclaw/workspace\",\n\t\t],\n\t\tstdin_open: true,\n\t\ttty: true,\n\t\tinit: true,\n\t\tnetworks: [\"openclaw-network\"],\n\t\tentrypoint: [\"node\", \"dist/index.js\"],\n\t};\n\n\treturn { gatewayService: gateway, cliService: cliService, allVolumes };\n}\n\n// ── Shared Companion Service Builder ────────────────────────────────────────\n\nfunction buildCompanionService(\n\tdef: ResolverOutput[\"services\"][number][\"definition\"],\n\tresolved: ResolverOutput,\n\toptions: ComposeOptions,\n\tallVolumes: Set<string>,\n): { entry: Record<string, unknown>; volumeNames: string[] } {\n\tconst svc: Record<string, unknown> = {};\n\tconst volumeNames: string[] = [];\n\n\tsvc.image = `${def.image}:${def.imageTag}`;\n\n\tif (def.environment.length > 0) {\n\t\tconst env: Record<string, string> = {};\n\t\tfor (const e of def.environment) {\n\t\t\tenv[e.key] = e.secret ? `\\${${e.key}}` : e.defaultValue;\n\t\t}\n\t\tsvc.environment = env;\n\t}\n\n\tconst exposedPorts = def.ports.filter((p) => p.exposed);\n\tif (exposedPorts.length > 0) {\n\t\tconst prefix = def.id.toUpperCase().replace(/-/g, \"_\");\n\t\tsvc.ports = exposedPorts.map((p, i) => {\n\t\t\tconst suffix = exposedPorts.length > 1 ? `_${i}` : \"\";\n\t\t\treturn `\\${${prefix}_PORT${suffix}:-${p.host}}:${p.container}`;\n\t\t});\n\t}\n\n\tif (def.volumes.length > 0) {\n\t\tsvc.volumes = def.volumes.map((v) => {\n\t\t\tconst isBindMount =\n\t\t\t\tv.name.startsWith(\"./\") || v.name.startsWith(\"/\") || v.name.startsWith(\"~\");\n\t\t\t\n\t\t\tif (!isBindMount) {\n\t\t\t\tallVolumes.add(v.name);\n\t\t\t\tvolumeNames.push(v.name);\n\t\t\t}\n\t\t\treturn `${v.name}:${v.containerPath}`;\n\t\t});\n\t}\n\n\t// PostgreSQL: mount the init script for creating per-service databases\n\tif (def.id === \"postgresql\") {\n\t\tif (!svc.volumes) svc.volumes = [];\n\t\t(svc.volumes as string[]).push(\n\t\t\t\"./postgres/init-databases.sh:/docker-entrypoint-initdb.d/init-databases.sh:ro\",\n\t\t);\n\t}\n\n\tif (def.healthcheck) {\n\t\tconst hc: Record<string, unknown> = {\n\t\t\ttest: [\"CMD-SHELL\", def.healthcheck.test],\n\t\t\tinterval: def.healthcheck.interval,\n\t\t\ttimeout: def.healthcheck.timeout,\n\t\t\tretries: def.healthcheck.retries,\n\t\t};\n\t\tif (def.healthcheck.startPeriod) {\n\t\t\thc.start_period = def.healthcheck.startPeriod;\n\t\t}\n\t\tsvc.healthcheck = hc;\n\t}\n\n\tsvc.restart = def.restartPolicy;\n\tsvc.networks = def.networks;\n\n\tif (def.command) svc.command = def.command;\n\tif (def.entrypoint) svc.entrypoint = def.entrypoint;\n\n\t// Labels: merge static definition labels with dynamic Traefik labels\n\tconst mergedLabels: Record<string, string> = {};\n\tif (def.labels) Object.assign(mergedLabels, def.labels);\n\tconst traefikLabels = options.traefikLabels?.get(def.id);\n\tif (traefikLabels) Object.assign(mergedLabels, traefikLabels);\n\tif (Object.keys(mergedLabels).length > 0) svc.labels = mergedLabels;\n\n\t// Traefik: bind-mount static config and Docker socket\n\tif (def.id === \"traefik\" && options.traefikLabels) {\n\t\tif (!svc.volumes) svc.volumes = [];\n\t\t(svc.volumes as string[]).push(\n\t\t\t\"./traefik/traefik.yml:/etc/traefik/traefik.yml:ro\",\n\t\t\t\"/var/run/docker.sock:/var/run/docker.sock:ro\",\n\t\t);\n\t}\n\n\tlet deploy: Record<string, unknown> | undefined;\n\tif (def.deploy) {\n\t\tdeploy = JSON.parse(JSON.stringify(def.deploy)) as Record<string, unknown>;\n\t}\n\tif (options.gpu && def.gpuRequired) {\n\t\tconst base = deploy ?? {};\n\t\tconst resources = (base.resources ?? {}) as Record<string, unknown>;\n\t\tdeploy = {\n\t\t\t...base,\n\t\t\tresources: {\n\t\t\t\t...resources,\n\t\t\t\treservations: {\n\t\t\t\t\t...((resources.reservations as Record<string, unknown>) ?? {}),\n\t\t\t\t\tdevices: [{ driver: \"nvidia\", count: \"all\", capabilities: [\"gpu\"] }],\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\tif (deploy) svc.deploy = deploy;\n\n\t// Merge both dependsOn and requires to ensure proper Docker startup ordering\n\tconst depIds = [...new Set([...def.dependsOn, ...def.requires])].filter((id) =>\n\t\tresolved.services.some((s) => s.definition.id === id),\n\t);\n\tif (depIds.length > 0) {\n\t\tconst dependsOn: Record<string, { condition: string }> = {};\n\t\tfor (const depId of depIds) {\n\t\t\tconst dep = resolved.services.find((s) => s.definition.id === depId);\n\t\t\tdependsOn[depId] = {\n\t\t\t\tcondition: dep?.definition.healthcheck ? \"service_healthy\" : \"service_started\",\n\t\t\t};\n\t\t}\n\t\tsvc.depends_on = dependsOn;\n\t}\n\n\treturn { entry: svc, volumeNames };\n}\n\n// ── Single-File Compose ─────────────────────────────────────────────────────\n\n/**\n * Generates a single Docker Compose YAML string with ALL services.\n * Backward-compatible signature.\n */\nexport function compose(resolved: ResolverOutput, options: ComposeOptions): string {\n\t// Build depends_on for ALL companion services\n\tconst gatewayDependsOn: Record<string, { condition: string }> = {};\n\tfor (const { definition: def } of resolved.services) {\n\t\tgatewayDependsOn[def.id] = {\n\t\t\tcondition: def.healthcheck ? \"service_healthy\" : \"service_started\",\n\t\t};\n\t}\n\n\tconst { gatewayService, cliService, allVolumes } = buildGatewayServices(\n\t\tresolved,\n\t\toptions,\n\t\tgatewayDependsOn,\n\t);\n\n\tconst services: Record<string, Record<string, unknown>> = {\n\t\t\"openclaw-gateway\": gatewayService,\n\t};\n\n\tfor (const { definition: def } of resolved.services) {\n\t\tconst { entry } = buildCompanionService(def, resolved, options, allVolumes);\n\t\tservices[def.id] = entry;\n\t}\n\n\t// Add CLI service\n\tservices[\"openclaw-cli\"] = cliService;\n\n\tconst volumes: Record<string, null> = {};\n\tfor (const v of [...allVolumes].sort()) {\n\t\tvolumes[v] = null;\n\t}\n\n\tconst networks = { \"openclaw-network\": { driver: \"bridge\" } };\n\n\treturn stringify({ services, volumes, networks }, YAML_OPTIONS);\n}\n\n// ── Multi-File Compose ──────────────────────────────────────────────────────\n\ninterface ServiceInfo {\n\tid: string;\n\tcategory: ServiceCategory;\n\tentry: Record<string, unknown>;\n\tvolumeNames: string[];\n}\n\n/**\n * Generates multiple Docker Compose files, splitting services into profile-based\n * override files by category.\n */\nexport function composeMultiFile(resolved: ResolverOutput, options: ComposeOptions): ComposeResult {\n\tconst allVolumes = new Set<string>();\n\n\t// Build all companion service entries & classify by category\n\tconst serviceInfos: ServiceInfo[] = [];\n\n\tfor (const { definition: def } of resolved.services) {\n\t\tconst { entry, volumeNames } = buildCompanionService(def, resolved, options, allVolumes);\n\t\tserviceInfos.push({ id: def.id, category: def.category, entry, volumeNames });\n\t}\n\n\t// Partition services into base vs. profile files\n\tconst baseServiceIds = new Set<string>();\n\tconst profileFileMap: Record<string, { profile: string; services: ServiceInfo[] }> = {};\n\n\tfor (const info of serviceInfos) {\n\t\tconst mapping = CATEGORY_PROFILE_MAP[info.category];\n\t\tif (mapping) {\n\t\t\tif (!profileFileMap[mapping.file]) {\n\t\t\t\tprofileFileMap[mapping.file] = { profile: mapping.profile, services: [] };\n\t\t\t}\n\t\t\tprofileFileMap[mapping.file]!.services.push(info);\n\t\t} else {\n\t\t\tbaseServiceIds.add(info.id);\n\t\t}\n\t}\n\n\t// Gateway depends_on (only base services)\n\tconst gatewayDependsOn: Record<string, { condition: string }> = {};\n\tfor (const { definition: def } of resolved.services) {\n\t\tif (baseServiceIds.has(def.id)) {\n\t\t\tgatewayDependsOn[def.id] = {\n\t\t\t\tcondition: def.healthcheck ? \"service_healthy\" : \"service_started\",\n\t\t\t};\n\t\t}\n\t}\n\n\tconst {\n\t\tgatewayService,\n\t\tcliService,\n\t\tallVolumes: gwVolumes,\n\t} = buildGatewayServices(resolved, options, gatewayDependsOn);\n\n\t// Merge gateway volumes into allVolumes\n\tfor (const v of gwVolumes) allVolumes.add(v);\n\n\t// Base file: gateway + CLI + core services + ALL volumes + networks\n\tconst baseServices: Record<string, Record<string, unknown>> = {\n\t\t\"openclaw-gateway\": gatewayService,\n\t};\n\n\tfor (const info of serviceInfos) {\n\t\tif (baseServiceIds.has(info.id)) {\n\t\t\tbaseServices[info.id] = info.entry;\n\t\t}\n\t}\n\n\tbaseServices[\"openclaw-cli\"] = cliService;\n\n\tconst sortedAllVolumes: Record<string, null> = {};\n\tfor (const v of [...allVolumes].sort()) {\n\t\tsortedAllVolumes[v] = null;\n\t}\n\n\tconst networks = { \"openclaw-network\": { driver: \"bridge\" } };\n\n\tconst files: Record<string, string> = {};\n\tfiles[\"docker-compose.yml\"] = stringify(\n\t\t{ services: baseServices, volumes: sortedAllVolumes, networks },\n\t\tYAML_OPTIONS,\n\t);\n\n\t// Profile override files\n\tconst usedProfiles = new Set<string>();\n\n\tfor (const [fileName, { profile, services }] of Object.entries(profileFileMap)) {\n\t\tusedProfiles.add(profile);\n\n\t\tconst profileServices: Record<string, Record<string, unknown>> = {};\n\t\tconst profileVolumes = new Set<string>();\n\n\t\tfor (const info of services) {\n\t\t\tprofileServices[info.id] = { ...info.entry, profiles: [profile] };\n\t\t\tfor (const vName of info.volumeNames) {\n\t\t\t\tprofileVolumes.add(vName);\n\t\t\t}\n\t\t}\n\n\t\tconst fileContent: Record<string, unknown> = { services: profileServices };\n\n\t\tif (profileVolumes.size > 0) {\n\t\t\tconst sortedProfileVolumes: Record<string, null> = {};\n\t\t\tfor (const v of [...profileVolumes].sort()) {\n\t\t\t\tsortedProfileVolumes[v] = null;\n\t\t\t}\n\t\t\tfileContent.volumes = sortedProfileVolumes;\n\t\t}\n\n\t\tfiles[fileName] = stringify(fileContent, YAML_OPTIONS);\n\t}\n\n\treturn {\n\t\tfiles,\n\t\tmainFile: \"docker-compose.yml\",\n\t\tprofiles: [...usedProfiles].sort(),\n\t};\n}\n"],"mappings":";;;AAaA,MAAM,uBAA4F;CACjG,IAAI;EAAE,MAAM;EAAyB,SAAS;EAAM;CACpD,eAAe;EAAE,MAAM;EAAyB,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CAAC,GAAG,WAAW,CAAC,MAAM,CACrC,kBAAiB,KAAK;CAGvB,MAAM,WAAW,EAAE,oBAAoB,EAAE,QAAQ,UAAU,EAAE;CAE7D,MAAM,QAAgC,EAAE;AACxC,OAAM,wBAAwB,UAC7B;EAAE,UAAU;EAAc,SAAS;EAAkB;EAAU,EAC/D,aACA;CAGD,MAAM,+BAAe,IAAI,KAAa;AAEtC,MAAK,MAAM,CAAC,UAAU,EAAE,SAAS,eAAe,OAAO,QAAQ,eAAe,EAAE;AAC/E,eAAa,IAAI,QAAQ;EAEzB,MAAM,kBAA2D,EAAE;EACnE,MAAM,iCAAiB,IAAI,KAAa;AAExC,OAAK,MAAM,QAAQ,UAAU;AAC5B,mBAAgB,KAAK,MAAM;IAAE,GAAG,KAAK;IAAO,UAAU,CAAC,QAAQ;IAAE;AACjE,QAAK,MAAM,SAAS,KAAK,YACxB,gBAAe,IAAI,MAAM;;EAI3B,MAAM,cAAuC,EAAE,UAAU,iBAAiB;AAE1E,MAAI,eAAe,OAAO,GAAG;GAC5B,MAAM,uBAA6C,EAAE;AACrD,QAAK,MAAM,KAAK,CAAC,GAAG,eAAe,CAAC,MAAM,CACzC,sBAAqB,KAAK;AAE3B,eAAY,UAAU;;AAGvB,QAAM,YAAY,UAAU,aAAa,aAAa;;AAGvD,QAAO;EACN;EACA,UAAU;EACV,UAAU,CAAC,GAAG,aAAa,CAAC,MAAM;EAClC"}
1
+ {"version":3,"file":"composer.mjs","names":[],"sources":["../src/composer.ts"],"sourcesContent":["import { stringify } from \"yaml\";\nimport type { ComposeOptions, ResolverOutput, ServiceCategory } from \"./types.js\";\n\n// ── Public Types ────────────────────────────────────────────────────────────\n\nexport interface ComposeResult {\n\tfiles: Record<string, string>; // filename -> YAML content\n\tmainFile: string; // \"docker-compose.yml\"\n\tprofiles: string[]; // list of profiles used\n}\n\n// ── Category → Profile Mapping ──────────────────────────────────────────────\n\nconst CATEGORY_PROFILE_MAP: Partial<Record<ServiceCategory, { file: string; profile: string }>> = {\n\tai: { file: \"docker-compose.ai.yml\", profile: \"ai\" },\n\t\"ai-platform\": { file: \"docker-compose.ai.yml\", profile: \"ai\" },\n\tmedia: { file: \"docker-compose.media.yml\", profile: \"media\" },\n\tmonitoring: { file: \"docker-compose.monitoring.yml\", profile: \"monitoring\" },\n\tanalytics: { file: \"docker-compose.monitoring.yml\", profile: \"monitoring\" },\n\t\"dev-tools\": { file: \"docker-compose.tools.yml\", profile: \"tools\" },\n\t\"coding-agent\": { file: \"docker-compose.tools.yml\", profile: \"tools\" },\n\t\"social-media\": { file: \"docker-compose.social.yml\", profile: \"social\" },\n\tknowledge: { file: \"docker-compose.knowledge.yml\", profile: \"knowledge\" },\n\tcommunication: { file: \"docker-compose.communication.yml\", profile: \"communication\" },\n};\n\nconst YAML_OPTIONS = { lineWidth: 120, nullStr: \"\" };\n\n// ── Shared Gateway Builder ──────────────────────────────────────────────────\n\ninterface GatewayBuildResult {\n\tgatewayService: Record<string, unknown>;\n\tcliService: Record<string, unknown>;\n\tallVolumes: Set<string>;\n}\n\n/**\n * Builds the OpenClaw gateway and CLI service entries.\n * Matches the real OpenClaw docker-compose.yml structure:\n * - Bridge port 18790 for ACP/WebSocket\n * - Bind-mount volumes (not named volumes)\n * - Claude web-provider session env vars\n * - Gateway bind mode (--bind lan)\n * - CLI companion service with stdin/tty\n */\nfunction buildGatewayServices(\n\tresolved: ResolverOutput,\n\toptions: ComposeOptions,\n\tdependsOn?: Record<string, { condition: string }>,\n): GatewayBuildResult {\n\tconst allVolumes = new Set<string>();\n\n\t// Gateway environment\n\tconst gatewayEnv: Record<string, string> = {\n\t\tHOME: \"/home/node\",\n\t\tTERM: \"xterm-256color\",\n\t\tOPENCLAW_GATEWAY_TOKEN: \"${OPENCLAW_GATEWAY_TOKEN}\",\n\t\t// Claude web-provider session vars (optional, user fills in .env)\n\t\tCLAUDE_AI_SESSION_KEY: \"${CLAUDE_AI_SESSION_KEY}\",\n\t\tCLAUDE_WEB_SESSION_KEY: \"${CLAUDE_WEB_SESSION_KEY}\",\n\t\tCLAUDE_WEB_COOKIE: \"${CLAUDE_WEB_COOKIE}\",\n\t};\n\n\t// Gateway volumes (bind-mount style matching real docker-setup.sh)\n\tconst gatewayVolumes: string[] = [\n\t\t\"${OPENCLAW_CONFIG_DIR:-./openclaw/config}:/home/node/.openclaw\",\n\t\t\"${OPENCLAW_WORKSPACE_DIR:-./openclaw/workspace}:/home/node/.openclaw/workspace\",\n\t];\n\n\t// Collect env vars and volume mounts from companion services\n\tfor (const { definition: def } of resolved.services) {\n\t\tfor (const env of def.openclawEnvVars) {\n\t\t\tgatewayEnv[env.key] = env.secret ? `\\${${env.key}}` : env.defaultValue;\n\t\t}\n\t\tif (def.openclawVolumeMounts) {\n\t\t\tfor (const vol of def.openclawVolumeMounts) {\n\t\t\t\tconst isBindMount =\n\t\t\t\t\tvol.name.startsWith(\"./\") || vol.name.startsWith(\"/\") || vol.name.startsWith(\"~\");\n\t\t\t\tif (!isBindMount) {\n\t\t\t\t\tallVolumes.add(vol.name);\n\t\t\t\t}\n\t\t\t\tgatewayVolumes.push(`${vol.name}:${vol.containerPath}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Gateway service\n\tconst gateway: Record<string, unknown> = {\n\t\timage: `\\${OPENCLAW_IMAGE:-ghcr.io/openclaw/openclaw:${options.openclawVersion}}`,\n\t\tenvironment: gatewayEnv,\n\t\tvolumes: gatewayVolumes,\n\t\tports: [\"${OPENCLAW_GATEWAY_PORT:-18789}:18789\", \"${OPENCLAW_BRIDGE_PORT:-18790}:18790\"],\n\t\tnetworks: [\"openclaw-network\"],\n\t\tinit: true,\n\t\trestart: \"unless-stopped\",\n\t\tcommand: [\n\t\t\t\"node\",\n\t\t\t\"dist/index.js\",\n\t\t\t\"gateway\",\n\t\t\t\"--bind\",\n\t\t\t\"${OPENCLAW_GATEWAY_BIND:-lan}\",\n\t\t\t\"--port\",\n\t\t\t\"18789\",\n\t\t],\n\t};\n\n\t// Traefik labels for the gateway\n\tconst gwTraefikLabels = options.traefikLabels?.get(\"openclaw-gateway\");\n\tif (gwTraefikLabels) {\n\t\tgateway.labels = gwTraefikLabels;\n\t}\n\n\tif (options.bareMetalNativeHost) {\n\t\tgateway.extra_hosts = [\"host.docker.internal:host-gateway\"];\n\t}\n\n\tif (dependsOn && Object.keys(dependsOn).length > 0) {\n\t\tgateway.depends_on = dependsOn;\n\t}\n\n\t// CLI companion service (matching real OpenClaw docker-compose.yml)\n\tconst cliService: Record<string, unknown> = {\n\t\timage: `\\${OPENCLAW_IMAGE:-ghcr.io/openclaw/openclaw:${options.openclawVersion}}`,\n\t\tenvironment: {\n\t\t\tHOME: \"/home/node\",\n\t\t\tTERM: \"xterm-256color\",\n\t\t\tOPENCLAW_GATEWAY_TOKEN: \"${OPENCLAW_GATEWAY_TOKEN}\",\n\t\t\tBROWSER: \"echo\",\n\t\t\tCLAUDE_AI_SESSION_KEY: \"${CLAUDE_AI_SESSION_KEY}\",\n\t\t\tCLAUDE_WEB_SESSION_KEY: \"${CLAUDE_WEB_SESSION_KEY}\",\n\t\t\tCLAUDE_WEB_COOKIE: \"${CLAUDE_WEB_COOKIE}\",\n\t\t},\n\t\tvolumes: [\n\t\t\t\"${OPENCLAW_CONFIG_DIR:-./openclaw/config}:/home/node/.openclaw\",\n\t\t\t\"${OPENCLAW_WORKSPACE_DIR:-./openclaw/workspace}:/home/node/.openclaw/workspace\",\n\t\t],\n\t\tstdin_open: true,\n\t\ttty: true,\n\t\tinit: true,\n\t\tnetworks: [\"openclaw-network\"],\n\t\tentrypoint: [\"node\", \"dist/index.js\"],\n\t};\n\n\treturn { gatewayService: gateway, cliService: cliService, allVolumes };\n}\n\n// ── Shared Companion Service Builder ────────────────────────────────────────\n\nfunction buildCompanionService(\n\tdef: ResolverOutput[\"services\"][number][\"definition\"],\n\tresolved: ResolverOutput,\n\toptions: ComposeOptions,\n\tallVolumes: Set<string>,\n): { entry: Record<string, unknown>; volumeNames: string[] } {\n\tconst svc: Record<string, unknown> = {};\n\tconst volumeNames: string[] = [];\n\n\tsvc.image = `${def.image}:${def.imageTag}`;\n\n\tif (def.environment.length > 0) {\n\t\tconst env: Record<string, string> = {};\n\t\tfor (const e of def.environment) {\n\t\t\tenv[e.key] = e.secret ? `\\${${e.key}}` : e.defaultValue;\n\t\t}\n\t\tsvc.environment = env;\n\t}\n\n\tconst exposedPorts = def.ports.filter((p) => p.exposed);\n\tif (exposedPorts.length > 0) {\n\t\tconst prefix = def.id.toUpperCase().replace(/-/g, \"_\");\n\t\tsvc.ports = exposedPorts.map((p, i) => {\n\t\t\tconst suffix = exposedPorts.length > 1 ? `_${i}` : \"\";\n\t\t\treturn `\\${${prefix}_PORT${suffix}:-${p.host}}:${p.container}`;\n\t\t});\n\t}\n\n\tif (def.volumes.length > 0) {\n\t\tsvc.volumes = def.volumes.map((v) => {\n\t\t\tconst isBindMount =\n\t\t\t\tv.name.startsWith(\"./\") || v.name.startsWith(\"/\") || v.name.startsWith(\"~\");\n\n\t\t\tif (!isBindMount) {\n\t\t\t\tallVolumes.add(v.name);\n\t\t\t\tvolumeNames.push(v.name);\n\t\t\t}\n\t\t\treturn `${v.name}:${v.containerPath}`;\n\t\t});\n\t}\n\n\t// PostgreSQL: mount the init script for creating per-service databases\n\tif (def.id === \"postgresql\") {\n\t\tif (!svc.volumes) svc.volumes = [];\n\t\t(svc.volumes as string[]).push(\n\t\t\t\"./postgres/init-databases.sh:/docker-entrypoint-initdb.d/init-databases.sh:ro\",\n\t\t);\n\t}\n\n\tif (def.healthcheck) {\n\t\tconst hc: Record<string, unknown> = {\n\t\t\ttest: [\"CMD-SHELL\", def.healthcheck.test],\n\t\t\tinterval: def.healthcheck.interval,\n\t\t\ttimeout: def.healthcheck.timeout,\n\t\t\tretries: def.healthcheck.retries,\n\t\t};\n\t\tif (def.healthcheck.startPeriod) {\n\t\t\thc.start_period = def.healthcheck.startPeriod;\n\t\t}\n\t\tsvc.healthcheck = hc;\n\t}\n\n\tsvc.restart = def.restartPolicy;\n\tsvc.networks = def.networks;\n\n\tif (def.command) svc.command = def.command;\n\tif (def.entrypoint) svc.entrypoint = def.entrypoint;\n\n\t// Labels: merge static definition labels with dynamic Traefik labels\n\tconst mergedLabels: Record<string, string> = {};\n\tif (def.labels) Object.assign(mergedLabels, def.labels);\n\tconst traefikLabels = options.traefikLabels?.get(def.id);\n\tif (traefikLabels) Object.assign(mergedLabels, traefikLabels);\n\tif (Object.keys(mergedLabels).length > 0) svc.labels = mergedLabels;\n\n\t// Traefik: bind-mount static config and Docker socket\n\tif (def.id === \"traefik\" && options.traefikLabels) {\n\t\tif (!svc.volumes) svc.volumes = [];\n\t\t(svc.volumes as string[]).push(\n\t\t\t\"./traefik/traefik.yml:/etc/traefik/traefik.yml:ro\",\n\t\t\t\"/var/run/docker.sock:/var/run/docker.sock:ro\",\n\t\t);\n\t}\n\n\tlet deploy: Record<string, unknown> | undefined;\n\tif (def.deploy) {\n\t\tdeploy = JSON.parse(JSON.stringify(def.deploy)) as Record<string, unknown>;\n\t}\n\tif (options.gpu && def.gpuRequired) {\n\t\tconst base = deploy ?? {};\n\t\tconst resources = (base.resources ?? {}) as Record<string, unknown>;\n\t\tdeploy = {\n\t\t\t...base,\n\t\t\tresources: {\n\t\t\t\t...resources,\n\t\t\t\treservations: {\n\t\t\t\t\t...((resources.reservations as Record<string, unknown>) ?? {}),\n\t\t\t\t\tdevices: [{ driver: \"nvidia\", count: \"all\", capabilities: [\"gpu\"] }],\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\tif (deploy) svc.deploy = deploy;\n\n\t// Merge both dependsOn and requires to ensure proper Docker startup ordering\n\tconst depIds = [...new Set([...def.dependsOn, ...def.requires])].filter((id) =>\n\t\tresolved.services.some((s) => s.definition.id === id),\n\t);\n\tif (depIds.length > 0) {\n\t\tconst dependsOn: Record<string, { condition: string }> = {};\n\t\tfor (const depId of depIds) {\n\t\t\tconst dep = resolved.services.find((s) => s.definition.id === depId);\n\t\t\tdependsOn[depId] = {\n\t\t\t\tcondition: dep?.definition.healthcheck ? \"service_healthy\" : \"service_started\",\n\t\t\t};\n\t\t}\n\t\tsvc.depends_on = dependsOn;\n\t}\n\n\treturn { entry: svc, volumeNames };\n}\n\n// ── Single-File Compose ─────────────────────────────────────────────────────\n\n/**\n * Generates a single Docker Compose YAML string with ALL services.\n * Backward-compatible signature.\n */\nexport function compose(resolved: ResolverOutput, options: ComposeOptions): string {\n\t// Build depends_on for ALL companion services\n\tconst gatewayDependsOn: Record<string, { condition: string }> = {};\n\tfor (const { definition: def } of resolved.services) {\n\t\tgatewayDependsOn[def.id] = {\n\t\t\tcondition: def.healthcheck ? \"service_healthy\" : \"service_started\",\n\t\t};\n\t}\n\n\tconst { gatewayService, cliService, allVolumes } = buildGatewayServices(\n\t\tresolved,\n\t\toptions,\n\t\tgatewayDependsOn,\n\t);\n\n\tconst services: Record<string, Record<string, unknown>> = {\n\t\t\"openclaw-gateway\": gatewayService,\n\t};\n\n\tfor (const { definition: def } of resolved.services) {\n\t\tconst { entry } = buildCompanionService(def, resolved, options, allVolumes);\n\t\tservices[def.id] = entry;\n\t}\n\n\t// Add CLI service\n\tservices[\"openclaw-cli\"] = cliService;\n\n\tconst volumes: Record<string, null> = {};\n\tfor (const v of [...allVolumes].sort()) {\n\t\tvolumes[v] = null;\n\t}\n\n\tconst networks = { \"openclaw-network\": { driver: \"bridge\" } };\n\n\treturn stringify({ services, volumes, networks }, YAML_OPTIONS);\n}\n\n// ── Multi-File Compose ──────────────────────────────────────────────────────\n\ninterface ServiceInfo {\n\tid: string;\n\tcategory: ServiceCategory;\n\tentry: Record<string, unknown>;\n\tvolumeNames: string[];\n}\n\n/**\n * Generates multiple Docker Compose files, splitting services into profile-based\n * override files by category.\n */\nexport function composeMultiFile(resolved: ResolverOutput, options: ComposeOptions): ComposeResult {\n\tconst allVolumes = new Set<string>();\n\n\t// Build all companion service entries & classify by category\n\tconst serviceInfos: ServiceInfo[] = [];\n\n\tfor (const { definition: def } of resolved.services) {\n\t\tconst { entry, volumeNames } = buildCompanionService(def, resolved, options, allVolumes);\n\t\tserviceInfos.push({ id: def.id, category: def.category, entry, volumeNames });\n\t}\n\n\t// Partition services into base vs. profile files\n\tconst baseServiceIds = new Set<string>();\n\tconst profileFileMap: Record<string, { profile: string; services: ServiceInfo[] }> = {};\n\n\tfor (const info of serviceInfos) {\n\t\tconst mapping = CATEGORY_PROFILE_MAP[info.category];\n\t\tif (mapping) {\n\t\t\tif (!profileFileMap[mapping.file]) {\n\t\t\t\tprofileFileMap[mapping.file] = { profile: mapping.profile, services: [] };\n\t\t\t}\n\t\t\tprofileFileMap[mapping.file]!.services.push(info);\n\t\t} else {\n\t\t\tbaseServiceIds.add(info.id);\n\t\t}\n\t}\n\n\t// Gateway depends_on (only base services)\n\tconst gatewayDependsOn: Record<string, { condition: string }> = {};\n\tfor (const { definition: def } of resolved.services) {\n\t\tif (baseServiceIds.has(def.id)) {\n\t\t\tgatewayDependsOn[def.id] = {\n\t\t\t\tcondition: def.healthcheck ? \"service_healthy\" : \"service_started\",\n\t\t\t};\n\t\t}\n\t}\n\n\tconst {\n\t\tgatewayService,\n\t\tcliService,\n\t\tallVolumes: gwVolumes,\n\t} = buildGatewayServices(resolved, options, gatewayDependsOn);\n\n\t// Merge gateway volumes into allVolumes\n\tfor (const v of gwVolumes) allVolumes.add(v);\n\n\t// Base file: gateway + CLI + core services + ALL volumes + networks\n\tconst baseServices: Record<string, Record<string, unknown>> = {\n\t\t\"openclaw-gateway\": gatewayService,\n\t};\n\n\tfor (const info of serviceInfos) {\n\t\tif (baseServiceIds.has(info.id)) {\n\t\t\tbaseServices[info.id] = info.entry;\n\t\t}\n\t}\n\n\tbaseServices[\"openclaw-cli\"] = cliService;\n\n\tconst sortedAllVolumes: Record<string, null> = {};\n\tfor (const v of [...allVolumes].sort()) {\n\t\tsortedAllVolumes[v] = null;\n\t}\n\n\tconst networks = { \"openclaw-network\": { driver: \"bridge\" } };\n\n\tconst files: Record<string, string> = {};\n\tfiles[\"docker-compose.yml\"] = stringify(\n\t\t{ services: baseServices, volumes: sortedAllVolumes, networks },\n\t\tYAML_OPTIONS,\n\t);\n\n\t// Profile override files\n\tconst usedProfiles = new Set<string>();\n\n\tfor (const [fileName, { profile, services }] of Object.entries(profileFileMap)) {\n\t\tusedProfiles.add(profile);\n\n\t\tconst profileServices: Record<string, Record<string, unknown>> = {};\n\t\tconst profileVolumes = new Set<string>();\n\n\t\tfor (const info of services) {\n\t\t\tprofileServices[info.id] = { ...info.entry, profiles: [profile] };\n\t\t\tfor (const vName of info.volumeNames) {\n\t\t\t\tprofileVolumes.add(vName);\n\t\t\t}\n\t\t}\n\n\t\tconst fileContent: Record<string, unknown> = { services: profileServices };\n\n\t\tif (profileVolumes.size > 0) {\n\t\t\tconst sortedProfileVolumes: Record<string, null> = {};\n\t\t\tfor (const v of [...profileVolumes].sort()) {\n\t\t\t\tsortedProfileVolumes[v] = null;\n\t\t\t}\n\t\t\tfileContent.volumes = sortedProfileVolumes;\n\t\t}\n\n\t\tfiles[fileName] = stringify(fileContent, YAML_OPTIONS);\n\t}\n\n\treturn {\n\t\tfiles,\n\t\tmainFile: \"docker-compose.yml\",\n\t\tprofiles: [...usedProfiles].sort(),\n\t};\n}\n"],"mappings":";;;AAaA,MAAM,uBAA4F;CACjG,IAAI;EAAE,MAAM;EAAyB,SAAS;EAAM;CACpD,eAAe;EAAE,MAAM;EAAyB,SAAS;EAAM;CAC/D,OAAO;EAAE,MAAM;EAA4B,SAAS;EAAS;CAC7D,YAAY;EAAE,MAAM;EAAiC,SAAS;EAAc;CAC5E,WAAW;EAAE,MAAM;EAAiC,SAAS;EAAc;CAC3E,aAAa;EAAE,MAAM;EAA4B,SAAS;EAAS;CACnE,gBAAgB;EAAE,MAAM;EAA4B,SAAS;EAAS;CACtE,gBAAgB;EAAE,MAAM;EAA6B,SAAS;EAAU;CACxE,WAAW;EAAE,MAAM;EAAgC,SAAS;EAAa;CACzE,eAAe;EAAE,MAAM;EA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,MAAM,kBAA2D,EAAE;EACnE,MAAM,iCAAiB,IAAI,KAAa;AAExC,OAAK,MAAM,QAAQ,UAAU;AAC5B,mBAAgB,KAAK,MAAM;IAAE,GAAG,KAAK;IAAO,UAAU,CAAC,QAAQ;IAAE;AACjE,QAAK,MAAM,SAAS,KAAK,YACxB,gBAAe,IAAI,MAAM;;EAI3B,MAAM,cAAuC,EAAE,UAAU,iBAAiB;AAE1E,MAAI,eAAe,OAAO,GAAG;GAC5B,MAAM,uBAA6C,EAAE;AACrD,QAAK,MAAM,KAAK,CAAC,GAAG,eAAe,CAAC,MAAM,CACzC,sBAAqB,KAAK;AAE3B,eAAY,UAAU;;AAGvB,QAAM,YAAY,UAAU,aAAa,aAAa;;AAGvD,QAAO;EACN;EACA,UAAU;EACV,UAAU,CAAC,GAAG,aAAa,CAAC,MAAM;EAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.mts","names":[],"sources":["../src/generate.ts"],"mappings":";;;;;AAyCA;;iBAAgB,QAAA,CAAS,QAAA,EAAU,eAAA,GAAkB,gBAAA;AAAA,iBAsNrC,mBAAA,CAAoB,QAAA,EAAD,cAAA"}
1
+ {"version":3,"file":"generate.d.mts","names":[],"sources":["../src/generate.ts"],"mappings":";;;;;AA2CA;;iBAAgB,QAAA,CAAS,QAAA,EAAU,eAAA,GAAkB,gBAAA;AAAA,iBAmOrC,mBAAA,CAAoB,QAAA,EAAD,cAAA"}
package/dist/generate.mjs CHANGED
@@ -6,10 +6,12 @@ import { generateBareMetalInstall } from "./generators/bare-metal-install.mjs";
6
6
  import { generateCaddyfile } from "./generators/caddy.mjs";
7
7
  import { generatePostgresInit } from "./generators/postgres-init.mjs";
8
8
  import { generateEnvFiles } from "./generators/env.mjs";
9
+ import { generateGsdScripts } from "./generators/get-shit-done.mjs";
9
10
  import { generateGrafanaConfig, generateGrafanaDashboard } from "./generators/grafana.mjs";
10
11
  import { generateHealthCheck } from "./generators/health-check.mjs";
11
12
  import { generateN8nWorkflows } from "./generators/n8n-workflows.mjs";
12
13
  import { generateNativeInstallScripts } from "./generators/native-services.mjs";
14
+ import { generateOpenClawConfig } from "./generators/openclaw-json.mjs";
13
15
  import { generatePrometheusConfig } from "./generators/prometheus.mjs";
14
16
  import { generateReadme } from "./generators/readme.mjs";
15
17
  import { generateScripts } from "./generators/scripts.mjs";
@@ -34,6 +36,7 @@ function generate(rawInput) {
34
36
  const resolved = resolve({
35
37
  services: input.services,
36
38
  skillPacks: input.skillPacks,
39
+ aiProviders: input.aiProviders,
37
40
  proxy: input.proxy,
38
41
  gpu: input.gpu,
39
42
  platform: composePlatform,
@@ -90,6 +93,7 @@ function generate(rawInput) {
90
93
  ].join("\n");
91
94
  const skillFiles = generateSkillFiles(resolved);
92
95
  for (const [path, content] of Object.entries(skillFiles)) files[path] = content;
96
+ files["openclaw/config/openclaw.json"] = generateOpenClawConfig(resolved);
93
97
  files["README.md"] = generateReadme(resolved, {
94
98
  projectName: input.projectName,
95
99
  domain: input.domain,
@@ -140,6 +144,13 @@ function generate(rawInput) {
140
144
  });
141
145
  for (const [path, content] of Object.entries(bareMetalFiles)) files[path] = content;
142
146
  }
147
+ if (input.gsdRuntimes && input.gsdRuntimes.length > 0) {
148
+ const gsdScripts = generateGsdScripts(input.gsdRuntimes);
149
+ if (gsdScripts) {
150
+ files["openclaw/scripts/setup-gsd.sh"] = gsdScripts.sh;
151
+ files["openclaw/scripts/setup-gsd.ps1"] = gsdScripts.ps1;
152
+ }
153
+ }
143
154
  const skillCount = resolved.services.reduce((sum, s) => sum + s.definition.skills.length, 0);
144
155
  return {
145
156
  files,
@@ -1 +1 @@
1
- {"version":3,"file":"generate.mjs","names":[],"sources":["../src/generate.ts"],"sourcesContent":["import {\n\tpartitionBareMetal,\n\tplatformToNativePlatform,\n\tresolvedWithOnlyServices,\n} from \"./bare-metal-partition.js\";\nimport { composeMultiFile } from \"./composer.js\";\nimport { StackConfigError, ValidationError } from \"./errors.js\";\nimport { generateBareMetalInstall } from \"./generators/bare-metal-install.js\";\nimport { generateCaddyfile } from \"./generators/caddy.js\";\nimport { generateEnvFiles } from \"./generators/env.js\";\nimport { generateGrafanaConfig, generateGrafanaDashboard } from \"./generators/grafana.js\";\nimport { generateHealthCheck } from \"./generators/health-check.js\";\nimport { generateN8nWorkflows } from \"./generators/n8n-workflows.js\";\nimport { generateNativeInstallScripts } from \"./generators/native-services.js\";\nimport { generatePostgresInit } from \"./generators/postgres-init.js\";\nimport { generatePrometheusConfig } from \"./generators/prometheus.js\";\nimport { generateReadme } from \"./generators/readme.js\";\nimport { generateScripts } from \"./generators/scripts.js\";\nimport { generateSkillFiles } from \"./generators/skills.js\";\nimport { generateTraefikConfig } from \"./generators/traefik.js\";\nimport { migrateConfig } from \"./migrations.js\";\nimport { resolve } from \"./resolver.js\";\nimport type {\n\tGeneratedFiles,\n\tGenerationInput,\n\tGenerationResult,\n\tPlatform,\n\tResolverInput,\n} from \"./types.js\";\nimport { validate } from \"./validator.js\";\n\n/** Resolver/compose only support linux image platforms; normalize for bare-metal (windows/macos). */\nfunction getComposePlatform(platform: Platform): \"linux/amd64\" | \"linux/arm64\" {\n\tif (platform === \"linux/amd64\" || platform === \"linux/arm64\") return platform;\n\treturn \"linux/amd64\";\n}\n\n/**\n * Main orchestration function: takes generation input, resolves dependencies,\n * generates all files, validates, and returns the complete file tree.\n */\nexport function generate(rawInput: GenerationInput): GenerationResult {\n\t// Apply config migrations if needed\n\tconst input = migrateConfig(rawInput as Record<string, unknown>) as GenerationInput;\n\n\tconst composePlatform = getComposePlatform(input.platform);\n\n\t// 1. Resolve dependencies\n\tconst resolverInput: ResolverInput = {\n\t\tservices: input.services,\n\t\tskillPacks: input.skillPacks,\n\t\tproxy: input.proxy,\n\t\tgpu: input.gpu,\n\t\tplatform: composePlatform,\n\t\tmonitoring: input.monitoring,\n\t};\n\tconst resolved = resolve(resolverInput);\n\n\tif (!resolved.isValid) {\n\t\tthrow new StackConfigError(\n\t\t\t`Invalid stack configuration: ${resolved.errors.map((e) => e.message).join(\"; \")}`,\n\t\t);\n\t}\n\n\tconst isBareMetal = input.deploymentType === \"bare-metal\";\n\tlet resolvedForCompose = resolved;\n\tlet nativeIds = new Set<string>();\n\tlet nativeServices: typeof resolved.services = [];\n\tlet dockerOnlyServices: typeof resolved.services = [];\n\n\tif (isBareMetal) {\n\t\tconst partition = partitionBareMetal(resolved, input.platform);\n\t\tnativeServices = partition.nativeServices;\n\t\tdockerOnlyServices = partition.dockerOnlyServices;\n\t\tnativeIds = partition.nativeIds;\n\t\tif (nativeServices.length > 0) {\n\t\t\tresolvedForCompose = resolvedWithOnlyServices(resolved, dockerOnlyServices);\n\t\t}\n\t}\n\n\t// 2. Generate Docker Compose YAML (multi-file)\n\t// Compute Traefik labels before composing (labels get injected into docker-compose services)\n\tlet traefikOutput: ReturnType<typeof generateTraefikConfig> | undefined;\n\tif (input.proxy === \"traefik\" && input.domain) {\n\t\ttraefikOutput = generateTraefikConfig(resolvedForCompose, input.domain);\n\t}\n\n\tconst composeOptions = {\n\t\tprojectName: input.projectName,\n\t\tproxy: input.proxy,\n\t\tdomain: input.domain,\n\t\tgpu: input.gpu,\n\t\tplatform: composePlatform,\n\t\tdeployment: input.deployment,\n\t\topenclawVersion: input.openclawVersion,\n\t\tbareMetalNativeHost: isBareMetal && nativeIds.size > 0,\n\t\ttraefikLabels: traefikOutput?.serviceLabels,\n\t};\n\tconst composeResult = composeMultiFile(resolvedForCompose, composeOptions);\n\n\t// 3. Validate (using the base docker-compose.yml)\n\tconst validation = validate(resolvedForCompose, composeResult.files[\"docker-compose.yml\"] ?? \"\", {\n\t\tdomain: input.domain,\n\t\tgenerateSecrets: input.generateSecrets,\n\t});\n\tif (!validation.valid) {\n\t\tthrow new ValidationError(\n\t\t\t`Validation failed: ${validation.errors.map((e) => e.message).join(\"; \")}`,\n\t\t);\n\t}\n\n\t// 4. Generate all files\n\tconst files: GeneratedFiles = {};\n\n\t// Docker Compose (multi-file output)\n\tfor (const [filename, content] of Object.entries(composeResult.files)) {\n\t\tfiles[filename] = content;\n\t}\n\n\t// Environment files (when bare-metal with native services, host vars use host.docker.internal)\n\tconst envFiles = generateEnvFiles(resolved, {\n\t\tgenerateSecrets: input.generateSecrets,\n\t\tdomain: input.domain,\n\t\topenclawVersion: input.openclawVersion,\n\t\tnativeServiceIds: isBareMetal ? nativeIds : undefined,\n\t});\n\tfiles[\".env.example\"] = envFiles.envExample;\n\tfiles[\".env\"] = envFiles.env;\n\n\t// .gitignore\n\tfiles[\".gitignore\"] = [\n\t\t\".env\",\n\t\t\".env.local\",\n\t\t\".env.*.local\",\n\t\t\"*.log\",\n\t\t\"docker-compose.override.yml\",\n\t].join(\"\\n\");\n\n\t// Skills\n\tconst skillFiles = generateSkillFiles(resolved);\n\tfor (const [path, content] of Object.entries(skillFiles)) {\n\t\tfiles[path] = content;\n\t}\n\n\t// README\n\tfiles[\"README.md\"] = generateReadme(resolved, {\n\t\tprojectName: input.projectName,\n\t\tdomain: input.domain,\n\t\tproxy: input.proxy,\n\t\tdeploymentType: input.deploymentType,\n\t\thasNativeServices: isBareMetal && nativeServices.length > 0,\n\t});\n\n\t// Scripts\n\tconst scripts = generateScripts();\n\tfor (const [path, content] of Object.entries(scripts)) {\n\t\tfiles[path] = content;\n\t}\n\n\t// Health check scripts (dynamic, stack-specific)\n\tconst healthCheckFiles = generateHealthCheck(resolved, {\n\t\tprojectName: input.projectName,\n\t\tdeploymentType: input.deploymentType,\n\t});\n\tfor (const [path, content] of Object.entries(healthCheckFiles)) {\n\t\tfiles[path] = content;\n\t}\n\n\t// n8n workflows\n\tconst n8nWorkflows = generateN8nWorkflows(resolved);\n\tfor (const [path, content] of Object.entries(n8nWorkflows)) {\n\t\tfiles[path] = content;\n\t}\n\n\t// PostgreSQL init script (creates per-service databases and users)\n\tconst postgresInit = generatePostgresInit(resolved);\n\tif (postgresInit) {\n\t\tfiles[\"postgres/init-databases.sh\"] = postgresInit;\n\t}\n\n\t// Caddy config\n\tif (input.proxy === \"caddy\" && input.domain) {\n\t\tfiles[\"caddy/Caddyfile\"] = generateCaddyfile(resolved, input.domain);\n\t}\n\n\t// Traefik config (labels are already injected via composeOptions.traefikLabels)\n\tif (traefikOutput) {\n\t\tfiles[\"traefik/traefik.yml\"] = traefikOutput.staticConfig;\n\t}\n\n\t// Prometheus config\n\tconst hasPrometheus = resolved.services.some((s) => s.definition.id === \"prometheus\");\n\tif (hasPrometheus) {\n\t\tfiles[\"prometheus/prometheus.yml\"] = generatePrometheusConfig(resolved);\n\t}\n\n\t// Grafana config\n\tconst hasGrafana = resolved.services.some((s) => s.definition.id === \"grafana\");\n\tif (hasGrafana) {\n\t\tconst grafanaFiles = generateGrafanaConfig();\n\t\tfor (const [path, content] of Object.entries(grafanaFiles)) {\n\t\t\tfiles[path] = content;\n\t\t}\n\t\t// Grafana dashboard\n\t\tfiles[\"config/grafana/dashboards/openclaw-stack-overview.json\"] = generateGrafanaDashboard();\n\t}\n\n\t// Docker Compose override (empty template)\n\tfiles[\"docker-compose.override.yml\"] = [\n\t\t\"# Local overrides for docker-compose.yml\",\n\t\t\"# This file is gitignored — use it for personal port changes, extra volumes, etc.\",\n\t\t\"services: {}\",\n\t\t\"\",\n\t].join(\"\\n\");\n\n\t// SERVICES.md documentation\n\tfiles[\"docs/SERVICES.md\"] = generateServicesDoc(resolved);\n\n\t// Bare-metal: native install scripts + top-level installer\n\tif (isBareMetal) {\n\t\tif (nativeServices.length > 0) {\n\t\t\tconst nativePlatform = platformToNativePlatform(input.platform);\n\t\t\tconst nativeScripts = generateNativeInstallScripts({\n\t\t\t\tnativeServices,\n\t\t\t\tplatform: nativePlatform,\n\t\t\t\tprojectName: input.projectName,\n\t\t\t});\n\t\t\tfor (const [path, content] of Object.entries(nativeScripts)) {\n\t\t\t\tfiles[path] = content;\n\t\t\t}\n\t\t}\n\t\tconst bareMetalFiles = generateBareMetalInstall({\n\t\t\tplatform: input.platform,\n\t\t\tprojectName: input.projectName,\n\t\t\thasNativeServices: nativeServices.length > 0,\n\t\t});\n\t\tfor (const [path, content] of Object.entries(bareMetalFiles)) {\n\t\t\tfiles[path] = content;\n\t\t}\n\t}\n\n\t// 5. Calculate metadata\n\tconst skillCount = resolved.services.reduce((sum, s) => sum + s.definition.skills.length, 0);\n\n\treturn {\n\t\tfiles,\n\t\tmetadata: {\n\t\t\tserviceCount: resolved.services.length,\n\t\t\tskillCount,\n\t\t\testimatedMemoryMB: resolved.estimatedMemoryMB,\n\t\t\tgeneratedAt: new Date().toISOString(),\n\t\t},\n\t};\n}\n\nexport function generateServicesDoc(resolved: import(\"./types.js\").ResolverOutput): string {\n\tconst lines: string[] = [\n\t\t\"# Service Reference\",\n\t\t\"\",\n\t\t\"This document describes all companion services in your OpenClaw stack.\",\n\t\t\"\",\n\t];\n\n\tfor (const svc of resolved.services) {\n\t\tconst def = svc.definition;\n\t\tlines.push(`## ${def.icon} ${def.name}`);\n\t\tlines.push(\"\");\n\t\tlines.push(def.description);\n\t\tlines.push(\"\");\n\t\tlines.push(`- **Image**: \\`${def.image}:${def.imageTag}\\``);\n\t\tlines.push(`- **Category**: ${def.category}`);\n\t\tlines.push(`- **Maturity**: ${def.maturity}`);\n\t\tif (def.minMemoryMB) {\n\t\t\tlines.push(`- **Min Memory**: ${def.minMemoryMB}MB`);\n\t\t}\n\t\tif (def.ports.length > 0) {\n\t\t\tlines.push(\"- **Ports**:\");\n\t\t\tfor (const p of def.ports) {\n\t\t\t\tlines.push(\n\t\t\t\t\t` - \\`${p.container}\\` — ${p.description}${p.exposed ? \"\" : \" (internal only)\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tlines.push(`- **Docs**: ${def.docsUrl}`);\n\t\tlines.push(\"\");\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,mBAAmB,UAAmD;AAC9E,KAAI,aAAa,iBAAiB,aAAa,cAAe,QAAO;AACrE,QAAO;;;;;;AAOR,SAAgB,SAAS,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,GAAG;AACd,QAAM,KAAK,kBAAkB,IAAI,MAAM,GAAG,IAAI,SAAS,IAAI;AAC3D,QAAM,KAAK,mBAAmB,IAAI,WAAW;AAC7C,QAAM,KAAK,mBAAmB,IAAI,WAAW;AAC7C,MAAI,IAAI,YACP,OAAM,KAAK,qBAAqB,IAAI,YAAY,IAAI;AAErD,MAAI,IAAI,MAAM,SAAS,GAAG;AACzB,SAAM,KAAK,eAAe;AAC1B,QAAK,MAAM,KAAK,IAAI,MACnB,OAAM,KACL,SAAS,EAAE,UAAU,OAAO,EAAE,cAAc,EAAE,UAAU,KAAK,qBAC7D;;AAGH,QAAM,KAAK,eAAe,IAAI,UAAU;AACxC,QAAM,KAAK,GAAG;;AAGf,QAAO,MAAM,KAAK,KAAK"}
1
+ {"version":3,"file":"generate.mjs","names":[],"sources":["../src/generate.ts"],"sourcesContent":["import {\n\tpartitionBareMetal,\n\tplatformToNativePlatform,\n\tresolvedWithOnlyServices,\n} from \"./bare-metal-partition.js\";\nimport { composeMultiFile } from \"./composer.js\";\nimport { StackConfigError, ValidationError } from \"./errors.js\";\nimport { generateBareMetalInstall } from \"./generators/bare-metal-install.js\";\nimport { generateCaddyfile } from \"./generators/caddy.js\";\nimport { generateEnvFiles } from \"./generators/env.js\";\nimport { generateGsdScripts } from \"./generators/get-shit-done.js\";\nimport { generateGrafanaConfig, generateGrafanaDashboard } from \"./generators/grafana.js\";\nimport { generateHealthCheck } from \"./generators/health-check.js\";\nimport { generateN8nWorkflows } from \"./generators/n8n-workflows.js\";\nimport { generateNativeInstallScripts } from \"./generators/native-services.js\";\nimport { generateOpenClawConfig } from \"./generators/openclaw-json.js\";\nimport { generatePostgresInit } from \"./generators/postgres-init.js\";\nimport { generatePrometheusConfig } from \"./generators/prometheus.js\";\nimport { generateReadme } from \"./generators/readme.js\";\nimport { generateScripts } from \"./generators/scripts.js\";\nimport { generateSkillFiles } from \"./generators/skills.js\";\nimport { generateTraefikConfig } from \"./generators/traefik.js\";\nimport { migrateConfig } from \"./migrations.js\";\nimport { resolve } from \"./resolver.js\";\nimport type {\n\tGeneratedFiles,\n\tGenerationInput,\n\tGenerationResult,\n\tPlatform,\n\tResolverInput,\n} from \"./types.js\";\nimport { validate } from \"./validator.js\";\n\n/** Resolver/compose only support linux image platforms; normalize for bare-metal (windows/macos). */\nfunction getComposePlatform(platform: Platform): \"linux/amd64\" | \"linux/arm64\" {\n\tif (platform === \"linux/amd64\" || platform === \"linux/arm64\") return platform;\n\treturn \"linux/amd64\";\n}\n\n/**\n * Main orchestration function: takes generation input, resolves dependencies,\n * generates all files, validates, and returns the complete file tree.\n */\nexport function generate(rawInput: GenerationInput): GenerationResult {\n\t// Apply config migrations if needed\n\tconst input = migrateConfig(rawInput as Record<string, unknown>) as GenerationInput;\n\n\tconst composePlatform = getComposePlatform(input.platform);\n\n\t// 1. Resolve dependencies\n\tconst resolverInput: ResolverInput = {\n\t\tservices: input.services,\n\t\tskillPacks: input.skillPacks,\n\t\taiProviders: input.aiProviders,\n\t\tproxy: input.proxy,\n\t\tgpu: input.gpu,\n\t\tplatform: composePlatform,\n\t\tmonitoring: input.monitoring,\n\t};\n\tconst resolved = resolve(resolverInput);\n\n\tif (!resolved.isValid) {\n\t\tthrow new StackConfigError(\n\t\t\t`Invalid stack configuration: ${resolved.errors.map((e) => e.message).join(\"; \")}`,\n\t\t);\n\t}\n\n\tconst isBareMetal = input.deploymentType === \"bare-metal\";\n\tlet resolvedForCompose = resolved;\n\tlet nativeIds = new Set<string>();\n\tlet nativeServices: typeof resolved.services = [];\n\tlet dockerOnlyServices: typeof resolved.services = [];\n\n\tif (isBareMetal) {\n\t\tconst partition = partitionBareMetal(resolved, input.platform);\n\t\tnativeServices = partition.nativeServices;\n\t\tdockerOnlyServices = partition.dockerOnlyServices;\n\t\tnativeIds = partition.nativeIds;\n\t\tif (nativeServices.length > 0) {\n\t\t\tresolvedForCompose = resolvedWithOnlyServices(resolved, dockerOnlyServices);\n\t\t}\n\t}\n\n\t// 2. Generate Docker Compose YAML (multi-file)\n\t// Compute Traefik labels before composing (labels get injected into docker-compose services)\n\tlet traefikOutput: ReturnType<typeof generateTraefikConfig> | undefined;\n\tif (input.proxy === \"traefik\" && input.domain) {\n\t\ttraefikOutput = generateTraefikConfig(resolvedForCompose, input.domain);\n\t}\n\n\tconst composeOptions = {\n\t\tprojectName: input.projectName,\n\t\tproxy: input.proxy,\n\t\tdomain: input.domain,\n\t\tgpu: input.gpu,\n\t\tplatform: composePlatform,\n\t\tdeployment: input.deployment,\n\t\topenclawVersion: input.openclawVersion,\n\t\tbareMetalNativeHost: isBareMetal && nativeIds.size > 0,\n\t\ttraefikLabels: traefikOutput?.serviceLabels,\n\t};\n\tconst composeResult = composeMultiFile(resolvedForCompose, composeOptions);\n\n\t// 3. Validate (using the base docker-compose.yml)\n\tconst validation = validate(resolvedForCompose, composeResult.files[\"docker-compose.yml\"] ?? \"\", {\n\t\tdomain: input.domain,\n\t\tgenerateSecrets: input.generateSecrets,\n\t});\n\tif (!validation.valid) {\n\t\tthrow new ValidationError(\n\t\t\t`Validation failed: ${validation.errors.map((e) => e.message).join(\"; \")}`,\n\t\t);\n\t}\n\n\t// 4. Generate all files\n\tconst files: GeneratedFiles = {};\n\n\t// Docker Compose (multi-file output)\n\tfor (const [filename, content] of Object.entries(composeResult.files)) {\n\t\tfiles[filename] = content;\n\t}\n\n\t// Environment files (when bare-metal with native services, host vars use host.docker.internal)\n\tconst envFiles = generateEnvFiles(resolved, {\n\t\tgenerateSecrets: input.generateSecrets,\n\t\tdomain: input.domain,\n\t\topenclawVersion: input.openclawVersion,\n\t\tnativeServiceIds: isBareMetal ? nativeIds : undefined,\n\t});\n\tfiles[\".env.example\"] = envFiles.envExample;\n\tfiles[\".env\"] = envFiles.env;\n\n\t// .gitignore\n\tfiles[\".gitignore\"] = [\n\t\t\".env\",\n\t\t\".env.local\",\n\t\t\".env.*.local\",\n\t\t\"*.log\",\n\t\t\"docker-compose.override.yml\",\n\t].join(\"\\n\");\n\n\t// Skills\n\tconst skillFiles = generateSkillFiles(resolved);\n\tfor (const [path, content] of Object.entries(skillFiles)) {\n\t\tfiles[path] = content;\n\t}\n\n\t// OpenClaw Core Configuration\n\tfiles[\"openclaw/config/openclaw.json\"] = generateOpenClawConfig(resolved);\n\n\t// README\n\tfiles[\"README.md\"] = generateReadme(resolved, {\n\t\tprojectName: input.projectName,\n\t\tdomain: input.domain,\n\t\tproxy: input.proxy,\n\t\tdeploymentType: input.deploymentType,\n\t\thasNativeServices: isBareMetal && nativeServices.length > 0,\n\t});\n\n\t// Scripts\n\tconst scripts = generateScripts();\n\tfor (const [path, content] of Object.entries(scripts)) {\n\t\tfiles[path] = content;\n\t}\n\n\t// Health check scripts (dynamic, stack-specific)\n\tconst healthCheckFiles = generateHealthCheck(resolved, {\n\t\tprojectName: input.projectName,\n\t\tdeploymentType: input.deploymentType,\n\t});\n\tfor (const [path, content] of Object.entries(healthCheckFiles)) {\n\t\tfiles[path] = content;\n\t}\n\n\t// n8n workflows\n\tconst n8nWorkflows = generateN8nWorkflows(resolved);\n\tfor (const [path, content] of Object.entries(n8nWorkflows)) {\n\t\tfiles[path] = content;\n\t}\n\n\t// PostgreSQL init script (creates per-service databases and users)\n\tconst postgresInit = generatePostgresInit(resolved);\n\tif (postgresInit) {\n\t\tfiles[\"postgres/init-databases.sh\"] = postgresInit;\n\t}\n\n\t// Caddy config\n\tif (input.proxy === \"caddy\" && input.domain) {\n\t\tfiles[\"caddy/Caddyfile\"] = generateCaddyfile(resolved, input.domain);\n\t}\n\n\t// Traefik config (labels are already injected via composeOptions.traefikLabels)\n\tif (traefikOutput) {\n\t\tfiles[\"traefik/traefik.yml\"] = traefikOutput.staticConfig;\n\t}\n\n\t// Prometheus config\n\tconst hasPrometheus = resolved.services.some((s) => s.definition.id === \"prometheus\");\n\tif (hasPrometheus) {\n\t\tfiles[\"prometheus/prometheus.yml\"] = generatePrometheusConfig(resolved);\n\t}\n\n\t// Grafana config\n\tconst hasGrafana = resolved.services.some((s) => s.definition.id === \"grafana\");\n\tif (hasGrafana) {\n\t\tconst grafanaFiles = generateGrafanaConfig();\n\t\tfor (const [path, content] of Object.entries(grafanaFiles)) {\n\t\t\tfiles[path] = content;\n\t\t}\n\t\t// Grafana dashboard\n\t\tfiles[\"config/grafana/dashboards/openclaw-stack-overview.json\"] = generateGrafanaDashboard();\n\t}\n\n\t// Docker Compose override (empty template)\n\tfiles[\"docker-compose.override.yml\"] = [\n\t\t\"# Local overrides for docker-compose.yml\",\n\t\t\"# This file is gitignored — use it for personal port changes, extra volumes, etc.\",\n\t\t\"services: {}\",\n\t\t\"\",\n\t].join(\"\\n\");\n\n\t// SERVICES.md documentation\n\tfiles[\"docs/SERVICES.md\"] = generateServicesDoc(resolved);\n\n\t// Bare-metal: native install scripts + top-level installer\n\tif (isBareMetal) {\n\t\tif (nativeServices.length > 0) {\n\t\t\tconst nativePlatform = platformToNativePlatform(input.platform);\n\t\t\tconst nativeScripts = generateNativeInstallScripts({\n\t\t\t\tnativeServices,\n\t\t\t\tplatform: nativePlatform,\n\t\t\t\tprojectName: input.projectName,\n\t\t\t});\n\t\t\tfor (const [path, content] of Object.entries(nativeScripts)) {\n\t\t\t\tfiles[path] = content;\n\t\t\t}\n\t\t}\n\t\tconst bareMetalFiles = generateBareMetalInstall({\n\t\t\tplatform: input.platform,\n\t\t\tprojectName: input.projectName,\n\t\t\thasNativeServices: nativeServices.length > 0,\n\t\t});\n\t\tfor (const [path, content] of Object.entries(bareMetalFiles)) {\n\t\t\tfiles[path] = content;\n\t\t}\n\t}\n\n\t// Get-Shit-Done setup scripts\n\tif (input.gsdRuntimes && input.gsdRuntimes.length > 0) {\n\t\tconst gsdScripts = generateGsdScripts(input.gsdRuntimes);\n\t\tif (gsdScripts) {\n\t\t\tfiles[\"openclaw/scripts/setup-gsd.sh\"] = gsdScripts.sh;\n\t\t\tfiles[\"openclaw/scripts/setup-gsd.ps1\"] = gsdScripts.ps1;\n\t\t}\n\t}\n\n\t// 5. Calculate metadata\n\tconst skillCount = resolved.services.reduce((sum, s) => sum + s.definition.skills.length, 0);\n\n\treturn {\n\t\tfiles,\n\t\tmetadata: {\n\t\t\tserviceCount: resolved.services.length,\n\t\t\tskillCount,\n\t\t\testimatedMemoryMB: resolved.estimatedMemoryMB,\n\t\t\tgeneratedAt: new Date().toISOString(),\n\t\t},\n\t};\n}\n\nexport function generateServicesDoc(resolved: import(\"./types.js\").ResolverOutput): string {\n\tconst lines: string[] = [\n\t\t\"# Service Reference\",\n\t\t\"\",\n\t\t\"This document describes all companion services in your OpenClaw stack.\",\n\t\t\"\",\n\t];\n\n\tfor (const svc of resolved.services) {\n\t\tconst def = svc.definition;\n\t\tlines.push(`## ${def.icon} ${def.name}`);\n\t\tlines.push(\"\");\n\t\tlines.push(def.description);\n\t\tlines.push(\"\");\n\t\tlines.push(`- **Image**: \\`${def.image}:${def.imageTag}\\``);\n\t\tlines.push(`- **Category**: ${def.category}`);\n\t\tlines.push(`- **Maturity**: ${def.maturity}`);\n\t\tif (def.minMemoryMB) {\n\t\t\tlines.push(`- **Min Memory**: ${def.minMemoryMB}MB`);\n\t\t}\n\t\tif (def.ports.length > 0) {\n\t\t\tlines.push(\"- **Ports**:\");\n\t\t\tfor (const p of def.ports) {\n\t\t\t\tlines.push(\n\t\t\t\t\t` - \\`${p.container}\\` — ${p.description}${p.exposed ? \"\" : \" (internal only)\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tlines.push(`- **Docs**: ${def.docsUrl}`);\n\t\tlines.push(\"\");\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,mBAAmB,UAAmD;AAC9E,KAAI,aAAa,iBAAiB,aAAa,cAAe,QAAO;AACrE,QAAO;;;;;;AAOR,SAAgB,SAAS,UAA6C;CAErE,MAAM,QAAQ,cAAc,SAAoC;CAEhE,MAAM,kBAAkB,mBAAmB,MAAM,SAAS;CAY1D,MAAM,WA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AM,KAAK,MAAM,IAAI,KAAK,GAAG,IAAI,OAAO;AACxC,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,IAAI,YAAY;AAC3B,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,kBAAkB,IAAI,MAAM,GAAG,IAAI,SAAS,IAAI;AAC3D,QAAM,KAAK,mBAAmB,IAAI,WAAW;AAC7C,QAAM,KAAK,mBAAmB,IAAI,WAAW;AAC7C,MAAI,IAAI,YACP,OAAM,KAAK,qBAAqB,IAAI,YAAY,IAAI;AAErD,MAAI,IAAI,MAAM,SAAS,GAAG;AACzB,SAAM,KAAK,eAAe;AAC1B,QAAK,MAAM,KAAK,IAAI,MACnB,OAAM,KACL,SAAS,EAAE,UAAU,OAAO,EAAE,cAAc,EAAE,UAAU,KAAK,qBAC7D;;AAGH,QAAM,KAAK,eAAe,IAAI,UAAU;AACxC,QAAM,KAAK,GAAG;;AAGf,QAAO,MAAM,KAAK,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.mts","names":[],"sources":["../../src/generators/env.ts"],"mappings":";;;;;AAOA;UAAiB,mBAAA;EAChB,eAAA;EACA,MAAA;EACA,eAAA;EADA;EAGA,gBAAA,GAAmB,GAAA;AAAA;;;;AASpB;;;iBAAgB,gBAAA,CACf,QAAA,EAAU,cAAA,EACV,OAAA,EAAS,mBAAA;EACL,UAAA;EAAoB,GAAA;AAAA;AAAA,UAkSR,WAAA;EAChB,WAAA;EACA,WAAA;EACA,SAAA;EACA,IAAA;IACC,GAAA;IACA,WAAA;IACA,MAAA;IACA,QAAA;IACA,YAAA;EAAA;AAAA;;;;;;;;iBAWc,oBAAA,CAAqB,QAAA,EAAU,cAAA,GAAiB,WAAA"}
1
+ {"version":3,"file":"env.d.mts","names":[],"sources":["../../src/generators/env.ts"],"mappings":";;;;;AAOA;UAAiB,mBAAA;EAChB,eAAA;EACA,MAAA;EACA,eAAA;EADA;EAGA,gBAAA,GAAmB,GAAA;AAAA;;;;AASpB;;;iBAAgB,gBAAA,CACf,QAAA,EAAU,cAAA,EACV,OAAA,EAAS,mBAAA;EACL,UAAA;EAAoB,GAAA;AAAA;AAAA,UA4TR,WAAA;EAChB,WAAA;EACA,WAAA;EACA,SAAA;EACA,IAAA;IACC,GAAA;IACA,WAAA;IACA,MAAA;IACA,QAAA;IACA,YAAA;EAAA;AAAA;;;;;;;;iBAWc,oBAAA,CAAqB,QAAA,EAAU,cAAA,GAAiB,WAAA"}
@@ -66,6 +66,24 @@ function generateEnvFiles(resolved, options) {
66
66
  exampleValue: "example.com",
67
67
  actualValue: options.domain
68
68
  });
69
+ if (resolved.aiProviders && resolved.aiProviders.length > 0) {
70
+ lines.push({
71
+ comment: "\n# ═══════════════════════════════════════════════════════════════════════════════\n# AI Provider API Keys\n# ═══════════════════════════════════════════════════════════════════════════════",
72
+ key: "",
73
+ exampleValue: "",
74
+ actualValue: ""
75
+ });
76
+ for (const provider of resolved.aiProviders) {
77
+ if (provider === "ollama" || provider === "lmstudio" || provider === "vllm") continue;
78
+ const envKey = `${provider.toUpperCase()}_API_KEY`;
79
+ lines.push({
80
+ comment: formatComment(`API Key for ${provider} AI models`, "OpenClaw Core", true, true),
81
+ key: envKey,
82
+ exampleValue: `your_${provider.toLowerCase()}_api_key_here`,
83
+ actualValue: ""
84
+ });
85
+ }
86
+ }
69
87
  lines.push({
70
88
  comment: "\n# ═══════════════════════════════════════════════════════════════════════════════\n# Claude Web Provider (optional)\n# ═══════════════════════════════════════════════════════════════════════════════",
71
89
  key: "",
@@ -109,6 +127,7 @@ function generateEnvFiles(resolved, options) {
109
127
  }
110
128
  }
111
129
  const dbPasswordKeys = dbReqs.map((r) => r.passwordEnvVar);
130
+ const aiProviderKeys = (resolved.aiProviders || []).map((p) => `${p.toUpperCase()}_API_KEY`);
112
131
  const seenKeys = new Set([
113
132
  "OPENCLAW_VERSION",
114
133
  "OPENCLAW_GATEWAY_TOKEN",
@@ -122,7 +141,8 @@ function generateEnvFiles(resolved, options) {
122
141
  "CLAUDE_AI_SESSION_KEY",
123
142
  "CLAUDE_WEB_SESSION_KEY",
124
143
  "CLAUDE_WEB_COOKIE",
125
- ...dbPasswordKeys
144
+ ...dbPasswordKeys,
145
+ ...aiProviderKeys
126
146
  ]);
127
147
  for (const { definition } of resolved.services) {
128
148
  const allEnvVars = [...definition.environment, ...definition.openclawEnvVars];
@@ -1 +1 @@
1
- {"version":3,"file":"env.mjs","names":[],"sources":["../../src/generators/env.ts"],"sourcesContent":["import { randomBytes } from \"node:crypto\";\nimport type { ResolverOutput } from \"../types.js\";\nimport { getDbRequirements } from \"./postgres-init.js\";\n\n/**\n * Options for environment file generation.\n */\nexport interface EnvGeneratorOptions {\n\tgenerateSecrets: boolean;\n\tdomain?: string;\n\topenclawVersion?: string;\n\t/** When set, host-like vars (e.g. REDIS_HOST) for these services use host.docker.internal so gateway in Docker can reach native services on host. */\n\tnativeServiceIds?: Set<string>;\n}\n\n/**\n * Generates `.env.example` and `.env` file contents from resolved services.\n *\n * - `.env.example`: every env var with descriptive comments, placeholders for secrets\n * - `.env`: same vars but secrets filled with cryptographically random values when generateSecrets is true\n */\nexport function generateEnvFiles(\n\tresolved: ResolverOutput,\n\toptions: EnvGeneratorOptions,\n): { envExample: string; env: string } {\n\tconst version = options.openclawVersion ?? \"latest\";\n\tconst lines: { comment: string; key: string; exampleValue: string; actualValue: string }[] = [];\n\n\t// ── Base OpenClaw Variables ──────────────────────────────────────────────\n\n\tlines.push({\n\t\tcomment: formatComment(\"OpenClaw version to deploy\", \"OpenClaw Core\", true, false),\n\t\tkey: \"OPENCLAW_VERSION\",\n\t\texampleValue: version,\n\t\tactualValue: version,\n\t});\n\n\tconst gatewayToken = options.generateSecrets ? randomBytes(24).toString(\"hex\") : \"\";\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Authentication token for the OpenClaw gateway API\",\n\t\t\t\"OpenClaw Core\",\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t),\n\t\tkey: \"OPENCLAW_GATEWAY_TOKEN\",\n\t\texampleValue: \"your_gateway_token_here\",\n\t\tactualValue: gatewayToken,\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\"Port the OpenClaw gateway listens on\", \"OpenClaw Core\", true, false),\n\t\tkey: \"OPENCLAW_GATEWAY_PORT\",\n\t\texampleValue: \"18789\",\n\t\tactualValue: \"18789\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Port for the OpenClaw ACP bridge (WebSocket)\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_BRIDGE_PORT\",\n\t\texampleValue: \"18790\",\n\t\tactualValue: \"18790\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Gateway network bind mode (lan for Docker networking, loopback for local-only)\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_GATEWAY_BIND\",\n\t\texampleValue: \"lan\",\n\t\tactualValue: \"lan\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Host path to OpenClaw configuration directory\",\n\t\t\t\"OpenClaw Core\",\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_CONFIG_DIR\",\n\t\texampleValue: \"./openclaw/config\",\n\t\tactualValue: \"./openclaw/config\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Host path to OpenClaw workspace directory\",\n\t\t\t\"OpenClaw Core\",\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_WORKSPACE_DIR\",\n\t\texampleValue: \"./openclaw/workspace\",\n\t\tactualValue: \"./openclaw/workspace\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"OpenClaw Docker image override (default uses ghcr.io/openclaw/openclaw)\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_IMAGE\",\n\t\texampleValue: \"\",\n\t\tactualValue: \"\",\n\t});\n\n\tif (options.domain) {\n\t\tlines.push({\n\t\t\tcomment: formatComment(\"Primary domain for service routing\", \"OpenClaw Core\", false, false),\n\t\t\tkey: \"OPENCLAW_DOMAIN\",\n\t\t\texampleValue: \"example.com\",\n\t\t\tactualValue: options.domain,\n\t\t});\n\t}\n\n\t// Claude web-provider session variables (optional)\n\tlines.push({\n\t\tcomment:\n\t\t\t\"\\n# ═══════════════════════════════════════════════════════════════════════════════\\n# Claude Web Provider (optional)\\n# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\tkey: \"\",\n\t\texampleValue: \"\",\n\t\tactualValue: \"\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Claude AI session key for web provider authentication\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t),\n\t\tkey: \"CLAUDE_AI_SESSION_KEY\",\n\t\texampleValue: \"your_claude_ai_session_key_here\",\n\t\tactualValue: \"\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Claude web session key for web provider authentication\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t),\n\t\tkey: \"CLAUDE_WEB_SESSION_KEY\",\n\t\texampleValue: \"your_claude_web_session_key_here\",\n\t\tactualValue: \"\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Claude web cookie for web provider authentication\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t),\n\t\tkey: \"CLAUDE_WEB_COOKIE\",\n\t\texampleValue: \"your_claude_web_cookie_here\",\n\t\tactualValue: \"\",\n\t});\n\n\t// ── Per-Service Database Passwords ──────────────────────────────────────\n\n\tconst dbReqs = getDbRequirements(resolved);\n\n\tif (dbReqs.length > 0) {\n\t\tlines.push({\n\t\t\tcomment:\n\t\t\t\t\"\\n# ═══════════════════════════════════════════════════════════════════════════════\\n# Per-Service Database Passwords\\n# Each service gets its own PostgreSQL database and credentials\\n# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\t\tkey: \"\",\n\t\t\texampleValue: \"\",\n\t\t\tactualValue: \"\",\n\t\t});\n\n\t\tfor (const req of dbReqs) {\n\t\t\tconst secretValue = options.generateSecrets ? randomBytes(24).toString(\"hex\") : \"\";\n\n\t\t\tlines.push({\n\t\t\t\tcomment: formatComment(\n\t\t\t\t\t`PostgreSQL password for ${req.serviceName} (database: ${req.dbName}, user: ${req.dbUser})`,\n\t\t\t\t\treq.serviceName,\n\t\t\t\t\ttrue,\n\t\t\t\t\ttrue,\n\t\t\t\t),\n\t\t\t\tkey: req.passwordEnvVar,\n\t\t\t\texampleValue: `your_${req.passwordEnvVar.toLowerCase()}_here`,\n\t\t\t\tactualValue: secretValue,\n\t\t\t});\n\t\t}\n\t}\n\n\t// ── Service-Specific Variables ───────────────────────────────────────────\n\n\tconst dbPasswordKeys = dbReqs.map((r) => r.passwordEnvVar);\n\tconst seenKeys = new Set<string>([\n\t\t\"OPENCLAW_VERSION\",\n\t\t\"OPENCLAW_GATEWAY_TOKEN\",\n\t\t\"OPENCLAW_GATEWAY_PORT\",\n\t\t\"OPENCLAW_BRIDGE_PORT\",\n\t\t\"OPENCLAW_GATEWAY_BIND\",\n\t\t\"OPENCLAW_CONFIG_DIR\",\n\t\t\"OPENCLAW_WORKSPACE_DIR\",\n\t\t\"OPENCLAW_IMAGE\",\n\t\t\"OPENCLAW_DOMAIN\",\n\t\t\"CLAUDE_AI_SESSION_KEY\",\n\t\t\"CLAUDE_WEB_SESSION_KEY\",\n\t\t\"CLAUDE_WEB_COOKIE\",\n\t\t...dbPasswordKeys,\n\t]);\n\n\tfor (const { definition } of resolved.services) {\n\t\tconst allEnvVars = [...definition.environment, ...definition.openclawEnvVars];\n\n\t\tif (allEnvVars.length === 0) continue;\n\n\t\t// Section separator for this service\n\t\tlines.push({\n\t\t\tcomment: `\\n# ═══════════════════════════════════════════════════════════════════════════════\\n# ${definition.icon} ${definition.name}\\n# ═══════════════════════════════════════════════════════════════════════════════`,\n\t\t\tkey: \"\",\n\t\t\texampleValue: \"\",\n\t\t\tactualValue: \"\",\n\t\t});\n\n\t\tconst isNative = options.nativeServiceIds?.has(definition.id);\n\n\t\tfor (const envVar of allEnvVars) {\n\t\t\tif (seenKeys.has(envVar.key)) continue;\n\t\t\tseenKeys.add(envVar.key);\n\n\t\t\tconst secretValue = options.generateSecrets ? randomBytes(24).toString(\"hex\") : \"\";\n\n\t\t\t// For native services, host-like vars must point to host so gateway (in Docker) can reach them\n\t\t\tconst isHostVar = envVar.key.endsWith(\"_HOST\");\n\t\t\tconst hostValue = isNative && isHostVar ? \"host.docker.internal\" : null;\n\n\t\t\tconst exampleValue = hostValue\n\t\t\t\t? hostValue\n\t\t\t\t: envVar.secret\n\t\t\t\t\t? `your_${envVar.key.toLowerCase()}_here`\n\t\t\t\t\t: envVar.defaultValue;\n\n\t\t\tlet actualValue: string;\n\t\t\tif (hostValue) {\n\t\t\t\tactualValue = hostValue;\n\t\t\t} else if (envVar.secret) {\n\t\t\t\tactualValue = envVar.defaultValue.startsWith(\"${\") ? envVar.defaultValue : secretValue;\n\t\t\t} else {\n\t\t\t\tactualValue = envVar.defaultValue;\n\t\t\t}\n\n\t\t\tlines.push({\n\t\t\t\tcomment: formatComment(envVar.description, definition.name, envVar.required, envVar.secret),\n\t\t\t\tkey: envVar.key,\n\t\t\t\texampleValue,\n\t\t\t\tactualValue,\n\t\t\t});\n\t\t}\n\t}\n\n\t// ── Build output strings ────────────────────────────────────────────────\n\n\tconst header = [\n\t\t\"# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\t\"# OpenClaw Environment Configuration\",\n\t\t`# Generated at ${new Date().toISOString()}`,\n\t\t\"# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\t\"\",\n\t].join(\"\\n\");\n\n\tlet envExample = header;\n\tlet env = header;\n\n\tfor (const line of lines) {\n\t\tif (line.key === \"\") {\n\t\t\t// Section comment\n\t\t\tenvExample += `${line.comment}\\n`;\n\t\t\tenv += `${line.comment}\\n`;\n\t\t} else {\n\t\t\tenvExample += `${line.comment}\\n${line.key}=${line.exampleValue}\\n\\n`;\n\t\t\tenv += `${line.comment}\\n${line.key}=${line.actualValue}\\n\\n`;\n\t\t}\n\t}\n\n\treturn { envExample, env };\n}\n\n/**\n * Format a descriptive comment block for an environment variable.\n */\nfunction formatComment(\n\tdescription: string,\n\tserviceName: string,\n\trequired: boolean,\n\tsecret: boolean,\n): string {\n\treturn [\n\t\t`# ${description}`,\n\t\t`# Service: ${serviceName} | Required: ${required ? \"Yes\" : \"No\"} | Secret: ${secret ? \"Yes\" : \"No\"}`,\n\t].join(\"\\n\");\n}\n\n// ── Structured Env Vars ─────────────────────────────────────────────────────\n\nexport interface EnvVarGroup {\n\tserviceName: string;\n\tserviceIcon: string;\n\tserviceId: string;\n\tvars: {\n\t\tkey: string;\n\t\tdescription: string;\n\t\tsecret: boolean;\n\t\trequired: boolean;\n\t\tdefaultValue: string;\n\t}[];\n}\n\n/**\n * Returns environment variables grouped by service, suitable for UI rendering.\n *\n * - First group is always \"OpenClaw Core\" with base variables.\n * - Subsequent groups correspond to each resolved service.\n * - Variables are deduplicated across groups (first occurrence wins).\n */\nexport function getStructuredEnvVars(resolved: ResolverOutput): EnvVarGroup[] {\n\tconst groups: EnvVarGroup[] = [];\n\tconst seenKeys = new Set<string>();\n\n\t// ── OpenClaw Core group ──────────────────────────────────────────────────\n\tconst coreVars: EnvVarGroup[\"vars\"] = [\n\t\t{\n\t\t\tkey: \"OPENCLAW_VERSION\",\n\t\t\tdescription: \"OpenClaw version to deploy\",\n\t\t\tsecret: false,\n\t\t\trequired: true,\n\t\t\tdefaultValue: \"latest\",\n\t\t},\n\t\t{\n\t\t\tkey: \"OPENCLAW_GATEWAY_TOKEN\",\n\t\t\tdescription: \"Authentication token for the OpenClaw gateway API\",\n\t\t\tsecret: true,\n\t\t\trequired: true,\n\t\t\tdefaultValue: \"\",\n\t\t},\n\t\t{\n\t\t\tkey: \"OPENCLAW_GATEWAY_PORT\",\n\t\t\tdescription: \"Port the OpenClaw gateway listens on\",\n\t\t\tsecret: false,\n\t\t\trequired: true,\n\t\t\tdefaultValue: \"18789\",\n\t\t},\n\t];\n\n\tfor (const v of coreVars) {\n\t\tseenKeys.add(v.key);\n\t}\n\n\tgroups.push({\n\t\tserviceName: \"OpenClaw Core\",\n\t\tserviceIcon: \"⚙️\",\n\t\tserviceId: \"openclaw-core\",\n\t\tvars: coreVars,\n\t});\n\n\t// ── Per-service groups ───────────────────────────────────────────────────\n\tfor (const { definition } of resolved.services) {\n\t\tconst allEnvVars = [...definition.environment, ...definition.openclawEnvVars];\n\n\t\tconst vars: EnvVarGroup[\"vars\"] = [];\n\n\t\tfor (const envVar of allEnvVars) {\n\t\t\tif (seenKeys.has(envVar.key)) continue;\n\t\t\tseenKeys.add(envVar.key);\n\n\t\t\tvars.push({\n\t\t\t\tkey: envVar.key,\n\t\t\t\tdescription: envVar.description,\n\t\t\t\tsecret: envVar.secret,\n\t\t\t\trequired: envVar.required,\n\t\t\t\tdefaultValue: envVar.defaultValue,\n\t\t\t});\n\t\t}\n\n\t\tif (vars.length === 0) continue;\n\n\t\tgroups.push({\n\t\t\tserviceName: definition.name,\n\t\t\tserviceIcon: definition.icon,\n\t\t\tserviceId: definition.id,\n\t\t\tvars,\n\t\t});\n\t}\n\n\treturn groups;\n}\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,iBACf,UACA,SACsC;CACtC,MAAM,UAAU,QAAQ,mBAAmB;CAC3C,MAAM,QAAuF,EAAE;AAI/F,OAAM,KAAK;EACV,SAAS,cAAc,8BAA8B,iBAAiB,MAAM,MAAM;EAClF,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;CAEF,MAAM,eAAe,QAAQ,kBAAkB,YAAY,GAAG,CAAC,SAAS,MAAM,GAAG;AAEjF,OAAM,KAAK;EACV,SAAS,cACR,qDACA,iBACA,MACA,KACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cAAc,wCAAwC,iBAAiB,MAAM,MAAM;EAC5F,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cACR,gDACA,iBACA,OACA,MACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cACR,kFACA,iBACA,OACA,MACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cACR,iDACA,iBACA,MACA,MACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cACR,6CACA,iBACA,MACA,MACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cACR,2EACA,iBACA,OACA,MACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,KAAI,QAAQ,OACX,OAAM,KAAK;EACV,SAAS,cAAc,sCAAsC,iBAAiB,OAAO,MAAM;EAC3F,KAAK;EACL,cAAc;EACd,aAAa,QAAQ;EACrB,CAAC;AAIH,OAAM,KAAK;EACV,SACC;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cACR,yDACA,iBACA,OACA,KACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cACR,0DACA,iBACA,OACA,KACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cACR,qDACA,iBACA,OACA,KACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,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B,QAAO,KAAK;EACX,aAAa;EACb,aAAa;EACb,WAAW;EACX,MAAM;EACN,CAAC;AAGF,MAAK,MAAM,EAAE,gBAAgB,SAAS,UAAU;EAC/C,MAAM,aAAa,CAAC,GAAG,WAAW,aAAa,GAAG,WAAW,gBAAgB;EAE7E,MAAM,OAA4B,EAAE;AAEpC,OAAK,MAAM,UAAU,YAAY;AAChC,OAAI,SAAS,IAAI,OAAO,IAAI,CAAE;AAC9B,YAAS,IAAI,OAAO,IAAI;AAExB,QAAK,KAAK;IACT,KAAK,OAAO;IACZ,aAAa,OAAO;IACpB,QAAQ,OAAO;IACf,UAAU,OAAO;IACjB,cAAc,OAAO;IACrB,CAAC;;AAGH,MAAI,KAAK,WAAW,EAAG;AAEvB,SAAO,KAAK;GACX,aAAa,WAAW;GACxB,aAAa,WAAW;GACxB,WAAW,WAAW;GACtB;GACA,CAAC;;AAGH,QAAO"}
1
+ {"version":3,"file":"env.mjs","names":[],"sources":["../../src/generators/env.ts"],"sourcesContent":["import { randomBytes } from \"node:crypto\";\nimport type { ResolverOutput } from \"../types.js\";\nimport { getDbRequirements } from \"./postgres-init.js\";\n\n/**\n * Options for environment file generation.\n */\nexport interface EnvGeneratorOptions {\n\tgenerateSecrets: boolean;\n\tdomain?: string;\n\topenclawVersion?: string;\n\t/** When set, host-like vars (e.g. REDIS_HOST) for these services use host.docker.internal so gateway in Docker can reach native services on host. */\n\tnativeServiceIds?: Set<string>;\n}\n\n/**\n * Generates `.env.example` and `.env` file contents from resolved services.\n *\n * - `.env.example`: every env var with descriptive comments, placeholders for secrets\n * - `.env`: same vars but secrets filled with cryptographically random values when generateSecrets is true\n */\nexport function generateEnvFiles(\n\tresolved: ResolverOutput,\n\toptions: EnvGeneratorOptions,\n): { envExample: string; env: string } {\n\tconst version = options.openclawVersion ?? \"latest\";\n\tconst lines: { comment: string; key: string; exampleValue: string; actualValue: string }[] = [];\n\n\t// ── Base OpenClaw Variables ──────────────────────────────────────────────\n\n\tlines.push({\n\t\tcomment: formatComment(\"OpenClaw version to deploy\", \"OpenClaw Core\", true, false),\n\t\tkey: \"OPENCLAW_VERSION\",\n\t\texampleValue: version,\n\t\tactualValue: version,\n\t});\n\n\tconst gatewayToken = options.generateSecrets ? randomBytes(24).toString(\"hex\") : \"\";\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Authentication token for the OpenClaw gateway API\",\n\t\t\t\"OpenClaw Core\",\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t),\n\t\tkey: \"OPENCLAW_GATEWAY_TOKEN\",\n\t\texampleValue: \"your_gateway_token_here\",\n\t\tactualValue: gatewayToken,\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\"Port the OpenClaw gateway listens on\", \"OpenClaw Core\", true, false),\n\t\tkey: \"OPENCLAW_GATEWAY_PORT\",\n\t\texampleValue: \"18789\",\n\t\tactualValue: \"18789\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Port for the OpenClaw ACP bridge (WebSocket)\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_BRIDGE_PORT\",\n\t\texampleValue: \"18790\",\n\t\tactualValue: \"18790\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Gateway network bind mode (lan for Docker networking, loopback for local-only)\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_GATEWAY_BIND\",\n\t\texampleValue: \"lan\",\n\t\tactualValue: \"lan\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Host path to OpenClaw configuration directory\",\n\t\t\t\"OpenClaw Core\",\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_CONFIG_DIR\",\n\t\texampleValue: \"./openclaw/config\",\n\t\tactualValue: \"./openclaw/config\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Host path to OpenClaw workspace directory\",\n\t\t\t\"OpenClaw Core\",\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_WORKSPACE_DIR\",\n\t\texampleValue: \"./openclaw/workspace\",\n\t\tactualValue: \"./openclaw/workspace\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"OpenClaw Docker image override (default uses ghcr.io/openclaw/openclaw)\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t),\n\t\tkey: \"OPENCLAW_IMAGE\",\n\t\texampleValue: \"\",\n\t\tactualValue: \"\",\n\t});\n\n\tif (options.domain) {\n\t\tlines.push({\n\t\t\tcomment: formatComment(\"Primary domain for service routing\", \"OpenClaw Core\", false, false),\n\t\t\tkey: \"OPENCLAW_DOMAIN\",\n\t\t\texampleValue: \"example.com\",\n\t\t\tactualValue: options.domain,\n\t\t});\n\t}\n\n\t// ── AI Provider API Keys ─────────────────────────────────────────────────\n\n\tif (resolved.aiProviders && resolved.aiProviders.length > 0) {\n\t\tlines.push({\n\t\t\tcomment:\n\t\t\t\t\"\\n# ═══════════════════════════════════════════════════════════════════════════════\\n# AI Provider API Keys\\n# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\t\tkey: \"\",\n\t\t\texampleValue: \"\",\n\t\t\tactualValue: \"\",\n\t\t});\n\n\t\tfor (const provider of resolved.aiProviders) {\n\t\t\tif (provider === \"ollama\" || provider === \"lmstudio\" || provider === \"vllm\") continue;\n\n\t\t\tconst envKey = `${provider.toUpperCase()}_API_KEY`;\n\t\t\tlines.push({\n\t\t\t\tcomment: formatComment(`API Key for ${provider} AI models`, \"OpenClaw Core\", true, true),\n\t\t\t\tkey: envKey,\n\t\t\t\texampleValue: `your_${provider.toLowerCase()}_api_key_here`,\n\t\t\t\tactualValue: \"\",\n\t\t\t});\n\t\t}\n\t}\n\n\t// Claude web-provider session variables (optional)\n\tlines.push({\n\t\tcomment:\n\t\t\t\"\\n# ═══════════════════════════════════════════════════════════════════════════════\\n# Claude Web Provider (optional)\\n# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\tkey: \"\",\n\t\texampleValue: \"\",\n\t\tactualValue: \"\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Claude AI session key for web provider authentication\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t),\n\t\tkey: \"CLAUDE_AI_SESSION_KEY\",\n\t\texampleValue: \"your_claude_ai_session_key_here\",\n\t\tactualValue: \"\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Claude web session key for web provider authentication\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t),\n\t\tkey: \"CLAUDE_WEB_SESSION_KEY\",\n\t\texampleValue: \"your_claude_web_session_key_here\",\n\t\tactualValue: \"\",\n\t});\n\n\tlines.push({\n\t\tcomment: formatComment(\n\t\t\t\"Claude web cookie for web provider authentication\",\n\t\t\t\"OpenClaw Core\",\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t),\n\t\tkey: \"CLAUDE_WEB_COOKIE\",\n\t\texampleValue: \"your_claude_web_cookie_here\",\n\t\tactualValue: \"\",\n\t});\n\n\t// ── Per-Service Database Passwords ──────────────────────────────────────\n\n\tconst dbReqs = getDbRequirements(resolved);\n\n\tif (dbReqs.length > 0) {\n\t\tlines.push({\n\t\t\tcomment:\n\t\t\t\t\"\\n# ═══════════════════════════════════════════════════════════════════════════════\\n# Per-Service Database Passwords\\n# Each service gets its own PostgreSQL database and credentials\\n# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\t\tkey: \"\",\n\t\t\texampleValue: \"\",\n\t\t\tactualValue: \"\",\n\t\t});\n\n\t\tfor (const req of dbReqs) {\n\t\t\tconst secretValue = options.generateSecrets ? randomBytes(24).toString(\"hex\") : \"\";\n\n\t\t\tlines.push({\n\t\t\t\tcomment: formatComment(\n\t\t\t\t\t`PostgreSQL password for ${req.serviceName} (database: ${req.dbName}, user: ${req.dbUser})`,\n\t\t\t\t\treq.serviceName,\n\t\t\t\t\ttrue,\n\t\t\t\t\ttrue,\n\t\t\t\t),\n\t\t\t\tkey: req.passwordEnvVar,\n\t\t\t\texampleValue: `your_${req.passwordEnvVar.toLowerCase()}_here`,\n\t\t\t\tactualValue: secretValue,\n\t\t\t});\n\t\t}\n\t}\n\n\t// ── Service-Specific Variables ───────────────────────────────────────────\n\n\tconst dbPasswordKeys = dbReqs.map((r) => r.passwordEnvVar);\n\tconst aiProviderKeys = (resolved.aiProviders || []).map((p) => `${p.toUpperCase()}_API_KEY`);\n\tconst seenKeys = new Set<string>([\n\t\t\"OPENCLAW_VERSION\",\n\t\t\"OPENCLAW_GATEWAY_TOKEN\",\n\t\t\"OPENCLAW_GATEWAY_PORT\",\n\t\t\"OPENCLAW_BRIDGE_PORT\",\n\t\t\"OPENCLAW_GATEWAY_BIND\",\n\t\t\"OPENCLAW_CONFIG_DIR\",\n\t\t\"OPENCLAW_WORKSPACE_DIR\",\n\t\t\"OPENCLAW_IMAGE\",\n\t\t\"OPENCLAW_DOMAIN\",\n\t\t\"CLAUDE_AI_SESSION_KEY\",\n\t\t\"CLAUDE_WEB_SESSION_KEY\",\n\t\t\"CLAUDE_WEB_COOKIE\",\n\t\t...dbPasswordKeys,\n\t\t...aiProviderKeys,\n\t]);\n\n\tfor (const { definition } of resolved.services) {\n\t\tconst allEnvVars = [...definition.environment, ...definition.openclawEnvVars];\n\n\t\tif (allEnvVars.length === 0) continue;\n\n\t\t// Section separator for this service\n\t\tlines.push({\n\t\t\tcomment: `\\n# ═══════════════════════════════════════════════════════════════════════════════\\n# ${definition.icon} ${definition.name}\\n# ═══════════════════════════════════════════════════════════════════════════════`,\n\t\t\tkey: \"\",\n\t\t\texampleValue: \"\",\n\t\t\tactualValue: \"\",\n\t\t});\n\n\t\tconst isNative = options.nativeServiceIds?.has(definition.id);\n\n\t\tfor (const envVar of allEnvVars) {\n\t\t\tif (seenKeys.has(envVar.key)) continue;\n\t\t\tseenKeys.add(envVar.key);\n\n\t\t\tconst secretValue = options.generateSecrets ? randomBytes(24).toString(\"hex\") : \"\";\n\n\t\t\t// For native services, host-like vars must point to host so gateway (in Docker) can reach them\n\t\t\tconst isHostVar = envVar.key.endsWith(\"_HOST\");\n\t\t\tconst hostValue = isNative && isHostVar ? \"host.docker.internal\" : null;\n\n\t\t\tconst exampleValue = hostValue\n\t\t\t\t? hostValue\n\t\t\t\t: envVar.secret\n\t\t\t\t\t? `your_${envVar.key.toLowerCase()}_here`\n\t\t\t\t\t: envVar.defaultValue;\n\n\t\t\tlet actualValue: string;\n\t\t\tif (hostValue) {\n\t\t\t\tactualValue = hostValue;\n\t\t\t} else if (envVar.secret) {\n\t\t\t\tactualValue = envVar.defaultValue.startsWith(\"${\") ? envVar.defaultValue : secretValue;\n\t\t\t} else {\n\t\t\t\tactualValue = envVar.defaultValue;\n\t\t\t}\n\n\t\t\tlines.push({\n\t\t\t\tcomment: formatComment(envVar.description, definition.name, envVar.required, envVar.secret),\n\t\t\t\tkey: envVar.key,\n\t\t\t\texampleValue,\n\t\t\t\tactualValue,\n\t\t\t});\n\t\t}\n\t}\n\n\t// ── Build output strings ────────────────────────────────────────────────\n\n\tconst header = [\n\t\t\"# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\t\"# OpenClaw Environment Configuration\",\n\t\t`# Generated at ${new Date().toISOString()}`,\n\t\t\"# ═══════════════════════════════════════════════════════════════════════════════\",\n\t\t\"\",\n\t].join(\"\\n\");\n\n\tlet envExample = header;\n\tlet env = header;\n\n\tfor (const line of lines) {\n\t\tif (line.key === \"\") {\n\t\t\t// Section comment\n\t\t\tenvExample += `${line.comment}\\n`;\n\t\t\tenv += `${line.comment}\\n`;\n\t\t} else {\n\t\t\tenvExample += `${line.comment}\\n${line.key}=${line.exampleValue}\\n\\n`;\n\t\t\tenv += `${line.comment}\\n${line.key}=${line.actualValue}\\n\\n`;\n\t\t}\n\t}\n\n\treturn { envExample, env };\n}\n\n/**\n * Format a descriptive comment block for an environment variable.\n */\nfunction formatComment(\n\tdescription: string,\n\tserviceName: string,\n\trequired: boolean,\n\tsecret: boolean,\n): string {\n\treturn [\n\t\t`# ${description}`,\n\t\t`# Service: ${serviceName} | Required: ${required ? \"Yes\" : \"No\"} | Secret: ${secret ? \"Yes\" : \"No\"}`,\n\t].join(\"\\n\");\n}\n\n// ── Structured Env Vars ─────────────────────────────────────────────────────\n\nexport interface EnvVarGroup {\n\tserviceName: string;\n\tserviceIcon: string;\n\tserviceId: string;\n\tvars: {\n\t\tkey: string;\n\t\tdescription: string;\n\t\tsecret: boolean;\n\t\trequired: boolean;\n\t\tdefaultValue: string;\n\t}[];\n}\n\n/**\n * Returns environment variables grouped by service, suitable for UI rendering.\n *\n * - First group is always \"OpenClaw Core\" with base variables.\n * - Subsequent groups correspond to each resolved service.\n * - Variables are deduplicated across groups (first occurrence wins).\n */\nexport function getStructuredEnvVars(resolved: ResolverOutput): EnvVarGroup[] {\n\tconst groups: EnvVarGroup[] = [];\n\tconst seenKeys = new Set<string>();\n\n\t// ── OpenClaw Core group ──────────────────────────────────────────────────\n\tconst coreVars: EnvVarGroup[\"vars\"] = [\n\t\t{\n\t\t\tkey: \"OPENCLAW_VERSION\",\n\t\t\tdescription: \"OpenClaw version to deploy\",\n\t\t\tsecret: false,\n\t\t\trequired: true,\n\t\t\tdefaultValue: \"latest\",\n\t\t},\n\t\t{\n\t\t\tkey: \"OPENCLAW_GATEWAY_TOKEN\",\n\t\t\tdescription: \"Authentication token for the OpenClaw gateway API\",\n\t\t\tsecret: true,\n\t\t\trequired: true,\n\t\t\tdefaultValue: \"\",\n\t\t},\n\t\t{\n\t\t\tkey: \"OPENCLAW_GATEWAY_PORT\",\n\t\t\tdescription: \"Port the OpenClaw gateway listens on\",\n\t\t\tsecret: false,\n\t\t\trequired: true,\n\t\t\tdefaultValue: \"18789\",\n\t\t},\n\t];\n\n\tfor (const v of coreVars) {\n\t\tseenKeys.add(v.key);\n\t}\n\n\tgroups.push({\n\t\tserviceName: \"OpenClaw Core\",\n\t\tserviceIcon: \"⚙️\",\n\t\tserviceId: \"openclaw-core\",\n\t\tvars: coreVars,\n\t});\n\n\t// ── Per-service groups ───────────────────────────────────────────────────\n\tfor (const { definition } of resolved.services) {\n\t\tconst allEnvVars = [...definition.environment, ...definition.openclawEnvVars];\n\n\t\tconst vars: EnvVarGroup[\"vars\"] = [];\n\n\t\tfor (const envVar of allEnvVars) {\n\t\t\tif (seenKeys.has(envVar.key)) continue;\n\t\t\tseenKeys.add(envVar.key);\n\n\t\t\tvars.push({\n\t\t\t\tkey: envVar.key,\n\t\t\t\tdescription: envVar.description,\n\t\t\t\tsecret: envVar.secret,\n\t\t\t\trequired: envVar.required,\n\t\t\t\tdefaultValue: envVar.defaultValue,\n\t\t\t});\n\t\t}\n\n\t\tif (vars.length === 0) continue;\n\n\t\tgroups.push({\n\t\t\tserviceName: definition.name,\n\t\t\tserviceIcon: definition.icon,\n\t\t\tserviceId: definition.id,\n\t\t\tvars,\n\t\t});\n\t}\n\n\treturn groups;\n}\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,iBACf,UACA,SACsC;CACtC,MAAM,UAAU,QAAQ,mBAAmB;CAC3C,MAAM,QAAuF,EAAE;AAI/F,OAAM,KAAK;EACV,SAAS,cAAc,8BAA8B,iBAAiB,MAAM,MAAM;EAClF,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;CAEF,MAAM,eAAe,QAAQ,kBAAkB,YAAY,GAAG,CAAC,SAAS,MAAM,GAAG;AAEjF,OAAM,KAAK;EACV,SAAS,cACR,qDACA,iBACA,MACA,KACA;EACD,KAAK;EACL,cAAc;EACd,aAAa;EACb,CAAC;AAEF,OAAM,KAAK;EACV,SAAS,cAAc,wCAAwC,iBAAiB,MAAM,MAAM;EAC5F,KAAK;EACL,cAAc;EACd,a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,MAAM,WAAgC;EACrC;GACC,KAAK;GACL,aAAa;GACb,QAAQ;GACR,UAAU;GACV,cAAc;GACd;EACD;GACC,KAAK;GACL,aAAa;GACb,QAAQ;GACR,UAAU;GACV,cAAc;GACd;EACD;GACC,KAAK;GACL,aAAa;GACb,QAAQ;GACR,UAAU;GACV,cAAc;GACd;EACD;AAED,MAAK,MAAM,KAAK,SACf,UAAS,IAAI,EAAE,IAAI;AAGpB,QAAO,KAAK;EACX,aAAa;EACb,aAAa;EACb,WAAW;EACX,MAAM;EACN,CAAC;AAGF,MAAK,MAAM,EAAE,gBAAgB,SAAS,UAAU;EAC/C,MAAM,aAAa,CAAC,GAAG,WAAW,aAAa,GAAG,WAAW,gBAAgB;EAE7E,MAAM,OAA4B,EAAE;AAEpC,OAAK,MAAM,UAAU,YAAY;AAChC,OAAI,SAAS,IAAI,OAAO,IAAI,CAAE;AAC9B,YAAS,IAAI,OAAO,IAAI;AAExB,QAAK,KAAK;IACT,KAAK,OAAO;IACZ,aAAa,OAAO;IACpB,QAAQ,OAAO;IACf,UAAU,OAAO;IACjB,cAAc,OAAO;IACrB,CAAC;;AAGH,MAAI,KAAK,WAAW,EAAG;AAEvB,SAAO,KAAK;GACX,aAAa,WAAW;GACxB,aAAa,WAAW;GACxB,WAAW,WAAW;GACtB;GACA,CAAC;;AAGH,QAAO"}
@@ -0,0 +1,10 @@
1
+ import { GsdRuntime } from "../types.mjs";
2
+
3
+ //#region src/generators/get-shit-done.d.ts
4
+ declare function generateGsdScripts(runtimes: GsdRuntime[] | undefined): {
5
+ sh: string;
6
+ ps1: string;
7
+ } | undefined;
8
+ //#endregion
9
+ export { generateGsdScripts };
10
+ //# sourceMappingURL=get-shit-done.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-shit-done.d.mts","names":[],"sources":["../../src/generators/get-shit-done.ts"],"mappings":";;;iBAEgB,kBAAA,CACf,QAAA,EAAU,UAAA;EACN,EAAA;EAAY,GAAA;AAAA"}
@@ -0,0 +1,38 @@
1
+ //#region src/generators/get-shit-done.ts
2
+ function generateGsdScripts(runtimes) {
3
+ if (!runtimes || runtimes.length === 0) return;
4
+ const flags = runtimes.map((r) => `--${r}`).join(" ");
5
+ return {
6
+ sh: `#!/usr/bin/env bash
7
+ # Automatically generated by Better-OpenClaw
8
+
9
+ if ! command -v npx &> /dev/null; then
10
+ echo "Error: Node.js (npx) is not installed. Please install Node.js."
11
+ exit 1
12
+ fi
13
+
14
+ echo "Installing Get-Shit-Done workflows for requested runtimes: ${runtimes.join(", ")}"
15
+ npx yes | npx get-shit-done-cc@latest --local ${flags}
16
+
17
+ echo "GSD Integration Complete!"
18
+ echo "Check the injected folders matching your target platform (e.g. .claude, .codex)."
19
+ `,
20
+ ps1: `# Automatically generated by Better-OpenClaw
21
+
22
+ if (!(Get-Command npx -ErrorAction SilentlyContinue)) {
23
+ Write-Error "Error: Node.js (npx) is not installed. Please install Node.js."
24
+ exit 1
25
+ }
26
+
27
+ Write-Host "Installing Get-Shit-Done workflows for requested runtimes: ${runtimes.join(", ")}"
28
+ npx get-shit-done-cc@latest --local ${flags}
29
+
30
+ Write-Host "GSD Integration Complete!"
31
+ Write-Host "Check the injected folders matching your target platform (e.g. .claude, .codex)."
32
+ `
33
+ };
34
+ }
35
+
36
+ //#endregion
37
+ export { generateGsdScripts };
38
+ //# sourceMappingURL=get-shit-done.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-shit-done.mjs","names":[],"sources":["../../src/generators/get-shit-done.ts"],"sourcesContent":["import type { GsdRuntime } from \"../types.js\";\n\nexport function generateGsdScripts(\n\truntimes: GsdRuntime[] | undefined,\n): { sh: string; ps1: string } | undefined {\n\tif (!runtimes || runtimes.length === 0) {\n\t\treturn undefined;\n\t}\n\n\t// Map runtimes to their corresponding CLI flags for GSD installer\n\tconst flags = runtimes.map((r) => `--${r}`).join(\" \");\n\n\tconst sh = `#!/usr/bin/env bash\n# Automatically generated by Better-OpenClaw\n\nif ! command -v npx &> /dev/null; then\n echo \"Error: Node.js (npx) is not installed. Please install Node.js.\"\n exit 1\nfi\n\necho \"Installing Get-Shit-Done workflows for requested runtimes: ${runtimes.join(\", \")}\"\nnpx yes | npx get-shit-done-cc@latest --local ${flags}\n\necho \"GSD Integration Complete!\"\necho \"Check the injected folders matching your target platform (e.g. .claude, .codex).\"\n`;\n\n\tconst ps1 = `# Automatically generated by Better-OpenClaw\n\nif (!(Get-Command npx -ErrorAction SilentlyContinue)) {\n Write-Error \"Error: Node.js (npx) is not installed. Please install Node.js.\"\n exit 1\n}\n\nWrite-Host \"Installing Get-Shit-Done workflows for requested runtimes: ${runtimes.join(\", \")}\"\nnpx get-shit-done-cc@latest --local ${flags}\n\nWrite-Host \"GSD Integration Complete!\"\nWrite-Host \"Check the injected folders matching your target platform (e.g. .claude, .codex).\"\n`;\n\n\treturn { sh, ps1 };\n}\n"],"mappings":";AAEA,SAAgB,mBACf,UAC0C;AAC1C,KAAI,CAAC,YAAY,SAAS,WAAW,EACpC;CAID,MAAM,QAAQ,SAAS,KAAK,MAAM,KAAK,IAAI,CAAC,KAAK,IAAI;AA+BrD,QAAO;EAAE,IA7BE;;;;;;;;mEAQuD,SAAS,KAAK,KAAK,CAAC;gDACvC,MAAM;;;;;EAoBxC,KAdD;;;;;;;yEAO4D,SAAS,KAAK,KAAK,CAAC;sCACvD,MAAM;;;;;EAMzB"}
@@ -0,0 +1,11 @@
1
+ import { ResolverOutput } from "../types.mjs";
2
+
3
+ //#region src/generators/openclaw-json.d.ts
4
+ /**
5
+ * Generates a default `openclaw/config/openclaw.json` tailored
6
+ * to the services installed in the stack.
7
+ */
8
+ declare function generateOpenClawConfig(resolved: ResolverOutput): string;
9
+ //#endregion
10
+ export { generateOpenClawConfig };
11
+ //# sourceMappingURL=openclaw-json.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openclaw-json.d.mts","names":[],"sources":["../../src/generators/openclaw-json.ts"],"mappings":";;;;;AAgRA;;iBAAgB,sBAAA,CAAuB,QAAA,EAAU,cAAA"}