agentful 0.4.34 → 0.4.37

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.
Files changed (2) hide show
  1. package/dist/index.cjs +92 -8
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3044,7 +3044,7 @@ var VERSION, brand, useColor, wrap, paint, tuiDesign, sym, ui;
3044
3044
  var init_branding = __esm({
3045
3045
  "src/branding.ts"() {
3046
3046
  "use strict";
3047
- VERSION = "0.4.34" ? "0.4.34" : null.version;
3047
+ VERSION = "0.4.37" ? "0.4.37" : null.version;
3048
3048
  brand = {
3049
3049
  name: "agentful",
3050
3050
  // the command users type
@@ -9230,7 +9230,7 @@ Apart from a change I approved in step 2, do not modify project files.`
9230
9230
  },
9231
9231
  publish: {
9232
9232
  description: `${brand.displayName}: publish on a public subdomain`,
9233
- template: "Ask me for the subdomain if I did not provide one in $ARGUMENTS, then run `agentful publish <subdomain>` from the project root using the bash tool and report the public URL. " + NEEDS_A_PUSH
9233
+ template: "Ask me for the subdomain if I did not provide one in $ARGUMENTS, then run `agentful publish <subdomain>` from the project root using the bash tool and report the public URL. If the output lists findings of the security check, repeat them as they are; they are warnings, the app is published either way. " + NEEDS_A_PUSH
9234
9234
  },
9235
9235
  share: {
9236
9236
  description: `${brand.displayName}: make the live preview public (or private again)`,
@@ -10563,9 +10563,81 @@ async function tuiCommand(opts = {}) {
10563
10563
 
10564
10564
  // src/commands/publish.ts
10565
10565
  init_branding();
10566
+
10567
+ // src/lib/publishCheck.ts
10568
+ var COVERAGE_LINE = "The check looks at the access rules of your collections, at actions anyone can call and at known keys in the built files. With every new build it also asks whether tables of a Supabase database of your own, as far as your app names them, return rows without sign-in. The rest of your code is not part of it.";
10569
+ var GAP_LINES = {
10570
+ build_not_checked: "There is no result for the built files yet. The next build creates one.",
10571
+ build_partly_read: "The built files were read only in part (very large or very many files).",
10572
+ builds_unreadable: "The result for the built files could not be read just now.",
10573
+ database_partly_checked: "Your app talks to a Supabase database of your own. When it was built, the database was not checked, or only in part.",
10574
+ project_partly_read: "Collections or actions were read only in part."
10575
+ };
10576
+ function publishCheckReport(answer) {
10577
+ const report = { shown: false, critical: [], review: [], notes: [] };
10578
+ if (!answer || answer.enabled !== true) return report;
10579
+ report.shown = true;
10580
+ if (answer.state !== "checked") {
10581
+ report.notes.push("The security check could not run just now. The publish went through without it.");
10582
+ return report;
10583
+ }
10584
+ for (const finding of Array.isArray(answer.findings) ? answer.findings : []) {
10585
+ if (!finding || typeof finding.rule_id !== "string") continue;
10586
+ if (typeof finding.version_id === "string" && finding.live !== true) continue;
10587
+ const text = finding.message || finding.rule_id;
10588
+ (finding.level === "critical" ? report.critical : report.review).push(text);
10589
+ }
10590
+ for (const gap of Array.isArray(answer.gaps) ? answer.gaps : []) {
10591
+ if (GAP_LINES[gap]) report.notes.push(GAP_LINES[gap]);
10592
+ if (gap === "actions_not_understood") {
10593
+ const count2 = answer.counts?.actions_not_understood ?? 0;
10594
+ report.notes.push(`Actions the check does not understand and so did not judge: ${count2}`);
10595
+ }
10596
+ }
10597
+ return report;
10598
+ }
10599
+ function publishCheckJson(answer) {
10600
+ if (!answer || answer.enabled !== true) return null;
10601
+ const report = publishCheckReport(answer);
10602
+ return {
10603
+ state: answer.state ?? "failed",
10604
+ critical: report.critical.length,
10605
+ review: report.review.length,
10606
+ findings: (Array.isArray(answer.findings) ? answer.findings : []).filter((f) => f && typeof f.rule_id === "string" && !(typeof f.version_id === "string" && f.live !== true)),
10607
+ gaps: Array.isArray(answer.gaps) ? answer.gaps : [],
10608
+ coverage: COVERAGE_LINE
10609
+ };
10610
+ }
10611
+
10612
+ // src/commands/publish.ts
10566
10613
  var SUBDOMAIN_RE = /^[a-z0-9](?:[a-z0-9-]{1,61}[a-z0-9])?$/;
10567
- async function publishCommand(subdomain) {
10568
- console.log(banner());
10614
+ async function readPublishCheck(token, userId, projectId) {
10615
+ try {
10616
+ return await request(
10617
+ `${PUBLIC_API_URL}/api/workspaces/${encodeURIComponent(userId)}/${encodeURIComponent(projectId)}/publish-check?surface=cli`,
10618
+ { token, timeoutMs: 15e3 }
10619
+ );
10620
+ } catch {
10621
+ return null;
10622
+ }
10623
+ }
10624
+ function printPublishCheck(answer) {
10625
+ const report = publishCheckReport(answer);
10626
+ if (!report.shown) return;
10627
+ console.log("");
10628
+ const found = report.critical.length + report.review.length;
10629
+ if (found) ui.warn(`Security check: ${report.critical.length} critical, ${report.review.length} to review`);
10630
+ else ui.info("Security check: nothing reported");
10631
+ for (const line of report.critical) console.log(` critical ${line}`);
10632
+ for (const line of report.review) console.log(` review ${line}`);
10633
+ for (const line of report.notes) console.log(` note ${line}`);
10634
+ console.log(` ${COVERAGE_LINE}`);
10635
+ }
10636
+ async function publishCommand(subdomain, opts = {}) {
10637
+ const say = (line) => {
10638
+ if (!opts.json) ui.step(line);
10639
+ };
10640
+ if (!opts.json) console.log(banner());
10569
10641
  const auth = await ensureAuth();
10570
10642
  const project = requireProject();
10571
10643
  const name = subdomain.trim().toLowerCase();
@@ -10576,7 +10648,7 @@ async function publishCommand(subdomain) {
10576
10648
  "Subdomain must be 3-63 chars, lowercase letters/digits/hyphens, no leading/trailing hyphen."
10577
10649
  );
10578
10650
  }
10579
- ui.step(`Checking availability of ${name}.${PUBLISHED_DOMAIN}\u2026`);
10651
+ say(`Checking availability of ${name}.${PUBLISHED_DOMAIN}\u2026`);
10580
10652
  const check = await request(
10581
10653
  `${PUBLIC_API_URL}/api/subdomains/check/${name}`,
10582
10654
  { token: auth.pb_token }
@@ -10584,7 +10656,7 @@ async function publishCommand(subdomain) {
10584
10656
  if (check.available === false) {
10585
10657
  throw new ApiError(409, "subdomain_taken", check.message || `"${name}" is not available.`);
10586
10658
  }
10587
- ui.step("Publishing\u2026");
10659
+ say("Publishing\u2026");
10588
10660
  const res = await request(
10589
10661
  `${PUBLIC_API_URL}/api/publish`,
10590
10662
  {
@@ -10598,8 +10670,20 @@ async function publishCommand(subdomain) {
10598
10670
  if (res.success === false) {
10599
10671
  throw new ApiError(0, "publish_failed", res.message || "Publish failed.");
10600
10672
  }
10673
+ const publicUrl = res.public_url || `https://${name}.${PUBLISHED_DOMAIN}`;
10674
+ const securityCheck = await readPublishCheck(auth.pb_token, project.userId, project.projectId);
10675
+ if (opts.json) {
10676
+ process.stdout.write(JSON.stringify({
10677
+ published: true,
10678
+ public_url: publicUrl,
10679
+ subdomain: res.subdomain || name,
10680
+ publish_check: publishCheckJson(securityCheck)
10681
+ }, null, 2) + "\n");
10682
+ return;
10683
+ }
10601
10684
  console.log("");
10602
- ui.ok(`Published: ${ui.url(res.public_url || `https://${name}.${PUBLISHED_DOMAIN}`)}`);
10685
+ ui.ok(`Published: ${ui.url(publicUrl)}`);
10686
+ printPublishCheck(securityCheck);
10603
10687
  }
10604
10688
 
10605
10689
  // src/commands/share.ts
@@ -11020,7 +11104,7 @@ program2.command("build-status").description("Show the cloud's record of the las
11020
11104
  program2.command("backend").description("Open this project's Backend tab (managed DB + server actions) in the browser").action(run(backendCommand));
11021
11105
  program2.command("open").description("Open the live preview in the browser").action(run(openCommand));
11022
11106
  program2.command("tui").description("Start the Agentful coding TUI with your Agentful account").option("-s, --session <id>", "resume a previous session").option("-m, --model <provider/model>", "pin an exact model from the final engine catalog").option("--variant <name>", "pin the provider-specific model variant (for example high)").action(run((_opts, cmd) => tuiCommand(tuiOptionsFrom(cmd))));
11023
- program2.command("publish <subdomain>").description("Publish the built project at https://<subdomain>.agentful.page").action(run(publishCommand));
11107
+ program2.command("publish <subdomain>").description("Publish the built project at https://<subdomain>.agentful.page").option("--json", "print the address and the security check as JSON (for scripts and agents)").action(run(publishCommand));
11024
11108
  program2.command("share").description("Make the live preview public (anyone with the link)").option("--private", "make the preview owner-only again").action(run((opts) => shareCommand(opts)));
11025
11109
  program2.command("pull").description("Download the cloud workspace into this directory").option("--force", "overwrite files in a non-empty directory").action(run((opts) => pullCommand(opts)));
11026
11110
  program2.command("models").description("List available models and manage local providers with your own key").option("--add-local", "create/show the local provider file to edit").option("--refresh", "refresh the engine model cache from models.dev").action(run((opts) => modelsCommand(opts)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentful",
3
- "version": "0.4.34",
3
+ "version": "0.4.37",
4
4
  "description": "Agentful in your terminal — local development with push-to-cloud previews",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://agentful.dev",