File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,26 @@ describe('assembled html instructions', () => {
4646 } ) ;
4747} ) ;
4848
49+ /**
50+ * The app scenario's guidance must actually ship. It was written into
51+ * scenarios.ts and asserted there — and instructionsFor dropped it for every
52+ * non-html project, so the prompt said nothing about the database helper or
53+ * the component library. Presence in the table is not delivery; this reads
54+ * the prompt itself.
55+ */
56+ describe ( 'app scenario guidance' , ( ) => {
57+ it ( 'ships with an app turn' , ( ) => {
58+ const prompt = instructionsFor ( 'next' , 'app' ) ;
59+ expect ( prompt ) . toContain ( '@/lib/db' ) ;
60+ expect ( prompt ) . toContain ( '@/components/ui' ) ;
61+ } ) ;
62+
63+ it ( 'stays absent for legacy projects with no scenario' , ( ) => {
64+ expect ( instructionsFor ( 'next' , null ) ) . not . toContain ( '@/lib/db' ) ;
65+ expect ( instructionsFor ( null , null ) ) . not . toContain ( '@/lib/db' ) ;
66+ } ) ;
67+ } ) ;
68+
4969/**
5070 * The replay window is 20 turns. NOTES.md is the only thing that outlives it,
5171 * so both kinds have to be told to keep it — a Next project forgets its
Original file line number Diff line number Diff line change @@ -116,17 +116,19 @@ export class ChatController {
116116 }
117117
118118 /**
119- * What the user said they were making, from the page's own meta tag .
119+ * What the user said they were making.
120120 *
121- * Stored in the file rather than a column: the same trick the design system
122- * uses, and it means no migration and no DB_SYNCHRONIZE deploy. Null for a
123- * Next app or a page scaffolded before scenarios existed — the agent then
124- * gets its plain instructions, which is what it had all along.
121+ * Page projects carry it in the page's own meta tag — a file, like the
122+ * design tokens: no column, no migration, no DB_SYNCHRONIZE deploy. A Next
123+ * app is the 'app' scenario by construction (it is the only next kind
124+ * today), and its guidance is exactly what a turn needs: the database
125+ * helper and the component library only help if the model is told.
125126 */
126127 private async scenarioOf ( project : {
127128 projectPath : string ;
128129 template ?: string | null ;
129130 } ) : Promise < string | null > {
131+ if ( project . template === 'next' ) return 'app' ;
130132 if ( project . template !== 'html' ) return null ;
131133 try {
132134 const workspace = await this . workspaces . for ( project . projectPath ) ;
Original file line number Diff line number Diff line change @@ -92,10 +92,14 @@ export const instructionsFor = (
9292 template ?: string | null ,
9393 scenarioId ?: string | null ,
9494) : string => {
95- if ( template !== 'html' ) return `${ INSTRUCTIONS } \n\n${ NOTES_SECTION } ` ;
96- // What the user said they were making, so the agent builds that shape
97- // rather than defaulting every project to a centered hero.
95+ // The scenario's guidance rides every turn, whichever kind of project it
96+ // is. It used to be html-only: the app guidance (the database helper, the
97+ // component library) was written, tested for presence, and never shipped
98+ // to the model — a next project's prompt said nothing about either.
9899 const shape = scenarioId ? scenario ( scenarioId ) . guidance : '' ;
100+ if ( template !== 'html' ) {
101+ return [ INSTRUCTIONS , shape , NOTES_SECTION ] . filter ( Boolean ) . join ( '\n\n' ) ;
102+ }
99103 // STYLE_SECTION after PLAN_SECTION, not before: PLAN_SECTION carries its
100104 // own question example using `"id":"style"` with free-text options, and a
101105 // model copies the nearest example. Ordered the other way the style rules
You can’t perform that action at this time.
0 commit comments