Skip to content

v1.0-refactor#1

Closed
galligan wants to merge 21 commits into
mainfrom
gt/v1.0/rewrite
Closed

v1.0-refactor#1
galligan wants to merge 21 commits into
mainfrom
gt/v1.0/rewrite

Conversation

@galligan

@galligan galligan commented Oct 4, 2025

Copy link
Copy Markdown
Contributor

v1.0-refactor

chore: fix waymark formatting

chore: checkpoint

feat(cli): complete Phase 3 query parsing with fuzzy matching and exclusions

  • Created modular query-parser.ts with tokenization and parsing
  • Fuzzy type matching (todos→todo, fixme→fix)
  • Property search syntax (owner:@alice, depends:)
  • Exclusion syntax (!@alice, !todo, !#perf)
  • File path detection heuristic for automatic query vs file distinction
  • 20 parser unit tests + 7 integration tests
  • All 68 tests passing (33 original + 8 Phase 4 + 7 Phase 3 integration + 20 Phase 3 unit)
  • Updated documentation in phase-3-query-parsing.md and IMPROVEMENTS.md

Boolean operators (AND, OR, NOT) deferred to future work - current implementation sufficient for v1.0

feat(cli): add pino logger and enhanced ignore system with config-based filtering

Logger Integration:

  • Add pino logger with sensible CLI defaults (warn level)
  • Add CLI flags: --verbose (info), --debug (debug), --quiet (error)
  • Configure via preAction hook for dynamic level control
  • Add comprehensive tests for logger utility (9 unit + 3 integration)
  • Pretty format in development, JSON in production
  • Support LOG_LEVEL environment variable

Enhanced Ignore System:

  • Add .waymark/config.jsonc with skipPaths configuration
  • Move ignore patterns from .waymark/ignore.jsonc to config
  • Support include/exclude patterns with proper glob matching
  • Improve directory traversal with configurable filtering
  • Remove debug logging from compiled output

Testing:

  • Add 12 new tests (9 logger unit tests, 3 integration tests)
  • All 155 tests passing (up from 143)
  • Logger utility has 100% line coverage

Bug Fixes:

  • Remove leftover debug console.log statements from compiled output
  • Fix TypeScript strict mode compatibility with pino transport options
  • Fix lint errors: magic numbers, non-null assertions, for-in guards
  • Rebuild CLI to ensure clean dist output

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

chore: apply pre-commit formatting and regenerate map

  • Format config.ts and index.test.ts per Biome rules
  • Regenerate waymark map after recent changes

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

chore: regenerate waymark map

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

chore: final waymark map after hook regeneration

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

feat(cli): add enhanced ripgrep-style output formatter with chalk styling

Implemented comprehensive enhanced output formatter per CLI_READOUT.md requirements:

New Features:

  • Ripgrep-style output with file grouping and aligned line numbers
  • Comment marker stripping (enabled by default, disable with --keep-comment-markers)
  • Chalk-based styling system:
    • Type-specific colors based on waymark categories
    • Signal styling (bold + underline for ^ and *)
    • Mention styling (@user: bold yellow, @scope/pkg: bold cyan)
    • Tag styling (#tag: bold cyan)
    • Dim styling for line numbers, sigils, and properties
  • Multi-line waymark support with aligned ::: continuations
  • Compact output mode (--compact flag)

Implementation Details:

  • Created modular formatter architecture:
    • styles.ts: Chalk styling utilities with type category mapping
    • strip-markers.ts: Comment marker removal for all comment styles
    • enhanced.ts: Core ripgrep-style formatter with helper functions
  • Reduced cognitive complexity via function extraction
  • All regex patterns moved to module-level constants for performance
  • Updated display options and unified command to support new flags

Testing:

  • All 85 tests passing
  • Updated test expectations for enhanced output format
  • Verified ripgrep-style file headers work correctly

Quality:

  • Zero Biome lint errors
  • Properly formatted with Ultracite
  • Follows existing architecture patterns

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

feat(cli): implement intelligent ::: sigil alignment per CLI_READOUT.md review

Implemented advanced alignment algorithm ensuring all ::: sigils align at the same column within each file:

Algorithm:

  1. Calculate longest type length (including signals) per file
  2. Determine target ::: column: lineWidth + 1 + 2 + longestTypeLength + 1
  3. For waymarks: pad based on type length difference
  4. For continuations: pad to reach exact ::: column
  5. For property lines: maintain same alignment as continuations

Key Features:

  • All ::: sigils align perfectly within each file group
  • Signals (^ and *) naturally outdent by adding to type length
  • Line number padding adjusts for max line in file (1-3 digits)
  • Multi-line waymarks maintain visual alignment
  • Property continuations align with ::: position

Example Output:

49:   todo ::: implement authentication
50:        ::: continuation content
72:  *todo ::: finish before merging
88:   todo ::: implement OAuth

Implementation:

  • Added getLongestTypeLength() to find max type length per file
  • Added getTypeWithSignal() helper for consistent signal handling
  • Updated all formatting functions to accept longestTypeLength parameter
  • Calculated padding: baseIndent (always 2) + (longest - current)
  • Continuation padding: sigilColumn - lineWidth - 1

Testing:

  • All 85 tests passing
  • Manual testing verified alignment with various scenarios:
    • Different line widths (1, 2, 3 digits)
    • Mixed signals (*, ^)
    • Multi-line waymarks with continuations
    • Property lines

Documentation:

  • Added language specifiers to CLI_READOUT.md code blocks
  • Updated to reflect review requirements

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

feat(cli): fix output styling and compact mode issues

  • Code block masking: Prevent property styling inside code structures like ({...})
    by masking balanced braces/parentheses/brackets before applying property regex

  • Blessed marker priority: Fix 'needs :::' being treated as continuation instead
    of new waymark by checking blessed markers before property keys

  • Property-as-marker styling: Style property prefixes (ref, owner, since)
    consistently with type prefixes in multi-line waymarks

  • Minimum line width: Ensure single-digit line numbers always have leading
    space ( 1: instead of 1:) for better alignment

  • No-color flag: Add full --no-color flag support to disable colored output
    while maintaining compact mode styling

  • Compact mode fixes:

    • Add compact/keepCommentMarkers/noColor to BOOLEAN_OPTION_FLAGS
    • Fix buildOptions() to always pass boolean flags (not just when truthy)
    • Simplify formatCompactRecord() to use parsed contentText and collapse
      multi-line waymarks to single lines
  • Remove debug logging from unified command and display modules

  • Extract regex to module level to fix linter warning

  • Reduce handleModeDisplayFlags complexity by extracting formatting flags

All 155 tests passing.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

feat(cli): clean JSON output by removing empty fields

  • Added cleanRecord() function to strip empty arrays, objects, and all-false signals
  • Reduces JSON output size by ~42% for typical waymarks
  • Improves JSON/JSONL/pretty output readability
  • All 155 tests passing

docs: update scratchpad with JSON output optimization work

Also includes:

  • Regenerated waymark map
  • Linter fix: use undefined assignment instead of delete for optional properties

feat(config): standardize on TOML format and .waymark/ directory

  • Removed support for .json config files (only .toml, .jsonc, .yaml, .yml)
  • Prioritize .toml as the preferred config format
  • Keep .waymark/ as project directory for config, cache, and rules
  • Removed .waymarkrc.* support in favor of .waymark/config.*
  • Updated config loader to check formats in order: .toml, .jsonc, .yaml, .yml
  • Migrated repo config from .waymark/config.jsonc to .waymark/config.toml
  • Updated tests to use .toml format
  • All 155 tests passing

chore: remove generated map.md file and related hooks

  • Removed .waymark/map.md (run wm --map for fresh results instead)
  • Removed waymark-map from lefthook pre-commit and pre-push hooks
  • Removed check:waymarks from check:all script (kept script for manual use)
  • Updated AGENTS.md to remove map.md references and waymark map routine
  • Updated PRD.md to reflect TOML precedence and remove map.md
  • Scripts still available via 'bun run waymark:map' if needed

docs: update scratchpad with config standardization and map.md removal

feat(cli): add pino logger and interactive prompts for wm init

  • Added pino and pino-pretty dependencies for structured logging

    • Created logger utility with pretty-print formatting
    • Configured logger level to default to 'warn' for clean CLI output
    • Updated logger with simplified message format for CLI tools
  • Implemented interactive prompts for wm init when no flags provided

    • Uses inquirer to prompt for format, preset, and scope
    • Falls back to flags when any option is provided
    • Maintains backward compatibility with flag-based usage
  • Fixed global→user scope rename in MCP package

    • Updated types.ts, resources/map.ts, resources/todos.ts
  • Fixed TypeScript exactOptionalPropertyTypes error in output.ts

    • Changed from assigning undefined to using delete for optional properties

All 155 tests passing, build successful.

docs: update SCRATCHPAD with pino logger and interactive init work

docs: update PRD and PLAN for user scope rename and init command

  • Updated PRD.md:

    • Changed 'global' scope to 'user' for clarity
    • Updated default scope from 'user' to 'project' (more common use case)
    • Added wm init command documentation with interactive and flag modes
    • Updated config discovery order (removed .waymarkrc.yaml reference)
    • Changed 'global equivalents' to 'user-scoped equivalents'
  • Updated PLAN.md:

    • Changed project/global/default to project/user/default in decisions log
    • Added decision log entries for scope rename and init command implementation

All documentation now consistently uses 'user' instead of 'global' for
user-scoped configuration stored in ~/.config/waymark/

chore: checkpoint current rewrite state

feat(cli): implement insert, remove, and update commands with ID management

Add comprehensive waymark manipulation commands:

  • wm insert: Add waymarks with optional ID reservation
  • wm remove: Remove waymarks by line number, ID, or criteria
  • wm update: Update existing waymark content

Core features:

  • JSON-based ID index (.waymark/index.json, .waymark/history.json)
  • Fingerprinting system for waymark tracking without IDs
  • Interactive preview/confirm flows for remove operations
  • Multi-line waymark support across all commands
  • Flexible input modes (inline, JSON, JSONL)
  • Multiple output formats (text, JSON, JSONL)

Testing:

  • 124 insert command tests
  • 174 remove command tests
  • 57 update command tests
  • Comprehensive core module coverage

Documentation:

  • Updated PRD with index architecture
  • Added grammar README explaining parser design
  • Added CHANGELOG for prerelease tracking
  • Updated PLAN with Phase 3a completion notes

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

galligan and others added 21 commits September 26, 2025 16:32
…lusions

- Created modular query-parser.ts with tokenization and parsing
- Fuzzy type matching (todos→todo, fixme→fix)
- Property search syntax (owner:@alice, depends:)
- Exclusion syntax (!@alice, !todo, !#perf)
- File path detection heuristic for automatic query vs file distinction
- 20 parser unit tests + 7 integration tests
- All 68 tests passing (33 original + 8 Phase 4 + 7 Phase 3 integration + 20 Phase 3 unit)
- Updated documentation in phase-3-query-parsing.md and IMPROVEMENTS.md

Boolean operators (AND, OR, NOT) deferred to future work - current implementation sufficient for v1.0
…ed filtering

**Logger Integration:**
- Add pino logger with sensible CLI defaults (warn level)
- Add CLI flags: --verbose (info), --debug (debug), --quiet (error)
- Configure via preAction hook for dynamic level control
- Add comprehensive tests for logger utility (9 unit + 3 integration)
- Pretty format in development, JSON in production
- Support LOG_LEVEL environment variable

**Enhanced Ignore System:**
- Add .waymark/config.jsonc with skipPaths configuration
- Move ignore patterns from .waymark/ignore.jsonc to config
- Support include/exclude patterns with proper glob matching
- Improve directory traversal with configurable filtering
- Remove debug logging from compiled output

**Testing:**
- Add 12 new tests (9 logger unit tests, 3 integration tests)
- All 155 tests passing (up from 143)
- Logger utility has 100% line coverage

**Bug Fixes:**
- Remove leftover debug console.log statements from compiled output
- Fix TypeScript strict mode compatibility with pino transport options
- Fix lint errors: magic numbers, non-null assertions, for-in guards
- Rebuild CLI to ensure clean dist output

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Format config.ts and index.test.ts per Biome rules
- Regenerate waymark map after recent changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ling

Implemented comprehensive enhanced output formatter per CLI_READOUT.md requirements:

**New Features:**
- Ripgrep-style output with file grouping and aligned line numbers
- Comment marker stripping (enabled by default, disable with --keep-comment-markers)
- Chalk-based styling system:
  - Type-specific colors based on waymark categories
  - Signal styling (bold + underline for ^ and *)
  - Mention styling (@user: bold yellow, @scope/pkg: bold cyan)
  - Tag styling (#tag: bold cyan)
  - Dim styling for line numbers, sigils, and properties
- Multi-line waymark support with aligned ::: continuations
- Compact output mode (--compact flag)

**Implementation Details:**
- Created modular formatter architecture:
  - styles.ts: Chalk styling utilities with type category mapping
  - strip-markers.ts: Comment marker removal for all comment styles
  - enhanced.ts: Core ripgrep-style formatter with helper functions
- Reduced cognitive complexity via function extraction
- All regex patterns moved to module-level constants for performance
- Updated display options and unified command to support new flags

**Testing:**
- All 85 tests passing
- Updated test expectations for enhanced output format
- Verified ripgrep-style file headers work correctly

**Quality:**
- Zero Biome lint errors
- Properly formatted with Ultracite
- Follows existing architecture patterns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…md review

Implemented advanced alignment algorithm ensuring all ::: sigils align at the same column within each file:

**Algorithm:**
1. Calculate longest type length (including signals) per file
2. Determine target ::: column: `lineWidth + 1 + 2 + longestTypeLength + 1`
3. For waymarks: pad based on type length difference
4. For continuations: pad to reach exact ::: column
5. For property lines: maintain same alignment as continuations

**Key Features:**
- All ::: sigils align perfectly within each file group
- Signals (^ and *) naturally outdent by adding to type length
- Line number padding adjusts for max line in file (1-3 digits)
- Multi-line waymarks maintain visual alignment
- Property continuations align with ::: position

**Example Output:**
```
49:   todo ::: implement authentication
50:        ::: continuation content
72:  *todo ::: finish before merging
88:   todo ::: implement OAuth
```

**Implementation:**
- Added getLongestTypeLength() to find max type length per file
- Added getTypeWithSignal() helper for consistent signal handling
- Updated all formatting functions to accept longestTypeLength parameter
- Calculated padding: baseIndent (always 2) + (longest - current)
- Continuation padding: sigilColumn - lineWidth - 1

**Testing:**
- All 85 tests passing
- Manual testing verified alignment with various scenarios:
  - Different line widths (1, 2, 3 digits)
  - Mixed signals (*, ^)
  - Multi-line waymarks with continuations
  - Property lines

**Documentation:**
- Added language specifiers to CLI_READOUT.md code blocks
- Updated to reflect review requirements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Code block masking: Prevent property styling inside code structures like ({...})
  by masking balanced braces/parentheses/brackets before applying property regex

- Blessed marker priority: Fix 'needs :::' being treated as continuation instead
  of new waymark by checking blessed markers before property keys

- Property-as-marker styling: Style property prefixes (ref, owner, since)
  consistently with type prefixes in multi-line waymarks

- Minimum line width: Ensure single-digit line numbers always have leading
  space (` 1:` instead of `1:`) for better alignment

- No-color flag: Add full --no-color flag support to disable colored output
  while maintaining compact mode styling

- Compact mode fixes:
  - Add compact/keepCommentMarkers/noColor to BOOLEAN_OPTION_FLAGS
  - Fix buildOptions() to always pass boolean flags (not just when truthy)
  - Simplify formatCompactRecord() to use parsed contentText and collapse
    multi-line waymarks to single lines

- Remove debug logging from unified command and display modules
- Extract regex to module level to fix linter warning
- Reduce handleModeDisplayFlags complexity by extracting formatting flags

All 155 tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added cleanRecord() function to strip empty arrays, objects, and all-false signals
- Reduces JSON output size by ~42% for typical waymarks
- Improves JSON/JSONL/pretty output readability
- All 155 tests passing
Also includes:
- Regenerated waymark map
- Linter fix: use undefined assignment instead of delete for optional properties
- Removed support for .json config files (only .toml, .jsonc, .yaml, .yml)
- Prioritize .toml as the preferred config format
- Keep .waymark/ as project directory for config, cache, and rules
- Removed .waymarkrc.* support in favor of .waymark/config.*
- Updated config loader to check formats in order: .toml, .jsonc, .yaml, .yml
- Migrated repo config from .waymark/config.jsonc to .waymark/config.toml
- Updated tests to use .toml format
- All 155 tests passing
- Removed .waymark/map.md (run wm --map for fresh results instead)
- Removed waymark-map from lefthook pre-commit and pre-push hooks
- Removed check:waymarks from check:all script (kept script for manual use)
- Updated AGENTS.md to remove map.md references and waymark map routine
- Updated PRD.md to reflect TOML precedence and remove map.md
- Scripts still available via 'bun run waymark:map' if needed
- Added pino and pino-pretty dependencies for structured logging
  - Created logger utility with pretty-print formatting
  - Configured logger level to default to 'warn' for clean CLI output
  - Updated logger with simplified message format for CLI tools

- Implemented interactive prompts for wm init when no flags provided
  - Uses inquirer to prompt for format, preset, and scope
  - Falls back to flags when any option is provided
  - Maintains backward compatibility with flag-based usage

- Fixed global→user scope rename in MCP package
  - Updated types.ts, resources/map.ts, resources/todos.ts

- Fixed TypeScript exactOptionalPropertyTypes error in output.ts
  - Changed from assigning undefined to using delete for optional properties

All 155 tests passing, build successful.
- Updated PRD.md:
  - Changed 'global' scope to 'user' for clarity
  - Updated default scope from 'user' to 'project' (more common use case)
  - Added wm init command documentation with interactive and flag modes
  - Updated config discovery order (removed .waymarkrc.yaml reference)
  - Changed 'global equivalents' to 'user-scoped equivalents'

- Updated PLAN.md:
  - Changed project/global/default to project/user/default in decisions log
  - Added decision log entries for scope rename and init command implementation

All documentation now consistently uses 'user' instead of 'global' for
user-scoped configuration stored in ~/.config/waymark/
…gement

Add comprehensive waymark manipulation commands:
- wm insert: Add waymarks with optional ID reservation
- wm remove: Remove waymarks by line number, ID, or criteria
- wm update: Update existing waymark content

Core features:
- JSON-based ID index (.waymark/index.json, .waymark/history.json)
- Fingerprinting system for waymark tracking without IDs
- Interactive preview/confirm flows for remove operations
- Multi-line waymark support across all commands
- Flexible input modes (inline, JSON, JSONL)
- Multiple output formats (text, JSON, JSONL)

Testing:
- 124 insert command tests
- 174 remove command tests
- 57 update command tests
- Comprehensive core module coverage

Documentation:
- Updated PRD with index architecture
- Added grammar README explaining parser design
- Added CHANGELOG for prerelease tracking
- Updated PLAN with Phase 3a completion notes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

galligan commented Oct 4, 2025

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@coderabbitai

coderabbitai Bot commented Oct 4, 2025

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gt/v1.0/rewrite

Comment @coderabbitai help to get the list of available commands and usage tips.

@galligan

galligan commented Oct 4, 2025

Copy link
Copy Markdown
Contributor Author

Closing per request; continuing work without PR.

@galligan galligan closed this Oct 4, 2025
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