agentful 0.4.34 → 0.4.35
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/index.cjs +91 -8
- 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.
|
|
3047
|
+
VERSION = "0.4.35" ? "0.4.35" : 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,80 @@ 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. The rest of your code and a database of your own are 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
|
+
project_partly_read: "Collections or actions were read only in part."
|
|
10574
|
+
};
|
|
10575
|
+
function publishCheckReport(answer) {
|
|
10576
|
+
const report = { shown: false, critical: [], review: [], notes: [] };
|
|
10577
|
+
if (!answer || answer.enabled !== true) return report;
|
|
10578
|
+
report.shown = true;
|
|
10579
|
+
if (answer.state !== "checked") {
|
|
10580
|
+
report.notes.push("The security check could not run just now. The publish went through without it.");
|
|
10581
|
+
return report;
|
|
10582
|
+
}
|
|
10583
|
+
for (const finding of Array.isArray(answer.findings) ? answer.findings : []) {
|
|
10584
|
+
if (!finding || typeof finding.rule_id !== "string") continue;
|
|
10585
|
+
if (typeof finding.version_id === "string" && finding.live !== true) continue;
|
|
10586
|
+
const text = finding.message || finding.rule_id;
|
|
10587
|
+
(finding.level === "critical" ? report.critical : report.review).push(text);
|
|
10588
|
+
}
|
|
10589
|
+
for (const gap of Array.isArray(answer.gaps) ? answer.gaps : []) {
|
|
10590
|
+
if (GAP_LINES[gap]) report.notes.push(GAP_LINES[gap]);
|
|
10591
|
+
if (gap === "actions_not_understood") {
|
|
10592
|
+
const count2 = answer.counts?.actions_not_understood ?? 0;
|
|
10593
|
+
report.notes.push(`Actions the check does not understand and so did not judge: ${count2}`);
|
|
10594
|
+
}
|
|
10595
|
+
}
|
|
10596
|
+
return report;
|
|
10597
|
+
}
|
|
10598
|
+
function publishCheckJson(answer) {
|
|
10599
|
+
if (!answer || answer.enabled !== true) return null;
|
|
10600
|
+
const report = publishCheckReport(answer);
|
|
10601
|
+
return {
|
|
10602
|
+
state: answer.state ?? "failed",
|
|
10603
|
+
critical: report.critical.length,
|
|
10604
|
+
review: report.review.length,
|
|
10605
|
+
findings: (Array.isArray(answer.findings) ? answer.findings : []).filter((f) => f && typeof f.rule_id === "string" && !(typeof f.version_id === "string" && f.live !== true)),
|
|
10606
|
+
gaps: Array.isArray(answer.gaps) ? answer.gaps : [],
|
|
10607
|
+
coverage: COVERAGE_LINE
|
|
10608
|
+
};
|
|
10609
|
+
}
|
|
10610
|
+
|
|
10611
|
+
// src/commands/publish.ts
|
|
10566
10612
|
var SUBDOMAIN_RE = /^[a-z0-9](?:[a-z0-9-]{1,61}[a-z0-9])?$/;
|
|
10567
|
-
async function
|
|
10568
|
-
|
|
10613
|
+
async function readPublishCheck(token, userId, projectId) {
|
|
10614
|
+
try {
|
|
10615
|
+
return await request(
|
|
10616
|
+
`${PUBLIC_API_URL}/api/workspaces/${encodeURIComponent(userId)}/${encodeURIComponent(projectId)}/publish-check?surface=cli`,
|
|
10617
|
+
{ token, timeoutMs: 15e3 }
|
|
10618
|
+
);
|
|
10619
|
+
} catch {
|
|
10620
|
+
return null;
|
|
10621
|
+
}
|
|
10622
|
+
}
|
|
10623
|
+
function printPublishCheck(answer) {
|
|
10624
|
+
const report = publishCheckReport(answer);
|
|
10625
|
+
if (!report.shown) return;
|
|
10626
|
+
console.log("");
|
|
10627
|
+
const found = report.critical.length + report.review.length;
|
|
10628
|
+
if (found) ui.warn(`Security check: ${report.critical.length} critical, ${report.review.length} to review`);
|
|
10629
|
+
else ui.info("Security check: nothing reported");
|
|
10630
|
+
for (const line of report.critical) console.log(` critical ${line}`);
|
|
10631
|
+
for (const line of report.review) console.log(` review ${line}`);
|
|
10632
|
+
for (const line of report.notes) console.log(` note ${line}`);
|
|
10633
|
+
console.log(` ${COVERAGE_LINE}`);
|
|
10634
|
+
}
|
|
10635
|
+
async function publishCommand(subdomain, opts = {}) {
|
|
10636
|
+
const say = (line) => {
|
|
10637
|
+
if (!opts.json) ui.step(line);
|
|
10638
|
+
};
|
|
10639
|
+
if (!opts.json) console.log(banner());
|
|
10569
10640
|
const auth = await ensureAuth();
|
|
10570
10641
|
const project = requireProject();
|
|
10571
10642
|
const name = subdomain.trim().toLowerCase();
|
|
@@ -10576,7 +10647,7 @@ async function publishCommand(subdomain) {
|
|
|
10576
10647
|
"Subdomain must be 3-63 chars, lowercase letters/digits/hyphens, no leading/trailing hyphen."
|
|
10577
10648
|
);
|
|
10578
10649
|
}
|
|
10579
|
-
|
|
10650
|
+
say(`Checking availability of ${name}.${PUBLISHED_DOMAIN}\u2026`);
|
|
10580
10651
|
const check = await request(
|
|
10581
10652
|
`${PUBLIC_API_URL}/api/subdomains/check/${name}`,
|
|
10582
10653
|
{ token: auth.pb_token }
|
|
@@ -10584,7 +10655,7 @@ async function publishCommand(subdomain) {
|
|
|
10584
10655
|
if (check.available === false) {
|
|
10585
10656
|
throw new ApiError(409, "subdomain_taken", check.message || `"${name}" is not available.`);
|
|
10586
10657
|
}
|
|
10587
|
-
|
|
10658
|
+
say("Publishing\u2026");
|
|
10588
10659
|
const res = await request(
|
|
10589
10660
|
`${PUBLIC_API_URL}/api/publish`,
|
|
10590
10661
|
{
|
|
@@ -10598,8 +10669,20 @@ async function publishCommand(subdomain) {
|
|
|
10598
10669
|
if (res.success === false) {
|
|
10599
10670
|
throw new ApiError(0, "publish_failed", res.message || "Publish failed.");
|
|
10600
10671
|
}
|
|
10672
|
+
const publicUrl = res.public_url || `https://${name}.${PUBLISHED_DOMAIN}`;
|
|
10673
|
+
const securityCheck = await readPublishCheck(auth.pb_token, project.userId, project.projectId);
|
|
10674
|
+
if (opts.json) {
|
|
10675
|
+
process.stdout.write(JSON.stringify({
|
|
10676
|
+
published: true,
|
|
10677
|
+
public_url: publicUrl,
|
|
10678
|
+
subdomain: res.subdomain || name,
|
|
10679
|
+
publish_check: publishCheckJson(securityCheck)
|
|
10680
|
+
}, null, 2) + "\n");
|
|
10681
|
+
return;
|
|
10682
|
+
}
|
|
10601
10683
|
console.log("");
|
|
10602
|
-
ui.ok(`Published: ${ui.url(
|
|
10684
|
+
ui.ok(`Published: ${ui.url(publicUrl)}`);
|
|
10685
|
+
printPublishCheck(securityCheck);
|
|
10603
10686
|
}
|
|
10604
10687
|
|
|
10605
10688
|
// src/commands/share.ts
|
|
@@ -11020,7 +11103,7 @@ program2.command("build-status").description("Show the cloud's record of the las
|
|
|
11020
11103
|
program2.command("backend").description("Open this project's Backend tab (managed DB + server actions) in the browser").action(run(backendCommand));
|
|
11021
11104
|
program2.command("open").description("Open the live preview in the browser").action(run(openCommand));
|
|
11022
11105
|
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));
|
|
11106
|
+
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
11107
|
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
11108
|
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
11109
|
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)));
|