MCPcopy Create free account
hub / github.com/Noumena-Network/code / getPromptForCommand

Function getPromptForCommand

src/commands/insights.ts:3052–3187  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

3050 progressMessage: 'analyzing your sessions',
3051 source: 'builtin',
3052 async getPromptForCommand(args) {
3053 let collectRemote = false
3054 let remoteHosts: string[] = []
3055 let hasRemoteHosts = false
3056
3057 if (isInternalBuild()) {
3058 // Parse --homespaces flag
3059 collectRemote = args?.includes('--homespaces') ?? false
3060
3061 // Check for available remote hosts
3062 remoteHosts = await getRunningRemoteHosts()
3063 hasRemoteHosts = remoteHosts.length > 0
3064
3065 // Show collection message if collecting
3066 if (collectRemote && hasRemoteHosts) {
3067 // biome-ignore lint/suspicious/noConsole: intentional
3068 console.error(
3069 `Collecting sessions from ${remoteHosts.length} homespace(s): ${remoteHosts.join(', ')}...`,
3070 )
3071 }
3072 }
3073
3074 const { insights, htmlPath, data, remoteStats } = await generateUsageReport(
3075 { collectRemote },
3076 )
3077
3078 let reportUrl = `file://${htmlPath}`
3079 let uploadHint = ''
3080
3081 if (isInternalBuild()) {
3082 // Try to upload to S3
3083 const timestamp = new Date()
3084 .toISOString()
3085 .replace(/[-:]/g, '')
3086 .replace('T', '_')
3087 .slice(0, 15)
3088 const username = process.env.SAFEUSER || process.env.USER || 'unknown'
3089 const filename = `${username}_insights_${timestamp}.html`
3090 const s3Path = `s3://anthropic-serve/atamkin/cc-user-reports/${filename}`
3091 const s3Url = `https://s3-frontend.infra.ant.dev/anthropic-serve/atamkin/cc-user-reports/${filename}`
3092
3093 reportUrl = s3Url
3094 try {
3095 execFileSync('ff', ['cp', htmlPath, s3Path], {
3096 timeout: 60000,
3097 stdio: 'pipe', // Suppress output
3098 })
3099 } catch {
3100 // Upload failed - fall back to local file and show upload command
3101 reportUrl = `file://${htmlPath}`
3102 uploadHint = `\nAutomatic upload failed. Are you on the boron namespace? Try \`use-bo\` and ensure you've run \`sso\`.
3103To share, run: ff cp ${htmlPath} ${s3Path}
3104Then access at: ${s3Url}`
3105 }
3106 }
3107
3108 // Build header with stats
3109 const sessionLabel =

Callers

nothing calls this directly

Calls 5

isInternalBuildFunction · 0.85
generateUsageReportFunction · 0.85
jsonStringifyFunction · 0.85
getFacetsDirFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected