Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion home-manager/modules/local-scripts/tmux-bridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ cmd_list() {
printf "%-8s %-16s %-10s %-25s %-10s %s\n" "TARGET" "SESSION:WIN" "SIZE" "PROCESS" "LABEL" "CWD"
tmx list-panes -a \
-F '#{pane_id}|#{session_name}|#{window_index}|#{window_name}|#{pane_pid}|#{pane_width}x#{pane_height}|#{@name}|#{pane_current_path}' \
2>/dev/null | while IFS='|' read -r id sess widx wname pid size label cwd; do
2>/dev/null | while IFS='|' read -r id sess widx _wname pid size label cwd; do
# Get the actual running process (deepest child of pane pid)
local proc child_pid
proc=$(ps -o comm= -p "$pid" 2>/dev/null || echo "?")
Expand Down
32 changes: 8 additions & 24 deletions home-manager/modules/uv-globals/install-uv-globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,31 @@ if ! timeout 3 bash -c 'exec 3<>/dev/tcp/1.1.1.1/53' 2>/dev/null; then
exit 0
fi

# Install uv global tools from pyproject.toml
# Reads dependencies from ~/dotfiles/pyproject.toml and installs them as global tools

PYPROJECT="${HOME}/dotfiles/pyproject.toml"

# Exit if no pyproject.toml exists
if [ ! -f "$PYPROJECT" ]; then
echo "No ${PYPROJECT} found, skipping uv globals install"
exit 0
fi

# Check for required tools
if ! command -v uv &>/dev/null; then
echo "uv not found, skipping uv globals install"
exit 0
fi

if ! command -v dasel &>/dev/null; then
echo "dasel not found, skipping uv globals install"
exit 0
fi

if ! command -v jq &>/dev/null; then
echo "jq not found, skipping uv globals install"
if ! command -v tomlq &>/dev/null; then

@cubic-dev-ai cubic-dev-ai Bot Apr 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P0: tomlq is not provisioned in the Nix module. home-manager/modules/uv-globals/default.nix only exports uv, dasel, and jq to PATH. Since tomlq is never on PATH, command -v tomlq will always fail and the script will silently skip execution every time. Add ${pkgs.tomlq}/bin to the PATH export in default.nix.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/modules/uv-globals/install-uv-globals.sh, line 23:

<comment>`tomlq` is not provisioned in the Nix module. `home-manager/modules/uv-globals/default.nix` only exports `uv`, `dasel`, and `jq` to `PATH`. Since `tomlq` is never on `PATH`, `command -v tomlq` will always fail and the script will silently skip execution every time. Add `${pkgs.tomlq}/bin` to the `PATH` export in `default.nix`.</comment>

<file context>
@@ -8,40 +8,28 @@ if ! timeout 3 bash -c 'exec 3<>/dev/tcp/1.1.1.1/53' 2>/dev/null; then
-
-if ! command -v jq &>/dev/null; then
-  echo "jq not found, skipping uv globals install"
+if ! command -v tomlq &>/dev/null; then
+  echo "tomlq not found, skipping uv globals install"
   exit 0
</file context>
Fix with Cubic

echo "tomlq not found, skipping uv globals install"
exit 0
Comment on lines +23 to 25

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Verify the runtime check in installer/spec:
rg -n 'command -v tomlq|tomlq' home-manager/modules/uv-globals/install-uv-globals.sh spec/uv_globals_spec.sh

# Verify PATH/exported tools for uv-globals module:
rg -n 'export PATH=' home-manager/modules/uv-globals/default.nix
rg -n 'tomlq|dasel|jq' home-manager/modules/uv-globals/default.nix

Repository: shunkakinoki/dotfiles

Length of output: 933


🏁 Script executed:

# Check if tomlq is referenced elsewhere in default.nix or related files
rg -n 'tomlq|pkgs.toml' home-manager/modules/uv-globals/default.nix
# Also check if there are other related nix files
fd -e nix home-manager/modules/uv-globals/ -exec rg -l 'tomlq' {} \;

Repository: shunkakinoki/dotfiles

Length of output: 303


🏁 Script executed:

# Check if tomlq is referenced anywhere in the nix module files
rg -n 'tomlq' home-manager/modules/uv-globals/

# Also check the full default.nix to see buildInputs/dependencies
cat -n home-manager/modules/uv-globals/default.nix

Repository: shunkakinoki/dotfiles

Length of output: 909


🏁 Script executed:

export PATH=${pkgs.uv}/bin:${pkgs.dasel}/bin:${pkgs.jq}/bin:${pkgs.tomlq}/bin:$PATH

Repository: shunkakinoki/dotfiles

Length of output: 178


tomlq dependency is not provisioned in the module configuration.

Line 23 hard-requires tomlq, and line 32 uses it to parse pyproject.toml. However, home-manager/modules/uv-globals/default.nix (line 5) exports only uv, dasel, and jq to PATH. The script will always skip execution silently since command -v tomlq will fail.

Add ${pkgs.tomlq}/bin to the PATH export in default.nix line 5:

export PATH=${pkgs.uv}/bin:${pkgs.dasel}/bin:${pkgs.jq}/bin:${pkgs.tomlq}/bin:$PATH
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@home-manager/modules/uv-globals/install-uv-globals.sh` around lines 23 - 25,
The script install-uv-globals.sh requires tomlq (checked via command -v tomlq
and used to parse pyproject.toml) but default.nix only exports uv, dasel, and jq
to PATH; update the PATH export in default.nix (the line constructing export
PATH=...) to include ${pkgs.tomlq}/bin so tomlq is available at runtime,
ensuring install-uv-globals.sh can find and run tomlq.

fi

# Install uv global tools from pyproject.toml
# Reads dependencies from ~/dotfiles/pyproject.toml and installs them as global tools
echo "Installing uv global tools from pyproject.toml..."

# Parse Python version from requires-python (e.g., ">=3.13" -> "3.13")
PYTHON_VERSION=$(dasel -f "$PYPROJECT" -r toml 'project.requires-python' 2>/dev/null | sed 's/[^0-9.]//g' || echo "3.13")
PYTHON_VERSION=$(tomlq -r '.project["requires-python"]' "$PYPROJECT" 2>/dev/null | sed 's/[^0-9.]//g')
PYTHON_VERSION=${PYTHON_VERSION:-3.13}

# Parse dependencies from standard pyproject.toml format
DEPS=$(dasel -f "$PYPROJECT" -r toml -w json 'project.dependencies' 2>/dev/null | jq -r '.[]' 2>/dev/null || true)
DEPS=$(tomlq -r '.["dependency-groups"].tools[]' "$PYPROJECT" 2>/dev/null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Because the script uses set -e, if tomlq fails (for example, if the dependency-groups key is missing from pyproject.toml), the script will exit immediately with a non-zero status. This bypasses the graceful check on line 34. Adding || true ensures the script continues so it can handle the empty result gracefully, adhering to the principle of handling failures without blocking execution.

Suggested change
DEPS=$(tomlq -r '.["dependency-groups"].tools[]' "$PYPROJECT" 2>/dev/null)
DEPS=$(tomlq -r '.["dependency-groups"].tools[]' "$PYPROJECT" 2>/dev/null || true)
References
  1. Scripts should handle failures gracefully (e.g., during command execution or in retry loops) to avoid blocking execution flow, especially when set -e is in effect.

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

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

The filter .["dependency-groups"].tools[] will error when the dependency-groups table or tools array is missing (or non-array). That can cause the script to exit early in environments that run bash with set -e, and it also makes the behavior more brittle than necessary. Use a non-throwing filter (e.g., optional iteration like []? / default-to-empty) and ensure failures don’t abort the script so the later -z check can handle the 'no deps' case deterministically.

Suggested change
DEPS=$(tomlq -r '.["dependency-groups"].tools[]' "$PYPROJECT" 2>/dev/null)
DEPS=$(tomlq -r '.["dependency-groups"]?.tools? // [] | .[]?' "$PYPROJECT" 2>/dev/null || true)

Copilot uses AI. Check for mistakes.

@cubic-dev-ai cubic-dev-ai Bot Apr 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Guard the tomlq extraction against missing dependency-groups.tools; otherwise set -e can terminate the script before the empty-deps check runs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/modules/uv-globals/install-uv-globals.sh, line 32:

<comment>Guard the `tomlq` extraction against missing `dependency-groups.tools`; otherwise `set -e` can terminate the script before the empty-deps check runs.</comment>

<file context>
@@ -8,40 +8,28 @@ if ! timeout 3 bash -c 'exec 3<>/dev/tcp/1.1.1.1/53' 2>/dev/null; then
-
-# Parse dependencies from standard pyproject.toml format
-DEPS=$(dasel -f "$PYPROJECT" -r toml -w json 'project.dependencies' 2>/dev/null | jq -r '.[]' 2>/dev/null || true)
+DEPS=$(tomlq -r '.["dependency-groups"].tools[]' "$PYPROJECT" 2>/dev/null)
 
 if [ -z "$DEPS" ]; then
</file context>
Suggested change
DEPS=$(tomlq -r '.["dependency-groups"].tools[]' "$PYPROJECT" 2>/dev/null)
DEPS=$(tomlq -r '.["dependency-groups"].tools[]?' "$PYPROJECT" 2>/dev/null || true)
Fix with Cubic


if [ -z "$DEPS" ]; then
echo "No dependencies found in pyproject.toml"

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

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

The message is now misleading because the script no longer looks for general dependencies; it specifically reads dependency-groups.tools. Suggest updating the message to reflect the actual source (e.g., 'No dependency-groups.tools entries found in pyproject.toml') so failures are easier to diagnose.

Suggested change
echo "No dependencies found in pyproject.toml"
echo "No dependency-groups.tools entries found in pyproject.toml"

Copilot uses AI. Check for mistakes.
Expand All @@ -51,14 +42,7 @@ fi
echo "$DEPS" | while read -r pkg; do
if [ -n "$pkg" ]; then
echo "Installing $pkg..."
# Try default Python first, fall back to version from pyproject.toml
if ! uv tool install "$pkg" --force 2>/dev/null; then
if uv tool install "$pkg" --python "$PYTHON_VERSION" --force 2>/dev/null; then
echo "Installed $pkg with Python $PYTHON_VERSION"
else
echo "Failed to install $pkg, skipping..."
fi
fi
uv tool install "$pkg" --python "$PYTHON_VERSION" --force 2>/dev/null || echo "Failed to install $pkg, skipping..."
fi
done
Comment on lines 42 to 47

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

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

Piping via echo is less robust than printf because echo can treat leading -n/-e-like content as options and can be implementation-dependent. Prefer printf '%s\n' \"$DEPS\" | while ... (or, even better, avoid storing the whole list and stream directly from tomlq) to make the loop resilient to unusual dependency strings.

Copilot uses AI. Check for mistakes.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tools = [
"aider-chat>=0.86.2",
"marker-pdf>=1.10.2",
"mistral-vibe>=2.7.0",
"claude-swap>=1.1.5",
"claude-swap>=0.7.1",
"ruff>=0.15.8",
]

Expand Down
2 changes: 1 addition & 1 deletion spec/coverage_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ config/claude/hooks/pushover.sh
config/claude/hooks/rtk-rewrite.sh
config/claude/hooks/auto-switch.sh
config/claude/hooks/security.sh
config/claude/hooks/auto-switch.sh
config/claude/hooks/atuin-history.sh
config/claude/hooks/statusline.sh
config/codex/hooks/atuin-history.sh
Expand All @@ -254,6 +253,7 @@ home-manager/modules/cargo-globals/install-cargo-globals.sh
home-manager/modules/local-binaries/sync-local-binaries.sh
home-manager/modules/local-scripts/clipboard-copy.sh
home-manager/modules/local-scripts/notify-local.sh
home-manager/modules/local-scripts/tmux-bridge.sh
home-manager/modules/npm-globals/install-npm-globals.sh
home-manager/modules/uv-globals/install-uv-globals.sh
home-manager/programs/neovim/run_tests.sh
Expand Down
33 changes: 19 additions & 14 deletions spec/uv_globals_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@ When run bash -c "grep 'command -v uv' '$SCRIPT'"
The output should include 'uv'
End

It 'checks for dasel command'
When run bash -c "grep 'command -v dasel' '$SCRIPT'"
The output should include 'dasel'
End

It 'checks for jq command'
When run bash -c "grep 'command -v jq' '$SCRIPT'"
The output should include 'jq'
It 'checks for tomlq command'
When run bash -c "grep 'command -v tomlq' '$SCRIPT'"
The output should include 'tomlq'
End
End

Expand All @@ -60,9 +55,9 @@ End
End

Describe 'tool installation'
It 'uses dasel to parse TOML'
When run bash -c "grep 'dasel' '$SCRIPT'"
The output should include 'dasel'
It 'uses tomlq to parse TOML'
When run bash -c "grep 'tomlq' '$SCRIPT'"
The output should include 'tomlq'
End

It 'uses uv tool install'
Expand All @@ -75,9 +70,19 @@ When run bash -c "grep -- '--force' '$SCRIPT'"
The output should include '--force'
End

It 'parses project.dependencies'
When run bash -c "grep 'project.dependencies' '$SCRIPT'"
The output should include 'project.dependencies'
It 'parses dependency-groups.tools'
When run bash -c "grep 'dependency-groups' '$SCRIPT'"

@cubic-dev-ai cubic-dev-ai Bot Apr 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The spec claims to verify dependency-groups.tools, but it only matches dependency-groups, making the test too weak and prone to false positives.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At spec/uv_globals_spec.sh, line 74:

<comment>The spec claims to verify `dependency-groups.tools`, but it only matches `dependency-groups`, making the test too weak and prone to false positives.</comment>

<file context>
@@ -75,9 +70,9 @@ When run bash -c "grep -- '--force' '$SCRIPT'"
-When run bash -c "grep 'project.dependencies' '$SCRIPT'"
-The output should include 'project.dependencies'
+It 'parses dependency-groups.tools'
+When run bash -c "grep 'dependency-groups' '$SCRIPT'"
+The output should include 'dependency-groups'
 End
</file context>
Fix with Cubic

The output should include 'dependency-groups'
Comment on lines +74 to +75

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

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

This assertion is quite broad: it will pass if the script contains the text dependency-groups anywhere, even if it doesn’t actually parse .dependency-groups.tools. Consider grepping for the specific tomlq filter/path used (e.g., .[\"dependency-groups\"].tools / dependency-groups.tools) to make the test accurately match the behavior described by the test name.

Suggested change
When run bash -c "grep 'dependency-groups' '$SCRIPT'"
The output should include 'dependency-groups'
When run bash -c "grep -E '\\[\"dependency-groups\"\\]\\.tools|dependency-groups\\.tools' '$SCRIPT'"
The output should include '.tools'

Copilot uses AI. Check for mistakes.
End

It 'parses requires-python version'
When run bash -c "grep 'requires-python' '$SCRIPT'"
The output should include 'requires-python'
End

It 'passes --python flag to uv tool install'
When run bash -c "grep -- '--python' '$SCRIPT'"
The output should include '--python'
End
End
End
Loading