feat: implement cdd scan - #39
Merged
Merged
Conversation
Covers a repository Project seeded from git.LastCommit, a non-repository Project seeded from directory mtime, an already-jumped Project left alone, a second Scan seeding nothing new, and an excluded Project being skipped. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
internal/scan.Run discovers Projects under cfg.Root, honoring
cfg.Exclude and cfg.IncludeHidden, and seeds hist with one Visit per
Project. Evidence time is git.LastCommit when a Project is a
repository with a commit, else the Project directory's mtime,
truncated to UTC second precision to match History's line format.
Git calls are bounded to 8 concurrent workers. Seed's own idempotency
rule decides whether a Visit is actually appended; Run reports the
result as Summary{Seeded, Projects} for the cli to print.
Closes #19
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Closed
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
Adds
internal/scan.Run(ctx, cfg config.Config, hist *history.History) (Summary, error), per the resolution in #13 and #9.cfg.Rootwithcfg.Excludeandcfg.IncludeHiddenviaproject.Discover.git.LastCommitwhen it is a repository with a commit, else the Project directory's mtime (truncated to UTC second precision to match History's line format, so repeated Scans compare equal).hist.Seed(project.Rel(), evidence)for each Project. Seed's own idempotency rule (never overwriting a newer real Visit) is not re-implemented here.Summary{Seeded, Projects int}so the cli can print "Seeded 12 Visits across 40 Projects".Why
Closes #19. A fresh cdd installation has no History until a Jump happens; Scan seeds one Visit per discovered Project so the Picker has a sensible starting order.
Tests
Table of scenarios in
internal/scan/scan_test.go, usingt.TempDir()Roots and real git repositories:Runseeds nothing newNotes for reviewer
Summary.Seededis derived by comparinghist.Countbefore and after eachSeedcall, rather than re-implementing Seed's idempotency rule in this package.Seedcalls, which run sequentially;Seeditself is already safe for concurrent use (it takes an advisoryflock), so this ordering is purely about keepingSummary.Seededaccounting simple, not about correctness.Closes #19
🤖 Generated with Claude Code