ozmoz 0.1.34 → 0.1.37
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 +43 -43
- package/dist/index.js +1 -1
- package/dist/ozmoz-mcp.js +5 -5
- package/dist/ozmoz.iife.js +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var i=require("fs"),a=require("path"),W=require("https"),
|
|
2
|
+
var i=require("fs"),a=require("path"),W=require("https"),oe=require("http"),C=require("os"),{exec:re,spawnSync:N}=require("child_process"),se=[a.join(__dirname,"..","scripts","setup-lib.cjs"),a.join(__dirname,"..","..","scripts","setup-lib.cjs"),a.join(__dirname,"scripts","setup-lib.cjs")],ie=se.find(i.existsSync)||a.join(__dirname,"..","scripts","setup-lib.cjs"),{runFullSetup:Y,handleAuthAndEnv:K,touchTsConfig:ae,attemptViteAutoImportPatch:ce,injectUniversalRuntime:le,writeBrowserConfig:de,patchAllowScripts:ue}=require(ie),pe=!!(process.stdout&&process.stdout.isTTY&&typeof process.stdout.hasColors=="function"&&process.stdout.hasColors(16777216)),me=pe?"\x1B[38;2;15;156;140m":"\x1B[36m",fe="\x1B[31m",q="\x1B[0m";function p(e){console.log(e.replace(/OZmoz|\[|\]|→/g,t=>`${me}${t}${q}`))}function y(e){console.error(`${fe}${e}${q}`)}var x="ozmoz",G=/<!--\s*(?:ozmoz|fleetbo|OZmoz):start[^>]*-->[\s\S]*?<!--\s*(?:ozmoz|fleetbo|OZmoz):end\s*-->/i,he="<!-- 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"},D={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(a.join(__dirname,"..","package.json"),"utf8")).version||"dev"}catch{return"dev"}}var ye=Buffer.from("QUl6YVN5QUM1Uk94STNibklPMUR5TmZsTWhGUnJ0blItNDVwNFJF","base64").toString("utf8");function Oe(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 ze(e,t){let r=await fetch(`https://securetoken.googleapis.com/v1/token?key=${ye}`,{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 X(){if(process.env.FLEETBO_DEV_TOKEN)return process.env.FLEETBO_DEV_TOKEN;try{let e=a.join(C.homedir(),".fleetbo","credentials.json");if(i.existsSync(e)){let t=JSON.parse(i.readFileSync(e,"utf8"));if(t.devToken&&!Oe(t.devToken))return t.devToken;if(t.refreshToken)try{let r=await ze(e,t.refreshToken);if(r)return r}catch{}}}catch{}return null}async function Q(){let e=a.join(C.homedir(),".fleetbo","guidelines.json"),t=await X();t||y('[OZmoz] Not logged in: run "npx ozmoz login" first to load the full instructions. Using local cache if available.');try{p(" [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)y(" [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 p(" [OZmoz] Instructions loaded successfully."),i.existsSync(a.dirname(e))||i.mkdirSync(a.dirname(e),{recursive:!0}),i.writeFileSync(e,JSON.stringify(s,null,2),"utf8"),s;y("[OZmoz] Empty Cloud response.")}}catch(r){y("[OZmoz] Network error: "+r.message)}if(i.existsSync(e)){p("[OZmoz] Using local cache (~/.fleetbo/guidelines.json)");try{return JSON.parse(i.readFileSync(e,"utf8"))}catch{}}return{protocol:"",directives:"",version:"1.0.0"}}function V(e,t){return"<!-- ozmoz:start v"+e+` -->
|
|
3
3
|
`+t.trim()+`
|
|
4
|
-
`+
|
|
4
|
+
`+he+`
|
|
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):G.test(n)?(o=n.replace(G,()=>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(a.dirname(e),{recursive:!0}),i.writeFileSync(e,o,"utf8")),s}function
|
|
8
|
-
`,"utf8")),o?"updated":"created")}function j(e){let t=process.platform==="win32"?"where":"which";return N(t,[e],{stdio:"ignore"}).status===0}function $(e,t,r){let n=N(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=
|
|
9
|
-
`):[],
|
|
10
|
-
`).slice(-2).join(" "),legacy:m}}function Ee(e){let t={user:!1,local:!1,others:[]};try{let r=JSON.parse(i.readFileSync(a.join(C.homedir(),".claude.json"),"utf8")),n=c=>!!c&&typeof c=="object"&&/ozmoz|ozmoz/.test(String(c.command||"")+" "+JSON.stringify(c.args||[])),s=(c,
|
|
7
|
+
`)+t),!r&&s!=="unchanged"&&(s==="migrated"&&i.writeFileSync(e+".ozmoz-legacy.bak",n,"utf8"),i.mkdirSync(a.dirname(e),{recursive:!0}),i.writeFileSync(e,o,"utf8")),s}function ee(){return[a.join(__dirname,"ozmoz-mcp.js"),a.join(__dirname,"..","bin","ozmoz-mcp.js"),a.join(__dirname,"bin","ozmoz-mcp.js"),a.join(__dirname,"..","src","bin","ozmoz-mcp.js")].find(t=>i.existsSync(t))||a.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[x];return o&&JSON.stringify(o)===JSON.stringify(n)?"unchanged":(s.mcpServers=s.mcpServers||{},s.mcpServers[x]=n,t||(i.mkdirSync(a.dirname(e),{recursive:!0}),i.writeFileSync(e,JSON.stringify(s,null,2)+`
|
|
8
|
+
`,"utf8")),o?"updated":"created")}function j(e){let t=process.platform==="win32"?"where":"which";return N(t,[e],{stdio:"ignore"}).status===0}function $(e,t,r){let n=N(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=ee(),o=["mcp","add"].concat(n,[x,"--",process.execPath,s]),l=["mcp","remove",x].concat(n),c=e+" "+o.join(" ");if(!j(e))return{status:"manual",detail:c};if(t)return{status:"planned",detail:c};let h=$(e,["mcp","list"],6e4),u=h.ok?h.out.split(`
|
|
9
|
+
`):[],f=u.find(v=>/^[\s|│┃]*ozmoz(?![\w@-])/.test(v)),m=u.some(v=>/^\s*(?:fleetbo|ozmoz):\s/.test(v));if(f&&f.includes("ozmoz@latest"))return{status:"unchanged",legacy:m};if(f&&!$(e,l).ok)return{status:"manual",detail:e+" "+l.join(" ")+" && "+c,legacy:m};let g=$(e,o);return g.ok?{status:f?"updated":"created",legacy:m}:{status:"failed",detail:c,message:g.out.trim().split(`
|
|
10
|
+
`).slice(-2).join(" "),legacy:m}}function Ee(e){let t={user:!1,local:!1,others:[]};try{let r=JSON.parse(i.readFileSync(a.join(C.homedir(),".claude.json"),"utf8")),n=c=>!!c&&typeof c=="object"&&/ozmoz|ozmoz/.test(String(c.command||"")+" "+JSON.stringify(c.args||[])),s=(c,h)=>{!c||typeof c!="object"||Object.keys(c).forEach(u=>{u===x?t[h]=!0:n(c[u])&&t.others.push({name:u,where:h})})};s(r.mcpServers,"user");let o=e;try{o=i.realpathSync(e)}catch{}let l=r.projects||{};Array.from(new Set([e,o])).forEach(c=>s((l[c]||{}).mcpServers,"local"))}catch{}return t}function we(e){let t=Ee(e);t.user&&p(" \u26A0\uFE0F A global (user-scope) '"+x+"' entry from a previous version also exists: the tools appear in every project. To keep them in OZmoz projects only: claude mcp remove "+x+" --scope user"),t.local&&p(" \u26A0\uFE0F A local-scope '"+x+"' entry exists for this folder and takes precedence over .mcp.json. Remove it: claude mcp remove "+x+" --scope local"),t.others.forEach(r=>{p(" \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 Te(e){let t=C.homedir(),r=n=>i.existsSync(n);return{claude:j("claude")||r(a.join(t,".claude")),cursor:r(a.join(e,".cursor"))||r(a.join(t,".cursor"))||j("cursor"),windsurf:r(a.join(t,".codeium","windsurf"))||r(a.join(e,".windsurf")),devin:r(a.join(e,".devin")),codex:j("codex")||r(a.join(t,".codex")),gemini:j("gemini")||r(a.join(t,".gemini")),antigravity:j("agy")||r(a.join(t,".antigravity"))||r(a.join(e,".antigravity")),copilot:j("copilot")||r(a.join(t,".copilot"))}}var be={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 m=a.join(r,".env");if(i.existsSync(m)){let g=i.readFileSync(m,"utf8"),v=g.match(/^\s*OZ_DB_KEY\s*=\s*(.+?)\s*$/m);v&&(o=v[1].trim());let
|
|
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(
|
|
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 m=a.join(r,".env");if(i.existsSync(m)){let g=i.readFileSync(m,"utf8"),v=g.match(/^\s*OZ_DB_KEY\s*=\s*(.+?)\s*$/m);v&&(o=v[1].trim());let E=g.match(/^\s*OZ_PROTOTYPE\s*=\s*(.+?)\s*$/m);E&&(l=E[1].trim().toLowerCase()==="true")}}catch{}let c=i.existsSync(a.join(r,"svro.schema.json")),h=i.existsSync(a.join(r,"index.html"))||i.existsSync(a.join(r,"package.json")),u=l?"OZ_PROTOTYPE=true (mode essai / local sandbox)":"OZ_PROTOTYPE=false (mode r\xE9el / live database)",f=o||c?"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.":h?'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=N("ps",["-A","-o","pid=,ppid=,args="],{encoding:"utf8"});if(t.status!==0)return!1;let r=new Map;t.stdout.split(`
|
|
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(h=>/(^|\/)(gemini|claude|codex|antigravity|agy)$/.test(h))||/@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 N(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=be[n];o||(y('Usage: npx ozmoz start <claude|gemini|codex> ["your app idea"]'),y('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(a.join(C.homedir(),".fleetbo","credentials.json"),"utf8")).devToken}catch{}l||(p("[OZmoz] First use on this machine: sign in (your browser opens, approve once)."),N(process.execPath,[__filename,"login"],{stdio:"inherit",cwd:e,env:Object.assign({},process.env,{FLEETBO_START:"1"})}).status!==0&&(y('Sign-in did not complete. Run "npx ozmoz start '+n+'" again.'),process.exit(1))),N(process.execPath,[__filename,"mcp","--agent="+n],{stdio:"inherit",cwd:e,env:Object.assign({},process.env,{FLEETBO_START:"1"})}).status!==0&&(y("Could not configure "+o.bin+'. Run "npx ozmoz mcp --agent='+n+'" to see why.'),process.exit(1)),Ie()&&(p(`
|
|
15
15
|
[OZmoz] OZmoz is set up in this folder (instruction file + MCP server).
|
|
16
|
-
`),process.exit(0)),ke(o.bin)||(y('"'+o.bin+'" is not installed or not in your PATH. Install it, then run: npx ozmoz start '+n),process.exit(1));let
|
|
16
|
+
`),process.exit(0)),ke(o.bin)||(y('"'+o.bin+'" is not installed or not in your PATH. Install it, then run: npx ozmoz start '+n),process.exit(1));let h=Ce(o.rules,s,e);p(`
|
|
17
17
|
[OZmoz] Launching `+o.bin+` in this folder...
|
|
18
|
-
`);let
|
|
19
|
-
[OZmoz] Configuring your AI agents`+(r?" (dry run: nothing is written)":"")+"...");let m=await
|
|
18
|
+
`);let u=N(o.bin,o.launch(process.platform==="win32"?'"'+h+'"':h),{stdio:"inherit",cwd:e,shell:process.platform==="win32"});process.exit(u.status===null?1:u.status)}async function te(e,t){let r=t.includes("--dry-run"),n=t.find(d=>d.startsWith("--agent=")),s=n&&n.slice(8).trim()?n.slice(8).split(",").map(d=>d.trim().toLowerCase()).filter(Boolean):null,o=null;if(s){o=s.includes("all")?Object.keys(F):s;let d=o.filter(w=>!F[w]);d.length&&(y("Unknown agent(s): "+d.join(", ")+". Valid values: "+Object.keys(F).join(", ")+", all."),process.exit(1))}let l=t.find(d=>d.startsWith("--scope=")),c=l?l.slice(8).trim().toLowerCase():"project";["project","user","local"].includes(c)||(y("Unknown scope: "+c+". Valid values for Claude Code: project (default), user, local."),process.exit(1));let h=Te(e),u=o||Object.keys(F).filter(d=>h[d]),f=ge();p(`
|
|
19
|
+
[OZmoz] Configuring your AI agents`+(r?" (dry run: nothing is written)":"")+"...");let m=await Q(),g=m.version||f,v=`# OZMOZ DATA OS \u2014 DIRECTIVES AGENT
|
|
20
20
|
|
|
21
21
|
`+(m.directives||m.guidelines||"")+`
|
|
22
22
|
|
|
23
23
|
## PROTOCOLE DONN\xC9ES : QUI FAIT QUOI (AGENT FRONTEND \u2194 ALEX AI)
|
|
24
24
|
|
|
25
|
-
`+(m.protocol||""),
|
|
26
|
-
@AGENTS.md`)]],z=a.join(e,".cursorrules");if(i.existsSync(z)){let
|
|
25
|
+
`+(m.protocol||""),E=V(g,v),T=[["AGENTS.md",E],["GEMINI.md",E],["CLAUDE.md",V(g,`# OZMOZ DATA OS \u2014 DIRECTIVES AGENT
|
|
26
|
+
@AGENTS.md`)]],z=a.join(e,".cursorrules");if(i.existsSync(z)){let d=i.readFileSync(z,"utf8");(G.test(d)||d.includes(H))&&T.push([".cursorrules",E])}for(let d of T)p("\u2192 "+d[0]+": "+D[ve(a.join(e,d[0]),d[1],r)]);for(let d of u){let w=F[d];if(d==="cursor")p("\u2192 "+w+" MCP (.cursor/mcp.json): "+D[M(a.join(e,".cursor","mcp.json"),r)]);else if(d==="windsurf")p("\u2192 "+w+" MCP (~/.codeium/windsurf/mcp_config.json): "+D[M(a.join(C.homedir(),".codeium","windsurf","mcp_config.json"),r)]);else if(d==="copilot")p("\u2192 "+w+" MCP (~/.copilot/mcp-config.json): "+D[M(a.join(C.homedir(),".copilot","mcp-config.json"),r,{type:"local",tools:["*"]})]);else if(d==="claude"&&c==="project"){let A=M(a.join(e,".mcp.json"),r);p("\u2192 "+w+" MCP (.mcp.json, project scope): "+D[A]),(A==="created"||A==="updated")&&p(" 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(d==="gemini"){let A=[a.join(C.homedir(),".gemini","settings.json"),a.join(e,".gemini","settings.json"),a.join(e,".mcp.json")],b="unchanged";A.forEach(B=>{let _=M(B,r);(_==="created"||_==="updated")&&(b=_)}),p("\u2192 "+w+" MCP (settings.json & .mcp.json): "+D[b])}else if(d==="claude"||d==="codex"||d==="antigravity"){let A=d==="antigravity"?"agy":d,b=Se(A,r,c);b.status==="manual"?p("\u2192 "+w+": '"+A+"' not found or not scriptable. Run manually: "+b.detail):b.status==="planned"?p("\u2192 "+w+" MCP: would run: "+b.detail):b.status==="failed"?y("\u2192 "+w+" MCP: registration failed ("+b.message+"). Run manually: "+b.detail):p("\u2192 "+w+" MCP"+(d==="claude"?" ("+c+" scope)":"")+": "+D[b.status]),b.legacy&&p(" \u26A0\uFE0F An old MCP entry named 'fleetbo' exists. Remove it: "+A+" mcp remove fleetbo")}else d==="devin"&&p("\u2192 "+w+": reads AGENTS.md. Devin runs in its own environment: add the OZmoz MCP server from Devin's settings (not automated).")}!o&&u.length===0&&p("\u2192 No agent detected: instruction files were written; re-run with --agent=<name> to register the MCP server.");let O=!!(U(e).FLEETBO_DEV_TOKEN||process.env.FLEETBO_DEV_TOKEN),S=a.join(C.homedir(),".fleetbo","credentials.json");if(i.existsSync(S))try{O=O||!!JSON.parse(i.readFileSync(S,"utf8")).devToken}catch{}O||y('\u26A0\uFE0F No developer token found. Run "npx ozmoz login" once.'),process.env.FLEETBO_START||p(`
|
|
27
27
|
[OZmoz] Done.
|
|
28
|
-
`)}function Ne(e){let t=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";
|
|
28
|
+
`)}function Ne(e){let t=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";re(`${t} "${e}"`)}function _e(e){return new Promise((t,r)=>{let n=oe.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 c=l.searchParams.get("token"),h=l.searchParams.get("refresh");if(!c){o.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),o.end("<h3>Error: Missing token.</h3>");return}let u=a.join(C.homedir(),".fleetbo");i.existsSync(u)||i.mkdirSync(u,{recursive:!0}),i.writeFileSync(a.join(u,"credentials.json"),JSON.stringify({devToken:c,refreshToken:h||null,updatedAt:new Date().toISOString()},null,2));let f=a.join(e,".env");if(i.existsSync(f)){let m=i.readFileSync(f,"utf8");m.includes("FLEETBO_DEV_TOKEN=")?m=m.replace(/FLEETBO_DEV_TOKEN=.*/g,`FLEETBO_DEV_TOKEN=${c}`):m+=`
|
|
29
29
|
FLEETBO_DEV_TOKEN=${c}
|
|
30
|
-
`,i.writeFileSync(
|
|
30
|
+
`,i.writeFileSync(f,m,"utf8")}o.writeHead(200,{"Content-Type":"text/html; charset=utf-8",Connection:"close"}),o.end(`
|
|
31
31
|
<!DOCTYPE html>
|
|
32
32
|
<html>
|
|
33
33
|
<head>
|
|
@@ -45,23 +45,23 @@ FLEETBO_DEV_TOKEN=${c}
|
|
|
45
45
|
</div>
|
|
46
46
|
</body>
|
|
47
47
|
</html>
|
|
48
|
-
`),
|
|
49
|
-
[OZmoz] Developer token received and stored successfully!`),!process.env.FLEETBO_START&&!["AGENTS.md","CLAUDE.md","GEMINI.md"].some(m=>i.existsSync(a.join(e,m)))&&(
|
|
50
|
-
Next step to connect your AI agents:`),
|
|
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}`;
|
|
52
|
-
[OZmoz] Waiting for authentication...`),
|
|
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,c=>{let
|
|
48
|
+
`),p(`
|
|
49
|
+
[OZmoz] Developer token received and stored successfully!`),!process.env.FLEETBO_START&&!["AGENTS.md","CLAUDE.md","GEMINI.md"].some(m=>i.existsSync(a.join(e,m)))&&(p(`
|
|
50
|
+
Next step to connect your AI agents:`),p(` npx ozmoz mcp (Configure Claude Code, Cursor, Windsurf, Devin, Codex CLI, Gemini CLI, Antigravity CLI, GitHub Copilot)
|
|
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}`;p(`
|
|
52
|
+
[OZmoz] Waiting for authentication...`),p(`If your browser does not open automatically, visit: ${o}`),Ne(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))})}async function Pe(e,t,r){let n=await X();return new Promise((s,o)=>{let l=JSON.stringify({enterpriseID:e,schema:t,workflow:r}),c={hostname:"api.ozmoz.io",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(l),...n?{Authorization:`Bearer ${n}`}:{}}},h=W.request(c,u=>{let f="";u.on("data",m=>{f+=m}),u.on("end",()=>{u.statusCode>=200&&u.statusCode<300?s(JSON.parse(f)):u.statusCode===401||u.statusCode===403?o(new Error('Please sign in first: run "npx ozmoz login".')):o(new Error(`Edge sync failed with HTTP ${u.statusCode}`))})});h.on("error",u=>o(u)),h.write(l),h.end()})}function U(e){let t=a.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,c=>{let h="";c.on("data",u=>{h+=u}),c.on("end",()=>{if(c.statusCode>=200&&c.statusCode<300)try{let u=JSON.parse(h);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 ${c.statusCode} while fetching ${t}`))})});l.on("error",c=>n(c)),l.write(s),l.end()})}var I=process.argv.slice(2),k=I[0],De=["id","_id","userId","author","dateCreated","createdAt","_schema_version"],ne=e=>De.includes(e)||/^_/.test(e)||/^(created|updated|modified|deleted)(At|By)$/i.test(e);function Z(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 je(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=Z(s);o&&Object.keys(o).forEach(l=>{ne(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
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])=>Z(o)&&Object.keys(Z(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 c=Z(l),
|
|
57
|
+
`:(s.forEach(([o,l])=>{let c=Z(l),h=Object.entries(c).filter(([m])=>!ne(m));n+="### `"+o+`\`
|
|
58
58
|
|
|
59
59
|
| Champ | Type | Obligatoire | Valeurs / remarques |
|
|
60
60
|
|---|---|---|---|
|
|
61
|
-
`,
|
|
62
|
-
`});let
|
|
63
|
-
`,
|
|
64
|
-
`}),
|
|
61
|
+
`,h.forEach(([m,g])=>{let v=typeof g=="string"?g:g&&g.type||"any",E=g&&(g.enum||g.values||g.options),T=Array.isArray(E)&&E.length?"parmi : "+E.map(z=>"`"+z+"`").join(", "):"";n+="| `"+m+"` | "+v+" | "+(g&&g.required===!0?"\u2705 oui":"non")+" | "+T+` |
|
|
62
|
+
`});let u=h.filter(([,m])=>m&&m.required===!0),f=h.filter(([,m])=>!(m&&m.required===!0));n+="\nInsertion valide :\n```js\nawait oz.add('"+o+`', {
|
|
63
|
+
`,u.forEach(([m,g])=>{n+=" "+m+": "+Re(g)+`,
|
|
64
|
+
`}),f.length&&(n+=" // optionnels : "+f.map(([m])=>m).join(", ")+`
|
|
65
65
|
`),n+=`}, {
|
|
66
66
|
`,n+=" desc: 'Cr\xE9ation d\\'un \xE9l\xE9ment dans "+o+`',
|
|
67
67
|
`,n+=` role: 'AUTHENTICATED' // ou 'ANONYMOUS', 'ADMIN'
|
|
@@ -626,29 +626,29 @@ ${JSON.stringify({...e||{},context:void 0},null,2)}
|
|
|
626
626
|
\`\`\`json
|
|
627
627
|
${JSON.stringify(t||{},null,2)}
|
|
628
628
|
\`\`\`
|
|
629
|
-
`}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 Ze(e,t){let r=U(e),n=i.existsSync(a.join(e,"svro.schema.json"));(r.OZ_DB_KEY||n)&&(y("Cannot create project: an OZmoz project already exists in this folder."),
|
|
630
|
-
[OZmoz] Project "${s}" (${
|
|
631
|
-
`)}finally{if(i.existsSync(o))try{i.unlinkSync(o)}catch{}}}async function Ue(e){let t=process.env.FLEETBO_DEV_TOKEN;if(!t){let O=a.join(C.homedir(),".fleetbo","credentials.json");if(i.existsSync(O))try{t=JSON.parse(i.readFileSync(O,"utf8")).devToken}catch{}}let n=U(e).OZ_KEY_APP;(!n||!t)&&(y("Cannot update: project uninitialized or dev token missing."),process.exit(1));let s=i.existsSync(a.join(e,"src"))?a.join(e,"src"):e,o=new Set([".jsx",".tsx",".vue",".svelte",".js",".ts",".html"]),l=[],c=0;function
|
|
629
|
+
`}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 Ze(e,t){let r=U(e),n=i.existsSync(a.join(e,"svro.schema.json"));(r.OZ_DB_KEY||n)&&(y("Cannot create project: an OZmoz project already exists in this folder."),p('\u2192 Use "npx ozmoz sync" or evolve the existing contract instead.'),process.exit(1));let s=(t||"").trim();s||(y('Project name is required. Usage: npx ozmoz create "<name>"'),process.exit(1));let o=a.join(e,".ozmoz.lock");if(i.existsSync(o)){let c=!1;try{let h=Number(i.readFileSync(o,"utf8"));Date.now()-h>6e4&&(c=!0)}catch{c=!0}c||(y("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 c=process.env.FLEETBO_DEV_TOKEN;if(!c){let E=a.join(C.homedir(),".fleetbo","credentials.json");if(i.existsSync(E))try{c=JSON.parse(i.readFileSync(E,"utf8")).devToken}catch{}}c||(l(),y('Missing developer token. Please run "npx ozmoz login" first.'),process.exit(1)),p(`[OZmoz] Creating project "${s}" on Cloud...`);let h=Me(s),u=[h,`${h.slice(0,24)}_${Math.random().toString(36).slice(2,6)}`,`${h.slice(0,24)}_${Math.random().toString(36).slice(2,6)}`],f=null,m=null;for(let E of u)try{let T=await fetch("https://createprojectlight-jqycakhlxa-uc.a.run.app",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify({data:{name:s,keyApp:E}})}),z=await T.json();if(T.ok&&!z.error){f={keyApp:E,data:z.result?.data||z.data||{}};break}else m=z.error?.message||`HTTP ${T.status}`}catch(T){m=T.message}f||(l(),y(`Failed to create project on Cloud: ${m||"Unknown error"}`),process.exit(1));let g=f.data.bootstrapToken;await K(e,[`--keyApp=${f.keyApp}`,`--token=${g}`]);let v=a.join(e,"package.json");Y(e,v),await te(e,[]),p(`
|
|
630
|
+
[OZmoz] Project "${s}" (${f.keyApp}) created and configured successfully.`),p(`AI AGENTS: do NOT stop here and do NOT ask the user to restart. Continue NOW in the same turn: scaffold the frontend if missing, run "npx ozmoz sync", read ozmoz_contract.md, write ALL views in trial mode (OZ_PROTOTYPE=true), then start the dev server and ask the user to validate.
|
|
631
|
+
`)}finally{if(i.existsSync(o))try{i.unlinkSync(o)}catch{}}}async function Ue(e){let t=process.env.FLEETBO_DEV_TOKEN;if(!t){let O=a.join(C.homedir(),".fleetbo","credentials.json");if(i.existsSync(O))try{t=JSON.parse(i.readFileSync(O,"utf8")).devToken}catch{}}let n=U(e).OZ_KEY_APP;(!n||!t)&&(y("Cannot update: project uninitialized or dev token missing."),process.exit(1));let s=i.existsSync(a.join(e,"src"))?a.join(e,"src"):e,o=new Set([".jsx",".tsx",".vue",".svelte",".js",".ts",".html"]),l=[],c=0;function h(O){let S=[];try{S=i.readdirSync(O,{withFileTypes:!0})}catch{return}for(let d of S){if(/^(node_modules|\.git|dist|build|\.next|\.svelte-kit)$/.test(d.name))continue;let w=a.join(O,d.name);if(d.isDirectory())h(w);else if(o.has(a.extname(d.name))&&!d.name.endsWith(".d.ts"))try{let A=i.statSync(w);if(A.size>3e5)continue;let b=i.readFileSync(w,"utf8");/oz\.|<oz-/i.test(b)&&(c+=A.size,l.push({name:a.relative(e,w).split(a.sep).join("/"),content:b}))}catch{}}}h(s);let u=I.find(O=>O.startsWith("--files=")),f=u?u.slice(8).split(",").map(O=>O.trim()).filter(Boolean):null;if(f&&f.length>0)for(let O of f){let S=a.resolve(e,O);if(i.existsSync(S)){let d=i.readFileSync(S,"utf8");c+=i.statSync(S).size,l.push({name:a.relative(e,S).split(a.sep).join("/"),content:d})}}else h(s);l.length===0&&(y("Cannot update: no components using oz.* found."),process.exit(1)),c>8*1024*1024&&(y("Payload too large: total UI source files exceed 8 MB limit."),process.exit(1));let m=I.find(O=>O.startsWith("--rules=")),g=m?m.slice(8).trim():"",v=I.find(O=>O.startsWith("--reasoning=")),E=v?v.slice(12).trim().toLowerCase():void 0;E!=="standard"&&E!=="high"&&(y("Missing or invalid --reasoning=<standard|high>."),y("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)),p(`[OZmoz] Sending ${l.length} component(s) to Cloud Engine for modeling...`);try{let O=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:g,reasoning:E}})}),S=await O.json(),d=S.result?.data||S.data||S;if(!O.ok||S.error||d.success===!1){let w=S.error?.message||d.warnings?.join(", ")||S.message||"Server error";y(`Update failed: ${w}`),process.exit(1)}p("\u2192 Cloud modeling response: "+JSON.stringify(S).slice(0,800))}catch(O){y(`Network error: ${O.message}`),process.exit(1)}p("\u2192 Structure modeled. Sealing into OZmoz SVRO Kernel...");let T=N(process.execPath,[__filename,"sync"],{stdio:"inherit",cwd:e}),z=Date.now();for(let O=1;O<=5&&T.status===0;O++){let S=!1;try{let d=JSON.parse(i.readFileSync(a.join(e,"svro.schema.json"),"utf8"));S=Object.keys(d.collections||{}).length>0}catch{}if(S)break;p("\u2192 Contract still empty, waiting for the cloud (attempt "+O+"/5, "+Math.round((Date.now()-z)/1e3)+"s elapsed)..."),await new Promise(d=>setTimeout(d,6e3)),T=N(process.execPath,[__filename,"sync"],{stdio:"inherit",cwd:e})}let R=!1;try{let O=JSON.parse(i.readFileSync(a.join(e,"svro.schema.json"),"utf8"));R=Object.keys(O.collections||{}).length>0}catch{}T.status===0&&R?p(`
|
|
632
632
|
[OZmoz] Contract locked into SVRO Kernel.
|
|
633
633
|
`):T.status===0&&!R?(y(`
|
|
634
634
|
[OZmoz] Sync completed with 0 collections. Rerun with --reasoning=high.
|
|
635
635
|
`),process.exit(1)):(y(`
|
|
636
636
|
[OZmoz] Sync failed. Run "npx ozmoz sync".
|
|
637
|
-
`),process.exit(1))}async function Be(){let e=process.cwd(),t=a.join(e,"package.json");if(k==="init"||k==="doctor")
|
|
638
|
-
[OZmoz] Initializing and configuring OZmoz...`),await K(e,I),Y(e,t),
|
|
637
|
+
`),process.exit(1))}async function Be(){let e=process.cwd(),t=a.join(e,"package.json");if(k==="init"||k==="doctor")p(`
|
|
638
|
+
[OZmoz] Initializing and configuring OZmoz...`),await K(e,I),Y(e,t),p(`
|
|
639
639
|
[OZmoz] Configuration completed successfully!
|
|
640
|
-
`),
|
|
641
|
-
Next step:`),
|
|
642
|
-
`);else if(k==="sync"){let r=I.includes("--dry-run"),n=I.includes("--check-only");
|
|
643
|
-
`),
|
|
644
|
-
`),
|
|
645
|
-
`,"utf8"),
|
|
646
|
-
`,"utf8"),
|
|
647
|
-
`,"utf8"),
|
|
648
|
-
`);return` ${
|
|
640
|
+
`),p(`
|
|
641
|
+
Next step:`),p(` npx ozmoz sync (Sync cloud schema & generate IDE types)
|
|
642
|
+
`);else if(k==="sync"){let r=I.includes("--dry-run"),n=I.includes("--check-only");p(`[OZmoz] Syncing schema...${r?" (dry-run)":""}${n?" (check-only, no network)":""}`),r||de(e);let s=a.join(e,"svro.schema.json"),o=a.join(e,"svro.workflow.json"),l=a.join(e,"ozmoz_contract.md"),c=a.join(e,"src","ozmoz.d.ts"),u=U(e).OZ_ENTERPRISE_ID,f=null,m=null;if(n)p("\u2192 Mode check-only : Local contract used, no cloud fetch..");else if(u)try{p("\u2192 Fetching latest contracts from Cloud..."),f=await J(u,"svro.schema.json"),f&&(i.writeFileSync(s,JSON.stringify(f,null,2)+`
|
|
643
|
+
`),p("\u2192 Local svro.schema.json updated.")),m=await J(u,"svro.workflow.json"),m&&(i.writeFileSync(o,JSON.stringify(m,null,2)+`
|
|
644
|
+
`),p("\u2192 Local svro.workflow.json updated."))}catch(z){y(`\u26A0\uFE0F Cloud fetch bypassed: ${z.message}. Using local file fallback.`)}else y("\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
|
+
`,"utf8"),p("\u2192 Initial blank svro.schema.json created."));let v=m;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"),p("\u2192 Initial blank svro.workflow.json created."));{let z=je(g);z.changed&&(g=z.schema,i.writeFileSync(s,JSON.stringify(g,null,2)+`
|
|
647
|
+
`,"utf8"),p("\u2192 Managed by system, no longer required from your code: "+z.notes.join(", ")+"."))}let{protocol:E}=await Q(),T=Fe(g,v,E);i.writeFileSync(l,T,"utf8"),p("\u2192 Contract markdown successfully generated at project root.");try{let z=Object.keys(g.collections||{});if(u&&!n)try{await Pe(u,g,v),p("\u2192 Schema successfully sealed into SVRO Kernel (O(1)).")}catch(d){y(`\u26A0\uFE0F Kernel Shield sync warning: ${d.message}`)}let R=g.collections||{},O=Object.entries(R).map(([d,w])=>{let A=w.fields||w.schema||{},b=Object.entries(A).map(([B,_])=>{let L="any",P=String(typeof _=="string"?_:_.type||"").toLowerCase();return P==="string"||P==="text"||P==="media"?L="string":P==="number"?L="number":P==="boolean"||P==="toggle"?L="boolean":P==="array"&&(L="any[]"),` ${B}?:${L};`}).join(`
|
|
648
|
+
`);return` ${d}: {
|
|
649
649
|
${b}
|
|
650
650
|
};`}).join(`
|
|
651
|
-
`),
|
|
651
|
+
`),S=z.length>0?z.map(d=>`'${d}'`).join(" | "):"string";if(i.existsSync(a.dirname(c))){let d=`/* eslint-disable */
|
|
652
652
|
/* prettier-ignore */
|
|
653
653
|
// @ts-nocheck
|
|
654
654
|
// Generated by OZmoz \u2014 Updated via sync
|
|
@@ -693,7 +693,7 @@ declare global {
|
|
|
693
693
|
interface ImportMeta {
|
|
694
694
|
readonly env: ImportMetaEnv;
|
|
695
695
|
}
|
|
696
|
-
type KnownOzTables = ${
|
|
696
|
+
type KnownOzTables = ${S};
|
|
697
697
|
type OzTables = KnownOzTables | (string & { _ozPending?: never });
|
|
698
698
|
type OzData<T extends string> = T extends KnownOzTables
|
|
699
699
|
? Partial<OzSchemaMap[T]>
|
|
@@ -796,7 +796,7 @@ declare module 'svelte/elements' {
|
|
|
796
796
|
'oz-reference': OzProp;
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
|
-
`;i.writeFileSync(c,
|
|
799
|
+
`;i.writeFileSync(c,d)}ae(e),ce(e,t),le(e),ue(e),p(` [OZmoz] Schema synced successfully (${z.length} collection(s)).`),r&&p("\u2192 [Dry-run] Schema is valid.")}catch(z){y(`Error during synchronization: ${z.message}`),process.exit(1)}}else if(k==="create"){let r=I.slice(1).filter(n=>!n.startsWith("--")).join(" ");await Ze(e,r),process.exit(0)}else if(k==="update")await Ue(e),process.exit(0);else if(k==="mcp"){let r=I.includes("--run"),n=!1;if(!r&&!process.stdin.isTTY&&(r=await new Promise(s=>{let o=process.stdin,l=null,c=f=>{clearTimeout(l),o.removeListener("data",h),o.removeListener("end",u),o.removeListener("error",u),s(f)},h=f=>{o.pause(),o.unshift(f),n=!0,c(!0)},u=()=>c(!1);l=setTimeout(()=>{o.pause(),c(!1)},1500),o.on("data",h),o.once("end",u),o.once("error",u)})),r){try{await import(`file://${ee()}`),n&&process.stdin.resume()}catch(s){y(`Failed to start MCP server: ${s.message}`),process.exit(1)}return}await te(e,I),process.exit(0)}else k==="login"?(await _e(e),process.exit(0)):k==="start"?xe(e,I):["--help","-h","help"].includes(k)?(p(`OZmoz CLI
|
|
800
800
|
|
|
801
801
|
Commands:
|
|
802
802
|
login Authenticate this machine (opens the browser: approve once, the command exits by itself)
|