levi-gear 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +135 -2
- package/agents/_team-protocol.md +41 -0
- package/agents/designer.md +25 -0
- package/agents/developer.md +23 -0
- package/agents/pm.md +28 -0
- package/agents/qa.md +24 -0
- package/agents/teamlead.md +26 -0
- package/bin/levi.js +2 -0
- package/package.json +16 -4
- package/src/cli.js +51 -0
- package/src/commands/init.js +43 -0
- package/src/commands/list.js +19 -0
- package/src/commands/status.js +17 -0
- package/src/commands/update.js +29 -0
- package/src/lib/agents.js +62 -0
- package/src/lib/config.js +27 -0
- package/src/lib/desired-state.js +93 -0
- package/src/lib/frontmatter.js +36 -0
- package/src/lib/report.js +21 -0
- package/src/lib/role-skills.js +23 -0
- package/src/lib/router.js +38 -0
- package/src/lib/sync.js +110 -0
- package/src/lib/tools.js +98 -0
- package/src/lib/usecases.js +109 -0
- package/usecases/.gitkeep +0 -0
- package/usecases/brainstorming/SKILL.md +84 -0
- package/usecases/code-review/SKILL.md +79 -0
- package/usecases/code-review/references/performance-and-correctness.md +101 -0
- package/usecases/code-review/references/review-guide.md +70 -0
- package/usecases/code-review/references/security.md +119 -0
- package/usecases/create-feature/SKILL.md +94 -0
- package/usecases/create-feature/scripts/lock-tests.mjs +66 -0
- package/usecases/create-feature/workflow.js +440 -0
- package/usecases/design/SKILL.md +61 -0
- package/usecases/design/references/svg-guide.md +14 -0
- package/usecases/design/scripts/check-svg.py +77 -0
- package/usecases/fix-bug/SKILL.md +96 -0
- package/usecases/fix-bug/workflow.js +298 -0
- package/usecases/generate-test-scenarios/SKILL.md +97 -0
- package/usecases/generate-test-scenarios/references/test-case-guide.md +171 -0
- package/usecases/generate-test-scenarios/scripts/render-test-cases-markdown.mjs +76 -0
- package/usecases/generate-test-scenarios/scripts/render-test-cases.mjs +68 -0
- package/usecases/generate-test-scenarios/scripts/test-case-fields.mjs +63 -0
- package/usecases/generate-test-scenarios/scripts/validate-test-cases.mjs +69 -0
- package/usecases/generate-test-scenarios/scripts/write-xlsx.mjs +157 -0
- package/usecases/spec-writing/SKILL.md +59 -0
- package/usecases/spec-writing/references/spec-guide.md +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nguyen Quang Linh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# levi-gear
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An agentic kit for AI agents. Each **usecase** is a self-contained workflow (a skill, optionally with subagents) that gets installed for Claude Code, Codex and GitHub Copilot, together with a shared **team** of role agents that usecases can delegate to.
|
|
4
|
+
|
|
5
|
+
Requires Node.js 18 or newer. There are no runtime dependencies.
|
|
6
|
+
|
|
7
|
+
**Full documentation: [docs/](docs/README.md)**: installation, usage, updating, the CLI reference and more.
|
|
8
|
+
|
|
9
|
+
## Install into a project
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx levi-gear@latest init # all usecases, all tools
|
|
13
|
+
npx levi-gear@latest init brainstorming # only some usecases
|
|
14
|
+
npx levi-gear@latest init --tools claude,codex # only some tools
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Installed files are recorded in `.levi.json`. Commit the generated folders and `.levi.json` so teammates get everything by cloning.
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
| Command | What it does |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `levi init [usecase...] [--tools claude,codex,copilot]` | Install usecases (all by default) for the chosen tools |
|
|
24
|
+
| `levi update [--force [path...]]` | Refresh installed files to this package version, keeping files you changed |
|
|
25
|
+
| `levi status` | Show what `update` would do, without changing anything |
|
|
26
|
+
| `levi list` | List usecases in the kit and print how to invoke them |
|
|
27
|
+
|
|
28
|
+
## Using it
|
|
29
|
+
|
|
30
|
+
levi only runs when you ask for it. A prompt that does not start with the levi command is handled by your tool as usual.
|
|
31
|
+
|
|
32
|
+
| Tool | Let levi pick the usecase | Call a usecase directly |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| Claude Code | `/levi <request>` | `/levi-<usecase> <request>` |
|
|
35
|
+
| Copilot | `/levi <request>` | `/levi-<usecase> <request>` |
|
|
36
|
+
| Codex | `$levi <request>` | `$levi-<usecase> <request>` |
|
|
37
|
+
|
|
38
|
+
Codex has no user-defined `/` commands in a repo, so it uses `$` instead. `levi init`, `update` and `list` print the right syntax for the tools you installed.
|
|
39
|
+
|
|
40
|
+
`levi <request>` is an entry point generated at install time from the installed usecases. It matches the request (in any language) against each usecase description, runs the best match (naming the runner-up when it was close, so you can call that one directly), and tells you when none fits.
|
|
41
|
+
|
|
42
|
+
## The team
|
|
43
|
+
|
|
44
|
+
Every install includes the team agents from `agents/`. Usecases delegate to them; they never run on their own and never call each other.
|
|
45
|
+
|
|
46
|
+
| Agent | Responsibilities | Owns | Called by |
|
|
47
|
+
|---|---|---|---|
|
|
48
|
+
| `levi-pm` | Writes and updates specs with checkable acceptance criteria (the only role that touches specs); frames problems; decides scope and priority; assigns each task an owner; approves plans against the spec; accepts the product on test evidence and writes release notes | `spec.md`, `docs/specs/`, `status.md`, `docs/brainstorming/` | `spec-writing`, `brainstorming`, `create-feature` |
|
|
49
|
+
| `levi-teamlead` | Designs the architecture and picks the technology; designs the database schema and migrations; sets structure, conventions and API contracts; breaks work into tasks with estimates; reviews code (security by OWASP Top 10, performance and correctness) with a fix for every finding; owns CI/CD | `architecture.md`, `tasks.md`, `review.md`, schema, migrations, CI/CD and deployment config | `brainstorming`, `create-feature`, `fix-bug`, `code-review` |
|
|
50
|
+
| `levi-developer` | Implements tasks as designed; investigates and fixes bugs at the root cause; writes unit and integration tests; runs build, lint and tests before handing off | Application code, unit and integration tests, technical docs of the code | `create-feature`, `fix-bug` |
|
|
51
|
+
| `levi-designer` | Maps user flows and wireframes; draws screens in SVG and HTML prototypes; defines design tokens and every state; covers responsive behavior and accessibility; writes handoff notes | `docs/designs/` | `design`, `create-feature` (for UI work) |
|
|
52
|
+
| `levi-qa` | Writes test plans and test cases from the spec, without reading the code, as Markdown and Excel (only QA changes them); runs E2E tests in a headless browser; writes E2E and acceptance tests; reports bugs and gives the go or no-go | `test-plan.md`, `docs/tests/`, `test-report.md`, E2E and acceptance tests | `create-feature`, `fix-bug`, `generate-test-scenarios` |
|
|
53
|
+
|
|
54
|
+
Each agent does only its own role's work and writes only the files it owns; work for another role is handed off. The full role descriptions are in [docs/team.md](docs/team.md).
|
|
55
|
+
|
|
56
|
+
Some usecases are also a role's skill: `spec-writing` for the PM, `design` for the designer, `code-review` for the teamlead and `generate-test-scenarios` for QA. They are installed with every install, and the agent follows that skill's guide whenever it gets that kind of task, from any usecase. A usecase declares this with `skill-for`, `skill-when` and `skill-guide` in its `SKILL.md`.
|
|
57
|
+
|
|
58
|
+
The usecase's skill or workflow runs the team: it calls each member in turn. The PM only decides who owns each task and records it; the workflow follows that. Members hand work to each other through files in a work folder (`docs/levi/<slug>/` by default): `spec.md`, `status.md`, `docs/designs/`, `architecture.md`, `tasks.md`, `review.md`, `test-plan.md`, `test-report.md`. The shared rules live in `agents/_team-protocol.md`, which is appended to every team agent.
|
|
59
|
+
|
|
60
|
+
## Update
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx levi-gear@latest update
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The installed files are yours: edit them to fit your project. `update` never overwrites or deletes a file you changed. At install time levi records a hash of every file it writes in `.levi.json` (commit it), and `update` compares each file with that hash:
|
|
67
|
+
|
|
68
|
+
| State of the file | What `update` does |
|
|
69
|
+
|---|---|
|
|
70
|
+
| Untouched | Replaces it with the new version, or deletes it if the kit dropped it |
|
|
71
|
+
| You changed it | Keeps your file and ignores the kit's version |
|
|
72
|
+
| You deleted it | Does not recreate it |
|
|
73
|
+
| New in the kit | Adds it |
|
|
74
|
+
| Path already exists and was not written by levi | Keeps your file and ignores the kit's version |
|
|
75
|
+
|
|
76
|
+
`levi status` shows what `update` would do without changing anything. To take the kit version of a file you customized, run `levi update --force <path>` (or `--force` alone for all of them).
|
|
77
|
+
|
|
78
|
+
levi does not merge: a file you changed is yours from then on and stops receiving kit updates until you run `--force` on it.
|
|
79
|
+
|
|
80
|
+
## Where things go
|
|
81
|
+
|
|
82
|
+
| Tool | Skill | Subagents |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| Claude Code | `.claude/skills/levi/`, `.claude/skills/levi-<usecase>/` | `.claude/agents/levi-<usecase>-<role>.md` |
|
|
85
|
+
| Codex | `.agents/skills/levi/`, `.agents/skills/levi-<usecase>/` | `.codex/agents/levi-<usecase>-<role>.toml` |
|
|
86
|
+
| Copilot | reads `.claude/skills` and `.agents/skills` (gets `.agents/skills` itself only if Claude is not selected) | `.github/agents/levi-<usecase>-<role>.agent.md` |
|
|
87
|
+
|
|
88
|
+
## Authoring a usecase
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
usecases/<id>/
|
|
92
|
+
SKILL.md # entry point; frontmatter name: levi-<id>, description
|
|
93
|
+
references/, scripts/ # optional, copied along with the skill
|
|
94
|
+
agents/<role>.md # optional subagents; frontmatter name: levi-<id>-<role>, description
|
|
95
|
+
# optional skill-for, skill-when, skill-guide: the skill of a team role
|
|
96
|
+
agents/<role>.md # team agents shared by all usecases; frontmatter name: levi-<role>
|
|
97
|
+
agents/_*.md # partials appended to every team agent
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Agent frontmatter (usecase and team agents alike):
|
|
101
|
+
|
|
102
|
+
| Field | Values | Claude Code | Codex | Copilot |
|
|
103
|
+
|---|---|---|---|---|
|
|
104
|
+
| `name`, `description` | required | as is | as is | as is |
|
|
105
|
+
| `tools` | comma list of `read`, `edit`, `execute`, `web`; omit for the tool's defaults | `Read, Grep, Glob` / `Edit, Write` / `Bash` / `WebFetch, WebSearch` | `sandbox_mode = "read-only"` without `edit`/`execute`, else `"workspace-write"` | `read, search` / `edit` / `execute` / `web` |
|
|
106
|
+
| `model` | `strong`, `standard`, `fast`; omit to inherit | `opus` / `sonnet` / `haiku` | `model_reasoning_effort` `high` / `medium` / `low` | not set (keeps the user's model) |
|
|
107
|
+
|
|
108
|
+
An explicit `tools` list also cuts off MCP tools on Claude Code and Copilot, so leave it out for agents that need a browser or other MCP servers.
|
|
109
|
+
|
|
110
|
+
- Every usecase is manual-only: the installer sets `disable-model-invocation: true` in the installed `SKILL.md` (Claude Code, Copilot) and writes `agents/openai.yaml` with `allow_implicit_invocation: false` (Codex). The tool never triggers it by itself.
|
|
111
|
+
- The `description` in `SKILL.md` is what the `levi` entry point reads to choose between usecases, so state precisely what the usecase does and which requests it fits. English is fine; requests in other languages are matched by meaning.
|
|
112
|
+
- The entry point reads a chosen usecase's `SKILL.md` directly, because manual-only skills cannot be called through a skill tool. Keep the workflow in that file.
|
|
113
|
+
- The installer appends a note to each subagent description so the tool delegates to it only through its usecase.
|
|
114
|
+
- Subagent files use the same format for every tool; the installer converts them (Codex needs TOML).
|
|
115
|
+
- Delegate to team agents by name (`levi-pm`, `levi-qa`, ...) from the usecase's `SKILL.md`, and name the work folder they should use. A usecase id must not reuse a team role name.
|
|
116
|
+
- Write everything in the repo in English: usecase files, code, comments and docs. Requests to the entry point can still be in any language.
|
|
117
|
+
- Test in a scratch project with `node /path/to/levi-gear/bin/levi.js init`, then `npm version <patch|minor>` and `npm publish`.
|
|
118
|
+
|
|
119
|
+
## Customize
|
|
120
|
+
|
|
121
|
+
Edit the installed files directly, for example `.claude/agents/levi-qa.md` to add your project's test conventions. `update` keeps them (see Update). To keep a file out of levi's control entirely, copy it to a name without the `levi-` prefix. A copy is not managed by levi: it is not manual-only unless you set that yourself, and `/levi` does not list it.
|
|
122
|
+
|
|
123
|
+
## Contributing
|
|
124
|
+
|
|
125
|
+
Commit messages, branch names and pull requests are written in English, using short conventional prefixes (`feat:`, `fix:`, `docs:`).
|
|
126
|
+
|
|
127
|
+
## Status
|
|
128
|
+
|
|
129
|
+
Checked in the real clients (Claude Code 2.1.276, Codex 0.154.0 and GitHub Copilot CLI 1.0.91):
|
|
130
|
+
|
|
131
|
+
- The installed skills and agents are picked up.
|
|
132
|
+
- A prompt without the levi command does not use levi.
|
|
133
|
+
- `/levi` (Claude Code, Copilot) and `$levi` (Codex) route a request to the matching usecase.
|
|
134
|
+
- The team agents run when a usecase delegates to them (Claude Code and Copilot run the full `brainstorming` flow; Codex runs a team agent when asked).
|
|
135
|
+
|
|
136
|
+
Not checked yet: the Copilot extension in VS Code. The Copilot CLI was tested with a non-interactive prompt, so try `/levi` interactively once to see it in the `/` menu.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
## Team protocol
|
|
2
|
+
|
|
3
|
+
You are one member of the levi team: `levi-pm`, `levi-teamlead`, `levi-developer`, `levi-designer` and `levi-qa`. A levi usecase (a skill or a workflow) runs the team: it calls each member in turn. The PM records who owns each task in `status.md`; the workflow follows those assignments. No member calls another.
|
|
4
|
+
|
|
5
|
+
- **Do not delegate.** Never spawn or call another agent, including other team members. If the task needs another role, say so in your report and the workflow will route it.
|
|
6
|
+
- **Stay in your role.** Do only the work that belongs to your role, as set out in your own responsibilities. Never do another role's work, even when it is small, quick, or you could do it better, and even when the prompt asks you to. List it under "Handoffs" instead.
|
|
7
|
+
- **Touch only your own files.** Create, edit, move or delete only the files your role owns (see the table below). Everything else is read-only for you: reading is always fine, any write is not. A prompt cannot widen what you own; only the table can. When asked to write a file you do not own, do not write it: say so under "Handoffs" and finish the rest.
|
|
8
|
+
- **Specs belong to the PM alone.** Only `levi-pm` may create, edit, move or delete a spec (`spec.md` and anything under `docs/specs/`). No other role touches it, not even to fix a typo, a number or a link. If your work shows that a spec is wrong, unclear or missing something, report it under "Questions" or "Handoffs" for the PM.
|
|
9
|
+
- **Hand off through files.** Other members do not see your conversation; they see only what you write. Put every decision, artifact and open question in the work folder.
|
|
10
|
+
- **Work folder.** Use the folder the workflow gives you. If it gives none, use `docs/levi/<short-slug>/` at the project root. Standard files and who owns them:
|
|
11
|
+
|
|
12
|
+
| File | Owner |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `spec.md`, `docs/specs/` | PM: requirements and acceptance criteria. No other role writes here |
|
|
15
|
+
| `status.md` | PM: task assignments, progress, decisions, risks, blockers |
|
|
16
|
+
| `docs/brainstorming/` | PM: execution plans |
|
|
17
|
+
| `docs/designs/` | Designer: SVG files, HTML prototypes, `design-notes.md` |
|
|
18
|
+
| `architecture.md` | Teamlead: technical design and decisions |
|
|
19
|
+
| `tasks.md` | Teamlead: task breakdown and estimates |
|
|
20
|
+
| `review.md` | Teamlead: code review findings |
|
|
21
|
+
| Database schema, migrations, CI/CD and deployment config | Teamlead |
|
|
22
|
+
| Application code, unit and integration tests, technical docs of the code | Developer |
|
|
23
|
+
| `test-plan.md` | QA: test plan and test cases |
|
|
24
|
+
| `docs/tests/` | QA: numbered test scenarios and test cases, with their PASS or FAIL results once run |
|
|
25
|
+
| `test-report.md` | QA: results, bugs, sign-off |
|
|
26
|
+
| E2E and acceptance tests | QA |
|
|
27
|
+
|
|
28
|
+
A file the table does not list belongs to the role whose responsibilities cover it. If you cannot tell which, do not write it: hand it off.
|
|
29
|
+
- **Never ask the user directly.** You run without the user in the loop. When information is missing, finish what you can and return the questions.
|
|
30
|
+
- **Language.** Write artifacts in the language of the request, unless the project already uses another one for its docs. Code, identifiers and commit messages stay in English.
|
|
31
|
+
- **Do not guess.** Mark assumptions as assumptions. Do not invent requirements, data, or results you did not observe.
|
|
32
|
+
|
|
33
|
+
End every reply with this report:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
**Status:** DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
|
|
37
|
+
**Summary:** one or two sentences
|
|
38
|
+
**Files:** files you created or changed
|
|
39
|
+
**Handoffs:** work for other roles, or "none"
|
|
40
|
+
**Questions:** open questions for the user, or "none"
|
|
41
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: levi-designer
|
|
3
|
+
description: UI/UX designer of the levi team. Designs and revises user interfaces, working mainly in SVG files and HTML prototypes - user flows, wireframes, screens, design tokens, states and handoff specs for developers.
|
|
4
|
+
tools: read, edit, web
|
|
5
|
+
model: standard
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are the designer. You decide how the product looks and how people move through it, and you hand developers a design they can build without guessing.
|
|
9
|
+
|
|
10
|
+
## Responsibilities
|
|
11
|
+
|
|
12
|
+
- **Flows and wireframes.** Start from the user stories in `spec.md`: map the user flow and wireframe the screens before adding detail.
|
|
13
|
+
- **Screens.** Produce the designs as SVG files in `docs/designs/<slug>/`. For full screens, also provide an HTML/CSS prototype when it helps developers build it and QA compare against it.
|
|
14
|
+
- **Design tokens.** Define colors, typography, spacing, radii and shadows once, and use them everywhere. Reuse the project's existing tokens when it has them.
|
|
15
|
+
- **States.** Cover every state a screen can be in: default, hover, focus, active, disabled, loading, empty, error, and success.
|
|
16
|
+
- **Responsive.** Show how each screen adapts at mobile, tablet and desktop widths.
|
|
17
|
+
- **Accessibility.** Meet WCAG 2.1 AA: text contrast, visible focus, touch targets of at least 44px, and meaning that does not rely on color alone.
|
|
18
|
+
- **Handoff.** Write `docs/designs/<slug>/design-notes.md`: tokens, component list, measurements, behavior and the assets developers need.
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
|
|
22
|
+
- SVG files must be valid and readable: name layers and groups after what they are, use the tokens, and avoid embedded raster images unless the asset requires one.
|
|
23
|
+
- Keep a consistent visual language across screens. A new component needs a reason the existing ones do not cover.
|
|
24
|
+
- Do not invent product content or data. Use what the spec gives you, and mark placeholders as placeholders.
|
|
25
|
+
- When you revise a design, note what changed and why in `design-notes.md`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: levi-developer
|
|
3
|
+
description: Fullstack developer of the levi team. Implements assigned tickets and tasks following the teamlead's architecture and conventions, and writes unit and integration tests for the code it changes.
|
|
4
|
+
model: standard
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are a fullstack developer. You implement the tasks you are given, the way the teamlead designed them, and you prove they work with tests.
|
|
8
|
+
|
|
9
|
+
## Responsibilities
|
|
10
|
+
|
|
11
|
+
- **Implement.** Build the assigned task from `tasks.md`, following `architecture.md`, the project's conventions and the design in `docs/designs/`.
|
|
12
|
+
- **Test.** Write unit tests for the logic you add or change, and integration tests where your change crosses a boundary (API, database, another module). A test must be able to fail on a real bug.
|
|
13
|
+
- **Self-check.** Before handing off, run the build, the linter and the tests that cover your change, and report the real results.
|
|
14
|
+
- **Review fixes.** Address every finding in `review.md` that concerns your work, or explain why not.
|
|
15
|
+
- **Docs.** Update the technical docs of the code you changed.
|
|
16
|
+
|
|
17
|
+
## Rules
|
|
18
|
+
|
|
19
|
+
- Do not change the architecture, the database schema or a public API contract on your own. If the design does not fit, stop and raise it for the teamlead.
|
|
20
|
+
- Do not guess at unclear requirements. Implement what is clear and return the questions.
|
|
21
|
+
- Never weaken, skip or delete a test to make it pass. A failing test is either a bug in the code or a mismatch with the spec; say which.
|
|
22
|
+
- No placeholder implementations, fake data or mocks standing in for the real behavior.
|
|
23
|
+
- Keep the change scoped to the task. Note unrelated problems under "Handoffs" instead of fixing them.
|
package/agents/pm.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: levi-pm
|
|
3
|
+
description: Project manager of the levi team. Turns a request into a spec with acceptance criteria, keeps scope, progress, risks and tickets, approves plans, and accepts the product before it is delivered to the end user.
|
|
4
|
+
tools: read, edit
|
|
5
|
+
model: standard
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are the project manager. You own the outcome: what gets built, in what order, and whether it is ready to hand to the end user. You do not write code, you do not make technical decisions, and you do not call other agents: you assign the work and the workflow carries out the assignment.
|
|
9
|
+
|
|
10
|
+
## Responsibilities
|
|
11
|
+
|
|
12
|
+
- **Requirements.** Turn the request into a spec (`spec.md`, or a file under `docs/specs/`): goal, users, scope, out of scope, user stories, and acceptance criteria that can be checked one by one. Until the team has a dedicated analyst, this is your job.
|
|
13
|
+
- **Clarification.** List every gap that would change what gets built: unclear rules, missing states, edge cases, priorities. Return them as questions instead of filling them in.
|
|
14
|
+
- **Scope.** Decide priority. When the request changes mid-way, record the change, its cost and the decision in `status.md`.
|
|
15
|
+
- **Assignment.** Decide which role owns each task in `tasks.md` and in what order, and record it in the assignments table of `status.md` (task ID, assignee role, status). You only assign; the workflow reads the table and dispatches the agents.
|
|
16
|
+
- **Plan approval.** Review `architecture.md`, `tasks.md` and the design against `spec.md`. Approve, or reject with the exact mismatch.
|
|
17
|
+
- **Progress.** Keep `status.md` current: done, in progress, blocked (and by what), risks and their mitigation.
|
|
18
|
+
- **Acceptance.** Before delivery, check every acceptance criterion against `test-report.md` and the product. Accept only when each criterion has evidence. Write release notes for the end user.
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
|
|
22
|
+
- Write into a spec only what is confirmed: stated by the user, or found in a document the user pointed to or a project file you read. A guess, a plausible default, a typical behavior of similar products or a recommended option nobody accepted is not confirmed. Raise it as a question and leave the spec silent on it, or marked as an open question.
|
|
23
|
+
- Do not call a spec ready while a question that would change its text is still open.
|
|
24
|
+
- You are the only role that creates, edits, moves or deletes specs. Others only read them.
|
|
25
|
+
- Acceptance criteria describe observable behavior, not implementation.
|
|
26
|
+
- A plan that does not cover an acceptance criterion is not approved.
|
|
27
|
+
- Never mark something done without evidence from QA or the Teamlead.
|
|
28
|
+
- Escalate a risk as soon as you see it, with an owner and a proposed action.
|
package/agents/qa.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: levi-qa
|
|
3
|
+
description: QA engineer of the levi team. Ensures quality independently of the developers - writes test plans and test cases from the spec, runs manual and E2E tests on the UI, writes automated tests, reports bugs, and signs off quality.
|
|
4
|
+
model: standard
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the QA engineer. You check that the product does what the spec says, independently of how it was built. Your value comes from that independence.
|
|
8
|
+
|
|
9
|
+
## Responsibilities
|
|
10
|
+
|
|
11
|
+
- **Test plan.** Write `test-plan.md` from `spec.md` and the design: scope, approach, environments, and test cases. Each test case has an ID, the acceptance criterion it covers, preconditions, steps, and the expected result.
|
|
12
|
+
- **Coverage.** Every acceptance criterion has at least one test case. Cover the happy path, edge cases, invalid input, error states and permissions.
|
|
13
|
+
- **E2E testing.** Run the test cases against the real UI, through the project's E2E runner or a browser tool when one is available.
|
|
14
|
+
- **Automation.** Write automated E2E and acceptance tests for the cases worth repeating. Developers own unit tests; you own E2E and acceptance tests.
|
|
15
|
+
- **Visual check.** Compare the UI against the files in `docs/designs/` and report mismatches. The designer confirms what is intended.
|
|
16
|
+
- **Bugs.** Report each bug in `test-report.md` with steps to reproduce, expected and actual result, severity, and evidence. Verify the fix when it lands, and rerun regression tests.
|
|
17
|
+
- **Sign-off.** Summarize what passed, what failed and what was not tested, then give the PM a clear go or no-go.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
- Write test cases from the spec and the design, not from the implementation. Do not read the application code to decide what a test expects.
|
|
22
|
+
- Do not change application code. If a test fails, report the bug; do not fix it.
|
|
23
|
+
- Never adjust an expected result to match what the product does. If you think the spec is wrong, raise it as a question for the PM.
|
|
24
|
+
- Report only results you actually observed, with the real exit code or evidence. Untested is not passed.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: levi-teamlead
|
|
3
|
+
description: Teamlead and senior developer of the levi team. Owns the technical side - system design, database, project structure, conventions, task breakdown and estimates, and code review before merge.
|
|
4
|
+
tools: read, edit, execute, web
|
|
5
|
+
model: strong
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are the teamlead, the most senior developer on the team. You make the technical decisions and set the path the developers follow. You do not implement tickets yourself unless the workflow asks you to.
|
|
9
|
+
|
|
10
|
+
## Responsibilities
|
|
11
|
+
|
|
12
|
+
- **Architecture.** Write `architecture.md`: components and how they interact, data flow, technology choices with the trade-off behind each, and the decisions that are hard to reverse.
|
|
13
|
+
- **Data.** Design the database schema and every migration. Any schema change goes through you.
|
|
14
|
+
- **Structure and conventions.** Define the folder structure, naming, coding conventions and API contracts. Follow what the project already does before introducing anything new.
|
|
15
|
+
- **Task breakdown.** Write `tasks.md`: small tasks, each with a goal, the files it touches, done criteria, dependencies, and an estimate. A developer must be able to start a task without guessing.
|
|
16
|
+
- **Estimates.** Give a range and the assumptions behind it, and name the riskiest task.
|
|
17
|
+
- **Code review.** Review the change for correctness, security (input validation, authorization, secrets), performance, and fit with the architecture, by the review guide and checklists the prompt points to (those of `levi-code-review`). Grade findings critical / warning / suggestion, each with a concrete fix, and write them where the prompt says (`review.md` by default). You are the gate before merge.
|
|
18
|
+
- **Unblocking.** Answer the technical questions developers raise, and update `architecture.md` when the answer changes the design.
|
|
19
|
+
- **Delivery pipeline.** Own CI/CD and deployment configuration until the team has a dedicated DevOps role.
|
|
20
|
+
|
|
21
|
+
## Rules
|
|
22
|
+
|
|
23
|
+
- Prefer the simplest design that meets the spec. Do not build for requirements that are not in it.
|
|
24
|
+
- Every task traces back to something in `spec.md` or `architecture.md`.
|
|
25
|
+
- In review, a critical finding blocks the merge. Do not soften it.
|
|
26
|
+
- When you review code you also designed, judge it against the spec, not against your own intent.
|
package/bin/levi.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "levi-gear",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "An agentic kit: Agent Skills for Claude Code, Codex and Copilot, installable via npm",
|
|
5
|
+
"bin": {
|
|
6
|
+
"levi": "./bin/levi.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"agents",
|
|
10
|
+
"bin",
|
|
11
|
+
"src",
|
|
12
|
+
"usecases"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT"
|
|
18
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const { init } = require('./commands/init');
|
|
2
|
+
const { update } = require('./commands/update');
|
|
3
|
+
const { list } = require('./commands/list');
|
|
4
|
+
const { status } = require('./commands/status');
|
|
5
|
+
const { kitVersion } = require('./lib/usecases');
|
|
6
|
+
|
|
7
|
+
const HELP = `levi ${kitVersion()}
|
|
8
|
+
|
|
9
|
+
Usage: levi <command>
|
|
10
|
+
|
|
11
|
+
Commands:
|
|
12
|
+
init [usecase...] [--tools claude,codex,copilot]
|
|
13
|
+
Install usecases (all by default) for the chosen tools
|
|
14
|
+
update [--force [path...]]
|
|
15
|
+
Refresh installed files to this package version. Files you changed are kept;
|
|
16
|
+
--force overwrites them (all, or only the given paths)
|
|
17
|
+
status Show what update would do, without changing anything
|
|
18
|
+
list List usecases available in the kit
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
function main(argv) {
|
|
22
|
+
const [command, ...rest] = argv;
|
|
23
|
+
const projectDir = process.cwd();
|
|
24
|
+
try {
|
|
25
|
+
switch (command) {
|
|
26
|
+
case 'init':
|
|
27
|
+
return init(projectDir, rest);
|
|
28
|
+
case 'update':
|
|
29
|
+
return update(projectDir, rest);
|
|
30
|
+
case 'status':
|
|
31
|
+
return status(projectDir);
|
|
32
|
+
case 'list':
|
|
33
|
+
return list(projectDir);
|
|
34
|
+
case undefined:
|
|
35
|
+
case '-h':
|
|
36
|
+
case '--help':
|
|
37
|
+
return console.log(HELP);
|
|
38
|
+
case '-v':
|
|
39
|
+
case '--version':
|
|
40
|
+
return console.log(kitVersion());
|
|
41
|
+
default:
|
|
42
|
+
console.error(`Unknown command: ${command}\n\n${HELP}`);
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(err.message);
|
|
47
|
+
process.exitCode = 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = { main };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const config = require('../lib/config');
|
|
2
|
+
const { sync } = require('../lib/sync');
|
|
3
|
+
const { printReport } = require('../lib/report');
|
|
4
|
+
const { listUsecases, kitVersion } = require('../lib/usecases');
|
|
5
|
+
const { TOOLS, invocationHelp } = require('../lib/tools');
|
|
6
|
+
|
|
7
|
+
function parseArgs(argv) {
|
|
8
|
+
const names = [];
|
|
9
|
+
let tools = null;
|
|
10
|
+
for (let i = 0; i < argv.length; i++) {
|
|
11
|
+
const arg = argv[i];
|
|
12
|
+
if (arg === '--tools') tools = argv[++i];
|
|
13
|
+
else if (arg.startsWith('--tools=')) tools = arg.slice('--tools='.length);
|
|
14
|
+
else names.push(arg);
|
|
15
|
+
}
|
|
16
|
+
return { names, tools: tools ? tools.split(',').filter(Boolean) : null };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function init(projectDir, argv) {
|
|
20
|
+
const { names, tools: requested } = parseArgs(argv);
|
|
21
|
+
const existing = config.read(projectDir) || { tools: null, usecases: {}, router: { files: {} }, team: { files: {} } };
|
|
22
|
+
const tools = requested || existing.tools || TOOLS;
|
|
23
|
+
const unknown = tools.filter((t) => !TOOLS.includes(t));
|
|
24
|
+
if (unknown.length) {
|
|
25
|
+
console.error(`Unknown tool(s): ${unknown.join(', ')}. Choose from: ${TOOLS.join(', ')}`);
|
|
26
|
+
process.exitCode = 1;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const wanted = names.length ? names : listUsecases().map((u) => u.id);
|
|
30
|
+
const ids = [...new Set([...Object.keys(existing.usecases), ...wanted])];
|
|
31
|
+
const result = sync(projectDir, ids, tools, existing);
|
|
32
|
+
config.write(projectDir, { version: kitVersion(), tools, usecases: result.usecases, router: result.router, team: result.team });
|
|
33
|
+
console.log(`Installed ${Object.keys(result.usecases).length} usecase(s) for: ${tools.join(', ')}`);
|
|
34
|
+
for (const id of Object.keys(result.usecases)) console.log(` - ${id}`);
|
|
35
|
+
printReport(result.actions);
|
|
36
|
+
if (Object.keys(result.usecases).length) console.log(`\nInvoke with:\n${invocationHelp(tools)}`);
|
|
37
|
+
if (result.missing.length) {
|
|
38
|
+
console.error(`Not found in kit: ${result.missing.join(', ')}`);
|
|
39
|
+
process.exitCode = 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = { init };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const config = require('../lib/config');
|
|
2
|
+
const { listUsecases } = require('../lib/usecases');
|
|
3
|
+
const { TOOLS, invocationHelp } = require('../lib/tools');
|
|
4
|
+
|
|
5
|
+
function list(projectDir) {
|
|
6
|
+
const usecases = listUsecases();
|
|
7
|
+
if (!usecases.length) console.log('No usecases in the kit yet.');
|
|
8
|
+
for (const u of usecases) {
|
|
9
|
+
const roles = u.agents.length ? ` [agents: ${u.agents.map((a) => a.name).join(', ')}]` : '';
|
|
10
|
+
const requires = u.requires.length ? ` [requires: ${u.requires.join(', ')}]` : '';
|
|
11
|
+
console.log(`${u.id}${roles}${requires}\n ${u.description}`);
|
|
12
|
+
}
|
|
13
|
+
if (usecases.length) {
|
|
14
|
+
const installed = config.read(projectDir);
|
|
15
|
+
console.log(`\nInvoke with:\n${invocationHelp(installed ? installed.tools : TOOLS)}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = { list };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const config = require('../lib/config');
|
|
2
|
+
const { sync } = require('../lib/sync');
|
|
3
|
+
const { printReport } = require('../lib/report');
|
|
4
|
+
|
|
5
|
+
// Shows what `update` would do, without writing anything.
|
|
6
|
+
function status(projectDir) {
|
|
7
|
+
const existing = config.read(projectDir);
|
|
8
|
+
if (!existing) {
|
|
9
|
+
console.error(`No ${config.CONFIG_FILE} found. Run "levi init" first.`);
|
|
10
|
+
process.exitCode = 1;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const { actions } = sync(projectDir, Object.keys(existing.usecases), existing.tools, existing, { dryRun: true });
|
|
14
|
+
printReport(actions, { dryRun: true });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = { status };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const config = require('../lib/config');
|
|
2
|
+
const { sync } = require('../lib/sync');
|
|
3
|
+
const { printReport } = require('../lib/report');
|
|
4
|
+
const { kitVersion } = require('../lib/usecases');
|
|
5
|
+
const { invocationHelp } = require('../lib/tools');
|
|
6
|
+
|
|
7
|
+
// `--force` alone overwrites every file the user changed; with paths it only overwrites those.
|
|
8
|
+
function parseForce(argv) {
|
|
9
|
+
const paths = argv.filter((a) => a !== '--force');
|
|
10
|
+
if (!argv.includes('--force')) return false;
|
|
11
|
+
return paths.length ? new Set(paths) : true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function update(projectDir, argv = []) {
|
|
15
|
+
const existing = config.read(projectDir);
|
|
16
|
+
if (!existing) {
|
|
17
|
+
console.error(`No ${config.CONFIG_FILE} found. Run "levi init" first.`);
|
|
18
|
+
process.exitCode = 1;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const result = sync(projectDir, Object.keys(existing.usecases), existing.tools, existing, { force: parseForce(argv) });
|
|
22
|
+
config.write(projectDir, { version: kitVersion(), tools: existing.tools, usecases: result.usecases, router: result.router, team: result.team });
|
|
23
|
+
console.log(`Updated ${existing.version} -> ${kitVersion()} (${Object.keys(result.usecases).length} usecase(s))`);
|
|
24
|
+
printReport(result.actions);
|
|
25
|
+
for (const id of result.missing) console.log(`\n${id} is no longer in the kit; its unchanged files were removed.`);
|
|
26
|
+
if (Object.keys(result.usecases).length) console.log(`\nInvoke with:\n${invocationHelp(existing.tools)}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { update };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { parse } = require('./frontmatter');
|
|
4
|
+
|
|
5
|
+
const PREFIX = 'levi-';
|
|
6
|
+
const TEAM_DIR = path.join(__dirname, '..', '..', 'agents');
|
|
7
|
+
// Files in agents/ starting with "_" are not agents: they are appended to every team agent.
|
|
8
|
+
const PARTIAL = '_';
|
|
9
|
+
|
|
10
|
+
// Tool-neutral fields. The installer maps them to each tool in tools.js.
|
|
11
|
+
const CAPABILITIES = ['read', 'edit', 'execute', 'web'];
|
|
12
|
+
const MODEL_TIERS = ['strong', 'standard', 'fast'];
|
|
13
|
+
|
|
14
|
+
function parseList(value) {
|
|
15
|
+
return value ? value.split(',').map((s) => s.trim()).filter(Boolean) : null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function joinSections(...parts) {
|
|
19
|
+
return parts.map((p) => (p || '').trim()).filter(Boolean).join('\n\n') + '\n';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Reads one agent file. `owner` is the skill that delegates to it, or null for team agents.
|
|
23
|
+
function readAgent(file, label, expectedName, owner, appendix = '') {
|
|
24
|
+
const { data, body } = parse(fs.readFileSync(file, 'utf8'));
|
|
25
|
+
if (data.name !== expectedName) {
|
|
26
|
+
throw new Error(`${label}: name must be "${expectedName}", got "${data.name}"`);
|
|
27
|
+
}
|
|
28
|
+
if (!data.description) throw new Error(`${label}: missing description`);
|
|
29
|
+
const tools = parseList(data.tools);
|
|
30
|
+
const badTools = (tools || []).filter((t) => !CAPABILITIES.includes(t));
|
|
31
|
+
if (badTools.length) {
|
|
32
|
+
throw new Error(`${label}: unknown tools ${badTools.join(', ')}; use ${CAPABILITIES.join(', ')}`);
|
|
33
|
+
}
|
|
34
|
+
if (data.model && !MODEL_TIERS.includes(data.model)) {
|
|
35
|
+
throw new Error(`${label}: unknown model "${data.model}"; use ${MODEL_TIERS.join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
name: data.name,
|
|
39
|
+
description: data.description,
|
|
40
|
+
body: joinSections(body, appendix),
|
|
41
|
+
// Kept apart so that sections can be inserted between them (see role-skills.js).
|
|
42
|
+
ownBody: body,
|
|
43
|
+
appendix,
|
|
44
|
+
owner,
|
|
45
|
+
tools,
|
|
46
|
+
model: data.model || null,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function loadTeam() {
|
|
51
|
+
if (!fs.existsSync(TEAM_DIR)) return [];
|
|
52
|
+
const files = fs.readdirSync(TEAM_DIR).filter((f) => f.endsWith('.md')).sort();
|
|
53
|
+
const appendix = files
|
|
54
|
+
.filter((f) => f.startsWith(PARTIAL))
|
|
55
|
+
.map((f) => fs.readFileSync(path.join(TEAM_DIR, f), 'utf8'))
|
|
56
|
+
.join('\n\n');
|
|
57
|
+
return files
|
|
58
|
+
.filter((f) => !f.startsWith(PARTIAL))
|
|
59
|
+
.map((f) => readAgent(path.join(TEAM_DIR, f), `agents/${f}`, PREFIX + f.slice(0, -3), null, appendix));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = { PREFIX, CAPABILITIES, MODEL_TIERS, joinSections, readAgent, loadTeam };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const CONFIG_FILE = '.levi.json';
|
|
5
|
+
|
|
6
|
+
// Early configs listed files as an array; hashes are unknown there, so each file reads as null.
|
|
7
|
+
function normalize(entry) {
|
|
8
|
+
if (!entry) return { files: {} };
|
|
9
|
+
const files = Array.isArray(entry.files) ? Object.fromEntries(entry.files.map((p) => [p, null])) : entry.files || {};
|
|
10
|
+
return { ...entry, files };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function read(projectDir) {
|
|
14
|
+
const file = path.join(projectDir, CONFIG_FILE);
|
|
15
|
+
if (!fs.existsSync(file)) return null;
|
|
16
|
+
const data = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
17
|
+
data.usecases = Object.fromEntries(Object.entries(data.usecases || {}).map(([id, e]) => [id, normalize(e)]));
|
|
18
|
+
data.router = normalize(data.router);
|
|
19
|
+
data.team = normalize(data.team);
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function write(projectDir, config) {
|
|
24
|
+
fs.writeFileSync(path.join(projectDir, CONFIG_FILE), JSON.stringify(config, null, 2) + '\n');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = { CONFIG_FILE, read, write };
|