@farm.js/cli 0.1.0-beta.14 → 0.1.0-beta.17

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/bin/farm.js CHANGED
@@ -144,6 +144,7 @@ program
144
144
  )
145
145
  .option("--dialect <dialect>", "SQL dialect for Drizzle generation (postgres, mysql, sqlite)")
146
146
  .option("-o, --output <output>", "Custom output path")
147
+ .option("--check", "Fail when committed generated framework types are stale")
147
148
  .action(async (options) => {
148
149
  try {
149
150
  const { generateFarmArtifacts } = require("../dist/index.js");
@@ -153,6 +154,7 @@ program
153
154
  orm: options.orm,
154
155
  dialect: options.dialect,
155
156
  output: options.output,
157
+ check: options.check,
156
158
  });
157
159
  } catch (error) {
158
160
  console.error("Failed to generate Farm artifacts:", error);
@@ -169,6 +171,7 @@ program
169
171
  .option("--host <host>", "Host of a running local app")
170
172
  .option("--url <url>", "Base URL of a running Farm app")
171
173
  .option("--offline", "Inspect project files without probing a running app")
174
+ .option("--fix", "Apply safe additive corrections without overwriting application files")
172
175
  .option("--timeout <ms>", "Live runtime probe timeout in milliseconds", "1200")
173
176
  .option("--json", "Print machine-readable JSON")
174
177
  .action(async (options) => {
@@ -185,6 +188,7 @@ program
185
188
  host: options.host,
186
189
  url: options.url,
187
190
  offline: options.offline,
191
+ fix: options.fix,
188
192
  timeoutMs,
189
193
  });
190
194
  console.log(options.json ? JSON.stringify(report, null, 2) : formatFarmDoctorReport(report));
@@ -195,6 +199,30 @@ program
195
199
  }
196
200
  });
197
201
 
202
+ program
203
+ .command("explain <path>")
204
+ .description("Explain how a URL maps to a Farm route and deployment runtime")
205
+ .option("-r, --root <root>", "Root directory", process.cwd())
206
+ .option("-c, --config <config>", "Path to farm config file")
207
+ .option("--json", "Print machine-readable JSON")
208
+ .action(async (pathname, options) => {
209
+ try {
210
+ const { explainFarmRoute, formatFarmRouteExplanation } = require("../dist/index.js");
211
+ const explanation = await explainFarmRoute(pathname, {
212
+ root: options.root,
213
+ configPath: options.config,
214
+ });
215
+ console.log(
216
+ options.json
217
+ ? JSON.stringify(explanation, null, 2)
218
+ : formatFarmRouteExplanation(explanation),
219
+ );
220
+ } catch (error) {
221
+ console.error("Failed to explain Farm route:", error);
222
+ process.exit(1);
223
+ }
224
+ });
225
+
198
226
  program
199
227
  .command("preview")
200
228
  .description("Create a public URL for a running local Farm app")
@@ -433,14 +461,17 @@ program
433
461
  .option("--cloudflare", "Deploy to Cloudflare")
434
462
  .option("--netlify", "Deploy to Netlify")
435
463
  .option("--prod", "Deploy to production (Vercel: uses prebuilt output)")
464
+ .option("--plan", "Print the resolved deployment plan without building or deploying")
436
465
  .option("--custom", "Use your own credentials (not Farm.js managed)")
437
466
  .action(async (options) => {
438
467
  try {
439
468
  const { deployFarm } = require("../dist/index.js");
440
469
  await deployFarm(options);
441
470
  } catch (error) {
442
- console.error("Failed to deploy:", error);
443
- process.exit(1);
471
+ const code = error?.name === "FarmDeployError" ? ` [${error.code}]` : "";
472
+ const message = error instanceof Error ? error.message : String(error);
473
+ console.error(`Failed to deploy${code}: ${message}`);
474
+ process.exitCode = 1;
444
475
  }
445
476
  });
446
477