@turkit/workflow
Version:
Project-agnostic workflow Agent Skills (ticket lifecycle, reviews, ship, handoff) distributed via TanStack Intent.
100 lines (78 loc) • 4.54 kB
Markdown
---
name: turkit-init
description: Detect the project's build tool, package manager, base branch, and issue tracker, then propose a .turkit.yaml tailored to the repo. Writes the file only after operator confirmation.
disable-model-invocation: true
allowed-tools: Bash(git status:*), Bash(git symbolic-ref:*), Read, Grep, Glob, Write, Edit
---
# Turkit Init
Scan the current repo and propose a `.turkit.yaml` matching its build tool, package manager, base branch, and issue tracker. The operator reviews and confirms before the file is written.
## Steps
1. **Refuse to overwrite silently.** If `.turkit.yaml` already exists, read it first, show a diff of the proposed change, and ask whether to merge / overwrite / skip. Never overwrite without consent.
2. **Detect the build tool / package manager.** Scan the repo root in this order:
- `package.json` + `pnpm-lock.yaml` → pnpm
- `package.json` + `bun.lockb` → bun
- `package.json` + `yarn.lock` → yarn
- `package.json` alone → npm
- `Justfile` → just
- `Makefile` → make
- `Cargo.toml` → cargo
- `pyproject.toml` + `poetry.lock` → poetry
- `pyproject.toml` + `uv.lock` → uv
- `go.mod` → go
- Nothing recognizable → leave `commands:` empty; the operator fills it in manually.
3. **Resolve commands.** For the detected tool, map to turkit's five commands: `check`, `lint`, `fmt`, `test`, `build`.
- **package.json (pnpm / bun / yarn / npm)** — read `scripts.*` and pick by name convention:
- `check`: prefer `typecheck`, then `check`, then `tsc --noEmit` (only if `tsconfig.json` exists).
- `lint`: prefer `lint`, then `eslint .` (only if `.eslintrc*` or `eslint.config.*` exists).
- `fmt`: prefer `format`, `fmt`, then `prettier --write .` (only if `.prettierrc*` or `prettier.config.*` exists).
- `test`: prefer `test`, `vitest`, `jest`.
- `build`: prefer `build`, `vite build`, `tsc --build`.
- **Justfile / Makefile** — look for targets named `check`, `lint`, `fmt`, `test`, `build`. Use `just <target>` / `make <target>` verbatim.
- **cargo** — `cargo check`, `cargo clippy`, `cargo fmt`, `cargo test`, `cargo build`.
- **poetry / uv / go** — canonical commands per `docs/contracts/build-tool-detection.md`.
Omit any command you cannot resolve with confidence. Do not invent scripts. The runtime fallback in the build-tool contract will pick up the rest.
4. **Detect the base branch.** In order:
- `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null` (strip `refs/remotes/origin/`).
- Fallback: `main`. Never default to `master` — if the repo uses `master` you'll detect that via the symbolic-ref.
5. **Detect the issue tracker.** Report findings per `docs/contracts/issue-tracker-detection.md`:
- MCP match (name + how to invoke)
- Branch-name pattern only (show the current branch + extracted ticket ID if any)
- Nothing
This is informational — no config key is written for tracker detection.
6. **Propose the config.** Emit the full `.turkit.yaml` in a fenced block with a top comment that summarizes detection:
```yaml
# Generated by /turkit-workflow:turkit-init — detected <tool>, base <branch>, tracker <summary>
commands:
<key>: <resolved command>
...
base_branch: <branch>
```
7. **Ask before writing.** Show the proposed config + a one-line summary of what was detected and what was omitted. Then: *"Write this as `.turkit.yaml` at the repo root? [y/n]"*. Only write on explicit yes.
## Guardrails
- Never overwrite `.turkit.yaml` without showing the diff and getting consent.
- Never invent commands that won't actually run (don't default to `tsc --noEmit` without `tsconfig.json`, don't default to `prettier` without a prettier config, etc.).
- Never add a `tracker:` key or similar — tracker detection is fully runtime, not config-driven.
- Respond in the conversation's language by default.
## Example — pnpm / TypeScript project
Typical detection on a Vite + TypeScript repo with pnpm:
```yaml
# Generated by /turkit-workflow:turkit-init — detected pnpm, base main, Linear MCP available
commands:
check: pnpm typecheck
lint: pnpm lint
fmt: pnpm format
test: pnpm test
build: pnpm build
base_branch: main
```
## Example — Rust / just project
```yaml
# Generated by /turkit-workflow:turkit-init — detected just, base main, tracker via branch-name only
commands:
check: just check
lint: just lint
fmt: just fmt
test: just test
build: just build
base_branch: main
```