fleetbo-svro 1.0.58 → 1.0.60
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 +64 -53
- package/dist/fleetbo-mcp.js +5 -2
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var Q=(
|
|
3
|
-
`),T("\u2192 Created svro.schema.json at project root.")}function ae(
|
|
2
|
+
var Q=(t,n)=>()=>{try{return n||t((n={exports:{}}).exports,n),n.exports}catch(s){throw n=0,s}};var V=Q((ke,J)=>{var a=require("fs"),b=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(t){console.log(` ${te}${t}${R}`)}function v(t){console.error(` ${oe}${t}${R}`)}function ne(t){let n={};return t.forEach(s=>{if(s.startsWith("--")){let[o,r]=s.slice(2).split("=");o&&r&&(n[o]=r)}}),n}function _(t,n){try{let s=JSON.parse(a.readFileSync(t,"utf8"));return!!(s.dependencies&&s.dependencies[n]||s.devDependencies&&s.devDependencies[n])}catch{return!1}}function se(t,n){try{return a.existsSync(b.join(t,"node_modules",n,"package.json"))}catch{return!1}}function re(t,n){if(a.existsSync(b.join(t,"pnpm-lock.yaml")))return"pnpm";if(a.existsSync(b.join(t,"yarn.lock")))return"yarn";if(a.existsSync(b.join(t,"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(t,n){if(!_(n,"fleetbo-svro")||!se(t,"fleetbo-svro")){let s=re(t,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:t,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(t){let n=b.join(t,"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
|
+
`),T("\u2192 Created svro.schema.json at project root.")}function ae(t){let n=b.join(t,".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.
|
|
6
6
|
# false = Strict production mode: enforces schema contracts and persists to DB
|
|
7
7
|
VITE_FLEETBO_PROTOTYPE=true
|
|
8
|
-
`;if(!a.existsSync(n))a.writeFileSync(n,s.trimStart()),T("\u2192 Created .env with VITE_FLEETBO_PROTOTYPE=true");else{let o=a.readFileSync(n,"utf8");!o.includes("VITE_FLEETBO_PROTOTYPE")&&!o.includes("FLEETBO_PROTOTYPE")&&(a.appendFileSync(n,s),T("\u2192 Injected VITE_FLEETBO_PROTOTYPE=true into existing .env"))}}function ce(
|
|
8
|
+
`;if(!a.existsSync(n))a.writeFileSync(n,s.trimStart()),T("\u2192 Created .env with VITE_FLEETBO_PROTOTYPE=true");else{let o=a.readFileSync(n,"utf8");!o.includes("VITE_FLEETBO_PROTOTYPE")&&!o.includes("FLEETBO_PROTOTYPE")&&(a.appendFileSync(n,s),T("\u2192 Injected VITE_FLEETBO_PROTOTYPE=true into existing .env"))}}function ce(t){let n=b.join(t,"src");if(!a.existsSync(n))return;let s=b.join(n,"fleetbo.d.ts");if(a.existsSync(s))return;let o=`/* eslint-disable */
|
|
9
9
|
/* prettier-ignore */
|
|
10
10
|
// @ts-nocheck
|
|
11
11
|
export {}
|
|
@@ -70,16 +70,16 @@ 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
|
|
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 pe(t){let n=b.join(t,"index.d.ts");a.existsSync(n)||T("\u2192 Verified index.d.ts presence.")}function de(t){let n=["tsconfig.json","jsconfig.json"];for(let s of n){let o=b.join(t,s);if(a.existsSync(o)){let r=new Date;a.utimesSync(o,r,r);break}}}function ue(t){return new Promise((n,s)=>{let o=JSON.stringify({token:t}),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,e=>{let i="";e.on("data",c=>{i+=c}),e.on("end",()=>{if(e.statusCode>=200&&e.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 ${e.statusCode}`))}catch{s(new Error(`Server error ${e.statusCode}`))}})});l.on("error",e=>s(e)),l.write(o),l.end()})}async function fe(t,n=[]){let s=b.join(t,".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,e=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(h){v(`\u26A0\uFE0F Token exchange failed: ${h.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",u=`
|
|
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
|
+
${e?`VITE_FLEETBO_TESTER_EMAIL=${e}
|
|
78
78
|
`:""}VITE_FLEETBO_FACEBOOK_APP_ID=${c}
|
|
79
|
-
`;a.appendFileSync(s,
|
|
80
|
-
`),T(`\u2192 Updated ${
|
|
79
|
+
`;a.appendFileSync(s,u),T(".env file updated successfully with Fleetbo keys!")}function U(t){let n=b.join(t,"svro.d.ts");if(a.existsSync(n))try{a.unlinkSync(n),T("\u2192 Removed legacy svro.d.ts from project root.")}catch{}}function M(t,n){if(process.env.FLEETBO_SKIP_TYPECHECK_SETUP)return;let s=b.join(t,"tsconfig.json"),o=b.join(t,"jsconfig.json"),r=a.existsSync(s)?s:o,l=!a.existsSync(r),e={};if(!l)try{e=JSON.parse(a.readFileSync(r,"utf8"))}catch{v(`\u26A0\uFE0F Unable to read ${b.basename(r)} (Invalid JSON).`);return}e.compilerOptions=e.compilerOptions||{};let i=!1,c=_(n,"react");l?(e.compilerOptions.checkJs=!0,e.compilerOptions.allowJs=!0,e.compilerOptions.target=e.compilerOptions.target||"ES2020",e.compilerOptions.module=e.compilerOptions.module||"ESNext",e.compilerOptions.moduleResolution=e.compilerOptions.moduleResolution||"bundler",e.include=["src/**/*"],i=!0):(e.compilerOptions.checkJs===void 0&&(e.compilerOptions.checkJs=!0,i=!0),e.compilerOptions.allowJs===void 0&&(e.compilerOptions.allowJs=!0,i=!0)),c&&e.compilerOptions.jsx===void 0&&(e.compilerOptions.jsx="react-jsx",i=!0),Array.isArray(e.compilerOptions.types)&&e.compilerOptions.types.includes("vite/client")&&(e.compilerOptions.types=e.compilerOptions.types.filter(u=>u!=="vite/client"),e.compilerOptions.types.length===0&&delete e.compilerOptions.types,i=!0,T(`\u2192 Removed legacy "vite/client" entry from ${b.basename(r)}.`)),i&&(a.writeFileSync(r,JSON.stringify(e,null,2)+`
|
|
80
|
+
`),T(`\u2192 Updated ${b.basename(r)}.`))}function B(t){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=b.join(t,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
|
-
`+r,a.writeFileSync(o,r));return}}}function $(
|
|
82
|
+
`+r,a.writeFileSync(o,r));return}}}function $(t,n){if(process.env.FLEETBO_SKIP_AUTOIMPORT_SETUP)return;let o=["vite.config.ts","vite.config.js","vite.config.mjs"].map(c=>b.join(t,c)).find(c=>a.existsSync(c));if(!o)return;let r;try{r=a.readFileSync(o,"utf8")}catch{return}let l="fleetbo-svro",e=r,i=`{
|
|
83
83
|
name: 'fleetbo-auto-runtime',
|
|
84
84
|
transform(code, id) {
|
|
85
85
|
if (!id.includes('node_modules') && !code.includes('fleetbo-svro') && /(src[\\\\/](main|index|App|root))\\.(jsx?|tsx?|vue|svelte)/i.test(id)) {
|
|
@@ -122,29 +122,32 @@ ${t?`VITE_FLEETBO_TESTER_EMAIL=${t}
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
},`;if(
|
|
126
|
-
ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts'],`):
|
|
125
|
+
},`;if(e.includes("svro.schema.json")||(e.includes("server:")?e.includes("watch:")?e=e.replace(/watch\s*:\s*\{/,`watch: {
|
|
126
|
+
ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts'],`):e=e.replace(/server\s*:\s*\{/,`server: {
|
|
127
127
|
watch: {
|
|
128
128
|
ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts']
|
|
129
|
-
},`):
|
|
129
|
+
},`):e.includes("defineConfig({")&&(e=e.replace("defineConfig({",`defineConfig({
|
|
130
130
|
server: {
|
|
131
131
|
watch: {
|
|
132
132
|
ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts']
|
|
133
133
|
}
|
|
134
|
-
},`))),!
|
|
134
|
+
},`))),!e.includes("unplugin-auto-import")){let c=e.match(/plugins\s*:\s*\[/);if(c){let u=c.index+c[0].length,h=`
|
|
135
135
|
AutoImport({
|
|
136
136
|
imports: [{ '${l}': ['Fleetbo', 'FleetboUI'] }],
|
|
137
137
|
dts: 'src/auto-imports.d.ts'
|
|
138
|
-
}),`;if(
|
|
139
|
-
`;if(f){let
|
|
140
|
-
`+
|
|
141
|
-
`+i+
|
|
142
|
-
`),T("\u2192 Configured Fleetbo Cyan visual hints in .vscode/settings.json.")}catch{}}function me(
|
|
143
|
-
FLEETBO_DEV_TOKEN=${i}
|
|
144
|
-
`,d.writeFileSync(p,b,"utf8")}l.writeHead(200,{"Content-Type":"text/html; charset=utf-8",Connection:"close"}),l.end(`
|
|
138
|
+
}),`;if(e=e.slice(0,u)+h+e.slice(u),!e.includes("import AutoImport")){let f=[...e.matchAll(/^import .+;?$/gm)].pop(),m=`import AutoImport from 'unplugin-auto-import/vite';
|
|
139
|
+
`;if(f){let F=f.index+f[0].length;e=e.slice(0,F)+`
|
|
140
|
+
`+m+e.slice(F)}else e=m+e}}}if(!e.includes("fleetbo-auto-runtime")){let c=e.match(/plugins\s*:\s*\[/);if(c){let u=c.index+c[0].length;e=e.slice(0,u)+`
|
|
141
|
+
`+i+e.slice(u)}}e!==r&&a.writeFileSync(o,e)}function be(t){let n=b.join(t,".vscode"),s=b.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(t,n,s={}){let{skipSelfInstall:o=!1}=s,r=b.join(__dirname,"..");o||ie(t,n),le(t),ae(t),pe(r),ce(t),be(t),U(t),M(t,n),$(t,n),B(t)}J.exports={touchTsConfig:de,log:T,logError:v,handleAuthAndEnv:fe,detectDependency:_,cleanupLegacyRootDts:U,patchJsOrTsConfig:M,attemptViteAutoImportPatch:$,injectUniversalRuntime:B,runFullSetup:me}});var p=require("fs"),y=require("path"),K=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",Pe="\x1B[31m",W="\x1B[0m";function d(t){console.log(`${ve}${t}${W}`)}function P(t){console.error(`${Pe}${t}${W}`)}function Oe(t){let n=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";Fe(`${n} "${t}"`)}function xe(t){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 e=new URL(r.url,"http://127.0.0.1");if(e.pathname==="/callback"){let i=e.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");p.existsSync(c)||p.mkdirSync(c,{recursive:!0}),p.writeFileSync(y.join(c,"credentials.json"),JSON.stringify({devToken:i,updatedAt:new Date().toISOString()},null,2)),l.writeHead(200,{"Content-Type":"text/html; charset=utf-8",Connection:"close"}),l.end(`
|
|
145
143
|
<!DOCTYPE html>
|
|
146
144
|
<html>
|
|
147
|
-
<head
|
|
145
|
+
<head>
|
|
146
|
+
<meta name="color-scheme" content="light">
|
|
147
|
+
<style>
|
|
148
|
+
:root { color-scheme: light; }
|
|
149
|
+
</style>
|
|
150
|
+
</head>
|
|
148
151
|
<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
152
|
<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
153
|
<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>
|
|
@@ -154,12 +157,12 @@ FLEETBO_DEV_TOKEN=${i}
|
|
|
154
157
|
</div>
|
|
155
158
|
</body>
|
|
156
159
|
</html>
|
|
157
|
-
`),
|
|
158
|
-
[Fleetbo] Developer token received and stored successfully!`),
|
|
159
|
-
Next step to connect your AI agents:`),
|
|
160
|
-
`),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}`;
|
|
161
|
-
[Fleetbo] Waiting for authentication...`),
|
|
162
|
-
`).forEach(r=>{let[l,...
|
|
160
|
+
`),d(`
|
|
161
|
+
[Fleetbo] Developer token received and stored successfully!`),d(`
|
|
162
|
+
Next step to connect your AI agents:`),d(` npx fleetbo-svro mcp (Configure Cursor, Windsurf, Claude Code, etc.)
|
|
163
|
+
`),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}`;d(`
|
|
164
|
+
[Fleetbo] Waiting for authentication...`),d(`If your browser does not open automatically, visit: ${l}`),Oe(l);let e=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(e/1e3)}s: browser approval not received. Run "npx fleetbo-svro login" once more and approve in the browser.`))},e).unref()}),o.on("error",r=>s(r))})}function Ie(t,n){return new Promise((s,o)=>{let r=JSON.stringify({enterpriseID:t,schema:n}),l={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},e=K.request(l,i=>{let c="";i.on("data",u=>{c+=u}),i.on("end",()=>{i.statusCode>=200&&i.statusCode<300?s(JSON.parse(c)):o(new Error(`Edge sync failed with HTTP ${i.statusCode}`))})});e.on("error",i=>o(i)),e.write(r),e.end()})}function q(t){let n=y.join(t,".env");if(!p.existsSync(n))return{};let s=p.readFileSync(n,"utf8"),o={};return s.split(`
|
|
165
|
+
`).forEach(r=>{let[l,...e]=r.split("=");l&&e.length>0&&(o[l.trim()]=e.join("=").trim())}),o}function H(t,n){return new Promise((s,o)=>{let r=JSON.stringify({projectId:t,moduleName:n}),l={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},e=K.request(l,i=>{let c="";i.on("data",u=>{c+=u}),i.on("end",()=>{if(i.statusCode>=200&&i.statusCode<300)try{let u=JSON.parse(c);if(u.success&&u.found&&u.module){let h=u.module.code||u.module.mockCode;s(typeof h=="string"?JSON.parse(h):h)}else s(null)}catch{o(new Error(`Invalid JSON response for ${n}.`))}else o(new Error(`Server error ${i.statusCode} while fetching ${n}`))})});e.on("error",i=>o(i)),e.write(r),e.end()})}var w=process.argv.slice(2),I=w[0];function Ae(t,n){return`# LE CONTRAT DE DONN\xC9ES FLEETBO (FLEETBO DATA CONTRACT)
|
|
163
166
|
|
|
164
167
|
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
168
|
|
|
@@ -174,13 +177,18 @@ Ce document constitue le **Cahier des charges officiel et le Contrat bilat\xE9ra
|
|
|
174
177
|
|
|
175
178
|
### \u{1F6A8} DIRECTIVE D'EX\xC9CUTION OBLIGATOIRE POUR L'AGENT IA
|
|
176
179
|
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
|
-
2. **Refus de contournement** : Si un composant n\xE9cessite une donn\xE9e absente du contrat, n'\xE9cris aucun code palliatif :
|
|
180
|
+
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).
|
|
178
181
|
3. **Validit\xE9 physique** : Toute g\xE9n\xE9ration de code doit s'aligner \xE0 100 % sur les signatures et sch\xE9mas fournis, sous peine de rejet imm\xE9diat \xE0 l'Edge.
|
|
179
182
|
|
|
183
|
+
### \u{1F501} FAIRE \xC9VOLUER LE CONTRAT (MOD\xC9LISATION)
|
|
184
|
+
* La mod\xE9lisation n'est **pas** une commande shell : \`npx fleetbo-svro\` n'a aucune sous-commande \`update\` ou \`model\` (inutile de lancer \`--help\` pour en chercher une).
|
|
185
|
+
* **Avec le MCP Fleetbo** : appelle l'outil \`fleetbo_update_project\` avec \`name\` et \`filePaths\` (chemins des vues cr\xE9\xE9es, ex. \`src/components/DeskList.jsx\`), plus \`rules\` pour les r\xE8gles m\xE9tier \xE0 formaliser. \`keyApp\` est facultatif : il est lu dans le \`.env\` (VITE_FLEETBO_DB_KEY). Puis ex\xE9cute UNE fois \`npx fleetbo-svro sync\` : il rapatrie les contrats et r\xE9g\xE9n\xE8re ce fichier.
|
|
186
|
+
* **Sans MCP** : interromps-toi et fournis au d\xE9veloppeur le prompt exact \xE0 soumettre \xE0 Alex AI dans Fleetbo Studio (Mode Analyze), puis attends l'ex\xE9cution de \`npx fleetbo-svro sync\`.
|
|
187
|
+
|
|
180
188
|
---
|
|
181
189
|
|
|
182
190
|
## \u{1F4CB} CAHIER DES CHARGES M\xC9TIER (CONTEXTE DU PROJET)
|
|
183
|
-
${
|
|
191
|
+
${t?.context||n?.context||"Aucun cahier des charges textuel renseign\xE9."}
|
|
184
192
|
|
|
185
193
|
---
|
|
186
194
|
|
|
@@ -197,10 +205,11 @@ Ton r\xF4le est de guider le d\xE9veloppeur ou l'utilisateur et de concevoir des
|
|
|
197
205
|
- Les formules de calcul, validations, conditions et transitions d'\xE9tat DOIVENT respecter \xE0 la lettre les expressions scell\xE9es dans \`svro.workflow.json\`.
|
|
198
206
|
- Tout champ non d\xE9clar\xE9 ou calcul non conforme envoy\xE9 \xE0 la base sera rejet\xE9 imm\xE9diatement par le Gatekeeper Edge (HTTP 422).
|
|
199
207
|
|
|
200
|
-
2. PROTOCOLE STRICT DE
|
|
201
|
-
-
|
|
202
|
-
|
|
203
|
-
|
|
208
|
+
2. PROTOCOLE STRICT DE REMOD\xC9LISATION OU RESTRUCTURATION DE DONN\xC9ES :
|
|
209
|
+
- 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 :
|
|
210
|
+
\u{1F449} INTERDICTION FORMELLE d'\xE9crire ou de simuler un contournement c\xF4t\xE9 code client.
|
|
211
|
+
\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.
|
|
212
|
+
\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.
|
|
204
213
|
|
|
205
214
|
3. S\xC9PARATION STRICTE DES RESPONSABILIT\xC9S :
|
|
206
215
|
- Agent Frontend : g\xE8re exclusivement l'ergonomie, les composants d'affichage et l'UX.
|
|
@@ -231,7 +240,7 @@ Ton r\xF4le est de guider le d\xE9veloppeur ou l'utilisateur et de concevoir des
|
|
|
231
240
|
|
|
232
241
|
## \u{1F5C4}\uFE0F CONTRAT DDL PHYSIQUE SCELL\xC9 (svro.schema.json)
|
|
233
242
|
\`\`\`json
|
|
234
|
-
${JSON.stringify(
|
|
243
|
+
${JSON.stringify(t||{},null,2)}
|
|
235
244
|
\`\`\`
|
|
236
245
|
|
|
237
246
|
---
|
|
@@ -240,23 +249,23 @@ ${JSON.stringify(e||{},null,2)}
|
|
|
240
249
|
\`\`\`json
|
|
241
250
|
${JSON.stringify(n||{},null,2)}
|
|
242
251
|
\`\`\`
|
|
243
|
-
`}async function
|
|
244
|
-
[Fleetbo] Initializing and configuring Fleetbo...`),await he(
|
|
252
|
+
`}async function Ce(){let t=process.cwd(),n=y.join(t,"package.json");if(I==="init"||I==="doctor")d(`
|
|
253
|
+
[Fleetbo] Initializing and configuring Fleetbo...`),await he(t,w),ye(t,n),d(`
|
|
245
254
|
[Fleetbo] Configuration completed successfully!
|
|
246
|
-
`),
|
|
247
|
-
Next step:`),
|
|
248
|
-
`);else if(I==="sync"){let s=w.includes("--dry-run");
|
|
249
|
-
`),
|
|
250
|
-
`),
|
|
251
|
-
`,"utf8"),
|
|
252
|
-
`,"utf8"),
|
|
255
|
+
`),d(`
|
|
256
|
+
Next step:`),d(` npx fleetbo-svro sync (Sync cloud schema & generate IDE types)
|
|
257
|
+
`);else if(I==="sync"){let s=w.includes("--dry-run");d(`[Fleetbo] Syncing schema...${s?" (dry-run)":""}`);let o=y.join(t,"svro.schema.json"),r=y.join(t,"svro.workflow.json"),l=y.join(t,"Fleetbo_contract.md"),e=y.join(__dirname,".."),i=y.join(e,"index.d.ts"),c=y.join(t,"src","fleetbo.d.ts"),h=q(t).VITE_FLEETBO_ENTERPRISE_ID,f=null,m=null;if(h)try{d("\u2192 Fetching latest contracts from Fleetbo Cloud..."),f=await H(h,"svro.schema.json"),f&&(p.writeFileSync(o,JSON.stringify(f,null,2)+`
|
|
258
|
+
`),d("\u2192 Local svro.schema.json updated.")),m=await H(h,"svro.workflow.json"),m&&(p.writeFileSync(r,JSON.stringify(m,null,2)+`
|
|
259
|
+
`),d("\u2192 Local svro.workflow.json updated."))}catch(g){P(`\u26A0\uFE0F Cloud fetch bypassed: ${g.message}. Using local file fallback.`)}else P("\u26A0\uFE0F VITE_FLEETBO_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");let F=f;if(!F&&p.existsSync(o))try{F=JSON.parse(p.readFileSync(o,"utf8"))}catch{}F||(F={context:"Application en cours de mod\xE9lisation initiale.",collections:{}},p.writeFileSync(o,JSON.stringify(F,null,2)+`
|
|
260
|
+
`,"utf8"),d("\u2192 Initial blank svro.schema.json created."));let E=m;if(!E&&p.existsSync(r))try{E=JSON.parse(p.readFileSync(r,"utf8"))}catch{}E||(E={actors:{},sequences:[]},p.writeFileSync(r,JSON.stringify(E,null,2)+`
|
|
261
|
+
`,"utf8"),d("\u2192 Initial blank svro.workflow.json created."));let S=Ae(F,E);p.writeFileSync(l,S,"utf8"),d("\u2192 Fleetbo_contract.md successfully generated at project root.");try{let g=Object.keys(F.collections||{});if(h)try{await Ie(h,F),d("\u2192 Schema successfully sealed at Fleetbo Global Edge (O(1)).")}catch(O){P(`\u26A0\uFE0F Fleetbo Edge Shield sync warning: ${O.message}`)}let A=F.collections||{},j=Object.entries(A).map(([O,L])=>{let G=L.fields||L.schema||{},X=Object.entries(G).map(([z,k])=>{let C="any",x=String(typeof k=="string"?k:k.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(`
|
|
253
262
|
`);return` ${O}: {
|
|
254
263
|
${X}
|
|
255
264
|
};`}).join(`
|
|
256
|
-
`),D=
|
|
265
|
+
`),D=g.length>0?g.map(O=>`'${O}'`).join(" | "):"string",Y=`// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
|
|
257
266
|
|
|
258
267
|
export interface FleetboSchemaMap {
|
|
259
|
-
${
|
|
268
|
+
${j}
|
|
260
269
|
}
|
|
261
270
|
|
|
262
271
|
export type KnownFleetboTables = ${D};
|
|
@@ -516,7 +525,7 @@ declare module 'svelte/elements' {
|
|
|
516
525
|
'fleetbo-reference': FleetboProp;
|
|
517
526
|
}
|
|
518
527
|
}
|
|
519
|
-
`;if(
|
|
528
|
+
`;if(p.writeFileSync(i,Y),p.existsSync(y.dirname(c))){let O=`/* eslint-disable */
|
|
520
529
|
/* prettier-ignore */
|
|
521
530
|
// @ts-nocheck
|
|
522
531
|
// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
|
|
@@ -545,7 +554,7 @@ type FleetboProp = {
|
|
|
545
554
|
};
|
|
546
555
|
|
|
547
556
|
interface FleetboSchemaMap {
|
|
548
|
-
${
|
|
557
|
+
${j}
|
|
549
558
|
}
|
|
550
559
|
|
|
551
560
|
declare global {
|
|
@@ -650,10 +659,10 @@ declare module 'svelte/elements' {
|
|
|
650
659
|
'fleetbo-reference': FleetboProp;
|
|
651
660
|
}
|
|
652
661
|
}
|
|
653
|
-
`;
|
|
654
|
-
[Fleetbo] Configuring MCP server for your environment...`);let l=
|
|
655
|
-
`)},c=y.join(
|
|
656
|
-
Universal connection command for Claude Code and standalone agents:`),
|
|
662
|
+
`;p.writeFileSync(c,O)}Ee(t),Te(t,n),Se(t),d(`[Fleetbo] Schema synced successfully (${g.length} collection(s)).`),s&&d("\u2192 [Dry-run] Schema is valid.")}catch(g){P(`Error during synchronization: ${g.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 m=process.stdin,F=null,E=A=>{clearTimeout(F),m.removeListener("data",S),m.removeListener("end",g),m.removeListener("error",g),f(A)},S=A=>{m.pause(),m.unshift(A),o=!0,E(!0)},g=()=>E(!1);F=setTimeout(()=>{m.pause(),E(!1)},1500),m.on("data",S),m.once("end",g),m.once("error",g)})),s){try{await import(`file://${y.join(__dirname,"fleetbo-mcp.js")}`),o&&process.stdin.resume()}catch(f){P(`Failed to start MCP server: ${f.message}`),process.exit(1)}return}d(`
|
|
663
|
+
[Fleetbo] Configuring MCP server for your environment...`);let l=q(t).FLEETBO_DEV_TOKEN||process.env.FLEETBO_DEV_TOKEN||"";if(!l){let f=y.join(N.homedir(),".fleetbo","credentials.json");if(p.existsSync(f))try{l=JSON.parse(p.readFileSync(f,"utf8")).devToken||""}catch{}}let e={command:"npx",args:["-y","fleetbo-svro","mcp","--run"],env:{FLEETBO_DEV_TOKEN:l}},i=(f,m,F)=>{let E=y.dirname(f);p.existsSync(E)||p.mkdirSync(E,{recursive:!0});let S={mcpServers:{}};if(p.existsSync(f))try{let g=JSON.parse(p.readFileSync(f,"utf8"));g&&typeof g=="object"&&!Array.isArray(g)&&(S=g)}catch{}S.mcpServers=S.mcpServers||{},S.mcpServers[m]=F,p.writeFileSync(f,JSON.stringify(S,null,2)+`
|
|
664
|
+
`)},c=y.join(t,".cursor"),u=y.join(c,"mcp.json");i(u,"fleetbo-svro",e),d("\u2192 Configured for Cursor (.cursor/mcp.json)");let h=y.join(N.homedir(),".codeium","windsurf","mcp_config.json");if(p.existsSync(y.dirname(h))&&(i(h,"fleetbo-svro",e),d("\u2192 Configured for Windsurf (~/.codeium/windsurf/mcp_config.json)")),d(`
|
|
665
|
+
Universal connection command for Claude Code and standalone agents:`),d(` claude mcp add fleetbo-svro -- npx -y fleetbo-svro mcp --run
|
|
657
666
|
`),!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
|
|
658
667
|
|
|
659
668
|
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).
|
|
@@ -662,8 +671,8 @@ Universal connection command for Claude Code and standalone agents:`),u(` claud
|
|
|
662
671
|
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.*.
|
|
663
672
|
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.
|
|
664
673
|
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.
|
|
665
|
-
`;["AGENTS.md","GEMINI.md","CLAUDE.md",".cursorrules"].forEach(
|
|
666
|
-
`)}process.exit(0)}else I==="login"?(await xe(
|
|
674
|
+
`;["AGENTS.md","GEMINI.md","CLAUDE.md",".cursorrules"].forEach(F=>{let E=y.join(t,F);p.existsSync(E)||p.writeFileSync(E,f,"utf8")}),d("\u2192 Autonomous agent directives initialized."),d(`[Fleetbo] Agent ready! Your development environment now has access to Fleetbo MCP tools.
|
|
675
|
+
`)}process.exit(0)}else I==="login"?(await xe(t),process.exit(0)):["--help","-h","help"].includes(I)?(d(`Fleetbo CLI (fleetbo-svro)
|
|
667
676
|
|
|
668
677
|
Commands:
|
|
669
678
|
login Authenticate this machine (opens the browser: approve once, the command exits by itself)
|
|
@@ -672,6 +681,8 @@ Commands:
|
|
|
672
681
|
sync Seal the schema/workflow on the Edge and generate Fleetbo_contract.md + IDE types
|
|
673
682
|
|
|
674
683
|
AI agents: to create a project, call the MCP tool "fleetbo_create_project" (already authenticated).
|
|
684
|
+
Modeling has NO shell command: to evolve the schema/workflow from your UI files, call the MCP tool
|
|
685
|
+
"fleetbo_update_project" (keyApp is optional), then run "sync" once.
|
|
675
686
|
Run login / mcp at most once each and wait for them to finish. Nothing else needs to be
|
|
676
687
|
discovered: do not search the filesystem or read files outside the project.
|
|
677
|
-
`),process.exit(0)):(P('Unknown command. Run "npx fleetbo-svro --help".'),process.exit(1))}
|
|
688
|
+
`),process.exit(0)):(P('Unknown command. Run "npx fleetbo-svro --help".'),process.exit(1))}Ce().catch(t=>{P(`Fleetbo CLI Error: ${t.message}`),process.exit(1)});
|
package/dist/fleetbo-mcp.js
CHANGED
|
@@ -199,8 +199,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
201
|
name: "fleetbo_update_project",
|
|
202
|
-
|
|
203
|
-
"
|
|
202
|
+
description:
|
|
203
|
+
"Models / updates the project's data contract (svro.schema.json + svro.workflow.json) from UI component files and business rules, additively. " +
|
|
204
|
+
"This is the ONLY way to evolve the contract: there is no shell command for it. " +
|
|
205
|
+
"Pass 'filePaths' (e.g. ['src/components/DeskList.jsx']); 'keyApp' is optional (read from .env). " +
|
|
206
|
+
"Afterwards run 'npx fleetbo-svro sync' once.",
|
|
204
207
|
inputSchema: {
|
|
205
208
|
type: "object",
|
|
206
209
|
properties: {
|