@dougefresh/ci 0.1.12 → 0.1.14
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/.github/actions/jobtaker/action.yml +29 -0
- package/.github/additional-prompt.md +62 -0
- package/.github/workflows/action-review.yml +46 -3
- package/.github/workflows/pr-review.yml +7 -41
- package/AGENTS.md +15 -0
- package/action.yml +18 -2
- package/{biome.jsonc → biome.json} +1 -1
- package/package.json +3 -1
- package/pre-commit +1 -1
- package/prompt-template.md +180 -0
- package/scripts/bump-version.ts +2 -2
- package/scripts/generate-rust.ts +2 -2
- package/src/defaults.ts +119 -0
- package/src/index.ts +27 -177
- package/src/types.ts +81 -0
- package/.github/copilot-instructions.md +0 -118
- package/dist/ai.d.ts +0 -11
- package/dist/ai.d.ts.map +0 -1
- package/dist/ai.js +0 -52
- package/dist/ai.js.map +0 -1
- package/dist/index.d.ts +0 -106
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -213
- package/dist/index.js.map +0 -1
- package/src/ai.ts +0 -61
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: 'Jobtaker Review'
|
|
2
|
+
description: 'Runs Claude Code jobtaker with provided config'
|
|
3
|
+
inputs:
|
|
4
|
+
config:
|
|
5
|
+
description: 'JSON config from rust-config action'
|
|
6
|
+
required: true
|
|
7
|
+
anthropic_api_key:
|
|
8
|
+
description: 'Anthropic API key'
|
|
9
|
+
required: true
|
|
10
|
+
|
|
11
|
+
runs:
|
|
12
|
+
using: 'composite'
|
|
13
|
+
steps:
|
|
14
|
+
- name: jobtaker
|
|
15
|
+
if: ${{ fromJSON(inputs.config).ai.enabled }}
|
|
16
|
+
uses: anthropics/claude-code-action@v1
|
|
17
|
+
with:
|
|
18
|
+
anthropic_api_key: ${{ inputs.anthropic_api_key }}
|
|
19
|
+
trigger_phrase: '@jobtaker'
|
|
20
|
+
allowed_bots: ${{ fromJSON(inputs.config).ai.allowed_bots }}
|
|
21
|
+
prompt_file: claude-prompt.md
|
|
22
|
+
claude_args: ${{ fromJSON(inputs.config).ai.claude_args }}
|
|
23
|
+
use_sticky_comment: ${{ fromJSON(inputs.config).ai.use_sticky_comment }}
|
|
24
|
+
track_progress: "${{ fromJSON(inputs.config).ai.track_progress }}"
|
|
25
|
+
path_to_claude_code_executable: ''
|
|
26
|
+
path_to_bun_executable: ''
|
|
27
|
+
show_full_output: 'false'
|
|
28
|
+
plugins: ''
|
|
29
|
+
plugin_marketplaces: ''
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Configuration Validation
|
|
2
|
+
|
|
3
|
+
Before performing code review, validate your environment and permissions:
|
|
4
|
+
|
|
5
|
+
## Tool Access
|
|
6
|
+
|
|
7
|
+
Verify you can execute these commands:
|
|
8
|
+
- `cargo check` / `cargo test` / `cargo clippy`
|
|
9
|
+
- `bun run build` / `bun test`
|
|
10
|
+
- `tsgo` (TypeScript compiler wrapper)
|
|
11
|
+
|
|
12
|
+
If any tool fails, note it in your review.
|
|
13
|
+
|
|
14
|
+
## Permission Audit
|
|
15
|
+
|
|
16
|
+
Examine `claude_args` in `./src/defaults.ts` (variable: `DEFAULT_AI`):
|
|
17
|
+
|
|
18
|
+
1. **Tool allowlist**: Verify the comma-separated list is syntactically correct
|
|
19
|
+
2. **Security review**: Assess each allowed tool pattern for potential abuse:
|
|
20
|
+
- `Bash(*)` patterns: What commands could be chained?
|
|
21
|
+
- `mcp__github_inline_comment__*`: What GitHub API access is granted?
|
|
22
|
+
- File system access: Can sensitive files be read/modified?
|
|
23
|
+
|
|
24
|
+
3. **Risk assessment**: For each concern, provide:
|
|
25
|
+
- Attack vector example
|
|
26
|
+
- Likelihood (high/medium/low)
|
|
27
|
+
- Mitigation suggestion
|
|
28
|
+
|
|
29
|
+
Only flag **high likelihood** issues as blocking. Document medium/low risks for awareness.
|
|
30
|
+
|
|
31
|
+
## Configuration Sync
|
|
32
|
+
|
|
33
|
+
Compare workflow inputs in `.github/workflows/pr-review.yml` against `DEFAULT_AI` schema:
|
|
34
|
+
- Are all `fromJSON(needs.config.outputs.config).ai.*` fields defined in `DEFAULT_AI`?
|
|
35
|
+
- Do boolean/string types match between workflow and TypeScript?
|
|
36
|
+
|
|
37
|
+
Report mismatches as configuration bugs.
|
|
38
|
+
|
|
39
|
+
## User Config Validation
|
|
40
|
+
|
|
41
|
+
If `.github/rust-ci.ts` exists, validate it:
|
|
42
|
+
|
|
43
|
+
1. **Syntax**: Does it export a default function returning a `RustWorkflow`?
|
|
44
|
+
2. **Logic**: Check for contradictions:
|
|
45
|
+
- Jobs disabled but referenced in other configs
|
|
46
|
+
- Empty matrices (no OS/toolchains/features)
|
|
47
|
+
- Invalid arch values (not in `Arch` enum)
|
|
48
|
+
3. **Workflow impact**: What jobs will actually run? Flag if all jobs are disabled.
|
|
49
|
+
|
|
50
|
+
## Workflow Integrity
|
|
51
|
+
|
|
52
|
+
Validate `.github/workflows/pr-review.yml`:
|
|
53
|
+
|
|
54
|
+
1. **Job dependencies**: Does `needs: [config]` chain correctly? Are outputs referenced before they exist?
|
|
55
|
+
2. **Conditional logic**: Do all `if:` conditions reference valid event properties?
|
|
56
|
+
3. **Secret validation**: Is `ANTHROPIC_API_KEY` checked before use?
|
|
57
|
+
4. **Action versions**: Are pinned versions used (`@v1`, `@main`)? Flag unpinned refs.
|
|
58
|
+
5. **Runner variables**: Are `vars.RUNNER*` placeholders resolved by the config action?
|
|
59
|
+
6. **Input/output flow**: Trace `config.outputs.config` → `fromJSON()` → action inputs. Are all paths valid JSON?
|
|
60
|
+
|
|
61
|
+
Flag any broken references, missing dependencies, or unreachable code paths.
|
|
62
|
+
|
|
@@ -8,7 +8,50 @@ permissions:
|
|
|
8
8
|
pull-requests: write
|
|
9
9
|
id-token: write
|
|
10
10
|
jobs:
|
|
11
|
+
config:
|
|
12
|
+
if: |
|
|
13
|
+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@jobtaker')) ||
|
|
14
|
+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@jobtaker')) ||
|
|
15
|
+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@jobtaker')) ||
|
|
16
|
+
(contains(github.event.pull_request.labels.*.name, 'jobtaker')) ||
|
|
17
|
+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@jobtaker') || contains(github.event.issue.title, '@jobtaker')))
|
|
18
|
+
runs-on: ${{ vars.RUNNER }}
|
|
19
|
+
name: generate config
|
|
20
|
+
outputs:
|
|
21
|
+
config: ${{ steps.config.outputs.config }}
|
|
22
|
+
steps:
|
|
23
|
+
- name: Validate ANTHROPIC_API_KEY
|
|
24
|
+
shell: bash
|
|
25
|
+
run: |
|
|
26
|
+
if [ -z "${{ secrets.ANTHROPIC_API_KEY }}" ]; then
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
- uses: actions/checkout@v6
|
|
30
|
+
- name: config
|
|
31
|
+
id: config
|
|
32
|
+
uses: ./.github/actions/rust-config
|
|
33
|
+
with:
|
|
34
|
+
arm64: ${{ vars.RUNNER_ARM64 }}
|
|
35
|
+
amd64: ${{ vars.RUNNER_AMD64 }}
|
|
36
|
+
git_token: ${{ github.token }}
|
|
37
|
+
|
|
11
38
|
jobtaker:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
39
|
+
needs: [config]
|
|
40
|
+
if: |
|
|
41
|
+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@jobtaker')) ||
|
|
42
|
+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@jobtaker')) ||
|
|
43
|
+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@jobtaker')) ||
|
|
44
|
+
(contains(github.event.pull_request.labels.*.name, 'jobtaker')) ||
|
|
45
|
+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@jobtaker') || contains(github.event.issue.title, '@jobtaker')))
|
|
46
|
+
runs-on: ${{ vars.RUNNER }}
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v6
|
|
49
|
+
- name: checkout
|
|
50
|
+
uses: ./.github/actions/rust-init
|
|
51
|
+
with:
|
|
52
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
53
|
+
- name: jobtaker
|
|
54
|
+
uses: ./.github/actions/jobtaker
|
|
55
|
+
with:
|
|
56
|
+
config: ${{ needs.config.outputs.config }}
|
|
57
|
+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
name: jobtaker
|
|
2
2
|
on:
|
|
3
3
|
workflow_call:
|
|
4
|
+
inputs:
|
|
5
|
+
action_ref:
|
|
6
|
+
description: 'Ref to use for dougefresh/ci actions'
|
|
7
|
+
type: string
|
|
8
|
+
default: 'main'
|
|
4
9
|
permissions:
|
|
5
10
|
contents: read
|
|
6
11
|
checks: write
|
|
@@ -48,46 +53,7 @@ jobs:
|
|
|
48
53
|
with:
|
|
49
54
|
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
50
55
|
- name: jobtaker
|
|
51
|
-
|
|
52
|
-
uses: anthropics/claude-code-action@v1
|
|
56
|
+
uses: dougefresh/ci/.github/actions/jobtaker@main
|
|
53
57
|
with:
|
|
58
|
+
config: ${{ needs.config.outputs.config }}
|
|
54
59
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
55
|
-
trigger_phrase: '@jobtaker'
|
|
56
|
-
# settings: ${{ toJSON(fromJSON(needs.config.outputs.config).ai.settings) }}
|
|
57
|
-
# description: "Claude Code settings as JSON string or path to settings JSON file"
|
|
58
|
-
allowed_bots: ${{ fromJSON(needs.config.outputs.config).ai.allowed_bots }}
|
|
59
|
-
# description: "Comma-separated list of allowed bot usernames, or '*' to allow all bots. Empty string (default) allows no bots."
|
|
60
|
-
# Your custom review instructions
|
|
61
|
-
prompt: |
|
|
62
|
-
REPO: ${{ github.repository }}
|
|
63
|
-
PR NUMBER: ${{ github.event.pull_request.number }}
|
|
64
|
-
|
|
65
|
-
${{ fromJSON(needs.config.outputs.config).ai.prompt }}
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
${{ fromJSON(needs.config.outputs.config).ai.additional }}
|
|
70
|
-
# Tools for comprehensive PR review
|
|
71
|
-
claude_args: ${{ fromJSON(needs.config.outputs.config).ai.claude_args }}
|
|
72
|
-
use_sticky_comment: ${{ fromJSON(needs.config.outputs.config).ai.use_sticky_comment }}
|
|
73
|
-
# description: "Use just one comment to deliver issue/PR comments"
|
|
74
|
-
# required: false
|
|
75
|
-
# default: "false"
|
|
76
|
-
track_progress: "${{ fromJSON(needs.config.outputs.config).ai.track_progress }}"
|
|
77
|
-
# description: "Force tag mode with tracking comments for pull_request and issue events. Only applicable to pull_request (opened, synchronize, ready_for_review, reopened) and issue (opened, edited, labeled, assigned) events."
|
|
78
|
-
path_to_claude_code_executable: ''
|
|
79
|
-
# description: "Optional path to a custom Claude Code executable. If provided, skips automatic installation and uses this executable instead. WARNING: Using an older version may cause problems if the action begins taking advantage of new Claude Code features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
|
|
80
|
-
path_to_bun_executable: ''
|
|
81
|
-
# description: "Optional path to a custom Bun executable. If provided, skips automatic Bun installation and uses this executable instead. WARNING: Using an incompatible version may cause problems if the action requires specific Bun features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
|
|
82
|
-
show_full_output: 'false'
|
|
83
|
-
# description: "Show full JSON output from Claude Code. WARNING: This outputs ALL Claude messages including tool execution results which may contain secrets, API keys, or other sensitive information. These logs are publicly visible in GitHub Actions. Only enable for debugging in non-sensitive environments."
|
|
84
|
-
plugins: ''
|
|
85
|
-
# description: "Newline-separated list of Claude Code plugin names to install (e.g., 'code-review@claude-code-plugins\nfeature-dev@claude-code-plugins')"
|
|
86
|
-
plugin_marketplaces: ''
|
|
87
|
-
# description: "Newline-separated list of Claude Code plugin marketplace Git URLs to install from (e.g., 'https://github.com/user/marketplace1.git\nhttps://github.com/user/marketplace2.git')"
|
|
88
|
-
|
|
89
|
-
# When track_progress is enabled:
|
|
90
|
-
# - Creates a tracking comment with progress checkboxes
|
|
91
|
-
# - Includes all PR context (comments, attachments, images)
|
|
92
|
-
# - Updates progress as the review proceeds
|
|
93
|
-
# - Marks as completed when done
|
package/AGENTS.md
CHANGED
|
@@ -10,4 +10,19 @@ It isn't perfect, nor will this ever be perfect.
|
|
|
10
10
|
|
|
11
11
|
Review README.md for design flow
|
|
12
12
|
|
|
13
|
+
## GitHub Workflow
|
|
14
|
+
|
|
15
|
+
**Note**: This section only applies when running in GitHub Actions context (when `CI` environment variable is set). Ignore otherwise.
|
|
16
|
+
|
|
17
|
+
### Validation Prompt Detection
|
|
18
|
+
|
|
19
|
+
Before performing code review, verify that `.github/additional-prompt.md` was successfully injected into your prompt context:
|
|
20
|
+
|
|
21
|
+
1. **Self-check**: Check if `.github/additional-prompt.md` is present in your context/prompt
|
|
22
|
+
2. **Report status**:
|
|
23
|
+
- ✅ If found: Proceed with validation tasks defined in that file
|
|
24
|
+
- ❌ If not found: Report "Validation prompt not loaded - skipping QA checks" and continue with standard code review only
|
|
25
|
+
|
|
26
|
+
This ensures the action's prompt generation step (`action.yml` → `prompt` step) executed correctly.
|
|
27
|
+
|
|
13
28
|
|
package/action.yml
CHANGED
|
@@ -13,6 +13,24 @@ runs:
|
|
|
13
13
|
steps:
|
|
14
14
|
- name: setup bun
|
|
15
15
|
uses: oven-sh/setup-bun@v2
|
|
16
|
+
- name: install
|
|
17
|
+
shell: bash
|
|
18
|
+
run: |
|
|
19
|
+
cd ${{ github.action_path }}
|
|
20
|
+
bun install
|
|
21
|
+
- name: build
|
|
22
|
+
shell: bash
|
|
23
|
+
run: |
|
|
24
|
+
cd ${{ github.action_path }}
|
|
25
|
+
bun run build
|
|
26
|
+
- id: prompt
|
|
27
|
+
shell: bash
|
|
28
|
+
run: |
|
|
29
|
+
sed -e 's/%REPO%/{{ github.repository }}/g' -e 's/%PR%/{{ github.event.pull_request.number }}/g' \
|
|
30
|
+
${{ github.action_path }}/prompt-template.md > claude-prompt.md
|
|
31
|
+
if [ -f .github/additional-prompt.md ] ; then
|
|
32
|
+
cat .github/additional-prompt.md >> claude-prompt.md
|
|
33
|
+
fi
|
|
16
34
|
- id: generate
|
|
17
35
|
name: generate
|
|
18
36
|
shell: bash
|
|
@@ -28,7 +46,5 @@ runs:
|
|
|
28
46
|
fi
|
|
29
47
|
cat ${{ github.action_path }}/.github/rust-ci.ts
|
|
30
48
|
cd ${{ github.action_path }}
|
|
31
|
-
bun install
|
|
32
|
-
bun run build
|
|
33
49
|
CONFIG="$(bun run ./scripts/generate-rust.ts | jq . --compact-output )"
|
|
34
50
|
echo "config=$CONFIG" >> $GITHUB_OUTPUT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dougefresh/ci",
|
|
3
3
|
"description": "CI Mega Config github action",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.14",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"homepage": "https://github.com/dougefresh/ci",
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"node": ">=24.0.0"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
+
"precommit": "rm -rf dist && bun run lint && bun run build",
|
|
24
|
+
"lint": "biome check",
|
|
23
25
|
"build": "tsgo",
|
|
24
26
|
"prepublishOnly": "bun run build"
|
|
25
27
|
},
|
package/pre-commit
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
|
|
2
|
+
bun run precommit
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
REPO: %REPO%
|
|
2
|
+
PR NUMBER: %PR%
|
|
3
|
+
|
|
4
|
+
Perform a comprehensive code review with the following focus areas:
|
|
5
|
+
Provide detailed feedback using inline comments for ONLY issues, no praise inline comments.
|
|
6
|
+
Use top-level comments for general observations or praise
|
|
7
|
+
Do not be shy, I am a big boy and can handle criticism gracefully. I welcome feedback and suggestions.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Rust tooling
|
|
11
|
+
|
|
12
|
+
You should have access to cargo cli. You can use this to verify the build yourself, or use it to run tests (or a specific test)
|
|
13
|
+
If you encounter an error running cargo, please comment on this PR. If you desire more rust tools, such as rust-analyzer, or any cargo plugin to help review then please notify on pull request
|
|
14
|
+
|
|
15
|
+
## Bun tooling
|
|
16
|
+
|
|
17
|
+
You have access to bun cli. Apply the same principles and safety guidelines for bun commands as outlined for cargo commands.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Permissions
|
|
21
|
+
|
|
22
|
+
If you are denied access to a tool, shell command, or github API resource (via gh cli) then notify the pull request author that you would like access to that tool.
|
|
23
|
+
As an example, we use CodeCov to our test coverage, if you like to have access to historical data, we can provide you with the CodeCov CLI tool and access.
|
|
24
|
+
In general, if you need something, just ask.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Review this PR against our team checklist:
|
|
28
|
+
|
|
29
|
+
## Code Quality
|
|
30
|
+
- [ ] Code follows our style guide
|
|
31
|
+
- [ ] No commented-out code
|
|
32
|
+
- [ ] Meaningful variable names
|
|
33
|
+
- [ ] DRY principle followed
|
|
34
|
+
|
|
35
|
+
## Testing
|
|
36
|
+
- [ ] Unit tests for new functions
|
|
37
|
+
- [ ] Integration tests for new endpoints
|
|
38
|
+
- [ ] Edge cases covered
|
|
39
|
+
- [ ] Test coverage > 80%
|
|
40
|
+
|
|
41
|
+
## Documentation
|
|
42
|
+
- [ ] README updated if needed
|
|
43
|
+
- [ ] API docs updated
|
|
44
|
+
- [ ] Inline comments for complex logic
|
|
45
|
+
- [ ] CHANGELOG.md updated
|
|
46
|
+
|
|
47
|
+
## Security
|
|
48
|
+
- [ ] No hardcoded credentials
|
|
49
|
+
- [ ] Input validation implemented
|
|
50
|
+
- [ ] Proper error handling
|
|
51
|
+
- [ ] No sensitive data in logs
|
|
52
|
+
|
|
53
|
+
For each item, check if it is satisfied and comment on any that need attention.
|
|
54
|
+
Post a summary comment with checklist results.
|
|
55
|
+
# Claude Code GitHub Action - Safety Instructions
|
|
56
|
+
|
|
57
|
+
## Core Principles
|
|
58
|
+
|
|
59
|
+
- **READ-ONLY BY DEFAULT**: Treat the repository as read-only unless explicitly performing approved review actions
|
|
60
|
+
- **THINK BEFORE EXECUTING**: Carefully consider the implications of every command before running it
|
|
61
|
+
- **SCOPE LIMITATION**: Operate only within the context of the specific pull request being reviewed
|
|
62
|
+
|
|
63
|
+
## Strict Prohibitions
|
|
64
|
+
|
|
65
|
+
### Repository Modifications
|
|
66
|
+
- **NEVER** commit code changes, even if requested
|
|
67
|
+
- **NEVER** push to any branch
|
|
68
|
+
- **NEVER** merge pull requests
|
|
69
|
+
- **NEVER** modify git history (rebase, reset, force push, etc.)
|
|
70
|
+
- **NEVER** create, delete, or modify branches
|
|
71
|
+
- **NEVER** create or modify tags
|
|
72
|
+
|
|
73
|
+
### Workflow & Automation
|
|
74
|
+
- **NEVER** trigger, run, or execute other GitHub workflows
|
|
75
|
+
- **NEVER** modify GitHub Actions workflow files
|
|
76
|
+
- **NEVER** create or modify repository secrets
|
|
77
|
+
- **NEVER** change repository settings or permissions
|
|
78
|
+
|
|
79
|
+
### External Modifications
|
|
80
|
+
- **NEVER** make write/modify API calls to external services
|
|
81
|
+
- **NEVER** publish packages (cargo publish, npm publish, etc.)
|
|
82
|
+
- **NEVER** deploy applications or infrastructure
|
|
83
|
+
- **NEVER** modify external databases or services
|
|
84
|
+
|
|
85
|
+
## Cargo Command Safety
|
|
86
|
+
|
|
87
|
+
### Prohibited Cargo Commands
|
|
88
|
+
- **NEVER** run `cargo publish` or `cargo publish --dry-run` (could leak information)
|
|
89
|
+
- **NEVER** run `cargo install` (modifies global system state)
|
|
90
|
+
- **NEVER** run `cargo uninstall`
|
|
91
|
+
- **NEVER** run `cargo login`
|
|
92
|
+
- **NEVER** run `cargo yank` or `cargo owner`
|
|
93
|
+
- **NEVER** run any cargo subcommands that modify registry state
|
|
94
|
+
|
|
95
|
+
### Allowed Cargo Commands (Read-Only Analysis)
|
|
96
|
+
- ✅ `cargo check` - Type checking and validation
|
|
97
|
+
- ✅ `cargo clippy` - Linting and suggestions
|
|
98
|
+
- ✅ `cargo test` - Running tests (without `--release` for safety)
|
|
99
|
+
- ✅ `cargo build` - Building (prefer `--debug` over `--release`)
|
|
100
|
+
- ✅ `cargo tree` - Dependency analysis
|
|
101
|
+
- ✅ `cargo audit` - Security vulnerability scanning
|
|
102
|
+
- ✅ `cargo fmt --check` - Format checking (never with `--all` or without `--check`)
|
|
103
|
+
- ✅ `cargo doc --no-deps` - Documentation generation (local only)
|
|
104
|
+
- ✅ `cargo metadata` - Project metadata extraction
|
|
105
|
+
|
|
106
|
+
### Cargo Command Safeguards
|
|
107
|
+
- **ALWAYS** run cargo commands with `--locked` when possible to prevent dependency modifications
|
|
108
|
+
- **PREFER** `cargo check` over `cargo build` for faster validation
|
|
109
|
+
- **AVOID** `cargo build --release` unless necessary for performance-critical analysis
|
|
110
|
+
- **NEVER** modify `Cargo.toml` or `Cargo.lock` files
|
|
111
|
+
- **VERIFY** that test runs are isolated and won't affect external systems
|
|
112
|
+
|
|
113
|
+
## Approved GitHub PR Review Actions
|
|
114
|
+
|
|
115
|
+
### Comments & Reviews
|
|
116
|
+
- ✅ Create review comments on specific lines of code
|
|
117
|
+
- ✅ Create general PR comments
|
|
118
|
+
- ✅ Delete or edit your own previous comments
|
|
119
|
+
- ✅ Resolve comment threads you created
|
|
120
|
+
- ✅ Submit reviews (APPROVE, COMMENT, REQUEST_CHANGES)
|
|
121
|
+
|
|
122
|
+
### PR Analysis
|
|
123
|
+
- ✅ Read PR description, files changed, and existing comments
|
|
124
|
+
- ✅ Analyze code quality, security issues, and best practices
|
|
125
|
+
- ✅ Check for breaking changes
|
|
126
|
+
- ✅ Review dependency updates
|
|
127
|
+
|
|
128
|
+
### Limitations
|
|
129
|
+
- ❌ Do NOT resolve other users' comment threads
|
|
130
|
+
- ❌ Do NOT edit other users' comments
|
|
131
|
+
- ❌ Do NOT approve PRs without thorough analysis
|
|
132
|
+
- ❌ Do NOT request changes without clear justification
|
|
133
|
+
|
|
134
|
+
## Risk Assessment Protocol
|
|
135
|
+
|
|
136
|
+
Before running ANY command that could have side effects:
|
|
137
|
+
|
|
138
|
+
1. **ASK**: What is the purpose of this command?
|
|
139
|
+
2. **VERIFY**: Is this command in the allowed list?
|
|
140
|
+
3. **CHECK**: Does this command have any write/modify operations?
|
|
141
|
+
4. **CONFIRM**: Is this command scoped to the current PR only?
|
|
142
|
+
5. **VALIDATE**: Could this command affect external systems or state?
|
|
143
|
+
|
|
144
|
+
If ANY answer raises concern, DO NOT EXECUTE the command.
|
|
145
|
+
|
|
146
|
+
## File System Safety
|
|
147
|
+
|
|
148
|
+
- **READ**: You may read any files in the repository
|
|
149
|
+
- **TEMPORARY**: You may create temporary files for analysis (in `/tmp` or similar)
|
|
150
|
+
- **CLEANUP**: Clean up any temporary files after use
|
|
151
|
+
- **NO MODIFICATION**: Never modify tracked repository files
|
|
152
|
+
|
|
153
|
+
## Network & API Safety
|
|
154
|
+
|
|
155
|
+
- **READ-ONLY APIs**: Only call APIs for reading information (PR details, issue data, etc.)
|
|
156
|
+
- **NO WEBHOOKS**: Never trigger external webhooks or notifications
|
|
157
|
+
- **NO SECRETS**: Never log, expose, or transmit repository secrets
|
|
158
|
+
- **RATE LIMITS**: Be mindful of GitHub API rate limits
|
|
159
|
+
|
|
160
|
+
## Trust & Responsibility
|
|
161
|
+
|
|
162
|
+
You are trusted to perform thorough, helpful PR reviews while respecting these boundaries. These restrictions exist to:
|
|
163
|
+
|
|
164
|
+
- Protect the repository from accidental damage
|
|
165
|
+
- Ensure human oversight for critical decisions (merging, deploying)
|
|
166
|
+
- Prevent unintended external side effects
|
|
167
|
+
- Maintain audit trails and accountability
|
|
168
|
+
|
|
169
|
+
## When In Doubt
|
|
170
|
+
|
|
171
|
+
If you're unsure whether an action is safe or allowed:
|
|
172
|
+
|
|
173
|
+
1. **DON'T DO IT**
|
|
174
|
+
2. Explain what you wanted to do and why
|
|
175
|
+
3. Ask for explicit permission or clarification
|
|
176
|
+
4. Suggest a safer alternative if available
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
**Remember**: Your role is to ANALYZE and ADVISE, not to MODIFY and DEPLOY.
|
package/scripts/bump-version.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
3
|
|
|
4
4
|
const type = process.argv[2] || 'patch';
|
|
5
5
|
const pkg = JSON.parse(readFileSync('package.json', 'utf-8'));
|
|
@@ -12,5 +12,5 @@ pkg.version =
|
|
|
12
12
|
? `${major}.${minor + 1}.0`
|
|
13
13
|
: `${major}.${minor}.${patch + 1}`;
|
|
14
14
|
|
|
15
|
-
writeFileSync('package.json', JSON.stringify(pkg, null, 2)
|
|
15
|
+
writeFileSync('package.json', `${JSON.stringify(pkg, null, 2)}\n`);
|
|
16
16
|
console.log(`Bumped to ${pkg.version}`);
|
package/scripts/generate-rust.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
import { pathToFileURL } from 'url';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
4
|
|
|
5
5
|
const configPath = resolve(process.cwd(), '.github/rust-ci.ts');
|
|
6
6
|
const userConfig = await import(pathToFileURL(configPath).href);
|
package/src/defaults.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AiJob,
|
|
3
|
+
Arch,
|
|
4
|
+
type CargoSort,
|
|
5
|
+
type Clippy,
|
|
6
|
+
type Coverage,
|
|
7
|
+
type Dependencies,
|
|
8
|
+
type DocCheck,
|
|
9
|
+
type Extra,
|
|
10
|
+
type Fmt,
|
|
11
|
+
type Hack,
|
|
12
|
+
type Sanitizers,
|
|
13
|
+
type SemVer,
|
|
14
|
+
} from './types';
|
|
15
|
+
|
|
16
|
+
export const DEFAULT_AI: AiJob = {
|
|
17
|
+
enabled: true,
|
|
18
|
+
track_progress: true,
|
|
19
|
+
allowed_bots: '*',
|
|
20
|
+
claude_args:
|
|
21
|
+
' --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(tsc *),Bash(tsgo *),Bash(bun *),Bash(find *),Bash(diff *),Bash(jq *),Bash(git *),Bash(cargo *),Bash(gh *)"',
|
|
22
|
+
use_sticky_comment: false,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const DEFAULT_FMT: Fmt = {
|
|
26
|
+
if: true,
|
|
27
|
+
continueOnError: false,
|
|
28
|
+
run: 'cargo +nightly fmt --check --all',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const DEFAULT_SEMVER: SemVer = {
|
|
32
|
+
if: true,
|
|
33
|
+
continueOnError: false,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const DEFAULT_HACK: Hack = {
|
|
37
|
+
if: true,
|
|
38
|
+
continueOnError: false,
|
|
39
|
+
run: 'cargo hack --feature-powerset check',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const DEFAULT_DOC_CHECK: DocCheck = {
|
|
43
|
+
if: true,
|
|
44
|
+
continueOnError: false,
|
|
45
|
+
run: 'cargo +nightly docs-rs',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const DEFAULT_CARGO_SORT: CargoSort = {
|
|
49
|
+
if: true,
|
|
50
|
+
continueOnError: false,
|
|
51
|
+
run: 'if [ -f ./scripts/cargo-sort.sh ]; then\n ./scripts/cargo-sort.sh\nelse\n cargo sort -c -g\nfi\n',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const DEFAULT_DEPENDENCIES: Dependencies = {
|
|
55
|
+
if: true,
|
|
56
|
+
continueOnError: false,
|
|
57
|
+
run: 'cargo machete --with-metadata',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const DEFAULT_SANITIZERS: Sanitizers = {
|
|
61
|
+
enabled: true,
|
|
62
|
+
address: {
|
|
63
|
+
if: true,
|
|
64
|
+
continueOnError: false,
|
|
65
|
+
run: 'cargo test --lib --tests --no-fail-fast --target x86_64-unknown-linux-gnu -- --no-capture',
|
|
66
|
+
},
|
|
67
|
+
leak: {
|
|
68
|
+
if: true,
|
|
69
|
+
continueOnError: false,
|
|
70
|
+
run: 'cargo test --target x86_64-unknown-linux-gnu -- --no-capture',
|
|
71
|
+
},
|
|
72
|
+
thread: {
|
|
73
|
+
if: false,
|
|
74
|
+
continueOnError: false,
|
|
75
|
+
run: 'cargo test --target x86_64-unknown-linux-gnu -- --test-threads=1',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const DEFAULT_COVERAGE: Coverage = {
|
|
80
|
+
if: true,
|
|
81
|
+
continueOnError: false,
|
|
82
|
+
matrix: {
|
|
83
|
+
os: [Arch.ARM64],
|
|
84
|
+
toolchains: ['stable'],
|
|
85
|
+
features: ['default'],
|
|
86
|
+
},
|
|
87
|
+
run: `
|
|
88
|
+
cmd="cargo llvm-cov \${LLVM_ARGS} --locked --lcov --output-path lcov-\${FEATURES}.info --no-fail-fast"
|
|
89
|
+
if [ "$FEATURES" == "default" ]; then
|
|
90
|
+
$cmd -- --no-capture $CARGO_ARGS
|
|
91
|
+
else
|
|
92
|
+
$cmd --features "$FEATURES" -- --no-capture $CARGO_ARGS
|
|
93
|
+
fi
|
|
94
|
+
`,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const DEFAULT_CLIPPY: Clippy = {
|
|
98
|
+
if: true,
|
|
99
|
+
continueOnError: false,
|
|
100
|
+
run: '',
|
|
101
|
+
flags: '',
|
|
102
|
+
matrix: {
|
|
103
|
+
os: [Arch.ARM64],
|
|
104
|
+
toolchains: ['stable'],
|
|
105
|
+
features: ['default'],
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const DEFAULT_EXTRA: Extra = {
|
|
110
|
+
if: false,
|
|
111
|
+
continueOnError: false,
|
|
112
|
+
run: '',
|
|
113
|
+
name: 'extra',
|
|
114
|
+
matrix: {
|
|
115
|
+
os: [Arch.ARM64],
|
|
116
|
+
toolchains: ['stable'],
|
|
117
|
+
features: ['default'],
|
|
118
|
+
},
|
|
119
|
+
};
|