@sentry/warden 0.35.1 → 0.36.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/dist/cli/args.d.ts +12 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +14 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/init.js +2 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +16 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.d.ts +4 -2
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +34 -13
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/output/jsonl-schema-gen.d.ts.map +1 -1
- package/dist/cli/output/jsonl-schema-gen.js +3 -1
- package/dist/cli/output/jsonl-schema-gen.js.map +1 -1
- package/dist/cli/output/jsonl.d.ts +54 -0
- package/dist/cli/output/jsonl.d.ts.map +1 -1
- package/dist/cli/output/jsonl.js +6 -1
- package/dist/cli/output/jsonl.js.map +1 -1
- package/dist/cli/output/tasks.d.ts.map +1 -1
- package/dist/cli/output/tasks.js +7 -0
- package/dist/cli/output/tasks.js.map +1 -1
- package/dist/config/loader.d.ts +2 -2
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +3 -3
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +5 -5
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +3 -3
- package/dist/config/schema.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/sdk/analyze.d.ts.map +1 -1
- package/dist/sdk/analyze.js +139 -10
- package/dist/sdk/analyze.js.map +1 -1
- package/dist/sdk/auth.d.ts +5 -4
- package/dist/sdk/auth.d.ts.map +1 -1
- package/dist/sdk/auth.js +9 -7
- package/dist/sdk/auth.js.map +1 -1
- package/dist/sdk/circuit-breaker.js +3 -3
- package/dist/sdk/circuit-breaker.js.map +1 -1
- package/dist/sdk/errors.d.ts +8 -0
- package/dist/sdk/errors.d.ts.map +1 -1
- package/dist/sdk/errors.js +44 -1
- package/dist/sdk/errors.js.map +1 -1
- package/dist/sdk/haiku.d.ts.map +1 -1
- package/dist/sdk/haiku.js +21 -12
- package/dist/sdk/haiku.js.map +1 -1
- package/dist/sdk/otel.d.ts +15 -0
- package/dist/sdk/otel.d.ts.map +1 -1
- package/dist/sdk/otel.js +50 -6
- package/dist/sdk/otel.js.map +1 -1
- package/dist/sdk/post-process.d.ts +2 -2
- package/dist/sdk/post-process.d.ts.map +1 -1
- package/dist/sdk/post-process.js +1 -1
- package/dist/sdk/post-process.js.map +1 -1
- package/dist/sdk/runtimes/claude.d.ts.map +1 -1
- package/dist/sdk/runtimes/claude.js +45 -35
- package/dist/sdk/runtimes/claude.js.map +1 -1
- package/dist/sdk/runtimes/pi.d.ts.map +1 -1
- package/dist/sdk/runtimes/pi.js +90 -6
- package/dist/sdk/runtimes/pi.js.map +1 -1
- package/dist/sdk/runtimes/types.d.ts +2 -2
- package/dist/sdk/runtimes/types.d.ts.map +1 -1
- package/dist/sdk/types.d.ts +12 -4
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/sdk/verify.d.ts +2 -2
- package/dist/sdk/verify.d.ts.map +1 -1
- package/dist/sdk/verify.js +1 -1
- package/dist/sdk/verify.js.map +1 -1
- package/dist/sentry-trace.d.ts +29 -0
- package/dist/sentry-trace.d.ts.map +1 -0
- package/dist/sentry-trace.js +154 -0
- package/dist/sentry-trace.js.map +1 -0
- package/dist/sentry.d.ts.map +1 -1
- package/dist/sentry.js +56 -0
- package/dist/sentry.js.map +1 -1
- package/dist/types/index.d.ts +72 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +37 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/warden/SKILL.md +0 -76
- package/skills/warden/SOURCES.md +0 -39
- package/skills/warden/SPEC.md +0 -112
- package/skills/warden/references/cli-reference.md +0 -149
- package/skills/warden/references/config-schema.md +0 -141
- package/skills/warden/references/configuration.md +0 -143
- package/skills/warden/references/creating-skills.md +0 -87
- package/skills/warden-sweep/SKILL.md +0 -78
- package/skills/warden-sweep/SOURCES.md +0 -43
- package/skills/warden-sweep/SPEC.md +0 -126
- package/skills/warden-sweep/references/issue-phase.md +0 -24
- package/skills/warden-sweep/references/organize-phase.md +0 -31
- package/skills/warden-sweep/references/patch-phase.md +0 -142
- package/skills/warden-sweep/references/patch-prompt.md +0 -72
- package/skills/warden-sweep/references/resume-and-artifacts.md +0 -51
- package/skills/warden-sweep/references/scan-phase.md +0 -46
- package/skills/warden-sweep/references/script-interfaces.md +0 -127
- package/skills/warden-sweep/references/verify-phase.md +0 -69
- package/skills/warden-sweep/references/verify-prompt.md +0 -25
- package/skills/warden-sweep/scripts/_utils.py +0 -99
- package/skills/warden-sweep/scripts/create_issue.py +0 -189
- package/skills/warden-sweep/scripts/extract_findings.py +0 -219
- package/skills/warden-sweep/scripts/find_reviewers.py +0 -114
- package/skills/warden-sweep/scripts/generate_report.py +0 -266
- package/skills/warden-sweep/scripts/index_prs.py +0 -187
- package/skills/warden-sweep/scripts/organize.py +0 -422
- package/skills/warden-sweep/scripts/scan.py +0 -584
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: warden-sweep
|
|
3
|
-
description: Full-repository code sweep. Scans every file with Warden, verifies findings through deep tracing, creates draft PRs for validated issues. Use when asked to "sweep the repo", "scan everything", "find all bugs", "full codebase review", "batch code analysis", or run Warden across the entire repository.
|
|
4
|
-
disable-model-invocation: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Warden Sweep
|
|
8
|
-
|
|
9
|
-
Run a full-repository Warden sweep: scan files, verify findings, create a tracking issue, open draft PRs for validated issues, and organize the final report.
|
|
10
|
-
|
|
11
|
-
**Requires**: `warden`, `gh`, `git`, `jq`, `uv`.
|
|
12
|
-
|
|
13
|
-
Run commands from the repository root. Use the host's skill-root path for bundled scripts and references.
|
|
14
|
-
|
|
15
|
-
Output goes to `.warden/sweeps/<run-id>/`.
|
|
16
|
-
|
|
17
|
-
## References
|
|
18
|
-
|
|
19
|
-
Load only the reference for the current phase:
|
|
20
|
-
|
|
21
|
-
| Need | Read |
|
|
22
|
-
|------|------|
|
|
23
|
-
| Script arguments, outputs, and side effects | `references/script-interfaces.md` |
|
|
24
|
-
| Phase 1 scan workflow | `references/scan-phase.md` |
|
|
25
|
-
| Phase 2 verification workflow | `references/verify-phase.md` |
|
|
26
|
-
| Phase 3 tracking issue workflow | `references/issue-phase.md` |
|
|
27
|
-
| Phase 4 patch and draft PR workflow | `references/patch-phase.md` |
|
|
28
|
-
| Phase 5 organize and final report workflow | `references/organize-phase.md` |
|
|
29
|
-
| Resume behavior and artifact layout | `references/resume-and-artifacts.md` |
|
|
30
|
-
| Verification task prompt template | `references/verify-prompt.md` |
|
|
31
|
-
| Patch task prompt template | `references/patch-prompt.md` |
|
|
32
|
-
|
|
33
|
-
## Workflow
|
|
34
|
-
|
|
35
|
-
Track progress across phases:
|
|
36
|
-
|
|
37
|
-
- [ ] Phase 1: Scan repository files with Warden.
|
|
38
|
-
- [ ] Phase 2: Verify findings before patching.
|
|
39
|
-
- [ ] Phase 3: Create a tracking issue.
|
|
40
|
-
- [ ] Phase 4: Patch verified findings and open draft PRs.
|
|
41
|
-
- [ ] Phase 5: Organize results and produce the final report.
|
|
42
|
-
|
|
43
|
-
## Phase Order
|
|
44
|
-
|
|
45
|
-
1. Read `references/script-interfaces.md` once before running scripts.
|
|
46
|
-
2. Run Phase 1 from `references/scan-phase.md`. Save `runId` and `sweepDir`.
|
|
47
|
-
3. Run Phase 2 from `references/verify-phase.md`. Verify every finding before patching.
|
|
48
|
-
4. Run Phase 3 from `references/issue-phase.md`. Continue if issue creation fails.
|
|
49
|
-
5. Run Phase 4 from `references/patch-phase.md`. Patch sequentially, one finding at a time.
|
|
50
|
-
6. Run Phase 5 from `references/organize-phase.md`.
|
|
51
|
-
7. For interrupted or partial runs, read `references/resume-and-artifacts.md` and continue from the first incomplete phase.
|
|
52
|
-
|
|
53
|
-
## Non-Negotiable Rules
|
|
54
|
-
|
|
55
|
-
- Verify findings before creating fixes.
|
|
56
|
-
- Use draft PRs for generated patches.
|
|
57
|
-
- Branch every patch from the repository default branch.
|
|
58
|
-
- Patch findings sequentially; do not run patch workers in parallel.
|
|
59
|
-
- Skip existing entries in sweep artifacts instead of duplicating work.
|
|
60
|
-
- Record failures in sweep data and continue to the next finding when possible.
|
|
61
|
-
- Clean up each worktree after patch success or failure.
|
|
62
|
-
|
|
63
|
-
## Final Response
|
|
64
|
-
|
|
65
|
-
After organizing, report:
|
|
66
|
-
|
|
67
|
-
```markdown
|
|
68
|
-
## Sweep Complete
|
|
69
|
-
|
|
70
|
-
| Metric | Count |
|
|
71
|
-
|--------|-------|
|
|
72
|
-
| Files scanned | {filesScanned} |
|
|
73
|
-
| Findings verified | {verified} |
|
|
74
|
-
| PRs created | {prsCreated} |
|
|
75
|
-
| Security findings | {securityFindings} |
|
|
76
|
-
|
|
77
|
-
Full report: `{summaryPath}`
|
|
78
|
-
```
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Warden Sweep Sources
|
|
2
|
-
|
|
3
|
-
## Source Inventory
|
|
4
|
-
|
|
5
|
-
| Source | Trust tier | Confidence | Usage constraints |
|
|
6
|
-
|--------|------------|------------|-------------------|
|
|
7
|
-
| `packages/warden/skills/warden-sweep/SKILL.md` | canonical runtime | high | Keep as router and phase overview. |
|
|
8
|
-
| `packages/warden/skills/warden-sweep/references/*.md` | bundled runtime references | high | Keep focused by phase or lookup need. |
|
|
9
|
-
| `packages/warden/skills/warden-sweep/scripts/*.py` | executable workflow | high | Script interfaces in references must match these files. |
|
|
10
|
-
| `packages/warden/src/cli/output/jsonl.ts` | Warden output contract | high | Verify JSONL parsing assumptions when Warden output changes. |
|
|
11
|
-
| `packages/warden/src/output/renderer.ts` and `packages/warden/src/types/` | finding/report semantics | high | Verify severity, confidence, and finding fields here. |
|
|
12
|
-
| GitHub CLI commands used by scripts | external tool contract | medium | Confirm command flags when GitHub CLI behavior changes. |
|
|
13
|
-
|
|
14
|
-
## Coverage Matrix
|
|
15
|
-
|
|
16
|
-
| Dimension | Coverage status | Evidence |
|
|
17
|
-
|-----------|-----------------|----------|
|
|
18
|
-
| Workflow phases | covered | `SKILL.md` routes scan, verify, issue, patch, organize, and resume behavior to focused references. |
|
|
19
|
-
| Script interfaces | covered | `references/script-interfaces.md` lists scripts, arguments, outputs, and side effects. |
|
|
20
|
-
| Artifact schema | covered | `references/resume-and-artifacts.md` documents directories and key JSONL/JSON files. |
|
|
21
|
-
| Verification behavior | covered | `references/verify-phase.md` and `references/verify-prompt.md` define qualification and rejection behavior. |
|
|
22
|
-
| Patch behavior | covered | `references/patch-phase.md` and `references/patch-prompt.md` define triage, worktree isolation, draft PR creation, and cleanup. |
|
|
23
|
-
| Known issues/workarounds | partial | Resume, partial scans, skipped findings, and existing PR dedup are covered; CI follow-up and rate-limit recovery are not. |
|
|
24
|
-
| Version/migration variance | partial | Current artifact names and script interfaces are documented; no formal migration path exists for old sweep directories. |
|
|
25
|
-
|
|
26
|
-
## Decisions
|
|
27
|
-
|
|
28
|
-
- Split phase detail out of `SKILL.md` so agents load only the current phase instructions.
|
|
29
|
-
- Keep script interface documentation separate from phase runbooks because scripts are reused across phases and by resume workflows.
|
|
30
|
-
- Describe verification and patch work in host-neutral terms while allowing parallel agent tasks when the host supports them.
|
|
31
|
-
- Keep prompt templates as separate references because they are substituted into delegated verification and patch work.
|
|
32
|
-
- Keep generated sweep artifacts under `.warden/sweeps/<run-id>/` so runs are resumable and isolated from normal source files.
|
|
33
|
-
|
|
34
|
-
## Open Gaps
|
|
35
|
-
|
|
36
|
-
- Add a redacted fixture sweep to validate the full workflow without touching real GitHub repositories.
|
|
37
|
-
- Document rate-limit and permission failure recovery if these become common in real sweeps.
|
|
38
|
-
- Add migration notes if artifact schemas change after users have existing sweep directories.
|
|
39
|
-
- Consider adding a script-level dry-run mode for issue and PR creation.
|
|
40
|
-
|
|
41
|
-
## Changelog
|
|
42
|
-
|
|
43
|
-
- 2026-04-27: Reverse-engineered maintenance spec and split the distributed `warden-sweep` workflow into phase references.
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# Warden Sweep Skill Specification
|
|
2
|
-
|
|
3
|
-
## Intent
|
|
4
|
-
|
|
5
|
-
The `warden-sweep` skill runs a full-repository Warden scan, verifies findings through deeper code tracing, and creates draft PRs for validated issues.
|
|
6
|
-
|
|
7
|
-
It exists for batch remediation work where a normal targeted Warden run is too narrow. The workflow is intentionally conservative: scan broadly, verify before patching, deduplicate against existing PRs, and record every decision in sweep artifacts.
|
|
8
|
-
|
|
9
|
-
## Scope
|
|
10
|
-
|
|
11
|
-
In scope:
|
|
12
|
-
|
|
13
|
-
- Scanning a repository file-by-file with Warden.
|
|
14
|
-
- Extracting and normalizing Warden findings.
|
|
15
|
-
- Verifying findings before any code changes are attempted.
|
|
16
|
-
- Creating a tracking issue for the sweep.
|
|
17
|
-
- Creating one draft PR per validated issue that passes patch triage.
|
|
18
|
-
- Organizing reports, security findings, PR links, and resumable sweep state.
|
|
19
|
-
|
|
20
|
-
Out of scope:
|
|
21
|
-
|
|
22
|
-
- Replacing human review of generated PRs.
|
|
23
|
-
- Applying fixes directly to the user's current branch.
|
|
24
|
-
- Patching low-confidence or unverified findings.
|
|
25
|
-
- Running generic codebase review without Warden scan artifacts.
|
|
26
|
-
- Managing CI iteration after PR creation.
|
|
27
|
-
|
|
28
|
-
## Users And Trigger Context
|
|
29
|
-
|
|
30
|
-
- Primary users: maintainers asking an agent to perform broad Warden-backed repository cleanup.
|
|
31
|
-
- Common user requests: "sweep the repo", "scan everything", "find all bugs", "full codebase review", "batch code analysis", "run Warden across the whole repository".
|
|
32
|
-
- Should not trigger for: normal pre-commit Warden runs, single-file checks, generic code review, or PR feedback iteration.
|
|
33
|
-
|
|
34
|
-
## Runtime Contract
|
|
35
|
-
|
|
36
|
-
- Required first actions:
|
|
37
|
-
- Confirm the repository has the required tools: `warden`, `gh`, `git`, `jq`, and `uv`.
|
|
38
|
-
- Run `scripts/scan.py` from the repository root using the host skill-root path.
|
|
39
|
-
- Preserve the returned `runId` and `sweepDir`.
|
|
40
|
-
- Resume existing sweep artifacts instead of duplicating work when a sweep directory is provided.
|
|
41
|
-
- Required outputs:
|
|
42
|
-
- Phase summaries after scan, verification, issue creation, patching, and organization.
|
|
43
|
-
- Final pointer to the generated summary report.
|
|
44
|
-
- Explicit counts for scanned files, timeouts/errors, verified/rejected findings, created/existing/failed PRs, and security findings.
|
|
45
|
-
- Non-negotiable constraints:
|
|
46
|
-
- Verify findings before patching.
|
|
47
|
-
- Patch findings sequentially to avoid worktree and branch cross-contamination.
|
|
48
|
-
- Create draft PRs, not direct commits to the default branch.
|
|
49
|
-
- Record errors in sweep data and continue to the next finding when possible.
|
|
50
|
-
- Clean up worktrees after patch attempts.
|
|
51
|
-
- Expected bundled files loaded at runtime:
|
|
52
|
-
- `references/script-interfaces.md`
|
|
53
|
-
- `references/scan-phase.md`
|
|
54
|
-
- `references/verify-phase.md`
|
|
55
|
-
- `references/issue-phase.md`
|
|
56
|
-
- `references/patch-phase.md`
|
|
57
|
-
- `references/organize-phase.md`
|
|
58
|
-
- `references/resume-and-artifacts.md`
|
|
59
|
-
- `references/verify-prompt.md`
|
|
60
|
-
- `references/patch-prompt.md`
|
|
61
|
-
- `scripts/*.py`
|
|
62
|
-
|
|
63
|
-
## Source And Evidence Model
|
|
64
|
-
|
|
65
|
-
Authoritative sources:
|
|
66
|
-
|
|
67
|
-
- `skills/warden-sweep/SKILL.md` and bundled references.
|
|
68
|
-
- `skills/warden-sweep/scripts/*.py`.
|
|
69
|
-
- Warden JSONL output schema and renderer code in `packages/warden/src/cli/output/`.
|
|
70
|
-
- GitHub CLI behavior for PRs, issues, labels, and repo metadata.
|
|
71
|
-
|
|
72
|
-
Useful improvement sources:
|
|
73
|
-
|
|
74
|
-
- positive examples: completed sweeps with verified findings, clean draft PRs, and accurate final reports
|
|
75
|
-
- negative examples: duplicate PRs, false positive patches, failed worktree cleanup, incorrect artifact state, or patch contamination across findings
|
|
76
|
-
- commit logs/changelogs: changes to Warden output, script behavior, or sweep artifact schema
|
|
77
|
-
- issue or PR feedback: reviewer complaints about generated PR quality, false positives, or sweep noise
|
|
78
|
-
- eval results: dry-run prompts for scan resume, verification, patch triage, and final organization
|
|
79
|
-
|
|
80
|
-
Data that must not be stored:
|
|
81
|
-
|
|
82
|
-
- secrets, credentials, or tokens
|
|
83
|
-
- private customer data
|
|
84
|
-
- raw issue/PR content unrelated to the sweep finding
|
|
85
|
-
- unredacted sensitive code excerpts beyond what is needed in local sweep artifacts
|
|
86
|
-
|
|
87
|
-
## Reference Architecture
|
|
88
|
-
|
|
89
|
-
- `SKILL.md` contains the phase overview, routing table, universal constraints, and completion contract.
|
|
90
|
-
- `SOURCES.md` contains source inventory, coverage, decisions, gaps, and changelog.
|
|
91
|
-
- `references/` contains focused phase runbooks, prompt templates, script interfaces, and artifact layout.
|
|
92
|
-
- `references/evidence/` is unused until durable examples are needed.
|
|
93
|
-
- `scripts/` contains repeatable automation for scan, extraction, issue creation, PR indexing, reviewer selection, report generation, and organization.
|
|
94
|
-
- `assets/` is unused.
|
|
95
|
-
|
|
96
|
-
## Evaluation
|
|
97
|
-
|
|
98
|
-
- Lightweight validation:
|
|
99
|
-
- Run the skill validator against `skills/warden-sweep`.
|
|
100
|
-
- Confirm every script mentioned in `SKILL.md` and references exists.
|
|
101
|
-
- Confirm every phase reference has one clear lookup purpose.
|
|
102
|
-
- Deeper evaluation:
|
|
103
|
-
- Run a dry sweep in a small fixture repository when script or artifact behavior changes.
|
|
104
|
-
- Exercise resume paths for scan, verify, issue, patch, and organize phases.
|
|
105
|
-
- Holdout examples:
|
|
106
|
-
- Store redacted false positive and duplicate-PR examples in `references/evidence/` if these failures recur.
|
|
107
|
-
- Acceptance gates:
|
|
108
|
-
- Findings are verified before patching.
|
|
109
|
-
- Patch phase creates isolated branches and draft PRs.
|
|
110
|
-
- Existing overlapping PRs are detected before creating new PRs.
|
|
111
|
-
- Final artifacts are resumable and summarize errors separately from successful work.
|
|
112
|
-
|
|
113
|
-
## Known Limitations
|
|
114
|
-
|
|
115
|
-
- The workflow depends on external CLIs and repository permissions.
|
|
116
|
-
- Verification and patching quality depends on the host agent's ability to inspect code deeply.
|
|
117
|
-
- The skill uses host-agent delegation when available; hosts without parallel delegation can run the same verification steps serially.
|
|
118
|
-
- Broad scans can be expensive and noisy if repository Warden configuration is too broad.
|
|
119
|
-
|
|
120
|
-
## Maintenance Notes
|
|
121
|
-
|
|
122
|
-
- Update `SKILL.md` when phase order, universal constraints, or routing changes.
|
|
123
|
-
- Update `SOURCES.md` when source inventory, decisions, coverage, or known gaps change.
|
|
124
|
-
- Update phase references when script arguments, output shapes, artifact schema, or error handling changes.
|
|
125
|
-
- Update prompt templates when verification or patch quality failures recur.
|
|
126
|
-
- Update `references/evidence/` when preserving redacted examples will improve future iterations.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Issue Phase
|
|
2
|
-
|
|
3
|
-
Create a tracking issue that ties all generated PRs together and gives reviewers one overview.
|
|
4
|
-
|
|
5
|
-
## Run
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
uv run <skill-root>/scripts/create_issue.py ${SWEEP_DIR}
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Process
|
|
12
|
-
|
|
13
|
-
1. Parse the JSON stdout.
|
|
14
|
-
2. Save `issueUrl` and `issueNumber`.
|
|
15
|
-
3. If the script fails, show the error and continue to the patch phase. PRs can still be created without a tracking issue.
|
|
16
|
-
4. Update the checklist: Phase 3 complete.
|
|
17
|
-
|
|
18
|
-
## Report Template
|
|
19
|
-
|
|
20
|
-
```markdown
|
|
21
|
-
## Tracking Issue Created
|
|
22
|
-
|
|
23
|
-
{issueUrl}
|
|
24
|
-
```
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Organize Phase
|
|
2
|
-
|
|
3
|
-
Finalize sweep artifacts, security views, PR links, and the summary report.
|
|
4
|
-
|
|
5
|
-
## Run
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
uv run <skill-root>/scripts/organize.py ${SWEEP_DIR}
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Process
|
|
12
|
-
|
|
13
|
-
1. Parse the JSON stdout.
|
|
14
|
-
2. Confirm `summary.md` and `data/report.json` were produced.
|
|
15
|
-
3. If the script fails, show the error and note which phases completed.
|
|
16
|
-
4. Update the checklist: Phase 5 complete.
|
|
17
|
-
|
|
18
|
-
## Report Template
|
|
19
|
-
|
|
20
|
-
```markdown
|
|
21
|
-
## Sweep Complete
|
|
22
|
-
|
|
23
|
-
| Metric | Count |
|
|
24
|
-
|--------|-------|
|
|
25
|
-
| Files scanned | {filesScanned} |
|
|
26
|
-
| Findings verified | {verified} |
|
|
27
|
-
| PRs created | {prsCreated} |
|
|
28
|
-
| Security findings | {securityFindings} |
|
|
29
|
-
|
|
30
|
-
Full report: `{summaryPath}`
|
|
31
|
-
```
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
# Patch Phase
|
|
2
|
-
|
|
3
|
-
Create isolated fixes for verified findings and open draft PRs.
|
|
4
|
-
|
|
5
|
-
## Contents
|
|
6
|
-
|
|
7
|
-
- Rules
|
|
8
|
-
- Setup
|
|
9
|
-
- Per-Finding Process
|
|
10
|
-
- Dedup Check
|
|
11
|
-
- Worktree, Fix, Reviewers, And PR
|
|
12
|
-
- Report Template
|
|
13
|
-
|
|
14
|
-
## Rules
|
|
15
|
-
|
|
16
|
-
- Patch high-severity and above.
|
|
17
|
-
- Patch medium findings only when they come from bug-detection skills such as `code-review` or `security-review`.
|
|
18
|
-
- Skip low and info findings.
|
|
19
|
-
- Process findings sequentially.
|
|
20
|
-
- Create one worktree and one branch per finding.
|
|
21
|
-
- Clean up worktrees after success or failure.
|
|
22
|
-
|
|
23
|
-
## Setup
|
|
24
|
-
|
|
25
|
-
Index existing PRs before patching:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
uv run <skill-root>/scripts/index_prs.py ${SWEEP_DIR}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Parse the JSON stdout and use `fileIndex` for dedup checks.
|
|
32
|
-
|
|
33
|
-
Determine the default branch and fetch latest:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')
|
|
37
|
-
git fetch origin "${DEFAULT_BRANCH}"
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Per-Finding Process
|
|
41
|
-
|
|
42
|
-
For each finding in `data/verified.jsonl`:
|
|
43
|
-
|
|
44
|
-
1. If the finding ID already exists in `data/patches.jsonl`, skip it.
|
|
45
|
-
2. Run the dedup check.
|
|
46
|
-
3. Create a worktree.
|
|
47
|
-
4. Apply the fix using `references/patch-prompt.md`.
|
|
48
|
-
5. If the patch task returns `"status": "skipped"`, record an error, clean up the worktree, and continue.
|
|
49
|
-
6. Find reviewers.
|
|
50
|
-
7. Push the branch.
|
|
51
|
-
8. Create a draft PR.
|
|
52
|
-
9. Record the result in `data/patches.jsonl`.
|
|
53
|
-
10. Clean up the worktree.
|
|
54
|
-
|
|
55
|
-
## Dedup Check
|
|
56
|
-
|
|
57
|
-
Use the file index from `index_prs.py`:
|
|
58
|
-
|
|
59
|
-
1. File match: if no open Warden PR touches the finding file, proceed.
|
|
60
|
-
2. Chunk overlap: if a PR touches the same file, read `data/pr-diffs/<number>.diff` and check whether changed hunks overlap or sit within roughly 10 lines of the finding range.
|
|
61
|
-
3. Same concern: compare PR title and finding title/description.
|
|
62
|
-
|
|
63
|
-
Skip the finding only when there is both chunk overlap and the PR addresses the same concern. Record it with `"status": "existing"` and the matching `prUrl`.
|
|
64
|
-
|
|
65
|
-
## Worktree, Fix, Reviewers, And PR
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
BRANCH="warden-sweep/${RUN_ID}/${FINDING_ID}"
|
|
69
|
-
WORKTREE="${SWEEP_DIR}/worktrees/${FINDING_ID}"
|
|
70
|
-
git worktree add "${WORKTREE}" -b "${BRANCH}" "origin/${DEFAULT_BRANCH}"
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Each finding branches from the default branch so PRs contain only the fix commit.
|
|
74
|
-
|
|
75
|
-
Run patch work using the host agent's task/delegation mechanism when available. Read `references/patch-prompt.md` and substitute the finding values and worktree path into the `${...}` placeholders.
|
|
76
|
-
|
|
77
|
-
If delegated tasks are not available, apply the prompt instructions yourself in the worktree.
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
uv run <skill-root>/scripts/find_reviewers.py "${FILE_PATH}"
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
cd "${WORKTREE}" && git push -u origin HEAD:"${BRANCH}"
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Create the PR with a short "what" summary followed by the finding description and verification reasoning:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
gh pr create --draft \
|
|
91
|
-
--label "warden" \
|
|
92
|
-
--title "fix: ${TITLE}" \
|
|
93
|
-
--body "$(cat <<'EOF'
|
|
94
|
-
${FIX_WHAT_DESCRIPTION}
|
|
95
|
-
|
|
96
|
-
${DESCRIPTION}
|
|
97
|
-
|
|
98
|
-
${REASONING}
|
|
99
|
-
|
|
100
|
-
Automated fix for Warden finding ${FINDING_ID} (${SEVERITY}, detected by ${SKILL}).
|
|
101
|
-
|
|
102
|
-
<!-- Only include the next line if Phase 3 succeeded and ISSUE_NUMBER is available -->
|
|
103
|
-
Ref #${ISSUE_NUMBER}
|
|
104
|
-
|
|
105
|
-
> This PR was auto-generated by a Warden Sweep (run ${RUN_ID}).
|
|
106
|
-
> The finding has been validated through automated deep tracing,
|
|
107
|
-
> but human confirmation is requested as this is batch work.
|
|
108
|
-
EOF
|
|
109
|
-
)" ${REVIEWERS}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Record Result
|
|
113
|
-
|
|
114
|
-
Append to `data/patches.jsonl`. Use `"created"` for successful PRs, not the patch task's `"applied"` status.
|
|
115
|
-
|
|
116
|
-
```json
|
|
117
|
-
{"findingId": "...", "prUrl": "https://...", "branch": "...", "reviewers": ["user1", "user2"], "filesChanged": ["..."], "status": "created|existing|error"}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Clean up:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
cd "$(git rev-parse --show-toplevel)"
|
|
124
|
-
git worktree remove "${WORKTREE}" --force
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
On failure at any step, write `"status": "error"` with an `"error"` message, clean up the worktree, and continue.
|
|
128
|
-
|
|
129
|
-
Update the manifest: set `phases.patch` to `"complete"`.
|
|
130
|
-
|
|
131
|
-
## Report Template
|
|
132
|
-
|
|
133
|
-
```markdown
|
|
134
|
-
## PRs Created
|
|
135
|
-
|
|
136
|
-
**{created}** created, **{skipped}** skipped (existing), **{failed}** failed.
|
|
137
|
-
|
|
138
|
-
| # | Finding | PR | Status |
|
|
139
|
-
|---|---------|----|--------|
|
|
140
|
-
| 1 | `security-review-a1b2c3d4` SQL injection in query builder | #142 | created |
|
|
141
|
-
| 2 | `code-review-e5f6g7h8` Null pointer in handler | - | existing (#138) |
|
|
142
|
-
```
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
Fix a verified code issue. You are working in a git worktree at: ${WORKTREE}
|
|
2
|
-
|
|
3
|
-
## Finding
|
|
4
|
-
- Title: ${TITLE}
|
|
5
|
-
- File: ${FILE_PATH}:${START_LINE}
|
|
6
|
-
- Description: ${DESCRIPTION}
|
|
7
|
-
- Verification: ${REASONING}
|
|
8
|
-
- Suggested Fix: ${FIX_DESCRIPTION}
|
|
9
|
-
```diff
|
|
10
|
-
${FIX_DIFF}
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Instructions
|
|
14
|
-
|
|
15
|
-
### Step 1: Understand the code
|
|
16
|
-
Read the file at ${WORKTREE}/${FILE_PATH}. Read at least 50 lines above and below the reported location. Trace callers and callees of the affected code using Grep/Glob to understand how it is used. Do NOT skip this step.
|
|
17
|
-
|
|
18
|
-
### Step 2: Apply a minimal fix
|
|
19
|
-
Apply the smallest change that addresses the finding. If the suggested diff doesn't apply cleanly, adapt it while preserving intent. Do NOT refactor surrounding code, rename variables, add comments, or make any change beyond what the finding requires.
|
|
20
|
-
|
|
21
|
-
### Step 3: Write tests
|
|
22
|
-
Write or update tests that verify the fix:
|
|
23
|
-
- Follow existing test patterns (co-located files, same framework)
|
|
24
|
-
- At minimum, write a test that would have caught the original bug
|
|
25
|
-
- Test the specific edge case, not just the happy path
|
|
26
|
-
|
|
27
|
-
Only modify the fix target and its test file.
|
|
28
|
-
|
|
29
|
-
### Step 4: Self-review
|
|
30
|
-
Before staging, run `git diff` in the worktree and review every changed line. Verify:
|
|
31
|
-
1. The change addresses the specific finding described, not something else
|
|
32
|
-
2. No unrelated code was modified (no drive-by cleanups, no formatting changes)
|
|
33
|
-
3. Trace through changed code paths: does the fix introduce any new bug, null reference, type error, or broken import?
|
|
34
|
-
4. Tests exercise the fix (the failure case), not just that the code runs
|
|
35
|
-
|
|
36
|
-
If ANY check fails, fix the problem before proceeding. If the suggested fix is wrong or would introduce a regression you cannot resolve, do NOT commit. Instead, skip to the output step and report why.
|
|
37
|
-
|
|
38
|
-
### Step 5: Commit
|
|
39
|
-
Do NOT run tests locally. CI will validate the changes.
|
|
40
|
-
|
|
41
|
-
Stage and commit with this exact message:
|
|
42
|
-
|
|
43
|
-
fix: ${TITLE}
|
|
44
|
-
|
|
45
|
-
Warden finding ${FINDING_ID}
|
|
46
|
-
Severity: ${SEVERITY}
|
|
47
|
-
|
|
48
|
-
Co-Authored-By: Warden <noreply@getsentry.com>
|
|
49
|
-
|
|
50
|
-
### Step 6: Output
|
|
51
|
-
Return ONLY valid JSON (no surrounding text). Use `"status": "applied"` if you committed a fix, or `"status": "skipped"` if you did not.
|
|
52
|
-
|
|
53
|
-
```json
|
|
54
|
-
{
|
|
55
|
-
"status": "applied",
|
|
56
|
-
"filesChanged": ["src/example.ts"],
|
|
57
|
-
"testFilesChanged": ["src/example.test.ts"],
|
|
58
|
-
"selfReview": "Verified the fix addresses the null check and test covers the failure case",
|
|
59
|
-
"skipReason": null
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
When skipping:
|
|
64
|
-
```json
|
|
65
|
-
{
|
|
66
|
-
"status": "skipped",
|
|
67
|
-
"filesChanged": [],
|
|
68
|
-
"testFilesChanged": [],
|
|
69
|
-
"selfReview": null,
|
|
70
|
-
"skipReason": "The suggested fix would introduce a regression in the error handling path"
|
|
71
|
-
}
|
|
72
|
-
```
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Resume And Artifacts
|
|
2
|
-
|
|
3
|
-
Use this reference when resuming a partial sweep or inspecting generated files.
|
|
4
|
-
|
|
5
|
-
## Resume Rules
|
|
6
|
-
|
|
7
|
-
Each phase is incremental:
|
|
8
|
-
|
|
9
|
-
1. Check `data/manifest.json` for phase state.
|
|
10
|
-
2. For scan, pass `--sweep-dir` to `scan.py`.
|
|
11
|
-
3. For verify, skip existing `data/verify/<id>.json` files.
|
|
12
|
-
4. For issue, `create_issue.py` skips if `issueUrl` exists in the manifest.
|
|
13
|
-
5. For patch, skip existing entries in `data/patches.jsonl`.
|
|
14
|
-
6. For organize, rerun safely.
|
|
15
|
-
|
|
16
|
-
Continue from the first incomplete phase. Do not start a new sweep unless the user asks for a clean run.
|
|
17
|
-
|
|
18
|
-
## Output Directory Structure
|
|
19
|
-
|
|
20
|
-
```text
|
|
21
|
-
.warden/sweeps/<run-id>/
|
|
22
|
-
summary.md # Stats, key findings, PR links
|
|
23
|
-
findings/ # One markdown per verified finding
|
|
24
|
-
<finding-id>.md
|
|
25
|
-
security/ # Security-specific view
|
|
26
|
-
index.jsonl # Security findings index
|
|
27
|
-
<finding-id>.md # Copies of security findings
|
|
28
|
-
data/ # Structured data for tooling
|
|
29
|
-
manifest.json # Run metadata, phase state
|
|
30
|
-
scan-index.jsonl # Per-file scan tracking
|
|
31
|
-
all-findings.jsonl # Every finding from scan
|
|
32
|
-
verified.jsonl # Findings that passed verification
|
|
33
|
-
rejected.jsonl # Findings that failed verification
|
|
34
|
-
patches.jsonl # Finding -> PR URL -> reviewers
|
|
35
|
-
existing-prs.json # Cached open Warden PRs
|
|
36
|
-
report.json # Machine-readable summary
|
|
37
|
-
verify/ # Individual verification results
|
|
38
|
-
<finding-id>.json
|
|
39
|
-
logs/ # Warden JSONL logs per file
|
|
40
|
-
<hash>.jsonl
|
|
41
|
-
pr-diffs/ # Cached PR diffs for dedup
|
|
42
|
-
<number>.diff
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Failure Handling
|
|
46
|
-
|
|
47
|
-
- Preserve partial artifacts.
|
|
48
|
-
- Record per-finding errors in the relevant JSONL file.
|
|
49
|
-
- Distinguish timed-out files from errored files.
|
|
50
|
-
- Clean up worktrees before retrying patch work.
|
|
51
|
-
- Re-run organize after manual recovery to refresh reports.
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Scan Phase
|
|
2
|
-
|
|
3
|
-
Run Warden across repository files and collect normalized findings.
|
|
4
|
-
|
|
5
|
-
## Run
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
uv run <skill-root>/scripts/scan.py
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
To scan only specific files:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
uv run <skill-root>/scripts/scan.py src/foo.ts src/bar.ts
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
To resume a partial scan:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
uv run <skill-root>/scripts/scan.py --sweep-dir .warden/sweeps/<run-id>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Process
|
|
24
|
-
|
|
25
|
-
1. Parse the JSON stdout.
|
|
26
|
-
2. Save `runId` and `sweepDir`.
|
|
27
|
-
3. Treat exit code `1` as fatal and stop.
|
|
28
|
-
4. Treat exit code `2` as partial: report timed-out and errored files separately, then continue only if the user accepts the partial results.
|
|
29
|
-
5. Render every finding from the `findings` array.
|
|
30
|
-
6. Update the checklist: Phase 1 complete.
|
|
31
|
-
|
|
32
|
-
## Report Template
|
|
33
|
-
|
|
34
|
-
```markdown
|
|
35
|
-
## Scan Complete
|
|
36
|
-
|
|
37
|
-
Scanned **{filesScanned}** files, **{filesTimedOut}** timed out, **{filesErrored}** errors.
|
|
38
|
-
|
|
39
|
-
### Findings ({totalFindings} total)
|
|
40
|
-
|
|
41
|
-
| # | Severity | Skill | File | Title |
|
|
42
|
-
|---|----------|-------|------|-------|
|
|
43
|
-
| 1 | **HIGH** | security-review | `src/db/query.ts:42` | SQL injection in query builder |
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Bold severity for high and above.
|