@codyswann/lisa 2.127.1 → 2.128.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/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +5 -1
- package/plugins/lisa/.codex-plugin/hooks.json +4 -0
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/commands/parity-code-review.md +6 -0
- package/plugins/lisa/commands/parity-code-simplifier.md +6 -0
- package/plugins/lisa/commands/parity-coderabbit.md +6 -0
- package/plugins/lisa/commands/parity-safety-net-rules.md +6 -0
- package/plugins/lisa/commands/parity-sentry-sdk-setup.md +6 -0
- package/plugins/lisa/commands/parity-sentry-seer.md +6 -0
- package/plugins/lisa/commands/parity-skill-creator.md +6 -0
- package/plugins/lisa/hooks/parity-safety-net.sh +102 -0
- package/plugins/lisa/skills/parity-code-review/SKILL.md +83 -0
- package/plugins/lisa/skills/parity-code-review/agents/openai.yaml +4 -0
- package/plugins/lisa/skills/parity-code-simplifier/SKILL.md +76 -0
- package/plugins/lisa/skills/parity-code-simplifier/agents/openai.yaml +4 -0
- package/plugins/lisa/skills/parity-coderabbit/SKILL.md +77 -0
- package/plugins/lisa/skills/parity-coderabbit/agents/openai.yaml +4 -0
- package/plugins/lisa/skills/parity-safety-net-rules/SKILL.md +144 -0
- package/plugins/lisa/skills/parity-safety-net-rules/agents/openai.yaml +4 -0
- package/plugins/lisa/skills/parity-sentry-sdk-setup/SKILL.md +211 -0
- package/plugins/lisa/skills/parity-sentry-sdk-setup/agents/openai.yaml +4 -0
- package/plugins/lisa/skills/parity-sentry-seer/SKILL.md +135 -0
- package/plugins/lisa/skills/parity-sentry-seer/agents/openai.yaml +4 -0
- package/plugins/lisa/skills/parity-skill-creator/SKILL.md +149 -0
- package/plugins/lisa/skills/parity-skill-creator/agents/openai.yaml +4 -0
- package/plugins/lisa-agy/commands/parity-code-review.md +6 -0
- package/plugins/lisa-agy/commands/parity-code-simplifier.md +6 -0
- package/plugins/lisa-agy/commands/parity-coderabbit.md +6 -0
- package/plugins/lisa-agy/commands/parity-safety-net-rules.md +6 -0
- package/plugins/lisa-agy/commands/parity-sentry-sdk-setup.md +6 -0
- package/plugins/lisa-agy/commands/parity-sentry-seer.md +6 -0
- package/plugins/lisa-agy/commands/parity-skill-creator.md +6 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/parity-code-review/SKILL.md +83 -0
- package/plugins/lisa-agy/skills/parity-code-simplifier/SKILL.md +76 -0
- package/plugins/lisa-agy/skills/parity-coderabbit/SKILL.md +77 -0
- package/plugins/lisa-agy/skills/parity-safety-net-rules/SKILL.md +144 -0
- package/plugins/lisa-agy/skills/parity-sentry-sdk-setup/SKILL.md +211 -0
- package/plugins/lisa-agy/skills/parity-sentry-seer/SKILL.md +135 -0
- package/plugins/lisa-agy/skills/parity-skill-creator/SKILL.md +149 -0
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +5 -1
- package/plugins/lisa-copilot/commands/parity-code-review.md +6 -0
- package/plugins/lisa-copilot/commands/parity-code-simplifier.md +6 -0
- package/plugins/lisa-copilot/commands/parity-coderabbit.md +6 -0
- package/plugins/lisa-copilot/commands/parity-safety-net-rules.md +6 -0
- package/plugins/lisa-copilot/commands/parity-sentry-sdk-setup.md +6 -0
- package/plugins/lisa-copilot/commands/parity-sentry-seer.md +6 -0
- package/plugins/lisa-copilot/commands/parity-skill-creator.md +6 -0
- package/plugins/lisa-copilot/hooks/parity-safety-net.sh +102 -0
- package/plugins/lisa-copilot/skills/parity-code-review/SKILL.md +83 -0
- package/plugins/lisa-copilot/skills/parity-code-simplifier/SKILL.md +76 -0
- package/plugins/lisa-copilot/skills/parity-coderabbit/SKILL.md +77 -0
- package/plugins/lisa-copilot/skills/parity-safety-net-rules/SKILL.md +144 -0
- package/plugins/lisa-copilot/skills/parity-sentry-sdk-setup/SKILL.md +211 -0
- package/plugins/lisa-copilot/skills/parity-sentry-seer/SKILL.md +135 -0
- package/plugins/lisa-copilot/skills/parity-skill-creator/SKILL.md +149 -0
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/commands/parity-code-review.md +6 -0
- package/plugins/lisa-cursor/commands/parity-code-simplifier.md +6 -0
- package/plugins/lisa-cursor/commands/parity-coderabbit.md +6 -0
- package/plugins/lisa-cursor/commands/parity-safety-net-rules.md +6 -0
- package/plugins/lisa-cursor/commands/parity-sentry-sdk-setup.md +6 -0
- package/plugins/lisa-cursor/commands/parity-sentry-seer.md +6 -0
- package/plugins/lisa-cursor/commands/parity-skill-creator.md +6 -0
- package/plugins/lisa-cursor/hooks/hooks.json +4 -0
- package/plugins/lisa-cursor/hooks/parity-safety-net.sh +102 -0
- package/plugins/lisa-cursor/skills/parity-code-review/SKILL.md +83 -0
- package/plugins/lisa-cursor/skills/parity-code-simplifier/SKILL.md +76 -0
- package/plugins/lisa-cursor/skills/parity-coderabbit/SKILL.md +77 -0
- package/plugins/lisa-cursor/skills/parity-safety-net-rules/SKILL.md +144 -0
- package/plugins/lisa-cursor/skills/parity-sentry-sdk-setup/SKILL.md +211 -0
- package/plugins/lisa-cursor/skills/parity-sentry-seer/SKILL.md +135 -0
- package/plugins/lisa-cursor/skills/parity-skill-creator/SKILL.md +149 -0
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/.claude-plugin/plugin.json +2 -1
- package/plugins/src/base/commands/parity-code-review.md +6 -0
- package/plugins/src/base/commands/parity-code-simplifier.md +6 -0
- package/plugins/src/base/commands/parity-coderabbit.md +6 -0
- package/plugins/src/base/commands/parity-safety-net-rules.md +6 -0
- package/plugins/src/base/commands/parity-sentry-sdk-setup.md +6 -0
- package/plugins/src/base/commands/parity-sentry-seer.md +6 -0
- package/plugins/src/base/commands/parity-skill-creator.md +6 -0
- package/plugins/src/base/hooks/parity-safety-net.sh +102 -0
- package/plugins/src/base/skills/parity-code-review/SKILL.md +83 -0
- package/plugins/src/base/skills/parity-code-simplifier/SKILL.md +76 -0
- package/plugins/src/base/skills/parity-coderabbit/SKILL.md +77 -0
- package/plugins/src/base/skills/parity-safety-net-rules/SKILL.md +144 -0
- package/plugins/src/base/skills/parity-sentry-sdk-setup/SKILL.md +211 -0
- package/plugins/src/base/skills/parity-sentry-seer/SKILL.md +135 -0
- package/plugins/src/base/skills/parity-skill-creator/SKILL.md +149 -0
- package/scripts/plugin-parity-drift.mjs +9 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parity-code-simplifier
|
|
3
|
+
description: "Lisa-native, behavior-preserving simplification of recently-changed code. Removes duplication and dead code, reuses existing utilities, and improves readability without altering behavior — quality only, never a bug hunt. Vendor-neutral cross-agent equivalent of the upstream code-simplifier agent, runnable on Codex, agy, Copilot, Cursor, and Claude."
|
|
4
|
+
allowed-tools: ["Read", "Bash", "Grep", "Glob", "Edit", "Write"]
|
|
5
|
+
synced-from: code-simplifier@claude-plugins-official@1.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Parity Code Simplifier
|
|
9
|
+
|
|
10
|
+
Make the **recently-changed** code simpler and easier to maintain **without changing what it does**. This is a quality pass: deduplication, reuse, readability, and dead-code removal. It is explicitly **not** a bug hunt — if you spot a likely defect, note it for a reviewer (or `parity-code-review`) and leave the behavior intact.
|
|
11
|
+
|
|
12
|
+
> **Drift tracking.** Pinned to `code-simplifier@claude-plugins-official@1.0.0`. `scripts/plugin-parity-drift.mjs` compares this pin against the upstream version in the plugin cache and flags staleness. This is a Lisa-native reimplementation written from scratch — **do not port or copy upstream plugin code.**
|
|
13
|
+
|
|
14
|
+
## Scope: recently-changed code only
|
|
15
|
+
|
|
16
|
+
Default to the current diff, not the whole repository. Establish scope first:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git merge-base HEAD origin/main 2>/dev/null && \
|
|
20
|
+
git diff --stat "$(git merge-base HEAD origin/main)"...HEAD
|
|
21
|
+
git diff HEAD --stat
|
|
22
|
+
git status --short
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Simplify the files that changed and the immediate code they touch. Do not embark on a repo-wide refactor unless explicitly asked.
|
|
26
|
+
|
|
27
|
+
## The prime directive: preserve behavior
|
|
28
|
+
|
|
29
|
+
Every edit must be behavior-preserving. Before changing anything, understand the current contract — inputs, outputs, side effects, error paths, public signatures. After changing it, the observable behavior must be identical. When in doubt, **don't** — leave a note instead of risking a semantic change.
|
|
30
|
+
|
|
31
|
+
## What to simplify
|
|
32
|
+
|
|
33
|
+
1. **Duplication (DRY)** — Collapse copy-pasted blocks into a single function or shared helper. Prefer delegating to an existing canonical implementation over re-deriving logic (see the repo's DRY rule: a function that reproduces a sequence should call the shared generator, not reimplement it).
|
|
34
|
+
2. **Reuse over reinvention** — Search for existing utilities (`Grep`/`Glob`) before introducing new code. If the project already has a helper for what the change hand-rolls, use it.
|
|
35
|
+
3. **Readability** — Clearer names; flatten needless nesting with early returns/guard clauses; replace clever one-liners with obvious code; split overly long functions along natural seams.
|
|
36
|
+
4. **Dead code** — Remove unreachable branches, unused variables/imports/exports, and commented-out blocks introduced or exposed by the change.
|
|
37
|
+
5. **Idiomatic constructs** — Prefer immutable transformations (`map`/`filter`/`reduce`) over mutable accumulation where it's clearer; remove redundant intermediate state.
|
|
38
|
+
|
|
39
|
+
## Respect project conventions
|
|
40
|
+
|
|
41
|
+
This repo enforces specific patterns — honor them so your simplification doesn't trip the linter or hooks:
|
|
42
|
+
|
|
43
|
+
- **Immutability / functional style** — avoid `let` and in-place mutation; prefer `const` and pure transformations.
|
|
44
|
+
- **Statement order** — do not place expression-statement helper calls before `const` definitions; inline validation as `if` guard clauses (exempt from `enforce-statement-order`).
|
|
45
|
+
- **eslint-disable directives** must include a `-- description`.
|
|
46
|
+
- **Barrel-export constraint** — if you delete a file referenced by an `index.ts`, update the barrel in the same change so lint/typecheck stays green.
|
|
47
|
+
- **Never edit generated plugin artifacts** (`plugins/lisa`, `plugins/lisa-*`); the source of truth is `plugins/src/`.
|
|
48
|
+
|
|
49
|
+
## Workflow
|
|
50
|
+
|
|
51
|
+
1. Read each changed file and enough of its callers to know the contract.
|
|
52
|
+
2. Identify simplification opportunities; rank by value-to-risk. Skip anything that risks behavior.
|
|
53
|
+
3. Apply edits with `Edit`/`Write`, one coherent change at a time.
|
|
54
|
+
4. **Verify behavior is unchanged** — run the project's checks:
|
|
55
|
+
```bash
|
|
56
|
+
bun run test
|
|
57
|
+
bun run typecheck 2>/dev/null || true
|
|
58
|
+
bun run lint 2>/dev/null || true
|
|
59
|
+
```
|
|
60
|
+
If any check fails, fix or revert the offending edit before continuing. Never leave the tree worse than you found it.
|
|
61
|
+
|
|
62
|
+
## Output
|
|
63
|
+
|
|
64
|
+
Summarize what you changed and why, grouped by file with `file:line` anchors:
|
|
65
|
+
|
|
66
|
+
- **Simplified** — the edits applied (dedup / reuse / readability / dead-code), each with a one-line rationale.
|
|
67
|
+
- **Left alone** — opportunities you deliberately skipped because they risked behavior, with the reason.
|
|
68
|
+
- **Flagged for review** — any suspected bugs noticed in passing (not fixed here — quality pass only).
|
|
69
|
+
- **Verification** — which checks you ran and that they pass.
|
|
70
|
+
|
|
71
|
+
## Rules
|
|
72
|
+
|
|
73
|
+
- **Behavior-preserving only.** No bug fixes, no feature changes, no API changes disguised as cleanup.
|
|
74
|
+
- **Quality only** — if the only "simplification" would change behavior, don't make it.
|
|
75
|
+
- **Tests must stay green.** A simplification that breaks a test is a behavior change — revert it.
|
|
76
|
+
- If there is nothing worth simplifying, say so clearly rather than churning the code.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parity-coderabbit
|
|
3
|
+
description: "Thorough PR-style review of the full diff — bugs, security, performance, and maintainability — with concrete suggested fixes and a structured summary. An independent Lisa-native review skill that does NOT call CodeRabbit's service or port its code. Vendor-neutral cross-agent equivalent of the upstream coderabbit plugin, runnable on Codex, agy, Copilot, Cursor, and Claude."
|
|
4
|
+
allowed-tools: ["Read", "Bash", "Grep", "Glob"]
|
|
5
|
+
synced-from: coderabbit@claude-plugins-official@1.1.1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Parity CodeRabbit
|
|
9
|
+
|
|
10
|
+
A comprehensive, PR-grade code review of the **entire diff** — the kind of pass a senior reviewer (or an automated reviewer like CodeRabbit) gives before approving. Where `parity-code-review` is a tight defect hunt, this skill is **broad and thorough**: it covers bugs, security, performance, *and* maintainability, suggests concrete fixes, and ends with a reviewer-style summary and verdict.
|
|
11
|
+
|
|
12
|
+
> **Independent reimplementation.** This skill is **not** a wrapper around CodeRabbit's hosted service and does **not** port or invoke CodeRabbit's code. It is a Lisa-native review that produces a comparable artifact using only the model and local tooling. No network calls to any review SaaS are made.
|
|
13
|
+
>
|
|
14
|
+
> **Drift tracking.** Pinned to `coderabbit@claude-plugins-official@1.1.1`. `scripts/plugin-parity-drift.mjs` compares this pin against the upstream version in the plugin cache and flags staleness. Reimplemented from scratch — **do not port or copy upstream plugin code.**
|
|
15
|
+
|
|
16
|
+
## Step 1: Assemble the full review surface
|
|
17
|
+
|
|
18
|
+
Gather the complete change set the way a PR review would see it:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Full branch diff vs merge base
|
|
22
|
+
BASE="$(git merge-base HEAD origin/main 2>/dev/null)"
|
|
23
|
+
git diff "$BASE"...HEAD
|
|
24
|
+
git diff "$BASE"...HEAD --stat # file-by-file overview
|
|
25
|
+
git log "$BASE"..HEAD --oneline # commit narrative
|
|
26
|
+
git diff HEAD # uncommitted work
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Read the commit messages and (if available) the PR/ticket description to understand **intent** — a review judges the change against what it was meant to do, not just what it does.
|
|
30
|
+
|
|
31
|
+
## Step 2: Build context per file
|
|
32
|
+
|
|
33
|
+
For each changed file, `Read` the surrounding code and use `Grep`/`Glob` to follow callers, dependents, and tests. Note the change's blast radius: public API, shared modules, migrations, config, and anything downstream consumers rely on.
|
|
34
|
+
|
|
35
|
+
## Step 3: Review across all dimensions
|
|
36
|
+
|
|
37
|
+
Walk every meaningful hunk and evaluate each dimension. A finding in any dimension is fair game.
|
|
38
|
+
|
|
39
|
+
1. **Correctness / bugs** — Logic errors, off-by-one, inverted conditions, missing `await`, null/undefined handling, type coercion, broken control flow, incorrect defaults, mutation of shared state, race conditions, broken or missing tests for new behavior.
|
|
40
|
+
2. **Security** — Injection (SQL/shell/template), unsanitized boundary input, secrets/keys/tokens in code or logs, missing or broken authn/authz, unsafe deserialization, path traversal, SSRF, overly broad permissions, dependency vulnerabilities introduced by the change.
|
|
41
|
+
3. **Performance** — N+1 queries, work inside hot loops, unnecessary allocations or re-renders, missing indexes, blocking I/O on hot paths, unbounded growth, accidental O(n²), redundant network/database round-trips, large bundle additions.
|
|
42
|
+
4. **Maintainability** — Duplication, dead code, unclear naming, overly long/complex functions, missing or misleading docs, leaky abstractions, inconsistent patterns, hidden coupling, magic numbers, and violations of the project's conventions (immutability/functional style, statement order, barrel-export integrity, "never edit generated plugin artifacts").
|
|
43
|
+
5. **Test coverage** — Are the new branches and edge cases tested? Do tests assert behavior rather than implementation? Are failure paths covered?
|
|
44
|
+
|
|
45
|
+
## Step 4: Suggest concrete fixes
|
|
46
|
+
|
|
47
|
+
For each finding, give a **specific, actionable** fix — ideally a short code sketch or a `diff`-style suggestion, not vague advice. The reader should be able to act on it without re-deriving the problem.
|
|
48
|
+
|
|
49
|
+
## Step 5: Output — structured review
|
|
50
|
+
|
|
51
|
+
Produce a review document with these sections:
|
|
52
|
+
|
|
53
|
+
### Summary
|
|
54
|
+
2–4 sentences: what the change does, overall quality, and the headline risks. State a verdict: **Approve**, **Approve with nits**, or **Request changes**.
|
|
55
|
+
|
|
56
|
+
### Findings by severity
|
|
57
|
+
Group as **Critical → Major → Minor → Nit**. Every finding includes:
|
|
58
|
+
|
|
59
|
+
- **What** — the issue, and which dimension it falls under (bug / security / perf / maintainability / tests).
|
|
60
|
+
- **Where** — `path/to/file.ts:line`.
|
|
61
|
+
- **Why** — the concrete consequence, with a triggering example where relevant.
|
|
62
|
+
- **Fix** — a concrete suggestion or code snippet.
|
|
63
|
+
|
|
64
|
+
### Walkthrough (optional but encouraged)
|
|
65
|
+
A brief per-file note on what changed and any file-specific observations — the orientation a human reviewer leaves so the next reader understands the diff quickly.
|
|
66
|
+
|
|
67
|
+
### Strengths
|
|
68
|
+
Call out what's done well. A credible review is balanced, not only critical.
|
|
69
|
+
|
|
70
|
+
## Rules
|
|
71
|
+
|
|
72
|
+
- **Cover the whole diff.** If you deprioritize anything for size, say which files and why — never imply full coverage you didn't give.
|
|
73
|
+
- **Ground every finding in the code.** No generic checklists detached from the actual change; no speculative findings you can't point to.
|
|
74
|
+
- **Concrete fixes only.** "Consider improving error handling" is not a finding; "wrap the `fetch` in try/catch and return a 502 on network error at `api/proxy.ts:31`" is.
|
|
75
|
+
- **No external review service.** Use only local git/tooling and the model — this is an independent review, not a CodeRabbit proxy.
|
|
76
|
+
- **Review-only.** Report findings; do not edit files. Route fixes through the implementation flow, `parity-code-simplifier` (quality), or a follow-up.
|
|
77
|
+
- **If the diff is clean, approve it plainly** and say why — do not invent problems to look thorough.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parity-safety-net-rules
|
|
3
|
+
description: "View, set, and verify the custom guard rules enforced by Lisa's safety-net PreToolUse Bash hook (parity-safety-net.sh). The consolidated cross-agent equivalent of the upstream safety-net plugin's set-custom-rules + verify-custom-rules skills — manages a project-local list of extended-regex patterns that block destructive shell commands, on Codex, agy, Copilot, Cursor, and Claude."
|
|
4
|
+
allowed-tools: ["Read", "Edit", "Write", "Bash"]
|
|
5
|
+
synced-from: safety-net@cc-marketplace@0.9.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Parity Safety-Net Rules
|
|
9
|
+
|
|
10
|
+
Manage the **custom guard rules** that Lisa's safety-net hook enforces on every
|
|
11
|
+
Bash command. The hook (`hooks/parity-safety-net.sh`, registered as a
|
|
12
|
+
`PreToolUse` matcher on `Bash`) ships with built-in guards against catastrophic
|
|
13
|
+
commands; this skill lets a project **view**, **set**, and **verify** *additional*
|
|
14
|
+
project-specific rules on top of those built-ins.
|
|
15
|
+
|
|
16
|
+
> **Lisa-native reimplementation.** This consolidates the upstream
|
|
17
|
+
> `safety-net@cc-marketplace` plugin's two rule-management skills
|
|
18
|
+
> (`set-custom-rules` + `verify-custom-rules`) into one. It is reimplemented from
|
|
19
|
+
> scratch against Lisa conventions — it does **not** port or invoke upstream
|
|
20
|
+
> plugin code.
|
|
21
|
+
>
|
|
22
|
+
> **Drift tracking.** Pinned to `safety-net@cc-marketplace@0.9.0`.
|
|
23
|
+
> `scripts/plugin-parity-drift.mjs` compares this pin against the upstream
|
|
24
|
+
> version in the plugin cache and flags staleness. **Do not port or copy upstream
|
|
25
|
+
> plugin code.**
|
|
26
|
+
|
|
27
|
+
## How the rules work
|
|
28
|
+
|
|
29
|
+
- The hook always enforces its **built-in guards** (see below). These cannot be
|
|
30
|
+
disabled from the rules file — they are the floor.
|
|
31
|
+
- **Custom rules** live in a project-local file, one **POSIX extended regular
|
|
32
|
+
expression (ERE)** per line. Blank lines and lines beginning with `#` are
|
|
33
|
+
ignored. Matching is case-insensitive (`grep -Ei`).
|
|
34
|
+
- If *any* built-in guard or custom rule matches the proposed command, the hook
|
|
35
|
+
exits non-zero and the Bash call is **blocked**, with the reason shown to the
|
|
36
|
+
agent.
|
|
37
|
+
|
|
38
|
+
### Rules file location
|
|
39
|
+
|
|
40
|
+
Resolved in this order:
|
|
41
|
+
|
|
42
|
+
1. `$SAFETY_NET_RULES_FILE` (explicit override), else
|
|
43
|
+
2. `${CLAUDE_PROJECT_DIR:-$PWD}/.claude/safety-net-rules.txt`
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
RULES_FILE="${SAFETY_NET_RULES_FILE:-${CLAUDE_PROJECT_DIR:-$PWD}/.claude/safety-net-rules.txt}"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Built-in guards (always on)
|
|
50
|
+
|
|
51
|
+
1. `rm -rf` of a filesystem root, `$HOME`/`~`, or a top-level wildcard.
|
|
52
|
+
2. Force-pushing a protected branch (`main`/`master`/`production`/`release`).
|
|
53
|
+
`--force-with-lease` is intentionally allowed.
|
|
54
|
+
3. `git reset --hard` while the working tree is **dirty** (would discard work).
|
|
55
|
+
4. Destructive SQL — `DROP DATABASE/SCHEMA/TABLE`, `TRUNCATE TABLE`.
|
|
56
|
+
|
|
57
|
+
## View the current rules
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
RULES_FILE="${SAFETY_NET_RULES_FILE:-${CLAUDE_PROJECT_DIR:-$PWD}/.claude/safety-net-rules.txt}"
|
|
61
|
+
if [ -f "$RULES_FILE" ]; then
|
|
62
|
+
echo "Custom safety-net rules ($RULES_FILE):"
|
|
63
|
+
grep -vE '^[[:space:]]*(#|$)' "$RULES_FILE" || echo "(no active rules)"
|
|
64
|
+
else
|
|
65
|
+
echo "No custom rules file yet ($RULES_FILE). Only built-in guards are active."
|
|
66
|
+
fi
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`Read` the file to show comments and structure as well.
|
|
70
|
+
|
|
71
|
+
## Set (add or edit) a rule
|
|
72
|
+
|
|
73
|
+
A rule is an ERE matched against the full command string. Keep rules **specific**
|
|
74
|
+
to avoid blocking legitimate work — anchor on the dangerous verb and its target.
|
|
75
|
+
|
|
76
|
+
1. Ensure the file exists, then **append** a commented rule (use `Edit`/`Write`,
|
|
77
|
+
or append from the shell):
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
RULES_FILE="${SAFETY_NET_RULES_FILE:-${CLAUDE_PROJECT_DIR:-$PWD}/.claude/safety-net-rules.txt}"
|
|
81
|
+
mkdir -p "$(dirname "$RULES_FILE")"
|
|
82
|
+
{
|
|
83
|
+
echo "# Block deleting a Kubernetes namespace"
|
|
84
|
+
echo 'kubectl[[:space:]]+delete[[:space:]]+namespace'
|
|
85
|
+
} >> "$RULES_FILE"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
2. **Always verify** the new rule (next section) before considering it set —
|
|
89
|
+
confirm it blocks what it should and allows what it shouldn't.
|
|
90
|
+
|
|
91
|
+
Editing/removing: open the file with `Edit` and change or delete the line.
|
|
92
|
+
Removing a rule never affects the built-in guards.
|
|
93
|
+
|
|
94
|
+
## Verify the rules
|
|
95
|
+
|
|
96
|
+
Two checks — both should pass before you trust a rule.
|
|
97
|
+
|
|
98
|
+
### 1. The ERE is valid
|
|
99
|
+
|
|
100
|
+
An invalid regex would make the hook error on every command. Validate it:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
printf '%s' "$RULE" | grep -Eq -- "$RULE" 2>/dev/null && echo "valid ERE" \
|
|
104
|
+
|| echo "INVALID ERE — fix before saving"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 2. The rule behaves as intended
|
|
108
|
+
|
|
109
|
+
Drive the **actual hook** with a fake `PreToolUse` payload and assert the exit
|
|
110
|
+
code (non-zero = blocked, 0 = allowed). Build the JSON with `jq` so the test
|
|
111
|
+
command line itself never contains the dangerous literal:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
HOOK="${CLAUDE_PLUGIN_ROOT}/hooks/parity-safety-net.sh"
|
|
115
|
+
|
|
116
|
+
check() { # check <expect: block|allow> <command>
|
|
117
|
+
jq -nc --arg c "$2" '{tool_name:"Bash",tool_input:{command:$c}}' \
|
|
118
|
+
| bash "$HOOK" >/dev/null 2>&1
|
|
119
|
+
local code=$?
|
|
120
|
+
local got=allow; [ "$code" -ne 0 ] && got=block
|
|
121
|
+
printf '%-5s want=%-5s got=%-5s %s\n' \
|
|
122
|
+
"$([ "$got" = "$1" ] && echo OK || echo FAIL)" "$1" "$got" "$2"
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
# Should block (matches the new rule):
|
|
126
|
+
check block "kubectl delete namespace prod"
|
|
127
|
+
# Should allow (must not over-match):
|
|
128
|
+
check allow "kubectl get pods"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Report a table of cases with want/got/verdict. If any case disagrees, tighten the
|
|
132
|
+
ERE and re-verify.
|
|
133
|
+
|
|
134
|
+
## Rules
|
|
135
|
+
|
|
136
|
+
- **Built-in guards are the floor** — custom rules only *add* blocks; they cannot
|
|
137
|
+
weaken the built-ins.
|
|
138
|
+
- **Prefer specific over broad** — a rule that blocks too much trains users to
|
|
139
|
+
bypass the safety net. Anchor on verb + target.
|
|
140
|
+
- **Verify every rule against the real hook** before saving — never ship an
|
|
141
|
+
unverified or syntactically invalid ERE.
|
|
142
|
+
- **Never weaken the net to unblock yourself.** If a built-in guard fires on a
|
|
143
|
+
command that is genuinely safe, run it manually outside the agent after the
|
|
144
|
+
user confirms — do not edit the hook to remove the guard.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parity-sentry-sdk-setup
|
|
3
|
+
description: "Install and configure the Sentry SDK for a project — detect the framework/runtime, add the correct @sentry/<framework> package, initialize the client, wire the DSN through env, enable error + performance monitoring, and set up source map upload for readable stack traces. One consolidated skill covering react, nextjs, node, nestjs, express, python, django, react-native, and more. Lisa-native reimplementation of Sentry's SDK-setup suite. Use when adding Sentry to a project or fixing an existing Sentry install."
|
|
4
|
+
allowed-tools: ["Read", "Edit", "Write", "Bash"]
|
|
5
|
+
synced-from: sentry@claude-plugins-official@1.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Sentry SDK Setup
|
|
9
|
+
|
|
10
|
+
Detect a project's framework and runtime, then install and configure the correct
|
|
11
|
+
Sentry SDK with sensible, production-ready defaults: client initialization, DSN
|
|
12
|
+
via environment variable, error capture, performance/tracing, and source map
|
|
13
|
+
upload so stack traces are readable.
|
|
14
|
+
|
|
15
|
+
## Consolidation note
|
|
16
|
+
|
|
17
|
+
The upstream `sentry@claude-plugins-official` plugin ships **~30 separate
|
|
18
|
+
per-SDK setup skills** (one per framework/runtime). This **single** Lisa-native
|
|
19
|
+
skill consolidates all of them: instead of one thin skill per SDK, it detects the
|
|
20
|
+
framework and applies the matching case below. The behavior is reimplemented from
|
|
21
|
+
scratch against Lisa conventions — it is **not** a translation of the upstream
|
|
22
|
+
skills. Pinned to `sentry@claude-plugins-official@1.0.0` via `synced-from` so the
|
|
23
|
+
parity drift detector tracks it as one unit.
|
|
24
|
+
|
|
25
|
+
## Step 1 — Detect framework & runtime
|
|
26
|
+
|
|
27
|
+
Inspect the project before choosing an SDK. Read `package.json`
|
|
28
|
+
(dependencies/scripts), config files, and lockfiles:
|
|
29
|
+
|
|
30
|
+
- `next` dependency or `next.config.*` → **Next.js**
|
|
31
|
+
- `@nestjs/core` → **NestJS**
|
|
32
|
+
- `react-native` / `expo` → **React Native / Expo**
|
|
33
|
+
- `react` + a bundler (vite/webpack) without Next → **React (browser)**
|
|
34
|
+
- `express` / `fastify` / `koa` and a Node entrypoint → **Node server**
|
|
35
|
+
- `vue` / `@angular/core` / `svelte` → that browser framework
|
|
36
|
+
- `pyproject.toml` / `requirements.txt`; `django`/`flask`/`fastapi` →
|
|
37
|
+
**Python** (and which web framework)
|
|
38
|
+
- A plain Node library/CLI → **Node**
|
|
39
|
+
|
|
40
|
+
If the runtime is genuinely ambiguous, ask which app to instrument rather than
|
|
41
|
+
guessing. Respect the project's package manager (bun/npm/pnpm/yarn — match the
|
|
42
|
+
lockfile) and module system (ESM vs CJS).
|
|
43
|
+
|
|
44
|
+
## Step 2 — Install the package
|
|
45
|
+
|
|
46
|
+
Use the project's package manager. Examples (swap `bun add` for your manager):
|
|
47
|
+
|
|
48
|
+
| Framework | Package |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| React (browser) | `@sentry/react` |
|
|
51
|
+
| Next.js | `@sentry/nextjs` |
|
|
52
|
+
| Node / Express / Fastify | `@sentry/node` (+ `@sentry/profiling-node` for profiling) |
|
|
53
|
+
| NestJS | `@sentry/nestjs` (+ `@sentry/node`) |
|
|
54
|
+
| React Native / Expo | `@sentry/react-native` |
|
|
55
|
+
| Vue | `@sentry/vue` |
|
|
56
|
+
| Angular | `@sentry/angular` |
|
|
57
|
+
| Svelte / SvelteKit | `@sentry/svelte` / `@sentry/sveltekit` |
|
|
58
|
+
| Python (generic) | `sentry-sdk` |
|
|
59
|
+
| Django | `sentry-sdk[django]` |
|
|
60
|
+
| Flask | `sentry-sdk[flask]` |
|
|
61
|
+
| FastAPI | `sentry-sdk[fastapi]` |
|
|
62
|
+
|
|
63
|
+
For Next.js, prefer the official wizard when available — it scaffolds the config
|
|
64
|
+
files and source-map upload for you:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx @sentry/wizard@latest -i nextjs
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Step 3 — Initialize the client
|
|
71
|
+
|
|
72
|
+
Initialize **as early as possible** in the app's lifecycle, before other code
|
|
73
|
+
runs. Always read the DSN from the environment (see Step 4) — never hard-code it.
|
|
74
|
+
|
|
75
|
+
**React (browser)** — `src/instrument.ts`, imported first in the entrypoint:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import * as Sentry from "@sentry/react";
|
|
79
|
+
|
|
80
|
+
Sentry.init({
|
|
81
|
+
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
82
|
+
environment: import.meta.env.MODE,
|
|
83
|
+
integrations: [Sentry.browserTracingIntegration()],
|
|
84
|
+
tracesSampleRate: 0.1, // tune per traffic; 1.0 in dev
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Node / Express** — `instrument.ts`, required at the very top of the entrypoint
|
|
89
|
+
(`import "./instrument";` must be the first import):
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import * as Sentry from "@sentry/node";
|
|
93
|
+
|
|
94
|
+
Sentry.init({
|
|
95
|
+
dsn: process.env.SENTRY_DSN,
|
|
96
|
+
environment: process.env.NODE_ENV,
|
|
97
|
+
tracesSampleRate: 0.1,
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then, after routes are defined: `Sentry.setupExpressErrorHandler(app);`
|
|
102
|
+
|
|
103
|
+
**NestJS** — import `./instrument` first in `main.ts`, then add Sentry's module:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
// main.ts — FIRST line
|
|
107
|
+
import "./instrument";
|
|
108
|
+
// ...
|
|
109
|
+
// app.module.ts
|
|
110
|
+
import { SentryModule } from "@sentry/nestjs/setup";
|
|
111
|
+
@Module({ imports: [SentryModule.forRoot()] })
|
|
112
|
+
export class AppModule {}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Next.js** — config lives in `sentry.client.config.ts`,
|
|
116
|
+
`sentry.server.config.ts`, `sentry.edge.config.ts`, and `next.config.js` is
|
|
117
|
+
wrapped with `withSentryConfig`. The wizard (Step 2) writes these; verify the DSN
|
|
118
|
+
is read from `process.env.NEXT_PUBLIC_SENTRY_DSN` / `process.env.SENTRY_DSN`.
|
|
119
|
+
|
|
120
|
+
**React Native / Expo** — wrap the root component:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import * as Sentry from "@sentry/react-native";
|
|
124
|
+
Sentry.init({
|
|
125
|
+
dsn: process.env.EXPO_PUBLIC_SENTRY_DSN,
|
|
126
|
+
tracesSampleRate: 0.2,
|
|
127
|
+
});
|
|
128
|
+
export default Sentry.wrap(App);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Python (Django/Flask/FastAPI/generic)** — initialize at startup
|
|
132
|
+
(`settings.py`, app factory, or main module):
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
import os
|
|
136
|
+
import sentry_sdk
|
|
137
|
+
|
|
138
|
+
sentry_sdk.init(
|
|
139
|
+
dsn=os.environ["SENTRY_DSN"],
|
|
140
|
+
environment=os.environ.get("ENVIRONMENT", "production"),
|
|
141
|
+
traces_sample_rate=0.1,
|
|
142
|
+
send_default_pii=False,
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Framework-specific integrations (e.g. `DjangoIntegration`, `FastApiIntegration`)
|
|
147
|
+
are auto-enabled by the matching extra installed in Step 2.
|
|
148
|
+
|
|
149
|
+
## Step 4 — DSN via environment
|
|
150
|
+
|
|
151
|
+
- Store the DSN in an environment variable, never in committed source.
|
|
152
|
+
- Add it to `.env.example` (with a placeholder) so the requirement is documented,
|
|
153
|
+
but keep the real value in `.env`/secrets and confirm `.env` is gitignored.
|
|
154
|
+
- Use the framework's public-env convention for client-side code:
|
|
155
|
+
`NEXT_PUBLIC_SENTRY_DSN` (Next.js), `VITE_SENTRY_DSN` (Vite),
|
|
156
|
+
`EXPO_PUBLIC_SENTRY_DSN` (Expo). Server-only code uses `SENTRY_DSN`.
|
|
157
|
+
- For source-map upload (Step 6) the build also needs `SENTRY_AUTH_TOKEN`,
|
|
158
|
+
`SENTRY_ORG`, and `SENTRY_PROJECT` — these are **build/CI** secrets, not
|
|
159
|
+
shipped to the client.
|
|
160
|
+
|
|
161
|
+
## Step 5 — Error + performance monitoring
|
|
162
|
+
|
|
163
|
+
- **Errors**: unhandled exceptions/rejections are captured automatically once
|
|
164
|
+
`init` runs; add the framework error handler where required (Express:
|
|
165
|
+
`setupExpressErrorHandler`; React: an error boundary via
|
|
166
|
+
`Sentry.ErrorBoundary`; NestJS: `SentryModule`). Use
|
|
167
|
+
`Sentry.captureException(err)` for caught-but-notable errors.
|
|
168
|
+
- **Performance/tracing**: set a `tracesSampleRate` (start ~0.1 in production,
|
|
169
|
+
`1.0` in dev) and enable the framework tracing integration (browser tracing,
|
|
170
|
+
HTTP/DB auto-instrumentation on the server). Optionally add profiling on Node
|
|
171
|
+
via `@sentry/profiling-node` and `profilesSampleRate`.
|
|
172
|
+
- Set `environment` and (ideally) `release` so issues are grouped per deploy.
|
|
173
|
+
|
|
174
|
+
## Step 6 — Source maps (readable stack traces)
|
|
175
|
+
|
|
176
|
+
Minified/transpiled traces are useless without source maps. Configure upload at
|
|
177
|
+
build time:
|
|
178
|
+
|
|
179
|
+
- **Next.js**: handled by `withSentryConfig` in `next.config.js` (the wizard sets
|
|
180
|
+
it up); ensure `SENTRY_AUTH_TOKEN`/`SENTRY_ORG`/`SENTRY_PROJECT` exist in CI.
|
|
181
|
+
- **Vite/Webpack/Rollup/esbuild**: add the Sentry bundler plugin
|
|
182
|
+
(`@sentry/vite-plugin`, `@sentry/webpack-plugin`, etc.) with `sourcemaps`
|
|
183
|
+
upload enabled and the same auth env vars.
|
|
184
|
+
- **Node**: build with source maps emitted and upload via
|
|
185
|
+
`sentry-cli sourcemaps upload` (or the bundler plugin) in the release step.
|
|
186
|
+
- **React Native**: source maps upload through the Sentry Metro/Gradle/Xcode
|
|
187
|
+
integration added by the SDK's setup.
|
|
188
|
+
- Tie uploads to a **release** identifier (commit SHA or version) and inject the
|
|
189
|
+
same release into `Sentry.init({ release })` so traces map to the right build.
|
|
190
|
+
|
|
191
|
+
## Step 7 — Verify
|
|
192
|
+
|
|
193
|
+
- Build/typecheck to confirm the SDK wiring compiles:
|
|
194
|
+
`bun run build` / `bun run typecheck` (or the project's equivalents).
|
|
195
|
+
- Trigger a deliberate test error in a non-production environment and confirm it
|
|
196
|
+
appears in Sentry with a **readable** (source-mapped) stack trace.
|
|
197
|
+
- Confirm a transaction/trace shows up to validate performance monitoring.
|
|
198
|
+
- Remove the test error afterward.
|
|
199
|
+
|
|
200
|
+
## Rules
|
|
201
|
+
|
|
202
|
+
- **Do not port or copy upstream plugin code** — reimplement from scratch.
|
|
203
|
+
- Never hard-code or commit a DSN or `SENTRY_AUTH_TOKEN`; route everything
|
|
204
|
+
through env/secrets and update `.env.example`.
|
|
205
|
+
- Match the project's package manager and module system; do not introduce a new
|
|
206
|
+
one to install Sentry.
|
|
207
|
+
- Initialize Sentry before any other application code runs.
|
|
208
|
+
- Tune sample rates for the environment — do not ship `tracesSampleRate: 1.0` to
|
|
209
|
+
high-traffic production by default.
|
|
210
|
+
- Verify with a real captured event and a source-mapped trace before declaring
|
|
211
|
+
setup complete.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parity-sentry-seer
|
|
3
|
+
description: "AI debugging — given an error message, stack trace, or failing test, analyze the signal, form ranked hypotheses, locate the root cause in the codebase with file:line evidence, and propose a minimal fix. Lisa-native reimplementation of Sentry's seer workflow, available across all agent runtimes. Use when handed an exception, crash, regression, or red test and asked to find and fix the cause."
|
|
4
|
+
allowed-tools: ["Read", "Grep", "Glob", "Bash", "Edit"]
|
|
5
|
+
synced-from: sentry@claude-plugins-official@1.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Seer — AI Root-Cause Debugging
|
|
9
|
+
|
|
10
|
+
Take a failure signal (exception, stack trace, failing test, log excerpt, or a
|
|
11
|
+
Sentry issue) and drive it to a proven root cause and a proposed fix. This is the
|
|
12
|
+
Lisa-native reimplementation of the upstream `sentry@claude-plugins-official`
|
|
13
|
+
plugin's `seer` command, rebuilt from scratch so the AI-debugging workflow is
|
|
14
|
+
available to the Codex, agy, and Copilot runtimes (Cursor loads upstream
|
|
15
|
+
natively).
|
|
16
|
+
|
|
17
|
+
> The Sentry MCP itself (for pulling live issue data) is re-pointed per agent
|
|
18
|
+
> separately by the parity subsystem — this skill works **with or without** it.
|
|
19
|
+
> When the MCP is connected, use it to fetch issue details, breadcrumbs, and
|
|
20
|
+
> event context; when it is not, work from the error text the user pastes in.
|
|
21
|
+
|
|
22
|
+
## Drift tracking
|
|
23
|
+
|
|
24
|
+
Pinned to `sentry@claude-plugins-official@1.0.0` via `synced-from`. SDK install
|
|
25
|
+
& configuration is a separate concern owned by `parity-sentry-sdk-setup`.
|
|
26
|
+
|
|
27
|
+
## Inputs this handles
|
|
28
|
+
|
|
29
|
+
- A raw stack trace or exception message.
|
|
30
|
+
- A failing test (name + assertion output, or the command to reproduce it).
|
|
31
|
+
- A log excerpt or error ID from CloudWatch / project logging.
|
|
32
|
+
- A Sentry issue URL or ID (resolve via the Sentry MCP when available).
|
|
33
|
+
|
|
34
|
+
If the signal is too thin to act on (no message, no location, not reproducible),
|
|
35
|
+
ask for the one missing thing — the exact error text, the failing command, or a
|
|
36
|
+
repro step — before guessing.
|
|
37
|
+
|
|
38
|
+
## Workflow
|
|
39
|
+
|
|
40
|
+
### 1. Capture & normalize the signal
|
|
41
|
+
|
|
42
|
+
- Read the full error: type, message, and the **complete** stack trace.
|
|
43
|
+
- Identify the **deepest frame that belongs to this codebase** (ignore
|
|
44
|
+
node_modules / stdlib frames) — that file:line is your primary anchor.
|
|
45
|
+
- Note the runtime, environment, and any IDs (request id, user id, release).
|
|
46
|
+
- If a Sentry issue is referenced and the MCP is connected, fetch the event,
|
|
47
|
+
breadcrumbs, tags, and first/last-seen + frequency.
|
|
48
|
+
|
|
49
|
+
### 2. Reproduce (or pin down why you cannot)
|
|
50
|
+
|
|
51
|
+
- For a failing test, run it in isolation and read the actual vs. expected:
|
|
52
|
+
```bash
|
|
53
|
+
bun run test -- <test-file-or-pattern>
|
|
54
|
+
```
|
|
55
|
+
- For a runtime error, find the smallest command/route/input that triggers it.
|
|
56
|
+
- A reliably reproduced failure is the strongest evidence; if it is flaky or
|
|
57
|
+
environment-only, say so explicitly and treat hypotheses as provisional.
|
|
58
|
+
|
|
59
|
+
### 3. Form ranked hypotheses
|
|
60
|
+
|
|
61
|
+
List 2–4 candidate causes, **most likely first**, each with the reasoning that
|
|
62
|
+
makes it plausible and a concrete way to confirm or refute it. Common classes:
|
|
63
|
+
|
|
64
|
+
- Null/undefined or unexpected shape reaching the failing frame.
|
|
65
|
+
- Off-by-one / boundary / empty-collection edge case.
|
|
66
|
+
- Async race, unawaited promise, or ordering assumption.
|
|
67
|
+
- Contract drift — a caller and callee disagree after a recent change.
|
|
68
|
+
- Bad input validation / unhandled external response.
|
|
69
|
+
- Config/env divergence (works locally, fails in the target environment).
|
|
70
|
+
|
|
71
|
+
### 4. Locate the root cause with evidence
|
|
72
|
+
|
|
73
|
+
Walk the code to confirm or kill each hypothesis, highest-ranked first:
|
|
74
|
+
|
|
75
|
+
- `Grep`/`Glob` for the failing symbol, message string, and the function in the
|
|
76
|
+
anchor frame; read the surrounding code, not just the one line.
|
|
77
|
+
- Trace the data **backward** from the failure point to where the bad value
|
|
78
|
+
originates — the crash site is usually a symptom, not the cause.
|
|
79
|
+
- Use `git log`/`git blame` on the anchor file to find a correlated recent change:
|
|
80
|
+
```bash
|
|
81
|
+
git log -n 5 --oneline -- <path/to/anchor/file>
|
|
82
|
+
git blame -L <line>,<line> -- <path/to/anchor/file>
|
|
83
|
+
```
|
|
84
|
+
- When a value is uncertain, add a **temporary** strategic log/assert to confirm
|
|
85
|
+
the actual value, run, observe, then remove it. State the observed value as
|
|
86
|
+
evidence. (For deeper investigations, the `debug-specialist` agent owns
|
|
87
|
+
log-placement and CloudWatch tracing.)
|
|
88
|
+
|
|
89
|
+
Stop when one hypothesis is **proven** — you can point to the exact line where
|
|
90
|
+
the wrong value/behavior originates and explain the mechanism.
|
|
91
|
+
|
|
92
|
+
### 5. Propose the fix
|
|
93
|
+
|
|
94
|
+
- Describe the **minimal** change that addresses the root cause, not the symptom.
|
|
95
|
+
- Prefer fixing where the bad value originates over masking it at the crash site.
|
|
96
|
+
- Note any other call sites affected by the same root cause.
|
|
97
|
+
- Recommend a regression test that would have caught it (a failing test that the
|
|
98
|
+
fix turns green) — pair with `reproduce-bug` / `tdd-implementation` to land it
|
|
99
|
+
TDD-style, and `codify-verification` to lock it in.
|
|
100
|
+
- Do not silently broaden scope; if you spot adjacent issues, list them
|
|
101
|
+
separately as follow-ups.
|
|
102
|
+
|
|
103
|
+
## Output
|
|
104
|
+
|
|
105
|
+
Report in this shape:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
## Signal
|
|
109
|
+
<error type/message + anchor frame file:line + repro status>
|
|
110
|
+
|
|
111
|
+
## Root cause
|
|
112
|
+
<the proven cause, in plain English, with the mechanism>
|
|
113
|
+
|
|
114
|
+
## Evidence
|
|
115
|
+
- <file:line> — <what it shows>
|
|
116
|
+
- <observed value / test output / blame commit> — <why it confirms the cause>
|
|
117
|
+
|
|
118
|
+
## Proposed fix
|
|
119
|
+
<minimal change, where, and why it addresses the cause not the symptom>
|
|
120
|
+
|
|
121
|
+
## Regression test
|
|
122
|
+
<the test that should be added to prevent recurrence>
|
|
123
|
+
|
|
124
|
+
## Follow-ups (if any)
|
|
125
|
+
<adjacent issues found but out of scope>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Rules
|
|
129
|
+
|
|
130
|
+
- **Do not port or copy upstream plugin code.** This is a native reimplementation.
|
|
131
|
+
- Prove the cause before proposing a fix — no speculative "try changing this".
|
|
132
|
+
- Cite concrete `file:line` evidence for every claim.
|
|
133
|
+
- Remove any temporary debug logging you add before finishing.
|
|
134
|
+
- Fix the root cause, not the symptom; flag, don't smuggle in, scope creep.
|
|
135
|
+
- Never weaken a test to make it pass, and never use `--no-verify`.
|