@sentry/warden 0.34.0 → 0.35.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/bin/warden.js +19 -0
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +9 -5
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/add.js +3 -1
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +4 -3
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +7 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/runs.js +4 -4
- package/dist/cli/commands/runs.js.map +1 -1
- package/dist/cli/help.js +6 -6
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/index.js +0 -0
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +22 -13
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/output/jsonl-schema-gen.js +1 -1
- package/dist/cli/output/jsonl-schema-gen.js.map +1 -1
- package/dist/cli/output/jsonl.d.ts +26 -0
- package/dist/cli/output/jsonl.d.ts.map +1 -1
- package/dist/config/loader.d.ts +7 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +5 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +35 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +21 -8
- package/dist/config/schema.js.map +1 -1
- package/dist/config/writer.d.ts.map +1 -1
- package/dist/config/writer.js +7 -0
- package/dist/config/writer.js.map +1 -1
- package/dist/event/context.d.ts.map +1 -1
- package/dist/event/context.js +9 -0
- package/dist/event/context.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/output/dedup.d.ts +14 -1
- package/dist/output/dedup.d.ts.map +1 -1
- package/dist/output/dedup.js +92 -11
- package/dist/output/dedup.js.map +1 -1
- package/dist/output/renderer.d.ts.map +1 -1
- package/dist/output/renderer.js +2 -1
- package/dist/output/renderer.js.map +1 -1
- package/dist/sdk/analyze.d.ts +3 -0
- package/dist/sdk/analyze.d.ts.map +1 -1
- package/dist/sdk/analyze.js +85 -21
- package/dist/sdk/analyze.js.map +1 -1
- package/dist/sdk/errors.d.ts +1 -0
- package/dist/sdk/errors.d.ts.map +1 -1
- package/dist/sdk/errors.js +13 -5
- package/dist/sdk/errors.js.map +1 -1
- package/dist/sdk/extract.d.ts +1 -1
- package/dist/sdk/extract.d.ts.map +1 -1
- package/dist/sdk/extract.js +14 -6
- package/dist/sdk/extract.js.map +1 -1
- package/dist/sdk/local.d.ts +32 -0
- package/dist/sdk/local.d.ts.map +1 -0
- package/dist/sdk/local.js +32 -0
- package/dist/sdk/local.js.map +1 -0
- package/dist/sdk/model-pricing.json +8 -0
- package/dist/sdk/post-process.d.ts +2 -1
- package/dist/sdk/post-process.d.ts.map +1 -1
- package/dist/sdk/post-process.js +1 -0
- package/dist/sdk/post-process.js.map +1 -1
- package/dist/sdk/pricing.d.ts +4 -3
- package/dist/sdk/pricing.d.ts.map +1 -1
- package/dist/sdk/pricing.js +3 -1
- package/dist/sdk/pricing.js.map +1 -1
- package/dist/sdk/runner.d.ts +4 -1
- package/dist/sdk/runner.d.ts.map +1 -1
- package/dist/sdk/runner.js +2 -1
- package/dist/sdk/runner.js.map +1 -1
- package/dist/sdk/runtimes/claude.d.ts.map +1 -1
- package/dist/sdk/runtimes/claude.js +11 -1
- package/dist/sdk/runtimes/claude.js.map +1 -1
- package/dist/sdk/runtimes/model-selectors.d.ts +1 -1
- package/dist/sdk/runtimes/model-selectors.d.ts.map +1 -1
- package/dist/sdk/runtimes/model-selectors.js +2 -4
- package/dist/sdk/runtimes/model-selectors.js.map +1 -1
- package/dist/sdk/runtimes/pi.d.ts.map +1 -1
- package/dist/sdk/runtimes/pi.js +3 -1
- package/dist/sdk/runtimes/pi.js.map +1 -1
- package/dist/sdk/runtimes/types.d.ts +2 -1
- package/dist/sdk/runtimes/types.d.ts.map +1 -1
- package/dist/sdk/types.d.ts +5 -1
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/sdk/verify.d.ts +2 -1
- package/dist/sdk/verify.d.ts.map +1 -1
- package/dist/sdk/verify.js +7 -6
- package/dist/sdk/verify.js.map +1 -1
- package/dist/skills/loader.d.ts +6 -1
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +63 -23
- package/dist/skills/loader.js.map +1 -1
- package/dist/triggers/matcher.d.ts.map +1 -1
- package/dist/triggers/matcher.js +19 -0
- package/dist/triggers/matcher.js.map +1 -1
- package/dist/types/index.d.ts +52 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/path.d.ts +6 -0
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +18 -1
- package/dist/utils/path.js.map +1 -1
- package/package.json +16 -46
- package/skills/warden/SOURCES.md +2 -2
- package/skills/warden/references/cli-reference.md +1 -1
- package/skills/warden/references/config-schema.md +3 -0
- package/skills/warden/references/configuration.md +11 -0
- package/skills/warden-sweep/SOURCES.md +5 -5
- package/skills/warden-sweep/SPEC.md +1 -1
- package/.oxlintrc.json +0 -170
- package/CHANGELOG.md +0 -3430
- package/README.md +0 -52
- package/TELEMETRY.md +0 -322
- package/policies/README.md +0 -22
- package/policies/code-comments.md +0 -20
- package/policies/policy-template.md +0 -14
- package/src/internal-skills/skill-writer/scripts/quick_validate_test.py +0 -79
- package/test-results.junit.xml +0 -4372
package/README.md
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="assets/warden-icon.svg" alt="Warden" width="128" height="128">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
# warden
|
|
6
|
-
|
|
7
|
-
Your code is under new management. Agents that review your code - locally or on every PR - using the Skills you already know and love.
|
|
8
|
-
|
|
9
|
-
## Why Warden?
|
|
10
|
-
|
|
11
|
-
**Skills, not prompts.** Define analysis once, run it anywhere. Bootstrap your environment with skills from conventional directories (`.agents/skills/` or `.claude/skills/`).
|
|
12
|
-
|
|
13
|
-
**Two ways to run.** CLI catches issues before you push. GitHub Action reviews every PR automatically.
|
|
14
|
-
|
|
15
|
-
**GitHub-native.** Findings appear as inline PR comments with suggested fixes.
|
|
16
|
-
|
|
17
|
-
## Quick Start
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Initialize warden in your repository
|
|
21
|
-
npx @sentry/warden init
|
|
22
|
-
|
|
23
|
-
# Add the built-in baseline reviews
|
|
24
|
-
npx @sentry/warden add security-review
|
|
25
|
-
npx @sentry/warden add code-review
|
|
26
|
-
|
|
27
|
-
# Run a pre-review on current branch changes
|
|
28
|
-
# Uses Pi. Set WARDEN_OPENAI_API_KEY, or WARDEN_ANTHROPIC_API_KEY for Anthropic models.
|
|
29
|
-
npx @sentry/warden
|
|
30
|
-
|
|
31
|
-
# Fix issues automatically
|
|
32
|
-
npx @sentry/warden --fix
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**[Read the full documentation →](https://warden.sentry.dev/)**
|
|
36
|
-
|
|
37
|
-
## Contributing
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
git clone git@github.com:getsentry/warden.git
|
|
41
|
-
cd warden
|
|
42
|
-
pnpm install && pnpm build
|
|
43
|
-
pnpm test # unit tests
|
|
44
|
-
pnpm test:coverage # unit tests with LCOV coverage
|
|
45
|
-
pnpm evals # end-to-end evals (requires API key)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
See [`packages/evals/README.md`](packages/evals/README.md) for the eval framework.
|
|
49
|
-
|
|
50
|
-
## License
|
|
51
|
-
|
|
52
|
-
FSL-1.1-ALv2
|
package/TELEMETRY.md
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
spec: https://github.com/getsentry/junior/blob/main/TELEMETRY.spec.md
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Telemetry
|
|
6
|
-
|
|
7
|
-
## Goal
|
|
8
|
-
|
|
9
|
-
Use this when investigating Warden production incidents in the CLI or GitHub
|
|
10
|
-
Action. Start with a Sentry event, trace ID, repository, GitHub Action run,
|
|
11
|
-
skill or trigger name, file path, finding ID, or model/tool symptom, then use
|
|
12
|
-
the recipes below to find the failing run and next query.
|
|
13
|
-
|
|
14
|
-
Primary backend: Sentry Logs, Issues, Spans/Traces, and Metrics. Local CLI runs
|
|
15
|
-
also write `.warden/logs/*.jsonl`; those logs can carry the Sentry `traceId`
|
|
16
|
-
when telemetry is enabled.
|
|
17
|
-
|
|
18
|
-
## Where To Query
|
|
19
|
-
|
|
20
|
-
| Starting Point | Query Surface | Pivot | Answers | Next Step |
|
|
21
|
-
| -------------- | ------------- | ----- | ------- | --------- |
|
|
22
|
-
| `trace_id` from CLI summary, JSONL, or `Workflow initialized` | Sentry Traces and Logs | `span_id` | full run timeline, slow/error span | inspect skill or workflow span |
|
|
23
|
-
| Sentry `event_id` | Sentry Issues/Event | `trace_id`, `operation`, `warden.trigger.name`, `gen_ai.agent.name` | exception context and owning workflow | query trace logs |
|
|
24
|
-
| GitHub repository or Action run | Sentry Logs and Metrics | `vcs.owner.name`, `vcs.repository.name`, `cicd.pipeline.run.id`, `github.event.name` | recent Warden runs and trigger count | open matching trace |
|
|
25
|
-
| Skill or trigger name | Sentry Spans, Issues, Metrics | `gen_ai.agent.name`, `warden.trigger.name` | failing skill, model cost, finding count | inspect hunk or agent spans |
|
|
26
|
-
| File path or hunk | Sentry Spans | `code.file.path`, `warden.hunk.line_range` | hunk analysis state and extraction failures | inspect agent span |
|
|
27
|
-
| Model, tool, or token symptom | Sentry Spans | `gen_ai.*`, `gen_ai.tool.name` | Claude turn, tool, cost, and token behavior | inspect child spans |
|
|
28
|
-
| Stale comment or fix-eval symptom | Sentry Spans and Metrics | `warden.fix_eval.finding_id`, `warden.fix_eval.verdict` | whether a finding was evaluated or resolved | inspect fix eval span |
|
|
29
|
-
|
|
30
|
-
## Investigation Pivots
|
|
31
|
-
|
|
32
|
-
| Pivot | Meaning | Found In | First Query |
|
|
33
|
-
| ----- | ------- | -------- | ----------- |
|
|
34
|
-
| `trace_id` | one Warden run trace | CLI verbose summary, JSONL, logs, issues, spans | open trace |
|
|
35
|
-
| `span_id` | one workflow, skill, hunk, model, or tool span | logs, spans | inspect span |
|
|
36
|
-
| `event_id` | captured Sentry error | Sentry issue/event | open event |
|
|
37
|
-
| `vcs.repository.name` | repository name | global attributes, logs, metrics, spans | repo runs |
|
|
38
|
-
| `vcs.owner.name` | repository owner or org | global attributes, logs, metrics, spans | repo runs |
|
|
39
|
-
| `vcs.repository.url.full` | canonical repository URL | global attributes, logs, metrics, spans | exact repo runs |
|
|
40
|
-
| `github.event.name` | Action event name | `workflow.run` span | action entry |
|
|
41
|
-
| `cicd.pipeline.run.id` | GitHub Actions run ID | global attributes, logs, metrics, spans | action run |
|
|
42
|
-
| `cicd.pipeline.run.url.full` | GitHub Actions run URL | global attributes, logs, metrics, spans | action run |
|
|
43
|
-
| `warden.trigger.name` | matched Warden trigger | trigger exceptions | trigger failures |
|
|
44
|
-
| `gen_ai.agent.name` | configured or resolved skill/agent | spans, issues, metrics | skill timeline |
|
|
45
|
-
| `code.file.path` | file being analyzed or judged | hunk/file/fix spans | file analysis |
|
|
46
|
-
| `gen_ai.conversation.id` | Claude Code SDK session ID | `gen_ai.invoke_agent` span | agent session |
|
|
47
|
-
| `warden.fix_eval.finding_id` | finding comment identity | fix evaluation spans | fix verdict |
|
|
48
|
-
|
|
49
|
-
## Query Recipes
|
|
50
|
-
|
|
51
|
-
Trace log history after opening a Sentry event, CLI JSONL run, or verbose CLI
|
|
52
|
-
summary.
|
|
53
|
-
|
|
54
|
-
```text
|
|
55
|
-
dataset=logs query='trace_id:"<trace_id>"'
|
|
56
|
-
fields=timestamp,level,message,trace_id,span_id,vcs.owner.name,vcs.repository.name,gen_ai.agent.name,warden.trigger.name,error.type,exception.message
|
|
57
|
-
sort=timestamp
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Recent GitHub Action runs for a repository.
|
|
61
|
-
|
|
62
|
-
```text
|
|
63
|
-
dataset=logs query='message:"Workflow initialized" vcs.owner.name:"<owner>" vcs.repository.name:"<repo>"'
|
|
64
|
-
fields=timestamp,trace_id,github.event.name,cicd.pipeline.run.id,cicd.pipeline.run.url.full,warden.trigger.count,release,environment
|
|
65
|
-
sort=-timestamp
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Workflow run spans for a repository.
|
|
69
|
-
|
|
70
|
-
```text
|
|
71
|
-
dataset=spans query='span.op:workflow.run vcs.owner.name:"<owner>" vcs.repository.name:"<repo>"'
|
|
72
|
-
fields=timestamp,trace,span_id,span.duration,github.event.name,cicd.pipeline.run.id,cicd.pipeline.run.url.full,warden.trigger.count,warden.finding.count,error.type
|
|
73
|
-
sort=-timestamp
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Skill execution timeline for a slow or failing skill.
|
|
77
|
-
|
|
78
|
-
```text
|
|
79
|
-
dataset=spans query='span.op:skill.run gen_ai.agent.name:"<skill_name>"'
|
|
80
|
-
fields=timestamp,trace,span_id,span.duration,gen_ai.agent.name,warden.trigger.name,warden.file.count,warden.finding.count,error.type
|
|
81
|
-
sort=-timestamp
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
`warden.trigger.name` is present only for trigger-backed runs. Direct CLI skill
|
|
85
|
-
runs have `gen_ai.agent.name` without trigger metadata.
|
|
86
|
-
|
|
87
|
-
File or hunk analysis for a suspicious path.
|
|
88
|
-
|
|
89
|
-
```text
|
|
90
|
-
dataset=spans query='span.op:skill.analyze_hunk code.file.path:"<path>"'
|
|
91
|
-
fields=timestamp,trace,span_id,span.duration,gen_ai.agent.name,warden.hunk.line_range,warden.hunk.failed,warden.finding.count,error.type
|
|
92
|
-
sort=-timestamp
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Agent/model calls for token or provider symptoms.
|
|
96
|
-
|
|
97
|
-
```text
|
|
98
|
-
dataset=spans query='span.op:gen_ai.invoke_agent gen_ai.agent.name:"<skill_name>"'
|
|
99
|
-
fields=timestamp,trace,span_id,span.duration,gen_ai.conversation.id,gen_ai.request.model,gen_ai.response.model,gen_ai.usage.total_tokens,error.type
|
|
100
|
-
sort=-timestamp
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Structured auxiliary calls use `span.op:gen_ai.chat` and include
|
|
104
|
-
`warden.ai.task` (`extraction`, `deduplication`, `fix_quality`,
|
|
105
|
-
`fix_evaluation`, `consolidation`, or `skill_build`) when available.
|
|
106
|
-
|
|
107
|
-
Tool calls inside a Claude Code SDK turn or structured tool loop.
|
|
108
|
-
|
|
109
|
-
```text
|
|
110
|
-
dataset=spans query='span.op:gen_ai.execute_tool gen_ai.tool.name:"<tool_name>"'
|
|
111
|
-
fields=timestamp,trace,span_id,span.duration,gen_ai.agent.name,warden.ai.task,gen_ai.tool.name,error.type
|
|
112
|
-
sort=-timestamp
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Captured trigger or workflow exceptions.
|
|
116
|
-
|
|
117
|
-
```text
|
|
118
|
-
dataset=issues query='warden.trigger.name:"<trigger_name>" OR gen_ai.agent.name:"<skill_name>" OR operation:"<operation>"'
|
|
119
|
-
fields=timestamp,event_id,trace_id,operation,warden.trigger.name,gen_ai.agent.name,error.type,exception.message
|
|
120
|
-
sort=-timestamp
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Finding fix evaluation and stale comment resolution.
|
|
124
|
-
|
|
125
|
-
```text
|
|
126
|
-
dataset=spans query='span.op:fix_eval.evaluate warden.fix_eval.finding_id:"<finding_id>"'
|
|
127
|
-
fields=timestamp,trace,span_id,span.duration,code.file.path,code.line.number,gen_ai.agent.name,warden.fix_eval.verdict,warden.fix_eval.raw_verdict,warden.fix_eval.used_fallback,error.type
|
|
128
|
-
sort=-timestamp
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Repository-level health and cost.
|
|
132
|
-
|
|
133
|
-
```text
|
|
134
|
-
dataset=metrics query='metric:warden.workflow.runs OR metric:warden.skill.duration OR metric:warden.gen_ai.cost.usd vcs.owner.name:"<owner>" vcs.repository.name:"<repo>"'
|
|
135
|
-
fields=timestamp,metric,vcs.owner.name,vcs.repository.name,cicd.pipeline.run.id,gen_ai.agent.name,gen_ai.request.model,value
|
|
136
|
-
sort=-timestamp
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Total findings in a time window, segmented by skill and repository. Use the
|
|
140
|
-
Sentry time picker for the window. Query `skill.run` spans so the count uses
|
|
141
|
-
the final post-processed findings, not per-hunk candidates.
|
|
142
|
-
|
|
143
|
-
```text
|
|
144
|
-
dataset=spans query='span.op:skill.run warden.finding.count:>0'
|
|
145
|
-
fields=timestamp,trace,span_id,span.duration,vcs.owner.name,vcs.repository.name,gen_ai.agent.name,warden.trigger.name,warden.finding.count
|
|
146
|
-
aggregate=sum(warden.finding.count) by gen_ai.agent.name,vcs.owner.name,vcs.repository.name
|
|
147
|
-
sort=-timestamp
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Add `gen_ai.agent.name:"<skill_name>"`, `vcs.owner.name:"<owner>"`, or
|
|
151
|
-
`vcs.repository.name:"<repo>"` to narrow the same query.
|
|
152
|
-
|
|
153
|
-
Fix evaluation verdict breakdown for a skill. Use the Sentry time picker for
|
|
154
|
-
the window.
|
|
155
|
-
|
|
156
|
-
```text
|
|
157
|
-
dataset=spans query='span.op:fix_eval.evaluate gen_ai.agent.name:"<skill_name>"'
|
|
158
|
-
fields=timestamp,trace,span_id,span.duration,vcs.owner.name,vcs.repository.name,gen_ai.agent.name,code.file.path,code.line.number,warden.fix_eval.finding_id,warden.fix_eval.verdict,warden.fix_eval.raw_verdict,warden.fix_eval.used_fallback
|
|
159
|
-
aggregate=count() by warden.fix_eval.verdict,warden.fix_eval.used_fallback,gen_ai.agent.name,vcs.owner.name,vcs.repository.name
|
|
160
|
-
sort=-timestamp
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Finding lifecycle from analysis to fix evaluation. First find the evaluation
|
|
164
|
-
span by finding ID, then open the trace or query the trace ID with the path and
|
|
165
|
-
skill from that span.
|
|
166
|
-
|
|
167
|
-
```text
|
|
168
|
-
dataset=spans query='span.op:fix_eval.evaluate warden.fix_eval.finding_id:"<finding_id>"'
|
|
169
|
-
fields=timestamp,trace,span_id,span.duration,vcs.owner.name,vcs.repository.name,gen_ai.agent.name,code.file.path,code.line.number,warden.fix_eval.finding_id,warden.fix_eval.verdict,warden.fix_eval.raw_verdict
|
|
170
|
-
sort=-timestamp
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
```text
|
|
174
|
-
dataset=spans query='trace:"<trace_id>" (span.op:skill.run OR span.op:skill.analyze_hunk OR span.op:fix_eval.evaluate) gen_ai.agent.name:"<skill_name>"'
|
|
175
|
-
fields=timestamp,span.op,span_id,span.duration,code.file.path,warden.hunk.line_range,warden.finding.count,warden.fix_eval.finding_id,warden.fix_eval.verdict,warden.fix_eval.raw_verdict,error.type
|
|
176
|
-
sort=timestamp
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
## Domains
|
|
180
|
-
|
|
181
|
-
### Workflow Entry
|
|
182
|
-
|
|
183
|
-
The CLI or GitHub Action did not start, selected no work, or failed while
|
|
184
|
-
building repository context.
|
|
185
|
-
|
|
186
|
-
Events: `Workflow initialized`, top-level CLI/action fatal error
|
|
187
|
-
|
|
188
|
-
Spans: `workflow.run`, `workflow.init`, `config.load`
|
|
189
|
-
|
|
190
|
-
Attributes: `trace_id`, `vcs.owner.name`, `vcs.repository.name`,
|
|
191
|
-
`vcs.repository.url.full`, `warden.source`, `github.event.name`,
|
|
192
|
-
`cicd.pipeline.name`, `cicd.pipeline.run.id`,
|
|
193
|
-
`cicd.pipeline.run.url.full`, `warden.trigger.count`,
|
|
194
|
-
`warden.finding.count`
|
|
195
|
-
|
|
196
|
-
### Trigger And GitHub Review
|
|
197
|
-
|
|
198
|
-
The Action ran, but checks, comments, review posting, or trigger execution
|
|
199
|
-
failed.
|
|
200
|
-
|
|
201
|
-
Events: operation tags `create_core_check`, `fetch_existing_comments`,
|
|
202
|
-
`post_thread_reply`, `dismiss_review`, `update_core_check`
|
|
203
|
-
|
|
204
|
-
Spans: `workflow.setup`, `workflow.execute`, `trigger.execute`,
|
|
205
|
-
`workflow.review`
|
|
206
|
-
|
|
207
|
-
Attributes: `warden.trigger.name`, `gen_ai.agent.name`, `operation`,
|
|
208
|
-
`vcs.owner.name`, `vcs.repository.name`
|
|
209
|
-
|
|
210
|
-
### Skill Analysis
|
|
211
|
-
|
|
212
|
-
A skill was slow, returned no findings, failed every hunk, or analyzed the
|
|
213
|
-
wrong files.
|
|
214
|
-
|
|
215
|
-
Events: `Skill execution started`, `Skill execution complete`
|
|
216
|
-
|
|
217
|
-
Spans: `skill.run`, `skill.analyze_file`, `skill.analyze_hunk`
|
|
218
|
-
|
|
219
|
-
Attributes: `gen_ai.agent.name`, `warden.file.count`, `code.file.path`,
|
|
220
|
-
`warden.hunk.count`, `warden.hunk.line_range`, `warden.hunk.failed`,
|
|
221
|
-
`warden.finding.count`
|
|
222
|
-
|
|
223
|
-
### Agent And Model
|
|
224
|
-
|
|
225
|
-
Claude Code SDK execution, Anthropic calls, model choice, tokens, tool use, or
|
|
226
|
-
provider failures look wrong.
|
|
227
|
-
|
|
228
|
-
Events: SDK/runtime errors captured on the owning skill or trigger
|
|
229
|
-
|
|
230
|
-
Spans: `gen_ai.invoke_agent`, `gen_ai.chat`, `gen_ai.execute_tool`
|
|
231
|
-
|
|
232
|
-
Attributes: `gen_ai.agent.name`, `gen_ai.conversation.id`,
|
|
233
|
-
`gen_ai.request.model`, `gen_ai.response.model`, `gen_ai.usage.input_tokens`,
|
|
234
|
-
`gen_ai.usage.output_tokens`, `gen_ai.usage.total_tokens`,
|
|
235
|
-
`gen_ai.tool.name`
|
|
236
|
-
|
|
237
|
-
### Finding Pipeline
|
|
238
|
-
|
|
239
|
-
Findings were extracted, deduplicated, verified, merged, or stripped
|
|
240
|
-
unexpectedly.
|
|
241
|
-
|
|
242
|
-
Events: `Suggested fix quality gate`
|
|
243
|
-
|
|
244
|
-
Spans: skill spans plus auxiliary `gen_ai.invoke_agent` spans
|
|
245
|
-
|
|
246
|
-
Metrics: `warden.extraction.attempts`, `warden.extraction.findings`,
|
|
247
|
-
`warden.dedup.total`, `warden.dedup.unique`, `warden.dedup.removed`,
|
|
248
|
-
`warden.fix_gate.checked`, `warden.fix_gate.stripped_deterministic`,
|
|
249
|
-
`warden.fix_gate.stripped_semantic`, `warden.fix_gate.semantic_unavailable`
|
|
250
|
-
|
|
251
|
-
Attributes: `gen_ai.agent.name`, `warden.extraction.method`,
|
|
252
|
-
`warden.fix_gate.checked`, `warden.fix_gate.stripped_deterministic`,
|
|
253
|
-
`warden.fix_gate.stripped_semantic`, `warden.fix_gate.semantic_unavailable`
|
|
254
|
-
|
|
255
|
-
### Fix Evaluation And Stale Comments
|
|
256
|
-
|
|
257
|
-
Existing Warden comments were not resolved, were judged incorrectly, or fix
|
|
258
|
-
evaluation failed.
|
|
259
|
-
|
|
260
|
-
Events: operation tags `fetch_fix_context`, `evaluate_fix_attempts`,
|
|
261
|
-
`evaluate_fix_attempt`, `resolve_stale_comments`
|
|
262
|
-
|
|
263
|
-
Spans: `workflow.resolve`, `fix_eval.run`, `fix_eval.evaluate`
|
|
264
|
-
|
|
265
|
-
Attributes: `warden.fix_eval.comment_count`, `warden.fix_eval.finding_id`,
|
|
266
|
-
`gen_ai.agent.name`, `warden.fix_eval.verdict`,
|
|
267
|
-
`warden.fix_eval.raw_verdict`,
|
|
268
|
-
`warden.fix_eval.used_fallback`, `code.file.path`, `code.line.number`
|
|
269
|
-
|
|
270
|
-
### Local Run Logs
|
|
271
|
-
|
|
272
|
-
A local CLI report exists, but the matching Sentry trace or run metadata is
|
|
273
|
-
needed.
|
|
274
|
-
|
|
275
|
-
Events: JSONL records in `.warden/logs/*.jsonl`
|
|
276
|
-
|
|
277
|
-
Spans: `skill.run`, `skill.analyze_file`, `skill.analyze_hunk`,
|
|
278
|
-
`gen_ai.invoke_agent`
|
|
279
|
-
|
|
280
|
-
Attributes: `traceId` in JSONL, `runId`, `headSha`, `model`,
|
|
281
|
-
`gen_ai.agent.name` in telemetry
|
|
282
|
-
|
|
283
|
-
## Configuration
|
|
284
|
-
|
|
285
|
-
| Setting | Controls | Default |
|
|
286
|
-
| ------- | -------- | ------- |
|
|
287
|
-
| `WARDEN_SENTRY_DSN` | Enables Sentry logs, issues, traces, and metrics | disabled |
|
|
288
|
-
| `WARDEN_MODEL` | Fallback model recorded on gen AI spans and JSONL | SDK default when unset |
|
|
289
|
-
| `WARDEN_ANTHROPIC_API_KEY` | Anthropic auth for CI and auxiliary calls | falls back to `ANTHROPIC_API_KEY` or Claude auth |
|
|
290
|
-
| `ANTHROPIC_API_KEY` | Secondary Anthropic auth source | unset |
|
|
291
|
-
| `GITHUB_REPOSITORY` | Action repository scope for `vcs.*` attributes | GitHub Actions only |
|
|
292
|
-
| `GITHUB_EVENT_NAME` | Action event and `github.event.name` attribute | GitHub Actions only |
|
|
293
|
-
| `GITHUB_RUN_ID` | Action run scope for `cicd.pipeline.run.*` attributes | GitHub Actions only |
|
|
294
|
-
| `GITHUB_WORKFLOW` | Action workflow name for `cicd.pipeline.name` | GitHub Actions only |
|
|
295
|
-
| `GITHUB_JOB` | Action job name for `cicd.pipeline.task.name` | GitHub Actions only |
|
|
296
|
-
| CLI `--output` | Explicit JSONL output location | `.warden/logs/` run file |
|
|
297
|
-
|
|
298
|
-
## Attribute Notes
|
|
299
|
-
|
|
300
|
-
- `vcs.*`, `code.*`, and `gen_ai.*` fields follow OpenTelemetry semantic
|
|
301
|
-
conventions where applicable.
|
|
302
|
-
- `cicd.*` fields follow OpenTelemetry CI/CD semantic conventions for GitHub
|
|
303
|
-
Actions run metadata where there is a direct match.
|
|
304
|
-
- `warden.*` fields are Warden-owned local attributes for concepts that do not
|
|
305
|
-
have OpenTelemetry semantic attributes, such as triggers, hunks, finding
|
|
306
|
-
counts, and fix evaluation.
|
|
307
|
-
- `github.event.name` is GitHub-specific because OpenTelemetry does not define
|
|
308
|
-
the workflow trigger event name as a standard CI/CD attribute.
|
|
309
|
-
- `gen_ai.request.messages` and `gen_ai.response.text` may contain prompt or
|
|
310
|
-
model text. Use IDs, models, tokens, and status fields for triage unless the
|
|
311
|
-
incident specifically requires content inspection.
|
|
312
|
-
- `traceId` in JSONL is the same production pivot as Sentry `trace_id`.
|
|
313
|
-
|
|
314
|
-
## References
|
|
315
|
-
|
|
316
|
-
- [OpenTelemetry GenAI semantic conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/)
|
|
317
|
-
- [OpenTelemetry GenAI agent spans](https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-agent-spans/)
|
|
318
|
-
- [OpenTelemetry VCS attributes](https://opentelemetry.io/docs/specs/semconv/registry/attributes/vcs/)
|
|
319
|
-
- [OpenTelemetry code attributes](https://opentelemetry.io/docs/specs/semconv/registry/attributes/code/)
|
|
320
|
-
- [OpenTelemetry CI/CD attributes](https://opentelemetry.io/docs/specs/semconv/registry/attributes/cicd/)
|
|
321
|
-
- [Sentry AI Agents module](https://develop.sentry.dev/sdk/telemetry/traces/modules/ai-agents/)
|
|
322
|
-
- [Sentry JavaScript Node SDK logs](https://docs.sentry.io/platforms/javascript/guides/node/logs/)
|
package/policies/README.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Policies
|
|
2
|
-
|
|
3
|
-
Policies are short repo-wide defaults.
|
|
4
|
-
|
|
5
|
-
Use a policy doc when we want to say "this is how we normally do this here"
|
|
6
|
-
without turning it into a full architecture document or feature spec.
|
|
7
|
-
|
|
8
|
-
Good policy topics:
|
|
9
|
-
|
|
10
|
-
- code comments and docstrings
|
|
11
|
-
- testing expectations
|
|
12
|
-
- naming conventions
|
|
13
|
-
- migration hygiene
|
|
14
|
-
- automation safety boundaries
|
|
15
|
-
|
|
16
|
-
Keep policy docs small:
|
|
17
|
-
|
|
18
|
-
- explain the intent briefly
|
|
19
|
-
- state the default rule clearly
|
|
20
|
-
- call out only the meaningful exceptions
|
|
21
|
-
|
|
22
|
-
Use `policies/policy-template.md` for new policies.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Code Comments
|
|
2
|
-
|
|
3
|
-
## Intent
|
|
4
|
-
|
|
5
|
-
Comments are for non-obvious intent, invariants, and tradeoffs.
|
|
6
|
-
|
|
7
|
-
They are not there to narrate obvious code.
|
|
8
|
-
|
|
9
|
-
## Policy
|
|
10
|
-
|
|
11
|
-
- Add comments when behavior is easy to misread, policy-driven, or coupled to a non-obvious invariant.
|
|
12
|
-
- Exported functions must have a brief JSDoc comment explaining intent so future readers can change them safely.
|
|
13
|
-
- Prefer inline docstrings on tricky local helpers when future readers will need context to change them safely.
|
|
14
|
-
- Keep comments short and concrete. Explain why the code exists or what boundary it is protecting.
|
|
15
|
-
- Delete or rewrite stale comments immediately when behavior changes.
|
|
16
|
-
|
|
17
|
-
## Exceptions
|
|
18
|
-
|
|
19
|
-
- Do not comment obvious transformations or control flow.
|
|
20
|
-
- Do not add comments that simply restate the code in English.
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import importlib.util
|
|
2
|
-
import tempfile
|
|
3
|
-
import unittest
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
SCRIPT_PATH = Path(__file__).with_name("quick_validate.py")
|
|
8
|
-
SPEC = importlib.util.spec_from_file_location("quick_validate", SCRIPT_PATH)
|
|
9
|
-
assert SPEC is not None
|
|
10
|
-
quick_validate = importlib.util.module_from_spec(SPEC)
|
|
11
|
-
assert SPEC.loader is not None
|
|
12
|
-
SPEC.loader.exec_module(quick_validate)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class QuickValidateTest(unittest.TestCase):
|
|
16
|
-
def test_ignores_markdown_content_and_supporting_files(self) -> None:
|
|
17
|
-
with tempfile.TemporaryDirectory() as temp_dir:
|
|
18
|
-
skill_path = Path(temp_dir) / "example-skill"
|
|
19
|
-
skill_path.mkdir()
|
|
20
|
-
(skill_path / "SKILL.md").write_text(
|
|
21
|
-
"""---
|
|
22
|
-
name: example-skill
|
|
23
|
-
description: I can review <example> content.
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
This intentionally references missing content that review may care about:
|
|
27
|
-
|
|
28
|
-
- references/missing.md
|
|
29
|
-
- scripts/missing.py
|
|
30
|
-
- SOURCES.md
|
|
31
|
-
|
|
32
|
-
/Users/example/private/path should not be script-validated.
|
|
33
|
-
""",
|
|
34
|
-
encoding="utf-8",
|
|
35
|
-
)
|
|
36
|
-
(skill_path / "SPEC.md").write_text(
|
|
37
|
-
"""# Example Skill Spec
|
|
38
|
-
|
|
39
|
-
## Evaluation
|
|
40
|
-
|
|
41
|
-
Run the local checks for this skill.
|
|
42
|
-
""",
|
|
43
|
-
encoding="utf-8",
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
valid, errors, warnings, _skill_class = quick_validate.validate_skill(
|
|
47
|
-
skill_path,
|
|
48
|
-
selected_skill_class="integration-documentation",
|
|
49
|
-
strict_depth=True,
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
self.assertTrue(valid)
|
|
53
|
-
self.assertEqual(errors, [])
|
|
54
|
-
self.assertEqual(warnings, [])
|
|
55
|
-
|
|
56
|
-
def test_rejects_invalid_frontmatter_yaml(self) -> None:
|
|
57
|
-
with tempfile.TemporaryDirectory() as temp_dir:
|
|
58
|
-
skill_path = Path(temp_dir) / "example-skill"
|
|
59
|
-
skill_path.mkdir()
|
|
60
|
-
(skill_path / "SKILL.md").write_text(
|
|
61
|
-
"""---
|
|
62
|
-
name: [example-skill
|
|
63
|
-
description: Use when reviewing example code.
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
Review example code.
|
|
67
|
-
""",
|
|
68
|
-
encoding="utf-8",
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
valid, errors, warnings, _skill_class = quick_validate.validate_skill(skill_path)
|
|
72
|
-
|
|
73
|
-
self.assertFalse(valid)
|
|
74
|
-
self.assertEqual(warnings, [])
|
|
75
|
-
self.assertTrue(any("Invalid YAML in frontmatter" in message for message in errors), errors)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if __name__ == "__main__":
|
|
79
|
-
unittest.main()
|