@@ -71,6 +71,42 @@ schema:
7171 ) ;
7272}
7373
74+ async function createLocalNonDottedApp ( tempDir : string , name : string ) {
75+ const appDir = `${ tempDir } /f/test/${ name } __app` ;
76+ await mkdir ( appDir , { recursive : true } ) ;
77+
78+ await writeFile (
79+ `${ appDir } /app.yaml` ,
80+ `summary: "${ name } app"
81+ value:
82+ type: app
83+ grid:
84+ - id: button1
85+ data:
86+ type: buttoncomponent
87+ componentInput:
88+ type: runnable
89+ runnable:
90+ type: runnableByName
91+ inlineScript:
92+ content: |
93+ export async function main() {
94+ return "hello from app";
95+ }
96+ language: bun
97+ hiddenInlineScripts: []
98+ css: {}
99+ norefreshbar: false
100+ policy:
101+ on_behalf_of: null
102+ on_behalf_of_email: null
103+ triggerables: {}
104+ execution_mode: viewer
105+ ` ,
106+ "utf-8"
107+ ) ;
108+ }
109+
74110async function fileExists ( filePath : string ) : Promise < boolean > {
75111 try {
76112 await stat ( filePath ) ;
@@ -228,6 +264,61 @@ describe("generate-metadata flags", () => {
228264 } ) ;
229265 } ) ;
230266
267+ test ( "generate-metadata preserves non-dotted flow inline script filenames" , async ( ) => {
268+ await withTestBackend ( async ( backend , tempDir ) => {
269+ await setupWorkspace ( backend , tempDir , "full_gen_non_dotted_flow_test" , true ) ;
270+
271+ await createLocalNonDottedFlow ( tempDir , "my_flow" ) ;
272+
273+ const result = await backend . runCLICommand (
274+ [ "generate-metadata" , "--yes" ] ,
275+ tempDir ,
276+ "full_gen_non_dotted_flow_test"
277+ ) ;
278+
279+ expect ( result . code ) . toEqual ( 0 ) ;
280+
281+ const flowDir = `${ tempDir } /f/test/my_flow__flow` ;
282+ const flowYaml = await readFile ( `${ flowDir } /flow.yaml` , "utf-8" ) ;
283+
284+ // Inline script references should use non-dotted naming
285+ expect ( flowYaml ) . toContain ( "!inline a.ts" ) ;
286+ expect ( flowYaml ) . toContain ( "!inline a.lock" ) ;
287+ expect ( flowYaml ) . not . toContain ( ".inline_script." ) ;
288+ expect ( await fileExists ( `${ flowDir } /a.ts` ) ) . toEqual ( true ) ;
289+ expect ( await fileExists ( `${ flowDir } /a.lock` ) ) . toEqual ( true ) ;
290+ expect ( await fileExists ( `${ flowDir } /a.inline_script.ts` ) ) . toEqual ( false ) ;
291+ expect ( await fileExists ( `${ flowDir } /a.inline_script.lock` ) ) . toEqual ( false ) ;
292+ } ) ;
293+ } ) ;
294+
295+ test ( "generate-metadata uses non-dotted app inline script filenames" , async ( ) => {
296+ await withTestBackend ( async ( backend , tempDir ) => {
297+ await setupWorkspace ( backend , tempDir , "non_dotted_app_gen_test" , true ) ;
298+
299+ await createLocalNonDottedApp ( tempDir , "my_app" ) ;
300+
301+ const result = await backend . runCLICommand (
302+ [ "generate-metadata" , "--yes" ] ,
303+ tempDir ,
304+ "non_dotted_app_gen_test"
305+ ) ;
306+
307+ expect ( result . code ) . toEqual ( 0 ) ;
308+
309+ const appDir = `${ tempDir } /f/test/my_app__app` ;
310+ const appYaml = await readFile ( `${ appDir } /app.yaml` , "utf-8" ) ;
311+
312+ // Inline script references should use non-dotted naming
313+ expect ( appYaml ) . not . toContain ( ".inline_script." ) ;
314+ // Verify no dotted inline script files were created
315+ const { readdir : readdirAsync } = await import ( "node:fs/promises" ) ;
316+ const files = await readdirAsync ( appDir ) ;
317+ const dottedFiles = files . filter ( ( f : string ) => f . includes ( ".inline_script." ) ) ;
318+ expect ( dottedFiles . length ) . toEqual ( 0 ) ;
319+ } ) ;
320+ } ) ;
321+
231322 test ( "--schema-only only processes scripts (skips flows and apps)" , async ( ) => {
232323 await withTestBackend ( async ( backend , tempDir ) => {
233324 await setupWorkspace ( backend , tempDir , "schema_only_test" ) ;
0 commit comments