Skip to content

100x is a skill by a former Cursor engineer that turns prompts into formally verified, production-ready code

Start npm and npx through cmd without quoting their name, and give prompt tests a folder on the drive they run in

Glitch4747c6014981
diff --git a/lib/proc.mjs b/lib/proc.mjs
index 639054d..e33e9eb 100644
--- a/lib/proc.mjs
+++ b/lib/proc.mjs
@@ -14,7 +14,9 @@ const needsCmd = (command) => isWindows && (/\.(cmd|bat)$/i.test(command) || ['n
function invocation(command, args, options) {
if (!needsCmd(command)) return [command, args, options];
- const line = `"${[command, ...args].map(cmdQuote).join(' ')}"`;
+ // A bare name such as npm stays unquoted, so cmd finds it on PATH and the script's own %~dp0 is the folder it was found in. A path is quoted.
+ const head = /^[\w.-]+$/.test(command) ? command : cmdQuote(command);
+ const line = `"${[head, ...args.map(cmdQuote)].join(' ')}"`;
return [process.env.ComSpec || 'cmd.exe', ['/d', '/s', '/c', line], { ...options, windowsVerbatimArguments: true }];
}
diff --git a/test/package.test.mjs b/test/package.test.mjs
index 61158c3..230734e 100644
--- a/test/package.test.mjs
+++ b/test/package.test.mjs
@@ -1,14 +1,14 @@
import assert from 'node:assert/strict';
-import { spawnSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import test from 'node:test';
+import { runProgram } from '../lib/proc.mjs';
import { ROOT } from './helpers.mjs';
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
test('npm install -g from the repository carries what the tool reads at run time and nothing it does not', () => {
- const packed = spawnSync('npm', ['pack', '--dry-run', '--json', '--ignore-scripts'], { cwd: ROOT, encoding: 'utf8' });
+ const packed = runProgram('npm', ['pack', '--dry-run', '--json', '--ignore-scripts'], { cwd: ROOT, encoding: 'utf8' });
assert.equal(packed.status, 0, packed.stderr);
const files = new Set(JSON.parse(packed.stdout)[0].files.map((f) => f.path));
const skills = fs.readdirSync(path.join(ROOT, 'skills'), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
diff --git a/test/prompt.test.mjs b/test/prompt.test.mjs
index f87c947..bffcbc7 100644
--- a/test/prompt.test.mjs
+++ b/test/prompt.test.mjs
@@ -418,7 +418,7 @@ test('show leaves the asks as they were written, except for the box and the clos
test('show says where the other chat works, adds the owner\'s words on request, and writes a file', () => {
const box = promptBox(examples[1]);
// The folder is written as the system writes it: /work/dead-exports on macOS and Linux, C:\work\dead-exports on Windows.
- const folder = path.resolve('/work/dead-exports');
+ const folder = path.resolve(box.project, '/work/dead-exports');
const where = run(box, 'prompt', 'show', '--where', '/work/dead-exports', '--with-brief');
assert.ok(where.out.includes(`\nWHERE\nWork in ${folder}. Commit locally and often.`), 'nothing about this folder or its git state');
assert.match(where.out, /\nTHE OWNER'S WORDS\na cli that finds dead exports/);
@@ -490,7 +490,7 @@ test('show lists the number phrases that would change a run after the skill name
test('show lists a number phrase in the WHERE line it wrote, and no mode word', () => {
const box = promptBox(FULL);
const { out, err } = run(box, 'prompt', 'show', '--where', '/work/mockup-overnight-3 versions');
- const line = out.split('\n').findIndex((one) => one.startsWith(`Work in ${path.resolve('/work/mockup-overnight-3 versions')}`)) + 1;
+ const line = out.split('\n').findIndex((one) => one.startsWith(`Work in ${path.resolve(box.project, '/work/mockup-overnight-3 versions')}`)) + 1;
assert.match(err, new RegExp(`Line ${line} has "3 versions"\\.`));
assert.doesNotMatch(err, /has "(mockup|overnight)"/);
box.cleanup();
@@ -630,8 +630,10 @@ test('prompt says what to do when there is no project.md, the word is wrong, or
test('the export is built once, so what the in-process reader says is what the command prints', () => {
const box = promptBox(FULL);
- const { text, notes } = renderPrompt(box.project, { where: '/work/x' });
- assert.equal(text, run(box, 'prompt', 'show', '--where', '/work/x').out);
+ // The same folder for both, whatever drive the test itself runs on.
+ const where = path.resolve(box.project, '/work/x');
+ const { text, notes } = renderPrompt(box.project, { where });
+ assert.equal(text, run(box, 'prompt', 'show', '--where', where).out);
assert.deepEqual(notes, []);
box.cleanup();
});
diff --git a/test/skill-spec.test.mjs b/test/skill-spec.test.mjs
index d0b1a89..2d45dbd 100644
--- a/test/skill-spec.test.mjs
+++ b/test/skill-spec.test.mjs
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
-import { spawnSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import test from 'node:test';
import { commandNames, commandUsages } from '../lib/commands/index.mjs';
+import { runProgram } from '../lib/proc.mjs';
import { COMPATIBILITY, readStamp, stampProblems, stampText } from '../lib/skill-meta.mjs';
import { skillHash } from '../lib/skill-hash.mjs';
import { parseSkillFrontmatter, specFindings } from '../lib/skill-spec.mjs';
@@ -161,7 +161,7 @@ test('a symlink that loops back to a folder above it is left out of the hash ins
test('every skill passes the specification\'s own validator, skills-ref', { skip: process.env.X100_FAST ? 'the fast lane leaves out the network check' : false }, (t) => {
const skillsRoot = path.join(ROOT, 'skills');
for (const name of fs.readdirSync(skillsRoot).sort()) {
- const run = spawnSync('npx', ['-y', 'skills-ref', 'validate', path.join(skillsRoot, name)], { encoding: 'utf8', timeout: 120000 });
+ const run = runProgram('npx', ['-y', 'skills-ref', 'validate', path.join(skillsRoot, name)], { encoding: 'utf8', timeout: 120000 });
const out = `${run.stdout}${run.stderr}`;
if (run.status !== 0 && /ENOTFOUND|EAI_AGAIN|ETIMEDOUT|ECONNREFUSED|network/i.test(out)) return t.skip('skills-ref could not be fetched, the network is down');
assert.equal(run.status, 0, `${name}: ${out}`);