fleetbo-svro 1.0.59 → 1.0.61

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var Q=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(s){throw n=0,s}};var V=Q((_e,J)=>{var a=require("fs"),m=require("path"),Z=require("https"),{execSync:ee}=require("child_process"),te="\x1B[38;2;231;233;237m",oe="\x1B[31m",R="\x1B[0m";function T(e){console.log(` ${te}${e}${R}`)}function v(e){console.error(` ${oe}${e}${R}`)}function ne(e){let n={};return e.forEach(s=>{if(s.startsWith("--")){let[o,r]=s.slice(2).split("=");o&&r&&(n[o]=r)}}),n}function k(e,n){try{let s=JSON.parse(a.readFileSync(e,"utf8"));return!!(s.dependencies&&s.dependencies[n]||s.devDependencies&&s.devDependencies[n])}catch{return!1}}function se(e,n){try{return a.existsSync(m.join(e,"node_modules",n,"package.json"))}catch{return!1}}function re(e,n){if(a.existsSync(m.join(e,"pnpm-lock.yaml")))return"pnpm";if(a.existsSync(m.join(e,"yarn.lock")))return"yarn";if(a.existsSync(m.join(e,"bun.lockb")))return"bun";try{let s=JSON.parse(a.readFileSync(n,"utf8"));if(typeof s.packageManager=="string"){if(s.packageManager.startsWith("pnpm"))return"pnpm";if(s.packageManager.startsWith("yarn"))return"yarn";if(s.packageManager.startsWith("bun"))return"bun"}}catch{}return"npm"}function ie(e,n){if(!k(n,"fleetbo-svro")||!se(e,"fleetbo-svro")){let s=re(e,n),o={pnpm:"pnpm add fleetbo-svro",yarn:"yarn add fleetbo-svro",bun:"bun add fleetbo-svro",npm:"npm install fleetbo-svro"}[s];T(`\u2192 Installing fleetbo-svro into the project (detected: ${s})...`);try{ee(o,{cwd:e,stdio:"inherit"}),T("fleetbo-svro installed successfully!")}catch(r){v(`\u26A0\uFE0F Automatic installation failed: ${r.message}`),v(`\u{1F449} Please run '${o}' manually.`)}}}function le(e){let n=m.join(e,"svro.schema.json");if(a.existsSync(n))return;let s=new Date().toISOString(),o={createdAt:s,patchedAt:s,schemaVersion:1,collections:{}};a.writeFileSync(n,JSON.stringify(o,null,2)+`
2
+ var Z=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(s){throw n=0,s}};var J=Z((we,V)=>{var a=require("fs"),m=require("path"),Q=require("https"),{execSync:ee}=require("child_process"),te="\x1B[38;2;231;233;237m",oe="\x1B[31m",R="\x1B[0m";function T(e){console.log(` ${te}${e}${R}`)}function O(e){console.error(` ${oe}${e}${R}`)}function ne(e){let n={};return e.forEach(s=>{if(s.startsWith("--")){let[o,r]=s.slice(2).split("=");o&&r&&(n[o]=r)}}),n}function k(e,n){try{let s=JSON.parse(a.readFileSync(e,"utf8"));return!!(s.dependencies&&s.dependencies[n]||s.devDependencies&&s.devDependencies[n])}catch{return!1}}function se(e,n){try{return a.existsSync(m.join(e,"node_modules",n,"package.json"))}catch{return!1}}function re(e,n){if(a.existsSync(m.join(e,"pnpm-lock.yaml")))return"pnpm";if(a.existsSync(m.join(e,"yarn.lock")))return"yarn";if(a.existsSync(m.join(e,"bun.lockb")))return"bun";try{let s=JSON.parse(a.readFileSync(n,"utf8"));if(typeof s.packageManager=="string"){if(s.packageManager.startsWith("pnpm"))return"pnpm";if(s.packageManager.startsWith("yarn"))return"yarn";if(s.packageManager.startsWith("bun"))return"bun"}}catch{}return"npm"}function ie(e,n){if(!k(n,"fleetbo-svro")||!se(e,"fleetbo-svro")){let s=re(e,n),o={pnpm:"pnpm add fleetbo-svro",yarn:"yarn add fleetbo-svro",bun:"bun add fleetbo-svro",npm:"npm install fleetbo-svro"}[s];T(`\u2192 Installing fleetbo-svro into the project (detected: ${s})...`);try{ee(o,{cwd:e,stdio:"inherit"}),T("fleetbo-svro installed successfully!")}catch(r){O(`\u26A0\uFE0F Automatic installation failed: ${r.message}`),O(`\u{1F449} Please run '${o}' manually.`)}}}function le(e){let n=m.join(e,"svro.schema.json");if(a.existsSync(n))return;let s=new Date().toISOString(),o={createdAt:s,patchedAt:s,schemaVersion:1,collections:{}};a.writeFileSync(n,JSON.stringify(o,null,2)+`
3
3
  `),T("\u2192 Created svro.schema.json at project root.")}function ae(e){let n=m.join(e,".env"),s=`
4
4
  # Fleetbo UI Sandbox Mode
5
5
  # true = Sandbox mode: simulates writes locally for fluid UI testing; no DB access and IDE alert.
@@ -70,13 +70,13 @@ declare global {
70
70
  'fleetbo-reference': FleetboProp;
71
71
  }
72
72
  }
73
- `;try{a.writeFileSync(s,o),T("\u2192 Created src/fleetbo.d.ts stub for instant IDE auto-completion.")}catch(r){v(`\u26A0\uFE0F Unable to create src/fleetbo.d.ts: ${r.message}`)}}function de(e){let n=m.join(e,"index.d.ts");a.existsSync(n)||T("\u2192 Verified index.d.ts presence.")}function pe(e){let n=["tsconfig.json","jsconfig.json"];for(let s of n){let o=m.join(e,s);if(a.existsSync(o)){let r=new Date;a.utimesSync(o,r,r);break}}}function ue(e){return new Promise((n,s)=>{let o=JSON.stringify({token:e}),r={hostname:"bootstrapproject-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(o)}},l=Z.request(r,t=>{let i="";t.on("data",c=>{i+=c}),t.on("end",()=>{if(t.statusCode>=200&&t.statusCode<300)try{n(JSON.parse(i))}catch{s(new Error("Invalid response received from Fleetbo server."))}else try{let c=JSON.parse(i);s(new Error(c.error||`Server error ${t.statusCode}`))}catch{s(new Error(`Server error ${t.statusCode}`))}})});l.on("error",t=>s(t)),l.write(o),l.end()})}async function fe(e,n=[]){let s=m.join(e,".env");if(a.existsSync(s)&&a.readFileSync(s,"utf8").includes("VITE_FLEETBO_DB_KEY")){T("\u2192 Fleetbo environment variables already present in .env \u2014 skipping step.");return}let o=ne(n),r=o.keyApp,l=o.token||o.bootstrapToken,t=o.email||"";(!r||!l)&&(v("\u26A0\uFE0F Missing required parameters."),v("\u{1F449} Usage: npx fleetbo-svro init --keyApp=YOUR_KEY --token=YOUR_TOKEN"),process.exit(1)),T("\u2192 Exchanging bootstrap token for project keys...");let i;try{i=await ue(l)}catch(b){v(`\u26A0\uFE0F Token exchange failed: ${b.message}`),v("\u{1F449} The token may have expired (15 min limit) or was already used. Please regenerate one from the Fleetbo dashboard."),process.exit(1)}(!i.enterpriseId||!i.fleetboDBKey)&&(v("\u26A0\uFE0F Incomplete response from Fleetbo server."),process.exit(1));let c=i.facebookAppId||o.fbAppId||o.facebookAppId||"11967268204758",p=`
73
+ `;try{a.writeFileSync(s,o),T("\u2192 Created src/fleetbo.d.ts stub for instant IDE auto-completion.")}catch(r){O(`\u26A0\uFE0F Unable to create src/fleetbo.d.ts: ${r.message}`)}}function de(e){let n=m.join(e,"index.d.ts");a.existsSync(n)||T("\u2192 Verified index.d.ts presence.")}function pe(e){let n=["tsconfig.json","jsconfig.json"];for(let s of n){let o=m.join(e,s);if(a.existsSync(o)){let r=new Date;a.utimesSync(o,r,r);break}}}function ue(e){return new Promise((n,s)=>{let o=JSON.stringify({token:e}),r={hostname:"bootstrapproject-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(o)}},l=Q.request(r,t=>{let i="";t.on("data",c=>{i+=c}),t.on("end",()=>{if(t.statusCode>=200&&t.statusCode<300)try{n(JSON.parse(i))}catch{s(new Error("Invalid response received from Fleetbo server."))}else try{let c=JSON.parse(i);s(new Error(c.error||`Server error ${t.statusCode}`))}catch{s(new Error(`Server error ${t.statusCode}`))}})});l.on("error",t=>s(t)),l.write(o),l.end()})}async function fe(e,n=[]){let s=m.join(e,".env");if(a.existsSync(s)&&a.readFileSync(s,"utf8").includes("VITE_FLEETBO_DB_KEY")){T("\u2192 Fleetbo environment variables already present in .env \u2014 skipping step.");return}let o=ne(n),r=o.keyApp,l=o.token||o.bootstrapToken,t=o.email||"";(!r||!l)&&(O("\u26A0\uFE0F Missing required parameters."),O("\u{1F449} Usage: npx fleetbo-svro init --keyApp=YOUR_KEY --token=YOUR_TOKEN"),process.exit(1)),T("\u2192 Exchanging bootstrap token for project keys...");let i;try{i=await ue(l)}catch(b){O(`\u26A0\uFE0F Token exchange failed: ${b.message}`),O("\u{1F449} The token may have expired (15 min limit) or was already used. Please regenerate one from the Fleetbo dashboard."),process.exit(1)}(!i.enterpriseId||!i.fleetboDBKey)&&(O("\u26A0\uFE0F Incomplete response from Fleetbo server."),process.exit(1));let c=i.facebookAppId||o.fbAppId||o.facebookAppId||"11967268204758",p=`
74
74
  VITE_FLEETBO_DB_KEY=${i.fleetboDBKey}
75
75
  VITE_FLEETBO_ENTERPRISE_ID=${i.enterpriseId}
76
76
  VITE_FLEETBO_KEY_APP=${r}
77
77
  ${t?`VITE_FLEETBO_TESTER_EMAIL=${t}
78
78
  `:""}VITE_FLEETBO_FACEBOOK_APP_ID=${c}
79
- `;a.appendFileSync(s,p),T(".env file updated successfully with Fleetbo keys!")}function U(e){let n=m.join(e,"svro.d.ts");if(a.existsSync(n))try{a.unlinkSync(n),T("\u2192 Removed legacy svro.d.ts from project root.")}catch{}}function B(e,n){if(process.env.FLEETBO_SKIP_TYPECHECK_SETUP)return;let s=m.join(e,"tsconfig.json"),o=m.join(e,"jsconfig.json"),r=a.existsSync(s)?s:o,l=!a.existsSync(r),t={};if(!l)try{t=JSON.parse(a.readFileSync(r,"utf8"))}catch{v(`\u26A0\uFE0F Unable to read ${m.basename(r)} (Invalid JSON).`);return}t.compilerOptions=t.compilerOptions||{};let i=!1,c=k(n,"react");l?(t.compilerOptions.checkJs=!0,t.compilerOptions.allowJs=!0,t.compilerOptions.target=t.compilerOptions.target||"ES2020",t.compilerOptions.module=t.compilerOptions.module||"ESNext",t.compilerOptions.moduleResolution=t.compilerOptions.moduleResolution||"bundler",t.include=["src/**/*"],i=!0):(t.compilerOptions.checkJs===void 0&&(t.compilerOptions.checkJs=!0,i=!0),t.compilerOptions.allowJs===void 0&&(t.compilerOptions.allowJs=!0,i=!0)),c&&t.compilerOptions.jsx===void 0&&(t.compilerOptions.jsx="react-jsx",i=!0),Array.isArray(t.compilerOptions.types)&&t.compilerOptions.types.includes("vite/client")&&(t.compilerOptions.types=t.compilerOptions.types.filter(p=>p!=="vite/client"),t.compilerOptions.types.length===0&&delete t.compilerOptions.types,i=!0,T(`\u2192 Removed legacy "vite/client" entry from ${m.basename(r)}.`)),i&&(a.writeFileSync(r,JSON.stringify(t,null,2)+`
79
+ `;a.appendFileSync(s,p),T(".env file updated successfully with Fleetbo keys!")}function U(e){let n=m.join(e,"svro.d.ts");if(a.existsSync(n))try{a.unlinkSync(n),T("\u2192 Removed legacy svro.d.ts from project root.")}catch{}}function B(e,n){if(process.env.FLEETBO_SKIP_TYPECHECK_SETUP)return;let s=m.join(e,"tsconfig.json"),o=m.join(e,"jsconfig.json"),r=a.existsSync(s)?s:o,l=!a.existsSync(r),t={};if(!l)try{t=JSON.parse(a.readFileSync(r,"utf8"))}catch{O(`\u26A0\uFE0F Unable to read ${m.basename(r)} (Invalid JSON).`);return}t.compilerOptions=t.compilerOptions||{};let i=!1,c=k(n,"react");l?(t.compilerOptions.checkJs=!0,t.compilerOptions.allowJs=!0,t.compilerOptions.target=t.compilerOptions.target||"ES2020",t.compilerOptions.module=t.compilerOptions.module||"ESNext",t.compilerOptions.moduleResolution=t.compilerOptions.moduleResolution||"bundler",t.include=["src/**/*"],i=!0):(t.compilerOptions.checkJs===void 0&&(t.compilerOptions.checkJs=!0,i=!0),t.compilerOptions.allowJs===void 0&&(t.compilerOptions.allowJs=!0,i=!0)),c&&t.compilerOptions.jsx===void 0&&(t.compilerOptions.jsx="react-jsx",i=!0),Array.isArray(t.compilerOptions.types)&&t.compilerOptions.types.includes("vite/client")&&(t.compilerOptions.types=t.compilerOptions.types.filter(p=>p!=="vite/client"),t.compilerOptions.types.length===0&&delete t.compilerOptions.types,i=!0,T(`\u2192 Removed legacy "vite/client" entry from ${m.basename(r)}.`)),i&&(a.writeFileSync(r,JSON.stringify(t,null,2)+`
80
80
  `),T(`\u2192 Updated ${m.basename(r)}.`))}function M(e){let n=["src/app/layout.tsx","src/app/layout.jsx","app/layout.tsx","app/layout.jsx","src/pages/_app.tsx","src/pages/_app.jsx","pages/_app.tsx","pages/_app.jsx","src/main.tsx","src/main.jsx","src/main.ts","src/main.js","src/index.tsx","src/index.jsx","src/index.ts","src/index.js","src/App.tsx","src/App.jsx","src/App.vue","app.vue","src/routes/+layout.svelte","src/routes/+layout.ts","src/main.singletons.ts"];for(let s of n){let o=m.join(e,s);if(a.existsSync(o)){let r=a.readFileSync(o,"utf8");r.includes("fleetbo-svro")||(r.startsWith('"use client"')||r.startsWith("'use client'")?r=r.replace(/(['"]use client['"];?\r?\n)/,`$1import 'fleetbo-svro';
81
81
  `):r=`import 'fleetbo-svro';
82
82
  `+r,a.writeFileSync(o,r));return}}}function $(e,n){if(process.env.FLEETBO_SKIP_AUTOIMPORT_SETUP)return;let o=["vite.config.ts","vite.config.js","vite.config.mjs"].map(c=>m.join(e,c)).find(c=>a.existsSync(c));if(!o)return;let r;try{r=a.readFileSync(o,"utf8")}catch{return}let l="fleetbo-svro",t=r,i=`{
@@ -139,12 +139,17 @@ ${t?`VITE_FLEETBO_TESTER_EMAIL=${t}
139
139
  `;if(f){let h=f.index+f[0].length;t=t.slice(0,h)+`
140
140
  `+g+t.slice(h)}else t=g+t}}}if(!t.includes("fleetbo-auto-runtime")){let c=t.match(/plugins\s*:\s*\[/);if(c){let p=c.index+c[0].length;t=t.slice(0,p)+`
141
141
  `+i+t.slice(p)}}t!==r&&a.writeFileSync(o,t)}function be(e){let n=m.join(e,".vscode"),s=m.join(n,"settings.json");try{a.existsSync(n)||a.mkdirSync(n,{recursive:!0});let o={};if(a.existsSync(s))try{o=JSON.parse(a.readFileSync(s,"utf8"))}catch{o={}}o["workbench.colorCustomizations"]=o["workbench.colorCustomizations"]||{},o["workbench.colorCustomizations"]["editorInfo.foreground"]="#00feae",o["workbench.colorCustomizations"]["editorHint.foreground"]="#00feae",a.writeFileSync(s,JSON.stringify(o,null,2)+`
142
- `),T("\u2192 Configured Fleetbo Cyan visual hints in .vscode/settings.json.")}catch{}}function me(e,n,s={}){let{skipSelfInstall:o=!1}=s,r=m.join(__dirname,"..");o||ie(e,n),le(e),ae(e),de(r),ce(e),be(e),U(e),B(e,n),$(e,n),M(e)}J.exports={touchTsConfig:pe,log:T,logError:v,handleAuthAndEnv:fe,detectDependency:k,cleanupLegacyRootDts:U,patchJsOrTsConfig:B,attemptViteAutoImportPatch:$,injectUniversalRuntime:M,runFullSetup:me}});var d=require("fs"),y=require("path"),H=require("https"),ge=require("http"),N=require("os"),{exec:Fe}=require("child_process"),{runFullSetup:ye,handleAuthAndEnv:he,touchTsConfig:Ee,attemptViteAutoImportPatch:Te,injectUniversalRuntime:Se}=V(),ve="\x1B[34m",Oe="\x1B[31m",W="\x1B[0m";function u(e){console.log(`${ve}${e}${W}`)}function O(e){console.error(`${Oe}${e}${W}`)}function Pe(e){let n=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";Fe(`${n} "${e}"`)}function xe(e){return new Promise((n,s)=>{let o=ge.createServer((r,l)=>{if(l.setHeader("Access-Control-Allow-Origin","*"),l.setHeader("Access-Control-Allow-Methods","GET, OPTIONS"),l.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization"),l.setHeader("Access-Control-Allow-Private-Network","true"),r.method==="OPTIONS"){l.writeHead(204),l.end();return}let t=new URL(r.url,"http://127.0.0.1");if(t.pathname==="/callback"){let i=t.searchParams.get("token");if(!i){l.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),l.end("<h3>Error: Missing token.</h3>");return}let c=y.join(N.homedir(),".fleetbo");d.existsSync(c)||d.mkdirSync(c,{recursive:!0}),d.writeFileSync(y.join(c,"credentials.json"),JSON.stringify({devToken:i,updatedAt:new Date().toISOString()},null,2));let p=y.join(e,".env");if(d.existsSync(p)){let b=d.readFileSync(p,"utf8");b.includes("FLEETBO_DEV_TOKEN=")?b=b.replace(/FLEETBO_DEV_TOKEN=.*/g,`FLEETBO_DEV_TOKEN=${i}`):b+=`
142
+ `),T("\u2192 Configured Fleetbo Cyan visual hints in .vscode/settings.json.")}catch{}}function me(e,n,s={}){let{skipSelfInstall:o=!1}=s,r=m.join(__dirname,"..");o||ie(e,n),le(e),ae(e),de(r),ce(e),be(e),U(e),B(e,n),$(e,n),M(e)}V.exports={touchTsConfig:pe,log:T,logError:O,handleAuthAndEnv:fe,detectDependency:k,cleanupLegacyRootDts:U,patchJsOrTsConfig:B,attemptViteAutoImportPatch:$,injectUniversalRuntime:M,runFullSetup:me}});var d=require("fs"),E=require("path"),H=require("https"),ge=require("http"),N=require("os"),{exec:Fe}=require("child_process"),{runFullSetup:Ee,handleAuthAndEnv:he,touchTsConfig:ye,attemptViteAutoImportPatch:Te,injectUniversalRuntime:ve}=J(),Oe="\x1B[34m",Pe="\x1B[31m",Y="\x1B[0m";function u(e){console.log(`${Oe}${e}${Y}`)}function P(e){console.error(`${Pe}${e}${Y}`)}function Se(e){let n=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";Fe(`${n} "${e}"`)}function xe(e){return new Promise((n,s)=>{let o=ge.createServer((r,l)=>{if(l.setHeader("Access-Control-Allow-Origin","*"),l.setHeader("Access-Control-Allow-Methods","GET, OPTIONS"),l.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization"),l.setHeader("Access-Control-Allow-Private-Network","true"),r.method==="OPTIONS"){l.writeHead(204),l.end();return}let t=new URL(r.url,"http://127.0.0.1");if(t.pathname==="/callback"){let i=t.searchParams.get("token");if(!i){l.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),l.end("<h3>Error: Missing token.</h3>");return}let c=E.join(N.homedir(),".fleetbo");d.existsSync(c)||d.mkdirSync(c,{recursive:!0}),d.writeFileSync(E.join(c,"credentials.json"),JSON.stringify({devToken:i,updatedAt:new Date().toISOString()},null,2));let p=E.join(e,".env");if(d.existsSync(p)){let b=d.readFileSync(p,"utf8");b.includes("FLEETBO_DEV_TOKEN=")?b=b.replace(/FLEETBO_DEV_TOKEN=.*/g,`FLEETBO_DEV_TOKEN=${i}`):b+=`
143
143
  FLEETBO_DEV_TOKEN=${i}
144
144
  `,d.writeFileSync(p,b,"utf8")}l.writeHead(200,{"Content-Type":"text/html; charset=utf-8",Connection:"close"}),l.end(`
145
145
  <!DOCTYPE html>
146
146
  <html>
147
- <head><meta charset="utf-8"><title>Fleetbo CLI</title></head>
147
+ <head>
148
+ <meta name="color-scheme" content="light">
149
+ <style>
150
+ :root { color-scheme: light; }
151
+ </style>
152
+ </head>
148
153
  <body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #F8FAFC; color: #0F172A; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0;">
149
154
  <div style="text-align: center; padding: 40px; border: 2px solid #E2E8F0; border-radius: 16px; background: #FFFFFF; max-width: 400px; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);">
150
155
  <div style="width: 48px; height: 48px; border-radius: 50%; background: #EAFBF8; color: #0F9C8C; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 16px;">\u2713</div>
@@ -158,20 +163,37 @@ FLEETBO_DEV_TOKEN=${i}
158
163
  [Fleetbo] Developer token received and stored successfully!`),u(`
159
164
  Next step to connect your AI agents:`),u(` npx fleetbo-svro mcp (Configure Cursor, Windsurf, Claude Code, etc.)
160
165
  `),typeof o.closeAllConnections=="function"&&o.closeAllConnections(),o.close(()=>n()),setTimeout(()=>n(),300)}});o.listen(0,"127.0.0.1",()=>{let l=`https://fleetbo.io/cli-auth?port=${o.address().port}`;u(`
161
- [Fleetbo] Waiting for authentication...`),u(`If your browser does not open automatically, visit: ${l}`),Pe(l);let t=Number(process.env.FLEETBO_LOGIN_TIMEOUT_MS)||12e4;setTimeout(()=>{try{typeof o.closeAllConnections=="function"&&o.closeAllConnections()}catch{}o.close(),s(new Error(`Login timed out after ${Math.round(t/1e3)}s: browser approval not received. Run "npx fleetbo-svro login" once more and approve in the browser.`))},t).unref()}),o.on("error",r=>s(r))})}function Ie(e,n){return new Promise((s,o)=>{let r=JSON.stringify({enterpriseID:e,schema:n}),l={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},t=H.request(l,i=>{let c="";i.on("data",p=>{c+=p}),i.on("end",()=>{i.statusCode>=200&&i.statusCode<300?s(JSON.parse(c)):o(new Error(`Edge sync failed with HTTP ${i.statusCode}`))})});t.on("error",i=>o(i)),t.write(r),t.end()})}function K(e){let n=y.join(e,".env");if(!d.existsSync(n))return{};let s=d.readFileSync(n,"utf8"),o={};return s.split(`
162
- `).forEach(r=>{let[l,...t]=r.split("=");l&&t.length>0&&(o[l.trim()]=t.join("=").trim())}),o}function q(e,n){return new Promise((s,o)=>{let r=JSON.stringify({projectId:e,moduleName:n}),l={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},t=H.request(l,i=>{let c="";i.on("data",p=>{c+=p}),i.on("end",()=>{if(i.statusCode>=200&&i.statusCode<300)try{let p=JSON.parse(c);if(p.success&&p.found&&p.module){let b=p.module.code||p.module.mockCode;s(typeof b=="string"?JSON.parse(b):b)}else s(null)}catch{o(new Error(`Invalid JSON response for ${n}.`))}else o(new Error(`Server error ${i.statusCode} while fetching ${n}`))})});t.on("error",i=>o(i)),t.write(r),t.end()})}var w=process.argv.slice(2),I=w[0];function Ae(e,n){return`# LE CONTRAT DE DONN\xC9ES FLEETBO (FLEETBO DATA CONTRACT)
166
+ [Fleetbo] Waiting for authentication...`),u(`If your browser does not open automatically, visit: ${l}`),Se(l);let t=Number(process.env.FLEETBO_LOGIN_TIMEOUT_MS)||12e4;setTimeout(()=>{try{typeof o.closeAllConnections=="function"&&o.closeAllConnections()}catch{}o.close(),s(new Error(`Login timed out after ${Math.round(t/1e3)}s: browser approval not received. Run "npx fleetbo-svro login" once more and approve in the browser.`))},t).unref()}),o.on("error",r=>s(r))})}function Ie(e,n){return new Promise((s,o)=>{let r=JSON.stringify({enterpriseID:e,schema:n}),l={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},t=H.request(l,i=>{let c="";i.on("data",p=>{c+=p}),i.on("end",()=>{i.statusCode>=200&&i.statusCode<300?s(JSON.parse(c)):o(new Error(`Edge sync failed with HTTP ${i.statusCode}`))})});t.on("error",i=>o(i)),t.write(r),t.end()})}function q(e){let n=E.join(e,".env");if(!d.existsSync(n))return{};let s=d.readFileSync(n,"utf8"),o={};return s.split(`
167
+ `).forEach(r=>{let[l,...t]=r.split("=");l&&t.length>0&&(o[l.trim()]=t.join("=").trim())}),o}function K(e,n){return new Promise((s,o)=>{let r=JSON.stringify({projectId:e,moduleName:n}),l={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},t=H.request(l,i=>{let c="";i.on("data",p=>{c+=p}),i.on("end",()=>{if(i.statusCode>=200&&i.statusCode<300)try{let p=JSON.parse(c);if(p.success&&p.found&&p.module){let b=p.module.code||p.module.mockCode;s(typeof b=="string"?JSON.parse(b):b)}else s(null)}catch{o(new Error(`Invalid JSON response for ${n}.`))}else o(new Error(`Server error ${i.statusCode} while fetching ${n}`))})});t.on("error",i=>o(i)),t.write(r),t.end()})}var _=process.argv.slice(2),I=_[0];function Ae(e,n){return`# LE CONTRAT DE DONN\xC9ES FLEETBO (FLEETBO DATA CONTRACT)
163
168
 
164
169
  Ce document constitue le **Cahier des charges officiel et le Contrat bilat\xE9ral d'int\xE9grit\xE9** liant le code client (d\xE9veloppeur ou agent IA) et le moteur Data OS Fleetbo SVRO.
165
170
 
166
171
  ### Pourquoi parlons-nous de \xAB Contrat \xBB ?
167
172
  * **Une v\xE9rit\xE9 unique et scell\xE9e** : Ce contrat d\xE9finit l'int\xE9gralit\xE9 des r\xE8gles m\xE9tier, des types stricts, des permissions ReBAC et des machines \xE0 \xE9tats de l'application.
168
- * **Un bouclier d'int\xE9grit\xE9 d\xE9terministe** : Tout appel front-end (\xE9criture, mutation, transition) non conforme \xE0 ce contrat est rejet\xE9 imm\xE9diatement \xE0 l'Edge (HTTP 422) avant d'atteindre la base.
173
+ * **Un bouclier d'int\xE9grit\xE9 d\xE9terministe** : Tout appel front-end (\xE9criture, mutation, transition) non conforme \xE0 ce contrat est rejet\xE9 imm\xE9diatement \xE0 l'Edge (HTTP 422) avant d'atteindre la base **en mode production** (\`VITE_FLEETBO_PROTOTYPE=false\`) ; en mode prototype, l'Edge est tol\xE9rant et simule (voir \xAB Mode d'ex\xE9cution \xBB).
169
174
  * **Un accord d'ex\xE9cution bilat\xE9ral** :
170
175
  1. **L'Agent / Le D\xE9veloppeur** s'engage \xE0 n'envoyer que des structures pr\xE9vues, sans inventer de routes interm\xE9diaires ni contourner le sch\xE9ma.
171
176
  2. **Fleetbo Engine** s'engage \xE0 assurer la persistance, le stockage m\xE9dia, la synchronisation d\xE9terministe et le typage TypeScript natif sans n\xE9cessiter de backend d'API.
172
177
 
173
178
  ---
174
179
 
180
+ ### \u{1F7E2} L'INTERRUPTEUR MA\xCETRE : VITE_FLEETBO_PROTOTYPE (ZERO-REWRITE PATTERN)
181
+
182
+ L'agent DOIT adapter son impl\xE9mentation selon la valeur de \`VITE_FLEETBO_PROTOTYPE\` dans le fichier \`.env\` :
183
+
184
+ #### 1. Si VITE_FLEETBO_PROTOTYPE=true (MODE PROTOTYPE & VALIDATION UX)
185
+ * **Mode bac \xE0 sable visuel :** Tu con\xE7ois et valides l'ergonomie de l'interface. L'Edge simule, tol\xE8re et acquitte les mutations en m\xE9moire vive sans alt\xE9rer la base physique.
186
+ * **Pr\xE9-c\xE2blage direct (Zero-Rewrite) :** N'attends pas que le sch\xE9ma BDD soit forg\xE9 pour coder. Branche imm\xE9diatement les m\xE9thodes globales (\`Fleetbo.getDocsG\`, \`Fleetbo.add\`, \`Fleetbo.update\`, etc.) et les balises \`<fleetbo-*>\`.
187
+ * **Donn\xE9es virtuelles & Fallbacks autoris\xE9s :** Utilise des jeux de donn\xE9es fictifs en \xE9tat local (variables r\xE9actives du framework utilis\xE9, attributs \`fallback="..."\`) pour alimenter les vues au chargement et tester les sc\xE9narios r\xE9els.
188
+ * **Tol\xE9rance Edge :** Aucun appel front-end n'est bloqu\xE9. D\xE8s que les flux d'\xE9crans sont valid\xE9s, transmets tes fichiers de vues \xE0 Alex AI via \`fleetbo_update_project\` pour figer le sch\xE9ma r\xE9el.
189
+
190
+ #### 2. Si VITE_FLEETBO_PROTOTYPE=false (MODE PRODUCTION VERROUILL\xC9)
191
+ * **Verrouillage Edge actif :** Le Gatekeeper Cloudflare filtre et valide physiquement chaque payload \xE0 l'entr\xE9e.
192
+ * **Tol\xE9rance z\xE9ro (HTTP 422) :** Tout champ non scell\xE9 dans \`svro.schema.json\` ou non conforme \xE0 \`svro.workflow.json\` est rejet\xE9 avant MongoDB.
193
+ * **Z\xE9ro r\xE9\xE9criture de code :** Gr\xE2ce au pr\xE9-c\xE2blage fait en mode prototype, la base physique prend le relais de mani\xE8re transparente sans modifier une seule ligne de code front-end.
194
+
195
+ ---
196
+
175
197
  ### \u{1F6A8} DIRECTIVE D'EX\xC9CUTION OBLIGATOIRE POUR L'AGENT IA
176
198
  1. **Interdiction d'extrapolation** : Ne cr\xE9e aucun champ, type ou endpoint non d\xE9clar\xE9 explicitement dans les contrats scell\xE9s ci-dessous.
177
199
  2. **Refus de contournement** : Si un composant n\xE9cessite une donn\xE9e absente du contrat, n'\xE9cris aucun code palliatif : fais \xE9voluer le contrat (voir \xAB Faire \xE9voluer le contrat \xBB ci-dessous).
@@ -206,7 +228,7 @@ Ton r\xF4le est de guider le d\xE9veloppeur ou l'utilisateur et de concevoir des
206
228
  - Si l'interface utilisateur requiert une nouvelle donn\xE9e, un changement de type, une relation suppl\xE9mentaire ou une r\xE8gle de calcul modifi\xE9e :
207
229
  \u{1F449} INTERDICTION FORMELLE d'\xE9crire ou de simuler un contournement c\xF4t\xE9 code client.
208
230
  \u{1F449} Avec le MCP Fleetbo : appelle imm\xE9diatement l'outil \`fleetbo_update_project \`, puis \`npx fleetbo-svro sync \`. Ne demande JAMAIS \xE0 l'utilisateur de se rendre dans Fleetbo Studio quand le serveur MCP est actif.
209
- \u{1F449} Sans MCP : l'agent frontend DOIT IMM\xC9DIATEMENT interrompre son travail et fournir au d\xE9veloppeur le prompt exact \xE0 soumettre \xE0 Alex AI dans Fleetbo Studio.
231
+ \u{1F449} Sans MCP : l'agent frontend DOIT IMM\xC9DIATEMENT interrompre son travail et fournir au d\xE9veloppeur le prompt exact \xE0 soumettre \xE0 Alex AI dans Fleetbo Studio.
210
232
 
211
233
  3. S\xC9PARATION STRICTE DES RESPONSABILIT\xC9S :
212
234
  - Agent Frontend : g\xE8re exclusivement l'ergonomie, les composants d'affichage et l'UX.
@@ -246,20 +268,20 @@ ${JSON.stringify(e||{},null,2)}
246
268
  \`\`\`json
247
269
  ${JSON.stringify(n||{},null,2)}
248
270
  \`\`\`
249
- `}async function Ce(){let e=process.cwd(),n=y.join(e,"package.json");if(I==="init"||I==="doctor")u(`
250
- [Fleetbo] Initializing and configuring Fleetbo...`),await he(e,w),ye(e,n),u(`
271
+ `}async function Ce(){let e=process.cwd(),n=E.join(e,"package.json");if(I==="init"||I==="doctor")u(`
272
+ [Fleetbo] Initializing and configuring Fleetbo...`),await he(e,_),Ee(e,n),u(`
251
273
  [Fleetbo] Configuration completed successfully!
252
274
  `),u(`
253
275
  Next step:`),u(` npx fleetbo-svro sync (Sync cloud schema & generate IDE types)
254
- `);else if(I==="sync"){let s=w.includes("--dry-run");u(`[Fleetbo] Syncing schema...${s?" (dry-run)":""}`);let o=y.join(e,"svro.schema.json"),r=y.join(e,"svro.workflow.json"),l=y.join(e,"Fleetbo_contract.md"),t=y.join(__dirname,".."),i=y.join(t,"index.d.ts"),c=y.join(e,"src","fleetbo.d.ts"),b=K(e).VITE_FLEETBO_ENTERPRISE_ID,f=null,g=null;if(b)try{u("\u2192 Fetching latest contracts from Fleetbo Cloud..."),f=await q(b,"svro.schema.json"),f&&(d.writeFileSync(o,JSON.stringify(f,null,2)+`
255
- `),u("\u2192 Local svro.schema.json updated.")),g=await q(b,"svro.workflow.json"),g&&(d.writeFileSync(r,JSON.stringify(g,null,2)+`
256
- `),u("\u2192 Local svro.workflow.json updated."))}catch(F){O(`\u26A0\uFE0F Cloud fetch bypassed: ${F.message}. Using local file fallback.`)}else O("\u26A0\uFE0F VITE_FLEETBO_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");let h=f;if(!h&&d.existsSync(o))try{h=JSON.parse(d.readFileSync(o,"utf8"))}catch{}h||(h={context:"Application en cours de mod\xE9lisation initiale.",collections:{}},d.writeFileSync(o,JSON.stringify(h,null,2)+`
257
- `,"utf8"),u("\u2192 Initial blank svro.schema.json created."));let E=g;if(!E&&d.existsSync(r))try{E=JSON.parse(d.readFileSync(r,"utf8"))}catch{}E||(E={actors:{},sequences:[]},d.writeFileSync(r,JSON.stringify(E,null,2)+`
258
- `,"utf8"),u("\u2192 Initial blank svro.workflow.json created."));let S=Ae(h,E);d.writeFileSync(l,S,"utf8"),u("\u2192 Fleetbo_contract.md successfully generated at project root.");try{let F=Object.keys(h.collections||{});if(b)try{await Ie(b,h),u("\u2192 Schema successfully sealed at Fleetbo Global Edge (O(1)).")}catch(P){O(`\u26A0\uFE0F Fleetbo Edge Shield sync warning: ${P.message}`)}let A=h.collections||{},j=Object.entries(A).map(([P,L])=>{let G=L.fields||L.schema||{},X=Object.entries(G).map(([z,_])=>{let C="any",x=String(typeof _=="string"?_:_.type||"").toLowerCase();return x==="string"||x==="text"||x==="media"?C="string":x==="number"?C="number":x==="boolean"||x==="toggle"?C="boolean":x==="array"&&(C="any[]"),` ${z}?:${C};`}).join(`
259
- `);return` ${P}: {
276
+ `);else if(I==="sync"){let s=_.includes("--dry-run");u(`[Fleetbo] Syncing schema...${s?" (dry-run)":""}`);let o=E.join(e,"svro.schema.json"),r=E.join(e,"svro.workflow.json"),l=E.join(e,"Fleetbo_contract.md"),t=E.join(__dirname,".."),i=E.join(t,"index.d.ts"),c=E.join(e,"src","fleetbo.d.ts"),b=q(e).VITE_FLEETBO_ENTERPRISE_ID,f=null,g=null;if(b)try{u("\u2192 Fetching latest contracts from Fleetbo Cloud..."),f=await K(b,"svro.schema.json"),f&&(d.writeFileSync(o,JSON.stringify(f,null,2)+`
277
+ `),u("\u2192 Local svro.schema.json updated.")),g=await K(b,"svro.workflow.json"),g&&(d.writeFileSync(r,JSON.stringify(g,null,2)+`
278
+ `),u("\u2192 Local svro.workflow.json updated."))}catch(F){P(`\u26A0\uFE0F Cloud fetch bypassed: ${F.message}. Using local file fallback.`)}else P("\u26A0\uFE0F VITE_FLEETBO_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");let h=f;if(!h&&d.existsSync(o))try{h=JSON.parse(d.readFileSync(o,"utf8"))}catch{}h||(h={context:"Application en cours de mod\xE9lisation initiale.",collections:{}},d.writeFileSync(o,JSON.stringify(h,null,2)+`
279
+ `,"utf8"),u("\u2192 Initial blank svro.schema.json created."));let y=g;if(!y&&d.existsSync(r))try{y=JSON.parse(d.readFileSync(r,"utf8"))}catch{}y||(y={actors:{},sequences:[]},d.writeFileSync(r,JSON.stringify(y,null,2)+`
280
+ `,"utf8"),u("\u2192 Initial blank svro.workflow.json created."));let v=Ae(h,y);d.writeFileSync(l,v,"utf8"),u("\u2192 Fleetbo_contract.md successfully generated at project root.");try{let F=Object.keys(h.collections||{});if(b)try{await Ie(b,h),u("\u2192 Schema successfully sealed at Fleetbo Global Edge (O(1)).")}catch(S){P(`\u26A0\uFE0F Fleetbo Edge Shield sync warning: ${S.message}`)}let A=h.collections||{},j=Object.entries(A).map(([S,L])=>{let G=L.fields||L.schema||{},X=Object.entries(G).map(([z,w])=>{let C="any",x=String(typeof w=="string"?w:w.type||"").toLowerCase();return x==="string"||x==="text"||x==="media"?C="string":x==="number"?C="number":x==="boolean"||x==="toggle"?C="boolean":x==="array"&&(C="any[]"),` ${z}?:${C};`}).join(`
281
+ `);return` ${S}: {
260
282
  ${X}
261
283
  };`}).join(`
262
- `),D=F.length>0?F.map(P=>`'${P}'`).join(" | "):"string",Y=`// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
284
+ `),D=F.length>0?F.map(S=>`'${S}'`).join(" | "):"string",W=`// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
263
285
 
264
286
  export interface FleetboSchemaMap {
265
287
  ${j}
@@ -522,7 +544,7 @@ declare module 'svelte/elements' {
522
544
  'fleetbo-reference': FleetboProp;
523
545
  }
524
546
  }
525
- `;if(d.writeFileSync(i,Y),d.existsSync(y.dirname(c))){let P=`/* eslint-disable */
547
+ `;if(d.writeFileSync(i,W),d.existsSync(E.dirname(c))){let S=`/* eslint-disable */
526
548
  /* prettier-ignore */
527
549
  // @ts-nocheck
528
550
  // Generated by fleetbo-svro \u2014 Updated via fleetbo sync
@@ -656,11 +678,11 @@ declare module 'svelte/elements' {
656
678
  'fleetbo-reference': FleetboProp;
657
679
  }
658
680
  }
659
- `;d.writeFileSync(c,P)}Ee(e),Te(e,n),Se(e),u(`[Fleetbo] Schema synced successfully (${F.length} collection(s)).`),s&&u("\u2192 [Dry-run] Schema is valid.")}catch(F){O(`Error during synchronization: ${F.message}`),process.exit(1)}}else if(I==="mcp"){let s=w.includes("--run"),o=!1;if(!s&&!process.stdin.isTTY&&(s=await new Promise(f=>{let g=process.stdin,h=null,E=A=>{clearTimeout(h),g.removeListener("data",S),g.removeListener("end",F),g.removeListener("error",F),f(A)},S=A=>{g.pause(),g.unshift(A),o=!0,E(!0)},F=()=>E(!1);h=setTimeout(()=>{g.pause(),E(!1)},1500),g.on("data",S),g.once("end",F),g.once("error",F)})),s){try{await import(`file://${y.join(__dirname,"fleetbo-mcp.js")}`),o&&process.stdin.resume()}catch(f){O(`Failed to start MCP server: ${f.message}`),process.exit(1)}return}u(`
660
- [Fleetbo] Configuring MCP server for your environment...`);let l=K(e).FLEETBO_DEV_TOKEN||process.env.FLEETBO_DEV_TOKEN||"";if(!l){let f=y.join(N.homedir(),".fleetbo","credentials.json");if(d.existsSync(f))try{l=JSON.parse(d.readFileSync(f,"utf8")).devToken||""}catch{}}let t={command:"npx",args:["-y","fleetbo-svro","mcp","--run"],env:{FLEETBO_DEV_TOKEN:l}},i=(f,g,h)=>{let E=y.dirname(f);d.existsSync(E)||d.mkdirSync(E,{recursive:!0});let S={mcpServers:{}};if(d.existsSync(f))try{let F=JSON.parse(d.readFileSync(f,"utf8"));F&&typeof F=="object"&&!Array.isArray(F)&&(S=F)}catch{}S.mcpServers=S.mcpServers||{},S.mcpServers[g]=h,d.writeFileSync(f,JSON.stringify(S,null,2)+`
661
- `)},c=y.join(e,".cursor"),p=y.join(c,"mcp.json");i(p,"fleetbo-svro",t),u("\u2192 Configured for Cursor (.cursor/mcp.json)");let b=y.join(N.homedir(),".codeium","windsurf","mcp_config.json");if(d.existsSync(y.dirname(b))&&(i(b,"fleetbo-svro",t),u("\u2192 Configured for Windsurf (~/.codeium/windsurf/mcp_config.json)")),u(`
681
+ `;d.writeFileSync(c,S)}ye(e),Te(e,n),ve(e),u(`[Fleetbo] Schema synced successfully (${F.length} collection(s)).`),s&&u("\u2192 [Dry-run] Schema is valid.")}catch(F){P(`Error during synchronization: ${F.message}`),process.exit(1)}}else if(I==="mcp"){let s=_.includes("--run"),o=!1;if(!s&&!process.stdin.isTTY&&(s=await new Promise(f=>{let g=process.stdin,h=null,y=A=>{clearTimeout(h),g.removeListener("data",v),g.removeListener("end",F),g.removeListener("error",F),f(A)},v=A=>{g.pause(),g.unshift(A),o=!0,y(!0)},F=()=>y(!1);h=setTimeout(()=>{g.pause(),y(!1)},1500),g.on("data",v),g.once("end",F),g.once("error",F)})),s){try{await import(`file://${E.join(__dirname,"fleetbo-mcp.js")}`),o&&process.stdin.resume()}catch(f){P(`Failed to start MCP server: ${f.message}`),process.exit(1)}return}u(`
682
+ [Fleetbo] Configuring MCP server for your environment...`);let l=q(e).FLEETBO_DEV_TOKEN||process.env.FLEETBO_DEV_TOKEN||"";if(!l){let f=E.join(N.homedir(),".fleetbo","credentials.json");if(d.existsSync(f))try{l=JSON.parse(d.readFileSync(f,"utf8")).devToken||""}catch{}}let t={command:"npx",args:["-y","fleetbo-svro","mcp","--run"],env:{FLEETBO_DEV_TOKEN:l}},i=(f,g,h)=>{let y=E.dirname(f);d.existsSync(y)||d.mkdirSync(y,{recursive:!0});let v={mcpServers:{}};if(d.existsSync(f))try{let F=JSON.parse(d.readFileSync(f,"utf8"));F&&typeof F=="object"&&!Array.isArray(F)&&(v=F)}catch{}v.mcpServers=v.mcpServers||{},v.mcpServers[g]=h,d.writeFileSync(f,JSON.stringify(v,null,2)+`
683
+ `)},c=E.join(e,".cursor"),p=E.join(c,"mcp.json");i(p,"fleetbo-svro",t),u("\u2192 Configured for Cursor (.cursor/mcp.json)");let b=E.join(N.homedir(),".codeium","windsurf","mcp_config.json");if(d.existsSync(E.dirname(b))&&(i(b,"fleetbo-svro",t),u("\u2192 Configured for Windsurf (~/.codeium/windsurf/mcp_config.json)")),u(`
662
684
  Universal connection command for Claude Code and standalone agents:`),u(` claude mcp add fleetbo-svro -- npx -y fleetbo-svro mcp --run
663
- `),!l)O('\u26A0\uFE0F No developer token found. Run "npx fleetbo-svro login" or set FLEETBO_DEV_TOKEN in your .env file.');else{let f=`# FLEETBO DATA OS \u2014 DIRECTIVES SYST\xC8ME
685
+ `),!l)P('\u26A0\uFE0F No developer token found. Run "npx fleetbo-svro login" or set FLEETBO_DEV_TOKEN in your .env file.');else{let f=`# FLEETBO DATA OS \u2014 DIRECTIVES SYST\xC8ME
664
686
 
665
687
  1. TOUTE demande de cr\xE9ation d'une NOUVELLE application DOIT d\xE9clencher l'outil MCP 'fleetbo_create_project'. Mais si le '.env' du projet contient d\xE9j\xE0 VITE_FLEETBO_DB_KEY (ou si 'svro.schema.json' existe), le projet EXISTE : n'appelle JAMAIS 'fleetbo_create_project' ; utilise 'fleetbo_update_project' (le 'keyApp' est la valeur de VITE_FLEETBO_DB_KEY, et il est facultatif : l'outil le lit tout seul).
666
688
  2. Le serveur MCP est d\xE9j\xE0 pr\xE9-authentifi\xE9 : n'inspecte pas le shell ('env', 'grep'), ne parcours pas le syst\xE8me de fichiers hors de la racine du projet et ne lance pas de connexion (lire le '.env' du projet est autoris\xE9). Seule exception : si un outil renvoie \xAB FLEETBO_DEV_TOKEN missing \xBB, ex\xE9cute UNE fois 'npx fleetbo-svro login', attends qu'elle se termine (le d\xE9veloppeur valide dans le navigateur), puis relance l'outil.
@@ -668,7 +690,8 @@ Universal connection command for Claude Code and standalone agents:`),u(` claud
668
690
  4. D\xE8s la cr\xE9ation valid\xE9e, ex\xE9cute la commande renvoy\xE9e ('commandInit') \xE0 la racine et commence le code UI avec l'objet global Fleetbo.*.
669
691
  5. Si l'outil 'fleetbo_create_project' n'appara\xEEt pas dans tes outils : n'improvise pas et n'explore rien. Ex\xE9cute UNE fois 'npx fleetbo-svro mcp', puis demande au d\xE9veloppeur de recharger son \xE9diteur.
670
692
  6. Pour les r\xE8gles Fleetbo, la seule source est 'Fleetbo_contract.md' (racine, g\xE9n\xE9r\xE9 par 'npx fleetbo-svro sync') ou l'outil MCP 'fleetbo_get_contract' : ne charge pas les autres fichiers .md du projet.
671
- `;["AGENTS.md","GEMINI.md","CLAUDE.md",".cursorrules"].forEach(h=>{let E=y.join(e,h);d.existsSync(E)||d.writeFileSync(E,f,"utf8")}),u("\u2192 Autonomous agent directives initialized."),u(`[Fleetbo] Agent ready! Your development environment now has access to Fleetbo MCP tools.
693
+ 7. Avant d'\xE9crire du code de donn\xE9es, lis VITE_FLEETBO_PROTOTYPE dans le '.env' du projet : true = prototype purement visuel (donn\xE9es fictives en repli, l'Edge simule les mutations) ; false = production ('Fleetbo.*' et la s\xE9curit\xE9 Edge prennent le relais). Le code reste identique dans les deux cas. Ne modifie jamais cette valeur toi-m\xEAme.
694
+ `;["AGENTS.md","GEMINI.md","CLAUDE.md",".cursorrules"].forEach(h=>{let y=E.join(e,h);d.existsSync(y)||d.writeFileSync(y,f,"utf8")}),u("\u2192 Autonomous agent directives initialized."),u(`[Fleetbo] Agent ready! Your development environment now has access to Fleetbo MCP tools.
672
695
  `)}process.exit(0)}else I==="login"?(await xe(e),process.exit(0)):["--help","-h","help"].includes(I)?(u(`Fleetbo CLI (fleetbo-svro)
673
696
 
674
697
  Commands:
@@ -682,4 +705,4 @@ Modeling has NO shell command: to evolve the schema/workflow from your UI files,
682
705
  "fleetbo_update_project" (keyApp is optional), then run "sync" once.
683
706
  Run login / mcp at most once each and wait for them to finish. Nothing else needs to be
684
707
  discovered: do not search the filesystem or read files outside the project.
685
- `),process.exit(0)):(O('Unknown command. Run "npx fleetbo-svro --help".'),process.exit(1))}Ce().catch(e=>{O(`Fleetbo CLI Error: ${e.message}`),process.exit(1)});
708
+ `),process.exit(0)):(P('Unknown command. Run "npx fleetbo-svro --help".'),process.exit(1))}Ce().catch(e=>{P(`Fleetbo CLI Error: ${e.message}`),process.exit(1)});
@@ -100,6 +100,10 @@ const FLEETBO_SYSTEM_GUIDELINES = `
100
100
  - INTERDICTION d'inventer des balises de structure inexistantes (<fleetbo-list>, <fleetbo-if>, <fleetbo-else>, <fleetbo-button>, <template>).
101
101
  - Seuls composants Web autorisés pour l'affichage : <fleetbo-text value="..." fallback="..." /> et <fleetbo-number value="..." currency="EUR" />.
102
102
  - Toute interaction de données passe par les méthodes JavaScript : Fleetbo.getDocsG(), Fleetbo.add(), Fleetbo.delete().
103
+ - Interrupteur d'environnement VITE_FLEETBO_PROTOTYPE (à lire dans le .env du projet avant d'écrire du code de données ; le code reste identique dans les deux modes) :
104
+ - true : prototype purement visuel. Données fictives (état local réactif) en repli ; l'Edge est tolérant et SIMULE les mutations en mémoire sans toucher à la base physique. But : valider les interfaces et le workflow.
105
+ - false : production. Fleetbo.* prend le relais et la sécurité Edge s'applique (rejet HTTP 422 hors contrat scellé, écritures physiques). Ne masque pas une erreur Edge derrière des données fictives.
106
+ - L'agent ne modifie jamais cette valeur lui-même : la bascule est une décision du développeur.
103
107
 
104
108
  ### Étape 3 : Modélisation Additive & Extraction Métier (Alex AI)
105
109
  - L'agent transmet les fichiers UI et les contraintes métier via 'fleetbo_update_project'.
@@ -199,7 +203,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
199
203
  },
200
204
  {
201
205
  name: "fleetbo_update_project",
202
- description:
206
+ description:
203
207
  "Models / updates the project's data contract (svro.schema.json + svro.workflow.json) from UI component files and business rules, additively. " +
204
208
  "This is the ONLY way to evolve the contract: there is no shell command for it. " +
205
209
  "Pass 'filePaths' (e.g. ['src/components/DeskList.jsx']); 'keyApp' is optional (read from .env). " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-svro",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "exports": {