Skip to content

local: handle ghq-style repo layouts#11

Merged
steipete merged 1 commit intosteipete:mainfrom
shunkakinoki:local/ghq-depth
Jan 21, 2026
Merged

local: handle ghq-style repo layouts#11
steipete merged 1 commit intosteipete:mainfrom
shunkakinoki:local/ghq-depth

Conversation

@shunkakinoki
Copy link
Copy Markdown
Contributor

@shunkakinoki shunkakinoki commented Jan 2, 2026

Summary

  • raise local projects default scan depth from 2 to 4 so ghq-style paths (e.g. ~/ghq/github.com/owner/repo) are discovered
  • document the rationale inline

Reference

Copilot AI review requested due to automatic review settings January 2, 2026 06:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR increases the default scan depth for local repository discovery from 2 to 4 to support ghq-style repository layouts (e.g., ~/ghq/github.com/owner/repo). This change enables the application to discover repositories nested 3-4 directory levels below the configured root path.

Key Changes

  • Increased defaultMaxDepth constant from 2 to 4 in LocalProjectsConstants
  • Added inline documentation explaining the rationale for the increased depth to support ghq-style layouts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +14
// Allow ghq-style layouts (e.g. ~/ghq/github.com/owner/repo) which sit 3–4 levels
// below the configured root path.
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states ghq-style repos "sit 3–4 levels below the configured root path", but the depth calculation may be confusing. For a path like ~/ghq/github.com/owner/repo where the root is ~/ghq, the repo directory is at depth 3 (github.com=1, owner=2, repo=3). With maxDepth=4, the scanner checks depths 0-3 (since the condition is depth < maxDepth). Consider clarifying the comment to explain that maxDepth=4 allows scanning up to 3 levels deep from the root, or provide a concrete example showing the depth counting.

Suggested change
// Allow ghq-style layouts (e.g. ~/ghq/github.com/owner/repo) which sit 3–4 levels
// below the configured root path.
// Allow ghq-style layouts, e.g. ~/ghq/github.com/owner/repo when the root is ~/ghq.
// Depth is counted from the root directory (root = depth 0), so in this example:
// github.com = depth 1, owner = depth 2, repo = depth 3.
// With defaultMaxDepth = 4 and a depth check like `depth < maxDepth`, depths 0–3
// are scanned, which covers repos up to 3 levels below the configured root path.

Copilot uses AI. Check for mistakes.
public static let defaultMaxDepth: Int = 2
// Allow ghq-style layouts (e.g. ~/ghq/github.com/owner/repo) which sit 3–4 levels
// below the configured root path.
public static let defaultMaxDepth: Int = 4
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increasing the default scan depth from 2 to 4 doubles the number of directory levels traversed during repository discovery. This could significantly impact performance for users with deeply nested directory structures or many directories at intermediate levels. Consider adding test coverage for the deeper scanning behavior with maxDepth=4 to ensure it performs acceptably, similar to the existing tests that use maxDepth values of 1 and 2.

Copilot uses AI. Check for mistakes.
@steipete steipete merged commit 0d590c2 into steipete:main Jan 21, 2026
7 checks passed
@steipete
Copy link
Copy Markdown
Owner

Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: dcb76d7d12b284b14dd99108b34d753a3f695dc1\n- Merge commit: 0d590c2\n\nThanks @shunkakinoki!

Sign up for free to 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.

3 participants