Skip to content

feat: status command shipped#7

Merged
RohitRavindra-dev merged 2 commits into
mainfrom
feat/v1/status
Jun 27, 2026
Merged

feat: status command shipped#7
RohitRavindra-dev merged 2 commits into
mainfrom
feat/v1/status

Conversation

@RohitRavindra-dev

@RohitRavindra-dev RohitRavindra-dev commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added a new status command to show the current devlocal setup status.
    • The status output now includes configuration details, tracked files, and patch information.
  • Bug Fixes

    • Improved file validation so missing files and directories are reported more clearly.
    • Status checks now surface errors instead of silently continuing when something goes wrong.

@RohitRavindra-dev RohitRavindra-dev self-assigned this Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

A new status subcommand validates the devlocal filesystem, loads devlocal config, and prints version, overlooked-file, and patches status sections. Supporting helpers now expose file-existence checks and git skip-worktree inspection.

Changes

Status command flow

Layer / File(s) Summary
Filesystem and git helpers
internal/filesystem/utils.go, internal/git/worktrees.go
FileExists now returns explicit errors for missing paths and directories, and IsSkipWorktree shells out to git ls-files -v to report skip-worktree state.
Status reporter
internal/service/status/reporter.go
status.Run loads devlocal config, renders the status sections, and returns config-loading or rendering errors.
Cobra subcommand wiring
cmd/status.go
cmd/status.go adds the status subcommand, validates the filesystem in PreRunE, runs status.Run in RunE, and registers the command on rootCmd.

Sequence Diagram(s)

sequenceDiagram
  participant rootCmd
  participant statusCmd
  participant validateDevLocalFilesystem as "filesystem.ValidateDevLocalFilesystem"
  participant statusRun as "status.Run"
  participant loadDevlocalConfig as "filesystem.LoadDevlocalConfig"
  participant fileExists as "filesystem.FileExists"
  participant isSkipWorktree as "git.IsSkipWorktree"
  rootCmd->>statusCmd: invoke status subcommand
  statusCmd->>validateDevLocalFilesystem: PreRunE validation
  validateDevLocalFilesystem-->>statusCmd: validation result
  statusCmd->>statusRun: RunE execution
  statusRun->>loadDevlocalConfig: load devlocal config
  loadDevlocalConfig-->>statusRun: config data
  statusRun->>fileExists: check overlooked file path
  fileExists-->>statusRun: existence / error
  statusRun->>isSkipWorktree: inspect git state
  isSkipWorktree-->>statusRun: skip-worktree flag
  statusRun-->>statusCmd: status output or error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I hop to status with a twitchy nose,
sniffing config where the devlocal grows.
One paw for files, one paw for git,
“skip-worktree!” thumps my bunny kit.
And every print makes my whiskers glow. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding and shipping a new status command.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/v1/status

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/git/worktrees.go`:
- Around line 78-90: `IsSkipWorktree` currently treats an empty `git ls-files
-v` result as success, so unmatched paths are misreported downstream. Update
`IsSkipWorktree` in the worktrees helper to return an error when
`CombinedOutput` yields no output for the requested file, and then change
`displayOverlookStatus` in the status reporter to handle the returned error from
`git.IsSkipWorktree(filename)` instead of discarding it so non-tracked paths do
not show as “Being tracked”.

In `@internal/service/status/reporter.go`:
- Around line 41-47: The displayPatchesStatus function currently prints the
section header and returns without rendering anything when patches is non-empty,
so add the missing iteration over the patches slice inside displayPatchesStatus
to print each configured patch’s status before returning. Keep the empty-slice
branch for the “No patches registed…” message, and use the existing
displayPatchesStatus symbol so the status command shows patch entries whenever
configuration exists.
- Around line 27-29: The status reporter is ignoring errors from
git.IsSkipWorktree, which can leave the default “Being tracked” state even when
the check failed. Update the logic in the reporter’s skip-worktree check to
handle the returned error explicitly instead of using the blank identifier; if
git.IsSkipWorktree fails, surface that failure in the reported status/comment
rather than treating the file as healthy, and keep the normal
overlookStatus/overlookComment assignment only when the check succeeds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5eeb8c27-932e-4c94-93cc-b6ed8cb63d8d

📥 Commits

Reviewing files that changed from the base of the PR and between fd692af and 4463d8e.

📒 Files selected for processing (4)
  • cmd/status.go
  • internal/filesystem/utils.go
  • internal/git/worktrees.go
  • internal/service/status/reporter.go

Comment thread internal/git/worktrees.go
Comment on lines +78 to +90
func IsSkipWorktree(file string) (bool, error) {
out, err := exec.Command(
"git",
"ls-files",
"-v",
file,
).CombinedOutput()

if err != nil {
return false, err
}

return len(out) > 0 && out[0] == 'S', nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -u
set +e

echo '$ git ls-files -v __coderabbit_unmatched_probe__'
git ls-files -v __coderabbit_unmatched_probe__
echo "exit=$?"

echo
echo '$ git ls-files -v --error-unmatch -- __coderabbit_unmatched_probe__'
git ls-files -v --error-unmatch -- __coderabbit_unmatched_probe__
echo "exit=$?"

Repository: RohitRavindra-dev/devlocal

Length of output: 413


🏁 Script executed:

#!/bin/bash
set -u

echo '### internal/git/worktrees.go'
sed -n '1,180p' internal/git/worktrees.go

echo
echo '### internal/service/status/reporter.go'
sed -n '1,220p' internal/service/status/reporter.go

Repository: RohitRavindra-dev/devlocal

Length of output: 3574


🏁 Script executed:

#!/bin/bash
set -u

rg -n "IsSkipWorktree\(" .

Repository: RohitRavindra-dev/devlocal

Length of output: 355


🏁 Script executed:

#!/bin/bash
set -u

rg -n "IsSkipWorktree\(" .

Repository: RohitRavindra-dev/devlocal

Length of output: 355


Make IsSkipWorktree failures propagate to status output. git ls-files -v can return no output for an unmatched path, and displayOverlookStatus currently discards the error from git.IsSkipWorktree(filename), so non-tracked paths still render as “Being tracked”. Make unmatched paths return an error in internal/git/worktrees.go and handle that error in internal/service/status/reporter.go instead of ignoring it.

🧰 Tools
🪛 golangci-lint (2.12.2)

[error] 79-79: os/exec.Command must not be called. use os/exec.CommandContext

(noctx)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/git/worktrees.go` around lines 78 - 90, `IsSkipWorktree` currently
treats an empty `git ls-files -v` result as success, so unmatched paths are
misreported downstream. Update `IsSkipWorktree` in the worktrees helper to
return an error when `CombinedOutput` yields no output for the requested file,
and then change `displayOverlookStatus` in the status reporter to handle the
returned error from `git.IsSkipWorktree(filename)` instead of discarding it so
non-tracked paths do not show as “Being tracked”.

Comment on lines +27 to +29
if isOverlooked, _ := git.IsSkipWorktree(filename); isOverlooked {
overlookStatus = "✓"
overlookComment = "Overlooked"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Don't swallow IsSkipWorktree failures.

When git.IsSkipWorktree errors, the blank identifier leaves the default "Being tracked" message in place. That turns git/read failures into a false healthy status instead of surfacing that the inspection failed.

Suggested fix
-			if isOverlooked, _ := git.IsSkipWorktree(filename); isOverlooked {
+			isOverlooked, err := git.IsSkipWorktree(filename)
+			if err != nil {
+				overlookComment = err.Error()
+			} else if isOverlooked {
 				overlookStatus = "✓"
 				overlookComment = "Overlooked"
 			}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if isOverlooked, _ := git.IsSkipWorktree(filename); isOverlooked {
overlookStatus = "✓"
overlookComment = "Overlooked"
isOverlooked, err := git.IsSkipWorktree(filename)
if err != nil {
overlookComment = err.Error()
} else if isOverlooked {
overlookStatus = "✓"
overlookComment = "Overlooked"
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/status/reporter.go` around lines 27 - 29, The status
reporter is ignoring errors from git.IsSkipWorktree, which can leave the default
“Being tracked” state even when the check failed. Update the logic in the
reporter’s skip-worktree check to handle the returned error explicitly instead
of using the blank identifier; if git.IsSkipWorktree fails, surface that failure
in the reported status/comment rather than treating the file as healthy, and
keep the normal overlookStatus/overlookComment assignment only when the check
succeeds.

Comment on lines +41 to +47
func displayPatchesStatus(patches []string) {
fmt.Println("[Patches]")
if len(patches) == 0 {
fmt.Println("\t- No patches registed in config for patching!")
return
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Configured patches never render any status.

For any non-empty patches, this function prints [Patches] and exits without listing a single entry. The new status command therefore omits patch state exactly when patch configuration exists.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/status/reporter.go` around lines 41 - 47, The
displayPatchesStatus function currently prints the section header and returns
without rendering anything when patches is non-empty, so add the missing
iteration over the patches slice inside displayPatchesStatus to print each
configured patch’s status before returning. Keep the empty-slice branch for the
“No patches registed…” message, and use the existing displayPatchesStatus symbol
so the status command shows patch entries whenever configuration exists.

@RohitRavindra-dev RohitRavindra-dev merged commit d583e2f into main Jun 27, 2026
2 checks passed
@RohitRavindra-dev RohitRavindra-dev deleted the feat/v1/status branch June 27, 2026 06:46
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.

1 participant