agentful 0.3.6 → 0.3.8
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 +54 -20
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3044,7 +3044,7 @@ var VERSION, brand, useColor, wrap, paint, sym, ui;
|
|
|
3044
3044
|
var init_branding = __esm({
|
|
3045
3045
|
"src/branding.ts"() {
|
|
3046
3046
|
"use strict";
|
|
3047
|
-
VERSION = "0.3.
|
|
3047
|
+
VERSION = "0.3.8" ? "0.3.8" : null.version;
|
|
3048
3048
|
brand = {
|
|
3049
3049
|
name: "agentful",
|
|
3050
3050
|
// the command users type
|
|
@@ -8084,28 +8084,47 @@ async function shareCommand(opts) {
|
|
|
8084
8084
|
}
|
|
8085
8085
|
|
|
8086
8086
|
// src/commands/pull.ts
|
|
8087
|
-
var
|
|
8088
|
-
var
|
|
8087
|
+
var import_node_fs19 = require("fs");
|
|
8088
|
+
var import_node_path22 = require("path");
|
|
8089
8089
|
init_branding();
|
|
8090
8090
|
init_branding();
|
|
8091
|
-
|
|
8092
|
-
|
|
8091
|
+
|
|
8092
|
+
// src/lib/pullFiles.ts
|
|
8093
|
+
var import_node_fs18 = require("fs");
|
|
8094
|
+
var import_node_path21 = require("path");
|
|
8095
|
+
var INLINE_BASE64_EXTENSIONS = /\.(?:png|jpe?g|gif|webp|avif|svg|ico|bmp|tiff?|woff2?|ttf|otf|eot|pdf|docx?|xlsx?|pptx?|zip|tar|gz|7z|rar|bz2|mp[34]|m4a|wav|ogg|avi|mov|mkv|flac|webm|exe|dll|so|dylib|bin|wasm)$/i;
|
|
8096
|
+
function inlineContent(value) {
|
|
8097
|
+
return typeof value === "object" && value !== null && "content" in value ? String(value.content) : String(value ?? "");
|
|
8093
8098
|
}
|
|
8094
|
-
function
|
|
8099
|
+
function writePulledWorkspaceEntry(root, rel, value) {
|
|
8095
8100
|
const target = (0, import_node_path21.join)(root, rel);
|
|
8096
8101
|
(0, import_node_fs18.mkdirSync)((0, import_node_path21.dirname)(target), { recursive: true });
|
|
8097
|
-
const content =
|
|
8098
|
-
if (
|
|
8102
|
+
const content = inlineContent(value);
|
|
8103
|
+
if (INLINE_BASE64_EXTENSIONS.test(rel)) {
|
|
8099
8104
|
(0, import_node_fs18.writeFileSync)(target, Buffer.from(content, "base64"));
|
|
8100
|
-
|
|
8101
|
-
(0, import_node_fs18.writeFileSync)(target, content, "utf8");
|
|
8105
|
+
return;
|
|
8102
8106
|
}
|
|
8107
|
+
(0, import_node_fs18.writeFileSync)(target, content, "utf8");
|
|
8108
|
+
}
|
|
8109
|
+
function writePulledBackendDeclaration(root, declaration) {
|
|
8110
|
+
const target = (0, import_node_path21.join)(root, ".agentful", "backend.json");
|
|
8111
|
+
(0, import_node_fs18.mkdirSync)((0, import_node_path21.dirname)(target), { recursive: true });
|
|
8112
|
+
const {
|
|
8113
|
+
source: _source,
|
|
8114
|
+
received_at: _receivedAt,
|
|
8115
|
+
last_sync: _lastSync,
|
|
8116
|
+
...portableDeclaration
|
|
8117
|
+
} = declaration;
|
|
8118
|
+
(0, import_node_fs18.writeFileSync)(target, `${JSON.stringify(portableDeclaration, null, 2)}
|
|
8119
|
+
`, "utf8");
|
|
8103
8120
|
}
|
|
8121
|
+
|
|
8122
|
+
// src/commands/pull.ts
|
|
8104
8123
|
async function pullCommand(opts) {
|
|
8105
8124
|
console.log(banner());
|
|
8106
8125
|
const auth = await ensureAuth();
|
|
8107
8126
|
const project = requireProject();
|
|
8108
|
-
const nonHidden = (0,
|
|
8127
|
+
const nonHidden = (0, import_node_fs19.readdirSync)(process.cwd()).filter((n) => n !== ".agentful" && !n.startsWith("."));
|
|
8109
8128
|
if (nonHidden.length > 0 && !opts.force) {
|
|
8110
8129
|
throw new ApiError(
|
|
8111
8130
|
0,
|
|
@@ -8114,10 +8133,13 @@ async function pullCommand(opts) {
|
|
|
8114
8133
|
);
|
|
8115
8134
|
}
|
|
8116
8135
|
ui.step("Fetching workspace\u2026");
|
|
8117
|
-
const data = await
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8136
|
+
const [data, backendState] = await Promise.all([
|
|
8137
|
+
request(
|
|
8138
|
+
`${PB_URL}/api/workspaces/${project.userId}/${project.projectId}`,
|
|
8139
|
+
{ token: auth.pb_token, timeoutMs: 12e4 }
|
|
8140
|
+
),
|
|
8141
|
+
fetchBackendSessionState(auth, project.userId, project.projectId)
|
|
8142
|
+
]);
|
|
8121
8143
|
let written = 0;
|
|
8122
8144
|
if (data.mode === "presigned" && data.urls) {
|
|
8123
8145
|
for (const [rel, url] of Object.entries(data.urls)) {
|
|
@@ -8129,20 +8151,26 @@ async function pullCommand(opts) {
|
|
|
8129
8151
|
ui.warn(`Skipped ${rel} (HTTP ${resp.status})`);
|
|
8130
8152
|
continue;
|
|
8131
8153
|
}
|
|
8132
|
-
const target = (0,
|
|
8133
|
-
(0,
|
|
8134
|
-
(0,
|
|
8154
|
+
const target = (0, import_node_path22.join)(process.cwd(), rel);
|
|
8155
|
+
(0, import_node_fs19.mkdirSync)((0, import_node_path22.dirname)(target), { recursive: true });
|
|
8156
|
+
(0, import_node_fs19.writeFileSync)(target, Buffer.from(await resp.arrayBuffer()));
|
|
8135
8157
|
written++;
|
|
8136
8158
|
}
|
|
8137
8159
|
} else if (data.files) {
|
|
8138
8160
|
for (const [rel, value] of Object.entries(data.files)) {
|
|
8139
|
-
|
|
8161
|
+
writePulledWorkspaceEntry(process.cwd(), rel, value);
|
|
8140
8162
|
written++;
|
|
8141
8163
|
}
|
|
8142
8164
|
} else {
|
|
8143
8165
|
throw new ApiError(0, "empty_workspace", "The cloud workspace has no files yet.");
|
|
8144
8166
|
}
|
|
8145
8167
|
ui.ok(`Pulled ${written} files from the cloud workspace.`);
|
|
8168
|
+
if (backendState?.declaration) {
|
|
8169
|
+
writePulledBackendDeclaration(process.cwd(), backendState.declaration);
|
|
8170
|
+
ui.ok("Restored .agentful/backend.json from the platform declaration.");
|
|
8171
|
+
} else if (backendState === null) {
|
|
8172
|
+
ui.warn("Could not read the platform backend declaration; .agentful/backend.json was not restored.");
|
|
8173
|
+
}
|
|
8146
8174
|
}
|
|
8147
8175
|
|
|
8148
8176
|
// THIRD-PARTY-LICENSES.txt
|
|
@@ -8275,6 +8303,12 @@ async function upgradeCommand() {
|
|
|
8275
8303
|
process.exitCode = 1;
|
|
8276
8304
|
}
|
|
8277
8305
|
|
|
8306
|
+
// src/lib/commandOptions.ts
|
|
8307
|
+
function tuiOptionsFrom(command) {
|
|
8308
|
+
const { session, model, variant } = command.optsWithGlobals();
|
|
8309
|
+
return { session, model, variant };
|
|
8310
|
+
}
|
|
8311
|
+
|
|
8278
8312
|
// src/index.ts
|
|
8279
8313
|
var program2 = new Command();
|
|
8280
8314
|
var run = (fn) => async (...args) => {
|
|
@@ -8308,7 +8342,7 @@ program2.command("push").description("Upload this project and get a live preview
|
|
|
8308
8342
|
program2.command("build-status").description("Show the cloud's record of the last build (the real error on failures)").action(run(buildStatusCommand));
|
|
8309
8343
|
program2.command("backend").description("Open this project's Backend tab (managed DB + server actions) in the browser").action(run(backendCommand));
|
|
8310
8344
|
program2.command("open").description("Open the live preview in the browser").action(run(openCommand));
|
|
8311
|
-
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((
|
|
8345
|
+
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))));
|
|
8312
8346
|
program2.command("publish <subdomain>").description("Publish the built project at https://<subdomain>.agentful.dev").action(run(publishCommand));
|
|
8313
8347
|
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)));
|
|
8314
8348
|
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)));
|