mirror of
https://github.com/garrytan/gstack.git
synced 2026-06-18 07:40:09 +02:00
Merge remote-tracking branch 'origin/main' into garrytan/dublin-v1
# Conflicts: # CHANGELOG.md # VERSION # package.json
This commit is contained in:
@@ -1098,6 +1098,26 @@ describe('Plan status footer in preamble', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// --- make-pdf setup ordering ---
|
||||
|
||||
describe('make-pdf setup ordering', () => {
|
||||
test('MAKE-PDF SETUP appears before generic preamble footer sections', () => {
|
||||
const content = fs.readFileSync(path.join(ROOT, 'make-pdf', 'SKILL.md'), 'utf-8');
|
||||
const preambleIdx = content.indexOf('## Preamble (run first)');
|
||||
const setupIdx = content.indexOf('## MAKE-PDF SETUP');
|
||||
const planModeIdx = content.indexOf('## Plan Mode Safe Operations');
|
||||
const telemetryIdx = content.indexOf('## Telemetry (run last)');
|
||||
const workflowIdx = content.indexOf('# make-pdf: publication-quality PDFs from markdown');
|
||||
|
||||
expect(preambleIdx).toBeGreaterThanOrEqual(0);
|
||||
expect(setupIdx).toBeGreaterThan(preambleIdx);
|
||||
expect(setupIdx).toBeLessThan(planModeIdx);
|
||||
expect(setupIdx).toBeLessThan(telemetryIdx);
|
||||
expect(setupIdx).toBeLessThan(workflowIdx);
|
||||
expect(content.match(/^## MAKE-PDF SETUP/gm)?.length ?? 0).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
// --- Skill invocation during plan mode in preamble ---
|
||||
|
||||
describe('Skill invocation during plan mode in preamble', () => {
|
||||
|
||||
@@ -56,13 +56,6 @@ function withFreezeDir(freezePath: string, fn: (stateDir: string) => void) {
|
||||
}
|
||||
}
|
||||
|
||||
// Detect whether the safe-rm-targets regex works on this platform.
|
||||
// macOS sed -E does not support \s, so the safe exception check fails there.
|
||||
function detectSafeRmWorks(): boolean {
|
||||
const { output } = runHook(CAREFUL_SCRIPT, carefulInput('rm -rf node_modules'));
|
||||
return output.permissionDecision === undefined;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// check-careful.sh tests
|
||||
// ============================================================
|
||||
@@ -88,24 +81,13 @@ describe('check-careful.sh', () => {
|
||||
test('rm -rf node_modules allows (safe exception)', () => {
|
||||
const { exitCode, output } = runHook(CAREFUL_SCRIPT, carefulInput('rm -rf node_modules'));
|
||||
expect(exitCode).toBe(0);
|
||||
if (detectSafeRmWorks()) {
|
||||
// GNU sed: safe exception triggers, allows through
|
||||
expect(output.permissionDecision).toBeUndefined();
|
||||
} else {
|
||||
// macOS sed: safe exception regex uses \\s which is unsupported,
|
||||
// so the safe-targets check fails and the command warns
|
||||
expect(output.permissionDecision).toBe('ask');
|
||||
}
|
||||
expect(output.permissionDecision).toBeUndefined();
|
||||
});
|
||||
|
||||
test('rm -rf .next dist allows (multiple safe targets)', () => {
|
||||
const { exitCode, output } = runHook(CAREFUL_SCRIPT, carefulInput('rm -rf .next dist'));
|
||||
expect(exitCode).toBe(0);
|
||||
if (detectSafeRmWorks()) {
|
||||
expect(output.permissionDecision).toBeUndefined();
|
||||
} else {
|
||||
expect(output.permissionDecision).toBe('ask');
|
||||
}
|
||||
expect(output.permissionDecision).toBeUndefined();
|
||||
});
|
||||
|
||||
test('rm -rf node_modules /var/data warns (mixed safe+unsafe)', () => {
|
||||
|
||||
Reference in New Issue
Block a user