fleetbo-svro 1.0.42 → 1.0.46
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 +131 -35
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`),
|
|
2
|
+
var Q=(e,o)=>()=>{try{return o||e((o={exports:{}}).exports,o),o.exports}catch(s){throw o=0,s}};var J=Q((Ne,$)=>{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",j="\x1B[0m";function g(e){console.log(` ${te}${e}${j}`)}function h(e){console.error(` ${oe}${e}${j}`)}function ne(e){let o={};return e.forEach(s=>{if(s.startsWith("--")){let[n,r]=s.slice(2).split("=");n&&r&&(o[n]=r)}}),o}function A(e,o){try{let s=JSON.parse(a.readFileSync(e,"utf8"));return!!(s.dependencies&&s.dependencies[o]||s.devDependencies&&s.devDependencies[o])}catch{return!1}}function se(e,o){try{return a.existsSync(b.join(e,"node_modules",o,"package.json"))}catch{return!1}}function re(e,o){if(a.existsSync(b.join(e,"pnpm-lock.yaml")))return"pnpm";if(a.existsSync(b.join(e,"yarn.lock")))return"yarn";if(a.existsSync(b.join(e,"bun.lockb")))return"bun";try{let s=JSON.parse(a.readFileSync(o,"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,o){if(!A(o,"fleetbo-svro")||!se(e,"fleetbo-svro")){let s=re(e,o),n={pnpm:"pnpm add fleetbo-svro",yarn:"yarn add fleetbo-svro",bun:"bun add fleetbo-svro",npm:"npm install fleetbo-svro"}[s];g(`\u2192 Installing fleetbo-svro into the project (detected: ${s})...`);try{ee(n,{cwd:e,stdio:"inherit"}),g("fleetbo-svro installed successfully!")}catch(r){h(`\u26A0\uFE0F Automatic installation failed: ${r.message}`),h(`\u{1F449} Please run '${n}' manually.`)}}}function le(e){let o=b.join(e,"svro.schema.json");if(a.existsSync(o))return;let s=new Date().toISOString(),n={createdAt:s,patchedAt:s,schemaVersion:1,collections:{}};a.writeFileSync(o,JSON.stringify(n,null,2)+`
|
|
3
|
+
`),g("\u2192 Created svro.schema.json at project root.")}function ae(e){let o=b.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.
|
|
6
6
|
# false = Strict production mode: enforces schema contracts and persists to DB
|
|
7
7
|
VITE_FLEETBO_PROTOTYPE=true
|
|
8
|
-
`;if(!
|
|
8
|
+
`;if(!a.existsSync(o))a.writeFileSync(o,s.trimStart()),g("\u2192 Created .env with VITE_FLEETBO_PROTOTYPE=true");else{let n=a.readFileSync(o,"utf8");!n.includes("VITE_FLEETBO_PROTOTYPE")&&!n.includes("FLEETBO_PROTOTYPE")&&(a.appendFileSync(o,s),g("\u2192 Injected VITE_FLEETBO_PROTOTYPE=true into existing .env"))}}function ce(e){let o=b.join(e,"src");if(!a.existsSync(o))return;let s=b.join(o,"fleetbo.d.ts");if(a.existsSync(s))return;let n=`/* 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{
|
|
74
|
-
VITE_FLEETBO_DB_KEY=${
|
|
75
|
-
VITE_FLEETBO_ENTERPRISE_ID=${
|
|
73
|
+
`;try{a.writeFileSync(s,n),g("\u2192 Created src/fleetbo.d.ts stub for instant IDE auto-completion.")}catch(r){h(`\u26A0\uFE0F Unable to create src/fleetbo.d.ts: ${r.message}`)}}function pe(e){let o=b.join(e,"index.d.ts");a.existsSync(o)||g("\u2192 Verified index.d.ts presence.")}function de(e){let o=["tsconfig.json","jsconfig.json"];for(let s of o){let n=b.join(e,s);if(a.existsSync(n)){let r=new Date;a.utimesSync(n,r,r);break}}}function ue(e){return new Promise((o,s)=>{let n=JSON.stringify({token:e}),r={hostname:"bootstrapproject-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(n)}},p=Z.request(r,t=>{let i="";t.on("data",l=>{i+=l}),t.on("end",()=>{if(t.statusCode>=200&&t.statusCode<300)try{o(JSON.parse(i))}catch{s(new Error("Invalid response received from Fleetbo server."))}else try{let l=JSON.parse(i);s(new Error(l.error||`Server error ${t.statusCode}`))}catch{s(new Error(`Server error ${t.statusCode}`))}})});p.on("error",t=>s(t)),p.write(n),p.end()})}async function be(e,o=[]){let s=b.join(e,".env");if(a.existsSync(s)&&a.readFileSync(s,"utf8").includes("VITE_FLEETBO_DB_KEY")){g("\u2192 Fleetbo environment variables already present in .env \u2014 skipping step.");return}let n=ne(o),r=n.keyApp,p=n.token||n.bootstrapToken,t=n.email||"";(!r||!p)&&(h("\u26A0\uFE0F Missing required parameters."),h("\u{1F449} Usage: npx fleetbo-svro init --keyApp=YOUR_KEY --token=YOUR_TOKEN"),process.exit(1)),g("\u2192 Exchanging bootstrap token for project keys...");let i;try{i=await ue(p)}catch(u){h(`\u26A0\uFE0F Token exchange failed: ${u.message}`),h("\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)&&(h("\u26A0\uFE0F Incomplete response from Fleetbo server."),process.exit(1));let l=i.facebookAppId||n.fbAppId||n.facebookAppId||"11967268204758",c=`
|
|
74
|
+
VITE_FLEETBO_DB_KEY=${i.fleetboDBKey}
|
|
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=${l}
|
|
79
|
-
`;
|
|
80
|
-
`),
|
|
79
|
+
`;a.appendFileSync(s,c),g(".env file updated successfully with Fleetbo keys!")}function L(e){let o=b.join(e,"svro.d.ts");if(a.existsSync(o))try{a.unlinkSync(o),g("\u2192 Removed legacy svro.d.ts from project root.")}catch{}}function _(e,o){if(process.env.FLEETBO_SKIP_TYPECHECK_SETUP)return;let s=b.join(e,"tsconfig.json"),n=b.join(e,"jsconfig.json"),r=a.existsSync(s)?s:n,p=!a.existsSync(r),t={};if(!p)try{t=JSON.parse(a.readFileSync(r,"utf8"))}catch{h(`\u26A0\uFE0F Unable to read ${b.basename(r)} (Invalid JSON).`);return}t.compilerOptions=t.compilerOptions||{};let i=!1,l=A(o,"react");p?(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)),l&&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(c=>c!=="vite/client"),t.compilerOptions.types.length===0&&delete t.compilerOptions.types,i=!0,g(`\u2192 Removed legacy "vite/client" entry from ${b.basename(r)}.`)),i&&(a.writeFileSync(r,JSON.stringify(t,null,2)+`
|
|
80
|
+
`),g(`\u2192 Updated ${b.basename(r)}.`))}function U(e){let o=["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 o){let n=b.join(e,s);if(a.existsSync(n)){let r=a.readFileSync(n,"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,
|
|
82
|
+
`+r,a.writeFileSync(n,r));return}}}function B(e,o){if(process.env.FLEETBO_SKIP_AUTOIMPORT_SETUP)return;let n=["vite.config.ts","vite.config.js","vite.config.mjs"].map(l=>b.join(e,l)).find(l=>a.existsSync(l));if(!n)return;let r;try{r=a.readFileSync(n,"utf8")}catch{return}let p="fleetbo-svro",t=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,41 +122,132 @@ ${e?`VITE_FLEETBO_TESTER_EMAIL=${e}
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
},`;if(
|
|
126
|
-
ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts'],`):
|
|
125
|
+
},`;if(t.includes("svro.schema.json")||(t.includes("server:")?t.includes("watch:")?t=t.replace(/watch\s*:\s*\{/,`watch: {
|
|
126
|
+
ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts'],`):t=t.replace(/server\s*:\s*\{/,`server: {
|
|
127
127
|
watch: {
|
|
128
128
|
ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts']
|
|
129
|
-
},`):
|
|
129
|
+
},`):t.includes("defineConfig({")&&(t=t.replace("defineConfig({",`defineConfig({
|
|
130
130
|
server: {
|
|
131
131
|
watch: {
|
|
132
132
|
ignored: ['**/svro.schema.json', '**/src/auto-imports.d.ts']
|
|
133
133
|
}
|
|
134
|
-
},`))),!
|
|
134
|
+
},`))),!t.includes("unplugin-auto-import")){let l=t.match(/plugins\s*:\s*\[/);if(l){let c=l.index+l[0].length,u=`
|
|
135
135
|
AutoImport({
|
|
136
|
-
imports: [{ '${
|
|
136
|
+
imports: [{ '${p}': ['Fleetbo', 'FleetboUI'] }],
|
|
137
137
|
dts: 'src/auto-imports.d.ts'
|
|
138
|
-
}),`;if(
|
|
139
|
-
`;if(
|
|
140
|
-
`+
|
|
141
|
-
`+
|
|
142
|
-
`),
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
}),`;if(t=t.slice(0,c)+u+t.slice(c),!t.includes("import AutoImport")){let y=[...t.matchAll(/^import .+;?$/gm)].pop(),T=`import AutoImport from 'unplugin-auto-import/vite';
|
|
139
|
+
`;if(y){let F=y.index+y[0].length;t=t.slice(0,F)+`
|
|
140
|
+
`+T+t.slice(F)}else t=T+t}}}if(!t.includes("fleetbo-auto-runtime")){let l=t.match(/plugins\s*:\s*\[/);if(l){let c=l.index+l[0].length;t=t.slice(0,c)+`
|
|
141
|
+
`+i+t.slice(c)}}t!==r&&a.writeFileSync(n,t)}function fe(e){let o=b.join(e,".vscode"),s=b.join(o,"settings.json");try{a.existsSync(o)||a.mkdirSync(o,{recursive:!0});let n={};if(a.existsSync(s))try{n=JSON.parse(a.readFileSync(s,"utf8"))}catch{n={}}n["workbench.colorCustomizations"]=n["workbench.colorCustomizations"]||{},n["workbench.colorCustomizations"]["editorInfo.foreground"]="#00feae",n["workbench.colorCustomizations"]["editorHint.foreground"]="#00feae",a.writeFileSync(s,JSON.stringify(n,null,2)+`
|
|
142
|
+
`),g("\u2192 Configured Fleetbo Cyan visual hints in .vscode/settings.json.")}catch{}}function me(e,o,s={}){let{skipSelfInstall:n=!1}=s,r=b.join(__dirname,"..");n||ie(e,o),le(e),ae(e),pe(r),ce(e),fe(e),L(e),_(e,o),B(e,o),U(e)}$.exports={touchTsConfig:de,log:g,logError:h,handleAuthAndEnv:be,detectDependency:A,cleanupLegacyRootDts:L,patchJsOrTsConfig:_,attemptViteAutoImportPatch:B,injectUniversalRuntime:U,runFullSetup:me}});var d=require("fs"),m=require("path"),H=require("https"),ge=require("http"),N=require("os"),{exec:Fe}=require("child_process"),{runFullSetup:ye,handleAuthAndEnv:Te,touchTsConfig:he,attemptViteAutoImportPatch:Ee,injectUniversalRuntime:Se}=J(),Pe="\x1B[34m",Oe="\x1B[31m",q="\x1B[0m";function f(e){console.log(`${Pe}${e}${q}`)}function S(e){console.error(`${Oe}${e}${q}`)}function ve(e){let o=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";Fe(`${o} "${e}"`)}function xe(e){return new Promise((o,s)=>{let n=ge.createServer((r,p)=>{if(p.setHeader("Access-Control-Allow-Origin","*"),p.setHeader("Access-Control-Allow-Methods","GET, OPTIONS"),p.setHeader("Access-Control-Allow-Headers","Content-Type"),r.method==="OPTIONS"){p.writeHead(204),p.end();return}let t=new URL(r.url,"http://localhost");if(t.pathname==="/callback"){let i=t.searchParams.get("token");if(!i){p.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),p.end("<h3>Error: Missing token.</h3>");return}let l=m.join(N.homedir(),".fleetbo");d.existsSync(l)||d.mkdirSync(l,{recursive:!0}),d.writeFileSync(m.join(l,"credentials.json"),JSON.stringify({devToken:i,updatedAt:new Date().toISOString()},null,2));let c=m.join(e,".env");if(d.existsSync(c)){let u=d.readFileSync(c,"utf8");u.includes("FLEETBO_DEV_TOKEN=")?u=u.replace(/FLEETBO_DEV_TOKEN=.*/g,`FLEETBO_DEV_TOKEN=${i}`):u+=`
|
|
143
|
+
FLEETBO_DEV_TOKEN=${i}
|
|
144
|
+
`,d.writeFileSync(c,u,"utf8")}p.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),p.end(`
|
|
145
|
+
<div style="font-family: sans-serif; text-align: center; margin-top: 50px;">
|
|
146
|
+
<h2 style="color: #0F9C8C;">Authentication Successful!</h2>
|
|
147
|
+
<p>Your terminal is now connected to Fleetbo. You can close this window.</p>
|
|
148
|
+
</div>
|
|
149
|
+
`),f(`
|
|
150
|
+
[Fleetbo] Developer token received and stored successfully!`),n.close(()=>o())}});n.listen(0,()=>{let p=`https://fleetbo.io/cli-auth?port=${n.address().port}`;f(`
|
|
151
|
+
[Fleetbo] Waiting for authentication...`),f(`If your browser does not open automatically, visit: ${p}`),ve(p)}),n.on("error",r=>s(r))})}function Ie(e,o){return new Promise((s,n)=>{let r=JSON.stringify({enterpriseID:e,schema:o}),p={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},t=H.request(p,i=>{let l="";i.on("data",c=>{l+=c}),i.on("end",()=>{i.statusCode>=200&&i.statusCode<300?s(JSON.parse(l)):n(new Error(`Edge sync failed with HTTP ${i.statusCode}`))})});t.on("error",i=>n(i)),t.write(r),t.end()})}function M(e){let o=m.join(e,".env");if(!d.existsSync(o))return{};let s=d.readFileSync(o,"utf8"),n={};return s.split(`
|
|
152
|
+
`).forEach(r=>{let[p,...t]=r.split("=");p&&t.length>0&&(n[p.trim()]=t.join("=").trim())}),n}function V(e,o){return new Promise((s,n)=>{let r=JSON.stringify({projectId:e,moduleName:o}),p={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},t=H.request(p,i=>{let l="";i.on("data",c=>{l+=c}),i.on("end",()=>{if(i.statusCode>=200&&i.statusCode<300)try{let c=JSON.parse(l);if(c.success&&c.found&&c.module){let u=c.module.code||c.module.mockCode;s(typeof u=="string"?JSON.parse(u):u)}else s(null)}catch{n(new Error(`Invalid JSON response for ${o}.`))}else n(new Error(`Server error ${i.statusCode} while fetching ${o}`))})});t.on("error",i=>n(i)),t.write(r),t.end()})}var C=process.argv.slice(2),I=C[0];function Ce(e,o){return`# LE CONTRAT DE DONN\xC9ES FLEETBO (FLEETBO DATA CONTRACT)
|
|
153
|
+
|
|
154
|
+
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.
|
|
155
|
+
|
|
156
|
+
### Pourquoi parlons-nous de \xAB Contrat \xBB ?
|
|
157
|
+
* **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.
|
|
158
|
+
* **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.
|
|
159
|
+
* **Un accord d'ex\xE9cution bilat\xE9ral** :
|
|
160
|
+
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.
|
|
161
|
+
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.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### \u{1F6A8} DIRECTIVE D'EX\xC9CUTION OBLIGATOIRE POUR L'AGENT IA
|
|
166
|
+
1. **Interdiction d'extrapolation** : Ne cr\xE9e aucun champ, type ou endpoint non d\xE9clar\xE9 explicitement dans les contrats scell\xE9s ci-dessous.
|
|
167
|
+
2. **Refus de contournement** : Si un composant n\xE9cessite une donn\xE9e absente du contrat, n'\xE9cris aucun code palliatif : signale imm\xE9diatement le blocage et fournis le prompt de mise \xE0 jour \xE0 ex\xE9cuter dans Fleetbo Studio.
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## \u{1F4CB} CAHIER DES CHARGES M\xC9TIER (CONTEXTE DU PROJET)
|
|
173
|
+
${e?.context||o?.context||"Aucun cahier des charges textuel renseign\xE9."}
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
# FLEETBO SVRO \u2014 CONSIGNES STRICTES POUR L'IA (SYSTEM INSTRUCTIONS)
|
|
178
|
+
|
|
179
|
+
Tu es Alex AI, un expert Fleetbo SVRO (fleetbo-svro).
|
|
180
|
+
Ton r\xF4le est de guider le d\xE9veloppeur ou l'utilisateur et de concevoir des architectures de donn\xE9es d\xE9terministes.
|
|
181
|
+
|
|
182
|
+
================================================================================
|
|
183
|
+
\u{1F6A8} PROTOCOLE UNIVERSEL DE COLLABORATION FRONTEND \u2194 ALEX AI (DATA OS) \u{1F6A8}
|
|
184
|
+
================================================================================
|
|
185
|
+
1. CONTRATS SCELL\xC9S ET IMMUABLES C\xD4T\xC9 CLIENT :
|
|
186
|
+
- L'agent d'interface (frontend) DOIT limiter ses op\xE9rations d'\xE9criture aux seuls champs d\xE9clar\xE9s dans \`svro.schema.json\`.
|
|
187
|
+
- Les formules de calcul, validations, conditions et transitions d'\xE9tat DOIVENT respecter \xE0 la lettre les expressions scell\xE9es dans \`svro.workflow.json\`.
|
|
188
|
+
- 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).
|
|
189
|
+
|
|
190
|
+
2. PROTOCOLE STRICT DE REMOD\xC9LISATION OU RESTRUCTURATION DE DONN\xC9ES :
|
|
191
|
+
- 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 :
|
|
192
|
+
\u{1F449} INTERDICTION FORMELLE d'\xE9crire ou de simuler un contournement c\xF4t\xE9 code client.
|
|
193
|
+
\u{1F449} 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.
|
|
194
|
+
|
|
195
|
+
3. S\xC9PARATION STRICTE DES RESPONSABILIT\xC9S :
|
|
196
|
+
- Agent Frontend : g\xE8re exclusivement l'ergonomie, les composants d'affichage et l'UX.
|
|
197
|
+
- Alex AI : autorit\xE9 exclusive sur la structure physique DDL, la s\xE9curit\xE9 ReBAC et la conformit\xE9 au Cahier des Charges.
|
|
198
|
+
================================================================================
|
|
199
|
+
|
|
200
|
+
================================================================================
|
|
201
|
+
\u{1F6A8} INSTRUCTIONS D'ARCHITECTURE FLEETBO SVRO POUR L'IA (PRIORIT\xC9 ABSOLUE) \u{1F6A8}
|
|
202
|
+
================================================================================
|
|
203
|
+
1. FLEETBO EST LE BACKEND DE DONN\xC9ES & D'AUTHENTIFICATION (Auth + CRUD BDD) :
|
|
204
|
+
- Pour enregistrer, lire, modifier des donn\xE9es ou g\xE9rer les utilisateurs, TU DOIS EXCLUSIVEMENT UTILISER L'OBJET GLOBAL : Fleetbo
|
|
205
|
+
- Ne cr\xE9e AUCUN backend/serveur HTTP interm\xE9diaire (pas d'Express, pas de routes d'API REST locales).
|
|
206
|
+
2. APIS TIERS :
|
|
207
|
+
- L'utilisation de fetch() ou axios reste r\xE9serv\xE9e uniquement aux webhooks tiers (Stripe, etc.). Pour la BDD, Fleetbo.* est le SDK direct.
|
|
208
|
+
================================================================================
|
|
209
|
+
|
|
210
|
+
## \u{1F6E0}\uFE0F SYNTAXE DES M\xC9THODES CRUD DU SDK
|
|
211
|
+
- CREATE : await Fleetbo.add('collection', { name: String(n), price: Number(p) });
|
|
212
|
+
- READ (Tous) : const docs = await Fleetbo.getDocsG('collection');
|
|
213
|
+
- READ (Un seul) : const doc = await Fleetbo.getDoc('collection', id);
|
|
214
|
+
- READ (Utilisateur) : const docs = await Fleetbo.getDocsU('collection');
|
|
215
|
+
- UPDATE : await Fleetbo.update('collection', id, { price: Number(p) });
|
|
216
|
+
- DELETE : await Fleetbo.delete('collection', id);
|
|
217
|
+
- JOIN : await Fleetbo.join('orders', { innerJoin: { collection: 'users', on: ['userId', '==', 'id'], as: 'user' } });
|
|
218
|
+
- CLOUD FUNCTION : await Fleetbo.call('$functionName', payload);
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## \u{1F5C4}\uFE0F CONTRAT DDL PHYSIQUE SCELL\xC9 (svro.schema.json)
|
|
223
|
+
\`\`\`json
|
|
224
|
+
${JSON.stringify(e||{},null,2)}
|
|
225
|
+
\`\`\`
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## \u2699\uFE0F CONTRAT DE GOUVERNANCE ET WORKFLOW (svro.workflow.json)
|
|
230
|
+
\`\`\`json
|
|
231
|
+
${JSON.stringify(o||{},null,2)}
|
|
232
|
+
\`\`\`
|
|
233
|
+
`}async function we(){let e=process.cwd(),o=m.join(e,"package.json");if(I==="init"||I==="doctor")f(`
|
|
234
|
+
[Fleetbo] Initializing and configuring Fleetbo...`),await Te(e,C),ye(e,o),f(`
|
|
145
235
|
[Fleetbo] Configuration completed successfully!
|
|
146
|
-
`),
|
|
147
|
-
Next step:`),
|
|
148
|
-
`);else if(I==="sync"){let
|
|
149
|
-
`),
|
|
150
|
-
`);
|
|
151
|
-
${
|
|
236
|
+
`),f(`
|
|
237
|
+
Next step:`),f(` npx fleetbo-svro sync (Sync cloud schema & generate IDE types)
|
|
238
|
+
`);else if(I==="sync"){let s=C.includes("--dry-run");f(`[Fleetbo] Syncing schema...${s?" (dry-run)":""}`);let n=m.join(e,"svro.schema.json"),r=m.join(e,"svro.workflow.json"),p=m.join(e,"Fleetbo_contract.md"),t=m.join(__dirname,".."),i=m.join(t,"index.d.ts"),l=m.join(e,"src","fleetbo.d.ts"),u=M(e).VITE_FLEETBO_ENTERPRISE_ID,y=null,T=null;if(u)try{f("\u2192 Fetching latest contracts from Fleetbo Cloud..."),y=await V(u,"svro.schema.json"),y&&(d.writeFileSync(n,JSON.stringify(y,null,2)+`
|
|
239
|
+
`),f("\u2192 Local svro.schema.json updated.")),T=await V(u,"svro.workflow.json"),T&&(d.writeFileSync(r,JSON.stringify(T,null,2)+`
|
|
240
|
+
`),f("\u2192 Local svro.workflow.json updated."))}catch(P){S(`\u26A0\uFE0F Cloud fetch bypassed: ${P.message}. Using local file fallback.`)}else S("\u26A0\uFE0F VITE_FLEETBO_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");d.existsSync(n)||(S("Error: svro.schema.json not found."),process.exit(1));let F=y||JSON.parse(d.readFileSync(n,"utf8")),E=T;if(!E&&d.existsSync(r))try{E=JSON.parse(d.readFileSync(r,"utf8"))}catch{}let K=Ce(F,E);d.writeFileSync(p,K,"utf8"),f("\u2192 Fleetbo_contract.md successfully generated at project root.");try{let P=Object.keys(F.collections||{});if(u)try{await Ie(u,F),f("\u2192 Schema successfully sealed at Fleetbo Global Edge (O(1)).")}catch(O){S(`\u26A0\uFE0F Fleetbo Edge Shield sync warning: ${O.message}`)}let W=F.collections||{},k=Object.entries(W).map(([O,R])=>{let G=R.fields||R.schema||{},X=Object.entries(G).map(([z,w])=>{let x="any",v=String(typeof w=="string"?w:w.type||"").toLowerCase();return v==="string"||v==="text"||v==="media"?x="string":v==="number"?x="number":v==="boolean"||v==="toggle"?x="boolean":v==="array"&&(x="any[]"),` ${z}?:${x};`}).join(`
|
|
241
|
+
`);return` ${O}: {
|
|
242
|
+
${X}
|
|
152
243
|
};`}).join(`
|
|
153
|
-
`),
|
|
244
|
+
`),D=P.length>0?P.map(O=>`'${O}'`).join(" | "):"string",Y=`// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
|
|
154
245
|
|
|
155
246
|
export interface FleetboSchemaMap {
|
|
156
|
-
${
|
|
247
|
+
${k}
|
|
157
248
|
}
|
|
158
249
|
|
|
159
|
-
export type KnownFleetboTables = ${
|
|
250
|
+
export type KnownFleetboTables = ${D};
|
|
160
251
|
|
|
161
252
|
export type FleetboTables =
|
|
162
253
|
| KnownFleetboTables
|
|
@@ -413,7 +504,7 @@ declare module 'svelte/elements' {
|
|
|
413
504
|
'fleetbo-reference': FleetboProp;
|
|
414
505
|
}
|
|
415
506
|
}
|
|
416
|
-
`;if(
|
|
507
|
+
`;if(d.writeFileSync(i,Y),d.existsSync(m.dirname(l))){let O=`/* eslint-disable */
|
|
417
508
|
/* prettier-ignore */
|
|
418
509
|
// @ts-nocheck
|
|
419
510
|
// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
|
|
@@ -442,11 +533,11 @@ type FleetboProp = {
|
|
|
442
533
|
};
|
|
443
534
|
|
|
444
535
|
interface FleetboSchemaMap {
|
|
445
|
-
${
|
|
536
|
+
${k}
|
|
446
537
|
}
|
|
447
538
|
|
|
448
539
|
declare global {
|
|
449
|
-
type KnownFleetboTables = ${
|
|
540
|
+
type KnownFleetboTables = ${D};
|
|
450
541
|
type FleetboTables = KnownFleetboTables | (string & { _fleetboPending?: never });
|
|
451
542
|
type FleetboData<T extends string> = T extends KnownFleetboTables
|
|
452
543
|
? Partial<FleetboSchemaMap[T]>
|
|
@@ -547,4 +638,9 @@ declare module 'svelte/elements' {
|
|
|
547
638
|
'fleetbo-reference': FleetboProp;
|
|
548
639
|
}
|
|
549
640
|
}
|
|
550
|
-
`;
|
|
641
|
+
`;d.writeFileSync(l,O)}he(e),Ee(e,o),Se(e),f(`[Fleetbo] Schema synced successfully (${P.length} collection(s)).`),s&&f("\u2192 [Dry-run] Schema is valid.")}catch(P){S(`Error during synchronization: ${P.message}`),process.exit(1)}}else if(I==="mcp"){if(!process.stdin.isTTY||C.includes("--run")){try{await import(`file://${m.join(__dirname,"fleetbo-mcp.js")}`)}catch(c){S(`Failed to start MCP server: ${c.message}`),process.exit(1)}return}f(`
|
|
642
|
+
[Fleetbo] Configuring MCP server for your environment...`);let n=M(e).FLEETBO_DEV_TOKEN||process.env.FLEETBO_DEV_TOKEN||"";if(!n){let c=m.join(N.homedir(),".fleetbo","credentials.json");if(d.existsSync(c))try{n=JSON.parse(d.readFileSync(c,"utf8")).devToken||""}catch{}}let r={command:"npx",args:["-y","fleetbo-svro","mcp","--run"],env:{FLEETBO_DEV_TOKEN:n}},p=(c,u,y)=>{let T=m.dirname(c);d.existsSync(T)||d.mkdirSync(T,{recursive:!0});let F={mcpServers:{}};if(d.existsSync(c))try{let E=JSON.parse(d.readFileSync(c,"utf8"));E&&typeof E=="object"&&!Array.isArray(E)&&(F=E)}catch{}F.mcpServers=F.mcpServers||{},F.mcpServers[u]=y,d.writeFileSync(c,JSON.stringify(F,null,2)+`
|
|
643
|
+
`)},t=m.join(e,".cursor"),i=m.join(t,"mcp.json");p(i,"fleetbo-svro",r),f("\u2192 Configured for Cursor (.cursor/mcp.json)");let l=m.join(N.homedir(),".codeium","windsurf","mcp_config.json");d.existsSync(m.dirname(l))&&(p(l,"fleetbo-svro",r),f("\u2192 Configured for Windsurf (~/.codeium/windsurf/mcp_config.json)")),f(`
|
|
644
|
+
Universal connection command for Claude Code and standalone agents:`),f(` claude mcp add fleetbo-svro -- npx -y fleetbo-svro mcp --run
|
|
645
|
+
`),n?f(`[Fleetbo] Agent ready! Your development environment now has access to Fleetbo MCP tools.
|
|
646
|
+
`):S('\u26A0\uFE0F No developer token found. Run "npx fleetbo-svro login" or set FLEETBO_DEV_TOKEN in your .env file.'),process.exit(0)}else I==="login"?(await xe(e),process.exit(0)):(S('Unknown command. Usage: "npx fleetbo-svro init", "npx fleetbo-svro sync", "npx fleetbo-svro mcp" or "npx fleetbo-svro login"'),process.exit(1))}we().catch(e=>{S(`Fleetbo CLI Error: ${e.message}`),process.exit(1)});
|