fimo 2.14.1 → 2.14.2

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.
@@ -22,7 +22,7 @@ fimo preview url --json # cu
22
22
  - **Publish only when the user says to publish, ship, or go live.** Publishing makes the site public.
23
23
  - Local changes to go live: `fimo deploy --publish`. The revision already on Fimo is the release: `fimo publish` (it never pushes).
24
24
  - Check the reported source commit and warnings before you report success. If local work is not in the build, or the built commit is unknown, follow the hint.
25
- - A failed publication usually gives its id (`error.details.publication_id`; else find it with `fimo publish list`). Run `fimo publish inspect <id> --json` for the status and cause, then `fimo publish logs <id> --json` for the build log. The hosting provider can delete old logs: then report that, and do not publish again only to get logs. Older attempts: `fimo publish list --cursor <cursor>` or `--all-pages`.
25
+ - A failed publication usually gives its id (`error.details.publication_id`; else find it with `fimo publish list`). Run `fimo publish inspect <id> --json` for the status and cause, then `fimo publish logs <id> --json` for the build log (a Studio chat agent cannot run it; it reads the cause from `publish inspect`). The hosting provider can delete old logs: then report that, and do not publish again only to get logs. Older attempts: `fimo publish list --cursor <cursor>` or `--all-pages`.
26
26
 
27
27
  ## A failed preview deploy
28
28
 
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "bundled": true,
3
3
  "bundler": "esbuild",
4
- "bundledAt": "2026-11-12T13:46:27.719Z",
5
- "cliVersion": "2.14.1",
4
+ "bundledAt": "2026-11-13T10:12:16.543Z",
5
+ "cliVersion": "2.14.2",
6
6
  "external": [
7
7
  "oxc-parser",
8
8
  "fsevents",
package/dist/cli/index.js CHANGED
@@ -2250,7 +2250,7 @@ function check() {
2250
2250
  for (const f of list) groups.set(f.cls + ' ' + f.id, [...(groups.get(f.cls + ' ' + f.id) || []), f]);
2251
2251
  const namedDrawn = site.named ? site.named.filter((p) => (site.pages[p] || {}).drawn).length : 0;
2252
2252
  const how = site.read !== 'http' ? 'in a browser' : namedDrawn ? 'their HTML, and in a browser the ' + namedDrawn + ' JavaScript draws' : 'their HTML, without a browser';
2253
- const scope = site.named ? 'Checked ' + live + ' of the ' + site.named.length + ' pages named (' + how + ') and the status of the ' + (Object.keys(site.pages).length + Object.keys(site.assets).length - live) + ' addresses of the site they link to' : 'Checked ' + live + ' live pages of ' + Object.keys(site.pages).length + (site.drawn ? ' (' + site.drawn + ' in a browser: JavaScript draws them)' : '');
2253
+ const scope = site.named ? 'Checked ' + live + ' of the ' + site.named.length + ' pages named (' + how + ') and the status of the ' + (Object.keys(site.pages).length + Object.keys(site.assets).length - live) + ' addresses of the site they link to' : 'Checked ' + live + ' pages that answer, of ' + Object.keys(site.pages).length + (site.drawn ? ' (' + site.drawn + ' in a browser: JavaScript draws them)' : '');
2254
2254
  console.log(scope + '; languages: ' + (multilingual ? site.locales.join(', ') || 'several' : 'one') + '; ' + (act.length ? act.length + ' findings' : 'no findings') + (unknown.length ? ' in what could be checked; ' + unknown.length + ' things could not be checked' : '') + '.' + skippedLine(site, '\nNot checked, another site: '));
2255
2255
  if (site.named) console.log('Only the pages named were read: what needs the whole site (pages nothing links to, clicks from home, the title shape most titles share, duplicates on pages not named) was not checked.');
2256
2256
  for (const [, items] of groups) console.log('[' + items[0].cls + '] ' + items[0].id + ' x' + items.length + '\n' + items.slice(0, 8).map((f) => ' ' + f.path + ': ' + f.evidence).join('\n') + (items.length > 8 ? '\n +' + (items.length - 8) + ' more' : ''));
@@ -2899,7 +2899,7 @@ Output
2899
2899
  ${run.output}`:fields},"render")})}__name(renderRunDetail,"renderRunDetail");function renderFields(fields){let width=Math.max(...Object.keys(fields).map(key=>key.length));return Object.entries(fields).map(([key,value])=>`${key.padEnd(width)} ${String(value)}`).join(`
2900
2900
  `)}__name(renderFields,"renderFields");function renderTable(headers,rows){if(rows.length===0)return"No results.";let widths=headers.map((header,index)=>Math.max(header.length,...rows.map(row2=>String(row2[index]??"").length)));return[headers,...rows].map(row2=>row2.map((value,index)=>String(value).padEnd(widths[index])).join(" ").trimEnd()).join(`
2901
2901
  `)}__name(renderTable,"renderTable");function readActiveRunId(body){if(!body||typeof body!="object")return;let value=body.activeRunId;return typeof value=="string"?value:void 0}__name(readActiveRunId,"readActiveRunId");init_esm();init_dist();import fs44 from"node:fs";import path46 from"node:path";import{isDeepStrictEqual}from"node:util";init_sdk_transport();init_project_context();init_project2();var SYSTEM_SCHEMA_FIELDS=new Set(RESERVED_CONTENT_FIELD_NAMES),SchemaCommandError=class extends Error{static{__name(this,"SchemaCommandError")}code;constructor(code2,message,options){super(message,options),this.name="SchemaCommandError",this.code=code2}};function isRecord3(value){return!!(value&&typeof value=="object"&&!Array.isArray(value))}__name(isRecord3,"isRecord");function schemaMatches(actual,expected){if(!isRecord3(actual)||!isRecord3(actual.fields))return!1;let userFields=Object.fromEntries(Object.entries(actual.fields).filter(([fieldName])=>!SYSTEM_SCHEMA_FIELDS.has(fieldName)));return actual.name===expected.name&&actual.label===expected.label&&actual.isSingleton===expected.isSingleton&&isDeepStrictEqual(actual.i18n,expected.i18n)&&(actual.description??null)===expected.description&&isDeepStrictEqual(actual.groups??[],expected.groups)&&isDeepStrictEqual(userFields,expected.fields)}__name(schemaMatches,"schemaMatches");async function readBackSchemaBatch(fimo,projectId2,branch,schemas3){let checks=await Promise.all(schemas3.map(async schema=>{try{let actual=await fimo.execute("schemas.get",{projectId:projectId2,branch,typeName:schema.name});return{name:schema.name,actual,state:schemaMatches(actual,schema)?"matched":"mismatched"}}catch(error){if(error instanceof ApiRequestError&&error.status===404)return{name:schema.name,state:"absent"};throw error}})),matched=checks.filter(check=>check.state==="matched"),absent=checks.filter(check=>check.state==="absent"),mismatched=checks.filter(check=>check.state==="mismatched");return matched.length===schemas3.length?{state:"committed",results:matched.map(check=>check.actual)}:absent.length===schemas3.length?{state:"absent"}:{state:"ambiguous",details:[matched.length>0?`matched: ${matched.map(check=>check.name).join(", ")}`:null,absent.length>0?`absent: ${absent.map(check=>check.name).join(", ")}`:null,mismatched.length>0?`mismatched: ${mismatched.map(check=>check.name).join(", ")}`:null].filter(Boolean).join("; ")}}__name(readBackSchemaBatch,"readBackSchemaBatch");async function upsertSchemasWithReconciliation(fimo,projectId2,branch,schemas3,operations){let timeout;try{return await fimo.execute("schemas.upsertBatch",{projectId:projectId2,branch,contentTypes:schemas3,operations:[...operations]})}catch(error){if(!(error instanceof ApiRequestError)||error.status!==504)throw error;timeout=error}let firstReadBack=await readBackAfterTimeout(fimo,projectId2,branch,schemas3,timeout);if(firstReadBack.state==="committed")return firstReadBack.results;if(firstReadBack.state==="ambiguous")throw ambiguousSchemaPushError(firstReadBack.details,timeout);try{return await fimo.execute("schemas.upsertBatch",{projectId:projectId2,branch,contentTypes:schemas3,operations:[...operations]})}catch(error){if(!(error instanceof ApiRequestError)||error.status!==504)throw error;timeout=error}let secondReadBack=await readBackAfterTimeout(fimo,projectId2,branch,schemas3,timeout);if(secondReadBack.state==="committed")return secondReadBack.results;let detail=secondReadBack.state==="absent"?"all requested schemas remain absent after one retry":secondReadBack.details;throw ambiguousSchemaPushError(detail,timeout)}__name(upsertSchemasWithReconciliation,"upsertSchemasWithReconciliation");function ambiguousSchemaPushError(detail,cause){return new SchemaCommandError("SCHEMA_PUSH_AMBIGUOUS",`Schema push returned an ambiguous 504 (${detail}). No further write was attempted; read the schemas back before rerunning.`,{cause})}__name(ambiguousSchemaPushError,"ambiguousSchemaPushError");async function readBackAfterTimeout(fimo,projectId2,branch,schemas3,timeout){try{return await readBackSchemaBatch(fimo,projectId2,branch,schemas3)}catch(error){let detail=error instanceof Error?error.message:String(error);throw new SchemaCommandError("SCHEMA_PUSH_AMBIGUOUS",`Schema push returned an ambiguous 504 and read-back failed (${detail}). No retry was attempted.`,{cause:timeout})}}__name(readBackAfterTimeout,"readBackAfterTimeout");function renameOperation(contentType,value){let separator=value.indexOf("="),from=value.slice(0,separator).trim(),to=value.slice(separator+1).trim();if(separator<=0||!from||!to||to.includes("="))throw new SchemaCommandError("SCHEMA_RENAME_INVALID",`Invalid --rename "${value}". Use --rename old.path=new.path.`);return{type:"renameField",contentType,from,to}}__name(renameOperation,"renameOperation");function toApiShape(schema){return{name:schema.uid,label:schema.name,isSingleton:schema.isSingleton??!1,i18n:schema.i18n??{enabled:!0},description:schema.description??null,groups:schema.groups??[],fields:schema.fields}}__name(toApiShape,"toApiShape");function renderPrettyJson8(data){return JSON.stringify(data,null,2)}__name(renderPrettyJson8,"renderPrettyJson");function isUniqueConflictIssue(issue2){if(!issue2||typeof issue2!="object"||Array.isArray(issue2))return!1;let candidate=issue2;return candidate.kind==="unique_conflict"&&typeof candidate.contentType=="string"&&typeof candidate.field=="string"&&typeof candidate.value=="string"&&typeof candidate.documentCount=="number"&&Array.isArray(candidate.documentIds)&&candidate.documentIds.every(id=>typeof id=="string")&&(candidate.documentIdsTruncated===void 0||typeof candidate.documentIdsTruncated=="boolean")}__name(isUniqueConflictIssue,"isUniqueConflictIssue");function getUniqueConflictIssues(body){if(!body||typeof body!="object"||Array.isArray(body))return null;let issues=body.issues;return Array.isArray(issues)?issues.filter(isUniqueConflictIssue):null}__name(getUniqueConflictIssues,"getUniqueConflictIssues");function renderSchemaTransitionRejected(body,issues){currentMode().format==="json"?ui.result({command:"schemas push",data:body,render:__name(()=>"","render")}):ui.table({command:"schemas push",headline:"Schema push rejected. Nothing was written.",columns:[{key:"content_type",label:"CONTENT TYPE"},{key:"field",label:"FIELD"},{key:"value",label:"VALUE"},{key:"documents",label:"DOCUMENTS"},{key:"document_ids",label:"DOCUMENT IDS"}],rows:issues.map(issue2=>{let remaining=Math.max(issue2.documentCount-issue2.documentIds.length,0),truncationNote=remaining>0?`... and ${remaining} more`:"... and more";return{content_type:issue2.contentType,field:issue2.field,value:issue2.value,documents:issue2.documentCount,document_ids:issue2.documentIdsTruncated?[...issue2.documentIds,truncationNote].join(", "):issue2.documentIds.join(", ")}})}),process.exitCode=1}__name(renderSchemaTransitionRejected,"renderSchemaTransitionRejected");async function schemaListCommand(options,cmd){let{ctx,fimo}=await bootstrapProjectCommand(options,cmd);await requireOperation("cms.schema.list",{projectId:ctx.projectId,branch:ctx.branch});let result=await fimo.execute("schemas.list",{projectId:ctx.projectId,branch:ctx.branch});ui.result({command:"schemas list",data:result,render:__name(()=>renderPrettyJson8(result),"render")})}__name(schemaListCommand,"schemaListCommand");async function schemaGetCommand(typeName,options,cmd){let{ctx,fimo}=await bootstrapProjectCommand(options,cmd);await requireOperation("cms.schema.get",{projectId:ctx.projectId,branch:ctx.branch});let result=await fimo.execute("schemas.get",{projectId:ctx.projectId,branch:ctx.branch,typeName});ui.result({command:"schemas get",data:result,render:__name(()=>renderPrettyJson8(result),"render")})}__name(schemaGetCommand,"schemaGetCommand");async function schemaPushCommand(typeName,options,cmd){if((options.rename?.length??0)>0&&!typeName)throw new SchemaCommandError("SCHEMA_RENAME_REQUIRES_TYPE","--rename requires one schema name: fimo schemas push <typeName> --rename old.path=new.path.");let{ctx,fimo}=await bootstrapProjectCommand(options,cmd,{refuseReadOnly:!0});await requireOperation("cms.schema.push",{projectId:ctx.projectId,branch:ctx.branch});let cwd=resolveProjectCwd(options.cwd),schemasDir=path46.join(cwd,"src/schemas"),allSchemaFiles=fs44.readdirSync(schemasDir).filter(file=>file.endsWith(".json")),files2=typeName?[`${typeName}.json`]:allSchemaFiles,schemaUids=new Set(allSchemaFiles.flatMap(file=>{try{let schema=JSON.parse(fs44.readFileSync(path46.join(schemasDir,file),"utf-8"));return typeof schema.uid=="string"?[schema.uid]:[]}catch{return[]}})),schemas3=files2.map(file=>{let filePath=path46.join(schemasDir,file);if(!fs44.existsSync(filePath))throw new Error(`Schema file not found: ${filePath}`);let issues=validateSchemaFile(filePath,path46.join("src/schemas",file),schemaUids);if(issues.length>0)throw new Error(issues.map(issue2=>`${issue2.file}: ${issue2.message}`).join(`
2902
- `));return JSON.parse(fs44.readFileSync(filePath,"utf-8"))}),framework=await detectProjectFramework(cwd);syncSchemas({cwd,framework:framework?.slug??null,verbose:!1});let operations=schemas3.length===1?(options.rename??[]).map(value=>renameOperation(schemas3[0].uid,value)):[],results;try{results=await upsertSchemasWithReconciliation(fimo,ctx.projectId,ctx.branch,schemas3.map(schema=>toApiShape(schema)),operations)}catch(error){if(error instanceof ApiRequestError&&error.code==="schema_transition_rejected"){let issues=getUniqueConflictIssues(error.body);if(issues){renderSchemaTransitionRejected(error.body,issues);return}}throw error}let payload=results.length===1?results[0]:results;ui.result({command:"schemas push",data:payload,render:__name(()=>renderPrettyJson8(payload),"render")})}__name(schemaPushCommand,"schemaPushCommand");async function schemaDeleteCommand(typeName,options,cmd){let{ctx,fimo}=await bootstrapProjectCommand(options,cmd,{refuseReadOnly:!0});await requireOperation("cms.schema.delete",{projectId:ctx.projectId,branch:ctx.branch});let result=await fimo.execute("schemas.deleteFromBranch",{projectId:ctx.projectId,branch:ctx.branch,typeName});ui.result({command:"schemas delete",data:result,render:__name(()=>renderPrettyJson8(result),"render")})}__name(schemaDeleteCommand,"schemaDeleteCommand");init_dist();init_project_context();var SinglesInputError=class extends Error{static{__name(this,"SinglesInputError")}constructor(message){super(message),this.name="SinglesInputError"}};function renderPrettyJson9(data){return JSON.stringify(data,null,2)}__name(renderPrettyJson9,"renderPrettyJson");function parseJsonObject2(value){let parsed;try{parsed=JSON.parse(value)}catch(error){throw new SinglesInputError(error instanceof Error?`Invalid JSON: ${error.message}`:"Invalid JSON.")}if(!parsed||typeof parsed!="object"||Array.isArray(parsed))throw new SinglesInputError("Expected a JSON object.");return parsed}__name(parseJsonObject2,"parseJsonObject");async function singlesGetCommand(typeName,options,cmd){let{ctx,fimo}=await bootstrapProjectCommand(options,cmd);await requireOperation("cms.get",{projectId:ctx.projectId,branch:ctx.branch});let{data:result}=await fimo.execute("singles.get",{projectId:ctx.projectId,branch:ctx.branch,typeName,locale:options.locale,populate:options.populate?[options.populate]:void 0});ui.result({command:"singles get",data:result,render:__name(()=>renderPrettyJson9(result),"render")})}__name(singlesGetCommand,"singlesGetCommand");async function singlesUpdateCommand(typeName,options,cmd){let{ctx,fimo}=await bootstrapProjectCommand(options,cmd,{refuseReadOnly:!0});await requireOperation("cms.update",{projectId:ctx.projectId,branch:ctx.branch});let input=parseJsonObject2(await readContentInputSource(options,message=>new SinglesInputError(message))),{data:result}=await fimo.execute("singles.update",{projectId:ctx.projectId,branch:ctx.branch,typeName,locale:options.locale,data:input.data});ui.result({command:"singles update",data:result,render:__name(()=>renderPrettyJson9(result),"render")})}__name(singlesUpdateCommand,"singlesUpdateCommand");import{spawn as spawn3}from"node:child_process";import{mkdtempSync as mkdtempSync2,rmSync,writeFileSync as writeFileSync6}from"node:fs";import{tmpdir as tmpdir5}from"node:os";import path47 from"node:path";init_esm();init_dist();init_config();init_project_services();init_git();init_project_context();init_project2();var PREVIEW_WAIT_MS=9e4,DEV_SERVER_URL="http://localhost:5173",MAX_PAGES=50,DEADLINE_SECONDS=300,SiteCommandError=class extends Error{constructor(message,hint){super(message);this.hint=hint;this.name="SiteCommandError"}static{__name(this,"SiteCommandError")}};function normalizePagePaths(args,all=!1){if(all){if(args.length>0)throw new SiteCommandError("--all reads every page: name no page with it.","Run `fimo site check --all`.");return[]}let out=[];for(let raw of args.flatMap(a2=>a2.split(/\s+/)).filter(Boolean)){let p;try{let u4=new URL(raw,"http://site.invalid");p=u4.pathname+u4.search}catch{throw new SiteCommandError(`'${raw}' is not a page path.`,"Name pages by path, for example `/pricing` or `/blog/my-post`.")}out.includes(p)||out.push(p)}if(out.length===0)throw new SiteCommandError("Name at least one page, or pass --all.","For example `fimo site check / /pricing`, or `fimo site check --all` for the whole site.");if(out.length>MAX_PAGES)throw new SiteCommandError(`${out.length} pages named; this checks at most ${MAX_PAGES} at once.`,"Check the pages the change affects, in batches if needed.");return out}__name(normalizePagePaths,"normalizePagePaths");async function answers(origin){try{return await fetch(origin+"/",{redirect:"manual",signal:AbortSignal.timeout(1e4)}),!0}catch{return!1}}__name(answers,"answers");function previewProblem(wait,branch,waitMs){switch(wait.kind){case"none":return`Branch '${branch}' has no hosted preview`;case"failed":return`the hosted preview of '${branch}' failed to build`;case"pending":return`the hosted preview of '${branch}' is still ${wait.preview.status==="queued"?"waiting to build":"building"} after ${Math.round(waitMs/1e3)} s`;case"no-url":return`the hosted preview of '${branch}' is ready but has no URL`}}__name(previewProblem,"previewProblem");async function resolveSiteTarget(input){if(input.url)try{return{kind:"url",origin:new URL(input.url).origin}}catch{throw new SiteCommandError(`--url '${input.url}' is not a URL.`,"Pass an origin such as http://localhost:5173.")}if(isProductionBranch(input.branch))throw new SiteCommandError(`Branch '${input.branch}' is production and has no hosted preview.`,"Check the live site with --branch main (main's hosted preview), or the published address with --url <origin>.");let wait=await waitForHostedPreview(input.readPreview,input.waitMs??PREVIEW_WAIT_MS,input.sleep);if(wait.kind==="ready")return{kind:"hosted-preview",origin:new URL(wait.url).origin,generation:wait.preview.generation,revision:wait.preview.revision};let why=previewProblem(wait,input.branch,input.waitMs??PREVIEW_WAIT_MS),ownBranch=input.checkoutBranch===input.branch;if(ownBranch&&await(input.devServerAnswers??answers)(DEV_SERVER_URL))return{kind:"dev-server",origin:DEV_SERVER_URL,why};let retry=wait.kind==="pending"?"Run the command again in a minute.":wait.kind==="failed"?"The hosted preview is a production build that Fimo runs apart from your dev server, so `fimo logs` does not show its error. Run the site's production build locally (its `build` script, for example `npm run build`) to see the error, fix it, then deploy again.":"Deploy a change to ask for a hosted preview (`fimo deploy`).";throw new SiteCommandError(`Cannot check the site: ${why}${ownBranch?`, and no dev server answers at ${DEV_SERVER_URL}`:""}.`,`${retry} Or pass --url <origin> to check another address.`)}__name(resolveSiteTarget,"resolveSiteTarget");function runScript(file,args,cwd,siteDir){return new Promise((resolve10,reject)=>{let child=spawn3(process.execPath,[file,...args],{cwd,env:siteDir?{...process.env,FIMO_SITE_DIR:siteDir}:process.env,stdio:["ignore","pipe","pipe"]}),stdout2="",stderr="";child.stdout.on("data",d=>stdout2+=d.toString("utf8")),child.stderr.on("data",d=>stderr+=d.toString("utf8")),child.on("error",reject),child.on("close",code2=>resolve10({code:code2??1,stdout:stdout2.trim(),stderr:stderr.trim()}))})}__name(runScript,"runScript");async function readPages(input){let dir=mkdtempSync2(path47.join(tmpdir5(),"fimo-site-")),siteDir=input.all?void 0:dir;try{let script=path47.join(dir,"site.mjs"),pages2=path47.join(dir,"pages.txt");writeFileSync6(script,SITE_SCRIPT),writeFileSync6(pages2,input.paths.join(`
2902
+ `));return JSON.parse(fs44.readFileSync(filePath,"utf-8"))}),framework=await detectProjectFramework(cwd);syncSchemas({cwd,framework:framework?.slug??null,verbose:!1});let operations=schemas3.length===1?(options.rename??[]).map(value=>renameOperation(schemas3[0].uid,value)):[],results;try{results=await upsertSchemasWithReconciliation(fimo,ctx.projectId,ctx.branch,schemas3.map(schema=>toApiShape(schema)),operations)}catch(error){if(error instanceof ApiRequestError&&error.code==="schema_transition_rejected"){let issues=getUniqueConflictIssues(error.body);if(issues){renderSchemaTransitionRejected(error.body,issues);return}}throw error}let payload=results.length===1?results[0]:results;ui.result({command:"schemas push",data:payload,render:__name(()=>renderPrettyJson8(payload),"render")})}__name(schemaPushCommand,"schemaPushCommand");async function schemaDeleteCommand(typeName,options,cmd){let{ctx,fimo}=await bootstrapProjectCommand(options,cmd,{refuseReadOnly:!0});await requireOperation("cms.schema.delete",{projectId:ctx.projectId,branch:ctx.branch});let result=await fimo.execute("schemas.deleteFromBranch",{projectId:ctx.projectId,branch:ctx.branch,typeName});ui.result({command:"schemas delete",data:result,render:__name(()=>renderPrettyJson8(result),"render")})}__name(schemaDeleteCommand,"schemaDeleteCommand");init_dist();init_project_context();var SinglesInputError=class extends Error{static{__name(this,"SinglesInputError")}constructor(message){super(message),this.name="SinglesInputError"}};function renderPrettyJson9(data){return JSON.stringify(data,null,2)}__name(renderPrettyJson9,"renderPrettyJson");function parseJsonObject2(value){let parsed;try{parsed=JSON.parse(value)}catch(error){throw new SinglesInputError(error instanceof Error?`Invalid JSON: ${error.message}`:"Invalid JSON.")}if(!parsed||typeof parsed!="object"||Array.isArray(parsed))throw new SinglesInputError("Expected a JSON object.");return parsed}__name(parseJsonObject2,"parseJsonObject");async function singlesGetCommand(typeName,options,cmd){let{ctx,fimo}=await bootstrapProjectCommand(options,cmd);await requireOperation("cms.get",{projectId:ctx.projectId,branch:ctx.branch});let{data:result}=await fimo.execute("singles.get",{projectId:ctx.projectId,branch:ctx.branch,typeName,locale:options.locale,populate:options.populate?[options.populate]:void 0});ui.result({command:"singles get",data:result,render:__name(()=>renderPrettyJson9(result),"render")})}__name(singlesGetCommand,"singlesGetCommand");async function singlesUpdateCommand(typeName,options,cmd){let{ctx,fimo}=await bootstrapProjectCommand(options,cmd,{refuseReadOnly:!0});await requireOperation("cms.update",{projectId:ctx.projectId,branch:ctx.branch});let input=parseJsonObject2(await readContentInputSource(options,message=>new SinglesInputError(message))),{data:result}=await fimo.execute("singles.update",{projectId:ctx.projectId,branch:ctx.branch,typeName,locale:options.locale,data:input.data});ui.result({command:"singles update",data:result,render:__name(()=>renderPrettyJson9(result),"render")})}__name(singlesUpdateCommand,"singlesUpdateCommand");import{spawn as spawn3}from"node:child_process";import{mkdtempSync as mkdtempSync2,rmSync,writeFileSync as writeFileSync6}from"node:fs";import{tmpdir as tmpdir5}from"node:os";import path47 from"node:path";init_esm();init_dist();init_config();init_project_services();init_git();init_project_context();init_project2();var PREVIEW_WAIT_MS=9e4,DEV_SERVER_URL="http://localhost:5173",MAX_PAGES=50,DEADLINE_SECONDS=300,SiteCommandError=class extends Error{constructor(message,hint){super(message);this.hint=hint;this.name="SiteCommandError"}static{__name(this,"SiteCommandError")}};function normalizePagePaths(args,all=!1){if(all){if(args.length>0)throw new SiteCommandError("--all reads every page: name no page with it.","Run `fimo site check --all`.");return[]}let out=[];for(let raw of args.flatMap(a2=>a2.split(/\s+/)).filter(Boolean)){let p;try{let u4=new URL(raw,"http://site.invalid");p=u4.pathname+u4.search}catch{throw new SiteCommandError(`'${raw}' is not a page path.`,"Name pages by path, for example `/pricing` or `/blog/my-post`.")}out.includes(p)||out.push(p)}if(out.length===0)throw new SiteCommandError("Name at least one page, or pass --all.","For example `fimo site check / /pricing`, or `fimo site check --all` for the whole site.");if(out.length>MAX_PAGES)throw new SiteCommandError(`${out.length} pages named; this checks at most ${MAX_PAGES} at once.`,"Check the pages the change affects, in batches if needed.");return out}__name(normalizePagePaths,"normalizePagePaths");async function answers(origin){try{return await fetch(origin+"/",{redirect:"manual",signal:AbortSignal.timeout(1e4)}),!0}catch{return!1}}__name(answers,"answers");function previewProblem(wait,branch,waitMs){switch(wait.kind){case"none":return`Branch '${branch}' has no hosted preview`;case"failed":return`the hosted preview of '${branch}' failed to build`;case"pending":return`the hosted preview of '${branch}' is still ${wait.preview.status==="queued"?"waiting to build":"building"} after ${Math.round(waitMs/1e3)} s`;case"no-url":return`the hosted preview of '${branch}' is ready but has no URL`}}__name(previewProblem,"previewProblem");async function resolveSiteTarget(input){if(input.url)try{return{kind:"url",origin:new URL(input.url).origin}}catch{throw new SiteCommandError(`--url '${input.url}' is not a URL.`,"Pass an origin such as http://localhost:5173.")}if(isProductionBranch(input.branch))throw new SiteCommandError(`Branch '${input.branch}' is production and has no hosted preview.`,"Check main's preview with --branch main, or the published site at its address with --url <origin>.");let wait=await waitForHostedPreview(input.readPreview,input.waitMs??PREVIEW_WAIT_MS,input.sleep);if(wait.kind==="ready")return{kind:"hosted-preview",origin:new URL(wait.url).origin,generation:wait.preview.generation,revision:wait.preview.revision};let why=previewProblem(wait,input.branch,input.waitMs??PREVIEW_WAIT_MS),ownBranch=input.checkoutBranch===input.branch;if(ownBranch&&await(input.devServerAnswers??answers)(DEV_SERVER_URL))return{kind:"dev-server",origin:DEV_SERVER_URL,why};let retry=wait.kind==="pending"?"Run the command again in a minute.":wait.kind==="failed"?"The hosted preview is a production build that Fimo runs apart from your dev server, so `fimo logs` does not show its error. Run the site's production build locally (its `build` script, for example `npm run build`) to see the error, fix it, then deploy again.":"Deploy a change to ask for a hosted preview (`fimo deploy`).";throw new SiteCommandError(`Cannot check the site: ${why}${ownBranch?`, and no dev server answers at ${DEV_SERVER_URL}`:""}.`,`${retry} Or pass --url <origin> to check another address.`)}__name(resolveSiteTarget,"resolveSiteTarget");function runScript(file,args,cwd,siteDir){return new Promise((resolve10,reject)=>{let child=spawn3(process.execPath,[file,...args],{cwd,env:siteDir?{...process.env,FIMO_SITE_DIR:siteDir}:process.env,stdio:["ignore","pipe","pipe"]}),stdout2="",stderr="";child.stdout.on("data",d=>stdout2+=d.toString("utf8")),child.stderr.on("data",d=>stderr+=d.toString("utf8")),child.on("error",reject),child.on("close",code2=>resolve10({code:code2??1,stdout:stdout2.trim(),stderr:stderr.trim()}))})}__name(runScript,"runScript");async function readPages(input){let dir=mkdtempSync2(path47.join(tmpdir5(),"fimo-site-")),siteDir=input.all?void 0:dir;try{let script=path47.join(dir,"site.mjs"),pages2=path47.join(dir,"pages.txt");writeFileSync6(script,SITE_SCRIPT),writeFileSync6(pages2,input.paths.join(`
2903
2903
  `)+`
2904
2904
  `);let crawlArgs=input.all?["crawl",input.origin,"--fresh",...input.seed?["--seed",path47.resolve(input.seed)]:[]]:["crawl",input.origin,"--pages",pages2,"--deadline",String(DEADLINE_SECONDS),"--fresh"];input.browser?(crawlArgs.push("--parallel","2"),__name((...topics)=>input.topics.length===0||input.topics.some(t2=>topics.includes(t2)),"reads")("accessibility","mobile")&&crawlArgs.push("--quality"),input.topics.some(t2=>t2==="consent"||t2==="privacy")&&crawlArgs.push("--compliance")):crawlArgs.push("--http");let read=await runScript(script,crawlArgs,input.projectDir,siteDir);if(read.code!==0)throw new SiteCommandError(read.stdout.split(`
2905
2905
  `).filter(Boolean).pop()||read.stderr||"The pages could not be read.",input.browser?"Check that agent-browser is installed (`agent-browser --version`).":`Check that ${input.origin} answers.`);let report2=await runScript(script,[...input.report],input.projectDir,siteDir);if(report2.code!==0)throw new SiteCommandError(report2.stdout||report2.stderr||"The check failed.","Run the command again.");return{read:read.stdout,report:report2.stdout}}finally{rmSync(dir,{recursive:!0,force:!0})}}__name(readPages,"readPages");async function checkoutBranchOf(projectDir){try{let branch=(await currentBranch2(projectDir)).trim();if(branch)return branch}catch{}return process.env.FIMO_ENV?.trim()||null}__name(checkoutBranchOf,"checkoutBranchOf");function targetLine(target,branch){switch(target.kind){case"hosted-preview":return`Hosted preview of '${branch}' (${target.origin}${target.revision?`, revision ${target.revision.slice(0,7)}`:""}).`;case"dev-server":return`Dev server ${target.origin}: ${target.why}.`;case"url":return`${target.origin} (--url).`}}__name(targetLine,"targetLine");async function runSiteCommand(command,pathArgs,options,cmd){try{let all=options.all===!0,paths=normalizePagePaths(pathArgs,all),{ctx}=await bootstrapProjectCommand(options,cmd);await requireOperation("fimo.site.check",{projectId:ctx.projectId,branch:ctx.branch});let sandbox=createSandboxService(loadConfig(),ctx.branch),projectDir=resolveProjectCwd(options.cwd),target=await resolveSiteTarget({url:options.url,branch:ctx.branch,checkoutBranch:await checkoutBranchOf(projectDir),readPreview:__name(()=>sandbox.getHostedPreview(ctx.projectId,ctx.branch),"readPreview")}),topics=(options.topic??"").split(",").map(t2=>t2.trim()).filter(Boolean),browser=command==="site check"&&options.browser===!0,{read,report:report2}=await readPages({origin:target.origin,paths,all,seed:options.seed,browser,topics,report:command==="site links"?["links"]:["check",...topics.length?["--topic",topics.join(",")]:[]],projectDir}),text2=[targetLine(target,ctx.branch),read,report2].filter(Boolean).join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fimo",
3
- "version": "2.14.1",
3
+ "version": "2.14.2",
4
4
  "description": "CLI for Fimo, the website platform for sites built with coding agents: CMS, previews, site agents, and hosting. Create, deploy, and manage Fimo sites.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -202,13 +202,13 @@
202
202
  "devDependencies": {
203
203
  "@clack/core": "^1.5.1",
204
204
  "@clack/prompts": "^1.8.1",
205
- "@fimo/agents-bundle": "2.14.1",
206
- "@fimo/api-contracts": "2.14.1",
207
- "@fimo/cli-kit": "2.14.1",
208
- "@fimo/framework-detect": "2.14.1",
209
- "@fimo/routes": "2.14.1",
210
- "@fimo/sdk": "2.14.1",
211
- "@fimo/tsconfig": "2.14.1",
205
+ "@fimo/agents-bundle": "2.14.2",
206
+ "@fimo/api-contracts": "2.14.2",
207
+ "@fimo/cli-kit": "2.14.2",
208
+ "@fimo/framework-detect": "2.14.2",
209
+ "@fimo/routes": "2.14.2",
210
+ "@fimo/sdk": "2.14.2",
211
+ "@fimo/tsconfig": "2.14.2",
212
212
  "@types/node": "22.18.6",
213
213
  "agent-install": "^0.0.5",
214
214
  "astro": "^7.4.5",
@@ -9,9 +9,9 @@
9
9
  "check": "astro sync && astro check"
10
10
  },
11
11
  "dependencies": {
12
- "fimo": "2.14.1",
13
- "fimo-analytics": "2.14.1",
14
- "fimo-astro": "2.14.1",
12
+ "fimo": "2.14.2",
13
+ "fimo-analytics": "2.14.2",
14
+ "fimo-astro": "2.14.2",
15
15
  "zod": "^4.4.3"
16
16
  },
17
17
  "devDependencies": {
@@ -12,10 +12,10 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@tanstack/react-query": "^5.80.6",
15
- "fimo": "2.14.1",
16
- "fimo-analytics": "2.14.1",
17
- "fimo-next": "2.14.1",
18
- "fimo-react": "2.14.1",
15
+ "fimo": "2.14.2",
16
+ "fimo-analytics": "2.14.2",
17
+ "fimo-next": "2.14.2",
18
+ "fimo-react": "2.14.2",
19
19
  "next": "16.4.2",
20
20
  "react": "^19.2.7",
21
21
  "react-dom": "^19.2.7",
@@ -21,11 +21,11 @@
21
21
  "cn": "0.2.4",
22
22
  "date-fns": "^4.1.0",
23
23
  "embla-carousel-react": "^8.6.0",
24
- "fimo": "2.14.1",
25
- "fimo-analytics": "2.14.1",
26
- "fimo-react": "2.14.1",
27
- "fimo-react-router": "2.14.1",
28
- "fimo-vite": "2.14.1",
24
+ "fimo": "2.14.2",
25
+ "fimo-analytics": "2.14.2",
26
+ "fimo-react": "2.14.2",
27
+ "fimo-react-router": "2.14.2",
28
+ "fimo-vite": "2.14.2",
29
29
  "input-otp": "^1.4.2",
30
30
  "isbot": "^5",
31
31
  "lucide-react": "^0.577.0",
@@ -11,9 +11,9 @@
11
11
  "prepare": "svelte-kit sync"
12
12
  },
13
13
  "dependencies": {
14
- "fimo": "2.14.1",
15
- "fimo-analytics": "2.14.1",
16
- "fimo-sveltekit": "2.14.1",
14
+ "fimo": "2.14.2",
15
+ "fimo-analytics": "2.14.2",
16
+ "fimo-sveltekit": "2.14.2",
17
17
  "zod": "^4.4.3"
18
18
  },
19
19
  "devDependencies": {
@@ -11,11 +11,11 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@tanstack/react-query": "^5.80.6",
14
- "fimo": "2.14.1",
15
- "fimo-analytics": "2.14.1",
16
- "fimo-react": "2.14.1",
17
- "fimo-react-router": "2.14.1",
18
- "fimo-vite": "2.14.1",
14
+ "fimo": "2.14.2",
15
+ "fimo-analytics": "2.14.2",
16
+ "fimo-react": "2.14.2",
17
+ "fimo-react-router": "2.14.2",
18
+ "fimo-vite": "2.14.2",
19
19
  "react": "^19.2.7",
20
20
  "react-dom": "^19.2.7",
21
21
  "react-router": "^8.3.0",