@flisk-sh/flisk 1.3.198 → 1.3.199
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.
- package/cli/dist/cli.js +25 -0
- package/cli/dist/commands/open.js +8 -0
- package/cli/dist/utils/one-command.js +46 -0
- package/cli/dist-bundle/{chunk-KBGQ4NJE.js → chunk-3SPYAO2E.js} +1 -1
- package/cli/dist-bundle/chunk-6357RMGA.js +4 -0
- package/cli/dist-bundle/{chunk-SB5WAMSU.js → chunk-7IWOM6M2.js} +1 -1
- package/cli/dist-bundle/{chunk-US4D5GJJ.js → chunk-GW7N23FV.js} +1 -1
- package/cli/dist-bundle/{chunk-DWHA5YKT.js → chunk-HSNRMF4B.js} +1 -1
- package/cli/dist-bundle/{chunk-YUARXGF4.js → chunk-WMK2PS63.js} +2 -2
- package/cli/dist-bundle/cli.js +191 -191
- package/cli/dist-bundle/{cold-preflight-5TVSNLIV.js → cold-preflight-WR2M53Z6.js} +1 -1
- package/cli/dist-bundle/one-command-7OW747ML.js +4 -0
- package/cli/dist-bundle/open-635MSZHV.js +2 -0
- package/cli/dist-bundle/{project-5GTJYFAE.js → project-R7P6QBF4.js} +1 -1
- package/cli/package.json +1 -1
- package/package.json +1 -1
- package/cli/dist-bundle/chunk-WPQOTHB5.js +0 -4
- package/cli/dist-bundle/one-command-TKXMWXCK.js +0 -4
- package/cli/dist-bundle/open-5SUD6LKB.js +0 -2
package/cli/dist/cli.js
CHANGED
|
@@ -53,6 +53,31 @@ if (templateArg) {
|
|
|
53
53
|
const { runStackQuiet } = await import("./utils/one-command.js");
|
|
54
54
|
const { openFirstFrontend } = await import("./commands/open.js");
|
|
55
55
|
const { startSpinner } = await import("./utils/spinner.js");
|
|
56
|
+
// A stack for this project may already be running (the same example in another folder
|
|
57
|
+
// shares its compose project). Then there is nothing to start: open what is up.
|
|
58
|
+
const { findReadyFrontend } = await import("./commands/open.js");
|
|
59
|
+
const running = await findReadyFrontend(destination, 0);
|
|
60
|
+
if (running) {
|
|
61
|
+
console.log(chalk.gray(`A stack for this project is already running (${running.name}).`));
|
|
62
|
+
const { openFirstFrontend } = await import("./commands/open.js");
|
|
63
|
+
await openFirstFrontend(destination);
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
// A fresh clone has no host dependencies, and the stack typechecks the services on the
|
|
67
|
+
// host, so install them before the stack starts.
|
|
68
|
+
const { installServiceDependencies } = await import("./utils/one-command.js");
|
|
69
|
+
const installSpinner = startSpinner("Installing the service dependencies...");
|
|
70
|
+
const installs = await installServiceDependencies(destination);
|
|
71
|
+
const failed = installs.filter((entry) => !entry.ok);
|
|
72
|
+
if (failed.length > 0) {
|
|
73
|
+
installSpinner.fail("Some services could not install their dependencies.");
|
|
74
|
+
for (const entry of failed) {
|
|
75
|
+
console.log(chalk.yellow(` - ${entry.dir}: run "bun install" there`));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
installSpinner.succeed("The service dependencies are installed.");
|
|
80
|
+
}
|
|
56
81
|
const spinner = startSpinner("Starting the stack (the first build takes a minute)...");
|
|
57
82
|
const outcome = await runStackQuiet(binPath, destination);
|
|
58
83
|
if (!outcome.ok) {
|
|
@@ -53,6 +53,14 @@ export async function pickReadyFrontend(targets, waitMs = 30000, onWait) {
|
|
|
53
53
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The first frontend of the project that answers, or undefined when none does. With a wait of
|
|
58
|
+
* zero this is a cheap "is a stack for this project already running?" check.
|
|
59
|
+
*/
|
|
60
|
+
export async function findReadyFrontend(projectRoot, waitMs = 0, onWait) {
|
|
61
|
+
const targets = await listFrontendTargets(projectRoot);
|
|
62
|
+
return pickReadyFrontend(targets, waitMs, onWait);
|
|
63
|
+
}
|
|
56
64
|
/**
|
|
57
65
|
* Opens the first ready frontend of the project in the browser. Returns the URL it opened, or
|
|
58
66
|
* null when the project has no frontend.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright (c) 2026 Flisk Landscape contributors
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
+
import { readdirSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
4
6
|
/** The marker the stack prints before the frontend URLs. */
|
|
5
7
|
const FRONTEND_MARKER = "Frontend URLs";
|
|
6
8
|
/** Picks the first frontend URL out of the `flisk up` output, if it printed one. */
|
|
@@ -95,3 +97,47 @@ export function nextAvailableProjectDir(base, isTaken) {
|
|
|
95
97
|
}
|
|
96
98
|
return base;
|
|
97
99
|
}
|
|
100
|
+
/** The service folders of a project that have their own package.json. */
|
|
101
|
+
export function findServiceDirs(projectRoot, maxDepth = 4) {
|
|
102
|
+
const dirs = [];
|
|
103
|
+
const walk = (dir, depth) => {
|
|
104
|
+
if (depth > maxDepth)
|
|
105
|
+
return;
|
|
106
|
+
let entries;
|
|
107
|
+
try {
|
|
108
|
+
entries = readdirSync(dir, { withFileTypes: true }).map((entry) => entry.name);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (entries.includes("package.json"))
|
|
114
|
+
dirs.push(dir);
|
|
115
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
116
|
+
if (!entry.isDirectory() || entry.name === "node_modules" || entry.name.startsWith("."))
|
|
117
|
+
continue;
|
|
118
|
+
walk(join(dir, entry.name), depth + 1);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
walk(projectRoot, 0);
|
|
122
|
+
return dirs;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Installs the host dependencies of the services. The stack typechecks the services on the
|
|
126
|
+
* host, so a fresh clone needs its dependencies before it can come up.
|
|
127
|
+
*/
|
|
128
|
+
export async function installServiceDependencies(projectRoot, run = defaultRun) {
|
|
129
|
+
const results = [];
|
|
130
|
+
for (const dir of findServiceDirs(projectRoot)) {
|
|
131
|
+
const code = await run("bun", ["install"], dir);
|
|
132
|
+
results.push({ dir, ok: code === 0 });
|
|
133
|
+
}
|
|
134
|
+
return results;
|
|
135
|
+
}
|
|
136
|
+
/** Runs a command and resolves with its exit code. */
|
|
137
|
+
function defaultRun(command, args, cwd) {
|
|
138
|
+
return new Promise((resolve) => {
|
|
139
|
+
const child = spawn(command, args, { cwd, stdio: "ignore" });
|
|
140
|
+
child.on("error", () => resolve(1));
|
|
141
|
+
child.on("close", (code) => resolve(code ?? 1));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
|
|
2
|
-
import{c as z,e as Q}from"./chunk-42IVF3YT.js";import{Fa as J,Ga as B,Qa as O,Ta as Y,cb as X,d as v,e as k,g as q,ga as L,h as x,i as P,j as F,k as W,l as A,p as d,q as N}from"./chunk-
|
|
2
|
+
import{c as z,e as Q}from"./chunk-42IVF3YT.js";import{Fa as J,Ga as B,Qa as O,Ta as Y,cb as X,d as v,e as k,g as q,ga as L,h as x,i as P,j as F,k as W,l as A,p as d,q as N}from"./chunk-GW7N23FV.js";import{b as V}from"./chunk-CF46CD6R.js";import{a as $}from"./chunk-6EA4DGCY.js";import{appendFileSync as le,existsSync as C,mkdirSync as fe,readFileSync as de,writeFileSync as Z}from"node:fs";import{dirname as pe,resolve as w}from"node:path";function ft(t,e,n){for(let[r,s]of e.entries())console.log(V.blue(`${s.emoji} ${s.description}...`)),s.type==="json"?me(t,s.filename,s.content):he(t,s.filename,String(s.content)),n&&n(s,r,e.length)}function ue(t,e,n=2){let r=`${JSON.stringify(e,null,n)}
|
|
3
3
|
`;Z(t,r,"utf-8")}function me(t,e,n,r=2){let s=w(t,e);ue(s,n,r)}function U(t,e){Z(t,e,"utf-8")}function he(t,e,n){let r=w(t,e);U(r,n)}function dt(t){C(t)||fe(t,{recursive:!0})}var ge=[".env",".tdk/.tdk-out/",".tdk/.project-id",".tdk/smoke/","node_modules/"];function Se(t){let e=w(t,".gitignore"),n=C(e)?de(e,"utf-8"):"",r=new Set(n.split(`
|
|
4
4
|
`).map(f=>f.trim().replace(/\/$/,""))),s=ge.filter(f=>!r.has(f.replace(/\/$/,"")));if(s.length===0)return[];let c=n&&!n.endsWith(`
|
|
5
5
|
`)?`
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
|
|
2
|
+
import{a as x}from"./chunk-DTIHDMED.js";import{g as w,h as y}from"./chunk-7IWOM6M2.js";import{Ra as h,ba as d,ca as u,d as l,k as f,ra as m,s as p,ta as g}from"./chunk-GW7N23FV.js";import{b as a}from"./chunk-CF46CD6R.js";import{Command as O}from"commander";import{readFileSync as $}from"node:fs";import{join as j}from"node:path";function A(n){let e=n.config;return e?Array.isArray(e.featuresEnabled)&&e.featuresEnabled.includes(l)?!0:(Array.isArray(e.dependsOn)?e.dependsOn:[]).some(t=>y.includes(t)):!1}function H(n,e){let i=n.replace(/-/g,"_"),t=[];for(let o of[...e].sort((r,s)=>r.name.localeCompare(s.name))){let r=o.resources.filter(A).map(s=>s.name);r.length!==0&&t.push({name:`${i}_${o.name.replace(/-/g,"_")}`,stack:o.name,services:r.sort()})}return t.length===0?null:{name:"postgres",databases:t}}function k(n){try{let e=JSON.parse($(j(n,".tdk",f),"utf-8"));return typeof e?.project?.name=="string"?e.project.name:null}catch{return null}}import{spawn as P}from"node:child_process";function N(n){try{let e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function S(n,e=process.platform,i=P){if(!N(n))return Promise.resolve(!1);let t,o;return e==="darwin"?(t="open",o=[n]):e==="win32"?(t="rundll32.exe",o=["url.dll,FileProtocolHandler",n]):(t="xdg-open",o=[n]),new Promise(r=>{try{let s=i(t,o,{stdio:"ignore",detached:!0,windowsHide:!0});s.once("error",()=>r(!1)),s.once("spawn",()=>{typeof s.unref=="function"&&s.unref(),r(!0)})}catch{r(!1)}})}function B(n,e=process.platform,i=P){return new Promise(t=>{let o,r;e==="darwin"?(o="pbcopy",r=[]):e==="win32"?(o="clip",r=[]):(o="xclip",r=["-selection","clipboard"]);try{let s=i(o,r,{stdio:["pipe","ignore","ignore"],windowsHide:!0});s.on("error",()=>{t(!1)}),s.on("close",c=>{t(c===0)}),s.stdin?(s.stdin.on("error",()=>{t(!1)}),s.stdin.write(n,"utf-8"),s.stdin.end()):t(!1)}catch{t(!1)}})}async function E(n){let{resources:e}=h(n),i=await w(n,{inspectDocker:!1}),{appBase:t}=m(i?.ingressHttp,n);return e.filter(o=>o.config?.appType==="frontend").map(o=>({name:o.name,url:`${t}${g(o)}`}))}async function b(n,e=2e3){try{return(await fetch(n,{signal:AbortSignal.timeout(e)})).status<500}catch{return!1}}async function T(n,e=3e4,i){if(n.length===0)return;let t=Date.now(),o=t+e;for(;;){for(let s of n)if(await b(s.url))return s;let r=Date.now()-t;if(r>=e)return;i?.(r),await new Promise(s=>setTimeout(s,2e3))}}async function Q(n,e=0,i){let t=await E(n);return T(t,e,i)}async function F(n){let e=n??p();if(!e)return console.log(a.yellow("Not in a Flisk project, so there is no frontend to open.")),console.log(a.gray("Run `flisk project --yes` first, or `flisk open` inside a project.")),null;let i=await E(e);if(i.length===0)return console.log(a.yellow("This project has no frontend service to open.")),console.log(a.gray("Start the stack with `flisk up` and add a frontend with `flisk resource`.")),null;let t=k(e);d(`Opening the first frontend of ${t??"this project"}`);for(let c of i)console.log(a.gray(` - ${c.name}: ${c.url}`));let o=x("Waiting for the frontend to answer..."),r=await T(i,12e4,c=>{o.text=`Waiting for the frontend to answer... ${Math.round(c/1e3)}s`});if(!r){o.fail("No frontend answered yet."),console.log(a.yellow("The stack is not serving the frontend yet.")),console.log(a.gray(" - Start the stack in another terminal: flisk up")),console.log(a.gray(" - Then run this again: flisk open"));for(let c of i)console.log(a.gray(` - ${c.name}: ${c.url}`));return null}o.succeed(`The frontend is up: ${r.name}`);let s=await S(r.url);return console.log(s?a.green(`
|
|
3
|
+
Opened ${r.url}`):a.yellow(`
|
|
4
|
+
Could not open a browser. Open ${r.url} yourself.`)),u("Run `flisk open` again to open the next frontend."),r.url}var X=new O("open").description("Open the first frontend of the project in your browser").action(async()=>{await F()});export{H as a,k as b,S as c,B as d,E as e,b as f,T as g,Q as h,F as i,X as j};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
|
|
2
|
-
import{Ta as w,cb as A,d as P,k as T}from"./chunk-
|
|
2
|
+
import{Ta as w,cb as A,d as P,k as T}from"./chunk-GW7N23FV.js";import{execFileSync as x}from"node:child_process";import{existsSync as G,mkdirSync as W,readFileSync as D,realpathSync as Y,writeFileSync as q}from"node:fs";import{join as S,resolve as V,sep as X}from"node:path";import{createServer as U}from"node:net";import{connect as K}from"node:net";function N(e,s=500){return new Promise(t=>{let r=K({port:e,host:"127.0.0.1"}),o=n=>{r.destroy(),t(n)};r.setTimeout(s,()=>o(!1)),r.once("connect",()=>o(!0)),r.once("error",()=>o(!1))})}var J={ingressHttp:{start:8080,end:8180},ingressHttps:{start:8443,end:8543},postgres:{start:15432,end:15532}},E={ingressHttp:"TDK_HTTP_PORT",ingressHttps:"TDK_HTTPS_PORT",postgres:"TDK_POSTGRES_PORT"},H={ingressHttp:80,ingressHttps:443,postgres:5432},k={ingressHttp:H.ingressHttp,ingressHttps:H.ingressHttps};function j(e,s){return e==="EACCES"&&s==="darwin"}async function b(e){return await N(e)?!1:new Promise(s=>{let t=U();t.once("error",r=>{s(j(r.code,process.platform))}),t.listen(e,"127.0.0.1",()=>t.close(()=>s(!0)))})}function B(e,s){let t=Number(s);if(!Number.isInteger(t)||t<1||t>65535)throw new Error(`${e} must be an integer between 1 and 65535 (received ${JSON.stringify(s)})`);return t}async function O(e={}){let s=e.env??process.env,t=e.isAvailable??b,r={ingressHttp:!1,ingressHttps:!1,postgres:!1},o={ingressHttp:"",ingressHttps:"",postgres:""},n={explicit:r},c=new Set;for(let a of["ingressHttp","ingressHttps","postgres"]){let f=s[E[a]],i=f!==void 0&&f.trim()!=="",u=e.ranges?.[a]??J[a],p=k[a],h=i?[B(E[a],f)]:[...p===void 0?[]:[p],...Array.from({length:u.end-u.start+1},(g,_)=>u.start+_)],d;for(let g of h)if(!c.has(g)){if(await t(g)){d=g;break}if(i)throw new Error(`${E[a]}=${g} is already in use. Choose a free host port and retry.`)}if(d===void 0)throw new Error(`No available host port in ${u.start}-${u.end} for ${a}. Set ${E[a]} to a free port and retry.`);c.add(d),n[a]=d,r[a]=i,o[a]=i?"explicit override":d===p?"requested port is free":`selected from fallback range ${u.start}-${u.end}`}return{...n,requested:{...H},reason:o}}function ue(e){return`Host ports: HTTP ${e.ingressHttp}, HTTPS ${e.ingressHttps}, Postgres ${e.postgres}`}var R=S(".tdk",".tdk-out","host-ports.json");function Q(e,s,t){return e.split(`
|
|
3
3
|
`).some(r=>{let[o="",n=""]=r.split("|"),c=o.toLowerCase(),a=s.toLowerCase();return(c.startsWith(`${a}_`)||c.startsWith(`${a}-`))&&n.includes(`:${t}->`)})}function F(e){let s=S(e,R);if(!G(s))return null;try{let t=JSON.parse(D(s,"utf-8"));if(!t||typeof t!="object")return null;let r=t;return!Number.isInteger(r.ingressHttp)||!Number.isInteger(r.ingressHttps)||!Number.isInteger(r.postgres)||!r.requested||!r.explicit||!r.reason?null:r}catch{return null}}function Se(e,s){let t=S(e,R);W(S(e,".tdk",".tdk-out"),{recursive:!0}),q(t,`${JSON.stringify(s,null,2)}
|
|
4
4
|
`,{encoding:"utf-8",mode:384})}function _e(e){process.env.TDK_HTTP_PORT=String(e.ingressHttp),process.env.TDK_HTTPS_PORT=String(e.ingressHttps),process.env.TDK_POSTGRES_PORT=String(e.postgres)}var z="com.docker.compose.project.working_dir";function Z(e,s,t){let r=new Set([V(s)]);try{r.add(Y(s))}catch{}return e.split(`
|
|
5
5
|
`).some(o=>{let[,n="",c=""]=o.split("|");return!c||!n.includes(`:${t}->`)?!1:[...r].some(a=>c===a||c.startsWith(`${a}${X}`))})}function Te(e,s,t=()=>x("docker",["ps","--format",`{{.Names}}|{{.Ports}}|{{.Label "${z}"}}`],{encoding:"utf-8",timeout:5e3})){let r=F(e);if(!r||r.ingressHttp===s)return s;try{if(Z(t(),e,r.ingressHttp))return r.ingressHttp}catch{}return s}async function Ee(e,s={}){let t=F(e),r=["TDK_HTTP_PORT","TDK_HTTPS_PORT","TDK_POSTGRES_PORT"].some(i=>process.env[i]);if(s.inspectDocker===!1&&t&&!r)return t;let o="";try{let i=JSON.parse(D(S(e,".tdk",T),"utf-8"));o=String(i?.project?.name??"tdk-project").replace(/-/g,"_").toLowerCase()}catch{o="tdk_project"}let n="";if(s.inspectDocker!==!1)try{n=x("docker",["ps","--format","{{.Names}}|{{.Ports}}"],{encoding:"utf-8",timeout:5e3})}catch{}let c=i=>Q(n,o,i),a=s.isPortFree??b,f=async i=>await a(i)||c(i);if(t&&!r){for(let i of[t.ingressHttp,t.ingressHttps,t.postgres])if(!await f(i))return O({isAvailable:f});for(let[i,u]of Object.entries(k)){let p=t[i];if(u!==void 0&&p!==u&&await f(u))return O({isAvailable:f})}return t}return O({isAvailable:f})}import{existsSync as ee,readFileSync as v}from"node:fs";import{join as l}from"node:path";var $=["postgres",P],L=["pre_alpha","alpha","beta","out_of_scope"];function te(e){return $.includes(e)}function C(e){try{return JSON.parse(v(l(e,".tdk",T),"utf-8"))}catch{return}}function m(e){try{return ee(e)?v(e,"utf-8"):void 0}catch{return}}function I(e,s){let t=o=>{let n=o;for(;n<e.length&&/\s/.test(e[n]);)n+=1;return n},r=0;for(;;){let o=e.indexOf(s,r);if(o===-1)return;let n=t(o+s.length);if(e[n]==="="&&(n=t(n+1),e[n]==="[")){let c=e.indexOf("]",n+1);return c===-1?void 0:[...e.slice(n+1,c).matchAll(/"([^"]+)"|'([^']+)'/g)].map(a=>a[1]??a[2]??"")}r=o+s.length}}function M(e){let s=l(e,".tdk",".tdk-out","Tiltfile"),t=m(s);if(t)return I(t,"ALWAYS_ENABLED_INFRA")}function se(e){let s=l(e,".tdk",".tdk-out","spec.master"),t=m(s);if(t!==void 0)return/"database-management"\s*:\s*True/.test(t)}function re(e){let s=l(e,".tdk",".tdk-out"),t=m(l(s,"Tiltfile")),r=m(l(s,"spec.master")),o=m(l(s,"tdk-cli-ext","discovery","config.star")),n=m(l(s,"tdk-cli-ext","engine","topologies","tilt","config","profiles.star"));if(!t||!r||!o||!n)return!1;let c=r.match(/PRE_ALPHA_RESOURCES\s*=\s*\{([^}]*)\}/)?.[1],a=I(o,"CORE_INFRA");return/FOCUS_MODE\s*,\s*FOCUS_ENABLED_ALL\s*,\s*FOCUS_ENABLED_RESOURCES\s*=\s*Config\.apply_focus\(cfg\)/.test(t)&&/if FOCUS_MODE and FOCUS_ENABLED_ALL\s*:/.test(t)&&/"[^"]+"\s*:\s*True|'[^']+'\s*:\s*True/.test(c??"")&&(a?.includes("postgres")??!1)&&/["']postgres["']\s*:\s*["']database-management["']/.test(o)&&/for infra in CORE_INFRA_EXPORT\s*:/.test(n)&&/needed\[INFRA_STACK_MAP_EXPORT\[infra\]\]\s*=\s*True/.test(n)}function ne(e){let s=C(e);if(!s)return!1;let t=s.phases??{};for(let o of L){let n=t[o]?.enabledStacks;if(Array.isArray(n)&&n.includes(P))return!0}let r=s.always_enabled_infra??A;return Array.isArray(r)&&r.includes(P)}function oe(e,s){let t=new Set;for(let n of $)t.add(n);for(let n of s)t.add(n.name),n.stack&&t.add(n.stack);let r=C(e);if(r){let n=r.phases??{};for(let a of L){let f=n[a]?.enabledStacks;if(Array.isArray(f))for(let i of f)t.add(i)}let c=r.always_enabled_infra??A;if(Array.isArray(c))for(let a of c)t.add(a)}let o=M(e);if(Array.isArray(o))for(let n of o)t.add(n);return t}function be(e,s=w(e)){let t=ne(e),r=M(e),o=Array.isArray(r)&&r.includes(P),n=se(e)===!0,c=t||o||n,a=!t&&re(e),f=oe(e,s),i=[],u=[];for(let d of s){let g=d.config?.dependsOn??[],_=!1;for(let y of g){if(te(y)){_=!0;continue}f.has(y)||u.push({resource:d.name,name:y})}_&&i.push(d.name)}let p=c||i.length>0,h=c?"feature":i.length>0?"dependsOn":"none";return{featureOn:c,featureOnFromProjectJson:t,featureOnFromTiltfile:o,featureOnFromSpecMaster:n,focusWouldEnableDatabaseManagement:a,dependsOnUsers:i,willStart:p,reason:h,unknownDependsOnNames:u}}export{O as a,ue as b,F as c,Se as d,_e as e,Te as f,Ee as g,$ as h,be as i};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
|
|
2
|
-
import{b as f}from"./chunk-CF46CD6R.js";var ar="Container Runtime",_="bring-your-own";var De="database-management",cr=".tiltignore",Ie="service.json",Q="docker-compose.yml",ur=".autogenerated",Ct="TILT_TECH_STACK.star",Dt="TILT_RESOURCE_DEFAULTS.star",B="project.json",je="package.json",fr=[Ct,Dt,"spec.master"],pr=["backend","frontend","library","sdk","worker","migrator","mcp","agent",_],lr={backend:["dev","build","start"],worker:["dev","build","start"],migrator:["dev","build","start"],mcp:["dev","build","start"],agent:["dev","build","start"],frontend:["dev","build"],library:["dev","build"],sdk:["dev","build"],[_]:[]};var Z=["monitoring","elk","debezium","golden_image","verdaccio"],dr={frontend:{base:3e3,min:3e3,max:3999,range:"3000-3999"},backend:{base:4e3,min:4e3,max:4999,range:"4000-4999"},mcp:{base:4e3,min:4e3,max:5999,range:"4000-5999"},agent:{base:4e3,min:4e3,max:5999,range:"4000-5999"},[_]:{base:4e3,min:4e3,max:5999,range:"4000-5999"},worker:{base:6e3,min:6e3,max:6999,range:"6000-6999"},health:{base:5e3,min:5e3,max:5999,range:"5000-5999"},migrator:{base:7e3,min:7e3,max:7999,range:"7000-7999"}},mr={tiltUi:10350,traefik:8080},ee="https://flisk.sh/docs/quickstart/";var Ne=["node_modules",".git",".tilt",".tilt-engine","dist","build",".prisma",".turbo","coverage","tmp","temp","__tests__","test","tests",".github",".vscode","docs"],Pe=["Dockerfile",Q,"docker-compose.yaml","Tiltfile","vite.config.ts","tsconfig.json","tsconfig.build.json"],It={infra:"\u{1F3D7}\uFE0F",core:"\u{1F527}",api:"\u26A1",app:"\u{1F3A8}",orchestrator:"\u2699\uFE0F"};function hr(e){let t=e.toLowerCase();for(let[n,r]of Object.entries(It))if(t.includes(n))return r;return"\u{1F4E6}"}import{existsSync as Nt}from"node:fs";import{dirname as Pt,join as Ft,resolve as Ue}from"node:path";import{cwd as Ut}from"node:process";var Fe={name:"tdk-cli-internal",private:!0,version:"1.3.198",description:"Flisk CLI \u2014 start services on your machine.",keywords:["flisk","tilt","cli","local-dev","microservices"],homepage:"https://github.com/flisk-sh/flisk#readme",bugs:{url:"https://github.com/flisk-sh/flisk/issues"},repository:{type:"git",url:"git+https://github.com/flisk-sh/flisk.git",directory:"cli"},license:"MIT",author:"Flisk Team",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",bin:{flisk:"bin/tdk.js"},files:["dist","dist-bundle","bin","templates","README.md","Tiltfile","engine","discovery","specs","ext","!ext/ide-components/code_executor","shared-platform-engineering/docker-templates"],scripts:{build:"tsc && node scripts/bundle.mjs","build:watch":"tsc --watch","check:dist":"npm run build && ../scripts/check-cli-dist.sh",lint:"biome check .","lint:fix":"biome check . --write",typecheck:"tsc --project tsconfig.typecheck.json",clean:"rm -rf dist",dev:"bun run build:watch",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage --coverage.reportOnFailure --coverage.reporter=text --coverage.reporter=html --coverage.reporter=json-summary --coverage.reporter=json --coverage.reportsDirectory=coverage --reporter=default --reporter=json --outputFile.json=test-results/vitest.json",prepack:"../scripts/stage-npm-engine.sh && npm run build"},dependencies:{commander:"^15.0.0",handlebars:"^4.7.8"},devDependencies:{"@biomejs/biome":"^2.5.13","@types/node":"^22.0.0","@types/react":"^19.3.0","@vitest/coverage-v8":"^5.0.2",ajv:"^8.17.1",chalk:"^6.0.1",esbuild:"^0.28.2",ink:"^8.0.0",knip:"^6.38.0",react:"^19.3.0","react-devtools-core":"^8.0.0",typescript:"^7.0.2",vite:"^8.3.3",vitest:"^5.0.0"},engines:{node:">=22.12.0"}};function E(e=Ut()){let t=Ue(e),n=Ue("/");for(;t!==n;){if(Nt(Ft(t,".tdk",B)))return t;let r=Pt(t);if(r===t)break;t=r}return null}var V=null;function Mt(){if(V)return V;let e=Fe;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid package.json: expected object");let t=e;return V={name:String(t.name??"@flisk-sh/flisk"),version:String(t.version??"0.0.0"),fullPackage:t},V}function wr(){return Mt().version}import{existsSync as Me}from"node:fs";import{delimiter as Le,extname as Be,join as Ve}from"node:path";import{delimiter as br,extname as Lt}from"node:path";function U(){return process.platform==="win32"}function Bt(e){return e==="linux"?"linux":e==="darwin"?"darwin":e==="win32"?"windows":null}function Vt(e){return e==="x64"?"amd64":e==="arm64"?"arm64":null}function Gt(e,t){let n=Bt(e),r=Vt(t);if(!n||!r||n==="windows"&&r!=="amd64")return null;let o=`tdk-${n}-${r}`;return n==="windows"?`${o}.exe`:o}function Ar(){return Gt(process.platform,process.arch)}function Rr(){return U()?"tdk.exe":"flisk"}function te(e,t=U()){return t?Lt(e)?[e]:[e,`${e}.exe`,`${e}.cmd`,`${e}.bat`]:[e]}function G(e){let t=process.env.PATH??process.env.Path??"",n=U(),r=te(e,n);if(n&&!Be(e))for(let o of(process.env.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";")){let s=o.toLowerCase();s&&!r.includes(`${e}${s}`)&&r.push(`${e}${s}`)}for(let o of t.split(Le))if(o)for(let s of r){let i=Ve(o,s);if(Me(i))return i}return null}function Ir(e){let t=process.env.PATH??process.env.Path??"",n=U(),r=te(e,n);if(n&&!Be(e))for(let i of(process.env.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";")){let a=i.toLowerCase();a&&!r.includes(`${e}${a}`)&&r.push(`${e}${a}`)}let o=[],s=new Set;for(let i of t.split(Le))if(i)for(let a of r){let c=Ve(i,a);if(!Me(c))continue;let p=n?c.toLowerCase():c;s.has(p)||(s.add(p),o.push(c))}return o}import{execFileSync as Wt,execSync as Kt}from"node:child_process";var Ge=1e4;function We(){let e=!1;if(process.platform==="win32")try{return Wt(G("docker")??"docker",["ps"],{stdio:"ignore",timeout:Ge,windowsHide:!0}),"running"}catch(t){return t.code==="ETIMEDOUT"?"unresponsive":"missing"}for(let t of["docker ps","colima status","podman ps"])try{return Kt(t,{stdio:"ignore",timeout:Ge}),"running"}catch(n){n.code==="ETIMEDOUT"&&(e=!0)}return e?"unresponsive":"missing"}function W(e,t){return e[t]??0}function Ht(e,t){let n=Array.from({length:t.length+1},(r,o)=>o);for(let r=1;r<=e.length;r++){let o=[r];for(let s=1;s<=t.length;s++){let i=e[r-1]===t[s-1]?0:1;o[s]=Math.min(W(o,s-1)+1,W(n,s)+1,W(n,s-1)+i)}n=o}return W(n,t.length)}function zt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length-1;n++)if(e[n]!==t[n]&&e[n]===t[n+1]&&e[n+1]===t[n]&&e.slice(0,n)===t.slice(0,n)&&e.slice(n+2)===t.slice(n+2))return!0;return!1}function Ke(e,t){if(e.length<2||t.length===0||t.includes(e))return;let n=e.toLowerCase(),r,o=Number.POSITIVE_INFINITY;for(let s of t){if(s.length===0)continue;let i=s.toLowerCase(),a=zt(n,i)?1:Ht(n,i),c=Math.max(1,Math.min(2,Math.floor(Math.max(n.length,i.length)/3)));a>c||(a<o||a===o&&(r===void 0||s<r))&&(r=s,o=a)}return r}import{spawn as Jt}from"node:child_process";import{join as qt}from"node:path";function Yt(e,t=[],n={}){return new Promise((r,o)=>{let s=[e,...t];n.verbose&&console.log(`Executing: tilt ${s.join(" ")}`);let i=Jt(G("tilt")??"tilt",s,{stdio:n.inheritStdio?"inherit":"pipe",shell:!1,windowsHide:process.platform==="win32",timeout:n.timeoutMs}),a="",c="";n.inheritStdio||(i.stdout?.on("data",p=>{a+=p.toString()}),i.stderr?.on("data",p=>{c+=p.toString()})),i.on("close",p=>{r({exitCode:p??1,stdout:a,stderr:c})}),i.on("error",p=>{o(new Error(`Failed to spawn tilt: ${p.message}`))})})}async function He(){try{return(await Yt("version",[],{inheritStdio:!1,timeoutMs:1e4})).exitCode===0}catch{return!1}}function Xt(){let e=E();if(!e)throw $.notInProject();return qt(e,".tdk",".tdk-out","Tiltfile")}function ze(e){let t=Xt();e.push("-f",t)}function Wr(e,t={}){let n=[];return ze(n),t.focusTargets&&t.focusTargets.length>0&&n.push("--",`--focus=${t.focusTargets.join(",")}`),n.push(...e),t.verbose&&!t.quiet&&n.push("--verbose"),t.watch&&n.push("--watch"),n}function Kr(e={}){let t=[];return ze(t),e.focusTargets&&e.focusTargets.length>0&&t.push("--",`--focus=${e.focusTargets.join(",")}`),t}function Je(e){return e instanceof Error?e.message:String(e)}function Zr(e,t){if(process.env.TDK_VERBOSE){let n=t!==void 0?`: ${Je(t)}`:"";console.warn(f.gray(`${e}${n}`))}}var S=class extends Error{suggestions;exitCode;constructor(t,n=[],r=1){super(t),this.name="TdkError",this.suggestions=n,this.exitCode=r}display(){oe(this.message,void 0,this.suggestions)}exit(){this.display(),process.exit(this.exitCode)}},re=class extends Error{code;constructor(t=1){super(`process.exit(${t})`),this.name="ProcessExitError",this.code=t}};function ne(e,t,n=!1){let r=new Set;for(let o of e){let s=Ke(o,t);s&&r.add(n?`Did you mean "${s}" for "${o}"?`:`Did you mean "${s}"?`)}return[...r]}var $={tiltNotInstalled:()=>new S("Tilt CLI is not installed",["Install Tilt: `brew install tilt` (macOS)","Or download from: https://docs.tilt.dev/install.html","Verify with: `tilt version`",`Setup guide: ${ee}`]),dockerNotAvailable:()=>new S("Docker (or a compatible container runtime) is not running",["Start Docker Desktop, then verify with: `docker ps`","Or start Colima: `colima start`","Or start the Docker service on Linux: `sudo systemctl start docker`",`Setup guide: ${ee}`]),dockerNotResponding:()=>new S("Docker is running but not responding (`docker ps` hung for 10s)",["Quit and reopen Docker Desktop, or run `colima restart`","Then verify with: `docker ps`"]),stackNotFound:(e,t=[])=>new S(`Stack "${e}" not found`,[...ne([e],t),"Run `flisk stacks` to see available stacks","Run `flisk stack` to assign resources to a stack"]),resourceNotFound:(e,t=[])=>new S(`Resource "${e}" not found`,[...ne([e],t),"Run `flisk resources` to list all resources","Check the resource name spelling"]),unknownServices:(e,t)=>{let n=ne(e,t,e.length>1);return new S(`Unknown service ${e.join(", ")}. Valid names: ${t.join(", ")}`,n,2)},directoryExists:e=>new S(`Directory already exists: ${e}`,["Use `--path` to specify a different location","Remove the existing directory if no longer needed"]),invalidPath:e=>new S(`Invalid path: ${e}`,["Path must be within the project directory",'Path cannot contain special characters like <>:"|?*']),notInProject:()=>new S("Could not find project root (no .tdk/project.json found)",["Run this from within a Flisk project","Run `flisk project --yes` to initialize a new project"])};function eo(){let e=E();return e||$.notInProject().exit()}function Qt(e){e instanceof S&&e.exit(),oe(Je(e)),process.exit(1)}async function Zt(e,t){try{return await e()}catch(n){if(n instanceof re)throw n;return t?.verbose&&n instanceof Error&&n.stack&&console.error(f.gray(n.stack)),Qt(n)}}async function to(e,t){let n=[],r=We();return r==="unresponsive"?n.push($.dockerNotResponding()):r==="missing"&&n.push($.dockerNotAvailable()),await He()||n.push($.tiltNotInstalled()),n.length>0&&(console.error(f.red(`
|
|
2
|
+
import{b as f}from"./chunk-CF46CD6R.js";var ar="Container Runtime",_="bring-your-own";var De="database-management",cr=".tiltignore",Ie="service.json",Q="docker-compose.yml",ur=".autogenerated",Ct="TILT_TECH_STACK.star",Dt="TILT_RESOURCE_DEFAULTS.star",B="project.json",je="package.json",fr=[Ct,Dt,"spec.master"],pr=["backend","frontend","library","sdk","worker","migrator","mcp","agent",_],lr={backend:["dev","build","start"],worker:["dev","build","start"],migrator:["dev","build","start"],mcp:["dev","build","start"],agent:["dev","build","start"],frontend:["dev","build"],library:["dev","build"],sdk:["dev","build"],[_]:[]};var Z=["monitoring","elk","debezium","golden_image","verdaccio"],dr={frontend:{base:3e3,min:3e3,max:3999,range:"3000-3999"},backend:{base:4e3,min:4e3,max:4999,range:"4000-4999"},mcp:{base:4e3,min:4e3,max:5999,range:"4000-5999"},agent:{base:4e3,min:4e3,max:5999,range:"4000-5999"},[_]:{base:4e3,min:4e3,max:5999,range:"4000-5999"},worker:{base:6e3,min:6e3,max:6999,range:"6000-6999"},health:{base:5e3,min:5e3,max:5999,range:"5000-5999"},migrator:{base:7e3,min:7e3,max:7999,range:"7000-7999"}},mr={tiltUi:10350,traefik:8080},ee="https://flisk.sh/docs/quickstart/";var Ne=["node_modules",".git",".tilt",".tilt-engine","dist","build",".prisma",".turbo","coverage","tmp","temp","__tests__","test","tests",".github",".vscode","docs"],Pe=["Dockerfile",Q,"docker-compose.yaml","Tiltfile","vite.config.ts","tsconfig.json","tsconfig.build.json"],It={infra:"\u{1F3D7}\uFE0F",core:"\u{1F527}",api:"\u26A1",app:"\u{1F3A8}",orchestrator:"\u2699\uFE0F"};function hr(e){let t=e.toLowerCase();for(let[n,r]of Object.entries(It))if(t.includes(n))return r;return"\u{1F4E6}"}import{existsSync as Nt}from"node:fs";import{dirname as Pt,join as Ft,resolve as Ue}from"node:path";import{cwd as Ut}from"node:process";var Fe={name:"tdk-cli-internal",private:!0,version:"1.3.199",description:"Flisk CLI \u2014 start services on your machine.",keywords:["flisk","tilt","cli","local-dev","microservices"],homepage:"https://github.com/flisk-sh/flisk#readme",bugs:{url:"https://github.com/flisk-sh/flisk/issues"},repository:{type:"git",url:"git+https://github.com/flisk-sh/flisk.git",directory:"cli"},license:"MIT",author:"Flisk Team",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",bin:{flisk:"bin/tdk.js"},files:["dist","dist-bundle","bin","templates","README.md","Tiltfile","engine","discovery","specs","ext","!ext/ide-components/code_executor","shared-platform-engineering/docker-templates"],scripts:{build:"tsc && node scripts/bundle.mjs","build:watch":"tsc --watch","check:dist":"npm run build && ../scripts/check-cli-dist.sh",lint:"biome check .","lint:fix":"biome check . --write",typecheck:"tsc --project tsconfig.typecheck.json",clean:"rm -rf dist",dev:"bun run build:watch",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage --coverage.reportOnFailure --coverage.reporter=text --coverage.reporter=html --coverage.reporter=json-summary --coverage.reporter=json --coverage.reportsDirectory=coverage --reporter=default --reporter=json --outputFile.json=test-results/vitest.json",prepack:"../scripts/stage-npm-engine.sh && npm run build"},dependencies:{commander:"^15.0.0",handlebars:"^4.7.8"},devDependencies:{"@biomejs/biome":"^2.5.13","@types/node":"^22.0.0","@types/react":"^19.3.0","@vitest/coverage-v8":"^5.0.2",ajv:"^8.17.1",chalk:"^6.0.1",esbuild:"^0.28.2",ink:"^8.0.0",knip:"^6.38.0",react:"^19.3.0","react-devtools-core":"^8.0.0",typescript:"^7.0.2",vite:"^8.3.3",vitest:"^5.0.0"},engines:{node:">=22.12.0"}};function E(e=Ut()){let t=Ue(e),n=Ue("/");for(;t!==n;){if(Nt(Ft(t,".tdk",B)))return t;let r=Pt(t);if(r===t)break;t=r}return null}var V=null;function Mt(){if(V)return V;let e=Fe;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid package.json: expected object");let t=e;return V={name:String(t.name??"@flisk-sh/flisk"),version:String(t.version??"0.0.0"),fullPackage:t},V}function wr(){return Mt().version}import{existsSync as Me}from"node:fs";import{delimiter as Le,extname as Be,join as Ve}from"node:path";import{delimiter as br,extname as Lt}from"node:path";function U(){return process.platform==="win32"}function Bt(e){return e==="linux"?"linux":e==="darwin"?"darwin":e==="win32"?"windows":null}function Vt(e){return e==="x64"?"amd64":e==="arm64"?"arm64":null}function Gt(e,t){let n=Bt(e),r=Vt(t);if(!n||!r||n==="windows"&&r!=="amd64")return null;let o=`tdk-${n}-${r}`;return n==="windows"?`${o}.exe`:o}function Ar(){return Gt(process.platform,process.arch)}function Rr(){return U()?"tdk.exe":"flisk"}function te(e,t=U()){return t?Lt(e)?[e]:[e,`${e}.exe`,`${e}.cmd`,`${e}.bat`]:[e]}function G(e){let t=process.env.PATH??process.env.Path??"",n=U(),r=te(e,n);if(n&&!Be(e))for(let o of(process.env.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";")){let s=o.toLowerCase();s&&!r.includes(`${e}${s}`)&&r.push(`${e}${s}`)}for(let o of t.split(Le))if(o)for(let s of r){let i=Ve(o,s);if(Me(i))return i}return null}function Ir(e){let t=process.env.PATH??process.env.Path??"",n=U(),r=te(e,n);if(n&&!Be(e))for(let i of(process.env.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";")){let a=i.toLowerCase();a&&!r.includes(`${e}${a}`)&&r.push(`${e}${a}`)}let o=[],s=new Set;for(let i of t.split(Le))if(i)for(let a of r){let c=Ve(i,a);if(!Me(c))continue;let p=n?c.toLowerCase():c;s.has(p)||(s.add(p),o.push(c))}return o}import{execFileSync as Wt,execSync as Kt}from"node:child_process";var Ge=1e4;function We(){let e=!1;if(process.platform==="win32")try{return Wt(G("docker")??"docker",["ps"],{stdio:"ignore",timeout:Ge,windowsHide:!0}),"running"}catch(t){return t.code==="ETIMEDOUT"?"unresponsive":"missing"}for(let t of["docker ps","colima status","podman ps"])try{return Kt(t,{stdio:"ignore",timeout:Ge}),"running"}catch(n){n.code==="ETIMEDOUT"&&(e=!0)}return e?"unresponsive":"missing"}function W(e,t){return e[t]??0}function Ht(e,t){let n=Array.from({length:t.length+1},(r,o)=>o);for(let r=1;r<=e.length;r++){let o=[r];for(let s=1;s<=t.length;s++){let i=e[r-1]===t[s-1]?0:1;o[s]=Math.min(W(o,s-1)+1,W(n,s)+1,W(n,s-1)+i)}n=o}return W(n,t.length)}function zt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length-1;n++)if(e[n]!==t[n]&&e[n]===t[n+1]&&e[n+1]===t[n]&&e.slice(0,n)===t.slice(0,n)&&e.slice(n+2)===t.slice(n+2))return!0;return!1}function Ke(e,t){if(e.length<2||t.length===0||t.includes(e))return;let n=e.toLowerCase(),r,o=Number.POSITIVE_INFINITY;for(let s of t){if(s.length===0)continue;let i=s.toLowerCase(),a=zt(n,i)?1:Ht(n,i),c=Math.max(1,Math.min(2,Math.floor(Math.max(n.length,i.length)/3)));a>c||(a<o||a===o&&(r===void 0||s<r))&&(r=s,o=a)}return r}import{spawn as Jt}from"node:child_process";import{join as qt}from"node:path";function Yt(e,t=[],n={}){return new Promise((r,o)=>{let s=[e,...t];n.verbose&&console.log(`Executing: tilt ${s.join(" ")}`);let i=Jt(G("tilt")??"tilt",s,{stdio:n.inheritStdio?"inherit":"pipe",shell:!1,windowsHide:process.platform==="win32",timeout:n.timeoutMs}),a="",c="";n.inheritStdio||(i.stdout?.on("data",p=>{a+=p.toString()}),i.stderr?.on("data",p=>{c+=p.toString()})),i.on("close",p=>{r({exitCode:p??1,stdout:a,stderr:c})}),i.on("error",p=>{o(new Error(`Failed to spawn tilt: ${p.message}`))})})}async function He(){try{return(await Yt("version",[],{inheritStdio:!1,timeoutMs:1e4})).exitCode===0}catch{return!1}}function Xt(){let e=E();if(!e)throw $.notInProject();return qt(e,".tdk",".tdk-out","Tiltfile")}function ze(e){let t=Xt();e.push("-f",t)}function Wr(e,t={}){let n=[];return ze(n),t.focusTargets&&t.focusTargets.length>0&&n.push("--",`--focus=${t.focusTargets.join(",")}`),n.push(...e),t.verbose&&!t.quiet&&n.push("--verbose"),t.watch&&n.push("--watch"),n}function Kr(e={}){let t=[];return ze(t),e.focusTargets&&e.focusTargets.length>0&&t.push("--",`--focus=${e.focusTargets.join(",")}`),t}function Je(e){return e instanceof Error?e.message:String(e)}function Zr(e,t){if(process.env.TDK_VERBOSE){let n=t!==void 0?`: ${Je(t)}`:"";console.warn(f.gray(`${e}${n}`))}}var S=class extends Error{suggestions;exitCode;constructor(t,n=[],r=1){super(t),this.name="TdkError",this.suggestions=n,this.exitCode=r}display(){oe(this.message,void 0,this.suggestions)}exit(){this.display(),process.exit(this.exitCode)}},re=class extends Error{code;constructor(t=1){super(`process.exit(${t})`),this.name="ProcessExitError",this.code=t}};function ne(e,t,n=!1){let r=new Set;for(let o of e){let s=Ke(o,t);s&&r.add(n?`Did you mean "${s}" for "${o}"?`:`Did you mean "${s}"?`)}return[...r]}var $={tiltNotInstalled:()=>new S("Tilt CLI is not installed",["Install Tilt: `brew install tilt` (macOS)","Or download from: https://docs.tilt.dev/install.html","Verify with: `tilt version`",`Setup guide: ${ee}`]),dockerNotAvailable:()=>new S("Docker (or a compatible container runtime) is not running",["Start Docker Desktop, then verify with: `docker ps`","Or start Colima: `colima start`","Or start the Docker service on Linux: `sudo systemctl start docker`",`Setup guide: ${ee}`]),dockerNotResponding:()=>new S("Docker is running but not responding (`docker ps` hung for 10s)",["Quit and reopen Docker Desktop, or run `colima restart`","Then verify with: `docker ps`"]),stackNotFound:(e,t=[])=>new S(`Stack "${e}" not found`,[...ne([e],t),"Run `flisk stacks` to see available stacks","Run `flisk stack` to assign resources to a stack"]),resourceNotFound:(e,t=[])=>new S(`Resource "${e}" not found`,[...ne([e],t),"Run `flisk resources` to list all resources","Check the resource name spelling"]),unknownServices:(e,t)=>{let n=ne(e,t,e.length>1);return new S(`Unknown service ${e.join(", ")}. Valid names: ${t.join(", ")}`,n,2)},directoryExists:e=>new S(`Directory already exists: ${e}`,["Use `--path` to specify a different location","Remove the existing directory if no longer needed"]),invalidPath:e=>new S(`Invalid path: ${e}`,["Path must be within the project directory",'Path cannot contain special characters like <>:"|?*']),notInProject:()=>new S("Could not find project root (no .tdk/project.json found)",["Run this from within a Flisk project","Run `flisk project --yes` to initialize a new project"])};function eo(){let e=E();return e||$.notInProject().exit()}function Qt(e){e instanceof S&&e.exit(),oe(Je(e)),process.exit(1)}async function Zt(e,t){try{return await e()}catch(n){if(n instanceof re)throw n;return t?.verbose&&n instanceof Error&&n.stack&&console.error(f.gray(n.stack)),Qt(n)}}async function to(e,t){let n=[],r=We();return r==="unresponsive"?n.push($.dockerNotResponding()):r==="missing"&&n.push($.dockerNotAvailable()),await He()||n.push($.tiltNotInstalled()),n.length>0&&(console.error(f.red(`
|
|
3
3
|
Flisk can't start - missing prerequisites:
|
|
4
4
|
`)),n.forEach((o,s)=>{s>0&&console.error(""),o.display()}),console.error(f.gray("\nRun `flisk doctor` for a full environment check.")),process.exit(1)),Zt(e,t)}function no(e,t=1,n){oe(e,void 0,n),process.exit(t)}function oe(e,t,n){if(console.error(f.red(`\u274C ${e}`)),t&&console.error(f.gray(` ${t}`)),n&&n.length>0){console.error(f.yellow(`
|
|
5
5
|
\u{1F4A1} Suggestions:`));for(let r of n)console.error(f.cyan(` \u2192 ${r}`))}}function ro(e,t){console.error(f.red(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
|
|
2
|
-
import{a as At,f as It,g as ae,i as Re}from"./chunk-
|
|
2
|
+
import{a as At,f as It,g as ae,i as Re}from"./chunk-7IWOM6M2.js";import{i as Mt,o as Lt}from"./chunk-3SPYAO2E.js";import{c as Ft}from"./chunk-42IVF3YT.js";import{Aa as _t,Ba as jt,Ca as De,G as J,O as g,Ta as b,Ua as Ot,b as x,c as re,d as Pt,fa as I,g as wt,h as D,ja as Tt,k as _,l as R,m as $e,ma as Et,na as Ee,o as Te,oa as oe,pa as Nt,q as vt,qa as K,s as m,t as xt,ua as Ne,va as Dt,wa as ie,x as $,xa as Rt,y as $t,ya as Ct}from"./chunk-GW7N23FV.js";import{b as y}from"./chunk-CF46CD6R.js";import{execFileSync as yn}from"node:child_process";import{readFileSync as ui}from"node:fs";import{join as pi}from"node:path";import{execFileSync as Po,execSync as tn}from"node:child_process";import{existsSync as E,readdirSync as wo,readFileSync as W}from"node:fs";import{join as w,normalize as lt,relative as ut}from"node:path";import{Command as vo}from"commander";import{existsSync as xn}from"node:fs";var ce="docs/agent-hosts.md",Ce=`WebContainers cannot run Flisk: there is no Docker daemon or Tilt. Run \`flisk up\` on a machine with Docker. See ${ce}.`,Ht=`Docker is not reachable from this Dev Container. Mount the host Docker socket (-v /var/run/docker.sock:/var/run/docker.sock) or add the docker-outside-of-docker feature to devcontainer.json, then retry. Docker-in-docker is not supported. See ${ce}.`;function $n(){return{env:process.env,versions:process.versions,platform:process.platform,fileExists:xn}}function Ut(e=$n()){let{env:t,versions:s,platform:n,fileExists:r}=e;return s.webcontainer?{kind:"webcontainer",canUp:!1}:t.CODESPACES==="true"?{kind:"codespaces",canUp:!0}:t.REMOTE_CONTAINERS||r("/.dockerenv")&&t.DEVCONTAINER?{kind:"devcontainer",canUp:!0}:n==="win32"?{kind:"native-windows",canUp:t.TDK_ALLOW_NATIVE_WINDOWS==="1"}:n==="linux"&&t.WSL_DISTRO_NAME?{kind:"wsl2",canUp:!0}:{kind:"local",canUp:!0}}function Bt(e){return e==="devcontainer"||e==="codespaces"}function de(e){return e.some(t=>I(t.config?.appType)||t.config?.appType==="frontend"||t.config?.appType==="worker")}import{existsSync as Tn,readFileSync as En}from"node:fs";import{join as Nn,relative as Gt,resolve as Wt,sep as Dn}from"node:path";var Rn=2,Vt=["services/*/*"];function qt(e){return e.split(Dn).filter(Boolean)}function Cn(e,t){let s=0,n=0,r=-1,o=0;for(;n<t.length;)if(s<e.length&&e[s]!=="*"&&(e[s]==="?"||e[s]===t[n]))s++,n++;else if(s<e.length&&e[s]==="*")r=s++,o=n;else if(r!==-1)s=r+1,n=++o;else return!1;for(;s<e.length&&e[s]==="*";)s++;return s===e.length}function _n(e,t){return e.length===t.length&&e.every((s,n)=>Cn(s,t[n]))}function _e(e){let t=Nn(e,".tdk",_);if(!Tn(t))return Vt;try{let s=JSON.parse(En(t,"utf-8"))?.discovery?.paths;if(Array.isArray(s)&&s.every(n=>typeof n=="string"))return s}catch{}return Vt}function le(e,t,s){let n=qt(Gt(e,Wt(e,t)));return s.some(r=>{let o=qt(Gt(e,Wt(e,r)));for(let i=0;i<=Rn;i++){let a=n.length-i;if(a>0&&_n(o,n.slice(0,a)))return!0}return!1})}function Ti(e,t,s,n){let r=_e(e);if(le(e,t,r))return{path:t};let o=`services/${s}/${n}`;return le(e,o,r)?{path:o,adjustedFrom:t}:{path:t}}import{execFile as zn}from"node:child_process";import{promisify as Yn}from"node:util";import{execFileSync as Qt,execSync as X}from"node:child_process";import{existsSync as je,readdirSync as jn,readFileSync as Oe}from"node:fs";import{join as B}from"node:path";function Jt(e,t){return e==="pending"||e==="in_progress"||e==="none"||t==="pending"||t==="none"}var Kt="container is running, but its health check is failing";function zt(e){let t=e?.runtimeStatus??"";if(t!=="ok")return t;let s=e?.composeResourceInfo?.healthStatus;return s==="unhealthy"?"error":s==="starting"?"pending":t}var z=1e4,Yt=3e3,On="http://localhost:4873";function es(e){return`'${e.replace(/'/g,"'\\''")}'`}function Y(e,t,s,n,r){return process.platform==="win32"?Qt($(t)??t,s,{...r,windowsHide:!0}):e(n,r)}var An=[80,443];function Ae(e){return e.replace(/-/g,"_")}function In(e,t){let s=new Set(t),n=[];for(let r of e.split(`
|
|
3
3
|
`)){let o=r.trim();if(!o)continue;let i=o.indexOf(" "),a=i>=0?o.slice(0,i):o,c=i>=0?o.slice(i+1):"",d=[];for(let l of s)c.split(/[\s,]+/).some(h=>h.startsWith(`${l}->`)||h.includes(`:${l}->`))&&d.push(l);d.length>0&&n.push({name:a,ports:c,publishedPorts:d})}return n}function ts(e,t){let s=e.toLowerCase(),n=t.toLowerCase();return s===`${n}_traefik`||s.startsWith(`${n}_traefik`)}function Fn(e,t){return e.filter(s=>!ts(s.name,t))}function Ie(e){try{let t=e??Ot();return new Set(t.filter(s=>s.config?.sablier?.enable&&s.config?.sablier?.deferStart).map(s=>s.name))}catch{return new Set}}function Fe(e,t=new Set){let n=JSON.parse(e).items??[],r=[],o=0,i=0,a=0;for(let c of n){let d=c.metadata?.name??"unknown",l=c.status?.updateStatus??"",u=zt(c.status),h=u==="error"&&c.status?.runtimeStatus==="ok",P=(c.status?.buildHistory?.[0]?.error??"").trim()||(h?Kt:"");if(l==="error"||u==="error"){r.push({name:d,updateStatus:l,runtimeStatus:u,error:P.replace(/\s+/g," ").slice(0,800)});continue}if(l==="ok"&&(u==="ok"||u==="not_applicable")){a+=1;continue}d!=="(Tiltfile)"&&Jt(l,u)&&(t.has(d)?i+=1:o+=1)}return{failures:r,pendingCount:o,deferredCount:i,okCount:a,total:n.length}}var Mn=/failed to resolve source metadata for docker\.io\/library\/([A-Za-z0-9._-]+-l[1-4](?:-[a-z]+)*)(?::[^\s:]+)?:/i;function Me(e){let t=e.replace(/\s+/g," ").trim(),s=t.match(/Bind for [^ ]+:(\d+) failed: port is already allocated/i);if(s)return`host port ${s[1]} is already allocated`;if(/port is already allocated/i.test(t))return"a required host port is already allocated";let n=[...t.matchAll(/ConnectionRefused downloading package manifest (@[A-Za-z0-9._/-]+)/gi)].map(a=>a[1]);if(n.length>0){let a=[...new Set(n)],c=a.slice(0,4).join(", "),d=a.length>4?` (+${a.length-4} more)`:"";return`private registry ConnectionRefused for ${c}${d} \u2014 Verdaccio (:4873) is down or unreachable from the build`}let r=t.match(Mn);if(r)return`base image ${r[1]} was missing when this build started (the golden layers weren't built yet, or golden-layers-build failed) - Tilt does not retry a failed build by itself`;if(/install-deps\.sh/i.test(t)||/bun install(?: --production)?/i.test(t)||/npm (?:ci|install)/i.test(t))return"dependency install failed during ImageBuild \u2014 usually Verdaccio (:4873) unreachable or missing @scoped packages (ConnectionRefused downloading package manifest)";let o=t.match(/No such image:\s*([^\s]+)/i)?.[1]??t.match(/pull access denied for ([^,:\s]+)/i)?.[1]??void 0,i=t.match(/\bup\s+-d\s+--no-build\s+([A-Za-z0-9._-]+)/i)?.[1];if(o||i||/docker compose .*\bup\s+-d\s+--no-build\b/i.test(t)){let a=o??`${i??"service"}:dev`,c=i?` for ${i}`:"";return`compose run failed because image is missing (${a})${c} \u2014 wait for the ImageBuild resource to finish, then re-trigger the *-run-only resource`}return/bun run build/i.test(t)?"ImageBuild failed during `bun run build` (compile/typecheck) \u2014 open the resource logs in Tilt for the TypeScript/build error":(/ImageBuild:/i.test(t)||/^Command "/i.test(t),t.slice(0,220))}function Xt(e){return/ConnectionRefused downloading package manifest|Verdaccio|private registry|dependency install failed during ImageBuild|install-deps\.sh|bun install/i.test(e)}function Le(e=m()??process.cwd()){let t=B(e,".tdk",_);if(!je(t))return!1;try{let s=JSON.parse(Oe(t,"utf-8"));return s.optional_infra?.verdaccio===!0||Object.values(s.phases??{}).some(n=>(n.enabledStacks??[]).includes("verdaccio"))}catch{return!1}}function ss(e){for(let t of[B(e,".npmrc"),B(e,R)])if(je(t))try{let s=Oe(t,"utf-8");if(/:4873\b/.test(s)||/verdaccio/i.test(s))return!0}catch{}return!1}function Ln(e=m()??process.cwd()){return Le(e)||ss(e)}function He(e=X,t=m()??process.cwd(),s=process.env.VERDACCIO_URL??process.env.NPM_REGISTRY_URL??On,n=!0){if(!n&&!ss(t))return{name:"Private npm registry",didPass:!0,isSkipped:!0,message:"Verdaccio is enabled in the project config but needs a Premium license, so Flisk will not start it - skipped"};if(!Ln(t))return{name:"Private npm registry",didPass:!0,isSkipped:!0,message:"Private npm registry (Verdaccio) not enabled for this project - skipped"};let r=!1;try{let a=Y(e,"docker",["ps","--format","{{.Names}}"],"docker ps --format '{{.Names}}'",{stdio:"pipe",encoding:"utf-8",timeout:z});r=/verdaccio/i.test(a)}catch{}let o=!1,i="";try{let a=process.platform==="win32"?Qt("curl.exe",["-fsS","-o","NUL","-w","%{http_code}","--max-time","2",s],{stdio:"pipe",encoding:"utf-8",timeout:Yt+1e3,windowsHide:!0}).trim():e(`curl -fsS -o /dev/null -w '%{http_code}' --max-time 2 ${es(s)}`,{stdio:"pipe",encoding:"utf-8",timeout:Yt+1e3}).trim();o=/^[23]\d\d$/.test(a),i=`HTTP ${a}`}catch(a){i=a instanceof Error?a.message.slice(0,120):"request failed"}return o?{name:"Private npm registry",didPass:!0,message:`Private npm registry reachable at ${s}${r?" (verdaccio container running)":""}`}:r?{name:"Private npm registry",didPass:!1,message:`Verdaccio container is running but ${s} is not responding (${i}). ImageBuilds that install @scoped packages will fail with ConnectionRefused downloading package manifest.`,fix:"Check `docker logs` for the verdaccio container, confirm port 4873 is published, then re-run `flisk doctor`."}:{name:"Private npm registry",didPass:!1,message:`Private npm registry (Verdaccio) is not reachable at ${s}. Docker ImageBuilds will fail with ConnectionRefused downloading package manifests for @flisk-sh/* and project-scoped packages.`,fix:"Start the registry with `bun run verdaccio:start` (or `docker compose -f docker-compose.verdaccio.yml up -d`), publish packages with `bun run publish:all` / `scripts/build/publish-to-verdaccio.sh`, then `tilt trigger` failed resources or re-run `flisk up`."}}function Ue(e=X,t=K(),s=An){let n=Ae(t),r="";try{r=Y(e,"docker",["ps","--format","{{.Names}}\\t{{.Ports}}"],"docker ps --format '{{.Names}}\\t{{.Ports}}'",{stdio:"pipe",encoding:"utf-8",timeout:z})}catch{return{name:"Ingress Ports",didPass:!0,isSkipped:!0,message:"Docker not available - skipped ingress port check"}}let o=In(r,s),i=Fn(o,n);if(i.length===0){let c=o.filter(d=>ts(d.name,n));return c.length>0?{name:"Ingress Ports",didPass:!0,message:`Ingress ports ${s.join("/")} held by this project's Traefik (${c.map(d=>d.name).join(", ")})`}:{name:"Ingress Ports",didPass:!0,message:`Ingress ports ${s.join("/")} are free for Traefik`}}return{name:"Ingress Ports",didPass:!1,message:`Traefik cannot bind ingress ports because another container already owns them:
|
|
4
4
|
${i.map(c=>{let d=c.publishedPorts.join(", ");return`${c.name} (host ports ${d})`}).join(`
|
|
5
5
|
`)}`,fix:`Stop the foreign container(s), e.g. \`docker stop ${i[0]?.name}\`, or shut down the other Flisk/Tilt project using that Traefik. Then re-run \`flisk up\`.`}}function Hn(e){let{status:t}=e;return t===void 0?e.error??"no response":t===404?"HTTP 404: Traefik is answering but has no route for this URL (container not started yet, or not running)":t===502||t===503||t===504?`HTTP ${t}: Traefik found the route but the container isn't answering (still starting, or unhealthy)`:`HTTP ${t}`}function Be(e){let t=e.filter(o=>o.status!==void 0),s=e.filter(o=>!o.ok);if(t.length===0)return{name:"Service Health",didPass:!0,isSkipped:!0,message:`No services responded - skipped ping of ${g(e.length,"service")} (stack may be down, or Traefik never bound :80)`,fix:"If `flisk up` is already running, check Traefik/port 80 in the Tilt UI. Otherwise start with: flisk up"};if(s.length===0)return{name:"Service Health",didPass:!0,message:`All ${g(e.length,"service")} responding on /health`};let n=s.map(o=>`${o.name} (${Hn(o)})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
|
|
2
|
-
import{a as O}from"./chunk-KGKKDD4K.js";import{b as N,c as pe,d as q,i as D,j as Y,n as J,o as I,q as C}from"./chunk-
|
|
2
|
+
import{a as O}from"./chunk-KGKKDD4K.js";import{b as N,c as pe,d as q,i as D,j as Y,n as J,o as I,q as C}from"./chunk-3SPYAO2E.js";import{H as z,J as G,L as E,Na as re,Ra as ae,Sa as se,Ua as ie,V as T,W as B,Wa as ce,Xa as le,Ya as de,aa as f,ba as y,ca as t,d as x,ja as ne,k as U,ka as W,la as V,m as P,s as F}from"./chunk-GW7N23FV.js";import{b as p}from"./chunk-CF46CD6R.js";import{execFileSync as ye}from"node:child_process";import{cpSync as be,existsSync as b,readdirSync as Se,readFileSync as K,writeFileSync as je}from"node:fs";import{basename as _e,dirname as we,join as j,resolve as M}from"node:path";import{cwd as ue}from"node:process";import{fileURLToPath as xe}from"node:url";import{Command as Pe}from"commander";var he="-y, --yes",ke="Skip prompts and confirmations; use defaults";function fe(e,o=ke){return e.option(he,o,!1)}async function ve(e,o=!0){let c=await I({message:e,initial:o});return c||T(),c}function Ne(e,o=1){e.valid||E(e.error??"Validation failed",o)}function De(e,o,c,a){return e.dryRun?(a?a():(console.log(`Dry run - ${o}`),console.log(`Would run: ${c}`)),!0):!1}async function Je(e,o){return await ve(e,!0)?!0:(o&&o(),!1)}var L=new Map;function me(e){e!==void 0?L.delete(e):L.clear()}function Ue(e=!1){let o=F(),c=o??"";if(!e){let r=L.get(c);if(r)return r}let{resources:a,problems:l}=o?ae(o):{resources:ie(),problems:[]},d=de(a),n=le(a);se(l);let g=a.filter(r=>!r.stack),m=new Map;for(let r of a)if(r.stack){let _=m.get(r.stack)||[];_.push(r),m.set(r.stack,_)}let k={resources:a,problems:l,stacks:d,stackNames:n,unassignedResources:g,resourcesByStack:m};return L.set(c,k),k}var A={proxy:{name:"proxy",description:"Traefik reverse proxy and API gateway for routing all services",category:"core",phase:"pre_alpha",enabled_by_default:!0,dependsOn:[]},verdaccio:{name:"verdaccio",description:"Verdaccio npm registry for package management and local publishing (Premium - requires TDK_LICENSE_KEY)",category:"premium",phase:"pre_alpha",enabled_by_default:!1,dependsOn:[]},[x]:{name:x,description:"PostgreSQL database for data persistence and SQL operations",category:"core",phase:"pre_alpha",enabled_by_default:!0,dependsOn:[]},monitoring:{name:"monitoring",description:"SigNoz or SkyWalking observability platform for monitoring and tracing",category:"optional",phase:"pre_alpha",enabled_by_default:!1,dependsOn:[x]},elk:{name:"elk",description:"Elasticsearch, Logstash, Kibana stack for log aggregation and analysis",category:"optional",phase:"pre_alpha",enabled_by_default:!1,dependsOn:[]},debezium:{name:"debezium",description:"Change Data Capture for real-time data streaming from databases",category:"optional",phase:"pre_alpha",enabled_by_default:!1,dependsOn:[x]},"golden-image":{name:"golden-image",description:"Pre-built Docker image layer for faster builds and smaller deployments",category:"optional",phase:"pre_alpha",enabled_by_default:!0,dependsOn:[]}};function H(e,o){try{return ce(e,o)}catch{return[]}}function Ee(e){return new Set([...e.phases.pre_alpha.enabledStacks,...e.phases.alpha.enabledStacks,...e.phases.beta.enabledStacks,...e.phases.out_of_scope.enabledStacks])}function Q(e,o){let c=Ee(e),a=o.filter(l=>!c.has(l));return a.length===0?(e.phases.pre_alpha.enabledStacks=Array.from(new Set(e.phases.pre_alpha.enabledStacks)),[]):(e.phases.pre_alpha.enabledStacks=Array.from(new Set([...e.phases.pre_alpha.enabledStacks,...a])),a)}function ft(e,o){let c=j(e,".tdk",U);if(!b(c))return[];let a=D(e),l=Q(a,H(e,o));return l.length>0&&N(c,a),l}function Ce(){return Object.values(A).filter(e=>e.enabled_by_default&&e.category==="core").map(e=>e.name)}function Oe(e,o){return o||(O[e]?.repo.split("/").pop()??e).replace(/\.git$/,"")}async function Ae(e,o,c){let a=O[e];if(!a){console.log(p.red(`
|
|
3
3
|
\u274C Unknown template: "${e}"`)),console.log(p.yellow(`
|
|
4
4
|
Available templates:`));for(let[n,g]of Object.entries(O))console.log(` ${p.cyan(n)} ${p.gray(`- ${g.description}`)}`);console.log(p.gray("\nOr run `flisk project` with no template for a blank project.")),process.exit(1)}let l=Oe(e,o);re(l)||z.invalidPath(l).exit();let d=M(ue(),l);b(d)&&Se(d).length>0&&z.directoryExists(d).exit(),B(`Cloning template: ${e}`),t(`${a.description}
|
|
5
5
|
`,0),t(`Source: ${a.bundledPath?"bundled Flisk example":a.repo}`,0),t(`Destination: ${d}
|
|
6
6
|
`,0);try{if(a.bundledPath){let n=M(we(xe(new URL("../dist/commands/project.js",import.meta.url).href)),"../../../");be(M(n,a.bundledPath),d,{recursive:!0});let g=_e(d).replace(/-/g,"_");for(let m of["services/platform/messaging/docker-compose.yml","services/shop/orders-api/service.json","services/shop/orders-api/src/index.ts","services/shop/orders-worker/service.json","services/shop/orders-worker/src/index.ts"]){let k=j(d,m),r=K(k,"utf-8");je(k,r.replaceAll("tdk_example",g))}}else ye("git",["clone",a.repo,d],{stdio:"inherit"})}catch{E(a.bundledPath?"Bundled example copy failed. Reinstall the Flisk CLI package and try again.":"git clone failed. Check you have git installed and network access.")}me(),console.log(p.green(`
|
|
7
7
|
\u2705 Cloned "${e}" into ${l}/`)),t(`
|
|
8
8
|
Next steps:`,0),t(`1. cd ${l}`),t("2. flisk doctor # check Docker/Tilt are ready"),t("3. flisk up # start the stack"),t(`
|
|
9
|
-
Runtime readiness:`,0);for(let n of c)t(n,0)}var R={version:"1.0",project:{name:"",version:"1.0.0"},phases:{pre_alpha:{name:"Pre-Alpha",description:"Core infrastructure and MVP services",enabledStacks:Ce()},alpha:{name:"Alpha",description:"Essential business services",enabledStacks:[]},beta:{name:"Beta",description:"Extended features",enabledStacks:[]},out_of_scope:{name:"Out of Scope",description:"Future releases",enabledStacks:[]}},optional_infra:{monitoring:!1,elk:!1,debezium:!1,golden_image:!0,verdaccio:!1},discovery:{paths:["services/*/*"]},overrides:{}},mt=fe(new Pe("project")).description("Initialize or validate project-level master configuration").argument("[template]",`Clone a starter example instead of a blank project (${Object.keys(O).join(", ")})`).option("--path <dir>","Directory to clone the template into (default: the template's repo name)").option("--check","Check if master configs exist and are in sync").option("--force","Overwrite existing configuration (dangerous)").option("--config-file <path>","Load project config from existing JSON file").action(async(e,o)=>{let{assertMachineReadyOrExit:c,detectRuntimePrerequisites:a,formatRuntimeNextSteps:l}=await import("./cold-preflight-
|
|
9
|
+
Runtime readiness:`,0);for(let n of c)t(n,0)}var R={version:"1.0",project:{name:"",version:"1.0.0"},phases:{pre_alpha:{name:"Pre-Alpha",description:"Core infrastructure and MVP services",enabledStacks:Ce()},alpha:{name:"Alpha",description:"Essential business services",enabledStacks:[]},beta:{name:"Beta",description:"Extended features",enabledStacks:[]},out_of_scope:{name:"Out of Scope",description:"Future releases",enabledStacks:[]}},optional_infra:{monitoring:!1,elk:!1,debezium:!1,golden_image:!0,verdaccio:!1},discovery:{paths:["services/*/*"]},overrides:{}},mt=fe(new Pe("project")).description("Initialize or validate project-level master configuration").argument("[template]",`Clone a starter example instead of a blank project (${Object.keys(O).join(", ")})`).option("--path <dir>","Directory to clone the template into (default: the template's repo name)").option("--check","Check if master configs exist and are in sync").option("--force","Overwrite existing configuration (dangerous)").option("--config-file <path>","Load project config from existing JSON file").action(async(e,o)=>{let{assertMachineReadyOrExit:c,detectRuntimePrerequisites:a,formatRuntimeNextSteps:l}=await import("./cold-preflight-WR2M53Z6.js");await c({scope:"scaffold"});let d=l(a());if(e){await G(async()=>Ae(e,o.path,d));return}await G(async()=>{let n=F();n||(n=ue(),y(`\u{1F680} Initializing new Flisk project...
|
|
10
10
|
`),t(`Location: ${n}
|
|
11
11
|
`,0));let g=j(n,".tdk"),m=j(g,U);if(o.check){let i=P.every(u=>b(j(n,".tdk",".tdk-out",u))),h=b(m);if(i&&h){let u=D(n);f("Project configuration is valid"),t(`Project: ${u.project.name}`,3),t(`Phases: ${Object.keys(u.phases).join(", ")}`,3),process.exit(0)}else{if(console.log(p.yellow("\u26A0\uFE0F Project configuration incomplete:")),h||t(".tdk/project.json (not found)",3),!i)for(let u of P.filter(S=>!b(j(n,".tdk/.tdk-out",S))))t(`.tdk/.tdk-out/${u} (not found)`,3);t("Run `flisk project` to create them."),process.exit(1)}}B("Project Configuration"),t(`Project root: ${n}
|
|
12
12
|
`,0),b(g)||(pe(g),f("Created: .tdk/ directory"));let k=b(m);if(k&&!o.force){f(".tdk/project.json exists");let i=JSON.parse(K(m,"utf-8")),h=D(n),u=H(n),S=Q(h,u);if((S.length>0||!i.phases)&&N(m,h),S.length>0&&t(`Auto-enabled discovered service stacks: ${S.join(", ")}`,0),y(`
|