Skip to content

feat: add cwd-aware auto_suggestions option#55

Merged
eitsupi merged 5 commits intomainfrom
feat/cwd-aware-suggestions
Feb 5, 2026
Merged

feat: add cwd-aware auto_suggestions option#55
eitsupi merged 5 commits intomainfrom
feat/cwd-aware-suggestions

Conversation

@eitsupi
Copy link
Copy Markdown
Owner

@eitsupi eitsupi commented Feb 5, 2026

Summary

  • Change auto_suggestions from bool to enum with three modes:
    • "none": Disable suggestions
    • "all": Show suggestions from all history (default)
    • "cwd": Show suggestions only from current directory history
  • Backward compatibility preserved (true"all", false"none")
  • JSON Schema updated to accept both boolean and string values

Details

The "cwd" mode filters history-based suggestions to show only entries recorded in the current working directory, falling back to all history if no matches found. This is similar to fish shell's directory-aware completions.

Config example

[editor]
auto_suggestions = "cwd"  # or "all", "none", true, false

Note

Shell mode (#! prefix) always searches all history regardless of this setting.

Test plan

  • All existing tests pass
  • New tests for AutoSuggestions parsing (string and boolean values)
  • Test for invalid string value error handling
  • Schema and snapshot tests updated

🤖 Generated with Claude Code

eitsupi and others added 3 commits February 5, 2026 14:29
Change auto_suggestions from bool to enum with three modes:
- "none": Disable suggestions
- "all": Show suggestions from all history (default, backward compatible)
- "cwd": Show suggestions only from current directory history

The cwd mode filters history entries by the directory where they were
recorded, falling back to all history if no matches found. This is
similar to fish shell's directory-aware completions.

Backward compatibility is preserved:
- true → "all"
- false → "none"

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Extract create_r_hinter() helper to eliminate code duplication
- Add documentation for shell mode cwd limitation
- Add test for invalid auto_suggestions string values
- Update JSON schema to accept both boolean and string values

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a cwd-aware mode to the auto-suggestions feature, changing it from a boolean to an enum with three modes: "none" (disable), "all" (show all history), and "cwd" (show only current directory history). The implementation maintains backward compatibility by accepting boolean values in configuration, with a comprehensive JSON schema that supports both formats.

Changes:

  • Introduces AutoSuggestions enum with three variants replacing the previous boolean field
  • Implements custom serialization/deserialization to accept both boolean and string values for backward compatibility
  • Refactors RLanguageHinter to support cwd-aware filtering with fallback to all history
  • Updates JSON schema, documentation, tests, and snapshots to reflect the new configuration option

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/arf-console/src/config/editor.rs Adds AutoSuggestions enum with custom serde implementation and JSON schema
crates/arf-console/src/editor/hinter.rs Refactors RLanguageHinter to support cwd-aware filtering
crates/arf-console/src/repl/mod.rs Updates REPL to create appropriate hinter based on config
crates/arf-console/src/config/mod.rs Adds comprehensive tests for new enum parsing
docs/configuration.md Documents the new auto-suggestions modes with examples
crates/arf-console/src/config/snapshots/* Updates snapshots for schema and default config
artifacts/arf.schema.json Updates JSON schema with new enum definition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

eitsupi and others added 2 commits February 5, 2026 14:59
Address Copilot review: remove "true"/"false" string aliases from
AutoSuggestions deserialization. Boolean values are already handled
by visit_bool, so string aliases are unnecessary and potentially confusing.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update documentation to clearly separate boolean values (true/false) from
string values ("none", "all", "cwd"). Add tests to verify that string
"true"/"false" are rejected (users should use boolean values instead).

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@eitsupi eitsupi merged commit df0251a into main Feb 5, 2026
@eitsupi eitsupi deleted the feat/cwd-aware-suggestions branch February 5, 2026 15:26
@eitsupi eitsupi mentioned this pull request Feb 5, 2026
3 tasks
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.

2 participants