feat: self-describing syntax feature registry for LLM-friendly help discovery#252
feat: self-describing syntax feature registry for LLM-friendly help discovery#252
Conversation
AI Code ReviewApprove This PR replaces the fragmented help system with a structured, LLM-friendly syntax registry while maintaining backward compatibility through topic aliases. Key strengths include eliminating duplication, adding JSON output for machine consumption, enabling drill-down topic navigation, and sharing aliases between CLI and REPL. The implementation follows the project's architectural patterns and updates the help system comprehensively. Moderate concerns about test coverage visibility and full-stack verification are mitigated by:
The new HELP MDL command appropriately follows documentation/querying patterns (similar to SHOW) and reads as English. Code quality improvements from removing redundant help files outweigh minor help text phrasing issues. Recommend approval with standard verification of test additions and pipeline completion. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
…y help discovery Current help system is flat (26 monolithic .txt topics) with no drill-down, no structured output, and no way for LLMs to bridge from business concepts to MDL syntax. Proposes a SyntaxFeature registry where each syntax construct self-registers with metadata (path, summary, keywords, example), enabling: - `mxcli syntax --json` for one-shot LLM discovery - Hierarchical drill-down (workflow → user-task → targeting) - Single-file changes when adding new features
Registry core with workflow (12) and security (8) features registered, --json output, hierarchical drill-down, legacy .txt fallback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
95 features registered across 7 domain files: domain-model (18), microflow (13), page/snippet/fragment (16), navigation/settings/misc (12), integration/odata/rest/sql/xpath (20), workflow (12), security (8). Legacy topic aliases map old names to new registry paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HELP WORKFLOW; HELP WORKFLOW USER TASK; HELP SECURITY ENTITY ACCESS; all now query the syntax feature registry. Greedy path resolver merges space-separated words into hyphenated registry paths. Grammar extended: helpStatement accepts optional identifierOrKeyword*. AST HelpStmt gains Topic []string field. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Delete 25 .txt files, embedded FS, switch statement, showKeywords/ showTypes/showDeleteBehaviors functions, and reservedKeywords/ attributeTypes/deleteBehaviors data. All topics now served from the syntax feature registry with full alias map for backward compat. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…help topic - Move topicAliases to syntax package so HELP <topic> works in REPL (was broken: HELP entity returned "No syntax help found") - Add duplicate path detection in Register() (panic on duplicate) - Register missing 'test' help topic (replaced deleted test.txt) - Fix capitalize() for UTF-8 safety - Add unit tests for resolveHelpPath and ResolveAlias - Add TestAliasTargetsExist to verify all aliases point to valid paths - Add doctype-test for HELP command Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42ab5db to
8f7533b
Compare
AI Code ReviewCritical Issues
Moderate Issues
Minor Issues
What Looks Good
RecommendationRequest changes to add unit tests for the new
Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
Summary
cmd/mxcli/syntax/package with aSyntaxFeatureregistry covering ~80 feature paths across domain-model, microflow, page, security, workflow, integration, navigation, settings, and mischelp_topics/*.txtfiles with structured registry entries — each feature hasPath,Summary,Keywords,Syntax,Example, andSeeAlsomxcli syntax [topic...]command with--jsonoutput for LLM-friendly one-shot discoveryHELP [topic words...]MDL command with registry-backed topic lookup from the REPLentity→domain-model.entity) shared between CLI and REPL viasyntax.ResolveAlias()Conflict resolution notes
make grammarat each conflictexecutor_dispatch.go: kept HEAD's registry-based dispatch (replaced PR's switch statement)cmd_misc.go: merged PR's topic-handling into HEAD'sctx *ExecContextpattern;execHelp(ctx, s)now accepts statementregister_stubs.go: updatedHelpStmtregistration to pass statement toexecHelphelp.goPhase 4/5:topicAliasesmoved tosyntax.ResolveAlias()in registry; added agents aliases to bothagents/agents.model/agents.knowledge-base/agents.mcp-service/agents.agentregistry entries for AI agent documents (fromhelp_topics/agents.txtwhich was added to main after the PR was created)Closes #172
Test plan
make build && make testpassmxcli syntax --jsonoutputs full registrymxcli syntax workflow user-task targetingdrills down correctlymxcli syntax agentsshows AI agent syntaxHELP workflow user task;in REPL returns registry entrymxcli syntax entityresolves alias →domain-model.entity🤖 Generated with Claude Code