Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ path appears only for the current Canvas ID's verified output when no
regeneration is pending; otherwise the page asks for generation and verification.
At Generate, Designer checks the child checkout's Specify inventory for packages
in the Wizard handoff and freezes their installed versions alongside the original
Wizard snapshot. Unrelated installed packages do not affect version verification.
Wizard snapshot. On Windows, inventory checks run Specify directly so extended-length
checkout paths are supported. Unrelated installed packages do not affect version verification.
Version drift is reported as a warning rather than blocking generation. If
Specify's inventory cannot be read or a package is missing, that package's
generated version is marked `unverified` and the warning remains visible.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export async function readCurrentInstalledVersions(project, frozen, run = execFi
try {
const { stdout } = await run(process.platform === "win32" ? "specify.exe" : "specify",
[command, "list", "--json"],
await specifySpawnOptions(project, { timeout: 10000, maxBuffer: 128 * 1024 }));
await specifySpawnOptions(project, { timeout: 10000, maxBuffer: 128 * 1024, shell: false }));
inventory[kind] = normalizeObservedVersions(stdout, kind, relevantIds);
} catch (error) {
inventory[kind] = [];
Expand Down
26 changes: 24 additions & 2 deletions spec-kit-extensions/tests/canvas_generation.test.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import assert from "node:assert/strict";
import { execFile } from "node:child_process";
import { createHash } from "node:crypto";
import { EventEmitter } from "node:events";
import fs from "node:fs";
import { mkdtemp, mkdir, open, readFile, readdir, rename, rm, symlink, writeFile } from "node:fs/promises";
import { createServer } from "node:http";
import { syncBuiltinESMExports } from "node:module";
import { tmpdir } from "node:os";
import { join, posix } from "node:path";
import { join, posix, toNamespacedPath } from "node:path";
import { test } from "node:test";
import { setImmediate as nextTurn } from "node:timers/promises";
import { pathToFileURL } from "node:url";
import { promisify } from "node:util";
import { runInNewContext } from "node:vm";
import { materialize, readBoundedSessionFile, renameDirectoryWithoutReplacement } from "../extension-canvas-design/scripts/generate.mjs";
import { createRuntime, existingOutputFolder } from "../extension-canvas-design/generated-scaffold/runtime.mjs";
Expand Down Expand Up @@ -985,7 +987,7 @@ test("Specify inventories supply observed package versions and reject invalid re
assert.deepEqual(calls, kinds.map((kind) => ({
args: [kind === "presets" ? "preset" : kind === "extensions" ? "extension" : "bundle",
"list", "--json"], cwd: "child",
env: { ...process.env, PATH: augmentedPath }, shell: process.platform === "win32",
env: { ...process.env, PATH: augmentedPath }, shell: false,
})));
assert.deepEqual(await readCurrentInstalledVersions("child",
{ presets: [], extensions: [], bundles: [] }, run),
Expand Down Expand Up @@ -1023,6 +1025,26 @@ test("Specify inventories supply observed package versions and reject invalid re
assert.deepEqual(missingCli.inventory, { presets: [], extensions: [], bundles: [] });
});

test("Windows inventory reads from a namespaced project path",
{ skip: process.platform !== "win32" }, async (t) => {
const project = await mkdtemp(join(tmpdir(), "designer inventory-"));
t.after(() => rm(project, { recursive: true, force: true }));
await mkdir(join(project, ".specify"));
const extensions = [{ id: "bug", version: "1.0.2", priority: 1 }];
await writeFile(join(project, ".specify", "inventory.json"), JSON.stringify(extensions));
const exec = promisify(execFile);
const run = (command, args, options) => {
assert.equal(command, "specify.exe");
assert.deepEqual(args, ["extension", "list", "--json"]);
return exec(process.execPath, ["-e",
'process.stdout.write(require("node:fs").readFileSync(".specify/inventory.json", "utf8"))'], options);
};
assert.deepEqual(await readCurrentInstalledVersions(toNamespacedPath(project),
{ presets: [], extensions: [{ id: "bug" }], bundles: [] }, run), {
inventory: { presets: [], extensions, bundles: [] }, warnings: [],
});
});

test("generated package versions reflect the installed inventory without blocking drift", async (t) => {
const current = { presets: [{ id: "copilot-sub-agents", version: "1.2.3", priority: 4 }],
extensions: [], bundles: [] };
Expand Down