refactor: use module-root deltas - #3
Merged
Merged
Conversation
…ion-based snapshots
…ndexing Remove legacy project-based tables and CLI commands, migrating to module-root storage with immutable delta snapshots. The new model tracks Go module paths as roots, registers checkout locations, and publishes immutable snapshots with optional base references. Source revisions store AST projections as JSON; deltas record set or delete operations per snapshot. Snapshot heads are published atomically with version-checked updates. Query expressions now use --root (module path), --location (checkout), and --snapshot (historical ID) instead of project keys. The browser lists roots and their checkouts with effective source views. Opening an older database discards legacy tables; back up first if history is needed. BREAKING CHANGE: The uir project ... CLI, project GORM tables, and project browser API are removed. Use uir add [path], uir reindex [path], and uir query instead. Database schema changes from project-centric to module-root-centric with source deltas. Existing project snapshots are not imported.
…e shutdown handling
…ed database config Add structured query flags for fine-grained symbol selection, implement reindex --all for unindexed registrations, support environment variables for database configuration, and enhance query result rendering with declaration code and usage lines. Additions: - Structured query options (--methods, --vars, --types, --modules, --packages, --callers, --calls, --implements, --inherits, --include, --exclude, --group-by) enable building queries without positional expressions - reindex --all reindexes only registered checkouts lacking indexed heads - UIR_DSN and UIR_SCHEMA environment variables provide database defaults - Query results now populate declaration code, definition line numbers, and usage context from source - Missing-head warnings alert users when query scope is incomplete - New history show subcommand displays a commit's logical changes - Query rendering displays symbol trees with code snippets, respecting grouping preferences Breaking change: query expression argument is now optional when structured flags are provided; query without both fails with clear error.
…ce relation support
…snapshots
Snapshots now capture each go.mod requirement, its declared/selected version, and the linked target snapshot, resolving local workspace modules, directory replacements, and versioned tags or pseudo-versions from registered checkouts.
Dirty worktrees record `git-{commit}-dirty-{latest UTC mtime}` as the revision and keep the raw SHA in a new git_commit column, so a linked local dependency changing no longer collides with the parent's clean commit. Source bytes for dirty and non-Git snapshots are stored in source_blobs and served hash-verified, so later local edits cannot change what a snapshot shows.
Historical commits resolve modules standalone, ignoring current workspaces and local replacements, and fall back to syntax coverage with dependency diagnostics when package loading fails. Unchanged-snapshot reuse now also requires the dependency set hash and re-verified indexing inputs.
BREAKING CHANGE: dirty Git-backed snapshots use a new revision format (`git-{commit}-dirty-{mtime}`) instead of the raw commit, and pre-existing snapshots report dependencies as not captured until reindexed.
…ule dependencies route Adds refactor-preview/refactor-apply module routes that shell out to gopatch from the explorer, plus a dependencies route exposing declared requirements and linked snapshots. Preview returns a diff and hash; apply refuses unless the hash matches so a changed workspace or input cannot silently apply a stale edit, and it reindexes affected registered checkouts afterwards. Refactor routes require a current, fully indexed local checkout and are limited to loopback same-origin requests to avoid remote code modification. The UIR DSN is passed to gopatch so current indexed references across the module and its consumers are checked, with relative SQLite paths resolved before gopatch changes directory. Also resolve snapshots by git_commit in symboldiff selection and drop the deprecated strings.Title call.
Surface module dependency edges for the selected immutable snapshot so users can navigate to resolved targets or see why an edge is unresolved. Add guarded rename/move actions that always preview the gopatch diff, apply it against the exact previewed hash, and refresh the explorer with the resulting snapshot. Introduce API clients and types for dependencies and refactor preview/apply, and cover them with tests.
… linting Claude-Session-Id: 01a0f1ee-f195-7960-81ef-60837de2c356
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
uir projectCLI commands, GORM tables, and project browser API.uir add,uir reindex, anduir querycommands using module paths and delta snapshots.Notes