test(dist-bundle): assert inlined prompt content survives bundling
After the prompts-core migration the TypeScript prompt sources were deleted; the only mechanism delivering markdown prompts to npm users is bun build inlining via bunfig.toml [loader] ".md" = "text" and import attributes. bun test runs from src/index.ts, not from dist/index.js, so a future Bun upgrade that silently regresses markdown inlining would pass source tests green while the published bundle is broken with Cannot find module ../prompts/atlas/default.md at first agent load. Add a smoke test that scans the built dist/index.js for unique signature strings from each migrated prompt file (15 signatures: 3 ultrawork + 5 atlas + 3 prometheus + 4 mode prompts). Skips gracefully if dist/index.js does not exist (local bun test before build). Wire into the existing CI Verify dist bundle tests step in .github/workflows/ci.yml so the regression catches in CI build. Closes pre-publish blocker V1 and V33.
This commit is contained in:
@@ -129,7 +129,7 @@ jobs:
|
||||
test -f dist/index.d.ts || (echo "ERROR: dist/index.d.ts not found!" && exit 1)
|
||||
|
||||
- name: Verify dist bundle tests
|
||||
run: bun test src/shared/dist-bundle-bun-globals.test.ts
|
||||
run: bun test src/shared/dist-bundle-bun-globals.test.ts src/shared/dist-bundle-prompt-content.test.ts
|
||||
|
||||
- name: Auto-commit schema changes
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/// <reference types="bun-types" />
|
||||
|
||||
import { describe, expect, test } from "bun:test"
|
||||
|
||||
const DIST_INDEX = "dist/index.js"
|
||||
const SKIP_MESSAGE = "[skipped - dist not built]"
|
||||
|
||||
const PROMPT_SIGNATURES = [
|
||||
{
|
||||
path: "packages/prompts-core/prompts/ultrawork/default.md",
|
||||
label: "Ultrawork default",
|
||||
signature: "ULTRAWORK MODE ENABLED!",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/ultrawork/gemini.md",
|
||||
label: "Ultrawork Gemini",
|
||||
signature: "ULTRAWORK MODE ENABLED!",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/ultrawork/gpt.md",
|
||||
label: "Ultrawork GPT",
|
||||
signature: "ULTRAWORK MODE ENABLED!",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/atlas/default.md",
|
||||
label: "Atlas default",
|
||||
signature: "You are Atlas - the Master Orchestrator from OhMyOpenCode.",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/atlas/gemini.md",
|
||||
label: "Atlas Gemini",
|
||||
signature: "Your value is ORCHESTRATION, not coding.",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/atlas/gpt.md",
|
||||
label: "Atlas GPT",
|
||||
signature: "This prompt is outcome-first. Choose the most efficient path to the outcomes above.",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/atlas/kimi.md",
|
||||
label: "Atlas Kimi",
|
||||
signature: "Trust the trained prior on the hard 30% (verification reasoning, failure diagnosis, dependency analysis).",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/atlas/opus-4-7.md",
|
||||
label: "Atlas Opus 4.7",
|
||||
signature: "Opus 4.7 spawns fewer subagents than Opus 4.6 unless told otherwise.",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/prometheus/default.md",
|
||||
label: "Prometheus default",
|
||||
signature: "YOU ARE A PLANNER. YOU ARE NOT AN IMPLEMENTER. YOU DO NOT WRITE CODE. YOU DO NOT EXECUTE TASKS.",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/prometheus/gemini.md",
|
||||
label: "Prometheus Gemini",
|
||||
signature: "If you feel the urge to write code or implement something - STOP. That is NOT your job.",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/prometheus/gpt.md",
|
||||
label: "Prometheus GPT",
|
||||
signature: "YOU ARE A PLANNER. NOT AN IMPLEMENTER. NOT A CODE WRITER.",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/mode/search.md",
|
||||
label: "Search mode",
|
||||
signature: "MAXIMIZE SEARCH EFFORT. Launch multiple background agents IN PARALLEL:",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/mode/analyze.md",
|
||||
label: "Analyze mode",
|
||||
signature: "IF COMPLEX - DO NOT STRUGGLE ALONE. Consult specialists:",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/mode/team.md",
|
||||
label: "Team mode",
|
||||
signature: "Team-mode reference detected. Orchestrate via team_* tools",
|
||||
},
|
||||
{
|
||||
path: "packages/prompts-core/prompts/mode/hyperplan.md",
|
||||
label: "Hyperplan mode",
|
||||
signature: "HYPERPLAN MODE ENABLED!",
|
||||
},
|
||||
] as const
|
||||
|
||||
describe("dist bundle prompt content", () => {
|
||||
test("#given dist bundle #when scanned #then markdown prompt signatures are inlined", async () => {
|
||||
const distIndex = Bun.file(DIST_INDEX)
|
||||
if (!(await distIndex.exists())) {
|
||||
console.info(SKIP_MESSAGE)
|
||||
return
|
||||
}
|
||||
|
||||
const bundle = await distIndex.text()
|
||||
|
||||
for (const prompt of PROMPT_SIGNATURES) {
|
||||
expect(
|
||||
bundle.includes(prompt.signature),
|
||||
`${prompt.label} prompt content missing from dist/index.js (${prompt.path}): markdown inlining may have regressed`,
|
||||
).toBe(true)
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user