-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathjustfile
More file actions
188 lines (164 loc) · 6.71 KB
/
Copy pathjustfile
File metadata and controls
188 lines (164 loc) · 6.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# Plugin management commands
plugins := "review customaize-agent ddd docs git kaizen mcp reflexion sadd sdd tdd tech-stack fpf"
marketplace := ".claude-plugin/marketplace.json"
# Show all commands
help:
@just --list
# Copy README.md files from docs/plugins/ to respective plugins/ folders
sync-docs-to-plugins:
@echo "Syncing README.md files from docs/plugins/ to plugins/..."
@for plugin in {{plugins}}; do \
if [ -f "docs/plugins/$plugin/README.md" ]; then \
cp "docs/plugins/$plugin/README.md" "plugins/$plugin/README.md"; \
echo " Copied: docs/plugins/$plugin/README.md -> plugins/$plugin/README.md"; \
else \
echo " Skipped: docs/plugins/$plugin/README.md (not found)"; \
fi; \
done
@echo "Done."
# Copy README.md files from plugins/ to docs/plugins/ folders
sync-plugins-to-docs:
@echo "Syncing README.md files from plugins/ to docs/plugins/..."
@for plugin in {{plugins}}; do \
if [ -f "plugins/$plugin/README.md" ]; then \
mkdir -p "docs/plugins/$plugin"; \
cp "plugins/$plugin/README.md" "docs/plugins/$plugin/README.md"; \
echo " Copied: plugins/$plugin/README.md -> docs/plugins/$plugin/README.md"; \
else \
echo " Skipped: plugins/$plugin/README.md (not found)"; \
fi; \
done
@echo "Done."
# Set version for a specific plugin
set-version plugin version:
@if [ ! -f "plugins/{{plugin}}/.claude-plugin/plugin.json" ]; then \
echo "Error: Plugin '{{plugin}}' not found"; \
exit 1; \
fi
@echo "Updating version for plugin '{{plugin}}' to {{version}}..."
@# Update plugin.json
@jq '.version = "{{version}}"' "plugins/{{plugin}}/.claude-plugin/plugin.json" > "plugins/{{plugin}}/.claude-plugin/plugin.json.tmp" && \
mv "plugins/{{plugin}}/.claude-plugin/plugin.json.tmp" "plugins/{{plugin}}/.claude-plugin/plugin.json"
@echo " Updated: plugins/{{plugin}}/.claude-plugin/plugin.json"
@# Update marketplace.json
@jq '(.plugins[] | select(.name == "{{plugin}}")).version = "{{version}}"' "{{marketplace}}" > "{{marketplace}}.tmp" && \
mv "{{marketplace}}.tmp" "{{marketplace}}"
@echo " Updated: {{marketplace}}"
@echo "Done. Version set to {{version}} for plugin '{{plugin}}'"
# Set version for the marketplace
set-marketplace-version version:
@if [ ! -f "{{marketplace}}" ]; then \
echo "Error: Marketplace file '{{marketplace}}' not found"; \
exit 1; \
fi
@echo "Updating marketplace version to {{version}}..."
@jq '.version = "{{version}}"' "{{marketplace}}" > "{{marketplace}}.tmp" && \
mv "{{marketplace}}.tmp" "{{marketplace}}"
@echo " Updated: {{marketplace}}"
@echo "Done. Marketplace version set to {{version}}"
# List all available plugins
list-plugins:
@echo "Available plugins:"
@for plugin in {{plugins}}; do \
if [ -f "plugins/$plugin/.claude-plugin/plugin.json" ]; then \
version=$(jq -r '.version' "plugins/$plugin/.claude-plugin/plugin.json"); \
echo " $plugin (v$version)"; \
fi; \
done
[doc("Get the running devcontainer ID (empty if not running)")]
_sandbox-id:
@docker ps --filter "label=devcontainer.local_folder={{justfile_directory()}}" --format "{{{{.ID}}" | head -n1
[doc("""
Start devcontainer and open an interactive shell.
Description:
Starts the development container using devcontainer CLI and attaches to an
interactive zsh shell. First run may take time to build the image.
Steps:
1. Runs `devcontainer up` to start the container
2. Extracts container ID, workspace folder, and user from output
3. Attaches to the container with docker exec
Usage:
just sandbox
""")]
sandbox:
#!/usr/bin/env bash
set -euo pipefail
echo "Starting devcontainer... First run can take long time to build the image"
tmpfile=$(mktemp)
devcontainer up --workspace-folder . 2>&1 | tee "$tmpfile"
output=$(cat "$tmpfile")
rm "$tmpfile"
container_id=$(echo "$output" | grep -oP '"containerId"\s*:\s*"\K[^"]+')
workspace=$(echo "$output" | grep -oP '"remoteWorkspaceFolder"\s*:\s*"\K[^"]+')
user=$(echo "$output" | grep -oP '"remoteUser"\s*:\s*"\K[^"]+')
if [ -z "$container_id" ]; then
echo "Error: could not find devcontainer"
exit 1
fi
echo "Attaching to container $container_id as ${user:-root} at $workspace..."
docker exec -it -u "${user:-root}" -w "${workspace:-/}" "$container_id" zsh
[doc("""
Attach to a running devcontainer.
Description:
Connects to an already running devcontainer shell. Requires that
the devcontainer was started with `just sandbox` first.
Steps:
1. Gets the container ID using _sandbox-id
2. Inspects container to find workspace and user
3. Attaches with docker exec
Usage:
just attach-sandbox
""")]
attach-sandbox:
#!/usr/bin/env bash
set -euo pipefail
container_id=$(just _sandbox-id)
if [ -z "$container_id" ]; then
echo "Error: no running devcontainer found. Run 'just sandbox' first."
exit 1
fi
eval "$(docker inspect "$container_id" | python3 -c "
import json,sys
c = json.load(sys.stdin)[0]
folder = c['Config']['Labels'].get('devcontainer.local_folder','')
ws = next((m['Destination'] for m in c.get('Mounts',[]) if m['Source'] == folder), '/')
meta = json.loads(c['Config']['Labels'].get('devcontainer.metadata','[]'))
user = next((i['remoteUser'] for i in meta if 'remoteUser' in i), 'root')
print(f'workspace={ws}')
print(f'user={user}')
")"
echo "Attaching to container $container_id as $user at $workspace..."
docker exec -it -u "$user" -w "$workspace" "$container_id" zsh
[doc("""
Stop and remove the devcontainer.
Description:
Gracefully stops and removes the running development container.
Safe to run even if no container is running.
Steps:
1. Gets container ID (if any)
2. Stops the container with docker stop
3. Removes the container with docker rm
Usage:
just stop-sandbox
""")]
stop-sandbox:
#!/usr/bin/env bash
set -euo pipefail
container_id=$(just _sandbox-id)
if [ -z "$container_id" ]; then
echo "No running devcontainer found."
exit 0
fi
echo "Stopping container $container_id..."
docker stop "$container_id" && docker rm "$container_id"
echo "Done."
[doc("""
Tear down the devcontainer docker-compose resources.
Description:
Runs docker compose down for the devcontainer configuration.
Use this to completely clean up devcontainer networking and volumes.
Usage:
just down-devcontainer
""")]
down-devcontainer:
docker compose --project-name decision-engine_devcontainer -f .devcontainer/docker-compose.yaml down