-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
187 lines (160 loc) · 6.65 KB
/
Copy pathTaskfile.yml
File metadata and controls
187 lines (160 loc) · 6.65 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
version: '3'
vars:
TAGS: sqlite_fts5
# BIN is the dev build target. It deliberately writes to ~/.local/bin
# (no sudo, no system pollution). To make this build the system-wide
# `myco`, run `task install` after `task build` — that overwrites
# whichever `myco` is currently on PATH, following one level of symlink.
# Override the build target with: task build BIN=/some/other/path
BIN:
sh: echo "$HOME/.local/bin/myco"
tasks:
# ── build ────────────────────────────────────────────────────────────────────
build:
desc: Build the myco binary to ~/.local/bin/myco
cmds:
- mkdir -p "$(dirname {{.BIN}})"
- go build -tags {{.TAGS}} -o {{.BIN}} ./cmd/myco
sources:
- '**/*.go'
- go.mod
- go.sum
generates:
- '{{.BIN}}'
install:
desc: |
Install the freshly built binary over whichever `myco` is on PATH.
Resolves `command -v myco`, follows one level of symlink, and overwrites
the target. Falls back to /usr/local/bin/myco if no existing myco exists.
Use this after `task build` to make the dev binary the system-wide myco.
deps: [build]
cmds:
- |
set -eu
src="{{.BIN}}"
target="$(command -v myco 2>/dev/null || true)"
if [ -n "$target" ] && [ -L "$target" ]; then
linkval="$(readlink "$target")"
case "$linkval" in
/*) target="$linkval" ;;
*) target="$(cd "$(dirname "$target")" && pwd)/$linkval" ;;
esac
fi
if [ -z "$target" ]; then
target="/usr/local/bin/myco"
echo "No existing myco on PATH — installing to $target"
else
echo "Existing myco resolves to $target"
fi
# If src and target are literally the same file, `task build` already
# wrote the new binary in place — nothing left to do.
src_real="$(cd "$(dirname "$src")" && pwd)/$(basename "$src")"
target_real="$(cd "$(dirname "$target")" 2>/dev/null && pwd)/$(basename "$target")" || target_real="$target"
if [ "$src_real" = "$target_real" ]; then
echo " (PATH already points at the build target — $src)"
echo " version: $("$target" --version)"
exit 0
fi
echo " → overwriting"
dest_dir="$(dirname "$target")"
mkdir -p "$dest_dir" 2>/dev/null || true
if [ -w "$dest_dir" ] || { [ -e "$target" ] && [ -w "$target" ]; }; then
cp "$src" "$target"
else
echo "Need sudo to write $target"
sudo cp "$src" "$target"
fi
echo "installed myco to $target"
runs_from="$(command -v myco 2>/dev/null || true)"
echo " PATH resolves \`myco\` to: ${runs_from:-<not on PATH>}"
echo " version: $("$target" --version)"
# ── quality ──────────────────────────────────────────────────────────────────
vet:
desc: Run go vet
cmds:
- go vet -tags {{.TAGS}} ./...
test:
desc: Run the full test suite with the race detector
cmds:
- go test -tags {{.TAGS}} -race ./...
test-pkg:
desc: Test a single package (task test-pkg -- ./internal/telemetry/...)
cmds:
- go test -tags {{.TAGS}} -race -v {{.CLI_ARGS}}
check:
desc: vet + test (run before every push)
deps: [vet, test]
tidy:
desc: go mod tidy
cmds:
- go mod tidy
# ── dev ──────────────────────────────────────────────────────────────────────
smoke:
desc: Wipe index, re-index, run doctor — fastest correctness loop
deps: [build]
cmds:
- rm -rf .mycelium
- '{{.BIN}} index'
- '{{.BIN}} doctor'
daemon:
desc: Build then start the daemon (blocks; Ctrl-C to stop)
deps: [build]
cmds:
- '{{.BIN}} daemon'
index:
desc: One-shot index of the repo (daemon must not be running)
deps: [build]
cmds:
- '{{.BIN}} index'
doctor:
desc: Run health checks against the current index
cmds:
- '{{.BIN}} doctor'
# ── session / telemetry ──────────────────────────────────────────────────────
session-list:
desc: List all recorded agent sessions
cmds:
- '{{.BIN}} session list'
session-export:
desc: Export a session report (task session-export -- <session-id> [--format markdown])
cmds:
- '{{.BIN}} session export {{.CLI_ARGS}}'
session-compare:
desc: Side-by-side diff of two sessions (task session-compare -- <id-a> <id-b>)
cmds:
- '{{.BIN}} session compare {{.CLI_ARGS}}'
session-stats:
desc: Aggregate telemetry across all calls (requires telemetry.enabled in .mycelium.yml)
cmds:
- '{{.BIN}} stats --telemetry'
# ── hooks ────────────────────────────────────────────────────────────────────
hooks-install:
desc: Write Claude Code UserPromptSubmit/PostToolUse/Stop hooks to .claude/settings.json
deps: [build]
cmds:
- '{{.BIN}} session hooks install'
# ── release ──────────────────────────────────────────────────────────────────
tag:
desc: |
Create the next release tag (annotated). Defaults to patch bump of the
latest vX.Y.Z tag. Override: task tag -- v5.0.0
Push afterwards with: git push origin <tag>
cmds:
- |
set -eu
latest=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1 || true)
[ -z "$latest" ] && latest="v0.0.0"
if [ -n "{{.CLI_ARGS}}" ]; then
next="{{.CLI_ARGS}}"
else
major=$(echo "$latest" | sed 's/v\([0-9]*\)\..*/\1/')
minor=$(echo "$latest" | sed 's/v[0-9]*\.\([0-9]*\)\..*/\1/')
patch=$(echo "$latest" | sed 's/v[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/')
next="v${major}.${minor}.$((patch + 1))"
fi
echo "latest tag : $latest"
echo "new tag : $next"
git tag -a "$next" -m "release $next"
echo ""
echo "Tag created. Push with:"
echo " git push origin $next"