-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.dist.yaml
More file actions
204 lines (175 loc) · 5.87 KB
/
Taskfile.dist.yaml
File metadata and controls
204 lines (175 loc) · 5.87 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
dotenv: [.env]
env:
PYTHONDONTWRITEBYTECODE: "1"
VIRTUAL_ENV: "{{.ROOT_DIR}}/.venv"
vars:
OPENCODE_CONFIG_DIR: "{{.HOME}}/.config/opencode"
CLAUDE_CONFIG_DIR: "{{.HOME}}/.claude"
CODEX_CONFIG_DIR: "{{.HOME}}/.codex"
includes:
setup: .taskfiles/setup.yaml
hooks: .taskfiles/hooks.yaml
notify: .taskfiles/notify.yaml
mcp: .taskfiles/mcp.yaml
commands: .taskfiles/commands.yaml
github: .taskfiles/github.yaml
agents: .taskfiles/agents.yaml
plugin: .taskfiles/plugin.yaml
tasks:
default:
silent: true
cmds:
- task -l
init:
desc: Install dependencies and setup environment
aliases: [setup]
cmds:
- task: setup:init
- task: setup-user
- task: create-claude-md
# - rtk init
setup-user:
desc: Setup user commands
cmds:
- mkdir -p {{.OPENCODE_CONFIG_DIR}}
- mkdir -p {{.CLAUDE_CONFIG_DIR}}
- task: copy-user-config
- task: commands:setup-user
- task: mcp:setup-user
- task: agents:setup-user
- task: plugin:setup-user
- task: link-user-agents-md
copy-user-config:
desc: Copy configs
cmds:
- cp -f .opencode/opencode.json {{.OPENCODE_CONFIG_DIR}}/opencode.json
link-user-agents-md:
desc: Symlink user/AGENTS.md to agent configs
aliases: [copy-user-agents-md]
cmds:
- mkdir -p "{{.CLAUDE_CONFIG_DIR}}" "{{.OPENCODE_CONFIG_DIR}}"
- rm -f "{{.CLAUDE_CONFIG_DIR}}/CLAUDE.md"
"{{.OPENCODE_CONFIG_DIR}}/AGENTS.md"
- ln -s "{{.ROOT_DIR}}/user/AGENTS.md" "{{.CLAUDE_CONFIG_DIR}}/CLAUDE.md"
- ln -s "{{.ROOT_DIR}}/user/AGENTS.md" "{{.OPENCODE_CONFIG_DIR}}/AGENTS.md"
- ln -s "{{.ROOT_DIR}}/user/AGENTS.md" "{{.CODEX_CONFIG_DIR}}/AGENTS.md"
check:
desc: Run code checks
cmds:
- prettier --check .
fix:
desc: Run code fixes
cmds:
- prettier --write .
test:
desc: Run tests
devtools:chrome:
desc: Launch Chromium/Chrome with remote debugging on port 9222
silent: true
summary: |
Launches Chromium or Chrome with DevTools remote debugging enabled.
Usage: task devtools:chrome -- http://localhost:5173
Optional: BROWSER_BIN=/path/to/chrome task devtools:chrome -- <url>
cmd: |
set -eu
app_url="{{.CLI_ARGS}}"
endpoint="http://127.0.0.1:9222/json/list"
profile="${TMPDIR:-/tmp}/ai-chrome-devtools-profile"
log_file="${TMPDIR:-/tmp}/ai-chrome-devtools.log"
browser=""
tabs=""
if [ -z "$app_url" ]; then
printf 'Usage: task devtools:chrome -- <app-url>\n' >&2
exit 2
fi
if [ -n "${BROWSER_BIN:-}" ]; then
browser="$BROWSER_BIN"
elif [ -n "${CHROME_BIN:-}" ]; then
browser="$CHROME_BIN"
fi
if [ -z "$browser" ]; then
for candidate in \
"/Applications/Chromium.app/Contents/MacOS/Chromium" \
"$HOME/Applications/Chromium.app/Contents/MacOS/Chromium" \
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
"$HOME/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
do
if [ -x "$candidate" ]; then
browser="$candidate"
break
fi
done
fi
if [ -z "$browser" ]; then
for candidate in chromium chromium-browser google-chrome google-chrome-stable chrome; do
if command -v "$candidate" >/dev/null 2>&1; then
browser="$(command -v "$candidate")"
break
fi
done
fi
if [ -z "$browser" ]; then
printf 'Could not find Chromium or Chrome. Set BROWSER_BIN=/path/to/browser and try again.\n' >&2
exit 1
fi
mkdir -p "$profile"
nohup "$browser" \
--remote-debugging-address=127.0.0.1 \
--remote-debugging-port=9222 \
--user-data-dir="$profile" \
"$app_url" >"$log_file" 2>&1 &
for attempt in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
if tabs="$(curl -fsS "$endpoint" 2>/dev/null)"; then
case "$tabs" in
*"\"url\": \"$app_url\""*|*"\"url\": \"$app_url/\""*)
printf 'DevTools endpoint: %s\n' "$endpoint"
printf '%s\n' "$tabs"
exit 0
;;
esac
if [ "$app_url" = "about:blank" ]; then
printf 'DevTools endpoint: %s\n' "$endpoint"
printf '%s\n' "$tabs"
exit 0
fi
fi
sleep 0.5
done
if [ -n "$tabs" ]; then
printf 'DevTools endpoint responded, but the requested URL was not found: %s\n' "$app_url" >&2
printf '%s\n' "$tabs" >&2
else
printf 'Timed out waiting for DevTools endpoint: %s\n' "$endpoint" >&2
printf 'Browser log: %s\n' "$log_file" >&2
fi
exit 1
# Required until Claude Code supports `AGENTS.md` https://github.com/anthropics/claude-code/issues/6235
create-claude-md:
desc: Create CLAUDE.md files with @AGENTS.md import
dir: /{{.ROOT_DIR}}
cmds:
- find . -type f -name "AGENTS.md" -exec sh -c 'printf "@AGENTS.md\n" >
"$(dirname "$1")/CLAUDE.md"' _ {} \;
clean:
desc: Clean AI environment
cmds:
- find . -type f -name "CLAUDE.md" -delete
ccusage:
desc: Run ccusage tool
aliases: [cc]
cmd: ccusage {{.CLI_ARGS}}
compose:
desc: Run Docker Compose commands with environment variables
aliases: [dc]
cmds:
- docker-compose {{.CLI_ARGS | default "up -d"}}
remote:
desc: Open the remote GitHub repository in default browser
cmd: >
{{if eq OS "darwin"}}open{{else if eq OS "linux"}}xdg-open{{else if eq OS
"windows"}}start{{else}}open{{end}} $(git remote get-url origin | sed
's/\.git$//' | sed 's|git@github.com:|https://github.com/|')