ozmoz 0.1.27 → 0.1.28
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/dist/cli.cjs +36 -24
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var i=require("fs"),c=require("path"),W=require("https"),ne=require("http"),b=require("os"),{exec:oe,spawnSync:x}=require("child_process"),re=[c.join(__dirname,"..","scripts","setup-lib.cjs"),c.join(__dirname,"..","..","scripts","setup-lib.cjs"),c.join(__dirname,"scripts","setup-lib.cjs")],se=re.find(i.existsSync)||c.join(__dirname,"..","scripts","setup-lib.cjs"),{runFullSetup:Y,handleAuthAndEnv:K,touchTsConfig:ie,attemptViteAutoImportPatch:ae,injectUniversalRuntime:ce,writeBrowserConfig:le,patchAllowScripts:de}=require(se),ue=!!(process.stdout&&process.stdout.isTTY&&typeof process.stdout.hasColors=="function"&&process.stdout.hasColors(16777216)),pe=ue?"\x1B[38;2;15;156;140m":"\x1B[36m",me="\x1B[31m",q="\x1B[0m";function d(e){console.log(e.replace(/OZmoz|\[|\]|→/g,t=>`${pe}${t}${q}`))}function O(e){console.error(`${me}${e}${q}`)}var k="ozmoz",V=/<!--\s*(?:ozmoz|fleetbo|OZmoz):start[^>]*-->[\s\S]*?<!--\s*(?:ozmoz|fleetbo|OZmoz):end\s*-->/i,fe="<!-- OZmoz:end -->",H="# OZMOZ DATA OS \u2014 DIRECTIVES SYST\xC8ME",F={claude:"Claude Code",cursor:"Cursor",windsurf:"Windsurf",devin:"Devin",codex:"Codex CLI",gemini:"Gemini CLI",antigravity:"Antigravity CLI",copilot:"GitHub Copilot"},P={created:"created",updated:"updated",unchanged:"already up to date",appended:"OZmoz block appended (your own content was kept)",migrated:"old file replaced (backup: <file>.ozmoz-legacy.bak)",invalid:"skipped: the file is not valid JSON, fix or delete it first"};function
|
|
2
|
+
var i=require("fs"),c=require("path"),W=require("https"),ne=require("http"),b=require("os"),{exec:oe,spawnSync:x}=require("child_process"),re=[c.join(__dirname,"..","scripts","setup-lib.cjs"),c.join(__dirname,"..","..","scripts","setup-lib.cjs"),c.join(__dirname,"scripts","setup-lib.cjs")],se=re.find(i.existsSync)||c.join(__dirname,"..","scripts","setup-lib.cjs"),{runFullSetup:Y,handleAuthAndEnv:K,touchTsConfig:ie,attemptViteAutoImportPatch:ae,injectUniversalRuntime:ce,writeBrowserConfig:le,patchAllowScripts:de}=require(se),ue=!!(process.stdout&&process.stdout.isTTY&&typeof process.stdout.hasColors=="function"&&process.stdout.hasColors(16777216)),pe=ue?"\x1B[38;2;15;156;140m":"\x1B[36m",me="\x1B[31m",q="\x1B[0m";function d(e){console.log(e.replace(/OZmoz|\[|\]|→/g,t=>`${pe}${t}${q}`))}function O(e){console.error(`${me}${e}${q}`)}var k="ozmoz",V=/<!--\s*(?:ozmoz|fleetbo|OZmoz):start[^>]*-->[\s\S]*?<!--\s*(?:ozmoz|fleetbo|OZmoz):end\s*-->/i,fe="<!-- OZmoz:end -->",H="# OZMOZ DATA OS \u2014 DIRECTIVES SYST\xC8ME",F={claude:"Claude Code",cursor:"Cursor",windsurf:"Windsurf",devin:"Devin",codex:"Codex CLI",gemini:"Gemini CLI",antigravity:"Antigravity CLI",copilot:"GitHub Copilot"},P={created:"created",updated:"updated",unchanged:"already up to date",appended:"OZmoz block appended (your own content was kept)",migrated:"old file replaced (backup: <file>.ozmoz-legacy.bak)",invalid:"skipped: the file is not valid JSON, fix or delete it first"};function ge(){try{return JSON.parse(i.readFileSync(c.join(__dirname,"..","package.json"),"utf8")).version||"dev"}catch{return"dev"}}var he=Buffer.from("QUl6YVN5QUM1Uk94STNibklPMUR5TmZsTWhGUnJ0blItNDVwNFJF","base64").toString("utf8");function ye(e){try{let t=JSON.parse(Buffer.from(e.split(".")[1],"base64url").toString("utf8"));return typeof t.exp=="number"&&t.exp*1e3<Date.now()+6e4}catch{return!1}}async function Oe(e,t){let r=await fetch(`https://securetoken.googleapis.com/v1/token?key=${he}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`grant_type=refresh_token&refresh_token=${encodeURIComponent(t)}`});if(!r.ok)return null;let n=await r.json();return n.id_token?(i.writeFileSync(e,JSON.stringify({devToken:n.id_token,refreshToken:n.refresh_token||t,updatedAt:new Date().toISOString()},null,2)),n.id_token):null}async function ze(){if(process.env.FLEETBO_DEV_TOKEN)return process.env.FLEETBO_DEV_TOKEN;try{let e=c.join(b.homedir(),".fleetbo","credentials.json");if(i.existsSync(e)){let t=JSON.parse(i.readFileSync(e,"utf8"));if(t.devToken&&!ye(t.devToken))return t.devToken;if(t.refreshToken)try{let r=await Oe(e,t.refreshToken);if(r)return r}catch{}}}catch{}return null}async function X(){let e=c.join(b.homedir(),".fleetbo","guidelines.json"),t=await ze();t||O('[OZmoz] Not logged in: run "npx ozmoz login" first to load the full instructions. Using local cache if available.');try{d("[OZmoz] Fetching instructions from Cloud...");let r=await fetch("https://getagentdirectives-jqycakhlxa-uc.a.run.app",{method:"POST",headers:Object.assign({"Content-Type":"application/json"},t?{Authorization:`Bearer ${t}`}:{}),body:JSON.stringify({data:{}})});if(!r.ok)O("[OZmoz] Cloud error HTTP "+r.status);else{let n=await r.json(),s=n.result?.data||n.result||n.data;if(s&&s.protocol&&s.directives)return d("[OZmoz] Instructions loaded successfully."),i.existsSync(c.dirname(e))||i.mkdirSync(c.dirname(e),{recursive:!0}),i.writeFileSync(e,JSON.stringify(s,null,2),"utf8"),s;O("[OZmoz] Empty Cloud response.")}}catch(r){O("[OZmoz] Network error: "+r.message)}if(i.existsSync(e)){d("[OZmoz] Using local cache (~/.fleetbo/guidelines.json)");try{return JSON.parse(i.readFileSync(e,"utf8"))}catch{}}return{protocol:"",directives:"",version:"1.0.0"}}function G(e,t){return"<!-- ozmoz:start v"+e+` -->
|
|
3
3
|
`+t.trim()+`
|
|
4
4
|
`+fe+`
|
|
5
5
|
`}function ve(e,t,r){let n=i.existsSync(e)?i.readFileSync(e,"utf8"):null,s,o;return n===null?(s="created",o=t):V.test(n)?(o=n.replace(V,()=>t.trimEnd()),s=o===n?"unchanged":"updated"):n.includes(H)?(s="migrated",o=t):(s="appended",o=n.replace(/\s*$/,`
|
|
6
6
|
|
|
7
|
-
`)+t),!r&&s!=="unchanged"&&(s==="migrated"&&i.writeFileSync(e+".ozmoz-legacy.bak",n,"utf8"),i.mkdirSync(c.dirname(e),{recursive:!0}),i.writeFileSync(e,o,"utf8")),s}function Q(){return[c.join(__dirname,"ozmoz-mcp.js"),c.join(__dirname,"..","bin","ozmoz-mcp.js"),c.join(__dirname,"bin","ozmoz-mcp.js"),c.join(__dirname,"..","src","bin","ozmoz-mcp.js")].find(t=>i.existsSync(t))||c.resolve(__dirname,"ozmoz-mcp.js")}function
|
|
7
|
+
`)+t),!r&&s!=="unchanged"&&(s==="migrated"&&i.writeFileSync(e+".ozmoz-legacy.bak",n,"utf8"),i.mkdirSync(c.dirname(e),{recursive:!0}),i.writeFileSync(e,o,"utf8")),s}function Q(){return[c.join(__dirname,"ozmoz-mcp.js"),c.join(__dirname,"..","bin","ozmoz-mcp.js"),c.join(__dirname,"bin","ozmoz-mcp.js"),c.join(__dirname,"..","src","bin","ozmoz-mcp.js")].find(t=>i.existsSync(t))||c.resolve(__dirname,"ozmoz-mcp.js")}function M(e,t,r){let n=Object.assign({command:process.execPath,args:[__filename,"mcp","--run"]},r||{}),s={};if(i.existsSync(e))try{let l=JSON.parse(i.readFileSync(e,"utf8"));if(!l||typeof l!="object"||Array.isArray(l))return"invalid";s=l}catch{return"invalid"}let o=s.mcpServers&&s.mcpServers[k];return o&&JSON.stringify(o)===JSON.stringify(n)?"unchanged":(s.mcpServers=s.mcpServers||{},s.mcpServers[k]=n,t||(i.mkdirSync(c.dirname(e),{recursive:!0}),i.writeFileSync(e,JSON.stringify(s,null,2)+`
|
|
8
8
|
`,"utf8")),o?"updated":"created")}function R(e){let t=process.platform==="win32"?"where":"which";return x(t,[e],{stdio:"ignore"}).status===0}function $(e,t,r){let n=x(e,t,{encoding:"utf8",timeout:r||3e4,shell:process.platform==="win32"});return{ok:n.status===0,out:(n.stdout||"")+(n.stderr||"")}}function Se(e,t,r){let n=e==="claude"?["--scope",r||"user"]:[],s=Q(),o=["mcp","add"].concat(n,[k,"--",process.execPath,s]),l=["mcp","remove",k].concat(n),a=e+" "+o.join(" ");if(!R(e))return{status:"manual",detail:a};if(t)return{status:"planned",detail:a};let m=$(e,["mcp","list"],6e4),u=m.ok?m.out.split(`
|
|
9
|
-
`):[],f=u.find(v=>/^[\s|│┃]*ozmoz(?![\w@-])/.test(v)),p=u.some(v=>/^\s*(?:fleetbo|ozmoz):\s/.test(v));if(f&&f.includes("ozmoz@latest"))return{status:"unchanged",legacy:p};if(f&&!$(e,l).ok)return{status:"manual",detail:e+" "+l.join(" ")+" && "+a,legacy:p};let
|
|
9
|
+
`):[],f=u.find(v=>/^[\s|│┃]*ozmoz(?![\w@-])/.test(v)),p=u.some(v=>/^\s*(?:fleetbo|ozmoz):\s/.test(v));if(f&&f.includes("ozmoz@latest"))return{status:"unchanged",legacy:p};if(f&&!$(e,l).ok)return{status:"manual",detail:e+" "+l.join(" ")+" && "+a,legacy:p};let g=$(e,o);return g.ok?{status:f?"updated":"created",legacy:p}:{status:"failed",detail:a,message:g.out.trim().split(`
|
|
10
10
|
`).slice(-2).join(" "),legacy:p}}function Ee(e){let t={user:!1,local:!1,others:[]};try{let r=JSON.parse(i.readFileSync(c.join(b.homedir(),".claude.json"),"utf8")),n=a=>!!a&&typeof a=="object"&&/ozmoz|ozmoz/.test(String(a.command||"")+" "+JSON.stringify(a.args||[])),s=(a,m)=>{!a||typeof a!="object"||Object.keys(a).forEach(u=>{u===k?t[m]=!0:n(a[u])&&t.others.push({name:u,where:m})})};s(r.mcpServers,"user");let o=e;try{o=i.realpathSync(e)}catch{}let l=r.projects||{};Array.from(new Set([e,o])).forEach(a=>s((l[a]||{}).mcpServers,"local"))}catch{}return t}function we(e){let t=Ee(e);t.user&&d(" \u26A0\uFE0F A global (user-scope) '"+k+"' entry from a previous version also exists: the tools appear in every project. To keep them in OZmoz projects only: claude mcp remove "+k+" --scope user"),t.local&&d(" \u26A0\uFE0F A local-scope '"+k+"' entry exists for this folder and takes precedence over .mcp.json. Remove it: claude mcp remove "+k+" --scope local"),t.others.forEach(r=>{d(" \u26A0\uFE0F An old MCP entry named '"+r.name+"' ("+r.where+" scope) points to OZmoz/OZmoz. Remove it: claude mcp remove "+r.name+" --scope "+r.where)})}function be(e){let t=b.homedir(),r=n=>i.existsSync(n);return{claude:R("claude")||r(c.join(t,".claude")),cursor:r(c.join(e,".cursor"))||r(c.join(t,".cursor"))||R("cursor"),windsurf:r(c.join(t,".codeium","windsurf"))||r(c.join(e,".windsurf")),devin:r(c.join(e,".devin")),codex:R("codex")||r(c.join(t,".codex")),gemini:R("gemini")||r(c.join(t,".gemini")),antigravity:R("agy")||r(c.join(t,".antigravity"))||r(c.join(e,".antigravity")),copilot:R("copilot")||r(c.join(t,".copilot"))}}var Te={claude:{bin:"claude",launch:e=>[e]},gemini:{bin:"gemini",launch:e=>["-i",e]},codex:{bin:"codex",launch:e=>[e]},antigravity:{bin:"agy",launch:e=>["-i",e]}};function Ae(e){return String(e||"").replace(/[^\p{L}\p{N} '.,:\-_]/gu," ").replace(/\s+/g," ").trim().slice(0,4e3)}function Ce(e,t,r){let n=Ae(t),s=n?`The user already provided their project description and technical choices: "${n}".
|
|
11
11
|
- Check if the framework (e.g. React, Vue) is already specified.
|
|
12
12
|
- If it is, DO NOT ask a generic "what tech do you want" question. Acknowledge their choice naturally (e.g. "J'ai bien not\xE9 que vous souhaitez utiliser React...") and only ask for the missing precision (TypeScript vs JavaScript) in a single friendly confirmation, or proceed directly if obvious.
|
|
13
|
-
- Once the user answers, do NOT run exploratory bash commands. IMMEDIATELY call the MCP tool 'oz_create_project' with the application name.`:"Ask me the starter questions from your OZmoz instructions before installing anything: the technology first, then a one-sentence project description, one question at a time.",o=null,l=!0;try{let p=c.join(r,".env");if(i.existsSync(p)){let
|
|
13
|
+
- Once the user answers, do NOT run exploratory bash commands. IMMEDIATELY call the MCP tool 'oz_create_project' with the application name.`:"Ask me the starter questions from your OZmoz instructions before installing anything: the technology first, then a one-sentence project description, one question at a time.",o=null,l=!0;try{let p=c.join(r,".env");if(i.existsSync(p)){let g=i.readFileSync(p,"utf8"),v=g.match(/^\s*OZ_DB_KEY\s*=\s*(.+?)\s*$/m);v&&(o=v[1].trim());let y=g.match(/^\s*OZ_PROTOTYPE\s*=\s*(.+?)\s*$/m);y&&(l=y[1].trim().toLowerCase()==="true")}}catch{}let a=i.existsSync(c.join(r,"svro.schema.json")),m=i.existsSync(c.join(r,"index.html"))||i.existsSync(c.join(r,"package.json")),u=l?"OZ_PROTOTYPE=true (mode essai / local sandbox)":"OZ_PROTOTYPE=false (mode r\xE9el / live database)",f=o||a?"This folder ALREADY contains an OZmoz project (OZ_DB_KEY="+o+", "+u+"). Do NOT call oz_create_project, and do NOT ask the starter questions. State this in one plain sentence to the user \u2014 then ask what I want to work on now.":m?'This folder does NOT have an OZmoz project yet, but a frontend project ALREADY exists here \u2014 do NOT run "npm create vite" or scaffold a new frontend. Skip the technology question and ask me only for a one-sentence project description, then call oz_create_project directly.':"This folder does NOT contain an OZmoz project yet (no .env, no svro.schema.json). "+s;return"Use OZmoz as the backend of my app. You are in the project folder ("+r+"). Follow your OZmoz local instructions (do NOT run bash commands or web searches to inspect instruction files, they are already active). "+f}function Ie(){let e=process.env;if(e.CLAUDECODE==="1"||e.GEMINI_CLI||e.CODEX_CLI||e.AI_AGENT||e.CURSOR_AGENT||e.ANTIGRAVITY_CLI)return!0;if(process.platform==="win32")return!1;try{let t=x("ps",["-A","-o","pid=,ppid=,args="],{encoding:"utf8"});if(t.status!==0)return!1;let r=new Map;t.stdout.split(`
|
|
14
14
|
`).forEach(s=>{let o=s.match(/^\s*(\d+)\s+(\d+)\s+(.*)$/);o&&r.set(Number(o[1]),{ppid:Number(o[2]),args:o[3]})});let n=process.ppid;for(let s=0;n>1&&s<20&&r.has(n);s++){let{ppid:o,args:l}=r.get(n);if(l.split(/\s+/).slice(0,2).some(m=>/(^|\/)(gemini|claude|codex|antigravity|agy)$/.test(m))||/@google\/gemini-cli|@anthropic-ai\/claude-code|@openai\/codex/.test(l))return!0;n=o}}catch{}return!1}function ke(e){let t=process.platform==="win32"?"where":"which";return x(t,[e],{stdio:"ignore"}).status===0}function xe(e,t){let r=t.slice(1).filter(f=>!f.startsWith("--")),n=(r[0]||"").toLowerCase(),s=r.slice(1).join(" "),o=Te[n];o||(O('Usage: npx ozmoz start <claude|gemini|codex> ["your app idea"]'),O('Cursor, Windsurf, Devin and GitHub Copilot have no terminal agent to launch: run "npx ozmoz mcp --agent=<cursor|windsurf|devin|copilot>" instead.'),process.exit(1));let l=!1;try{l=!!JSON.parse(i.readFileSync(c.join(b.homedir(),".fleetbo","credentials.json"),"utf8")).devToken}catch{}l||(d("[OZmoz] First use on this machine: sign in (your browser opens, approve once)."),x(process.execPath,[__filename,"login"],{stdio:"inherit",cwd:e,env:Object.assign({},process.env,{FLEETBO_START:"1"})}).status!==0&&(O('Sign-in did not complete. Run "npx ozmoz start '+n+'" again.'),process.exit(1))),x(process.execPath,[__filename,"mcp","--agent="+n],{stdio:"inherit",cwd:e,env:Object.assign({},process.env,{FLEETBO_START:"1"})}).status!==0&&(O("Could not configure "+o.bin+'. Run "npx ozmoz mcp --agent='+n+'" to see why.'),process.exit(1)),Ie()&&(d(`
|
|
15
15
|
[OZmoz] OZmoz is set up in this folder (instruction file + MCP server).
|
|
16
16
|
`),process.exit(0)),ke(o.bin)||(O('"'+o.bin+'" is not installed or not in your PATH. Install it, then run: npx ozmoz start '+n),process.exit(1));let m=Ce(o.rules,s,e);d(`
|
|
17
17
|
[OZmoz] Launching `+o.bin+` in this folder...
|
|
18
|
-
`);let u=x(o.bin,o.launch(process.platform==="win32"?'"'+m+'"':m),{stdio:"inherit",cwd:e,shell:process.platform==="win32"});process.exit(u.status===null?1:u.status)}async function ee(e,t){let r=t.includes("--dry-run"),n=t.find(
|
|
19
|
-
[OZmoz] Configuring your AI agents`+(r?" (dry run: nothing is written)":"")+"...");let p=await X(),
|
|
18
|
+
`);let u=x(o.bin,o.launch(process.platform==="win32"?'"'+m+'"':m),{stdio:"inherit",cwd:e,shell:process.platform==="win32"});process.exit(u.status===null?1:u.status)}async function ee(e,t){let r=t.includes("--dry-run"),n=t.find(h=>h.startsWith("--agent=")),s=n&&n.slice(8).trim()?n.slice(8).split(",").map(h=>h.trim().toLowerCase()).filter(Boolean):null,o=null;if(s){o=s.includes("all")?Object.keys(F):s;let h=o.filter(E=>!F[E]);h.length&&(O("Unknown agent(s): "+h.join(", ")+". Valid values: "+Object.keys(F).join(", ")+", all."),process.exit(1))}let l=t.find(h=>h.startsWith("--scope=")),a=l?l.slice(8).trim().toLowerCase():"project";["project","user","local"].includes(a)||(O("Unknown scope: "+a+". Valid values for Claude Code: project (default), user, local."),process.exit(1));let m=be(e),u=o||Object.keys(F).filter(h=>m[h]),f=ge();d(`
|
|
19
|
+
[OZmoz] Configuring your AI agents`+(r?" (dry run: nothing is written)":"")+"...");let p=await X(),g=p.version||f,v=`# OZMOZ DATA OS \u2014 DIRECTIVES AGENT
|
|
20
20
|
|
|
21
21
|
`+(p.directives||p.guidelines||"")+`
|
|
22
22
|
|
|
23
23
|
## PROTOCOLE DONN\xC9ES : QUI FAIT QUOI (AGENT FRONTEND \u2194 ALEX AI)
|
|
24
24
|
|
|
25
|
-
`+(p.protocol||""),y=G(
|
|
26
|
-
@AGENTS.md`)]],z=c.join(e,".cursorrules");if(i.existsSync(z)){let
|
|
25
|
+
`+(p.protocol||""),y=G(g,v),S=[["AGENTS.md",y],["GEMINI.md",y],["CLAUDE.md",G(g,`# OZMOZ DATA OS \u2014 DIRECTIVES AGENT
|
|
26
|
+
@AGENTS.md`)]],z=c.join(e,".cursorrules");if(i.existsSync(z)){let h=i.readFileSync(z,"utf8");(V.test(h)||h.includes(H))&&S.push([".cursorrules",y])}for(let h of S)d("\u2192 "+h[0]+": "+P[ve(c.join(e,h[0]),h[1],r)]);for(let h of u){let E=F[h];if(h==="cursor")d("\u2192 "+E+" MCP (.cursor/mcp.json): "+P[M(c.join(e,".cursor","mcp.json"),r)]);else if(h==="windsurf")d("\u2192 "+E+" MCP (~/.codeium/windsurf/mcp_config.json): "+P[M(c.join(b.homedir(),".codeium","windsurf","mcp_config.json"),r)]);else if(h==="copilot")d("\u2192 "+E+" MCP (~/.copilot/mcp-config.json): "+P[M(c.join(b.homedir(),".copilot","mcp-config.json"),r,{type:"local",tools:["*"]})]);else if(h==="claude"&&a==="project"){let T=M(c.join(e,".mcp.json"),r);d("\u2192 "+E+" MCP (.mcp.json, project scope): "+P[T]),(T==="created"||T==="updated")&&d(" Claude Code asks you to approve a project server the first time you launch it. Commit .mcp.json to share it with your team (it contains no token)."),we(e)}else if(h==="gemini"){let T=[c.join(b.homedir(),".gemini","settings.json"),c.join(e,".gemini","settings.json"),c.join(e,".mcp.json")],w="unchanged";T.forEach(B=>{let D=M(B,r);(D==="created"||D==="updated")&&(w=D)}),d("\u2192 "+E+" MCP (settings.json & .mcp.json): "+P[w])}else if(h==="claude"||h==="codex"||h==="antigravity"){let T=h==="antigravity"?"agy":h,w=Se(T,r,a);w.status==="manual"?d("\u2192 "+E+": '"+T+"' not found or not scriptable. Run manually: "+w.detail):w.status==="planned"?d("\u2192 "+E+" MCP: would run: "+w.detail):w.status==="failed"?O("\u2192 "+E+" MCP: registration failed ("+w.message+"). Run manually: "+w.detail):d("\u2192 "+E+" MCP"+(h==="claude"?" ("+a+" scope)":"")+": "+P[w.status]),w.legacy&&d(" \u26A0\uFE0F An old MCP entry named 'fleetbo' exists. Remove it: "+T+" mcp remove fleetbo")}else h==="devin"&&d("\u2192 "+E+": reads AGENTS.md. Devin runs in its own environment: add the OZmoz MCP server from Devin's settings (not automated).")}!o&&u.length===0&&d("\u2192 No agent detected: instruction files were written; re-run with --agent=<name> to register the MCP server.");let C=!!(Z(e).FLEETBO_DEV_TOKEN||process.env.FLEETBO_DEV_TOKEN),N=c.join(b.homedir(),".fleetbo","credentials.json");if(i.existsSync(N))try{C=C||!!JSON.parse(i.readFileSync(N,"utf8")).devToken}catch{}C||O('\u26A0\uFE0F No developer token found. Run "npx ozmoz login" once.'),process.env.FLEETBO_START||d(`
|
|
27
27
|
[OZmoz] Done.
|
|
28
|
-
`)}function
|
|
28
|
+
`)}function _e(e){let t=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";oe(`${t} "${e}"`)}function Ne(e){return new Promise((t,r)=>{let n=ne.createServer((s,o)=>{if(o.setHeader("Access-Control-Allow-Origin","*"),o.setHeader("Access-Control-Allow-Methods","GET, OPTIONS"),o.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization"),o.setHeader("Access-Control-Allow-Private-Network","true"),s.method==="OPTIONS"){o.writeHead(204),o.end();return}let l=new URL(s.url,"http://127.0.0.1");if(l.pathname==="/callback"){let a=l.searchParams.get("token"),m=l.searchParams.get("refresh");if(!a){o.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),o.end("<h3>Error: Missing token.</h3>");return}let u=c.join(b.homedir(),".fleetbo");i.existsSync(u)||i.mkdirSync(u,{recursive:!0}),i.writeFileSync(c.join(u,"credentials.json"),JSON.stringify({devToken:a,refreshToken:m||null,updatedAt:new Date().toISOString()},null,2));let f=c.join(e,".env");if(i.existsSync(f)){let p=i.readFileSync(f,"utf8");p.includes("FLEETBO_DEV_TOKEN=")?p=p.replace(/FLEETBO_DEV_TOKEN=.*/g,`FLEETBO_DEV_TOKEN=${a}`):p+=`
|
|
29
29
|
FLEETBO_DEV_TOKEN=${a}
|
|
30
30
|
`,i.writeFileSync(f,p,"utf8")}o.writeHead(200,{"Content-Type":"text/html; charset=utf-8",Connection:"close"}),o.end(`
|
|
31
31
|
<!DOCTYPE html>
|
|
@@ -49,18 +49,18 @@ FLEETBO_DEV_TOKEN=${a}
|
|
|
49
49
|
[OZmoz] Developer token received and stored successfully!`),!process.env.FLEETBO_START&&!["AGENTS.md","CLAUDE.md","GEMINI.md"].some(p=>i.existsSync(c.join(e,p)))&&(d(`
|
|
50
50
|
Next step to connect your AI agents:`),d(` npx ozmoz mcp (Configure Claude Code, Cursor, Windsurf, Devin, Codex CLI, Gemini CLI, Antigravity CLI, GitHub Copilot)
|
|
51
51
|
`)),typeof n.closeAllConnections=="function"&&n.closeAllConnections(),n.close(()=>t()),setTimeout(()=>t(),300)}});n.listen(0,"127.0.0.1",()=>{let o=`https://ozmoz.io/cli-auth?port=${n.address().port}`;d(`
|
|
52
|
-
[OZmoz] Waiting for authentication...`),d(`If your browser does not open automatically, visit: ${o}`),
|
|
53
|
-
`).forEach(s=>{let[o,...l]=s.split("=");o&&l.length>0&&(n[o.trim()]=l.join("=").trim())}),n}function J(e,t){return new Promise((r,n)=>{let s=JSON.stringify({projectId:e,moduleName:t}),o={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},l=W.request(o,a=>{let m="";a.on("data",u=>{m+=u}),a.on("end",()=>{if(a.statusCode>=200&&a.statusCode<300)try{let u=JSON.parse(m);if(u.success&&u.found&&u.module){let f=u.module.code||u.module.mockCode;r(typeof f=="string"?JSON.parse(f):f)}else r(null)}catch{n(new Error(`Invalid JSON response for ${t}.`))}else n(new Error(`Server error ${a.statusCode} while fetching ${t}`))})});l.on("error",a=>n(a)),l.write(s),l.end()})}var A=process.argv.slice(2),I=A[0],
|
|
52
|
+
[OZmoz] Waiting for authentication...`),d(`If your browser does not open automatically, visit: ${o}`),_e(o);let l=Number(process.env.FLEETBO_LOGIN_TIMEOUT_MS)||12e4;setTimeout(()=>{try{typeof n.closeAllConnections=="function"&&n.closeAllConnections()}catch{}n.close(),r(new Error(`Login timed out after ${Math.round(l/1e3)}s: browser approval not received. Run "npx ozmoz login" once more and approve in the browser.`))},l).unref()}),n.on("error",s=>r(s))})}function De(e,t,r){return new Promise((n,s)=>{let o=JSON.stringify({enterpriseID:e,schema:t,workflow:r}),l={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(o)}},a=W.request(l,m=>{let u="";m.on("data",f=>{u+=f}),m.on("end",()=>{m.statusCode>=200&&m.statusCode<300?n(JSON.parse(u)):s(new Error(`Edge sync failed with HTTP ${m.statusCode}`))})});a.on("error",m=>s(m)),a.write(o),a.end()})}function Z(e){let t=c.join(e,".env");if(!i.existsSync(t))return{};let r=i.readFileSync(t,"utf8"),n={};return r.split(`
|
|
53
|
+
`).forEach(s=>{let[o,...l]=s.split("=");o&&l.length>0&&(n[o.trim()]=l.join("=").trim())}),n}function J(e,t){return new Promise((r,n)=>{let s=JSON.stringify({projectId:e,moduleName:t}),o={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},l=W.request(o,a=>{let m="";a.on("data",u=>{m+=u}),a.on("end",()=>{if(a.statusCode>=200&&a.statusCode<300)try{let u=JSON.parse(m);if(u.success&&u.found&&u.module){let f=u.module.code||u.module.mockCode;r(typeof f=="string"?JSON.parse(f):f)}else r(null)}catch{n(new Error(`Invalid JSON response for ${t}.`))}else n(new Error(`Server error ${a.statusCode} while fetching ${t}`))})});l.on("error",a=>n(a)),l.write(s),l.end()})}var A=process.argv.slice(2),I=A[0],je=["id","_id","userId","author","dateCreated","createdAt","_schema_version"],te=e=>je.includes(e)||/^_/.test(e)||/^(created|updated|modified|deleted)(At|By)$/i.test(e);function U(e){return!e||typeof e!="object"?null:e.fields&&typeof e.fields=="object"?e.fields:e.schema&&typeof e.schema=="object"?e.schema:null}function Pe(e){let t=[];if(!e||typeof e!="object"||!e.collections)return{schema:e,changed:!1,notes:t};let r=JSON.parse(JSON.stringify(e));return Object.entries(r.collections).forEach(([n,s])=>{let o=U(s);o&&Object.keys(o).forEach(l=>{te(l)&&o[l]&&typeof o[l]=="object"&&o[l].required===!0&&(o[l].required=!1,t.push(n+"."+l))})}),{schema:r,changed:t.length>0,notes:t}}function Re(e){let t=String(typeof e=="string"?e:e&&e.type||"").toLowerCase(),r=e&&(e.enum||e.values||e.options);return Array.isArray(r)&&r.length?JSON.stringify(r[0]):t==="number"||t==="integer"||t==="float"?"0":t==="boolean"||t==="toggle"?"false":t==="date"||t==="datetime"||t==="timestamp"?"new Date().toISOString()":t==="reference"?"'<id du document li\xE9>'":t==="media"?"null /* image/fichier : oz.addWithMedia */":t==="array"?"[]":"'\u2026'"}function Le(e){let r=Object.entries(e&&e.collections||{}),n=`## \u{1F4E5} CE QUE LE CODE DOIT ENVOYER (MOD\xC8LES D'\xC9CRITURE)
|
|
54
54
|
|
|
55
55
|
`;n+=`### \u{1F194} Identifiants
|
|
56
|
-
`,n+="* OZmoz attribue lui-m\xEAme `_id` (cha\xEEne) \xE0 chaque document. Utilise `doc._id` partout ; \xE0 la lecture, `doc.id` existe comme alias de `_id` (m\xEAme valeur), en prototype comme en production, mais la r\xE9f\xE9rence est `_id`.\n",n+="* N'envoie **jamais** `id` ni `_id` dans `oz.add` : `oz.add` renvoie `{ success, documentId }` (`documentId` = `_id`).\n",n+="* Pour lire, modifier ou supprimer un document : `oz.getDoc(table, doc._id)`, `oz.update(table, doc._id, {\u2026})`, `oz.delete(table, doc._id)`. Pour relier deux collections, stocke le `_id` du document li\xE9 dans un champ (ex. `playlistId`).\n",n+="* `userId`, `createdAt` et les autres champs de tra\xE7abilit\xE9 sont renseign\xE9s par le moteur : ne les envoie pas.\n\n";let s=r.filter(([,o])=>
|
|
57
|
-
`:(s.forEach(([o,l])=>{let a=
|
|
56
|
+
`,n+="* OZmoz attribue lui-m\xEAme `_id` (cha\xEEne) \xE0 chaque document. Utilise `doc._id` partout ; \xE0 la lecture, `doc.id` existe comme alias de `_id` (m\xEAme valeur), en prototype comme en production, mais la r\xE9f\xE9rence est `_id`.\n",n+="* N'envoie **jamais** `id` ni `_id` dans `oz.add` : `oz.add` renvoie `{ success, documentId }` (`documentId` = `_id`).\n",n+="* Pour lire, modifier ou supprimer un document : `oz.getDoc(table, doc._id)`, `oz.update(table, doc._id, {\u2026})`, `oz.delete(table, doc._id)`. Pour relier deux collections, stocke le `_id` du document li\xE9 dans un champ (ex. `playlistId`).\n",n+="* `userId`, `createdAt` et les autres champs de tra\xE7abilit\xE9 sont renseign\xE9s par le moteur : ne les envoie pas.\n\n";let s=r.filter(([,o])=>U(o)&&Object.keys(U(o)).length>0);return s.length===0?n+`_Aucune collection scell\xE9e pour l'instant : les mod\xE8les appara\xEEtront apr\xE8s la mod\xE9lisation d'Alex._
|
|
57
|
+
`:(s.forEach(([o,l])=>{let a=U(l),m=Object.entries(a).filter(([p])=>!te(p));n+="### `"+o+`\`
|
|
58
58
|
|
|
59
59
|
| Champ | Type | Obligatoire | Valeurs / remarques |
|
|
60
60
|
|---|---|---|---|
|
|
61
|
-
`,m.forEach(([p,
|
|
61
|
+
`,m.forEach(([p,g])=>{let v=typeof g=="string"?g:g&&g.type||"any",y=g&&(g.enum||g.values||g.options),S=Array.isArray(y)&&y.length?"parmi : "+y.map(z=>"`"+z+"`").join(", "):"";n+="| `"+p+"` | "+v+" | "+(g&&g.required===!0?"\u2705 oui":"non")+" | "+S+` |
|
|
62
62
|
`});let u=m.filter(([,p])=>p&&p.required===!0),f=m.filter(([,p])=>!(p&&p.required===!0));n+="\nInsertion valide :\n```js\nawait oz.add('"+o+`', {
|
|
63
|
-
`,u.forEach(([p,
|
|
63
|
+
`,u.forEach(([p,g])=>{n+=" "+p+": "+Re(g)+`,
|
|
64
64
|
`}),f.length&&(n+=" // optionnels : "+f.map(([p])=>p).join(", ")+`
|
|
65
65
|
`),n+=`}, {
|
|
66
66
|
`,n+=" desc: 'Cr\xE9ation d\\'un \xE9l\xE9ment dans "+o+`',
|
|
@@ -628,9 +628,9 @@ ${JSON.stringify(e||{},null,2)}
|
|
|
628
628
|
\`\`\`json
|
|
629
629
|
${JSON.stringify(t||{},null,2)}
|
|
630
630
|
\`\`\`
|
|
631
|
-
`}function
|
|
631
|
+
`}function Me(e){return String(e).toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]/g,"_").replace(/^_+|_+$/g,"").slice(0,30)||"app"}async function Ue(e,t){let r=Z(e),n=i.existsSync(c.join(e,"svro.schema.json"));(r.OZ_DB_KEY||n)&&(O("Cannot create project: an OZmoz project already exists in this folder."),d('\u2192 Use "npx ozmoz sync" or evolve the existing contract instead.'),process.exit(1));let s=(t||"").trim();s||(O('Project name is required. Usage: npx ozmoz create "<name>"'),process.exit(1));let o=c.join(e,".ozmoz.lock");if(i.existsSync(o)){let a=!1;try{let m=Number(i.readFileSync(o,"utf8"));Date.now()-m>6e4&&(a=!0)}catch{a=!0}a||(O("A project creation is already running in this folder."),process.exit(1)),i.unlinkSync(o)}i.writeFileSync(o,String(Date.now()));let l=()=>{if(i.existsSync(o))try{i.unlinkSync(o)}catch{}};try{let a=process.env.FLEETBO_DEV_TOKEN;if(!a){let y=c.join(b.homedir(),".fleetbo","credentials.json");if(i.existsSync(y))try{a=JSON.parse(i.readFileSync(y,"utf8")).devToken}catch{}}a||(l(),O('Missing developer token. Please run "npx ozmoz login" first.'),process.exit(1)),d(`[OZmoz] Creating project "${s}" on Cloud...`);let m=Me(s),u=[m,`${m.slice(0,24)}_${Math.random().toString(36).slice(2,6)}`,`${m.slice(0,24)}_${Math.random().toString(36).slice(2,6)}`],f=null,p=null;for(let y of u)try{let S=await fetch("https://createprojectlight-jqycakhlxa-uc.a.run.app",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({data:{name:s,keyApp:y}})}),z=await S.json();if(S.ok&&!z.error){f={keyApp:y,data:z.result?.data||z.data||{}};break}else p=z.error?.message||`HTTP ${S.status}`}catch(S){p=S.message}f||(l(),O(`Failed to create project on Cloud: ${p||"Unknown error"}`),process.exit(1));let g=f.data.bootstrapToken;await K(e,[`--keyApp=${f.keyApp}`,`--token=${g}`]);let v=c.join(e,"package.json");Y(e,v),await ee(e,[]),d(`
|
|
632
632
|
[OZmoz] Project "${s}" (${f.keyApp}) created and configured successfully.`),d(`Next step: scaffold the frontend if needed, then run "npx ozmoz sync".
|
|
633
|
-
`)}finally{if(i.existsSync(o))try{i.unlinkSync(o)}catch{}}}async function Ze(e){let t=process.env.FLEETBO_DEV_TOKEN;if(!t){let y=c.join(b.homedir(),".fleetbo","credentials.json");if(i.existsSync(y))try{t=JSON.parse(i.readFileSync(y,"utf8")).devToken}catch{}}let n=Z(e).OZ_KEY_APP;(!n||!t)&&(O("Cannot update: project uninitialized or dev token missing."),process.exit(1));let s=i.existsSync(c.join(e,"src"))?c.join(e,"src"):e,o=new Set([".jsx",".tsx",".vue",".svelte",".js",".ts",".html"]),l=[],a=0;function m(y){let S=[];try{S=i.readdirSync(y,{withFileTypes:!0})}catch{return}for(let z of S){if(/^(node_modules|\.git|dist|build|\.next|\.svelte-kit)$/.test(z.name))continue;let
|
|
633
|
+
`)}finally{if(i.existsSync(o))try{i.unlinkSync(o)}catch{}}}async function Ze(e){let t=process.env.FLEETBO_DEV_TOKEN;if(!t){let y=c.join(b.homedir(),".fleetbo","credentials.json");if(i.existsSync(y))try{t=JSON.parse(i.readFileSync(y,"utf8")).devToken}catch{}}let n=Z(e).OZ_KEY_APP;(!n||!t)&&(O("Cannot update: project uninitialized or dev token missing."),process.exit(1));let s=i.existsSync(c.join(e,"src"))?c.join(e,"src"):e,o=new Set([".jsx",".tsx",".vue",".svelte",".js",".ts",".html"]),l=[],a=0;function m(y){let S=[];try{S=i.readdirSync(y,{withFileTypes:!0})}catch{return}for(let z of S){if(/^(node_modules|\.git|dist|build|\.next|\.svelte-kit)$/.test(z.name))continue;let _=c.join(y,z.name);if(z.isDirectory())m(_);else if(o.has(c.extname(z.name))&&!z.name.endsWith(".d.ts"))try{let C=i.statSync(_);if(C.size>3e5)continue;let N=i.readFileSync(_,"utf8");/oz\.|<oz-/i.test(N)&&(a+=C.size,l.push({name:c.relative(e,_).split(c.sep).join("/"),content:N}))}catch{}}}m(s),l.length===0&&(O("Cannot update: no components using oz.* found."),process.exit(1)),a>8*1024*1024&&(O("Payload too large: total UI source files exceed 8 MB limit."),process.exit(1));let u=A.find(y=>y.startsWith("--rules=")),f=u?u.slice(8).trim():"",p=A.find(y=>y.startsWith("--reasoning=")),g=p?p.slice(12).trim().toLowerCase():void 0;g!=="standard"&&g!=="high"&&(O("Missing or invalid --reasoning=<standard|high>."),O("If you are an AI agent: ask the user which analysis depth they want (numbered [1]/[2] choice, recommended option first) before running this command, then pass --reasoning=standard or --reasoning=high accordingly. Never pick it yourself."),process.exit(1)),d(`[OZmoz] Sending ${l.length} component(s) to Cloud Engine for modeling...`);try{let y=await fetch("https://updateprojectlight-jqycakhlxa-uc.a.run.app",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({data:{keyApp:n,name:n,newViewFiles:l,oz_rules:f,reasoning:g}})}),S=await y.json();(!y.ok||S.error)&&(O(`Update failed: ${S.error?.message||S.message||"Server error"}`),process.exit(1))}catch(y){O(`Network error: ${y.message}`),process.exit(1)}d("\u2192 Structure modeled. Sealing into SVRO Kernel..."),x(process.execPath,[__filename,"sync"],{stdio:"inherit",cwd:e}).status===0?d(`
|
|
634
634
|
[OZmoz] Contract successfully locked into SVRO Kernel.
|
|
635
635
|
`):(O(`
|
|
636
636
|
[OZmoz] Kernel sync failed. Run "npx ozmoz sync" manually.
|
|
@@ -641,14 +641,14 @@ ${JSON.stringify(t||{},null,2)}
|
|
|
641
641
|
Next step:`),d(` npx ozmoz sync (Sync cloud schema & generate IDE types)
|
|
642
642
|
`);else if(I==="sync"){let r=A.includes("--dry-run"),n=A.includes("--check-only");d(`[OZmoz] Syncing schema...${r?" (dry-run)":""}${n?" (check-only, no network)":""}`),r||le(e);let s=c.join(e,"svro.schema.json"),o=c.join(e,"svro.workflow.json"),l=c.join(e,"ozmoz_contract.md"),a=c.join(e,"src","ozmoz.d.ts"),u=Z(e).OZ_ENTERPRISE_ID,f=null,p=null;if(n)d("\u2192 Mode check-only : Local contract used, no cloud fetch..");else if(u)try{d("\u2192 Fetching latest contracts from Cloud..."),f=await J(u,"svro.schema.json"),f&&(i.writeFileSync(s,JSON.stringify(f,null,2)+`
|
|
643
643
|
`),d("\u2192 Local svro.schema.json updated.")),p=await J(u,"svro.workflow.json"),p&&(i.writeFileSync(o,JSON.stringify(p,null,2)+`
|
|
644
|
-
`),d("\u2192 Local svro.workflow.json updated."))}catch(z){O(`\u26A0\uFE0F Cloud fetch bypassed: ${z.message}. Using local file fallback.`)}else O("\u26A0\uFE0F OZ_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");let
|
|
644
|
+
`),d("\u2192 Local svro.workflow.json updated."))}catch(z){O(`\u26A0\uFE0F Cloud fetch bypassed: ${z.message}. Using local file fallback.`)}else O("\u26A0\uFE0F OZ_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");let g=f;if(!g&&i.existsSync(s))try{g=JSON.parse(i.readFileSync(s,"utf8"))}catch{}g||(g={context:"Application en cours de mod\xE9lisation initiale.",collections:{}},i.writeFileSync(s,JSON.stringify(g,null,2)+`
|
|
645
645
|
`,"utf8"),d("\u2192 Initial blank svro.schema.json created."));let v=p;if(!v&&i.existsSync(o))try{v=JSON.parse(i.readFileSync(o,"utf8"))}catch{}v||(v={actors:{},sequences:[]},i.writeFileSync(o,JSON.stringify(v,null,2)+`
|
|
646
|
-
`,"utf8"),d("\u2192 Initial blank svro.workflow.json created."));{let z=Pe(
|
|
647
|
-
`,"utf8"),d("\u2192 Managed by system, no longer required from your code: "+z.notes.join(", ")+"."))}let{protocol:y}=await X(),S=Fe(
|
|
648
|
-
`);return` ${
|
|
646
|
+
`,"utf8"),d("\u2192 Initial blank svro.workflow.json created."));{let z=Pe(g);z.changed&&(g=z.schema,i.writeFileSync(s,JSON.stringify(g,null,2)+`
|
|
647
|
+
`,"utf8"),d("\u2192 Managed by system, no longer required from your code: "+z.notes.join(", ")+"."))}let{protocol:y}=await X(),S=Fe(g,v,y);i.writeFileSync(l,S,"utf8"),d("\u2192 Contract markdown successfully generated at project root.");try{let z=Object.keys(g.collections||{});if(u&&!n)try{await De(u,g,v),d("\u2192 Schema successfully sealed into SVRO Kernel (O(1)).")}catch(h){O(`\u26A0\uFE0F Kernel Shield sync warning: ${h.message}`)}let _=g.collections||{},C=Object.entries(_).map(([h,E])=>{let T=E.fields||E.schema||{},w=Object.entries(T).map(([B,D])=>{let L="any",j=String(typeof D=="string"?D:D.type||"").toLowerCase();return j==="string"||j==="text"||j==="media"?L="string":j==="number"?L="number":j==="boolean"||j==="toggle"?L="boolean":j==="array"&&(L="any[]"),` ${B}?:${L};`}).join(`
|
|
648
|
+
`);return` ${h}: {
|
|
649
649
|
${w}
|
|
650
650
|
};`}).join(`
|
|
651
|
-
`),
|
|
651
|
+
`),N=z.length>0?z.map(h=>`'${h}'`).join(" | "):"string";if(i.existsSync(c.dirname(a))){let h=`/* eslint-disable */
|
|
652
652
|
/* prettier-ignore */
|
|
653
653
|
// @ts-nocheck
|
|
654
654
|
// Generated by OZmoz \u2014 Updated via sync
|
|
@@ -681,7 +681,19 @@ ${C}
|
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
declare global {
|
|
684
|
-
|
|
684
|
+
interface ImportMetaEnv {
|
|
685
|
+
readonly OZ_DB_KEY?: string;
|
|
686
|
+
readonly OZ_ENTERPRISE_ID?: string;
|
|
687
|
+
readonly OZ_KEY_APP?: string;
|
|
688
|
+
readonly OZ_PROTOTYPE?: string;
|
|
689
|
+
readonly OZ_FACEBOOK_APP_ID?: string;
|
|
690
|
+
readonly [key: string]: any;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
interface ImportMeta {
|
|
694
|
+
readonly env: ImportMetaEnv;
|
|
695
|
+
}
|
|
696
|
+
type KnownOzTables = ${N};
|
|
685
697
|
type OzTables = KnownOzTables | (string & { _ozPending?: never });
|
|
686
698
|
type OzData<T extends string> = T extends KnownOzTables
|
|
687
699
|
? Partial<OzSchemaMap[T]>
|
|
@@ -784,7 +796,7 @@ declare module 'svelte/elements' {
|
|
|
784
796
|
'oz-reference': OzProp;
|
|
785
797
|
}
|
|
786
798
|
}
|
|
787
|
-
`;i.writeFileSync(a,
|
|
799
|
+
`;i.writeFileSync(a,h)}ie(e),ae(e,t),ce(e),de(e),d(`[OZmoz] Schema synced successfully (${z.length} collection(s)).`),r&&d("\u2192 [Dry-run] Schema is valid.")}catch(z){O(`Error during synchronization: ${z.message}`),process.exit(1)}}else if(I==="create"){let r=A.slice(1).filter(n=>!n.startsWith("--")).join(" ");await Ue(e,r),process.exit(0)}else if(I==="update")await Ze(e),process.exit(0);else if(I==="mcp"){let r=A.includes("--run"),n=!1;if(!r&&!process.stdin.isTTY&&(r=await new Promise(s=>{let o=process.stdin,l=null,a=f=>{clearTimeout(l),o.removeListener("data",m),o.removeListener("end",u),o.removeListener("error",u),s(f)},m=f=>{o.pause(),o.unshift(f),n=!0,a(!0)},u=()=>a(!1);l=setTimeout(()=>{o.pause(),a(!1)},1500),o.on("data",m),o.once("end",u),o.once("error",u)})),r){try{await import(`file://${Q()}`),n&&process.stdin.resume()}catch(s){O(`Failed to start MCP server: ${s.message}`),process.exit(1)}return}await ee(e,A),process.exit(0)}else I==="login"?(await Ne(e),process.exit(0)):I==="start"?xe(e,A):["--help","-h","help"].includes(I)?(d(`OZmoz CLI
|
|
788
800
|
|
|
789
801
|
Commands:
|
|
790
802
|
login Authenticate this machine (opens the browser: approve once, the command exits by itself)
|