Skip to content

Conversation

@samestrin
Copy link
Owner

Summary

Enhances the yaml command family with 5 new features:

  • Array bracket notation: Access array elements like items[0].name, with negative index support (items[-1])
  • Stdin input: Pipe values using - as the value argument
  • Dry-run flag: Preview changes without writing with --dry-run
  • Quiet flag: Suppress success messages with --quiet
  • Required keys file: Load validation keys from file with --required-file

Changes

yaml-set / yaml-multiset

  • Added --dry-run flag to preview changes without writing
  • Added --quiet flag to suppress success output (errors still shown)
  • Extended path parsing to support bracket notation

yaml-get / yaml-multiget

  • Extended path parsing to support bracket notation
  • Added --required-file flag to load keys from a file
  • Supports # comments in required keys files

MCP Tools

  • Updated yaml_set, yaml_multiset, yaml_multiget with new parameters
  • Updated descriptions to mention bracket notation support

Test Plan

  • All new features have unit tests
  • All existing tests pass (no regressions)
  • Coverage: 79.4%
  • Manual verification of each feature
  • MCP tests pass

Files Changed

  • internal/support/commands/yaml.go (+156 lines)
  • internal/support/commands/yaml_helpers.go (+439 lines)
  • internal/support/commands/yaml_test.go (+1119 lines)
  • internal/support/mcpserver/handlers.go (+25 lines)
  • internal/support/mcpserver/tools.go (+30 lines)
  • internal/support/mcpserver/tools_test.go (updated required fields)

Adds --dry-run flag to yaml-set and yaml-multiset commands that shows
a preview of changes without actually modifying the YAML file. Supports
--json and --min output modes for scripting.
Adds --quiet flag to yaml-set and yaml-multiset commands that suppresses
success messages while still returning errors. Useful for scripting
where only errors should be visible. Dry-run output is NOT suppressed
by quiet mode since it's informational, not a success message.
Adds --required-file flag to yaml-multiget command that loads required
keys from a file. Supports # comments (line and inline), empty lines,
and whitespace trimming. Keys from file are combined with positional
arguments and deduplicated while preserving order.
Updates MCP tool definitions and handlers for yaml_set, yaml_multiget,
and yaml_multiset:

- yaml_set: adds dry_run, quiet parameters
- yaml_multiget: adds required_file parameter, keys no longer required
- yaml_multiset: adds dry_run, quiet parameters
- All: updated descriptions to mention bracket notation support
Security hardening:
- Add path traversal protection to parseRequiredKeysFile (symlink rejection)
- Add 10MB stdin size limit to prevent memory exhaustion
- Add UTF-8 validation to reject binary data

Edge case fixes:
- Increase scanner buffer to 256KB for long YAML keys
- Handle Windows line endings (\r\n) in stdin
- Add read lock to dry-run mode to prevent race conditions

Test coverage:
- Add tests for yaml-set dry_run/quiet parameters
- Add tests for yaml-multiset dry_run/quiet parameters
- Add test for yaml-multiget required_file parameter

Maintainability:
- Replace magic number -999 with invalidArrayIndex constant
Database directory changes:
- Change default index directory from .llm-index to .index
- Make FTS database project-local at .index/qdrant_fts.db
- Remove global ~/.llm-semantic/ fallback for FTS

Memory stats tracking:
- Add memory_stats and retrieval_log tables to schema
- Add RetrievalStats, MemoryRetrieval, RetrievalLogEntry types
- Add MemoryStatsTracker interface for optional stats support
- Implement tracking in SQLiteStorage and LexicalIndex
- Auto-track retrievals in memory search (non-blocking)
- Add stats methods: Track, GetStats, GetHistory, Prune, UpdateStatus

New directory structure:
  {gitRoot}/.index/
  ├── semantic.db      # Main index (embeddings, chunks)
  └── qdrant_fts.db    # FTS index (project-local)
@samestrin samestrin merged commit 5e6a955 into main Jan 17, 2026
8 checks passed
@samestrin samestrin deleted the sprint/9.0_yaml_enhancements branch January 17, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant