@sentry/warden 0.4.0 → 0.6.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 (101) hide show
  1. package/.claude-plugin/marketplace.json +20 -0
  2. package/dist/cli/args.d.ts +1 -1
  3. package/dist/cli/args.js +4 -4
  4. package/dist/cli/args.js.map +1 -1
  5. package/dist/cli/commands/add.d.ts.map +1 -1
  6. package/dist/cli/commands/add.js +30 -28
  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 +12 -14
  10. package/dist/cli/commands/init.js.map +1 -1
  11. package/dist/cli/context.d.ts.map +1 -1
  12. package/dist/cli/context.js +3 -1
  13. package/dist/cli/context.js.map +1 -1
  14. package/dist/cli/git.d.ts +6 -0
  15. package/dist/cli/git.d.ts.map +1 -1
  16. package/dist/cli/git.js +33 -1
  17. package/dist/cli/git.js.map +1 -1
  18. package/dist/cli/main.js +20 -20
  19. package/dist/cli/main.js.map +1 -1
  20. package/dist/cli/output/formatters.d.ts +3 -3
  21. package/dist/cli/output/formatters.d.ts.map +1 -1
  22. package/dist/cli/output/formatters.js +3 -6
  23. package/dist/cli/output/formatters.js.map +1 -1
  24. package/dist/cli/output/jsonl.d.ts +27 -0
  25. package/dist/cli/output/jsonl.d.ts.map +1 -1
  26. package/dist/cli/output/jsonl.js.map +1 -1
  27. package/dist/cli/output/reporter.d.ts.map +1 -1
  28. package/dist/cli/output/reporter.js +16 -0
  29. package/dist/cli/output/reporter.js.map +1 -1
  30. package/dist/cli/output/tasks.d.ts.map +1 -1
  31. package/dist/cli/output/tasks.js +8 -5
  32. package/dist/cli/output/tasks.js.map +1 -1
  33. package/dist/cli/output/tty.d.ts +9 -0
  34. package/dist/cli/output/tty.d.ts.map +1 -1
  35. package/dist/cli/output/tty.js +13 -0
  36. package/dist/cli/output/tty.js.map +1 -1
  37. package/dist/cli/terminal.d.ts +2 -2
  38. package/dist/cli/terminal.d.ts.map +1 -1
  39. package/dist/cli/terminal.js +26 -7
  40. package/dist/cli/terminal.js.map +1 -1
  41. package/dist/config/loader.d.ts +40 -12
  42. package/dist/config/loader.d.ts.map +1 -1
  43. package/dist/config/loader.js +71 -23
  44. package/dist/config/loader.js.map +1 -1
  45. package/dist/config/schema.d.ts +147 -124
  46. package/dist/config/schema.d.ts.map +1 -1
  47. package/dist/config/schema.js +67 -53
  48. package/dist/config/schema.js.map +1 -1
  49. package/dist/config/writer.d.ts +5 -5
  50. package/dist/config/writer.d.ts.map +1 -1
  51. package/dist/config/writer.js +76 -45
  52. package/dist/config/writer.js.map +1 -1
  53. package/dist/event/context.d.ts.map +1 -1
  54. package/dist/event/context.js +3 -1
  55. package/dist/event/context.js.map +1 -1
  56. package/dist/event/schedule-context.d.ts.map +1 -1
  57. package/dist/event/schedule-context.js +1 -0
  58. package/dist/event/schedule-context.js.map +1 -1
  59. package/dist/index.d.ts +3 -3
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +3 -3
  62. package/dist/index.js.map +1 -1
  63. package/dist/output/dedup.d.ts.map +1 -1
  64. package/dist/output/dedup.js +18 -28
  65. package/dist/output/dedup.js.map +1 -1
  66. package/dist/output/github-checks.d.ts +3 -3
  67. package/dist/output/github-checks.d.ts.map +1 -1
  68. package/dist/output/github-checks.js +66 -93
  69. package/dist/output/github-checks.js.map +1 -1
  70. package/dist/output/github-issues.d.ts.map +1 -1
  71. package/dist/output/github-issues.js +9 -14
  72. package/dist/output/github-issues.js.map +1 -1
  73. package/dist/output/renderer.d.ts.map +1 -1
  74. package/dist/output/renderer.js +14 -27
  75. package/dist/output/renderer.js.map +1 -1
  76. package/dist/output/stale.d.ts +4 -0
  77. package/dist/output/stale.d.ts.map +1 -1
  78. package/dist/output/stale.js +7 -2
  79. package/dist/output/stale.js.map +1 -1
  80. package/dist/output/types.d.ts +2 -7
  81. package/dist/output/types.d.ts.map +1 -1
  82. package/dist/sdk/haiku.d.ts +55 -0
  83. package/dist/sdk/haiku.d.ts.map +1 -0
  84. package/dist/sdk/haiku.js +190 -0
  85. package/dist/sdk/haiku.js.map +1 -0
  86. package/dist/triggers/matcher.d.ts +18 -3
  87. package/dist/triggers/matcher.d.ts.map +1 -1
  88. package/dist/triggers/matcher.js +75 -21
  89. package/dist/triggers/matcher.js.map +1 -1
  90. package/dist/types/index.d.ts +2 -0
  91. package/dist/types/index.d.ts.map +1 -1
  92. package/dist/types/index.js +1 -0
  93. package/dist/types/index.js.map +1 -1
  94. package/package.json +1 -1
  95. package/plugins/.claude-plugin/marketplace.json +14 -0
  96. package/plugins/warden/.claude-plugin/plugin.json +7 -0
  97. package/plugins/warden/skills/warden/SKILL.md +78 -0
  98. package/plugins/warden/skills/warden/references/cli-reference.md +144 -0
  99. package/plugins/warden/skills/warden/references/config-schema.md +111 -0
  100. package/plugins/warden/skills/warden/references/configuration.md +108 -0
  101. package/plugins/warden/skills/warden/references/creating-skills.md +85 -0
@@ -0,0 +1,144 @@
1
+ # CLI Reference
2
+
3
+ ## Usage
4
+
5
+ ```
6
+ warden [command] [targets...] [options]
7
+ ```
8
+
9
+ Analyze code for security issues and code quality.
10
+
11
+ ## Commands
12
+
13
+ | Command | Description |
14
+ |---------|-------------|
15
+ | `(default)` | Run analysis on targets or using warden.toml skills |
16
+ | `init` | Initialize warden.toml and GitHub workflow |
17
+ | `add [skill]` | Add a skill to warden.toml |
18
+ | `sync [remote]` | Update cached remote skills to latest |
19
+ | `setup-app` | Create a GitHub App for Warden via manifest flow |
20
+
21
+ ## Targets
22
+
23
+ | Target | Description |
24
+ |--------|-------------|
25
+ | `<files>` | Analyze specific files (e.g., `src/auth.ts`) |
26
+ | `<glob>` | Analyze files matching pattern (e.g., `"src/**/*.ts"`) |
27
+ | `<git-ref>` | Analyze changes from git ref (e.g., `HEAD~3`, `main..feature`) |
28
+ | `(none)` | Analyze uncommitted changes using warden.toml skills |
29
+
30
+ Ambiguous targets (no path separator, no extension) are resolved by checking if a file exists at the path. Use `--git` to force git ref interpretation.
31
+
32
+ ## Options
33
+
34
+ | Option | Description |
35
+ |--------|-------------|
36
+ | `--skill <name>` | Run only this skill (default: run all built-in skills) |
37
+ | `--config <path>` | Path to warden.toml (default: `./warden.toml`) |
38
+ | `-m, --model <model>` | Model to use (fallback when not set in config) |
39
+ | `--json` | Output results as JSON |
40
+ | `-o, --output <path>` | Write full run output to a JSONL file |
41
+ | `--fail-on <severity>` | Exit with code 1 if findings >= severity |
42
+ | `--report-on <severity>` | Only show findings >= severity in output |
43
+ | `--fix` | Automatically apply all suggested fixes |
44
+ | `--parallel <n>` | Max concurrent skill executions (default: 4) |
45
+ | `--git` | Force ambiguous targets to be treated as git refs |
46
+ | `--offline` | Use cached remote skills without network access |
47
+ | `-q, --quiet` | Errors and final summary only |
48
+ | `-v, --verbose` | Show real-time findings and hunk details |
49
+ | `-vv` | Show debug info (token counts, latencies) |
50
+ | `--debug` | Enable debug output (equivalent to `-vv`) |
51
+ | `--log` | Use log output (no animations, timestamped) |
52
+ | `--color / --no-color` | Override color detection |
53
+ | `-h, --help` | Show help message |
54
+ | `-V, --version` | Show version number |
55
+
56
+ ## Per-Command Options
57
+
58
+ **Init:**
59
+ | Option | Description |
60
+ |--------|-------------|
61
+ | `-f, --force` | Overwrite existing files |
62
+
63
+ **Add:**
64
+ | Option | Description |
65
+ |--------|-------------|
66
+ | `--list` | List available skills |
67
+ | `--remote <ref>` | Remote repository (`owner/repo`, URL, or with `@sha`) |
68
+ | `--force` | Bypass skill cache and fetch latest |
69
+
70
+ **Sync:**
71
+ | Option | Description |
72
+ |--------|-------------|
73
+ | `--remote <ref>` | Specific remote to sync (default: all) |
74
+
75
+ **Setup-app:**
76
+ | Option | Description |
77
+ |--------|-------------|
78
+ | `--org <name>` | Create under organization (default: personal) |
79
+ | `--port <number>` | Local server port (default: 3000) |
80
+ | `--timeout <sec>` | Callback timeout in seconds (default: 300) |
81
+ | `--name <string>` | Custom app name (default: Warden) |
82
+ | `--no-open` | Print URL instead of opening browser |
83
+
84
+ ## Severity Levels
85
+
86
+ Used in `--fail-on` and `--report-on`:
87
+
88
+ | Level | Meaning |
89
+ |-------|---------|
90
+ | `critical` | Must fix before merge |
91
+ | `high` | Should fix before merge |
92
+ | `medium` | Worth reviewing |
93
+ | `low` | Minor improvement |
94
+ | `info` | Informational only |
95
+ | `off` | Disable the threshold |
96
+
97
+ ## Exit Codes
98
+
99
+ | Code | Meaning |
100
+ |------|---------|
101
+ | `0` | No findings at or above `--fail-on` threshold |
102
+ | `1` | Findings at or above `--fail-on` threshold |
103
+
104
+ ## Examples
105
+
106
+ ```bash
107
+ # Initialize
108
+ warden init
109
+
110
+ # Interactive skill selection
111
+ warden add
112
+ warden add security-review
113
+ warden add --list
114
+
115
+ # Remote skills
116
+ warden add --remote getsentry/skills --skill security-review
117
+ warden add --remote https://github.com/getsentry/skills --skill security-review
118
+ warden add --remote getsentry/skills@abc123 --skill security-review
119
+
120
+ # Run analysis
121
+ warden # Skills from warden.toml
122
+ warden src/auth.ts # Specific file
123
+ warden src/auth.ts --skill security-review
124
+ warden "src/**/*.ts" # Glob pattern
125
+ warden HEAD~3 # Git changes
126
+ warden HEAD~3 --skill security-review
127
+ warden main..HEAD # Branch diff
128
+
129
+ # Output control
130
+ warden --json
131
+ warden --fail-on high
132
+ warden -o results.jsonl
133
+
134
+ # Fix mode
135
+ warden --fix
136
+
137
+ # Cached skills only
138
+ warden --offline
139
+ warden sync # Update all unpinned remote skills
140
+
141
+ # GitHub App setup
142
+ warden setup-app
143
+ warden setup-app --org myorg
144
+ ```
@@ -0,0 +1,111 @@
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` - Triggers on local CLI runs
73
+ - `schedule` - Triggers on cron schedule (GitHub Action)
74
+
75
+ **Actions (for pull_request):**
76
+ - `opened`, `synchronize`, `reopened`, `closed`
77
+
78
+ ## Severity Values
79
+
80
+ Used in `failOn` and `reportOn`:
81
+ - `critical` - Most severe
82
+ - `high`
83
+ - `medium`
84
+ - `low`
85
+ - `info` - Least severe
86
+ - `off` - Disable threshold
87
+
88
+ ## Built-in Skip Patterns
89
+
90
+ Always skipped (cannot be overridden):
91
+ - Package locks: `pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `Cargo.lock`, etc.
92
+ - Minified files: `**/*.min.js`, `**/*.min.css`
93
+ - Build artifacts: `dist/`, `build/`, `node_modules/`, `.next/`, `__pycache__/`
94
+ - Generated code: `*.generated.*`, `*.g.ts`, `__generated__/`
95
+
96
+ ## Environment Variables
97
+
98
+ | Variable | Purpose |
99
+ |----------|---------|
100
+ | `WARDEN_ANTHROPIC_API_KEY` | Claude API key (required) |
101
+ | `WARDEN_MODEL` | Default model (lowest priority) |
102
+ | `WARDEN_STATE_DIR` | Override cache location (default: `~/.local/warden`) |
103
+ | `WARDEN_SKILL_CACHE_TTL` | Cache TTL in seconds for unpinned remotes (default: 86400) |
104
+
105
+ ## Model Precedence (highest to lowest)
106
+
107
+ 1. Skill-level `model`
108
+ 2. `[defaults]` `model`
109
+ 3. CLI `--model` flag
110
+ 4. `WARDEN_MODEL` env var
111
+ 5. SDK default
@@ -0,0 +1,108 @@
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 and at least one trigger:
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`, `schedule`
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`
@@ -0,0 +1,85 @@
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
+ .warden/skills/{name}/SKILL.md # Warden-specific (highest priority)
11
+ .agents/skills/{name}/SKILL.md # Shared agent skills
12
+ .claude/skills/{name}/SKILL.md # Claude Code skills
13
+ ```
14
+
15
+ ## SKILL.md Format
16
+
17
+ ```markdown
18
+ ---
19
+ name: my-skill
20
+ description: What this skill analyzes
21
+ allowed-tools: Read Grep Glob
22
+ ---
23
+
24
+ [Analysis instructions for the agent]
25
+
26
+ ## What to Look For
27
+ - Specific issue type 1
28
+ - Specific issue type 2
29
+
30
+ ## Output Format
31
+ Report findings with severity, location, and suggested fix.
32
+ ```
33
+
34
+ ## Available Tools
35
+
36
+ `Read`, `Glob`, `Grep`, `WebFetch`, `WebSearch`, `Bash`, `Write`, `Edit`
37
+
38
+ Most review skills only need `Read`, `Grep`, and `Glob` for exploring context.
39
+
40
+ ## Writing Checklist
41
+
42
+ - One skill, one concern ("security review" not "code quality")
43
+ - Clear criteria for what counts as an issue and at what severity
44
+ - Actionable findings that include how to fix
45
+ - Examples of good and bad code where helpful
46
+
47
+ ## Remote Skills
48
+
49
+ Skills can be fetched from GitHub repositories:
50
+
51
+ ```bash
52
+ # Add a remote skill
53
+ warden add --remote getsentry/skills --skill security-review
54
+
55
+ # Add with version pinning (recommended for reproducibility)
56
+ warden add --remote getsentry/skills@abc123 --skill security-review
57
+
58
+ # List skills in a remote repo
59
+ warden add --remote getsentry/skills --list
60
+
61
+ # Update all unpinned remote skills
62
+ warden sync
63
+
64
+ # Update specific repo
65
+ warden sync getsentry/skills
66
+
67
+ # Run with cached skills only (no network)
68
+ warden --offline
69
+ ```
70
+
71
+ **Remote skill in warden.toml:**
72
+
73
+ ```toml
74
+ [[skills]]
75
+ name = "security-review"
76
+ remote = "getsentry/skills@abc123"
77
+
78
+ [[skills.triggers]]
79
+ type = "pull_request"
80
+ actions = ["opened", "synchronize"]
81
+ ```
82
+
83
+ **Cache location:** `~/.local/warden/skills/` (override with `WARDEN_STATE_DIR`)
84
+
85
+ **Cache TTL:** 24 hours for unpinned refs (override with `WARDEN_SKILL_CACHE_TTL` in seconds)