Skip to content

Add implicit project-scope detection and doctor health checks - #25

Merged
polymorcodeus merged 5 commits into
mainfrom
auto-detection
Aug 24, 2026
Merged

Add implicit project-scope detection and doctor health checks#25
polymorcodeus merged 5 commits into
mainfrom
auto-detection

Conversation

@polymorcodeus

Copy link
Copy Markdown
Owner

Summary

Adds implicit project-scope integration for lnk update, lnk restore, and lnk doctor. When a command runs inside a git repo that contains a .lnkinclude file, the project scope is detected automatically and restored alongside the common and host scopes. lnk doctor now audits project storage, symlinks, and patterns.

What's new

  • Implicit project detection - DetectProjectScope resolves the project root, ID, and storage resolver from the current working directory when a .lnkinclude file is present.
  • Update/restore integration - RestoreWithProject and UpdateWithProject restore common, host, and detected project scope, logging (project scope: <id>) to stderr.
  • --no-project opt-out - global flag skips automatic project-scope detection for both update and restore.
  • Doctor project checks - lnk doctor reports orphaned project storage, broken project symlinks, and .lnkinclude patterns that match no files.
  • Issue formatting - project health issues print with severity, project ID, issue, and a suggested fix.

Usage

CommandPurpose
lnk updatePull repo changes and restore common, host, and detected project scope
lnk restoreRestore common, host, and detected project scope
lnk update --no-project / lnk restore --no-projectSkip automatic project-scope detection
lnk doctorAudit project storage, symlinks, and patterns

Behavior changes / guardrails

  • The lnk repository itself is never treated as a project, even if it contains a .lnkinclude file.
  • Project detection works from any subdirectory of the project git repo.
  • --no-project is a persistent global flag, so it is available on any subcommand.
  • Orphaned storage detection walks $HOME looking for .lnkinclude files and compares live project IDs against stored project IDs.
  • Broken symlink detection only reports symlinks that point into the project's lnk storage and whose target is missing.
  • Empty-pattern detection skips negation patterns and checks each positive pattern against files in the project directory.

Testing

  • Unit tests for DetectProjectScope, RestoreWithProject, and UpdateWithProject.
  • Unit tests for orphaned storage, broken symlinks, empty patterns, and a healthy-project baseline in lnk doctor.
  • make check runs fmt, vet, lint, unit, and integration suites; all green.

@polymorcodeuspolymorcodeus self-assigned this Aug 23, 2026
@polymorcodeus
polymorcodeus merged commit 35615a6 into mainAug 24, 2026
4 checks passed
@polymorcodeus
polymorcodeus deleted the auto-detection branch August 24, 2026 00:08
Sign up for freeto 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.

1 participant

@polymorcodeus