forked from coder/agentapi
-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add go taskfile common tasks #492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,174 +1,61 @@ | ||
| version: '3' | ||
|
|
||
| vars: | ||
| DETECTED_LANGUAGES: Go, Bun/Node | ||
| DETECTED_LANGUAGE: Go | ||
|
|
||
| tasks: | ||
| default: | ||
| desc: List common tasks for detected language targets. | ||
| desc: List available tasks. | ||
| cmds: | ||
| - task --list | ||
|
|
||
| build: | ||
| desc: Build every detected language target ({{.DETECTED_LANGUAGES}}). | ||
| cmds: | ||
| - task: build:go | ||
| - task: build:chat | ||
| - task: build:docs | ||
|
|
||
| build:go: | ||
| internal: true | ||
| status: | ||
| - test ! -f go.mod | ||
| desc: Build the {{.DETECTED_LANGUAGE}} binary. | ||
| cmds: | ||
| - | | ||
| bash -euo pipefail -c ' | ||
| export GOCACHE="$PWD/.cache/go-build" | ||
| export GOTMPDIR="$PWD/.cache/go-tmp" | ||
| mkdir -p "$GOCACHE" | ||
| mkdir -p "$GOTMPDIR" | ||
| go build -o ./agentapi ./main.go | ||
| ' | ||
|
|
||
| build:chat: | ||
| internal: true | ||
| status: | ||
| - test ! -f package.json | ||
| dir: chat | ||
| cmds: | ||
| - | | ||
| bash -euo pipefail -c ' | ||
| if [ ! -d node_modules ]; then | ||
| bun install --frozen-lockfile | ||
| fi | ||
| rm -f .next/lock | ||
| bun run build | ||
| ' | ||
|
|
||
| build:docs: | ||
| internal: true | ||
| status: | ||
| - test ! -f package.json || test ! -d ../vendor/phenodocs/packages/docs | ||
| dir: docs | ||
| cmds: | ||
| - | | ||
| bash -euo pipefail -c ' | ||
| npm ci --ignore-scripts | ||
| node ./node_modules/vitepress/dist/node/cli.js build . | ||
| ' | ||
|
|
||
| test: | ||
| desc: Run tests for detected language targets ({{.DETECTED_LANGUAGES}}). | ||
| cmds: | ||
| - task: test:go | ||
|
|
||
| test:go: | ||
| internal: true | ||
| status: | ||
| - test ! -f go.mod | ||
| desc: Run the {{.DETECTED_LANGUAGE}} test suite. | ||
| cmds: | ||
| - | | ||
| bash -euo pipefail -c ' | ||
| export GOCACHE="$PWD/.cache/go-build" | ||
| export GOTMPDIR="$PWD/.cache/go-tmp" | ||
| mkdir -p "$GOCACHE" | ||
| mkdir -p "$GOTMPDIR" | ||
| go test -short ./... | ||
| ' | ||
|
|
||
| lint: | ||
| desc: Run linters for detected language targets ({{.DETECTED_LANGUAGES}}). | ||
| cmds: | ||
| - task: lint:go | ||
| - task: lint:chat | ||
|
|
||
| lint:go: | ||
| internal: true | ||
| status: | ||
| - test ! -f go.mod | ||
| desc: Run {{.DETECTED_LANGUAGE}} vet checks. | ||
| cmds: | ||
| - task --list >/dev/null | ||
| - | | ||
| bash -euo pipefail -c ' | ||
| export GOCACHE="$PWD/.cache/go-build" | ||
| export GOTMPDIR="$PWD/.cache/go-tmp" | ||
| mkdir -p "$GOCACHE" | ||
| mkdir -p "$GOTMPDIR" | ||
| git ls-files "*.go" ":!:agentapi-plusplus/**" | xargs gofmt -l | tee /tmp/agentapi-gofmt.out | ||
| test ! -s /tmp/agentapi-gofmt.out | ||
| go list ./... | xargs go vet | ||
| ' | ||
|
|
||
| lint:chat: | ||
| internal: true | ||
| status: | ||
| - test ! -f chat/package.json | ||
| cmds: | ||
| - | | ||
| bash -euo pipefail -c ' | ||
| cd chat | ||
| if [ ! -d node_modules ]; then | ||
| bun install --frozen-lockfile | ||
| fi | ||
| bun run lint | ||
| go list ./... | grep -Ev "/agentapi-plusplus($|/)" | xargs go vet | ||
| ' | ||
|
|
||
| clean: | ||
| desc: Remove generated build artifacts for detected language targets ({{.DETECTED_LANGUAGES}}). | ||
| cmds: | ||
| - task: clean:go | ||
| - task: clean:chat | ||
| - task: clean:docs | ||
|
|
||
| clean:go: | ||
| internal: true | ||
| status: | ||
| - test ! -f go.mod | ||
| desc: Remove generated {{.DETECTED_LANGUAGE}} build artifacts. | ||
| cmds: | ||
| - | | ||
| python3 - <<'PY' | ||
| from pathlib import Path | ||
| import os | ||
| from pathlib import Path | ||
| import shutil | ||
| import subprocess | ||
|
|
||
| os.environ["GOCACHE"] = str(Path(".cache/go-build").resolve()) | ||
| os.environ["GOTMPDIR"] = str(Path(".cache/go-tmp").resolve()) | ||
| Path(os.environ["GOCACHE"]).mkdir(parents=True, exist_ok=True) | ||
| Path(os.environ["GOTMPDIR"]).mkdir(parents=True, exist_ok=True) | ||
| subprocess.run(["go", "clean", "-cache", "-testcache"], check=True) | ||
| for path in [Path("agentapi"), Path(".cache/go-build"), Path(".cache/go-tmp")]: | ||
| subprocess.run(["go", "clean", "-cache", "-testcache"], check=False) | ||
| for path in [Path("agentapi"), Path(".cache/go-build")]: | ||
| if path.is_file() or path.is_symlink(): | ||
| path.unlink() | ||
| elif path.is_dir(): | ||
| shutil.rmtree(path) | ||
| PY | ||
|
|
||
| clean:chat: | ||
| internal: true | ||
| status: | ||
| - test ! -f chat/package.json | ||
| cmds: | ||
| - | | ||
| python3 - <<'PY' | ||
| from pathlib import Path | ||
| import shutil | ||
|
|
||
| for path in [Path("chat/.next"), Path("chat/out"), Path("chat/.turbo")]: | ||
| if path.exists(): | ||
| shutil.rmtree(path) | ||
| PY | ||
|
|
||
| clean:docs: | ||
| internal: true | ||
| status: | ||
| - test ! -f docs/package.json | ||
| cmds: | ||
| - | | ||
| python3 - <<'PY' | ||
| from pathlib import Path | ||
| import shutil | ||
|
|
||
| for path in [Path("docs/.vitepress/cache")]: | ||
| if path.exists(): | ||
| shutil.rmtree(path) | ||
| shutil.rmtree(path, ignore_errors=True) | ||
| PY | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Architect Review — HIGH
Taskfile now exposes only
default,build,test,lint, andclean, but WARP.md still instructs contributors to runtask lint:arch,task quality,task setup, andtask dev, so following the documented workflows results intask: Task "…" not founderrors.Suggestion: Either add compatibility wrapper tasks (aliases/composed tasks) for the documented commands or update WARP.md in this PR so the documented workflows match the new Go-only Taskfile surface.
Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖