Commit Graph

8 Commits

Author SHA1 Message Date
aesoft 9cc4937dac fix(security): harden installer checksum, filter-trust, meta-command fallthrough 2026-06-12 14:01:04 +02:00
Nicolas Le Cam c59a76375a review: cleanup code, comments and uneeded undocumented RTK_CLAUDE_DIR now that we have CLAUDE_CONFIG_DIR 2026-06-09 21:51:23 +02:00
Christian C. Berclaz 9671d9ea7e refactor(init): address review feedback on CLAUDE_CONFIG_DIR PR
- restore migration Outdated check in hook_check (binary registered +
  legacy script present still reports Outdated until cleanup)
- add error context to resolve_claude_dir call sites (provider, integrity)
- use CLAUDE_DIR const instead of literal in telemetry + provider test
- simplify settings_path construction in print_manual_instructions

Refs #2087
2026-06-09 21:51:23 +02:00
Christian C. Berclaz 05de9d366a fix(init): respect CLAUDE_CONFIG_DIR for global paths
rtk init -g ignored CLAUDE_CONFIG_DIR and always targeted ~/.claude.
Honor the env var Claude Code uses to relocate its config directory.

Priority: RTK_CLAUDE_DIR > CLAUDE_CONFIG_DIR > $HOME/.claude.
Empty values are treated as unset. Manual-step instructions now
print the resolved path instead of a hardcoded ~/.claude.

All callsites that previously hardcoded home.join(CLAUDE_DIR) now use
the shared resolve_claude_dir(): hook_check (rtk gain), integrity
(rtk verify), telemetry, and discover (rtk discover).

Closes #633
2026-06-09 21:51:23 +02:00
hed0rah 21a069ad76 feat(init): add --dry-run flag to preview changes without writing
Rebased onto current develop (binary-command era). Threads dry_run
through patch_settings_json_command, migrate_old_hook_script,
install_cursor_hooks, run_kilocode_mode, run_antigravity_mode,
run_gemini, run_copilot, and uninstall.

Fixes from PR #1032 review:
- --uninstall --dry-run no longer deletes files (uninstall() now takes
  dry_run, every fs::remove_file / fs::write / atomic_write guarded)
- Success messages ("installed", "configured", "Restart ...") gated on
  !dry_run in run_default_mode, run_hook_only_mode, run_codex_mode,
  run_copilot, install_cursor_hooks, run_gemini
- prompt_telemetry_consent() skipped in dry-run
- integrity::store_hash() in run_gemini guarded
- KiloCode and Antigravity modes now accept dry_run
- PatchResult::WouldPatch variant added for patch_settings_json_command
- [dry-run] Nothing written. footer printed by every sub-mode
- write_if_changed uses atomic_write (not fs::write)

Added integrity::hash_path_for() public wrapper so dry-run can check
sidecar existence without the destructive remove_hash.

Tests: write_if_changed(dry_run=true) creates nothing;
run_codex_mode_with_paths(dry_run=true) creates neither RTK.md nor
AGENTS.md. 1596 tests pass, clippy clean.
2026-04-19 01:07:28 -04:00
aesoft 22892f0243 feat(hooks): native hook handlers, remove bash scripts
What changed:
  - Add `run_claude()` with permissions check, audit logging, tool_input
    preservation, and Ask/Allow/Deny support
  - Add `run_cursor()` with flat JSON format (`permission`/`updated_input`)
  - Add `audit_log()` (best-effort append when RTK_HOOK_AUDIT=1)
  - Fix `run_gemini()` to load exclude_commands from config
  - Convert all hook stdout to `writeln!` with `#[deny(clippy::print_stdout)]`
    to prevent JSON protocol corruption (Claude Code bug #4669)
  - Replace string-based heredoc detection with lexer-based `has_heredoc()`
    (quote-aware: `<<` inside quotes no longer false-positives)
  - Add shell prefix peeling (noglob, command, builtin, exec, nocorrect)
    to `rewrite_segment()` in registry.rs
  - Fix python3 -m pytest pattern, add pip show, add gt (Graphite) to RULES
  - Remove `command ` from IGNORED_PREFIXES (was blocking `command git status`)
  - Register `rtk hook claude`/`rtk hook cursor` binary commands in
    settings.json instead of writing bash script files
  - Add legacy script migration (deletes old rtk-rewrite.sh on `rtk init`)
  - Simplify hook_check and integrity for script-free model
2026-04-04 18:45:30 +02:00
aesoft aabc0167bc fix(cleaning): constant extract 2026-03-30 17:57:57 +02:00
aesoft 46fa31c4b8 chore(refacto-codebase): Folders + Technical docs
- codebase more clear for humans and AI agents
- alignement on vision and filter quality in technical docs
2026-03-24 22:14:35 +01:00