@jaypie/mcp 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/createMcpServer.d.ts +7 -1
- package/dist/index.js +22 -2088
- package/dist/index.js.map +1 -1
- package/dist/suite.js +1197 -7
- package/dist/suite.js.map +1 -1
- package/package.json +1 -2
- package/release-notes/fabric/0.1.3.md +25 -0
- package/release-notes/fabric/0.1.4.md +42 -0
- package/release-notes/mcp/0.4.0.md +27 -0
- package/release-notes/testkit/1.2.15.md +23 -0
- package/skills/fabric.md +30 -3
- package/dist/aws-B3dW_-bD.js +0 -1202
- package/dist/aws-B3dW_-bD.js.map +0 -1
- package/prompts/Branch_Management.md +0 -34
- package/prompts/Development_Process.md +0 -89
- package/prompts/Jaypie_Agent_Rules.md +0 -110
- package/prompts/Jaypie_Auth0_Express_Mongoose.md +0 -736
- package/prompts/Jaypie_Browser_and_Frontend_Web_Packages.md +0 -18
- package/prompts/Jaypie_CDK_Constructs_and_Patterns.md +0 -430
- package/prompts/Jaypie_CICD_with_GitHub_Actions.md +0 -371
- package/prompts/Jaypie_Commander_CLI_Package.md +0 -166
- package/prompts/Jaypie_Core_Errors_and_Logging.md +0 -39
- package/prompts/Jaypie_DynamoDB_Package.md +0 -774
- package/prompts/Jaypie_Eslint_NPM_Package.md +0 -78
- package/prompts/Jaypie_Express_Package.md +0 -630
- package/prompts/Jaypie_Fabric_Commander.md +0 -411
- package/prompts/Jaypie_Fabric_LLM.md +0 -312
- package/prompts/Jaypie_Fabric_Lambda.md +0 -308
- package/prompts/Jaypie_Fabric_MCP.md +0 -316
- package/prompts/Jaypie_Fabric_Package.md +0 -599
- package/prompts/Jaypie_Fabricator.md +0 -617
- package/prompts/Jaypie_Ideal_Project_Structure.md +0 -78
- package/prompts/Jaypie_Init_CICD_with_GitHub_Actions.md +0 -1186
- package/prompts/Jaypie_Init_Express_on_Lambda.md +0 -115
- package/prompts/Jaypie_Init_Jaypie_CDK_Package.md +0 -35
- package/prompts/Jaypie_Init_Lambda_Package.md +0 -505
- package/prompts/Jaypie_Init_Monorepo_Project.md +0 -44
- package/prompts/Jaypie_Init_Project_Subpackage.md +0 -65
- package/prompts/Jaypie_Legacy_Patterns.md +0 -15
- package/prompts/Jaypie_Llm_Calls.md +0 -449
- package/prompts/Jaypie_Llm_Tools.md +0 -155
- package/prompts/Jaypie_MCP_Package.md +0 -281
- package/prompts/Jaypie_Mocks_and_Testkit.md +0 -137
- package/prompts/Jaypie_Repokit.md +0 -103
- package/prompts/Jaypie_Scrub.md +0 -177
- package/prompts/Jaypie_Streaming.md +0 -467
- package/prompts/Templates_CDK_Subpackage.md +0 -115
- package/prompts/Templates_Express_Subpackage.md +0 -187
- package/prompts/Templates_Project_Monorepo.md +0 -326
- package/prompts/Templates_Project_Subpackage.md +0 -93
- package/prompts/Write_Efficient_Prompt_Guides.md +0 -48
- package/prompts/Write_and_Maintain_Engaging_Readme.md +0 -67
package/dist/aws-B3dW_-bD.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aws-B3dW_-bD.js","sources":["../src/datadog.ts","../src/llm.ts","../src/aws.ts"],"sourcesContent":["/**\n * Datadog API integration module\n */\nimport * as https from \"node:https\";\n\nexport interface DatadogCredentials {\n apiKey: string;\n appKey: string;\n}\n\nexport interface DatadogSearchOptions {\n query?: string;\n source?: string;\n env?: string;\n service?: string;\n from?: string;\n to?: string;\n limit?: number;\n sort?: \"timestamp\" | \"-timestamp\";\n}\n\nexport interface DatadogAnalyticsOptions {\n query?: string;\n source?: string;\n env?: string;\n service?: string;\n from?: string;\n to?: string;\n groupBy: string[];\n compute?: Array<{\n aggregation: \"count\" | \"avg\" | \"sum\" | \"min\" | \"max\" | \"cardinality\";\n metric?: string;\n }>;\n}\n\n// Monitors types\nexport interface DatadogMonitorsOptions {\n tags?: string[];\n monitorTags?: string[];\n name?: string;\n status?: (\"Alert\" | \"Warn\" | \"No Data\" | \"OK\")[];\n}\n\nexport interface DatadogMonitor {\n id: number;\n name: string;\n type: string;\n status: string;\n message?: string;\n tags: string[];\n priority?: number;\n query?: string;\n overallState?: string;\n}\n\nexport interface DatadogMonitorsResult {\n success: boolean;\n monitors: DatadogMonitor[];\n error?: string;\n}\n\n// Synthetics types\nexport interface DatadogSyntheticsOptions {\n tags?: string[];\n type?: \"api\" | \"browser\";\n}\n\nexport interface DatadogSyntheticTest {\n publicId: string;\n name: string;\n type: string;\n status: string;\n tags: string[];\n locations: string[];\n message?: string;\n}\n\nexport interface DatadogSyntheticResult {\n publicId: string;\n resultId: string;\n status: number;\n checkTime: number;\n passed: boolean;\n location?: string;\n}\n\nexport interface DatadogSyntheticsResult {\n success: boolean;\n tests: DatadogSyntheticTest[];\n error?: string;\n}\n\nexport interface DatadogSyntheticResultsResult {\n success: boolean;\n publicId: string;\n results: DatadogSyntheticResult[];\n error?: string;\n}\n\n// Metrics types\nexport interface DatadogMetricsOptions {\n query: string;\n from: number;\n to: number;\n}\n\nexport interface DatadogMetricSeries {\n metric: string;\n scope: string;\n pointlist: Array<[number, number | null]>;\n unit?: string;\n}\n\nexport interface DatadogMetricsResult {\n success: boolean;\n query: string;\n timeRange: { from: number; to: number };\n series: DatadogMetricSeries[];\n error?: string;\n}\n\n// RUM types\nexport interface DatadogRumOptions {\n query?: string;\n from?: string;\n to?: string;\n limit?: number;\n sort?: \"timestamp\" | \"-timestamp\";\n}\n\nexport interface DatadogRumEvent {\n id: string;\n type: string;\n timestamp?: string;\n sessionId?: string;\n viewUrl?: string;\n viewName?: string;\n errorMessage?: string;\n errorType?: string;\n attributes?: Record<string, unknown>;\n}\n\nexport interface DatadogRumResult {\n success: boolean;\n query: string;\n timeRange: { from: string; to: string };\n events: DatadogRumEvent[];\n error?: string;\n}\n\nexport interface DatadogLogEntry {\n id: string;\n timestamp?: string;\n status?: string;\n service?: string;\n message?: string;\n attributes?: Record<string, unknown>;\n}\n\nexport interface DatadogSearchResult {\n success: boolean;\n query: string;\n timeRange: { from: string; to: string };\n logs: DatadogLogEntry[];\n error?: string;\n}\n\nexport interface DatadogAnalyticsBucket {\n by: Record<string, string>;\n computes: Record<string, number>;\n}\n\nexport interface DatadogAnalyticsResult {\n success: boolean;\n query: string;\n timeRange: { from: string; to: string };\n groupBy: string[];\n buckets: DatadogAnalyticsBucket[];\n error?: string;\n}\n\ninterface Logger {\n info: (message: string, ...args: unknown[]) => void;\n error: (message: string, ...args: unknown[]) => void;\n}\n\nconst nullLogger: Logger = {\n info: () => {},\n error: () => {},\n};\n\n/**\n * Get Datadog credentials from environment variables\n */\nexport function getDatadogCredentials(): DatadogCredentials | null {\n const apiKey = process.env.DATADOG_API_KEY || process.env.DD_API_KEY;\n const appKey =\n process.env.DATADOG_APP_KEY ||\n process.env.DATADOG_APPLICATION_KEY ||\n process.env.DD_APP_KEY ||\n process.env.DD_APPLICATION_KEY;\n\n if (!apiKey || !appKey) {\n return null;\n }\n\n return { apiKey, appKey };\n}\n\n/**\n * Validate Datadog API credentials\n */\nexport async function validateDatadogCredentials(\n credentials: DatadogCredentials,\n): Promise<{ valid: boolean; error?: string }> {\n return new Promise((resolve) => {\n const options = {\n hostname: \"api.datadoghq.com\",\n port: 443,\n path: \"/api/v1/validate\",\n method: \"GET\",\n headers: {\n \"DD-API-KEY\": credentials.apiKey,\n \"DD-APPLICATION-KEY\": credentials.appKey,\n },\n };\n\n const req = https.request(options, (res) => {\n let data = \"\";\n\n res.on(\"data\", (chunk: Buffer) => {\n data += chunk.toString();\n });\n\n res.on(\"end\", () => {\n if (res.statusCode === 200) {\n resolve({ valid: true });\n } else {\n resolve({\n valid: false,\n error: `Datadog API returned status ${res.statusCode}: ${data}`,\n });\n }\n });\n });\n\n req.on(\"error\", (error) => {\n resolve({ valid: false, error: error.message });\n });\n\n req.end();\n });\n}\n\n/**\n * Build query string from environment variables and options\n */\nexport function buildDatadogQuery(options: DatadogSearchOptions): string {\n const ddEnv = process.env.DD_ENV;\n const ddService = process.env.DD_SERVICE;\n const ddSource = process.env.DD_SOURCE;\n const ddQuery = process.env.DD_QUERY;\n\n const queryParts: string[] = [];\n\n // Add source (parameter > env var > default 'lambda')\n const effectiveSource = options.source || ddSource || \"lambda\";\n queryParts.push(`source:${effectiveSource}`);\n\n // Add env (parameter > env var)\n const effectiveEnv = options.env || ddEnv;\n if (effectiveEnv) {\n queryParts.push(`env:${effectiveEnv}`);\n }\n\n // Add service (parameter > env var)\n const effectiveService = options.service || ddService;\n if (effectiveService) {\n queryParts.push(`service:${effectiveService}`);\n }\n\n // Add base query from DD_QUERY if available\n if (ddQuery) {\n queryParts.push(ddQuery);\n }\n\n // Add user-provided query terms\n if (options.query) {\n queryParts.push(options.query);\n }\n\n return queryParts.join(\" \");\n}\n\n/**\n * Search Datadog logs\n */\nexport async function searchDatadogLogs(\n credentials: DatadogCredentials,\n options: DatadogSearchOptions = {},\n logger: Logger = nullLogger,\n): Promise<DatadogSearchResult> {\n const effectiveQuery = buildDatadogQuery(options);\n const effectiveFrom = options.from || \"now-15m\";\n const effectiveTo = options.to || \"now\";\n const effectiveLimit = Math.min(options.limit || 50, 1000);\n const effectiveSort = options.sort || \"-timestamp\";\n\n logger.info(`Effective query: ${effectiveQuery}`);\n logger.info(\n `Search params: from=${effectiveFrom}, to=${effectiveTo}, limit=${effectiveLimit}, sort=${effectiveSort}`,\n );\n\n const requestBody = JSON.stringify({\n filter: {\n query: effectiveQuery,\n from: effectiveFrom,\n to: effectiveTo,\n },\n page: {\n limit: effectiveLimit,\n },\n sort: effectiveSort,\n });\n\n return new Promise((resolve) => {\n const requestOptions = {\n hostname: \"api.datadoghq.com\",\n port: 443,\n path: \"/api/v2/logs/events/search\",\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"DD-API-KEY\": credentials.apiKey,\n \"DD-APPLICATION-KEY\": credentials.appKey,\n \"Content-Length\": Buffer.byteLength(requestBody),\n },\n };\n\n const req = https.request(requestOptions, (res) => {\n let data = \"\";\n\n res.on(\"data\", (chunk: Buffer) => {\n data += chunk.toString();\n });\n\n res.on(\"end\", () => {\n logger.info(`Response status: ${res.statusCode}`);\n\n if (res.statusCode !== 200) {\n logger.error(`Datadog API error: ${res.statusCode}`);\n let errorMessage = `Datadog API returned status ${res.statusCode}: ${data}`;\n if (res.statusCode === 400) {\n errorMessage = `Invalid query syntax. Check your query: \"${effectiveQuery}\". Datadog error: ${data}`;\n } else if (res.statusCode === 403) {\n errorMessage =\n \"Access denied. Verify your API and Application keys have logs_read permission.\";\n } else if (res.statusCode === 429) {\n errorMessage =\n \"Rate limited by Datadog. Wait a moment and try again, or reduce your query scope.\";\n }\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n logs: [],\n error: errorMessage,\n });\n return;\n }\n\n try {\n const response = JSON.parse(data) as {\n data?: Array<{\n id: string;\n attributes?: {\n timestamp?: string;\n status?: string;\n service?: string;\n message?: string;\n attributes?: Record<string, unknown>;\n };\n }>;\n };\n\n const logs = (response.data || []).map((log) => {\n const attrs = log.attributes || {};\n return {\n id: log.id,\n timestamp: attrs.timestamp,\n status: attrs.status,\n service: attrs.service,\n message: attrs.message,\n attributes: attrs.attributes,\n };\n });\n\n logger.info(`Retrieved ${logs.length} log entries`);\n\n resolve({\n success: true,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n logs,\n });\n } catch (parseError) {\n logger.error(\"Failed to parse Datadog response:\", parseError);\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n logs: [],\n error: `Failed to parse response: ${parseError instanceof Error ? parseError.message : \"Unknown error\"}`,\n });\n }\n });\n });\n\n req.on(\"error\", (error) => {\n logger.error(\"Request error:\", error);\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n logs: [],\n error: `Connection error: ${error.message}`,\n });\n });\n\n req.write(requestBody);\n req.end();\n });\n}\n\n/**\n * Aggregate Datadog logs using the Analytics API\n * Groups logs by specified fields and computes aggregations\n */\nexport async function aggregateDatadogLogs(\n credentials: DatadogCredentials,\n options: DatadogAnalyticsOptions,\n logger: Logger = nullLogger,\n): Promise<DatadogAnalyticsResult> {\n const effectiveQuery = buildDatadogQuery(options);\n const effectiveFrom = options.from || \"now-15m\";\n const effectiveTo = options.to || \"now\";\n const groupBy = options.groupBy;\n const compute = options.compute || [{ aggregation: \"count\" as const }];\n\n logger.info(`Analytics query: ${effectiveQuery}`);\n logger.info(`Group by: ${groupBy.join(\", \")}`);\n logger.info(`Time range: ${effectiveFrom} to ${effectiveTo}`);\n\n // Build compute array - each item needs aggregation and type\n const computeItems = compute.map((c) => {\n const item: {\n aggregation: string;\n type: string;\n metric?: string;\n } = {\n aggregation: c.aggregation,\n type: \"total\",\n };\n if (c.metric) {\n item.metric = c.metric;\n }\n return item;\n });\n\n // Build group_by with proper sort configuration\n const groupByItems = groupBy.map((field) => {\n const item: {\n facet: string;\n limit: number;\n sort: {\n type: string;\n order: string;\n aggregation?: string;\n };\n } = {\n facet: field,\n limit: 100,\n sort: {\n type: \"measure\",\n order: \"desc\",\n aggregation: compute[0]?.aggregation || \"count\",\n },\n };\n return item;\n });\n\n const requestBody = JSON.stringify({\n filter: {\n query: effectiveQuery,\n from: effectiveFrom,\n to: effectiveTo,\n },\n group_by: groupByItems,\n compute: computeItems,\n page: {\n limit: 100,\n },\n });\n\n return new Promise((resolve) => {\n const requestOptions = {\n hostname: \"api.datadoghq.com\",\n port: 443,\n path: \"/api/v2/logs/analytics/aggregate\",\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"DD-API-KEY\": credentials.apiKey,\n \"DD-APPLICATION-KEY\": credentials.appKey,\n \"Content-Length\": Buffer.byteLength(requestBody),\n },\n };\n\n const req = https.request(requestOptions, (res) => {\n let data = \"\";\n\n res.on(\"data\", (chunk: Buffer) => {\n data += chunk.toString();\n });\n\n res.on(\"end\", () => {\n logger.info(`Response status: ${res.statusCode}`);\n\n if (res.statusCode !== 200) {\n logger.error(`Datadog Analytics API error: ${res.statusCode}`);\n let errorMessage = `Datadog API returned status ${res.statusCode}: ${data}`;\n if (res.statusCode === 400) {\n errorMessage = `Invalid query or groupBy fields. Verify facet names exist: ${groupBy.join(\", \")}. Datadog error: ${data}`;\n } else if (res.statusCode === 403) {\n errorMessage =\n \"Access denied. Verify your API and Application keys have logs_read permission.\";\n } else if (res.statusCode === 429) {\n errorMessage =\n \"Rate limited by Datadog. Wait a moment and try again, or reduce your query scope.\";\n }\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n groupBy,\n buckets: [],\n error: errorMessage,\n });\n return;\n }\n\n try {\n const response = JSON.parse(data) as {\n data?: {\n buckets?: Array<{\n by?: Record<string, string>;\n computes?: Record<string, number>;\n }>;\n };\n };\n\n const buckets = (response.data?.buckets || []).map((bucket) => ({\n by: bucket.by || {},\n computes: bucket.computes || {},\n }));\n\n logger.info(`Retrieved ${buckets.length} aggregation buckets`);\n\n resolve({\n success: true,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n groupBy,\n buckets,\n });\n } catch (parseError) {\n logger.error(\n \"Failed to parse Datadog analytics response:\",\n parseError,\n );\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n groupBy,\n buckets: [],\n error: `Failed to parse response: ${parseError instanceof Error ? parseError.message : \"Unknown error\"}`,\n });\n }\n });\n });\n\n req.on(\"error\", (error) => {\n logger.error(\"Request error:\", error);\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n groupBy,\n buckets: [],\n error: `Connection error: ${error.message}`,\n });\n });\n\n req.write(requestBody);\n req.end();\n });\n}\n\n/**\n * List Datadog monitors with optional filtering\n */\nexport async function listDatadogMonitors(\n credentials: DatadogCredentials,\n options: DatadogMonitorsOptions = {},\n logger: Logger = nullLogger,\n): Promise<DatadogMonitorsResult> {\n logger.info(\"Fetching Datadog monitors\");\n\n const queryParams = new URLSearchParams();\n\n if (options.tags && options.tags.length > 0) {\n queryParams.set(\"tags\", options.tags.join(\",\"));\n }\n if (options.monitorTags && options.monitorTags.length > 0) {\n queryParams.set(\"monitor_tags\", options.monitorTags.join(\",\"));\n }\n if (options.name) {\n queryParams.set(\"name\", options.name);\n }\n\n const queryString = queryParams.toString();\n const path = `/api/v1/monitor${queryString ? `?${queryString}` : \"\"}`;\n\n logger.info(`Request path: ${path}`);\n\n return new Promise((resolve) => {\n const requestOptions = {\n hostname: \"api.datadoghq.com\",\n port: 443,\n path,\n method: \"GET\",\n headers: {\n \"DD-API-KEY\": credentials.apiKey,\n \"DD-APPLICATION-KEY\": credentials.appKey,\n },\n };\n\n const req = https.request(requestOptions, (res) => {\n let data = \"\";\n\n res.on(\"data\", (chunk: Buffer) => {\n data += chunk.toString();\n });\n\n res.on(\"end\", () => {\n logger.info(`Response status: ${res.statusCode}`);\n\n if (res.statusCode !== 200) {\n logger.error(`Datadog Monitors API error: ${res.statusCode}`);\n let errorMessage = `Datadog API returned status ${res.statusCode}: ${data}`;\n if (res.statusCode === 403) {\n errorMessage =\n \"Access denied. Verify your API and Application keys have monitors_read permission.\";\n } else if (res.statusCode === 429) {\n errorMessage =\n \"Rate limited by Datadog. Wait a moment and try again.\";\n }\n resolve({\n success: false,\n monitors: [],\n error: errorMessage,\n });\n return;\n }\n\n try {\n const response = JSON.parse(data) as Array<{\n id: number;\n name: string;\n type: string;\n overall_state?: string;\n message?: string;\n tags?: string[];\n priority?: number;\n query?: string;\n }>;\n\n let monitors = response.map((monitor) => ({\n id: monitor.id,\n name: monitor.name,\n type: monitor.type,\n status: monitor.overall_state || \"Unknown\",\n message: monitor.message,\n tags: monitor.tags || [],\n priority: monitor.priority,\n query: monitor.query,\n overallState: monitor.overall_state,\n }));\n\n // Filter by status if specified\n if (options.status && options.status.length > 0) {\n monitors = monitors.filter((m) =>\n options.status!.includes(\n m.status as \"Alert\" | \"Warn\" | \"No Data\" | \"OK\",\n ),\n );\n }\n\n logger.info(`Retrieved ${monitors.length} monitors`);\n\n resolve({\n success: true,\n monitors,\n });\n } catch (parseError) {\n logger.error(\n \"Failed to parse Datadog monitors response:\",\n parseError,\n );\n resolve({\n success: false,\n monitors: [],\n error: `Failed to parse response: ${parseError instanceof Error ? parseError.message : \"Unknown error\"}`,\n });\n }\n });\n });\n\n req.on(\"error\", (error) => {\n logger.error(\"Request error:\", error);\n resolve({\n success: false,\n monitors: [],\n error: `Connection error: ${error.message}`,\n });\n });\n\n req.end();\n });\n}\n\n/**\n * List Datadog Synthetic tests\n */\nexport async function listDatadogSynthetics(\n credentials: DatadogCredentials,\n options: DatadogSyntheticsOptions = {},\n logger: Logger = nullLogger,\n): Promise<DatadogSyntheticsResult> {\n logger.info(\"Fetching Datadog Synthetic tests\");\n\n return new Promise((resolve) => {\n const requestOptions = {\n hostname: \"api.datadoghq.com\",\n port: 443,\n path: \"/api/v1/synthetics/tests\",\n method: \"GET\",\n headers: {\n \"DD-API-KEY\": credentials.apiKey,\n \"DD-APPLICATION-KEY\": credentials.appKey,\n },\n };\n\n const req = https.request(requestOptions, (res) => {\n let data = \"\";\n\n res.on(\"data\", (chunk: Buffer) => {\n data += chunk.toString();\n });\n\n res.on(\"end\", () => {\n logger.info(`Response status: ${res.statusCode}`);\n\n if (res.statusCode !== 200) {\n logger.error(`Datadog Synthetics API error: ${res.statusCode}`);\n let errorMessage = `Datadog API returned status ${res.statusCode}: ${data}`;\n if (res.statusCode === 403) {\n errorMessage =\n \"Access denied. Verify your API and Application keys have synthetics_read permission.\";\n } else if (res.statusCode === 429) {\n errorMessage =\n \"Rate limited by Datadog. Wait a moment and try again.\";\n }\n resolve({\n success: false,\n tests: [],\n error: errorMessage,\n });\n return;\n }\n\n try {\n const response = JSON.parse(data) as {\n tests?: Array<{\n public_id: string;\n name: string;\n type: string;\n status: string;\n tags?: string[];\n locations?: string[];\n message?: string;\n }>;\n };\n\n let tests = (response.tests || []).map((test) => ({\n publicId: test.public_id,\n name: test.name,\n type: test.type,\n status: test.status,\n tags: test.tags || [],\n locations: test.locations || [],\n message: test.message,\n }));\n\n // Filter by type if specified\n if (options.type) {\n tests = tests.filter((t) => t.type === options.type);\n }\n\n // Filter by tags if specified\n if (options.tags && options.tags.length > 0) {\n tests = tests.filter((t) =>\n options.tags!.some((tag) => t.tags.includes(tag)),\n );\n }\n\n logger.info(`Retrieved ${tests.length} synthetic tests`);\n\n resolve({\n success: true,\n tests,\n });\n } catch (parseError) {\n logger.error(\n \"Failed to parse Datadog synthetics response:\",\n parseError,\n );\n resolve({\n success: false,\n tests: [],\n error: `Failed to parse response: ${parseError instanceof Error ? parseError.message : \"Unknown error\"}`,\n });\n }\n });\n });\n\n req.on(\"error\", (error) => {\n logger.error(\"Request error:\", error);\n resolve({\n success: false,\n tests: [],\n error: `Connection error: ${error.message}`,\n });\n });\n\n req.end();\n });\n}\n\n/**\n * Get recent results for a specific Synthetic test\n */\nexport async function getDatadogSyntheticResults(\n credentials: DatadogCredentials,\n publicId: string,\n logger: Logger = nullLogger,\n): Promise<DatadogSyntheticResultsResult> {\n logger.info(`Fetching results for Synthetic test: ${publicId}`);\n\n return new Promise((resolve) => {\n const requestOptions = {\n hostname: \"api.datadoghq.com\",\n port: 443,\n path: `/api/v1/synthetics/tests/${publicId}/results`,\n method: \"GET\",\n headers: {\n \"DD-API-KEY\": credentials.apiKey,\n \"DD-APPLICATION-KEY\": credentials.appKey,\n },\n };\n\n const req = https.request(requestOptions, (res) => {\n let data = \"\";\n\n res.on(\"data\", (chunk: Buffer) => {\n data += chunk.toString();\n });\n\n res.on(\"end\", () => {\n logger.info(`Response status: ${res.statusCode}`);\n\n if (res.statusCode !== 200) {\n logger.error(\n `Datadog Synthetics Results API error: ${res.statusCode}`,\n );\n let errorMessage = `Datadog API returned status ${res.statusCode}: ${data}`;\n if (res.statusCode === 403) {\n errorMessage =\n \"Access denied. Verify your API and Application keys have synthetics_read permission.\";\n } else if (res.statusCode === 404) {\n errorMessage = `Synthetic test '${publicId}' not found. Use datadog_synthetics (without testId) to list available tests.`;\n } else if (res.statusCode === 429) {\n errorMessage =\n \"Rate limited by Datadog. Wait a moment and try again.\";\n }\n resolve({\n success: false,\n publicId,\n results: [],\n error: errorMessage,\n });\n return;\n }\n\n try {\n const response = JSON.parse(data) as {\n results?: Array<{\n result_id: string;\n status: number;\n check_time: number;\n dc_id?: number;\n result?: {\n passed?: boolean;\n };\n }>;\n };\n\n const results = (response.results || []).map((result) => ({\n publicId,\n resultId: result.result_id,\n status: result.status,\n checkTime: result.check_time,\n passed: result.result?.passed ?? result.status === 0,\n location: result.dc_id?.toString(),\n }));\n\n logger.info(`Retrieved ${results.length} synthetic results`);\n\n resolve({\n success: true,\n publicId,\n results,\n });\n } catch (parseError) {\n logger.error(\n \"Failed to parse Datadog synthetic results:\",\n parseError,\n );\n resolve({\n success: false,\n publicId,\n results: [],\n error: `Failed to parse response: ${parseError instanceof Error ? parseError.message : \"Unknown error\"}`,\n });\n }\n });\n });\n\n req.on(\"error\", (error) => {\n logger.error(\"Request error:\", error);\n resolve({\n success: false,\n publicId,\n results: [],\n error: `Connection error: ${error.message}`,\n });\n });\n\n req.end();\n });\n}\n\n/**\n * Query Datadog metrics\n */\nexport async function queryDatadogMetrics(\n credentials: DatadogCredentials,\n options: DatadogMetricsOptions,\n logger: Logger = nullLogger,\n): Promise<DatadogMetricsResult> {\n logger.info(`Querying metrics: ${options.query}`);\n logger.info(`Time range: ${options.from} to ${options.to}`);\n\n const queryParams = new URLSearchParams({\n query: options.query,\n from: options.from.toString(),\n to: options.to.toString(),\n });\n\n return new Promise((resolve) => {\n const requestOptions = {\n hostname: \"api.datadoghq.com\",\n port: 443,\n path: `/api/v1/query?${queryParams.toString()}`,\n method: \"GET\",\n headers: {\n \"DD-API-KEY\": credentials.apiKey,\n \"DD-APPLICATION-KEY\": credentials.appKey,\n },\n };\n\n const req = https.request(requestOptions, (res) => {\n let data = \"\";\n\n res.on(\"data\", (chunk: Buffer) => {\n data += chunk.toString();\n });\n\n res.on(\"end\", () => {\n logger.info(`Response status: ${res.statusCode}`);\n\n if (res.statusCode !== 200) {\n logger.error(`Datadog Metrics API error: ${res.statusCode}`);\n let errorMessage = `Datadog API returned status ${res.statusCode}: ${data}`;\n if (res.statusCode === 400) {\n errorMessage = `Invalid metric query. Check format: 'aggregation:metric.name{tags}'. Query: \"${options.query}\". Datadog error: ${data}`;\n } else if (res.statusCode === 403) {\n errorMessage =\n \"Access denied. Verify your API and Application keys have metrics_read permission.\";\n } else if (res.statusCode === 429) {\n errorMessage =\n \"Rate limited by Datadog. Wait a moment and try again, or reduce your time range.\";\n }\n resolve({\n success: false,\n query: options.query,\n timeRange: { from: options.from, to: options.to },\n series: [],\n error: errorMessage,\n });\n return;\n }\n\n try {\n const response = JSON.parse(data) as {\n series?: Array<{\n metric: string;\n scope: string;\n pointlist: Array<[number, number | null]>;\n unit?: Array<{ name?: string }>;\n }>;\n };\n\n const series = (response.series || []).map((s) => ({\n metric: s.metric,\n scope: s.scope,\n pointlist: s.pointlist,\n unit: s.unit?.[0]?.name,\n }));\n\n logger.info(`Retrieved ${series.length} metric series`);\n\n resolve({\n success: true,\n query: options.query,\n timeRange: { from: options.from, to: options.to },\n series,\n });\n } catch (parseError) {\n logger.error(\"Failed to parse Datadog metrics response:\", parseError);\n resolve({\n success: false,\n query: options.query,\n timeRange: { from: options.from, to: options.to },\n series: [],\n error: `Failed to parse response: ${parseError instanceof Error ? parseError.message : \"Unknown error\"}`,\n });\n }\n });\n });\n\n req.on(\"error\", (error) => {\n logger.error(\"Request error:\", error);\n resolve({\n success: false,\n query: options.query,\n timeRange: { from: options.from, to: options.to },\n series: [],\n error: `Connection error: ${error.message}`,\n });\n });\n\n req.end();\n });\n}\n\n/**\n * Search Datadog RUM events\n */\nexport async function searchDatadogRum(\n credentials: DatadogCredentials,\n options: DatadogRumOptions = {},\n logger: Logger = nullLogger,\n): Promise<DatadogRumResult> {\n const effectiveQuery = options.query || \"*\";\n const effectiveFrom = options.from || \"now-15m\";\n const effectiveTo = options.to || \"now\";\n const effectiveLimit = Math.min(options.limit || 50, 1000);\n const effectiveSort = options.sort || \"-timestamp\";\n\n logger.info(`RUM query: ${effectiveQuery}`);\n logger.info(`Time range: ${effectiveFrom} to ${effectiveTo}`);\n\n const requestBody = JSON.stringify({\n filter: {\n query: effectiveQuery,\n from: effectiveFrom,\n to: effectiveTo,\n },\n page: {\n limit: effectiveLimit,\n },\n sort: effectiveSort,\n });\n\n return new Promise((resolve) => {\n const requestOptions = {\n hostname: \"api.datadoghq.com\",\n port: 443,\n path: \"/api/v2/rum/events/search\",\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"DD-API-KEY\": credentials.apiKey,\n \"DD-APPLICATION-KEY\": credentials.appKey,\n \"Content-Length\": Buffer.byteLength(requestBody),\n },\n };\n\n const req = https.request(requestOptions, (res) => {\n let data = \"\";\n\n res.on(\"data\", (chunk: Buffer) => {\n data += chunk.toString();\n });\n\n res.on(\"end\", () => {\n logger.info(`Response status: ${res.statusCode}`);\n\n if (res.statusCode !== 200) {\n logger.error(`Datadog RUM API error: ${res.statusCode}`);\n let errorMessage = `Datadog API returned status ${res.statusCode}: ${data}`;\n // Check for specific \"No valid indexes\" error which means no RUM app is configured\n if (data.includes(\"No valid indexes\")) {\n errorMessage =\n \"No RUM application found. Ensure you have a RUM application configured in Datadog and it has collected data. \" +\n \"You can create a RUM application at https://app.datadoghq.com/rum/list\";\n } else if (res.statusCode === 400) {\n errorMessage = `Invalid RUM query. Check syntax: \"${effectiveQuery}\". Datadog error: ${data}`;\n } else if (res.statusCode === 403) {\n errorMessage =\n \"Access denied. Verify your API and Application keys have rum_read permission.\";\n } else if (res.statusCode === 429) {\n errorMessage =\n \"Rate limited by Datadog. Wait a moment and try again, or reduce your query scope.\";\n }\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n events: [],\n error: errorMessage,\n });\n return;\n }\n\n try {\n const response = JSON.parse(data) as {\n data?: Array<{\n id: string;\n type: string;\n attributes?: {\n timestamp?: string;\n attributes?: {\n session?: { id?: string };\n view?: { url?: string; name?: string };\n error?: { message?: string; type?: string };\n [key: string]: unknown;\n };\n };\n }>;\n };\n\n const events = (response.data || []).map((event) => {\n const attrs = event.attributes?.attributes || {};\n return {\n id: event.id,\n type: event.type,\n timestamp: event.attributes?.timestamp,\n sessionId: attrs.session?.id,\n viewUrl: attrs.view?.url,\n viewName: attrs.view?.name,\n errorMessage: attrs.error?.message,\n errorType: attrs.error?.type,\n attributes: attrs,\n };\n });\n\n logger.info(`Retrieved ${events.length} RUM events`);\n\n resolve({\n success: true,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n events,\n });\n } catch (parseError) {\n logger.error(\"Failed to parse Datadog RUM response:\", parseError);\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n events: [],\n error: `Failed to parse response: ${parseError instanceof Error ? parseError.message : \"Unknown error\"}`,\n });\n }\n });\n });\n\n req.on(\"error\", (error) => {\n logger.error(\"Request error:\", error);\n resolve({\n success: false,\n query: effectiveQuery,\n timeRange: { from: effectiveFrom, to: effectiveTo },\n events: [],\n error: `Connection error: ${error.message}`,\n });\n });\n\n req.write(requestBody);\n req.end();\n });\n}\n","/**\n * LLM debugging utilities for inspecting raw provider responses\n */\n\nimport { Llm } from \"@jaypie/llm\";\n\nexport type LlmProvider = \"anthropic\" | \"gemini\" | \"openai\" | \"openrouter\";\n\nexport interface LlmDebugCallParams {\n provider: LlmProvider;\n model?: string;\n message: string;\n}\n\nexport interface LlmDebugCallResult {\n success: boolean;\n provider: string;\n model: string;\n content?: string;\n reasoning?: string[];\n reasoningTokens?: number;\n history?: unknown[];\n rawResponses?: unknown[];\n usage?: unknown[];\n error?: string;\n}\n\ninterface Logger {\n info: (message: string, ...args: unknown[]) => void;\n error: (message: string, ...args: unknown[]) => void;\n}\n\n// Default models for each provider\nconst DEFAULT_MODELS: Record<LlmProvider, string> = {\n anthropic: \"claude-sonnet-4-20250514\",\n gemini: \"gemini-2.0-flash\",\n openai: \"gpt-4o-mini\",\n openrouter: \"openai/gpt-4o-mini\",\n};\n\n// Reasoning-capable models for testing reasoning extraction\nexport const REASONING_MODELS: Record<string, string> = {\n \"openai-o3-mini\": \"o3-mini\",\n \"openai-o1-preview\": \"o1-preview\",\n \"openai-o1-mini\": \"o1-mini\",\n};\n\n/**\n * Make a debug LLM call and return the raw response data for inspection\n */\nexport async function debugLlmCall(\n params: LlmDebugCallParams,\n log: Logger,\n): Promise<LlmDebugCallResult> {\n const { provider, message } = params;\n const model = params.model || DEFAULT_MODELS[provider];\n\n log.info(`Making debug LLM call to ${provider} with model ${model}`);\n\n try {\n const llm = new Llm(provider, { model });\n\n const result = await llm.operate(message, {\n user: \"[jaypie-mcp] Debug LLM Call\",\n });\n\n if (result.error) {\n return {\n success: false,\n provider,\n model,\n error: `${result.error.title}: ${result.error.detail || \"Unknown error\"}`,\n };\n }\n\n // Calculate total reasoning tokens\n const reasoningTokens = result.usage.reduce(\n (sum, u) => sum + (u.reasoning || 0),\n 0,\n );\n\n return {\n success: true,\n provider,\n model,\n content:\n typeof result.content === \"string\"\n ? result.content\n : JSON.stringify(result.content),\n reasoning: result.reasoning,\n reasoningTokens,\n history: result.history,\n rawResponses: result.responses,\n usage: result.usage,\n };\n } catch (error) {\n log.error(`Error calling ${provider}:`, error);\n return {\n success: false,\n provider,\n model,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n}\n\n/**\n * List available providers and their default/reasoning models\n */\nexport function listLlmProviders(): {\n providers: Array<{\n name: LlmProvider;\n defaultModel: string;\n reasoningModels: string[];\n }>;\n} {\n return {\n providers: [\n {\n name: \"openai\",\n defaultModel: DEFAULT_MODELS.openai,\n reasoningModels: [\"o3-mini\", \"o1-preview\", \"o1-mini\"],\n },\n {\n name: \"anthropic\",\n defaultModel: DEFAULT_MODELS.anthropic,\n reasoningModels: [], // Anthropic doesn't expose reasoning the same way\n },\n {\n name: \"gemini\",\n defaultModel: DEFAULT_MODELS.gemini,\n reasoningModels: [], // Gemini has thoughtsTokenCount but unclear on content\n },\n {\n name: \"openrouter\",\n defaultModel: DEFAULT_MODELS.openrouter,\n reasoningModels: [\"openai/o3-mini\", \"openai/o1-preview\"],\n },\n ],\n };\n}\n","/**\n * AWS CLI integration module\n * Provides a structured interface for common AWS operations via the AWS CLI\n */\nimport { spawn } from \"node:child_process\";\nimport * as fs from \"node:fs/promises\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\n\n// Logger interface matching the pattern from datadog.ts\ninterface Logger {\n info: (message: string, ...args: unknown[]) => void;\n error: (message: string, ...args: unknown[]) => void;\n}\n\nconst nullLogger: Logger = {\n info: () => {},\n error: () => {},\n};\n\n// Common AWS command options\nexport interface AwsCommandOptions {\n profile?: string;\n region?: string;\n}\n\n// Generic result type for AWS commands\nexport interface AwsCommandResult<T> {\n success: boolean;\n data?: T;\n error?: string;\n}\n\n// Step Functions types\nexport interface StepFunctionExecution {\n executionArn: string;\n stateMachineArn: string;\n name: string;\n status: string;\n startDate: string;\n stopDate?: string;\n}\n\nexport interface StepFunctionsListExecutionsOptions extends AwsCommandOptions {\n stateMachineArn: string;\n statusFilter?:\n | \"RUNNING\"\n | \"SUCCEEDED\"\n | \"FAILED\"\n | \"TIMED_OUT\"\n | \"ABORTED\"\n | \"PENDING_REDRIVE\";\n maxResults?: number;\n}\n\nexport interface StepFunctionsStopExecutionOptions extends AwsCommandOptions {\n executionArn: string;\n cause?: string;\n}\n\n// Lambda types\nexport interface LambdaFunction {\n FunctionName: string;\n FunctionArn: string;\n Runtime?: string;\n Handler?: string;\n CodeSize: number;\n Description?: string;\n Timeout?: number;\n MemorySize?: number;\n LastModified: string;\n Version?: string;\n}\n\nexport interface LambdaListFunctionsOptions extends AwsCommandOptions {\n functionNamePrefix?: string;\n maxResults?: number;\n}\n\nexport interface LambdaGetFunctionOptions extends AwsCommandOptions {\n functionName: string;\n}\n\n// CloudWatch Logs types\nexport interface LogEvent {\n timestamp: number;\n message: string;\n ingestionTime?: number;\n logStreamName?: string;\n}\n\nexport interface CloudWatchLogsFilterOptions extends AwsCommandOptions {\n logGroupName: string;\n filterPattern?: string;\n startTime?: string;\n endTime?: string;\n limit?: number;\n}\n\n// S3 types\nexport interface S3Object {\n Key: string;\n LastModified: string;\n ETag: string;\n Size: number;\n StorageClass: string;\n}\n\nexport interface S3ListObjectsOptions extends AwsCommandOptions {\n bucket: string;\n prefix?: string;\n maxResults?: number;\n}\n\n// CloudFormation types\nexport interface CloudFormationStack {\n StackName: string;\n StackId: string;\n StackStatus: string;\n StackStatusReason?: string;\n CreationTime: string;\n LastUpdatedTime?: string;\n Description?: string;\n Outputs?: Array<{\n OutputKey: string;\n OutputValue: string;\n Description?: string;\n }>;\n Parameters?: Array<{\n ParameterKey: string;\n ParameterValue: string;\n }>;\n}\n\nexport interface CloudFormationDescribeStackOptions extends AwsCommandOptions {\n stackName: string;\n}\n\n// DynamoDB types\nexport interface DynamoDBDescribeTableOptions extends AwsCommandOptions {\n tableName: string;\n}\n\nexport interface DynamoDBScanOptions extends AwsCommandOptions {\n tableName: string;\n filterExpression?: string;\n expressionAttributeValues?: string;\n limit?: number;\n}\n\nexport interface DynamoDBQueryOptions extends AwsCommandOptions {\n tableName: string;\n keyConditionExpression: string;\n expressionAttributeValues: string;\n indexName?: string;\n filterExpression?: string;\n limit?: number;\n scanIndexForward?: boolean;\n}\n\nexport interface DynamoDBGetItemOptions extends AwsCommandOptions {\n tableName: string;\n key: string;\n}\n\n// SQS types\nexport interface SQSQueue {\n QueueUrl: string;\n}\n\nexport interface SQSListQueuesOptions extends AwsCommandOptions {\n queueNamePrefix?: string;\n}\n\nexport interface SQSGetQueueAttributesOptions extends AwsCommandOptions {\n queueUrl: string;\n}\n\nexport interface SQSReceiveMessageOptions extends AwsCommandOptions {\n queueUrl: string;\n maxNumberOfMessages?: number;\n visibilityTimeout?: number;\n}\n\nexport interface SQSPurgeQueueOptions extends AwsCommandOptions {\n queueUrl: string;\n}\n\n// AWS Profile\nexport interface AwsProfile {\n name: string;\n source: \"config\" | \"credentials\";\n region?: string;\n sso_start_url?: string;\n}\n\n/**\n * Parse AWS CLI error messages into user-friendly descriptions\n */\nfunction parseAwsError(\n stderr: string,\n service: string,\n command: string,\n): string {\n if (stderr.includes(\"ExpiredToken\") || stderr.includes(\"Token has expired\")) {\n return \"AWS credentials have expired. Run 'aws sso login' or refresh your credentials.\";\n }\n if (\n stderr.includes(\"NoCredentialProviders\") ||\n stderr.includes(\"Unable to locate credentials\")\n ) {\n return \"No AWS credentials found. Configure credentials with 'aws configure' or 'aws sso login'.\";\n }\n if (stderr.includes(\"AccessDenied\") || stderr.includes(\"Access Denied\")) {\n return `Access denied for ${service}:${command}. Check your IAM permissions.`;\n }\n if (stderr.includes(\"ResourceNotFoundException\")) {\n return `Resource not found. Check that the specified resource exists in the correct region.`;\n }\n if (stderr.includes(\"ValidationException\")) {\n const match = stderr.match(/ValidationException[^:]*:\\s*(.+)/);\n return match\n ? `Validation error: ${match[1].trim()}`\n : \"Validation error in request parameters.\";\n }\n if (\n stderr.includes(\"ThrottlingException\") ||\n stderr.includes(\"Rate exceeded\")\n ) {\n return \"AWS API rate limit exceeded. Wait a moment and try again.\";\n }\n if (stderr.includes(\"InvalidParameterValue\")) {\n const match = stderr.match(/InvalidParameterValue[^:]*:\\s*(.+)/);\n return match\n ? `Invalid parameter: ${match[1].trim()}`\n : \"Invalid parameter value provided.\";\n }\n return stderr.trim();\n}\n\n/**\n * Parse relative time strings like 'now-1h' to Unix timestamps\n */\nfunction parseRelativeTime(timeStr: string): number {\n const now = Date.now();\n\n if (timeStr === \"now\") {\n return now;\n }\n\n // Handle relative time like 'now-15m', 'now-1h', 'now-1d'\n const relativeMatch = timeStr.match(/^now-(\\d+)([smhd])$/);\n if (relativeMatch) {\n const value = parseInt(relativeMatch[1], 10);\n const unit = relativeMatch[2];\n const multipliers: Record<string, number> = {\n s: 1000,\n m: 60 * 1000,\n h: 60 * 60 * 1000,\n d: 24 * 60 * 60 * 1000,\n };\n return now - value * multipliers[unit];\n }\n\n // Handle ISO 8601 format\n const parsed = Date.parse(timeStr);\n if (!isNaN(parsed)) {\n return parsed;\n }\n\n // Default to the current time if parsing fails\n return now;\n}\n\n/**\n * Execute an AWS CLI command and return parsed JSON output\n */\nexport async function executeAwsCommand<T>(\n service: string,\n command: string,\n args: string[],\n options: AwsCommandOptions = {},\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<T>> {\n const fullArgs = [service, command, ...args, \"--output\", \"json\"];\n\n if (options.profile) {\n fullArgs.push(\"--profile\", options.profile);\n }\n if (options.region) {\n fullArgs.push(\"--region\", options.region);\n }\n\n logger.info(`Executing: aws ${fullArgs.join(\" \")}`);\n\n return new Promise((resolve) => {\n const proc = spawn(\"aws\", fullArgs);\n let stdout = \"\";\n let stderr = \"\";\n\n proc.stdout.on(\"data\", (data) => {\n stdout += data.toString();\n });\n proc.stderr.on(\"data\", (data) => {\n stderr += data.toString();\n });\n\n proc.on(\"close\", (code) => {\n if (code !== 0) {\n logger.error(`AWS CLI error: ${stderr}`);\n resolve({\n success: false,\n error: parseAwsError(stderr, service, command),\n });\n return;\n }\n\n // Handle empty output (some commands return nothing on success)\n if (!stdout.trim()) {\n resolve({ success: true });\n return;\n }\n\n try {\n const data = JSON.parse(stdout) as T;\n resolve({ success: true, data });\n } catch {\n // Some commands return plain text\n resolve({ success: true, data: stdout.trim() as unknown as T });\n }\n });\n\n proc.on(\"error\", (error) => {\n if (error.message.includes(\"ENOENT\")) {\n resolve({\n success: false,\n error:\n \"AWS CLI not found. Install it from https://aws.amazon.com/cli/\",\n });\n } else {\n resolve({ success: false, error: error.message });\n }\n });\n });\n}\n\n/**\n * List available AWS profiles from ~/.aws/config and ~/.aws/credentials\n */\nexport async function listAwsProfiles(\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<AwsProfile[]>> {\n const profiles: AwsProfile[] = [];\n const homeDir = os.homedir();\n\n try {\n // Parse ~/.aws/config\n const configPath = path.join(homeDir, \".aws\", \"config\");\n try {\n const configContent = await fs.readFile(configPath, \"utf-8\");\n const profileRegex = /\\[profile\\s+([^\\]]+)\\]|\\[default\\]/g;\n let match;\n while ((match = profileRegex.exec(configContent)) !== null) {\n const name = match[1] || \"default\";\n profiles.push({\n name,\n source: \"config\",\n });\n }\n logger.info(`Found ${profiles.length} profiles in config`);\n } catch {\n logger.info(\"No ~/.aws/config file found\");\n }\n\n // Parse ~/.aws/credentials\n const credentialsPath = path.join(homeDir, \".aws\", \"credentials\");\n try {\n const credentialsContent = await fs.readFile(credentialsPath, \"utf-8\");\n const profileRegex = /\\[([^\\]]+)\\]/g;\n let match;\n while ((match = profileRegex.exec(credentialsContent)) !== null) {\n const name = match[1];\n // Only add if not already in the list\n if (!profiles.find((p) => p.name === name)) {\n profiles.push({\n name,\n source: \"credentials\",\n });\n }\n }\n logger.info(`Total profiles after credentials: ${profiles.length}`);\n } catch {\n logger.info(\"No ~/.aws/credentials file found\");\n }\n\n return { success: true, data: profiles };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error\";\n logger.error(`Error listing profiles: ${errorMessage}`);\n return { success: false, error: errorMessage };\n }\n}\n\n// Step Functions operations\nexport async function listStepFunctionExecutions(\n options: StepFunctionsListExecutionsOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ executions: StepFunctionExecution[] }>> {\n const args = [\"--state-machine-arn\", options.stateMachineArn];\n if (options.statusFilter) {\n args.push(\"--status-filter\", options.statusFilter);\n }\n if (options.maxResults) {\n args.push(\"--max-results\", String(options.maxResults));\n }\n\n return executeAwsCommand(\n \"stepfunctions\",\n \"list-executions\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\nexport async function stopStepFunctionExecution(\n options: StepFunctionsStopExecutionOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ stopDate: string }>> {\n const args = [\"--execution-arn\", options.executionArn];\n if (options.cause) {\n args.push(\"--cause\", options.cause);\n }\n\n return executeAwsCommand(\n \"stepfunctions\",\n \"stop-execution\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\n// Lambda operations\nexport async function listLambdaFunctions(\n options: LambdaListFunctionsOptions = {},\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Functions: LambdaFunction[] }>> {\n const args: string[] = [];\n if (options.maxResults) {\n args.push(\"--max-items\", String(options.maxResults));\n }\n\n const result = await executeAwsCommand<{ Functions: LambdaFunction[] }>(\n \"lambda\",\n \"list-functions\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n\n // Filter by prefix if specified\n if (result.success && result.data && options.functionNamePrefix) {\n result.data.Functions = result.data.Functions.filter((f) =>\n f.FunctionName.startsWith(options.functionNamePrefix!),\n );\n }\n\n return result;\n}\n\nexport async function getLambdaFunction(\n options: LambdaGetFunctionOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Configuration: LambdaFunction }>> {\n return executeAwsCommand(\n \"lambda\",\n \"get-function\",\n [\"--function-name\", options.functionName],\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\n// CloudWatch Logs operations\nexport async function filterLogEvents(\n options: CloudWatchLogsFilterOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ events: LogEvent[] }>> {\n const args = [\"--log-group-name\", options.logGroupName];\n\n if (options.filterPattern) {\n args.push(\"--filter-pattern\", options.filterPattern);\n }\n if (options.startTime) {\n const startMs = parseRelativeTime(options.startTime);\n args.push(\"--start-time\", String(startMs));\n }\n if (options.endTime) {\n const endMs = parseRelativeTime(options.endTime);\n args.push(\"--end-time\", String(endMs));\n }\n if (options.limit) {\n args.push(\"--limit\", String(options.limit));\n }\n\n return executeAwsCommand(\n \"logs\",\n \"filter-log-events\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\n// S3 operations\nexport async function listS3Objects(\n options: S3ListObjectsOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Contents: S3Object[] }>> {\n const args = [\"--bucket\", options.bucket];\n if (options.prefix) {\n args.push(\"--prefix\", options.prefix);\n }\n if (options.maxResults) {\n args.push(\"--max-items\", String(options.maxResults));\n }\n\n return executeAwsCommand(\n \"s3api\",\n \"list-objects-v2\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\n// CloudFormation operations\nexport async function describeStack(\n options: CloudFormationDescribeStackOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Stacks: CloudFormationStack[] }>> {\n return executeAwsCommand(\n \"cloudformation\",\n \"describe-stacks\",\n [\"--stack-name\", options.stackName],\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\n// DynamoDB operations\nexport async function describeDynamoDBTable(\n options: DynamoDBDescribeTableOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Table: Record<string, unknown> }>> {\n return executeAwsCommand(\n \"dynamodb\",\n \"describe-table\",\n [\"--table-name\", options.tableName],\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\nexport async function scanDynamoDB(\n options: DynamoDBScanOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Items: Record<string, unknown>[] }>> {\n const args = [\"--table-name\", options.tableName];\n if (options.filterExpression) {\n args.push(\"--filter-expression\", options.filterExpression);\n }\n if (options.expressionAttributeValues) {\n args.push(\n \"--expression-attribute-values\",\n options.expressionAttributeValues,\n );\n }\n if (options.limit) {\n args.push(\"--limit\", String(options.limit));\n }\n\n return executeAwsCommand(\n \"dynamodb\",\n \"scan\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\nexport async function queryDynamoDB(\n options: DynamoDBQueryOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Items: Record<string, unknown>[] }>> {\n const args = [\n \"--table-name\",\n options.tableName,\n \"--key-condition-expression\",\n options.keyConditionExpression,\n \"--expression-attribute-values\",\n options.expressionAttributeValues,\n ];\n if (options.indexName) {\n args.push(\"--index-name\", options.indexName);\n }\n if (options.filterExpression) {\n args.push(\"--filter-expression\", options.filterExpression);\n }\n if (options.limit) {\n args.push(\"--limit\", String(options.limit));\n }\n if (options.scanIndexForward === false) {\n args.push(\"--no-scan-index-forward\");\n }\n\n return executeAwsCommand(\n \"dynamodb\",\n \"query\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\nexport async function getDynamoDBItem(\n options: DynamoDBGetItemOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Item: Record<string, unknown> }>> {\n return executeAwsCommand(\n \"dynamodb\",\n \"get-item\",\n [\"--table-name\", options.tableName, \"--key\", options.key],\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\n// SQS operations\nexport async function listSQSQueues(\n options: SQSListQueuesOptions = {},\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ QueueUrls: string[] }>> {\n const args: string[] = [];\n if (options.queueNamePrefix) {\n args.push(\"--queue-name-prefix\", options.queueNamePrefix);\n }\n\n return executeAwsCommand(\n \"sqs\",\n \"list-queues\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\nexport async function getSQSQueueAttributes(\n options: SQSGetQueueAttributesOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<{ Attributes: Record<string, string> }>> {\n return executeAwsCommand(\n \"sqs\",\n \"get-queue-attributes\",\n [\"--queue-url\", options.queueUrl, \"--attribute-names\", \"All\"],\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\nexport async function receiveSQSMessage(\n options: SQSReceiveMessageOptions,\n logger: Logger = nullLogger,\n): Promise<\n AwsCommandResult<{\n Messages: Array<{\n MessageId: string;\n ReceiptHandle: string;\n Body: string;\n Attributes?: Record<string, string>;\n }>;\n }>\n> {\n const args = [\"--queue-url\", options.queueUrl];\n if (options.maxNumberOfMessages) {\n args.push(\"--max-number-of-messages\", String(options.maxNumberOfMessages));\n }\n if (options.visibilityTimeout) {\n args.push(\"--visibility-timeout\", String(options.visibilityTimeout));\n }\n args.push(\"--attribute-names\", \"All\");\n\n return executeAwsCommand(\n \"sqs\",\n \"receive-message\",\n args,\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n\nexport async function purgeSQSQueue(\n options: SQSPurgeQueueOptions,\n logger: Logger = nullLogger,\n): Promise<AwsCommandResult<void>> {\n return executeAwsCommand(\n \"sqs\",\n \"purge-queue\",\n [\"--queue-url\", options.queueUrl],\n { profile: options.profile, region: options.region },\n logger,\n );\n}\n"],"names":["nullLogger"],"mappings":";;;;;;;AAAA;;AAEG;AAwLH,MAAMA,YAAU,GAAW;AACzB,IAAA,IAAI,EAAE,MAAK,EAAE,CAAC;AACd,IAAA,KAAK,EAAE,MAAK,EAAE,CAAC;CAChB;AAED;;AAEG;SACa,qBAAqB,GAAA;AACnC,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;AACpE,IAAA,MAAM,MAAM,GACV,OAAO,CAAC,GAAG,CAAC,eAAe;QAC3B,OAAO,CAAC,GAAG,CAAC,uBAAuB;QACnC,OAAO,CAAC,GAAG,CAAC,UAAU;AACtB,QAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB;AAEhC,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE;AACtB,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;AAC3B;AA+CA;;AAEG;AACG,SAAU,iBAAiB,CAAC,OAA6B,EAAA;AAC7D,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM;AAChC,IAAA,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU;AACxC,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS;AACtC,IAAA,MAAM,OAAO,G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
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Branch Management
|
|
6
|
-
|
|
7
|
-
## Naming Conventions
|
|
8
|
-
|
|
9
|
-
Name branches after the ticket or use a generic naming scheme.
|
|
10
|
-
|
|
11
|
-
### Ticket Naming
|
|
12
|
-
|
|
13
|
-
If the issue is from a ticketing system such as GitHub, Jira, or Linear, use `feat/{{ ticket }}`.
|
|
14
|
-
Jira and Linear usually include a keyword like `DEV-12`.
|
|
15
|
-
For GitHub tickets use `GITHUB-#`.
|
|
16
|
-
|
|
17
|
-
### Generic Naming
|
|
18
|
-
|
|
19
|
-
Check the first eight characters of the latest commit hash with `git -C workspace rev-parse --short=8 HEAD`
|
|
20
|
-
Create a new branch prefixed with `feat/`.
|
|
21
|
-
Make the branch name a concise two- or three-word summary of the ticket.
|
|
22
|
-
Lead with the most important word.
|
|
23
|
-
Use dashes, for example `feat/readme-update-abcd5678`.
|
|
24
|
-
|
|
25
|
-
## Development
|
|
26
|
-
|
|
27
|
-
Refer to [Development_Process.md](./Development_Process.md) for details on process, scripts, and tests expected in the development step.
|
|
28
|
-
|
|
29
|
-
## Completion
|
|
30
|
-
|
|
31
|
-
Push the completed branch.
|
|
32
|
-
Start a new pull request.
|
|
33
|
-
Describe the changes and any failing validation steps.
|
|
34
|
-
Mark it closing the issue.
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Development workflow, required reading for coding tasks (always read)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Development Process
|
|
6
|
-
|
|
7
|
-
## Baseline Conditions
|
|
8
|
-
|
|
9
|
-
Check package.json scripts for available commands: build, format, lint, test, and typecheck.
|
|
10
|
-
Run each available script to establish baseline state.
|
|
11
|
-
Document all errors and warnings from the baseline run.
|
|
12
|
-
Do not fix baseline errors or warnings.
|
|
13
|
-
Use this baseline to identify new issues introduced by development work.
|
|
14
|
-
|
|
15
|
-
## Development
|
|
16
|
-
|
|
17
|
-
Implement the requested feature or fix.
|
|
18
|
-
Write tests to validate the work whenever possible.
|
|
19
|
-
Run tests to verify functionality (do not run lint or typecheck yet).
|
|
20
|
-
When development is complete, commit changes using conventional commit format.
|
|
21
|
-
Conventional commit format: `type: scope: description` (examples: `feat: api: add user endpoint`, `fix: auth: handle expired tokens`, `chore: config: update dependencies`).
|
|
22
|
-
|
|
23
|
-
## Validation
|
|
24
|
-
|
|
25
|
-
Check package.json for available scripts before running validation steps.
|
|
26
|
-
Skip any step that does not have a corresponding npm script.
|
|
27
|
-
If a npm script produces errors or warnings, note them for context in subsequent steps.
|
|
28
|
-
Include any pre-existing build, lint, test, and type warnings in instructions to disregard when fixing new issues.
|
|
29
|
-
Skip any step that cannot be passed due to pre-existing failures.
|
|
30
|
-
Commit after each successful validation step to create restore points.
|
|
31
|
-
|
|
32
|
-
### Scrub
|
|
33
|
-
|
|
34
|
-
Follow code style rules in packages/mcp/prompts/Jaypie_Scrub.md.
|
|
35
|
-
Repository-specific style guides (CLAUDE.md, .cursorrules) override Jaypie_Scrub.md when they conflict.
|
|
36
|
-
Applying scrub rules can prevent errors in subsequent validation steps, especially testing.
|
|
37
|
-
If no errors are found, no commit is needed for this step.
|
|
38
|
-
|
|
39
|
-
### Test
|
|
40
|
-
|
|
41
|
-
Run `npm run test` to execute the test suite.
|
|
42
|
-
Compare results to baseline: only fix failures introduced by your changes.
|
|
43
|
-
Determine root cause of each new failure:
|
|
44
|
-
- Unchanged test failing: implementation likely broke existing functionality
|
|
45
|
-
- Test covering intentionally modified behavior: test needs updating
|
|
46
|
-
- New test failing: fix the test or implementation as appropriate
|
|
47
|
-
Fix identified issues and re-run tests until only baseline failures remain.
|
|
48
|
-
Commit fixes with message describing what was corrected.
|
|
49
|
-
|
|
50
|
-
### Type Check
|
|
51
|
-
|
|
52
|
-
Run `npm run typecheck` (runs typecheck across all workspace packages).
|
|
53
|
-
Note: Some packages output `[TODO] Convert @jaypie/package to TypeScript` - this is expected and should be ignored.
|
|
54
|
-
Compare results to baseline: only fix type errors introduced by your changes.
|
|
55
|
-
Fix new type errors and re-run typecheck until only baseline errors remain.
|
|
56
|
-
Commit fixes with message describing type corrections.
|
|
57
|
-
|
|
58
|
-
### Format and Lint
|
|
59
|
-
|
|
60
|
-
Run `npm run format` (runs package.json sorting and auto-fixes linting issues).
|
|
61
|
-
Check git status to see if format updated any files.
|
|
62
|
-
If files were modified by format, review changes and commit them.
|
|
63
|
-
Run `npm run lint` to check for remaining lint errors.
|
|
64
|
-
Fix any new lint errors introduced by your changes (compare to baseline).
|
|
65
|
-
Commit lint fixes with appropriate message.
|
|
66
|
-
|
|
67
|
-
### Build
|
|
68
|
-
|
|
69
|
-
Run `npm run build` (uses Lerna to build all packages in dependency order).
|
|
70
|
-
Compare results to baseline: only fix build errors introduced by your changes.
|
|
71
|
-
Fix new build errors and re-run build until only baseline errors remain.
|
|
72
|
-
Commit build fixes with appropriate message.
|
|
73
|
-
Verify dist/ directories were created/updated for modified packages.
|
|
74
|
-
|
|
75
|
-
## Documentation
|
|
76
|
-
|
|
77
|
-
Check if README.md updates are needed:
|
|
78
|
-
- Public API changes (function signatures, exports, parameters)
|
|
79
|
-
- New features that users need to know about
|
|
80
|
-
- Breaking changes to existing functionality
|
|
81
|
-
- Changes to installation or setup procedures
|
|
82
|
-
|
|
83
|
-
Do NOT update README.md for:
|
|
84
|
-
- Internal refactoring
|
|
85
|
-
- Test updates
|
|
86
|
-
- Bug fixes that don't change behavior
|
|
87
|
-
- Dependency updates
|
|
88
|
-
|
|
89
|
-
If updates are needed, modify README.md to reflect changes and commit with message `docs: update README`.
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
trigger: always_on
|
|
3
|
-
description: Baseline rules in Jaypie repositories. Required reading.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Jaypie's Agent Rules
|
|
7
|
-
|
|
8
|
-
This repository uses Jaypie, an opinionated event-driven fullstack library.
|
|
9
|
-
|
|
10
|
-
## Errors
|
|
11
|
-
|
|
12
|
-
Jaypie providers errors that will be handled properly when thrown (e.g., presenting the correct status code).
|
|
13
|
-
|
|
14
|
-
`import { BadGatewayError, BadRequestError, ConfigurationError, ForbiddenError, GatewayTimeoutError, GoneError, IllogicalError, InternalError, MethodNotAllowedError, NotFoundError, NotImplementedError, RejectedError, TeapotError, UnauthorizedError, UnavailableError, UnhandledError, UnreachableCodeError } from "jaypie";`
|
|
15
|
-
|
|
16
|
-
ConfigurationError is a special InternalError 500 that is also thrown when types are incorrect.
|
|
17
|
-
|
|
18
|
-
Though supported, rely on default error messages when throwing.
|
|
19
|
-
Custom error messages should be logged not thrown
|
|
20
|
-
|
|
21
|
-
<Bad>
|
|
22
|
-
throw new NotFoundError("Item not found");
|
|
23
|
-
</Bad>
|
|
24
|
-
<Good>
|
|
25
|
-
log.error("Item not found");
|
|
26
|
-
throw new NotFoundError();
|
|
27
|
-
</Good>
|
|
28
|
-
|
|
29
|
-
Error messages may be returned to the user especially in express.
|
|
30
|
-
|
|
31
|
-
## Logging
|
|
32
|
-
|
|
33
|
-
`import { log } from "jaypie";`
|
|
34
|
-
`log` has methods `trace`, `debug`, `info`, `warn`, `error`, `fatal`, and `var`.
|
|
35
|
-
Only `trace` and `var` should be used in "happy paths".
|
|
36
|
-
`debug` should be used when execution deviates from the happy path.
|
|
37
|
-
`info` should rarely be used.
|
|
38
|
-
`var` expects a _single_ key-value pair like `log.var({ key: "value" });`.
|
|
39
|
-
Do _not_ pass multiple keys to `var`.
|
|
40
|
-
|
|
41
|
-
## Testing
|
|
42
|
-
|
|
43
|
-
`@jaypie/testkit` is a testing library used with vitest providing custom matchers and mocks for the main Jaypie library.
|
|
44
|
-
Always use the testkit to mock Jaypie.
|
|
45
|
-
Always create a manual mock for a models package.
|
|
46
|
-
Always mock network calls and external commands.
|
|
47
|
-
Jaypie relies heavily on mocking to confirm expected behavior and prevent behavior drift.
|
|
48
|
-
|
|
49
|
-
See [Jaypie_Mocks_and_Testkit.md](./Jaypie_Mocks_and_Testkit.md) for more context.
|
|
50
|
-
|
|
51
|
-
### Configuration
|
|
52
|
-
|
|
53
|
-
Mocks and matchers are usually configured at the subpackage-level in `testSetup.js` (legacy path) or `vitest.setup.[js|ts]` (modern path).
|
|
54
|
-
The subpackage `[vite|vitest].config[js|ts]` will reference the setup file.
|
|
55
|
-
All jaypie functions are mocked with `vi.mock("jaypie", async () => vi.importActual("@jaypie/testkit/mock"));`
|
|
56
|
-
|
|
57
|
-
vitest.setup.ts
|
|
58
|
-
```typescript
|
|
59
|
-
import { matchers as jaypieMatchers } from "@jaypie/testkit";
|
|
60
|
-
import * as extendedMatchers from "jest-extended";
|
|
61
|
-
import { expect , vi} from "vitest";
|
|
62
|
-
|
|
63
|
-
expect.extend(extendedMatchers);
|
|
64
|
-
expect.extend(jaypieMatchers);
|
|
65
|
-
|
|
66
|
-
vi.mock("jaypie", async () => vi.importActual("@jaypie/testkit/mock"));
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Errors
|
|
70
|
-
|
|
71
|
-
Use matchers to test errors.
|
|
72
|
-
`expect(fn).toThrowBadGatewayError();`
|
|
73
|
-
`await expect(async() => fn()).toThrowBadGatewayError();`
|
|
74
|
-
Do not use `.rejects`
|
|
75
|
-
|
|
76
|
-
### Matchers
|
|
77
|
-
|
|
78
|
-
toBeCalledAboveTrace, toBeCalledWithInitialParams, toBeClass, toBeJaypieError, toMatchBase64, toMatchJwt, toMatchMongoId, toMatchSchema, toMatchSignedCookie, toMatchUuid4, toMatchUuid5, toMatchUuid, toThrowBadGatewayError, toThrowBadRequestError, toThrowConfigurationError, toThrowForbiddenError, toThrowGatewayTimeoutError, toThrowInternalError, toThrowJaypieError, toThrowNotFoundError, toThrowUnauthorizedError, toThrowUnavailableError,
|
|
79
|
-
|
|
80
|
-
### Order of Tests
|
|
81
|
-
|
|
82
|
-
Tests are named `./__tests__/<subject>.spec.<js|ts>`.
|
|
83
|
-
Each file should have one top-level `describe` block.
|
|
84
|
-
Organize tests in one of seven second-level describe block sections in this order:
|
|
85
|
-
|
|
86
|
-
1. Base Cases - it is the type we expect ("It is a Function"). For functions, the simplest possible call works and returns not undefined ("It Works"). For objects, the expected shape.
|
|
87
|
-
2. Error Conditions - any error handling the code performs
|
|
88
|
-
3. Security - any security checks the code performs
|
|
89
|
-
4. Observability - any logging the code performs
|
|
90
|
-
5. Happy Paths - The most common use case
|
|
91
|
-
6. Features - Features in addition to the happy path
|
|
92
|
-
7. Specific Scenarios - Special cases
|
|
93
|
-
Omit describe blocks for sections that are not applicable or empty.
|
|
94
|
-
Whenever possible, especially when refactoring, write the test first so the user can confirm the expected behavior passes/fails.
|
|
95
|
-
|
|
96
|
-
### Test Coverage
|
|
97
|
-
|
|
98
|
-
Aim for complete coverage of all happy paths, features, and error conditions.
|
|
99
|
-
Whenever possible, confirm mocked functions are called.
|
|
100
|
-
Confirm calls to log above debug in Observability. Do not confirm calls to debug, var, or trace.
|
|
101
|
-
|
|
102
|
-
## Linting
|
|
103
|
-
|
|
104
|
-
Use double quotes, trailing commas, and semicolons.
|
|
105
|
-
Do not delete `// eslint-disable-next-line no-shadow` comments; add when shadowing variables, especially `error` in catch blocks.
|
|
106
|
-
|
|
107
|
-
### Beyond Lint
|
|
108
|
-
|
|
109
|
-
Whenever a hard-coded value like `site: "datadoghq.com"` is used, define a constant at the top of the file, `const DATADOG_SITE = "datadoghq.com"`, and reference that throughout.
|
|
110
|
-
Alphabetize as much as possible.
|