fleetbo-svro 1.0.59 → 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 +51 -48
- 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
|
|
|
@@ -185,7 +188,7 @@ Ce document constitue le **Cahier des charges officiel et le Contrat bilat\xE9ra
|
|
|
185
188
|
---
|
|
186
189
|
|
|
187
190
|
## \u{1F4CB} CAHIER DES CHARGES M\xC9TIER (CONTEXTE DU PROJET)
|
|
188
|
-
${
|
|
191
|
+
${t?.context||n?.context||"Aucun cahier des charges textuel renseign\xE9."}
|
|
189
192
|
|
|
190
193
|
---
|
|
191
194
|
|
|
@@ -237,7 +240,7 @@ Ton r\xF4le est de guider le d\xE9veloppeur ou l'utilisateur et de concevoir des
|
|
|
237
240
|
|
|
238
241
|
## \u{1F5C4}\uFE0F CONTRAT DDL PHYSIQUE SCELL\xC9 (svro.schema.json)
|
|
239
242
|
\`\`\`json
|
|
240
|
-
${JSON.stringify(
|
|
243
|
+
${JSON.stringify(t||{},null,2)}
|
|
241
244
|
\`\`\`
|
|
242
245
|
|
|
243
246
|
---
|
|
@@ -246,20 +249,20 @@ ${JSON.stringify(e||{},null,2)}
|
|
|
246
249
|
\`\`\`json
|
|
247
250
|
${JSON.stringify(n||{},null,2)}
|
|
248
251
|
\`\`\`
|
|
249
|
-
`}async function Ce(){let
|
|
250
|
-
[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(`
|
|
251
254
|
[Fleetbo] Configuration completed successfully!
|
|
252
|
-
`),
|
|
253
|
-
Next step:`),
|
|
254
|
-
`);else if(I==="sync"){let s=w.includes("--dry-run");
|
|
255
|
-
`),
|
|
256
|
-
`),
|
|
257
|
-
`,"utf8"),
|
|
258
|
-
`,"utf8"),
|
|
259
|
-
`);return` ${
|
|
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(`
|
|
262
|
+
`);return` ${O}: {
|
|
260
263
|
${X}
|
|
261
264
|
};`}).join(`
|
|
262
|
-
`),D=
|
|
265
|
+
`),D=g.length>0?g.map(O=>`'${O}'`).join(" | "):"string",Y=`// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
|
|
263
266
|
|
|
264
267
|
export interface FleetboSchemaMap {
|
|
265
268
|
${j}
|
|
@@ -522,7 +525,7 @@ declare module 'svelte/elements' {
|
|
|
522
525
|
'fleetbo-reference': FleetboProp;
|
|
523
526
|
}
|
|
524
527
|
}
|
|
525
|
-
`;if(
|
|
528
|
+
`;if(p.writeFileSync(i,Y),p.existsSync(y.dirname(c))){let O=`/* eslint-disable */
|
|
526
529
|
/* prettier-ignore */
|
|
527
530
|
// @ts-nocheck
|
|
528
531
|
// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
|
|
@@ -656,11 +659,11 @@ declare module 'svelte/elements' {
|
|
|
656
659
|
'fleetbo-reference': FleetboProp;
|
|
657
660
|
}
|
|
658
661
|
}
|
|
659
|
-
`;
|
|
660
|
-
[Fleetbo] Configuring MCP server for your environment...`);let l=
|
|
661
|
-
`)},c=y.join(
|
|
662
|
-
Universal connection command for Claude Code and standalone agents:`),
|
|
663
|
-
`),!l)
|
|
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
|
|
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
|
|
664
667
|
|
|
665
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).
|
|
666
669
|
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,8 +671,8 @@ Universal connection command for Claude Code and standalone agents:`),u(` claud
|
|
|
668
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.*.
|
|
669
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.
|
|
670
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.
|
|
671
|
-
`;["AGENTS.md","GEMINI.md","CLAUDE.md",".cursorrules"].forEach(
|
|
672
|
-
`)}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)
|
|
673
676
|
|
|
674
677
|
Commands:
|
|
675
678
|
login Authenticate this machine (opens the browser: approve once, the command exits by itself)
|
|
@@ -682,4 +685,4 @@ Modeling has NO shell command: to evolve the schema/workflow from your UI files,
|
|
|
682
685
|
"fleetbo_update_project" (keyApp is optional), then run "sync" once.
|
|
683
686
|
Run login / mcp at most once each and wait for them to finish. Nothing else needs to be
|
|
684
687
|
discovered: do not search the filesystem or read files outside the project.
|
|
685
|
-
`),process.exit(0)):(
|
|
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)});
|