From fe272ac55f7ce2004933e918860ef4e4cdd3d1ab Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:17:29 +0800 Subject: [PATCH] Design: fold.js names the skill on every deploy (--skill @spacesheep/design): the new space, each save and a copy, so a Design space counts as made with it on the skill's page; a CLI or server without the field publishes as before Co-authored-by: Pointman Co-authored-by: Claude --- design/assets/fold.js | 9 ++++++--- test/fold.test.js | 13 ++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/design/assets/fold.js b/design/assets/fold.js index 165bcf3..54546e7 100644 --- a/design/assets/fold.js +++ b/design/assets/fold.js @@ -313,6 +313,9 @@ for (const find of ["command -v spacesheep", "npx -y -p spacesheep@latest -c 'co if (bin) { cli = [bin]; break; } } catch {} } +// Every deploy names this skill, so the space counts as made with it on the skill's page (the first note per space +// counts; a CLI or server without the field publishes as before). +const MADE_WITH = ["--skill", "@spacesheep/design"]; const run = (args, opts = {}) => execFileSync(cli[0], [...cli.slice(1), ...args], { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 60000, killSignal: "SIGKILL", ...opts }); const runAsync = (args) => new Promise((ok) => { const t = allowed(90000); @@ -373,7 +376,7 @@ function deploy(message) { if (!t) return { ok: false, lines: [`not called: ${lost}`] }; let page = null; try { page = fs.readFileSync("work/index.html"); } catch {} - const r = spawnSync(cli[0], [...cli.slice(1), "deploy", "work", "--space", space, "-m", message], { encoding: "utf8", timeout: t, killSignal: "SIGKILL" }); + const r = spawnSync(cli[0], [...cli.slice(1), "deploy", "work", "--space", space, "-m", message, ...MADE_WITH], { encoding: "utf8", timeout: t, killSignal: "SIGKILL" }); const said = `${r.stdout || ""}\n${r.stderr || ""}`.split("\n").map((l) => l.trim()).filter(Boolean).filter((l) => !/^spacesheep /.test(l)); if (r.error && r.error.code === "ETIMEDOUT") { const s = `${Math.round(t / 1000)} s`, v = landed(message, before, page); @@ -618,7 +621,7 @@ if (cmd === "start") { mkdir("work"); const base = baseHtml(), title = plain("title", argv[2]) || "Design"; if (!work() || !setWork(firstPage(title, base))) process.exit(2); - const out = run(["deploy", "work", "--title", title, "--json"]); + const out = run(["deploy", "work", "--title", title, ...MADE_WITH, "--json"]); const j = JSON.parse(out.slice(out.indexOf("{"))); space = (j.space || {}).id; if (!UUID.test(space || "")) { console.error("start: the new space's id isn't in the answer"); process.exit(1); } @@ -1039,7 +1042,7 @@ if (cmd === "copy") { mkdir(dir); if (!write(`${dir}/index.html`, out)) process.exit(2); let j; - try { const r = run(["deploy", dir, "--title", name, "--json"]); j = JSON.parse(r.slice(r.indexOf("{"))); } + try { const r = run(["deploy", dir, "--title", name, ...MADE_WITH, "--json"]); j = JSON.parse(r.slice(r.indexOf("{"))); } catch (e) { console.error(`copy: the new space wasn't made: ${String(e.stderr || e.message || e).trim().split("\n").pop()}`); process.exit(1); } console.log(`copy: ${name} alone in a new space, private: ${(j.space || {}).url || (j.space || {}).id}; this space is as it was`); process.exit(0); diff --git a/test/fold.test.js b/test/fold.test.js index a151b44..e353245 100644 --- a/test/fold.test.js +++ b/test/fold.test.js @@ -193,6 +193,17 @@ test("stop with a message saves, and that save takes the work card down: no empt assert.ok(!sent().some((b) => b.status === ""), "no empty status"); }); +test("every deploy names the skill, so the space counts as made with it: the new space and each save (a copy: below)", () => { + const { fold, calls } = setup(); + assert.equal(fold(["start", "--new", "Poster"]).status, 0); + assert.equal(fold(["save", "Frame", "Drawing three directions"]).status, 0); + assert.equal(fold(["wait"]).status, 0); + assert.equal(fold(["stop", "Three poster looks"]).status, 0); + const deploys = calls().filter((a) => a[0] === "deploy"); + assert.equal(deploys.length, 3, JSON.stringify(deploys)); + for (const d of deploys) assert.equal(d[d.indexOf("--skill") + 1], "@spacesheep/design", JSON.stringify(d)); +}); + test("start says the next step, and push names the starter's placeholders after their sections without touching the rest", () => { const { folder, fold, sent } = setup(); const r = fold(["start", "--new", "Poster"]); @@ -1002,7 +1013,7 @@ test("copy puts one direction alone, its views with it, in a new space named aft const r = fold(["copy", "second"]); assert.equal(r.status, 0, r.stderr); assert.match(r.stdout, /^copy: Second alone in a new space, private: https:\/\/stage\.test\/s; this space is as it was$/m); - assert.deepEqual(calls().slice(n), [["deploy", "draw/_copy/second", "--title", "Second", "--json"]], "one deploy, of the copy, as a new space"); + assert.deepEqual(calls().slice(n), [["deploy", "draw/_copy/second", "--title", "Second", "--skill", "@spacesheep/design", "--json"]], "one deploy, of the copy, as a new space, naming the skill"); assert.equal(fs.readFileSync(file, "utf8"), before, "work/index.html as it was"); const copy = fs.readFileSync(path.join(folder, "draw", "_copy", "second", "index.html"), "utf8"); assert.deepEqual([...copy.matchAll(/
]*data-ss-id="([a-z-]+)"/g)].map((m) => m[1]), ["direction-second", "second-phone"]);