@floomhq/floom 1.0.46 → 1.0.48
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/cli.js +7 -0
- package/dist/daemon.js +23 -2
- package/dist/sync.js +2 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -28,6 +28,13 @@ import { TARGET_HINT, isAgentTarget } from "./targets.js";
|
|
|
28
28
|
const PKG = { name: "@floomhq/floom", version: CLI_VERSION };
|
|
29
29
|
const V1_NOT_AVAILABLE = "Not available in Floom Version 1.";
|
|
30
30
|
const CLI_COMMAND = "npx -y @floomhq/floom";
|
|
31
|
+
function exitOnBrokenPipe(err) {
|
|
32
|
+
if (err.code === "EPIPE")
|
|
33
|
+
process.exit(0);
|
|
34
|
+
throw err;
|
|
35
|
+
}
|
|
36
|
+
process.stdout.on("error", exitOnBrokenPipe);
|
|
37
|
+
process.stderr.on("error", exitOnBrokenPipe);
|
|
31
38
|
function usage() {
|
|
32
39
|
const out = `
|
|
33
40
|
${c.blue(" ________ ")}
|
package/dist/daemon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
import { mkdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
2
|
+
import { access, mkdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import { homedir, hostname, platform } from "node:os";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { CONFIG_DIR } from "./config.js";
|
|
@@ -91,6 +91,7 @@ function parseSyncResult(output) {
|
|
|
91
91
|
async function runTarget(target, opts) {
|
|
92
92
|
const started = Date.now();
|
|
93
93
|
const cacheDir = join(CONFIG_DIR, "skill-cache", target);
|
|
94
|
+
const nativeManifestPath = join(CONFIG_DIR, "native-sync-manifests", `${target}.json`);
|
|
94
95
|
const syncResult = await runCommand([String(opts.timeoutSeconds), "sync", "--target", target], {
|
|
95
96
|
[targetSkillsDirEnv(target)]: cacheDir,
|
|
96
97
|
FLOOM_SYNC_MANIFEST_PATH: join(cacheDir, ".floom-cli-sync-manifest.json"),
|
|
@@ -105,11 +106,20 @@ async function runTarget(target, opts) {
|
|
|
105
106
|
error = setupResult.timedOut ? "instruction setup timed out" : `${setupResult.stdout}\n${setupResult.stderr}`.trim() || "instruction setup failed";
|
|
106
107
|
}
|
|
107
108
|
}
|
|
109
|
+
if (opts.push && ok) {
|
|
110
|
+
if (opts.yolo && !(await fileExists(nativeManifestPath))) {
|
|
111
|
+
const baselineResult = await runCommand([String(opts.timeoutSeconds), "watch", "--push", "--once", "--target", target, "--no-yolo"], { FLOOM_SYNC_MANIFEST_PATH: nativeManifestPath });
|
|
112
|
+
if (baselineResult.code !== 0 || baselineResult.timedOut) {
|
|
113
|
+
ok = false;
|
|
114
|
+
error = baselineResult.timedOut ? "native baseline timed out" : `${baselineResult.stdout}\n${baselineResult.stderr}`.trim() || "native baseline failed";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
108
118
|
if (opts.push && ok) {
|
|
109
119
|
const pushArgs = ["watch", "--push", "--once", "--target", target];
|
|
110
120
|
if (!opts.yolo)
|
|
111
121
|
pushArgs.push("--no-yolo");
|
|
112
|
-
const pushResult = await runCommand([String(opts.timeoutSeconds), ...pushArgs], { FLOOM_SYNC_MANIFEST_PATH:
|
|
122
|
+
const pushResult = await runCommand([String(opts.timeoutSeconds), ...pushArgs], { FLOOM_SYNC_MANIFEST_PATH: nativeManifestPath });
|
|
113
123
|
if (pushResult.code !== 0 || pushResult.timedOut) {
|
|
114
124
|
ok = false;
|
|
115
125
|
error = pushResult.timedOut ? "push timed out" : `${pushResult.stdout}\n${pushResult.stderr}`.trim() || "push failed";
|
|
@@ -128,6 +138,17 @@ async function runTarget(target, opts) {
|
|
|
128
138
|
duration_ms: Date.now() - started,
|
|
129
139
|
};
|
|
130
140
|
}
|
|
141
|
+
async function fileExists(path) {
|
|
142
|
+
try {
|
|
143
|
+
await access(path);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
if (err.code === "ENOENT")
|
|
148
|
+
return false;
|
|
149
|
+
throw err;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
131
152
|
async function sleep(ms) {
|
|
132
153
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
133
154
|
}
|
package/dist/sync.js
CHANGED
|
@@ -14,6 +14,7 @@ const SLUG_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
|
14
14
|
const PATH_SEGMENT_RE = /^[a-z0-9._-]{1,128}$/;
|
|
15
15
|
const MANIFEST_SEGMENT_RE = /^[A-Za-z0-9._-]{1,128}$/;
|
|
16
16
|
const FD_PATH_ROOT = "/proc/self/fd";
|
|
17
|
+
const PACKAGE_SYNC_PAGE_LIMIT = "25";
|
|
17
18
|
function sha256(input) {
|
|
18
19
|
return createHash("sha256").update(input).digest("hex");
|
|
19
20
|
}
|
|
@@ -449,7 +450,7 @@ async function loadSyncPayload(apiUrl, token) {
|
|
|
449
450
|
const seenCursors = new Set();
|
|
450
451
|
for (let page = 0; page < 1000; page += 1) {
|
|
451
452
|
const url = new URL(`${apiUrl}/api/v1/me/skills`);
|
|
452
|
-
url.searchParams.set("limit",
|
|
453
|
+
url.searchParams.set("limit", PACKAGE_SYNC_PAGE_LIMIT);
|
|
453
454
|
url.searchParams.set("packages", "1");
|
|
454
455
|
if (cursor)
|
|
455
456
|
url.searchParams.set("cursor", cursor);
|