@claudetools/tools 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/setup.js +12 -9
- package/package.json +1 -1
package/dist/setup.js
CHANGED
|
@@ -504,9 +504,11 @@ if [ -f "$WATCHER_PID_FILE" ]; then
|
|
|
504
504
|
fi
|
|
505
505
|
|
|
506
506
|
# Start watcher in background if not running
|
|
507
|
+
# The watcher manages its own PID file, so don't write it here
|
|
507
508
|
if [ ! -f "$WATCHER_PID_FILE" ] && command -v claudetools &> /dev/null; then
|
|
508
|
-
nohup claudetools watch
|
|
509
|
-
|
|
509
|
+
nohup claudetools watch >> /tmp/claudetools-watcher.log 2>&1 &
|
|
510
|
+
# Give the watcher a moment to start and write its PID file
|
|
511
|
+
sleep 1
|
|
510
512
|
fi
|
|
511
513
|
|
|
512
514
|
# --- Context Injection ---
|
|
@@ -525,10 +527,11 @@ PROJECT_ID=""
|
|
|
525
527
|
PROJECT_NAME=""
|
|
526
528
|
|
|
527
529
|
if [ -f "$PROJECTS_FILE" ]; then
|
|
528
|
-
# Find project by path prefix match
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
530
|
+
# Find project by path prefix match (use variable binding for jq startswith)
|
|
531
|
+
# Use -c for compact output so head -1 gets complete JSON object
|
|
532
|
+
PROJECT_DATA=$(jq -c --arg cwd "$CWD" '
|
|
533
|
+
.bindings[]? | select(.local_path) |
|
|
534
|
+
. as $b | select($cwd | startswith($b.local_path)) |
|
|
532
535
|
{project_id, project_name}' "$PROJECTS_FILE" 2>/dev/null | head -1)
|
|
533
536
|
|
|
534
537
|
if [ -n "$PROJECT_DATA" ]; then
|
|
@@ -624,10 +627,10 @@ CWD=$(pwd)
|
|
|
624
627
|
PROJECT_ID=""
|
|
625
628
|
|
|
626
629
|
if [ -f "$PROJECT_FILE" ]; then
|
|
627
|
-
# Try to find project by path prefix
|
|
630
|
+
# Try to find project by path prefix (use variable binding for jq startswith)
|
|
628
631
|
PROJECT_ID=$(jq -r --arg cwd "$CWD" '
|
|
629
|
-
.bindings[]? | select(.local_path
|
|
630
|
-
select($cwd | startswith(.local_path)) |
|
|
632
|
+
.bindings[]? | select(.local_path) |
|
|
633
|
+
. as $b | select($cwd | startswith($b.local_path)) |
|
|
631
634
|
.project_id' "$PROJECT_FILE" 2>/dev/null | head -1)
|
|
632
635
|
fi
|
|
633
636
|
|