Latest working version of STM CLI + AI Mapper#64
Latest working version of STM CLI + AI Mapper#64Chaymee wants to merge 7 commits intoSolaceLabs:mainfrom
Conversation
This commit addresses two issues with feed generation: 1. Fixed bug where 'undefined' directory was created during feed generation - Set feed.name when feedName is provided via CLI - Moved lastUpdated timestamp before createFeed() call - Removed redundant updateAndLoadFeedInfo() call that wrote feedinfo.json twice - Removed unused updateAndLoadFeedInfo import 2. Added hard-coded default AI field mapper endpoint - Set default to https://b0hv9uf5m8.execute-api.us-east-2.amazonaws.com/Prod/fieldmap - Priority order: CLI flag > env var > hard-coded default - Updated documentation with usage examples and configuration priority 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
removed need for async api spec file and updated the codeflow
…ument The queue command was not respecting the queue name when provided as a positional argument (e.g., `stm manage queue create MyQueue`). The queue name from the config file was being used instead. Problem: When using positional arguments, the config file was being loaded BEFORE the positional arguments were processed. This meant: 1. Config loaded → sets options.queue from config file 2. Positional args processed → sets options.create to the queue name 3. checkparams.ts correctly sets options.queue from options.create 4. BUT the config loader uses cliOptions to determine what was set via CLI, and since positional args were processed AFTER config loading, cliOptions.create wasn't marked as 'cli' when the config was applied Solution: Moved the positional argument handling to BEFORE the config loading in src/index.ts. This ensures that when the config loader checks cliOptions, it sees that the operation was set via CLI, so it won't override the queue name with the config value. Changes: - src/index.ts: Added positional arguments [operation] and [queueName], moved positional arg processing before config loading - src/utils/checkparams.ts: Minor whitespace cleanup - src/common/queue-client.ts: Minor whitespace cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…e' into office-hours-fix
There was a problem hiding this comment.
Pull request overview
This PR adds AI-powered field mapping functionality to the STM CLI, enabling automatic generation of realistic data rules and topic parameter mappings from AsyncAPI specifications. The feature integrates with AWS Bedrock services (Google Gemini and Anthropic Claude) and includes user consent mechanisms through a disclaimer system.
Changes:
- Added
--ai-enhanceand--ai-mapper-endpointflags to feed generate and configure commands - Implemented AI disclaimer acceptance flow with persistent storage
- Integrated AI field mapper client for automatic feedrule enhancement
Reviewed changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/options.ts | Added AI enhancement command-line options for feed generation and configuration |
| src/utils/instances.ts | Extended ManageFeedClientOptionsEmpty class with AI enhancement properties |
| src/utils/field-mapper-client.ts | New module implementing AI field mapper Lambda client with endpoint validation |
| src/utils/defaults.ts | Added default constant for AI disclaimer acceptance file |
| src/utils/ai-disclaimer.ts | New module implementing AI disclaimer prompt and acceptance tracking |
| src/lib/feed-generate.ts | Integrated AI enhancement workflow with disclaimer checks in feed generation |
| src/lib/feed-configure.ts | Integrated AI enhancement workflow for automatic feed configuration |
| src/index.ts | Added queue command positional arguments handling and AI option source tracking |
| documentation/EVENT_FEEDS.md | Added documentation for AI-enhanced field mapping features |
| claude.md | New comprehensive documentation file covering architecture, AI features, and development guidance |
| README.md | Added AI enhancement feature announcement with disclaimer notice |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // .conflicts('feedName')) // INVALID CONFLICT CONDITION | ||
| // hidden option to use defaults | ||
| // AI enhancement options | ||
| .addOption(new Option('-ai, --ai-enhance [BOOLEAN]', chalk.whiteBright('use AI to intelligently enhance field mappings')) .argParser(parseBoolean) .default(false) .hideHelp(advanced)) |
There was a problem hiding this comment.
Corrected spelling of 'quitely' to 'quietly'.
| .addOption(new Option('-feed, --feed-name <FEED_NAME>', chalk.whiteBright('the feed name')) ) | ||
| .addOption(new Option('-port, --manage-port [PORT]', chalk.whiteBright('the port for the manager')) .argParser(parseManagePort) .default(0)) | ||
| // AI enhancement options | ||
| .addOption(new Option('-ai, --ai-enhance [BOOLEAN]', chalk.whiteBright('use AI to intelligently enhance field mappings')) .argParser(parseBoolean) .default(false) .hideHelp(advanced)) |
There was a problem hiding this comment.
Corrected spelling of 'quitely' to 'quietly'.
| feedName = options.feedName; | ||
| fileName = options.fileName; | ||
| } | ||
| feed.name = feedName; |
There was a problem hiding this comment.
The feed.name assignment appears to be set conditionally based on whether options came from CLI. This creates inconsistent state where feed.name may not be set if options come from other sources. Consider ensuring feed.name is always synchronized with feedName regardless of option source.
| feed.lastUpdated = new Date().toISOString(); | ||
| updateAndLoadFeedInfo(feed); | ||
| createFeed(fileName, feedName, feed, data, rules, schemas, sessionPropertiesJson, options.useDefaults ? true : false); |
There was a problem hiding this comment.
Setting feed.lastUpdated after calling createFeed may not have the intended effect, as the feed object has already been passed to createFeed. Consider moving this assignment before the createFeed call to ensure the timestamp is included.
Latest version of working STM CLI which includes minor fixes to STM CLI and the new AI Mapper functionality