@vocdoni/skills 0.2.0 → 0.3.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/.claude-plugin/marketplace.json +11 -1
- package/CHANGELOG.md +10 -0
- package/README.md +12 -0
- package/package.json +1 -1
- package/plugins/claude-pi-subagent/.claude-plugin/marketplace.json +1 -1
- package/plugins/claude-pi-subagent/plugins/pi-subagent/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-pi-subagent/plugins/pi-subagent/dist/server.mjs +18034 -3169
- package/plugins/claude-pi-subagent/plugins/pi-subagent/package-lock.json +156 -169
- package/plugins/claude-pi-subagent/plugins/pi-subagent/package.json +3 -3
- package/plugins/claude-pi-subagent/plugins/pi-subagent/src/schemas.ts +4 -0
- package/plugins/claude-pi-subagent/plugins/pi-subagent/src/server.ts +1 -1
- package/plugins/claude-pi-subagent/plugins/pi-subagent/test/schemas.test.ts +30 -0
- package/plugins/vocdoni-comments/.claude-plugin/plugin.json +21 -0
- package/plugins/vocdoni-comments/skills/comments/SKILL.md +59 -0
- package/plugins/vocdoni-comments/skills/comments/trim.md +78 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagent-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "MCP server that lets Claude Code delegate bounded coding tasks to Pi (pi --mode rpc), with git worktree isolation and compact diff/summary results.",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
22
|
-
"zod": "^
|
|
22
|
+
"zod": "^4.6.7"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.10.0",
|
|
26
26
|
"tsup": "^8.5.0",
|
|
27
27
|
"typescript": "^5.7.0",
|
|
28
|
-
"vitest": "^5.0.
|
|
28
|
+
"vitest": "^5.0.5"
|
|
29
29
|
},
|
|
30
30
|
"overrides": {
|
|
31
31
|
"esbuild": "^0.28.1"
|
|
@@ -26,13 +26,17 @@ const thinkingField = z
|
|
|
26
26
|
|
|
27
27
|
const toolsField = z
|
|
28
28
|
.array(z.enum(BUILTIN_TOOLS))
|
|
29
|
+
.max(BUILTIN_TOOLS.length)
|
|
29
30
|
.describe(
|
|
30
31
|
"Override the tool allowlist. Allowed: read, bash, edit, write, grep, find, ls. " +
|
|
31
32
|
"Omit to use the safe default for the chosen mode.",
|
|
32
33
|
);
|
|
33
34
|
|
|
35
|
+
export const MAX_FILES = 1000;
|
|
36
|
+
|
|
34
37
|
const filesField = z
|
|
35
38
|
.array(z.string())
|
|
39
|
+
.max(MAX_FILES)
|
|
36
40
|
.describe("Files Claude wants Pi to focus on (project-relative). Passed to Pi as context.");
|
|
37
41
|
|
|
38
42
|
const providerField = z.string().describe("Pi provider override (e.g. anthropic, openai, google).");
|
|
@@ -47,7 +47,7 @@ function errorResult(err: unknown): CallToolResult {
|
|
|
47
47
|
function main(): Promise<void> {
|
|
48
48
|
const config = loadConfig();
|
|
49
49
|
const manager = new PiTaskManager(config);
|
|
50
|
-
const server = new McpServer({ name: "pi-subagent", version: "0.2.
|
|
50
|
+
const server = new McpServer({ name: "pi-subagent", version: "0.2.2" });
|
|
51
51
|
|
|
52
52
|
server.registerTool(
|
|
53
53
|
"pi_list_agents",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { MAX_FILES, startTaskShape } from "../src/schemas";
|
|
4
|
+
|
|
5
|
+
const startTask = z.object(startTaskShape);
|
|
6
|
+
|
|
7
|
+
describe("startTaskShape", () => {
|
|
8
|
+
it("accepts a small valid input", () => {
|
|
9
|
+
const result = startTask.safeParse({ task: "review", files: ["a.ts"], tools: ["read"] });
|
|
10
|
+
expect(result.success).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("rejects an oversized tools array with a field-level issue", () => {
|
|
14
|
+
const result = startTask.safeParse({ task: "review", tools: Array(200_000).fill("nope") });
|
|
15
|
+
expect(result.success).toBe(false);
|
|
16
|
+
expect(result.error?.issues.some((issue) => issue.path[0] === "tools")).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("rejects an oversized files array with a field-level issue", () => {
|
|
20
|
+
const result = startTask.safeParse({ task: "review", files: Array(200_000).fill(1) });
|
|
21
|
+
expect(result.success).toBe(false);
|
|
22
|
+
expect(result.error?.issues.some((issue) => issue.path[0] === "files")).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("accepts exactly MAX_FILES files and rejects one more", () => {
|
|
26
|
+
const atLimit = Array.from({ length: MAX_FILES }, (_, i) => `f${i}.ts`);
|
|
27
|
+
expect(startTask.safeParse({ task: "review", files: atLimit }).success).toBe(true);
|
|
28
|
+
expect(startTask.safeParse({ task: "review", files: [...atLimit, "extra.ts"] }).success).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vocdoni-comments",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vocdoni's code comment rules: comments of 1-3 lines that carry the why or a constraint the code can't show, never restated code, history or measurements. Includes a trim procedure, for a branch's added comments or a whole project or folder, that shortens long blocks without losing anything only the comment said, and reports where each dropped piece still lives.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Vocdoni",
|
|
7
|
+
"url": "https://vocdoni.io"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/vocdoni/skills",
|
|
10
|
+
"repository": "https://github.com/vocdoni/skills",
|
|
11
|
+
"license": "AGPL-3.0-or-later",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"claude-code",
|
|
14
|
+
"skills",
|
|
15
|
+
"vocdoni",
|
|
16
|
+
"comments",
|
|
17
|
+
"code-comments",
|
|
18
|
+
"code-quality",
|
|
19
|
+
"code-review"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: comments
|
|
3
|
+
description: Use whenever writing, adding, editing or reviewing code comments (doc comments, inline comments, JSDoc), and when asked to trim, shorten or clean up comments, on a branch or across a whole project, package or folder. Keeps comments to 1-3 lines that carry the why, and trims existing ones without losing anything only they said.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code comments
|
|
7
|
+
|
|
8
|
+
- **Trimming comments** (`/comments trim` for a branch, `/comments trim project [path]` for the whole project or a folder, a request to trim or clean them up, or your own change adds blocks over 3 lines): follow [trim.md](trim.md).
|
|
9
|
+
- **Reviewing** someone else's comments (a PR, a diff you didn't write) is read-only: report what [trim.md](trim.md) would change, with the same report, minus the parts about edits, and edit nothing. A change you delegated counts as your own, not someone else's.
|
|
10
|
+
- **Anything else:** the rules below apply every time you write or change a comment.
|
|
11
|
+
|
|
12
|
+
## Writing comments
|
|
13
|
+
|
|
14
|
+
- **Length:** 1-3 lines per block, most of them 1-2. This includes doc comments on exported identifiers. Package overviews (Go `doc.go`, module docstrings) work as docs and aren't held to 3 lines. Usage examples belong in runnable examples (Go `Example` functions, doctests), not in the doc comment. For comment length this skill takes precedence over the longer-godoc advice in [[go-best-practices]] (its "Documentation is for users" proverb).
|
|
15
|
+
- **Content:** say the why, or a constraint the code can't show:
|
|
16
|
+
- an external API's quirk,
|
|
17
|
+
- a rate limit,
|
|
18
|
+
- an ordering requirement,
|
|
19
|
+
- an edge case handled silently,
|
|
20
|
+
- why the obvious approach doesn't work.
|
|
21
|
+
- **Don't:**
|
|
22
|
+
- restate what the code does,
|
|
23
|
+
- narrate history ("used to", "now", "before this change", the PR or issue story),
|
|
24
|
+
- record measurements,
|
|
25
|
+
- list examples where one does.
|
|
26
|
+
- **Don't repeat documented flows.** If a flow is already explained in the repo's docs (README, AGENTS.md/CLAUDE.md, skills, `docs/`) or in another comment of the same package, point to it in a few words instead of repeating it.
|
|
27
|
+
- **Claims must match the code.** A comment must not say less or more than the code does.
|
|
28
|
+
- **Style:**
|
|
29
|
+
- follow the language's doc-comment convention (Go: start with the identifier's name),
|
|
30
|
+
- match the surrounding comments' punctuation and line width,
|
|
31
|
+
- keep sentences grammatical. Don't telegraph.
|
|
32
|
+
- **Before committing:** check the diff for comment blocks over 3 lines that the change added or grew, and trim any with [trim.md](trim.md).
|
|
33
|
+
|
|
34
|
+
Example, a Go doc comment that narrates history and restates the code, trimmed to its purpose and the constraints only it states.
|
|
35
|
+
|
|
36
|
+
Before:
|
|
37
|
+
|
|
38
|
+
```go
|
|
39
|
+
// ParseBallot parses the JSON form of a ballot.
|
|
40
|
+
// It used to return nil on error. It now returns a wrapped error, so
|
|
41
|
+
// callers can match it with errors.Is.
|
|
42
|
+
// The function is pure: it reads no election state and takes no locks.
|
|
43
|
+
// The vote handler calls it while holding the election lock, so it must
|
|
44
|
+
// not block.
|
|
45
|
+
// Choice values are checked against MaxChoices later, by validateChoices
|
|
46
|
+
// in validate.go.
|
|
47
|
+
func ParseBallot(data []byte) (Ballot, error) {
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
After:
|
|
51
|
+
|
|
52
|
+
```go
|
|
53
|
+
// ParseBallot parses a ballot's JSON form. Errors are wrapped for errors.Is;
|
|
54
|
+
// choices are checked later, by validateChoices in validate.go. The vote
|
|
55
|
+
// handler calls it under the election lock, so it must not block.
|
|
56
|
+
func ParseBallot(data []byte) (Ballot, error) {
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Related:** [[go-best-practices]], [[go-code-quality]].
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Trimming comments
|
|
2
|
+
|
|
3
|
+
Comments only: never change code. What a good comment says is in [SKILL.md](SKILL.md).
|
|
4
|
+
|
|
5
|
+
## 1. Scope
|
|
6
|
+
|
|
7
|
+
Two modes:
|
|
8
|
+
- **Branch** (the default, `/comments trim`): only the comments a branch added.
|
|
9
|
+
- **Project** (`/comments trim project [path]`, or a request to trim the whole project, a package or a folder): every comment in the tracked files under `path`, or the whole repo.
|
|
10
|
+
|
|
11
|
+
A **block** is a run of consecutive comment lines.
|
|
12
|
+
|
|
13
|
+
### Branch mode
|
|
14
|
+
|
|
15
|
+
1. **Base:** the fork point, `git merge-base <ref> HEAD`, where `<ref>` is the ref you were given, or else the remote default branch (`git fetch`, then `origin/HEAD`, else `origin/main` or `origin/master`). Read `git diff <base>...HEAD`, plus uncommitted changes if the tree is dirty.
|
|
16
|
+
2. **In scope** means one of:
|
|
17
|
+
- the branch created the block, or
|
|
18
|
+
- the block existed on the base and the branch made it longer. Compare with `git show <base>:<file>`.
|
|
19
|
+
3. **Out of scope:** everything else stays exactly as it is, however long. That includes blocks the branch only edited, shortened or left at the same length.
|
|
20
|
+
|
|
21
|
+
### Project mode
|
|
22
|
+
|
|
23
|
+
1. **Files:** `git ls-files` under the path, so ignored and untracked files stay out.
|
|
24
|
+
2. **In scope:** every block over 3 lines.
|
|
25
|
+
3. **Clean tree first:** if the tree is dirty, stop and ask. The result has to be reviewable as its own diff.
|
|
26
|
+
|
|
27
|
+
### Both modes skip
|
|
28
|
+
|
|
29
|
+
- generated files: bindings, `*.pb.go`, lockfiles, vendored code,
|
|
30
|
+
- docs: README, AGENTS.md/CLAUDE.md, skills, `docs/`,
|
|
31
|
+
- comments that aren't prose: licence and copyright headers, and directives (`//go:build`, `//nolint`, `// eslint-disable`, `# type: ignore`, shebangs), which tools or the licence read verbatim.
|
|
32
|
+
|
|
33
|
+
## 2. Trim each in-scope block over 3 lines
|
|
34
|
+
|
|
35
|
+
For every piece of information you'd drop, classify it:
|
|
36
|
+
- **(a) The code says it:** names, logic or types make it obvious. Drop it.
|
|
37
|
+
- **(b) It's documented elsewhere:** in the repo's docs or another comment in the same package. Search for it and note the file and line for the report. Drop it, or leave a short pointer.
|
|
38
|
+
- The other place must survive this run: docs, or a comment you're keeping. If two in-scope comments say the same thing, don't drop it from both; keep it at the spot it concerns most.
|
|
39
|
+
- Dropping a duplicate must not lose a detail only it had. That detail is (c) at its own spot: keep it there in its 1-3 lines, rather than merging it into the surviving comment, which would only make that one long.
|
|
40
|
+
- A pointer names the file and identifier ("see `vote.go` `castBallot`"), never a line number, which goes stale.
|
|
41
|
+
- **(c) It's only here:** if it's a real constraint, a non-obvious why or a gotcha, it **must stay**.
|
|
42
|
+
- Rework the comment so it fits in 3 lines and still carries it,
|
|
43
|
+
- or move it to the line or field it concerns, still within 3 lines.
|
|
44
|
+
|
|
45
|
+
Then:
|
|
46
|
+
- **Always drop:** restated code, history and narration, measurements.
|
|
47
|
+
- **History that carries a why** ("this used to deadlock when…, so we lock first") is (c): keep the why in present tense ("locking first avoids a deadlock when…") and drop the story.
|
|
48
|
+
- **Keep the core message:** the comment still answers what a reader would ask at that spot.
|
|
49
|
+
- **Check each claim against the code:** a trimmed comment must not be narrower or broader than what the code does. For example, "an unknown X is an error" is wrong when the code also lets a no-X case through.
|
|
50
|
+
- **Package overviews** (Go `doc.go`, module docstrings) work as docs, so the 3-line limit doesn't fit them. Trim them anyway: drop restated code, history, measurements and whatever the README already says, and keep the overview a reader needs to start in that package.
|
|
51
|
+
- **Look again:** check for in-scope blocks you missed that are still over 3 lines.
|
|
52
|
+
|
|
53
|
+
## 3. Who does it
|
|
54
|
+
|
|
55
|
+
- **Use judgement:** this needs judgement on every block, so do it yourself, or delegate to a subagent on the strongest model available. This overrides any rule that sends code changes to a small worker model.
|
|
56
|
+
- **Never a small model:** don't hand it to a small, fast model. It drops constraints that were only stated in the comment.
|
|
57
|
+
- **Small worker models** never trim, with or without a commit: list the blocks over 3 lines in your report, so the agent that delegated the change trims them.
|
|
58
|
+
- **Large diffs or project mode:** split the work by package or module across several such subagents, each with its own list of files.
|
|
59
|
+
|
|
60
|
+
## 4. Verify
|
|
61
|
+
|
|
62
|
+
- **Comments only:** the diff contains no code changes beyond what the formatter does.
|
|
63
|
+
- **Formatter:** gofmt, prettier or the project's equivalent is clean on the touched files.
|
|
64
|
+
- **Checks:** build, vet or lint, and tests pass for the touched modules.
|
|
65
|
+
- **Commit:** when the trim is the task itself, don't commit and leave the result for review. When it runs as SKILL.md's pre-commit check, go on with the commit you were making. When you trim a delegated change the worker already committed, commit the trim on that branch before merging it.
|
|
66
|
+
|
|
67
|
+
## 5. Report
|
|
68
|
+
|
|
69
|
+
- **One entry per in-scope block**, a table when there are more than a few. In project mode, group the table by package:
|
|
70
|
+
- file:identifier,
|
|
71
|
+
- in scope (created, grown from N to M lines, or N lines in project mode),
|
|
72
|
+
- what was dropped,
|
|
73
|
+
- where that lives: code / file:line / doc section, or "only here: kept".
|
|
74
|
+
- **Out of scope:** blocks the branch touched but didn't add or grow, and skipped files, go in a short list with the reason, not a row each.
|
|
75
|
+
- **Restored or reworked:** the blocks restored to their original text or reworked to keep a constraint.
|
|
76
|
+
- **Leftovers:** any in-scope block still over 3 lines. There should be none; if there is one, say why.
|
|
77
|
+
- **Stale docs:** docs that pointed at a shortened comment and now read wrong. List them; don't fix docs unasked.
|
|
78
|
+
- **Verification results.**
|