@sentry/warden 0.11.0 → 0.13.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.
Files changed (142) hide show
  1. package/agents.lock +59 -0
  2. package/dist/cli/args.d.ts +7 -0
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +12 -1
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/cli/commands/add.js +1 -1
  7. package/dist/cli/commands/add.js.map +1 -1
  8. package/dist/cli/commands/init.d.ts.map +1 -1
  9. package/dist/cli/commands/init.js +26 -1
  10. package/dist/cli/commands/init.js.map +1 -1
  11. package/dist/cli/commands/sync.d.ts.map +1 -1
  12. package/dist/cli/commands/sync.js +16 -4
  13. package/dist/cli/commands/sync.js.map +1 -1
  14. package/dist/cli/fix.d.ts.map +1 -1
  15. package/dist/cli/fix.js +7 -23
  16. package/dist/cli/fix.js.map +1 -1
  17. package/dist/cli/input.d.ts +5 -0
  18. package/dist/cli/input.d.ts.map +1 -0
  19. package/dist/cli/input.js +23 -0
  20. package/dist/cli/input.js.map +1 -0
  21. package/dist/cli/log-cleanup.d.ts +19 -0
  22. package/dist/cli/log-cleanup.d.ts.map +1 -0
  23. package/dist/cli/log-cleanup.js +69 -0
  24. package/dist/cli/log-cleanup.js.map +1 -0
  25. package/dist/cli/main.d.ts.map +1 -1
  26. package/dist/cli/main.js +164 -44
  27. package/dist/cli/main.js.map +1 -1
  28. package/dist/cli/output/formatters.d.ts +11 -1
  29. package/dist/cli/output/formatters.d.ts.map +1 -1
  30. package/dist/cli/output/formatters.js +25 -0
  31. package/dist/cli/output/formatters.js.map +1 -1
  32. package/dist/cli/output/index.d.ts +3 -3
  33. package/dist/cli/output/index.d.ts.map +1 -1
  34. package/dist/cli/output/index.js +3 -3
  35. package/dist/cli/output/index.js.map +1 -1
  36. package/dist/cli/output/ink-runner.d.ts.map +1 -1
  37. package/dist/cli/output/ink-runner.js +40 -13
  38. package/dist/cli/output/ink-runner.js.map +1 -1
  39. package/dist/cli/output/jsonl.d.ts +32 -12
  40. package/dist/cli/output/jsonl.d.ts.map +1 -1
  41. package/dist/cli/output/jsonl.js +43 -31
  42. package/dist/cli/output/jsonl.js.map +1 -1
  43. package/dist/cli/output/reporter.d.ts +4 -0
  44. package/dist/cli/output/reporter.d.ts.map +1 -1
  45. package/dist/cli/output/reporter.js +14 -0
  46. package/dist/cli/output/reporter.js.map +1 -1
  47. package/dist/cli/output/tasks.d.ts +14 -1
  48. package/dist/cli/output/tasks.d.ts.map +1 -1
  49. package/dist/cli/output/tasks.js +89 -7
  50. package/dist/cli/output/tasks.js.map +1 -1
  51. package/dist/cli/terminal.d.ts +4 -7
  52. package/dist/cli/terminal.d.ts.map +1 -1
  53. package/dist/cli/terminal.js +22 -52
  54. package/dist/cli/terminal.js.map +1 -1
  55. package/dist/config/loader.d.ts +3 -1
  56. package/dist/config/loader.d.ts.map +1 -1
  57. package/dist/config/loader.js +2 -0
  58. package/dist/config/loader.js.map +1 -1
  59. package/dist/config/schema.d.ts +88 -0
  60. package/dist/config/schema.d.ts.map +1 -1
  61. package/dist/config/schema.js +31 -1
  62. package/dist/config/schema.js.map +1 -1
  63. package/dist/evals/runner.d.ts.map +1 -1
  64. package/dist/evals/runner.js +1 -0
  65. package/dist/evals/runner.js.map +1 -1
  66. package/dist/index.d.ts +2 -2
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +2 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/output/dedup.d.ts +19 -6
  71. package/dist/output/dedup.d.ts.map +1 -1
  72. package/dist/output/dedup.js +73 -28
  73. package/dist/output/dedup.js.map +1 -1
  74. package/dist/output/github-checks.d.ts +4 -2
  75. package/dist/output/github-checks.d.ts.map +1 -1
  76. package/dist/output/github-checks.js +12 -10
  77. package/dist/output/github-checks.js.map +1 -1
  78. package/dist/output/issue-renderer.d.ts.map +1 -1
  79. package/dist/output/issue-renderer.js +6 -18
  80. package/dist/output/issue-renderer.js.map +1 -1
  81. package/dist/output/renderer.d.ts.map +1 -1
  82. package/dist/output/renderer.js +48 -65
  83. package/dist/output/renderer.js.map +1 -1
  84. package/dist/output/types.d.ts +3 -1
  85. package/dist/output/types.d.ts.map +1 -1
  86. package/dist/sdk/analyze.d.ts.map +1 -1
  87. package/dist/sdk/analyze.js +25 -4
  88. package/dist/sdk/analyze.js.map +1 -1
  89. package/dist/sdk/extract.d.ts +2 -1
  90. package/dist/sdk/extract.d.ts.map +1 -1
  91. package/dist/sdk/extract.js +4 -3
  92. package/dist/sdk/extract.js.map +1 -1
  93. package/dist/sdk/haiku.d.ts +3 -0
  94. package/dist/sdk/haiku.d.ts.map +1 -1
  95. package/dist/sdk/haiku.js +5 -4
  96. package/dist/sdk/haiku.js.map +1 -1
  97. package/dist/sdk/prompt.d.ts.map +1 -1
  98. package/dist/sdk/prompt.js +5 -3
  99. package/dist/sdk/prompt.js.map +1 -1
  100. package/dist/sdk/session.d.ts +43 -0
  101. package/dist/sdk/session.d.ts.map +1 -0
  102. package/dist/sdk/session.js +105 -0
  103. package/dist/sdk/session.js.map +1 -0
  104. package/dist/sdk/types.d.ts +5 -0
  105. package/dist/sdk/types.d.ts.map +1 -1
  106. package/dist/sdk/types.js.map +1 -1
  107. package/dist/skills/remote.d.ts +4 -0
  108. package/dist/skills/remote.d.ts.map +1 -1
  109. package/dist/skills/remote.js +47 -27
  110. package/dist/skills/remote.js.map +1 -1
  111. package/dist/types/index.d.ts +27 -0
  112. package/dist/types/index.d.ts.map +1 -1
  113. package/dist/types/index.js +28 -0
  114. package/dist/types/index.js.map +1 -1
  115. package/package.json +3 -3
  116. package/.claude-plugin/marketplace.json +0 -20
  117. package/.mcp.json +0 -8
  118. package/agents.toml +0 -7
  119. package/conductor.json +0 -8
  120. package/evals/README.md +0 -154
  121. package/evals/bug-detection.yaml +0 -56
  122. package/evals/fixtures/ignores-style-issues/utils.ts +0 -48
  123. package/evals/fixtures/missing-await/cache.ts +0 -45
  124. package/evals/fixtures/null-property-access/handler.ts +0 -36
  125. package/evals/fixtures/off-by-one/paginator.ts +0 -38
  126. package/evals/fixtures/sql-injection/api.ts +0 -59
  127. package/evals/fixtures/stale-closure/counter.tsx +0 -33
  128. package/evals/fixtures/wrong-comparison/validator.ts +0 -52
  129. package/evals/fixtures/xss-reflected/server.ts +0 -55
  130. package/evals/precision.yaml +0 -15
  131. package/evals/security-scanning.yaml +0 -24
  132. package/evals/skills/bug-detection.md +0 -33
  133. package/evals/skills/precision.md +0 -18
  134. package/evals/skills/security-scanning.md +0 -32
  135. package/plugins/.claude-plugin/marketplace.json +0 -14
  136. package/plugins/warden/.claude-plugin/plugin.json +0 -7
  137. package/plugins/warden/skills/warden/SKILL.md +0 -78
  138. package/plugins/warden/skills/warden/references/cli-reference.md +0 -144
  139. package/plugins/warden/skills/warden/references/config-schema.md +0 -113
  140. package/plugins/warden/skills/warden/references/configuration.md +0 -108
  141. package/plugins/warden/skills/warden/references/creating-skills.md +0 -84
  142. package/scripts/update-pricing.ts +0 -88
@@ -1,113 +0,0 @@
1
- # warden.toml Configuration Schema
2
-
3
- ## Top-Level Structure
4
-
5
- ```toml
6
- version = 1 # Required, must be 1
7
-
8
- [defaults] # Optional, inherited by all skills
9
- [[skills]] # Required, array of skill configs
10
- ```
11
-
12
- ## Defaults Section
13
-
14
- ```toml
15
- [defaults]
16
- model = "claude-sonnet-4-20250514" # Default model
17
- maxTurns = 50 # Max agentic turns per hunk
18
- defaultBranch = "main" # Base branch for comparisons
19
- failOn = "high" # Exit 1 if findings >= this severity
20
- reportOn = "medium" # Show findings >= this severity
21
- maxFindings = 50 # Max findings to report (0 = unlimited)
22
- reportOnSuccess = false # Post report even with no findings
23
- paths = ["src/**/*.ts"] # Include only matching files
24
- ignorePaths = ["*.test.ts"] # Exclude matching files
25
-
26
- [defaults.chunking]
27
- enabled = true # Enable hunk-based chunking
28
-
29
- [defaults.chunking.coalesce]
30
- enabled = true # Merge nearby hunks
31
- maxGapLines = 30 # Lines between hunks to merge
32
- maxChunkSize = 8000 # Max chars per chunk
33
-
34
- [[defaults.chunking.filePatterns]]
35
- pattern = "*.config.*" # Glob pattern
36
- mode = "whole-file" # per-hunk | whole-file | skip
37
- ```
38
-
39
- ## Skills Section
40
-
41
- ```toml
42
- [[skills]]
43
- name = "skill-name" # Required, unique identifier
44
- remote = "owner/repo@sha" # Optional, fetch skill from GitHub repo
45
- paths = ["src/**"] # Include only matching files
46
- ignorePaths = ["**/*.test.ts"] # Exclude matching files
47
-
48
- # Optional overrides (inherit from defaults if not set)
49
- model = "claude-opus-4-20250514"
50
- maxTurns = 100
51
- failOn = "critical"
52
- reportOn = "high"
53
- maxFindings = 20
54
- reportOnSuccess = true
55
-
56
- [[skills.triggers]]
57
- type = "pull_request" # Required: pull_request | local | schedule
58
- actions = ["opened", "synchronize"] # Required for pull_request
59
-
60
- # Schedule-specific (only for type = "schedule")
61
- [[skills.triggers]]
62
- type = "schedule"
63
-
64
- [skills.triggers.schedule]
65
- issueTitle = "Daily Security Review" # GitHub issue title for tracking
66
- createFixPR = true # Create PR with fixes
67
- fixBranchPrefix = "security-fix" # Branch name prefix
68
- ```
69
-
70
- **Trigger types:**
71
- - `pull_request` - Triggers on PR events
72
- - `local` - Local CLI only (will not run in CI)
73
- - `schedule` - Cron schedule (GitHub Action only)
74
-
75
- All skills run locally regardless of trigger type. Skills with no triggers run everywhere (wildcard). Use `type = "local"` for skills that should *only* run locally.
76
-
77
- **Actions (for pull_request):**
78
- - `opened`, `synchronize`, `reopened`, `closed`
79
-
80
- ## Severity Values
81
-
82
- Used in `failOn` and `reportOn`:
83
- - `critical` - Most severe
84
- - `high`
85
- - `medium`
86
- - `low`
87
- - `info` - Least severe
88
- - `off` - Disable threshold
89
-
90
- ## Built-in Skip Patterns
91
-
92
- Always skipped (cannot be overridden):
93
- - Package locks: `pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `Cargo.lock`, etc.
94
- - Minified files: `**/*.min.js`, `**/*.min.css`
95
- - Build artifacts: `dist/`, `build/`, `node_modules/`, `.next/`, `__pycache__/`
96
- - Generated code: `*.generated.*`, `*.g.ts`, `__generated__/`
97
-
98
- ## Environment Variables
99
-
100
- | Variable | Purpose |
101
- |----------|---------|
102
- | `WARDEN_ANTHROPIC_API_KEY` | Claude API key (required) |
103
- | `WARDEN_MODEL` | Default model (lowest priority) |
104
- | `WARDEN_STATE_DIR` | Override cache location (default: `~/.local/warden`) |
105
- | `WARDEN_SKILL_CACHE_TTL` | Cache TTL in seconds for unpinned remotes (default: 86400) |
106
-
107
- ## Model Precedence (highest to lowest)
108
-
109
- 1. Skill-level `model`
110
- 2. `[defaults]` `model`
111
- 3. CLI `--model` flag
112
- 4. `WARDEN_MODEL` env var
113
- 5. SDK default
@@ -1,108 +0,0 @@
1
- # Configuration (warden.toml)
2
-
3
- See [config-schema.md](config-schema.md) for the complete schema reference.
4
-
5
- ## Minimal Example
6
-
7
- ```toml
8
- version = 1
9
-
10
- [defaults]
11
- model = "claude-sonnet-4-20250514"
12
-
13
- [[skills]]
14
- name = "find-bugs"
15
- paths = ["src/**/*.ts"]
16
-
17
- [[skills.triggers]]
18
- type = "pull_request"
19
- actions = ["opened", "synchronize"]
20
- ```
21
-
22
- ## Skill Configuration
23
-
24
- Skills define what to analyze and when. Each skill requires a name. Triggers are optional — skills with no triggers run everywhere (PR, local, schedule). All skills run locally regardless of trigger type.
25
-
26
- ```toml
27
- [[skills]]
28
- name = "security-review"
29
- paths = ["src/auth/**", "src/payments/**"]
30
- failOn = "critical"
31
- reportOn = "high"
32
- maxFindings = 20
33
-
34
- [[skills.triggers]]
35
- type = "pull_request"
36
- actions = ["opened", "synchronize"]
37
- ```
38
-
39
- **Trigger types:** `pull_request`, `local` (local-only), `schedule` (CI-only)
40
-
41
- **Actions (pull_request):** `opened`, `synchronize`, `reopened`, `closed`
42
-
43
- ## Common Patterns
44
-
45
- **Strict security on critical files:**
46
- ```toml
47
- [[skills]]
48
- name = "security-review"
49
- model = "claude-opus-4-20250514"
50
- maxTurns = 100
51
- paths = ["src/auth/**", "src/payments/**"]
52
- failOn = "critical"
53
-
54
- [[skills.triggers]]
55
- type = "pull_request"
56
- actions = ["opened", "synchronize"]
57
- ```
58
-
59
- **Skip test files:**
60
- ```toml
61
- [[skills]]
62
- name = "find-bugs"
63
- paths = ["src/**/*.ts"]
64
- ignorePaths = ["**/*.test.ts", "**/*.spec.ts"]
65
- ```
66
-
67
- **Whole-file analysis for configs:**
68
- ```toml
69
- [defaults.chunking.filePatterns]
70
- pattern = "*.config.*"
71
- mode = "whole-file"
72
- ```
73
-
74
- ## Model Precedence
75
-
76
- From highest to lowest priority:
77
-
78
- 1. Skill-level `model`
79
- 2. `[defaults]` `model`
80
- 3. CLI `--model` flag
81
- 4. `WARDEN_MODEL` env var
82
- 5. SDK default
83
-
84
- ## Environment Variables
85
-
86
- | Variable | Purpose |
87
- |----------|---------|
88
- | `WARDEN_ANTHROPIC_API_KEY` | Claude API key (required unless using Claude Code subscription) |
89
- | `WARDEN_MODEL` | Default model (lowest priority) |
90
- | `WARDEN_STATE_DIR` | Override cache location (default: `~/.local/warden`) |
91
- | `WARDEN_SKILL_CACHE_TTL` | Cache TTL in seconds for unpinned remotes (default: 86400) |
92
-
93
- ## Troubleshooting
94
-
95
- **No findings reported:**
96
- - Check `--report-on` threshold (default shows all)
97
- - Verify skill matches file types in `paths`
98
- - Use `-v` to see which files are being analyzed
99
-
100
- **Files being skipped:**
101
- - Built-in skip patterns: lock files, minified, `node_modules/`, `dist/`
102
- - Check `ignorePaths` in config
103
- - Use `-vv` to see skip reasons
104
-
105
- **Token/cost issues:**
106
- - Reduce `maxTurns` (default: 50)
107
- - Use chunking settings to control chunk size
108
- - Filter to relevant files with `paths`
@@ -1,84 +0,0 @@
1
- # Creating Skills
2
-
3
- Skills are markdown files that tell Warden what to look for. They follow the [agentskills.io](https://agentskills.io) specification.
4
-
5
- ## Skill Discovery
6
-
7
- Warden searches these directories in order (first match wins):
8
-
9
- ```
10
- .agents/skills/{name}/SKILL.md # Primary (recommended)
11
- .claude/skills/{name}/SKILL.md # Backup (Claude Code convention)
12
- ```
13
-
14
- ## SKILL.md Format
15
-
16
- ```markdown
17
- ---
18
- name: my-skill
19
- description: What this skill analyzes
20
- allowed-tools: Read Grep Glob
21
- ---
22
-
23
- [Analysis instructions for the agent]
24
-
25
- ## What to Look For
26
- - Specific issue type 1
27
- - Specific issue type 2
28
-
29
- ## Output Format
30
- Report findings with severity, location, and suggested fix.
31
- ```
32
-
33
- ## Available Tools
34
-
35
- `Read`, `Glob`, `Grep`, `WebFetch`, `WebSearch`, `Bash`, `Write`, `Edit`
36
-
37
- Most review skills only need `Read`, `Grep`, and `Glob` for exploring context.
38
-
39
- ## Writing Checklist
40
-
41
- - One skill, one concern ("security review" not "code quality")
42
- - Clear criteria for what counts as an issue and at what severity
43
- - Actionable findings that include how to fix
44
- - Examples of good and bad code where helpful
45
-
46
- ## Remote Skills
47
-
48
- Skills can be fetched from GitHub repositories:
49
-
50
- ```bash
51
- # Add a remote skill
52
- warden add --remote getsentry/skills --skill security-review
53
-
54
- # Add with version pinning (recommended for reproducibility)
55
- warden add --remote getsentry/skills@abc123 --skill security-review
56
-
57
- # List skills in a remote repo
58
- warden add --remote getsentry/skills --list
59
-
60
- # Update all unpinned remote skills
61
- warden sync
62
-
63
- # Update specific repo
64
- warden sync getsentry/skills
65
-
66
- # Run with cached skills only (no network)
67
- warden --offline
68
- ```
69
-
70
- **Remote skill in warden.toml:**
71
-
72
- ```toml
73
- [[skills]]
74
- name = "security-review"
75
- remote = "getsentry/skills@abc123"
76
-
77
- [[skills.triggers]]
78
- type = "pull_request"
79
- actions = ["opened", "synchronize"]
80
- ```
81
-
82
- **Cache location:** `~/.local/warden/skills/` (override with `WARDEN_STATE_DIR`)
83
-
84
- **Cache TTL:** 24 hours for unpinned refs (override with `WARDEN_SKILL_CACHE_TTL` in seconds)
@@ -1,88 +0,0 @@
1
- /**
2
- * Fetches Anthropic model pricing from pydantic/genai-prices and writes
3
- * src/sdk/model-pricing.json. Rerun whenever prices change.
4
- *
5
- * Usage: pnpm update-pricing
6
- */
7
-
8
- const SOURCE_URL =
9
- 'https://raw.githubusercontent.com/pydantic/genai-prices/main/prices/data.json';
10
- const OUTPUT_PATH = new URL('../src/sdk/model-pricing.json', import.meta.url);
11
-
12
- type PriceValue = number | { base: number; tiers: unknown[] };
13
-
14
- interface PriceEntry {
15
- input_mtok?: PriceValue;
16
- output_mtok?: PriceValue;
17
- cache_read_mtok?: PriceValue;
18
- cache_write_mtok?: PriceValue;
19
- }
20
-
21
- /** Extract the base price from a flat number or tiered pricing object. */
22
- function basePrice(v: PriceValue | undefined): number {
23
- if (v == null) return 0;
24
- if (typeof v === 'number') return v;
25
- return v.base;
26
- }
27
-
28
- interface ModelEntry {
29
- id: string;
30
- name: string;
31
- prices: PriceEntry;
32
- }
33
-
34
- interface ProviderEntry {
35
- id: string;
36
- models: ModelEntry[];
37
- }
38
-
39
- interface ModelPricingRecord {
40
- inputPerMTok: number;
41
- outputPerMTok: number;
42
- cacheReadPerMTok: number;
43
- cacheWritePerMTok: number;
44
- }
45
-
46
- async function main() {
47
- const res = await fetch(SOURCE_URL);
48
- if (!res.ok) {
49
- throw new Error(`Failed to fetch pricing data: ${res.status} ${res.statusText}`);
50
- }
51
-
52
- const providers: ProviderEntry[] = await res.json();
53
- const anthropic = providers.find((p) => p.id === 'anthropic');
54
- if (!anthropic) {
55
- throw new Error('Anthropic provider not found in pricing data');
56
- }
57
-
58
- const pricing: Record<string, ModelPricingRecord> = {};
59
-
60
- if (!anthropic.models || !Array.isArray(anthropic.models)) {
61
- throw new Error('Anthropic provider has invalid or missing models array');
62
- }
63
-
64
- for (const model of anthropic.models) {
65
- const p = model.prices;
66
- if (!p || typeof p !== 'object') {
67
- continue;
68
- }
69
- pricing[model.id] = {
70
- inputPerMTok: basePrice(p.input_mtok),
71
- outputPerMTok: basePrice(p.output_mtok),
72
- cacheReadPerMTok: basePrice(p.cache_read_mtok),
73
- cacheWritePerMTok: basePrice(p.cache_write_mtok),
74
- };
75
- }
76
-
77
- const { writeFileSync } = await import('node:fs');
78
- const { fileURLToPath } = await import('node:url');
79
- writeFileSync(fileURLToPath(OUTPUT_PATH), JSON.stringify(pricing, null, 2) + '\n');
80
-
81
- const count = Object.keys(pricing).length;
82
- console.log(`Wrote ${count} model(s) to src/sdk/model-pricing.json`);
83
- }
84
-
85
- main().catch((err) => {
86
- console.error(err);
87
- process.exit(1);
88
- });