Implement install command with committed lockfile materialization and narrow gitignore migration - #21
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69da968725
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const newline = content.includes("\r\n") ? "\r\n" : "\n" | ||
| const hasFinalNewline = content.endsWith(newline) | ||
| const body = hasFinalNewline ? content.slice(0, -newline.length) : content | ||
| const lines = body.length === 0 ? [] : body.split(newline) |
There was a problem hiding this comment.
Handle mixed line endings when migrating ignore rules
When an existing .gitignore mixes CRLF and LF delimiters, selecting CRLF because it occurs anywhere and then splitting only on that delimiter leaves LF-delimited records joined together. An exact legacy .packref on an LF-only segment is therefore not recognized and remains alongside the appended narrow rules, so Git continues ignoring .packref/packref-lock.json; parse either delimiter while retaining the original delimiters for rewriting.
AGENTS.md reference: AGENTS.md:L38-L40
Useful? React with 👍 / 👎.
| const resolvedRepository = yield* resolveRepositoryRef(entry, entry.source) | ||
| const materialized = yield* fetchRepositorySnapshot(entry, resolvedRepository) | ||
| return yield* ensureMatchingSource(entry, materialized) |
There was a problem hiding this comment.
Validate repository metadata before populating the store
When a schema-valid committed repository entry has a noncanonical URL (such as a .git suffix) or a host inconsistent with its URL and the identity is not cached, this fetch persists the normalized source before ensureMatchingSource rejects it. The failed install thus leaves a mismatched global entry behind, every retry fails against that cached entry, and the advertised recovery wipes the entire global store; compare the normalized source with the lock metadata before fetching, or remove the newly created entry on mismatch.
AGENTS.md reference: AGENTS.md:L7-L8
Useful? React with 👍 / 👎.
69da968 to
2392326
Compare
26a9462 to
aa66d42
Compare
aa66d42 to
36f15c7
Compare
2392326 to
ce7b7c9
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce7b7c9fa4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| yield* registerProject(projectPath) | ||
|
|
||
| for (const entry of entries) { | ||
| if (yield* hasProjectReference(projectPath, entry)) { |
There was a problem hiding this comment.
Reject conflicting duplicate lockfile identities
When a schema-valid committed lockfile contains two entries with the same registry, name, and version but different source metadata, the first entry creates the shared project path and this check classifies the second as already installed without comparing its source. Installation therefore succeeds while silently ignoring one locked source, with the materialized result depending on duplicate ordering; reject duplicate identities, or at least conflicting duplicates, before processing entries.
AGENTS.md reference: AGENTS.md:L7-L9
Useful? React with 👍 / 👎.
…nd gitignore migration
ce7b7c9 to
17e725c
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17e725c027
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| const checkIsPackrefEntry = (entry: string) => | ||
| entry === PACKREF_IGNORE_ENTRY || entry === `${PACKREF_IGNORE_ENTRY}/` | ||
| const checkIsPackrefEntry = (entry: string) => LEGACY_PACKREF_IGNORE_ENTRIES.has(entry.trim()) |
There was a problem hiding this comment.
Preserve leading whitespace in ignore patterns
When .gitignore contains a rule such as .packref/, Git treats the leading space as part of the filename pattern, but trim() classifies it as the legacy Packref rule and replaces it with the generated rules. Running packref init therefore silently removes an unrelated valid ignore rule; recognize trailing whitespace if desired, but do not strip leading whitespace during legacy migration.
AGENTS.md reference: AGENTS.md:L7-L9
Useful? React with 👍 / 👎.

Adds a
packref installcommand that materializes all source references recorded in the committed lockfile without modifying it.Lockfile commit model
.packref/packref-lock.jsonis now intended to be committed. The.gitignorerules are updated accordingly:initnow writes (and migrates legacy.packref/.packref/entries to) the narrower.packref/packages/and.packref/.packref-lock-*.tmppatterns, preserving line endings, comments, trailing whitespace, and CRLF files. A committed lockfile (packref-lock.json) is included in the repository.packref installbehaviorStoreSourceMismatchError.Supporting changes
readStoreEntryis extracted frommaterializeStoreEntryso install can read stored metadata without re-materializing.packageSourceEquivalenceis derived from the existing schema for source comparison.hasProjectReferenceandgetProjectReferencePathare added to the project workspace layer.directorykey when undefined, fixing equivalence checks against lockfile entries that lack it.initlogs a hint to runpackref installwhen it finds an existing lockfile with entries.installsubcommand is wired into the root CLI command.