@@ -290,18 +290,21 @@ OPTIONS:
290290 --limit <n> Max results [default: 10]
291291 --daysAgo <n> Filter to last N days
292292 --summary Return summaries only (faster)
293+ --verbose Show generated GraphQL query
293294
294295EXAMPLES:
295296 simple-memory search --query "typescript"
296297 simple-memory search --tags "project,work" --limit 20
297298 simple-memory search --query "bug" --daysAgo 7
299+ simple-memory search --query "api" --verbose
298300` ,
299301 store : `
300302simple-memory store - Store a new memory
301303
302304OPTIONS:
303305 --content <text> Content to store (required)
304306 --tags <tags> Tags (comma-separated)
307+ --verbose Show generated GraphQL query
305308
306309EXAMPLES:
307310 simple-memory store --content "Remember this note"
@@ -355,6 +358,17 @@ No options needed.
355358
356359EXAMPLES:
357360 simple-memory stats
361+ ` ,
362+ graphql : `
363+ simple-memory graphql - Execute raw GraphQL query
364+
365+ OPTIONS:
366+ --query <graphql> GraphQL query or mutation (required)
367+
368+ EXAMPLES:
369+ simple-memory graphql --query '{ stats { totalMemories } }'
370+ simple-memory graphql --query '{ memories(limit: 5) { hash title tags } }'
371+ simple-memory graphql --query 'mutation { store(content: "text") { hash } }'
358372` ,
359373 } ;
360374
@@ -379,6 +393,13 @@ async function main() {
379393 // Remove transport flags from args
380394 const cliArgs = args . filter ( arg => arg !== '--http' && arg !== '--both' ) ;
381395
396+ // Suppress debug output in CLI mode for cleaner output (must be set before service init)
397+ // But respect explicit MEMORY_DEBUG=true if user wants debug in CLI
398+ const isCliMode = cliArgs . length > 0 ;
399+ if ( isCliMode && process . env . MEMORY_DEBUG !== 'true' ) {
400+ process . env . MEMORY_DEBUG = 'false' ;
401+ }
402+
382403 // Initialize services (backup auto-configures from env vars)
383404 memoryService = initializeServices ( ) ;
384405
@@ -408,6 +429,13 @@ async function main() {
408429
409430 try {
410431 const query = CLI_SHORTCUTS [ command ] ( parsedArgs ) ;
432+
433+ // Show generated GraphQL if --verbose flag is set (helps users learn GraphQL)
434+ if ( parsedArgs . verbose ) {
435+ console . log ( 'Generated GraphQL:' , query ) ;
436+ console . log ( '---' ) ;
437+ }
438+
411439 const result = await executeGraphQLQuery ( query ) ;
412440 console . log ( JSON . stringify ( result , null , 2 ) ) ;
413441 process . exit ( 0 ) ;
@@ -421,8 +449,15 @@ async function main() {
421449 // Handle raw GraphQL
422450 if ( command === 'graphql' ) {
423451 const parsedArgs = parseCliArgs ( cliArgs . slice ( 1 ) ) ;
452+
453+ if ( parsedArgs . help ) {
454+ showCommandHelp ( 'graphql' ) ;
455+ process . exit ( 0 ) ;
456+ }
457+
424458 if ( ! parsedArgs . query ) {
425459 console . error ( 'Error: --query is required' ) ;
460+ console . log ( '\nRun "simple-memory graphql --help" for usage.' ) ;
426461 process . exit ( 1 ) ;
427462 }
428463 const result = await executeGraphQLQuery ( parsedArgs . query ) ;
0 commit comments