@adobe-commerce/aio-toolkit 1.0.13 → 1.0.15
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/CHANGELOG.md +116 -0
- package/README.md +122 -9
- package/dist/aio-toolkit-cursor-context/bin/cli.js +1089 -0
- package/dist/aio-toolkit-cursor-context/bin/cli.js.map +1 -0
- package/dist/index.d.mts +43 -16
- package/dist/index.d.ts +43 -16
- package/dist/index.js +1030 -166
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1034 -167
- package/dist/index.mjs.map +1 -1
- package/files/cursor-context/commands/aio-toolkit-create-event-consumer-action.md +562 -0
- package/files/cursor-context/commands/aio-toolkit-create-graphql-action.md +531 -0
- package/files/cursor-context/commands/aio-toolkit-create-runtime-action.md +293 -0
- package/files/cursor-context/commands/aio-toolkit-create-webhook-action.md +439 -0
- package/files/cursor-context/rules/aio-toolkit-create-adobe-commerce-client.mdc +1321 -0
- package/files/cursor-context/rules/aio-toolkit-oop-best-practices.mdc +331 -0
- package/files/cursor-context/rules/aio-toolkit-setup-new-relic-telemetry.mdc +354 -0
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/framework/command/base-context-help/index.ts","../../../src/commands/cursor-context/lib/help/index.ts","../../../src/commands/framework/helpers/package-rules-path/index.ts","../../../src/commands/framework/helpers/rule-files/index.ts","../../../src/commands/framework/helpers/directory-exists/index.ts","../../../src/commands/framework/helpers/format-messages/index.ts","../../../src/commands/framework/helpers/package-path/index.ts","../../../src/commands/framework/helpers/mcp-config/index.ts","../../../src/commands/framework/helpers/cursor-ide-detector/index.ts","../../../src/commands/framework/helpers/index.ts","../../../src/commands/framework/command/base-context-check/index.ts","../../../src/commands/cursor-context/lib/check/index.ts","../../../src/commands/framework/command/base-rule-apply/index.ts","../../../src/commands/cursor-context/lib/apply/index.ts","../../../src/commands/framework/command/base-rules/index.ts","../../../src/commands/cursor-context/lib/index.ts","../../../src/commands/cursor-context/bin/cli.ts"],"sourcesContent":["/**\n * <license header>\n */\n\nimport { CommandDescriptor, CommandResult } from '../base-rules/types';\n\n/**\n * BaseContextHelp class\n * Provides help text for the base rules CLI\n */\nexport abstract class BaseContextHelp {\n /**\n * Static command name\n */\n static readonly NAME = 'help';\n\n /**\n * Static command description\n */\n static readonly DESCRIPTION = 'Show help for the rules commands';\n\n /**\n * Static repository URL\n */\n private static readonly repositoryUrl = 'https://github.com/adobe-commerce/aio-toolkit';\n\n /**\n * Static method to get the commands - must be implemented by subclasses\n *\n * @returns {CommandDescriptor[]} The commands\n */\n public static getCliName(): string {\n throw new Error('getCliName() must be implemented by subclass');\n }\n\n /**\n * Get the commands dynamically\n *\n * @returns {CommandDescriptor[]} The commands array\n */\n public static getCommands(): CommandDescriptor[] {\n throw new Error('getCommands() must be implemented by subclass');\n }\n\n /**\n * Static execute method that returns the help text\n *\n * @returns {CommandResult} The command result with help text\n */\n static execute(): CommandResult {\n const helpText = [\n this.getUsageSection(),\n this.getCommandsSection(),\n this.getExamplesSection(),\n this.getFooterSection(),\n ].join('\\n');\n\n return {\n success: true,\n message: helpText,\n };\n }\n\n /**\n * Get the usage section\n *\n * @returns {string} The usage section\n */\n private static getUsageSection(): string {\n return `Usage: npx ${this.getCliName()} <command>`;\n }\n\n /**\n * Get the commands section\n *\n * @returns {string} The commands section\n */\n private static getCommandsSection(): string {\n const commands = this.getCommands();\n const maxNameLength = Math.max(...commands.map((cmd: CommandDescriptor) => cmd.name.length));\n const commandsList = commands\n .map((cmd: CommandDescriptor) => ` ${cmd.name.padEnd(maxNameLength + 2)}${cmd.description}`)\n .join('\\n');\n return `\\nCommands:\\n${commandsList}`;\n }\n\n /**\n * Get the examples section\n *\n * @returns {string} The examples section\n */\n private static getExamplesSection(): string {\n const commands = this.getCommands();\n const examples = commands\n .map((cmd: CommandDescriptor) => ` npx ${this.getCliName()} ${cmd.name}`)\n .join('\\n');\n return `\\nExamples:\\n${examples}`;\n }\n\n /**\n * Get the footer section with additional information\n *\n * @returns {string} The footer section\n */\n private static getFooterSection(): string {\n return `\\nFor more information, visit:\\n ${this.repositoryUrl}\\n`;\n }\n}\n","/**\n * <license header>\n */\n\nimport { BaseContextHelp } from '../../../framework/command/base-context-help/index';\nimport { CommandDescriptor } from '../../../framework/command/base-rules/types';\n\n/**\n * CursorContextHelp class\n * Provides help text for the aio-toolkit-cursor-context CLI\n */\nexport class CursorContextHelp extends BaseContextHelp {\n /**\n * Get the CLI name\n * This is used to display the correct help text for the CLI.\n *\n * @returns {string} The CLI name\n */\n public static override getCliName(): string {\n return 'aio-toolkit-cursor-context';\n }\n\n /**\n * Get commands dynamically to avoid circular dependency\n * This will be populated when CursorRules is initialized\n *\n * @returns {CommandDescriptor[]} The commands array\n */\n public static override getCommands(): CommandDescriptor[] {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { CursorRules } = require('../index');\n return CursorRules.getCommands();\n }\n}\n","/**\n * PackageRulesPath helper class\n * Finds the package rules path from the installed package\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nexport class PackageRulesPath {\n /**\n * Get the package rules path\n * @param {string} rulesPath - The relative path to rules within the package (e.g., 'src/cursor/rules')\n * @returns {string | null} The absolute path to rules in the installed package, or null if not found\n */\n static get(rulesPath: string): string | null {\n try {\n // Find the package root directory\n const packageRoot = this.findPackageRoot();\n\n if (packageRoot) {\n const fullRulesPath = path.join(packageRoot, rulesPath);\n\n // Verify the rules path exists\n if (fs.existsSync(fullRulesPath)) {\n return fullRulesPath;\n }\n }\n\n return null;\n } catch {\n return null;\n }\n }\n\n /**\n * Find the package root directory\n * @returns {string | null} The package root path or null if not found\n */\n private static findPackageRoot(): string | null {\n // Start from current file location\n let currentDir = __dirname;\n\n // Go up directories until we find package.json with our package name\n for (let i = 0; i < 10; i++) {\n const packageJsonPath = path.join(currentDir, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n try {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n // Check if this is our package\n if (packageJson.name === '@adobe-commerce/aio-toolkit') {\n return currentDir;\n }\n } catch {\n // Continue searching\n }\n }\n\n const parentDir = path.dirname(currentDir);\n /* istanbul ignore next */ // Both branches are covered, but Jest has trouble tracking coverage in loops\n if (parentDir === currentDir) break; // Reached root\n currentDir = parentDir;\n }\n\n return null;\n }\n}\n","/**\n * RuleFiles helper class\n * Gets rule files from a directory\n */\n\nimport * as fs from 'fs';\n\nexport class RuleFiles {\n private static readonly ruleExtensions = ['.mdc', '.md'];\n\n /**\n * Get all rule files from a directory\n * @param {string} dirPath - The path to the directory containing rule files\n * @returns {string[]} Array of rule file names\n */\n static get(dirPath: string): string[] {\n try {\n if (!fs.existsSync(dirPath)) {\n return [];\n }\n\n const files = fs.readdirSync(dirPath);\n return files.filter(file => this.ruleExtensions.some(ext => file.endsWith(ext)));\n } catch {\n return [];\n }\n }\n}\n","/**\n * DirectoryExists helper class\n * Checks and ensures directory existence\n */\n\nimport * as fs from 'fs';\n\nexport class DirectoryExists {\n /**\n * Check if a directory exists\n * @param {string} dirPath - The directory path to check\n * @returns {boolean} True if directory exists and is a directory\n */\n static is(dirPath: string): boolean {\n try {\n return fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory();\n } catch {\n return false;\n }\n }\n\n /**\n * Ensure a directory exists, create if it doesn't\n * @param {string} dirPath - The directory path to ensure\n * @returns {void}\n */\n static ensure(dirPath: string): void {\n if (!this.is(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n }\n}\n","/**\n * FormatMessages helper class\n * Formats an array of messages into a single string\n */\n\nexport class FormatMessages {\n /**\n * Format an array of messages into a single string\n * @param {string[]} messages - Array of message lines\n * @returns {string} Formatted message string\n */\n static execute(messages: string[]): string {\n return messages.join('\\n');\n }\n}\n","/**\n * PackagePath helper\n * Finds the path to a package in node_modules\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nexport class PackagePath {\n /**\n * Find the path to a package in node_modules\n *\n * @param {string} packageName - The name of the package to find (e.g., '@adobe-commerce/commerce-extensibility-tools')\n * @param {string} projectPath - The project root path (defaults to current directory)\n * @returns {string | null} The absolute path to the package, or null if not found\n */\n static find(packageName: string, projectPath: string = process.cwd()): string | null {\n try {\n // Start from the project root and traverse up to find node_modules\n let currentDir = projectPath;\n const maxIterations = 10; // Prevent infinite loop\n\n for (let i = 0; i < maxIterations; i++) {\n // Check if node_modules exists in current directory\n const nodeModulesPath = path.join(currentDir, 'node_modules');\n\n if (fs.existsSync(nodeModulesPath)) {\n // Check if package exists in this node_modules\n const packagePath = path.join(nodeModulesPath, packageName);\n\n if (fs.existsSync(packagePath)) {\n return packagePath;\n }\n }\n\n // Move up one directory\n const parentDir = path.dirname(currentDir);\n\n // If we've reached the root, stop\n if (parentDir === currentDir) {\n break;\n }\n\n currentDir = parentDir;\n }\n\n return null;\n } catch (error) {\n return null;\n }\n }\n\n /**\n * Get the entry point file path for a package\n *\n * @param {string} packageName - The name of the package\n * @param {string} projectPath - The project root path (defaults to current directory)\n * @returns {string | null} The relative path from project root to the package entry point, or null if not found\n */\n static getEntryPoint(packageName: string, projectPath: string = process.cwd()): string | null {\n try {\n const packagePath = this.find(packageName, projectPath);\n\n if (!packagePath) {\n return null;\n }\n\n // Read package.json to get the entry point\n const packageJsonPath = path.join(packagePath, 'package.json');\n\n if (!fs.existsSync(packageJsonPath)) {\n // Default to index.js if package.json doesn't exist\n const defaultEntry = path.join(packagePath, 'index.js');\n if (fs.existsSync(defaultEntry)) {\n // Return relative path from project root\n return path.relative(projectPath, defaultEntry);\n }\n return null;\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const entryPoint = packageJson.main || 'index.js';\n\n // Build absolute path to entry point\n const entryPointPath = path.join(packagePath, entryPoint);\n\n if (!fs.existsSync(entryPointPath)) {\n return null;\n }\n\n // Return relative path from project root\n return path.relative(projectPath, entryPointPath);\n } catch (error) {\n return null;\n }\n }\n}\n","/**\n * McpConfig helper\n * Generates and manages MCP (Model Context Protocol) configuration for Cursor IDE\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { PackagePath } from '../package-path';\nimport type { McpServerConfig, McpConfigStructure, McpConfigResult } from './types';\n\nexport type { McpServerConfig, McpConfigStructure, McpConfigResult } from './types';\n\nexport class McpConfig {\n /**\n * Create or update MCP configuration file\n *\n * @param {string} projectPath - The project root path (defaults to current directory)\n * @returns {McpConfigResult} Result object with success status and reason\n */\n static createOrUpdate(projectPath: string = process.cwd()): McpConfigResult {\n try {\n const mcpFilePath = path.join(projectPath, '.cursor', 'mcp.json');\n\n // Find the commerce-extensibility-tools package\n const packageName = '@adobe-commerce/commerce-extensibility-tools';\n const packageEntryPoint = PackagePath.getEntryPoint(packageName, projectPath);\n\n if (!packageEntryPoint) {\n // Package not found, return with warning\n return {\n success: false,\n reason: 'peer-dependency-missing',\n message: `Package '${packageName}' not found. Install it to enable MCP server integration:\\n npm install ${packageName}`,\n };\n }\n\n // Build commerce-extensibility server configuration\n const commerceExtensibilityConfig: McpServerConfig = {\n command: 'node',\n args: [packageEntryPoint.replace(/\\\\/g, '/')], // Normalize path separators for cross-platform\n env: {},\n };\n\n // Check if mcp.json already exists\n let existingConfig: McpConfigStructure | null = null;\n const fileExists = fs.existsSync(mcpFilePath);\n\n if (fileExists) {\n try {\n const existingContent = fs.readFileSync(mcpFilePath, 'utf-8');\n existingConfig = JSON.parse(existingContent);\n } catch (error) {\n // If parsing fails, we'll overwrite with new config\n existingConfig = null;\n }\n }\n\n // Build final MCP configuration\n const mcpConfig: McpConfigStructure = {\n mcpServers: existingConfig?.mcpServers\n ? {\n ...existingConfig.mcpServers,\n 'commerce-extensibility': commerceExtensibilityConfig,\n }\n : {\n 'commerce-extensibility': commerceExtensibilityConfig,\n },\n };\n\n // Write the configuration file\n fs.writeFileSync(mcpFilePath, JSON.stringify(mcpConfig, null, 2) + '\\n', 'utf-8');\n\n return {\n success: true,\n reason: fileExists ? 'updated' : 'created',\n message: fileExists\n ? 'MCP configuration updated at .cursor/mcp.json'\n : 'MCP configuration created at .cursor/mcp.json',\n };\n } catch (error) {\n return {\n success: false,\n reason: 'error',\n message: `Failed to create MCP config: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n }\n\n /**\n * Check if MCP configuration exists\n *\n * @param {string} projectPath - The project root path (defaults to current directory)\n * @returns {boolean} True if mcp.json exists, false otherwise\n */\n static exists(projectPath: string = process.cwd()): boolean {\n const mcpFilePath = path.join(projectPath, '.cursor', 'mcp.json');\n return fs.existsSync(mcpFilePath);\n }\n\n /**\n * Get the path to the MCP configuration file\n *\n * @param {string} projectPath - The project root path (defaults to current directory)\n * @returns {string} The path to mcp.json\n */\n static getPath(projectPath: string = process.cwd()): string {\n return path.join(projectPath, '.cursor', 'mcp.json');\n }\n}\n","/**\n * CursorIdeDetector helper class\n * Detects if the current IDE is Cursor IDE\n */\n\nimport * as os from 'os';\n\nexport class CursorIdeDetector {\n /**\n * Check if Cursor IDE is being used\n * @returns {boolean} True if Cursor IDE is detected, false otherwise\n */\n static isCursorIde(): boolean {\n try {\n // Method 1: Check for Cursor-specific environment variables (most reliable)\n // Cursor IDE sets these when launching terminal/commands:\n // - CURSOR_TRACE_ID: Trace ID for Cursor operations\n // - CURSOR_AGENT: Indicates Cursor agent is running\n // - __CFBundleIdentifier: macOS bundle identifier (com.todesktop.*)\n // - CURSOR or CURSOR_IDE: Legacy/alternative variables\n if (\n process.env.CURSOR ||\n process.env.CURSOR_IDE ||\n process.env.CURSOR_TRACE_ID ||\n process.env.CURSOR_AGENT ||\n (process.env.__CFBundleIdentifier &&\n process.env.__CFBundleIdentifier.startsWith('com.todesktop.'))\n ) {\n return true;\n }\n\n // Method 2: Check if running from Cursor's installation directory\n // This checks if Node.js was launched from within Cursor.app\n const execPath = process.execPath.toLowerCase();\n const cursorPaths = ['cursor.app', 'cursor.exe'];\n // Check for cursor.app/cursor.exe but exclude macOS-specific paths\n // (those are checked in Method 4 for better platform-specific detection)\n const isMacOsSpecificPath = execPath.includes('/applications/cursor.app/contents');\n if (cursorPaths.some(cursorPath => execPath.includes(cursorPath)) && !isMacOsSpecificPath) {\n return true;\n }\n\n // Method 3: Check parent process name (if available)\n // On macOS, check if parent process is Cursor\n if (process.env._) {\n const parentProcess = process.env._.toLowerCase();\n // Only match if it's clearly Cursor, not just containing \"cursor\" (could be false positive)\n if (\n parentProcess.includes('cursor.app') ||\n parentProcess.includes('cursor.exe') ||\n parentProcess.endsWith('/cursor')\n ) {\n return true;\n }\n }\n\n // Method 4: Check if we're running from Cursor's embedded Node.js\n // Cursor IDE includes its own Node.js runtime\n const platform = os.platform();\n if (platform === 'darwin') {\n // On macOS, Cursor's Node.js is typically at:\n // /Applications/Cursor.app/Contents/Resources/app/bin/cursor or similar\n if (execPath.includes('/applications/cursor.app/contents')) {\n return true;\n }\n } else if (platform === 'win32') {\n // On Windows, check if execPath is within Cursor installation\n if (\n execPath.includes('cursor') &&\n (execPath.includes('program files') ||\n execPath.includes('localappdata') ||\n execPath.includes('appdata'))\n ) {\n return true;\n }\n } else if (platform === 'linux') {\n // On Linux, check if execPath is within Cursor installation\n if (\n execPath.includes('cursor') &&\n (execPath.includes('/opt/cursor') ||\n execPath.includes('/usr/share/cursor') ||\n execPath.includes('/.local/share/cursor'))\n ) {\n return true;\n }\n }\n\n // Don't check if Cursor is just installed - only check if we're running FROM Cursor\n // This prevents false positives when Cursor is installed but not being used\n return false;\n } catch {\n // If detection fails, assume false\n return false;\n }\n }\n\n /**\n * Get a user-friendly message about Cursor IDE detection\n * @returns {string} Message about Cursor IDE status\n */\n static getDetectionMessage(): string {\n if (this.isCursorIde()) {\n return '✅ Cursor IDE detected';\n }\n return '⚠️ Cursor IDE not detected - cursor rules may not work in other IDEs';\n }\n}\n","/**\n * Helpers index\n * Export all helper classes\n */\n\nexport { PackageRulesPath } from './package-rules-path/index';\nexport { RuleFiles } from './rule-files/index';\nexport { DirectoryExists } from './directory-exists/index';\nexport { FormatMessages } from './format-messages/index';\nexport { PackagePath } from './package-path/index';\nexport { McpConfig } from './mcp-config/index';\nexport { CursorIdeDetector } from './cursor-ide-detector/index';\n","/**\n * <license header>\n */\n\nimport * as path from 'path';\nimport { CommandResult } from '../base-rules/types';\nimport {\n RuleFiles,\n DirectoryExists,\n FormatMessages,\n McpConfig,\n CursorIdeDetector,\n} from '../../helpers/index';\n\n/**\n * BaseContextCheck class\n * Checks if cursor contexts are being applied to the project\n */\nexport abstract class BaseContextCheck {\n /**\n * Static command name\n */\n static readonly NAME = 'check';\n\n /**\n * Static command description\n */\n static readonly DESCRIPTION = 'Check contexts are applied to the project';\n\n /**\n * Get the directory paths to check\n * This is used to check if the context directories exist.\n *\n * @returns {string[]} Array of directory paths relative to project root\n */\n public static getDirs(): string[] {\n throw new Error('getDirs() must be implemented by subclass');\n }\n\n /**\n * Static execute method to check and return the result\n *\n * @param {string} projectPath - The path to the project root (defaults to current directory)\n * @returns {Promise<CommandResult>} The check result\n */\n static async execute(projectPath: string = process.cwd()): Promise<CommandResult> {\n const dirs = this.getDirs();\n const missingDirs: string[] = [];\n const existingDirs: string[] = [];\n const allContextFiles: Array<{ dir: string; files: string[] }> = [];\n\n // Check all directories\n for (const dir of dirs) {\n const contextPath = path.join(projectPath, dir);\n if (!DirectoryExists.is(contextPath)) {\n missingDirs.push(dir);\n } else {\n existingDirs.push(dir);\n // Check for context files in this directory\n const contextFiles = RuleFiles.get(contextPath);\n if (contextFiles.length > 0) {\n allContextFiles.push({ dir, files: contextFiles });\n }\n }\n }\n\n // If no directories exist, return error\n if (existingDirs.length === 0) {\n return {\n success: false,\n message: FormatMessages.execute([\n '❌ Context directories not found',\n '--------------------------------',\n CursorIdeDetector.getDetectionMessage(),\n '',\n `The following directories do not exist:`,\n ...missingDirs.map(dir => ` - ${dir}`),\n 'Run: npx aio-toolkit-cursor-context apply',\n ]),\n };\n }\n\n // If directories exist but no context files found\n if (allContextFiles.length === 0) {\n return {\n success: false,\n message: FormatMessages.execute([\n '❌ No context files found',\n '--------------------------------',\n CursorIdeDetector.getDetectionMessage(),\n '',\n `No context files (.mdc, .md) found in:`,\n ...existingDirs.map(dir => ` - ${dir}`),\n 'Run: npx aio-toolkit-cursor-context apply',\n ]),\n };\n }\n\n // Success - contexts are applied\n const totalFiles = allContextFiles.reduce((sum, item) => sum + item.files.length, 0);\n const messages: string[] = [\n '✅ Contexts are applied to the project',\n '--------------------------------',\n CursorIdeDetector.getDetectionMessage(),\n '',\n `Found ${totalFiles} context file${totalFiles > 1 ? 's' : ''} across ${allContextFiles.length} director${allContextFiles.length > 1 ? 'ies' : 'y'}:`,\n ];\n\n // Add files grouped by directory\n for (const { dir, files } of allContextFiles) {\n messages.push(`\\n${dir}:`);\n files.forEach(file => messages.push(` - ${file}`));\n }\n\n // Warn about missing directories if any\n if (missingDirs.length > 0) {\n messages.push('\\n⚠️ Missing directories:');\n missingDirs.forEach(dir => messages.push(` - ${dir}`));\n }\n\n // Check MCP server configuration\n const mcpExists = McpConfig.exists(projectPath);\n messages.push('');\n if (mcpExists) {\n messages.push('✅ MCP server configuration found at .cursor/mcp.json');\n } else {\n messages.push('⚠️ MCP server configuration not found');\n messages.push(' Run: npx aio-toolkit-cursor-context apply');\n }\n\n return {\n success: true,\n message: FormatMessages.execute(messages),\n };\n }\n}\n","/**\n * <license header>\n */\n\nimport * as path from 'path';\nimport { BaseContextCheck } from '../../../framework/command/base-context-check/index';\n\n/**\n * CursorContextCheck class\n * Checks if cursor context directories exist\n */\nexport class CursorContextCheck extends BaseContextCheck {\n /**\n * Get the directory paths to check\n * This is used to check if the context directories exist.\n *\n * @returns {string[]} Array of directory paths relative to project root\n */\n public static override getDirs(): string[] {\n return [path.join('.cursor', 'rules'), path.join('.cursor', 'commands')];\n }\n}\n","/**\n * BaseRuleApply class\n * Applies contexts to the project by copying from package\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { FormatMessages } from '../../helpers/format-messages';\nimport {\n PackageRulesPath,\n RuleFiles,\n DirectoryExists,\n McpConfig,\n CursorIdeDetector,\n} from '../../helpers/index';\nimport { CommandResult } from '../base-rules/types';\n\n/**\n * BaseRuleApply class\n * Applies contexts to the project by copying from package\n */\nexport class BaseRuleApply {\n /**\n * Static command name\n */\n static readonly NAME = 'apply';\n\n /**\n * Static command description\n */\n static readonly DESCRIPTION =\n 'Apply contexts to your project (use --force or -f to overwrite existing)';\n\n /**\n * Get the copy directories configuration\n * @returns {Record<string, { from: string; to: string }>} Object with directory pairs to copy\n */\n public static getCopyDirs(): Record<string, { from: string; to: string }> {\n throw new Error('getCopyDirs() must be implemented by subclass');\n }\n\n /**\n * Check if IDE detection is required before applying contexts\n * Override this method in subclasses to enable IDE detection\n * @returns {boolean} True if IDE detection should be performed\n */\n public static shouldCheckIde(): boolean {\n return false;\n }\n\n /**\n * Static execute method to apply contexts\n * @param {string} projectPath - The path to the project root (defaults to current directory)\n * @param {string[]} args - Command arguments\n * @returns {Promise<CommandResult>} The apply result\n */\n static async execute(\n projectPath: string = process.cwd(),\n args: string[] = []\n ): Promise<CommandResult> {\n // Handle case where first argument is a flag (e.g., 'apply -f')\n // If projectPath starts with '-', it's actually a flag, not a path\n let actualProjectPath = projectPath;\n let actualArgs = args;\n\n if (projectPath.startsWith('-')) {\n // First argument is a flag, treat it as part of args\n actualProjectPath = process.cwd();\n actualArgs = [projectPath, ...args];\n }\n\n // Check for force flag\n const forceOverwrite = actualArgs.includes('--force') || actualArgs.includes('-f');\n\n // Check IDE detection if required (skip if force flag is set)\n if (!forceOverwrite && this.shouldCheckIde() && !CursorIdeDetector.isCursorIde()) {\n return {\n success: false,\n message: FormatMessages.execute([\n '❌ Cursor IDE not detected',\n '--------------------------------',\n CursorIdeDetector.getDetectionMessage(),\n '',\n 'Cursor contexts can only be applied when using Cursor IDE.',\n 'Please run this command from within Cursor IDE.',\n '',\n 'ℹ️ Use --force or -f to bypass this check and apply contexts anyway.',\n ]),\n };\n }\n\n try {\n const copyDirs = this.getCopyDirs();\n const dirKeys = Object.keys(copyDirs);\n\n if (dirKeys.length === 0) {\n return {\n success: false,\n message: FormatMessages.execute([\n '❌ No directories configured',\n '--------------------------------',\n 'The getCopyDirs() method must return at least one directory pair',\n ]),\n };\n }\n\n // Track results for all directories\n const allResults: Record<\n string,\n {\n copiedFiles: string[];\n skippedFiles: string[];\n overwrittenFiles: string[];\n sourcePath: string | null;\n destPath: string;\n }\n > = {};\n\n // Process each directory pair\n for (const dirKey of dirKeys) {\n const dirConfig = copyDirs[dirKey];\n if (!dirConfig) {\n continue;\n }\n const { from: sourceRelativePath, to: destRelativePath } = dirConfig;\n\n // Get the source directory path from this package using helper\n const sourcePath = PackageRulesPath.get(sourceRelativePath);\n\n if (!sourcePath) {\n return {\n success: false,\n message: FormatMessages.execute([\n '❌ Could not find contexts in package',\n '--------------------------------',\n 'The package context directory does not exist',\n `Expected at: ${sourceRelativePath}`,\n ]),\n };\n }\n\n // Get context files from source using helper\n const contextFiles = RuleFiles.get(sourcePath);\n\n if (contextFiles.length === 0) {\n return {\n success: false,\n message: FormatMessages.execute([\n '❌ No contexts found to apply',\n '--------------------------------',\n 'The package does not contain any context files',\n `Checked directory: ${sourceRelativePath}`,\n ]),\n };\n }\n\n // Create destination directory using helper\n const destPath = path.join(actualProjectPath, destRelativePath);\n DirectoryExists.ensure(destPath);\n\n // Initialize results for this directory\n allResults[dirKey] = {\n copiedFiles: [],\n skippedFiles: [],\n overwrittenFiles: [],\n sourcePath,\n destPath: destRelativePath,\n };\n\n // Copy context files (skip existing unless force flag is set)\n for (const file of contextFiles) {\n const sourceFilePath = path.join(sourcePath, file);\n const destFilePath = path.join(destPath, file);\n\n const fileExists = fs.existsSync(destFilePath);\n\n if (forceOverwrite) {\n // Force mode: copy all files (overwrite if exists)\n fs.copyFileSync(sourceFilePath, destFilePath);\n if (fileExists) {\n allResults[dirKey].overwrittenFiles.push(file);\n } else {\n allResults[dirKey].copiedFiles.push(file);\n }\n } else {\n // Normal mode: only copy if file doesn't exist\n if (!fileExists) {\n fs.copyFileSync(sourceFilePath, destFilePath);\n allResults[dirKey].copiedFiles.push(file);\n } else {\n allResults[dirKey].skippedFiles.push(file);\n }\n }\n }\n }\n\n // Create or update MCP configuration\n const mcpResult = McpConfig.createOrUpdate(actualProjectPath);\n\n // Build success message\n const messages: string[] = [];\n\n // Calculate totals across all directories\n const totalCopied = Object.values(allResults).reduce(\n (sum, r) => sum + r.copiedFiles.length,\n 0\n );\n const totalSkipped = Object.values(allResults).reduce(\n (sum, r) => sum + r.skippedFiles.length,\n 0\n );\n\n if (forceOverwrite) {\n // Force mode messages\n messages.push(\n '✅ Contexts applied successfully (force mode)!',\n '--------------------------------'\n );\n\n // Show results for each directory\n for (const dirKey of dirKeys) {\n const result = allResults[dirKey];\n if (!result) {\n continue;\n }\n /* istanbul ignore next */ // Unreachable: In force mode, files are always either copied or overwritten\n if (result.copiedFiles.length > 0 || result.overwrittenFiles.length > 0) {\n messages.push(`\\n${dirKey.toUpperCase()}:`);\n\n if (result.copiedFiles.length > 0) {\n messages.push(\n ` Copied ${result.copiedFiles.length} new context file${result.copiedFiles.length > 1 ? 's' : ''} to ${result.destPath}:`,\n ...result.copiedFiles.map(file => ` ✓ ${file}`)\n );\n }\n\n if (result.overwrittenFiles.length > 0) {\n if (result.copiedFiles.length > 0) {\n messages.push('');\n }\n messages.push(\n ` Overwritten ${result.overwrittenFiles.length} existing context file${result.overwrittenFiles.length > 1 ? 's' : ''}:`,\n ...result.overwrittenFiles.map(file => ` ↻ ${file}`)\n );\n }\n }\n }\n\n messages.push('');\n\n // Add MCP config message\n if (mcpResult.success) {\n messages.push(`✓ ${mcpResult.message}`, '');\n } else if (mcpResult.reason === 'peer-dependency-missing') {\n messages.push(`⚠️ ${mcpResult.message}`, '');\n }\n\n messages.push('⚠️ Please restart your IDE to load the updated contexts');\n } else {\n // Normal mode messages\n if (totalCopied === 0 && totalSkipped > 0) {\n // All files already exist\n messages.push('✅ All contexts are already applied!', '--------------------------------');\n\n // Show skipped files for each directory\n for (const dirKey of dirKeys) {\n const result = allResults[dirKey];\n if (!result) {\n continue;\n }\n /* istanbul ignore next */ // Unreachable: In \"all files already exist\" branch, directories with results must have skipped files\n if (result.skippedFiles.length > 0) {\n messages.push(\n `\\n${dirKey.toUpperCase()}:`,\n ` All ${result.skippedFiles.length} context file${result.skippedFiles.length > 1 ? 's' : ''} already exist in ${result.destPath}:`,\n ...result.skippedFiles.map(file => ` ⊝ ${file}`)\n );\n }\n }\n\n // Add MCP config message\n if (mcpResult.success) {\n messages.push('', `✓ ${mcpResult.message}`);\n } else if (mcpResult.reason === 'peer-dependency-missing') {\n messages.push('', `⚠️ ${mcpResult.message}`);\n }\n\n messages.push('', 'ℹ️ Use --force or -f to overwrite existing contexts');\n } else {\n // Some or all files were copied\n messages.push('✅ Contexts applied successfully!', '--------------------------------');\n\n // Show results for each directory\n for (const dirKey of dirKeys) {\n const result = allResults[dirKey];\n if (!result) {\n continue;\n }\n /* istanbul ignore next */ // Unreachable: Directories with results always have copied or skipped files\n if (result.copiedFiles.length > 0 || result.skippedFiles.length > 0) {\n messages.push(`\\n${dirKey.toUpperCase()}:`);\n\n if (result.copiedFiles.length > 0) {\n messages.push(\n ` Copied ${result.copiedFiles.length} new context file${result.copiedFiles.length > 1 ? 's' : ''} to ${result.destPath}:`,\n ...result.copiedFiles.map(file => ` ✓ ${file}`)\n );\n }\n\n if (result.skippedFiles.length > 0) {\n if (result.copiedFiles.length > 0) {\n messages.push('');\n }\n messages.push(\n ` Skipped ${result.skippedFiles.length} existing context file${result.skippedFiles.length > 1 ? 's' : ''}:`,\n ...result.skippedFiles.map(file => ` ⊝ ${file}`),\n '',\n ' ℹ️ Use --force or -f to overwrite existing contexts'\n );\n }\n }\n }\n\n /* istanbul ignore next */ // Unreachable: In else branch, totalCopied > 0 must be true (otherwise would fail earlier)\n if (totalCopied > 0) {\n messages.push('');\n\n // Add MCP config message\n if (mcpResult.success) {\n messages.push(`✓ ${mcpResult.message}`, '');\n } else if (mcpResult.reason === 'peer-dependency-missing') {\n messages.push(`⚠️ ${mcpResult.message}`, '');\n }\n\n messages.push('⚠️ Please restart your IDE to load the new contexts');\n }\n }\n }\n\n // Success\n return {\n success: true,\n message: FormatMessages.execute(messages),\n };\n } catch (error) {\n return {\n success: false,\n message: FormatMessages.execute([\n '❌ Failed to apply contexts to the project',\n '--------------------------------',\n `Error: ${error instanceof Error ? error.message : String(error)}`,\n ]),\n };\n }\n }\n}\n","/**\n * CursorRuleApply class\n * Applies cursor rules to the project by copying from package\n */\n\nimport * as path from 'path';\nimport { BaseRuleApply } from '../../../framework/command/base-rule-apply/index';\n\n/**\n * CursorRuleApply class\n * Applies cursor rules to the project by copying from package\n */\nexport class CursorRuleApply extends BaseRuleApply {\n /**\n * Enable IDE detection for Cursor-specific contexts\n * @returns {boolean} True to enable IDE detection\n */\n public static override shouldCheckIde(): boolean {\n return true;\n }\n\n /**\n * Get the rules directory path\n * @returns {string} The rules directory path\n */\n public static override getCopyDirs(): Record<string, { from: string; to: string }> {\n return {\n rules: {\n from: path.join('files', 'cursor-context', 'rules'),\n to: path.join('.cursor', 'rules'),\n },\n commands: {\n from: path.join('files', 'cursor-context', 'commands'),\n to: path.join('.cursor', 'commands'),\n },\n };\n }\n}\n","/**\n * <license header>\n */\n\nimport { CommandResult, CommandDescriptor } from './types';\n\n/**\n * BaseRules class\n * Manages the execution of base rules commands\n */\nexport abstract class BaseRules {\n /**\n * Static method to get the commands - must be implemented by subclasses\n *\n * @returns {CommandDescriptor[]} The commands\n */\n public static getCommands(): CommandDescriptor[] {\n throw new Error('getCommands() must be implemented by subclass');\n }\n\n /**\n * Static execute method to execute a command\n *\n * @param {string} type - The name of the command to execute\n * @param {...any} args - The arguments to pass to the command\n * @returns {Promise<CommandResult>} The execution result\n */\n static async execute(type: string = 'help', ...args: any[]): Promise<CommandResult> {\n const command = this.getCommands().find((cmd: CommandDescriptor) => cmd.name === type);\n if (!command) {\n return {\n success: false,\n message: `Unknown command: ${type}`,\n };\n }\n return await command.execute(...args);\n }\n}\n","/**\n * <license header>\n */\n\nimport { CursorContextHelp } from './help/index';\nimport { CursorContextCheck } from './check/index';\nimport { CursorRuleApply } from './apply/index';\nimport { CommandDescriptor } from '../../framework/command/base-rules/types';\nimport { BaseRules } from '../../framework/command/base-rules/index';\n\n/**\n * CursorRules class\n * Manages the execution of cursor rules commands\n */\nexport class CursorRules extends BaseRules {\n /**\n * Static commands array\n *\n * @returns {CommandDescriptor[]} The commands array\n */\n public static override getCommands(): CommandDescriptor[] {\n return [\n {\n name: CursorContextHelp.NAME,\n description: CursorContextHelp.DESCRIPTION,\n execute: CursorContextHelp.execute.bind(CursorContextHelp),\n },\n {\n name: CursorContextCheck.NAME,\n description: CursorContextCheck.DESCRIPTION,\n execute: CursorContextCheck.execute.bind(CursorContextCheck),\n },\n {\n name: CursorRuleApply.NAME,\n description: CursorRuleApply.DESCRIPTION,\n execute: CursorRuleApply.execute.bind(CursorRuleApply),\n },\n ];\n }\n}\n","/**\n * <license header>\n */\n\n/**\n * CLI entry point for aio-toolkit-cursor-context\n *\n * This will handle commands like:\n * - npx aio-toolkit-cursor-context apply\n * - npx aio-toolkit-cursor-context check\n * - npx aio-toolkit-cursor-context help\n */\n\nimport { CursorRules } from '../lib/index';\n\n/**\n * Command to execute\n * @type {string}\n */\nconst command = process.argv[2] || 'help';\n\n/**\n * Additional arguments (flags and options)\n * @type {string[]}\n */\nconst args = process.argv.slice(3);\n\n/**\n * Main function to execute the command\n * @returns {Promise<void>}\n */\nasync function main(): Promise<void> {\n const result = await CursorRules.execute(command, ...args);\n console.log(result.message);\n if (!result.success) {\n process.exit(1);\n }\n}\n\n/**\n * Main function to execute the command\n * @param {Error} error - The error to log\n * @returns {Promise<void>}\n */\nmain().catch((error: Error) => {\n console.error('Error:', error.message);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAUsB;AAVtB;AAAA;AAAA;AAUO,IAAe,mBAAf,MAAe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AAAA,QACF;AACA,eAAO,MAAMA,SAAQ,QAAQ,GAAGD,KAAI;AAAA,MACtC;AAAA,IACF;AA3BgC;AAAzB,IAAe,YAAf;AAAA;AAAA;;;ACVP;AAAA;AAAA;AAAA;AAAA,IAca;AAdb;AAAA;AAAA;AAIA;AACA;AACA;AAEA;AAMO,IAAM,eAAN,MAAM,qBAAoB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMzC,OAAuB,cAAmC;AACxD,eAAO;AAAA,UACL;AAAA,YACE,MAAM,kBAAkB;AAAA,YACxB,aAAa,kBAAkB;AAAA,YAC/B,SAAS,kBAAkB,QAAQ,KAAK,iBAAiB;AAAA,UAC3D;AAAA,UACA;AAAA,YACE,MAAM,mBAAmB;AAAA,YACzB,aAAa,mBAAmB;AAAA,YAChC,SAAS,mBAAmB,QAAQ,KAAK,kBAAkB;AAAA,UAC7D;AAAA,UACA;AAAA,YACE,MAAM,gBAAgB;AAAA,YACtB,aAAa,gBAAgB;AAAA,YAC7B,SAAS,gBAAgB,QAAQ,KAAK,eAAe;AAAA,UACvD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAzB2C;AAApC,IAAM,cAAN;AAAA;AAAA;;;ACDP;AAMA,IAAM,UAAU,QAAQ,KAAK,CAAC,KAAK;AAMnC,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAMjC,eAAe,OAAsB;AACnC,QAAM,SAAS,MAAM,YAAY,QAAQ,SAAS,GAAG,IAAI;AACzD,UAAQ,IAAI,OAAO,OAAO;AAC1B,MAAI,CAAC,OAAO,SAAS;AACnB,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AANe;AAaf,KAAK,EAAE,MAAM,CAAC,UAAiB;AAC7B,UAAQ,MAAM,UAAU,MAAM,OAAO;AACrC,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["CursorRules","fs","fs","fs","path","fs","path","platform","path","path","fs","path","args","path","args","command"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -41,6 +41,30 @@ interface ErrorResponse {
|
|
|
41
41
|
}
|
|
42
42
|
type RuntimeActionResponseType = SuccessResponse | ErrorResponse;
|
|
43
43
|
|
|
44
|
+
interface BaseTelemetryValidator {
|
|
45
|
+
isConfigured(params: Record<string, unknown>): boolean;
|
|
46
|
+
validateConfiguration(params: Record<string, unknown>): void;
|
|
47
|
+
}
|
|
48
|
+
interface BaseTelemetry {
|
|
49
|
+
canInitialize(params: Record<string, unknown>): boolean;
|
|
50
|
+
getConfig(): EntrypointInstrumentationConfig;
|
|
51
|
+
initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class Telemetry {
|
|
55
|
+
private params;
|
|
56
|
+
private logger;
|
|
57
|
+
constructor(params?: Record<string, unknown> | undefined);
|
|
58
|
+
getParams(): Record<string, unknown>;
|
|
59
|
+
setParams(params: Record<string, unknown>): void;
|
|
60
|
+
getLogger(): any;
|
|
61
|
+
createLogger(name: string): any;
|
|
62
|
+
formatError(error: unknown): Record<string, unknown>;
|
|
63
|
+
getCurrentSpan(): any;
|
|
64
|
+
instrument<T extends (...args: any[]) => any>(spanName: string, fn: T): T;
|
|
65
|
+
initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
|
|
66
|
+
}
|
|
67
|
+
|
|
44
68
|
declare class RuntimeAction {
|
|
45
69
|
private static actionType;
|
|
46
70
|
private static actionTypeName;
|
|
@@ -55,9 +79,12 @@ declare class RuntimeAction {
|
|
|
55
79
|
headers: {
|
|
56
80
|
[key: string]: any;
|
|
57
81
|
};
|
|
82
|
+
telemetry: Telemetry;
|
|
58
83
|
}) => Promise<RuntimeActionResponseType>): (params: {
|
|
59
84
|
[key: string]: any;
|
|
60
85
|
}) => Promise<RuntimeActionResponseType>;
|
|
86
|
+
private static executeActionWithInstrumentation;
|
|
87
|
+
private static validateRequestWithInstrumentation;
|
|
61
88
|
private static validateRequest;
|
|
62
89
|
}
|
|
63
90
|
|
|
@@ -91,9 +118,12 @@ declare class EventConsumerAction {
|
|
|
91
118
|
headers: {
|
|
92
119
|
[key: string]: any;
|
|
93
120
|
};
|
|
121
|
+
telemetry: Telemetry;
|
|
94
122
|
}) => Promise<RuntimeActionResponseType>): (params: {
|
|
95
123
|
[key: string]: any;
|
|
96
124
|
}) => Promise<RuntimeActionResponseType>;
|
|
125
|
+
private static validateWithInstrumentation;
|
|
126
|
+
private static executeActionWithInstrumentation;
|
|
97
127
|
}
|
|
98
128
|
|
|
99
129
|
declare class GraphQlAction {
|
|
@@ -105,9 +135,15 @@ declare class GraphQlAction {
|
|
|
105
135
|
params: {
|
|
106
136
|
[key: string]: any;
|
|
107
137
|
};
|
|
138
|
+
telemetry: Telemetry;
|
|
108
139
|
}) => Promise<any>, name?: string, disableIntrospection?: boolean): (params: {
|
|
109
140
|
[key: string]: any;
|
|
110
141
|
}) => Promise<RuntimeActionResponseType>;
|
|
142
|
+
private static buildSchemaWithInstrumentation;
|
|
143
|
+
private static parseQueryWithInstrumentation;
|
|
144
|
+
private static validateQueryWithInstrumentation;
|
|
145
|
+
private static checkIntrospectionWithInstrumentation;
|
|
146
|
+
private static executeGraphQLWithInstrumentation;
|
|
111
147
|
}
|
|
112
148
|
|
|
113
149
|
interface OpenwhiskConfig {
|
|
@@ -128,9 +164,11 @@ declare class OpenwhiskAction {
|
|
|
128
164
|
headers: {
|
|
129
165
|
[key: string]: any;
|
|
130
166
|
};
|
|
167
|
+
telemetry: Telemetry;
|
|
131
168
|
}) => Promise<RuntimeActionResponseType>): (params: {
|
|
132
169
|
[key: string]: any;
|
|
133
170
|
}) => Promise<RuntimeActionResponseType>;
|
|
171
|
+
private static executeActionWithInstrumentation;
|
|
134
172
|
}
|
|
135
173
|
|
|
136
174
|
interface FileRecord {
|
|
@@ -231,9 +269,14 @@ declare class WebhookAction {
|
|
|
231
269
|
headers: {
|
|
232
270
|
[key: string]: any;
|
|
233
271
|
};
|
|
272
|
+
telemetry: Telemetry;
|
|
234
273
|
}) => Promise<WebhookActionResponseType | WebhookActionResponseType[]>): (params: {
|
|
235
274
|
[key: string]: any;
|
|
236
275
|
}) => Promise<RuntimeActionResponseType>;
|
|
276
|
+
private static executeActionWithInstrumentation;
|
|
277
|
+
private static verifySignatureWithInstrumentation;
|
|
278
|
+
private static validateWithInstrumentation;
|
|
279
|
+
private static verifySignature;
|
|
237
280
|
}
|
|
238
281
|
|
|
239
282
|
declare class WebhookActionResponse {
|
|
@@ -284,22 +327,6 @@ declare class RuntimeApiGatewayService {
|
|
|
284
327
|
delete(endpoint: string, additionalHeaders?: Record<string, string>): Promise<any>;
|
|
285
328
|
}
|
|
286
329
|
|
|
287
|
-
interface BaseTelemetryValidator {
|
|
288
|
-
isConfigured(params: Record<string, unknown>): boolean;
|
|
289
|
-
validateConfiguration(params: Record<string, unknown>): void;
|
|
290
|
-
}
|
|
291
|
-
interface BaseTelemetry {
|
|
292
|
-
canInitialize(params: Record<string, unknown>): boolean;
|
|
293
|
-
getConfig(): EntrypointInstrumentationConfig;
|
|
294
|
-
initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
declare class Telemetry {
|
|
298
|
-
static createLogger(name: string, params: Record<string, unknown>): any;
|
|
299
|
-
static formatError(error: unknown): Record<string, unknown>;
|
|
300
|
-
static initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
330
|
declare class TelemetryInputError extends Error {
|
|
304
331
|
constructor(message: string);
|
|
305
332
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,30 @@ interface ErrorResponse {
|
|
|
41
41
|
}
|
|
42
42
|
type RuntimeActionResponseType = SuccessResponse | ErrorResponse;
|
|
43
43
|
|
|
44
|
+
interface BaseTelemetryValidator {
|
|
45
|
+
isConfigured(params: Record<string, unknown>): boolean;
|
|
46
|
+
validateConfiguration(params: Record<string, unknown>): void;
|
|
47
|
+
}
|
|
48
|
+
interface BaseTelemetry {
|
|
49
|
+
canInitialize(params: Record<string, unknown>): boolean;
|
|
50
|
+
getConfig(): EntrypointInstrumentationConfig;
|
|
51
|
+
initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class Telemetry {
|
|
55
|
+
private params;
|
|
56
|
+
private logger;
|
|
57
|
+
constructor(params?: Record<string, unknown> | undefined);
|
|
58
|
+
getParams(): Record<string, unknown>;
|
|
59
|
+
setParams(params: Record<string, unknown>): void;
|
|
60
|
+
getLogger(): any;
|
|
61
|
+
createLogger(name: string): any;
|
|
62
|
+
formatError(error: unknown): Record<string, unknown>;
|
|
63
|
+
getCurrentSpan(): any;
|
|
64
|
+
instrument<T extends (...args: any[]) => any>(spanName: string, fn: T): T;
|
|
65
|
+
initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
|
|
66
|
+
}
|
|
67
|
+
|
|
44
68
|
declare class RuntimeAction {
|
|
45
69
|
private static actionType;
|
|
46
70
|
private static actionTypeName;
|
|
@@ -55,9 +79,12 @@ declare class RuntimeAction {
|
|
|
55
79
|
headers: {
|
|
56
80
|
[key: string]: any;
|
|
57
81
|
};
|
|
82
|
+
telemetry: Telemetry;
|
|
58
83
|
}) => Promise<RuntimeActionResponseType>): (params: {
|
|
59
84
|
[key: string]: any;
|
|
60
85
|
}) => Promise<RuntimeActionResponseType>;
|
|
86
|
+
private static executeActionWithInstrumentation;
|
|
87
|
+
private static validateRequestWithInstrumentation;
|
|
61
88
|
private static validateRequest;
|
|
62
89
|
}
|
|
63
90
|
|
|
@@ -91,9 +118,12 @@ declare class EventConsumerAction {
|
|
|
91
118
|
headers: {
|
|
92
119
|
[key: string]: any;
|
|
93
120
|
};
|
|
121
|
+
telemetry: Telemetry;
|
|
94
122
|
}) => Promise<RuntimeActionResponseType>): (params: {
|
|
95
123
|
[key: string]: any;
|
|
96
124
|
}) => Promise<RuntimeActionResponseType>;
|
|
125
|
+
private static validateWithInstrumentation;
|
|
126
|
+
private static executeActionWithInstrumentation;
|
|
97
127
|
}
|
|
98
128
|
|
|
99
129
|
declare class GraphQlAction {
|
|
@@ -105,9 +135,15 @@ declare class GraphQlAction {
|
|
|
105
135
|
params: {
|
|
106
136
|
[key: string]: any;
|
|
107
137
|
};
|
|
138
|
+
telemetry: Telemetry;
|
|
108
139
|
}) => Promise<any>, name?: string, disableIntrospection?: boolean): (params: {
|
|
109
140
|
[key: string]: any;
|
|
110
141
|
}) => Promise<RuntimeActionResponseType>;
|
|
142
|
+
private static buildSchemaWithInstrumentation;
|
|
143
|
+
private static parseQueryWithInstrumentation;
|
|
144
|
+
private static validateQueryWithInstrumentation;
|
|
145
|
+
private static checkIntrospectionWithInstrumentation;
|
|
146
|
+
private static executeGraphQLWithInstrumentation;
|
|
111
147
|
}
|
|
112
148
|
|
|
113
149
|
interface OpenwhiskConfig {
|
|
@@ -128,9 +164,11 @@ declare class OpenwhiskAction {
|
|
|
128
164
|
headers: {
|
|
129
165
|
[key: string]: any;
|
|
130
166
|
};
|
|
167
|
+
telemetry: Telemetry;
|
|
131
168
|
}) => Promise<RuntimeActionResponseType>): (params: {
|
|
132
169
|
[key: string]: any;
|
|
133
170
|
}) => Promise<RuntimeActionResponseType>;
|
|
171
|
+
private static executeActionWithInstrumentation;
|
|
134
172
|
}
|
|
135
173
|
|
|
136
174
|
interface FileRecord {
|
|
@@ -231,9 +269,14 @@ declare class WebhookAction {
|
|
|
231
269
|
headers: {
|
|
232
270
|
[key: string]: any;
|
|
233
271
|
};
|
|
272
|
+
telemetry: Telemetry;
|
|
234
273
|
}) => Promise<WebhookActionResponseType | WebhookActionResponseType[]>): (params: {
|
|
235
274
|
[key: string]: any;
|
|
236
275
|
}) => Promise<RuntimeActionResponseType>;
|
|
276
|
+
private static executeActionWithInstrumentation;
|
|
277
|
+
private static verifySignatureWithInstrumentation;
|
|
278
|
+
private static validateWithInstrumentation;
|
|
279
|
+
private static verifySignature;
|
|
237
280
|
}
|
|
238
281
|
|
|
239
282
|
declare class WebhookActionResponse {
|
|
@@ -284,22 +327,6 @@ declare class RuntimeApiGatewayService {
|
|
|
284
327
|
delete(endpoint: string, additionalHeaders?: Record<string, string>): Promise<any>;
|
|
285
328
|
}
|
|
286
329
|
|
|
287
|
-
interface BaseTelemetryValidator {
|
|
288
|
-
isConfigured(params: Record<string, unknown>): boolean;
|
|
289
|
-
validateConfiguration(params: Record<string, unknown>): void;
|
|
290
|
-
}
|
|
291
|
-
interface BaseTelemetry {
|
|
292
|
-
canInitialize(params: Record<string, unknown>): boolean;
|
|
293
|
-
getConfig(): EntrypointInstrumentationConfig;
|
|
294
|
-
initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
declare class Telemetry {
|
|
298
|
-
static createLogger(name: string, params: Record<string, unknown>): any;
|
|
299
|
-
static formatError(error: unknown): Record<string, unknown>;
|
|
300
|
-
static initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
330
|
declare class TelemetryInputError extends Error {
|
|
304
331
|
constructor(message: string);
|
|
305
332
|
}
|