@@ -254,6 +254,96 @@ describe("CLI", () => {
254254 ) ;
255255 } ) ;
256256
257+ it ( "should show automation command in outro for interactive mode" , async ( ) => {
258+ const { outro } = await import ( "@clack/prompts" ) ;
259+ const { main } = await import ( "./cli.js" ) ;
260+
261+ await setupInteractiveMocks ( {
262+ scope : "project" ,
263+ prefix : "my-" ,
264+ flags : [ "beads" ] ,
265+ commands : [ "red.md" , "green.md" ] ,
266+ } ) ;
267+
268+ await main ( ) ;
269+
270+ expect ( outro ) . toHaveBeenCalledWith (
271+ expect . stringContaining ( "npx @wbern/claude-instructions" ) ,
272+ ) ;
273+ expect ( outro ) . toHaveBeenCalledWith (
274+ expect . stringContaining ( "--scope=project" ) ,
275+ ) ;
276+ expect ( outro ) . toHaveBeenCalledWith ( expect . stringContaining ( "--prefix=my-" ) ) ;
277+ expect ( outro ) . toHaveBeenCalledWith (
278+ expect . stringContaining ( "--flags=beads" ) ,
279+ ) ;
280+ } ) ;
281+
282+ it ( "should include --commands in automation note when specific commands selected" , async ( ) => {
283+ const { outro } = await import ( "@clack/prompts" ) ;
284+ const { main } = await import ( "./cli.js" ) ;
285+
286+ await setupInteractiveMocks ( {
287+ scope : "project" ,
288+ commands : [ "red.md" , "green.md" ] ,
289+ } ) ;
290+
291+ await main ( ) ;
292+
293+ expect ( outro ) . toHaveBeenCalledWith (
294+ expect . stringContaining ( "--commands=red.md,green.md" ) ,
295+ ) ;
296+ } ) ;
297+
298+ it ( "should NOT include --commands in automation note when no commands selected" , async ( ) => {
299+ const { outro } = await import ( "@clack/prompts" ) ;
300+ const { main } = await import ( "./cli.js" ) ;
301+
302+ await setupInteractiveMocks ( {
303+ scope : "project" ,
304+ commands : [ ] ,
305+ } ) ;
306+
307+ await main ( ) ;
308+
309+ expect ( outro ) . toHaveBeenCalledWith (
310+ expect . not . stringContaining ( "--commands=" ) ,
311+ ) ;
312+ } ) ;
313+
314+ it ( "should include --allowed-tools in automation note when tools selected" , async ( ) => {
315+ const { outro } = await import ( "@clack/prompts" ) ;
316+ const { main } = await import ( "./cli.js" ) ;
317+
318+ await setupInteractiveMocks ( {
319+ scope : "project" ,
320+ allowedTools : [ "Bash(git diff:*)" , "Bash(git status:*)" ] ,
321+ } ) ;
322+
323+ await main ( ) ;
324+
325+ expect ( outro ) . toHaveBeenCalledWith (
326+ expect . stringContaining (
327+ "--allowed-tools=Bash(git diff:*),Bash(git status:*)" ,
328+ ) ,
329+ ) ;
330+ } ) ;
331+
332+ it ( "should NOT show automation note in non-interactive mode" , async ( ) => {
333+ const { outro } = await import ( "@clack/prompts" ) ;
334+ const { main } = await import ( "./cli.js" ) ;
335+
336+ await main ( {
337+ scope : "project" ,
338+ prefix : "my-" ,
339+ flags : [ "beads" ] ,
340+ } ) ;
341+
342+ expect ( outro ) . toHaveBeenCalledWith (
343+ expect . not . stringContaining ( "To automate this setup" ) ,
344+ ) ;
345+ } ) ;
346+
257347 it ( "should prompt for command prefix and pass it to generator" , async ( ) => {
258348 const { text } = await import ( "@clack/prompts" ) ;
259349 const { generateToDirectory } = await import ( "./cli-generator.js" ) ;
@@ -1784,4 +1874,23 @@ describe("non-TTY mode", () => {
17841874 } ) ,
17851875 ) ;
17861876 } ) ;
1877+
1878+ it ( "should pass allowedTools from CLI args to generator in non-interactive mode" , async ( ) => {
1879+ const { generateToDirectory } = await import ( "./cli-generator.js" ) ;
1880+ const { main } = await import ( "./cli.js" ) ;
1881+
1882+ await main ( {
1883+ scope : "project" ,
1884+ prefix : "" ,
1885+ allowedTools : [ "Bash(git diff:*)" , "Bash(git status:*)" ] ,
1886+ } ) ;
1887+
1888+ expect ( generateToDirectory ) . toHaveBeenCalledWith (
1889+ undefined ,
1890+ "project" ,
1891+ expect . objectContaining ( {
1892+ allowedTools : [ "Bash(git diff:*)" , "Bash(git status:*)" ] ,
1893+ } ) ,
1894+ ) ;
1895+ } ) ;
17871896} ) ;
0 commit comments