Skip to content

Commit 9e73ea5

Browse files
authored
Merge branch 'main' into feat/subagent-low-effort-defaults
2 parents 7983d73 + 5d872e8 commit 9e73ea5

41 files changed

Lines changed: 3327 additions & 254 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/rules/code-style.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
- **Naming**: NEVER use leading underscores (`_function_name`) - Python has no true private functions, use public names
1010
- **Paths**: Always use absolute paths
1111
- **Encoding**: Always pass `encoding="utf-8"` to `open()`, `read_text()`, `write_text()`, etc. in new or changed code — Windows defaults to `cp1252` which breaks on non-ASCII content. Don't flag pre-existing code that lacks it unless you're already modifying that line.
12+
- **Pre-commit**: Run `uv run prek` before committing — fix any issues before creating the commit
13+
- **Pre-push**: Before pushing, run `uv run prek run --from-ref origin/<base>` to check all changed files against the PR base — this matches CI behavior and catches issues that per-commit prek misses. To detect the base branch: `gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo main`

.github/workflows/claude.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
workflow_dispatch:
55
pull_request:
66
types: [opened, synchronize, ready_for_review, reopened]
7+
paths-ignore:
8+
- '.github/workflows/**'
9+
- '*.md'
10+
- 'docs/**'
11+
- 'demos/**'
12+
- 'experiments/**'
13+
- 'LICENSE'
14+
- '.tessl/**'
15+
- 'code_to_optimize/**'
16+
- 'codeflash.code-workspace'
17+
- 'uv.lock'
718
issue_comment:
819
types: [created]
920
pull_request_review_comment:
@@ -23,7 +34,7 @@ jobs:
2334
if: |
2435
(
2536
github.event_name == 'pull_request' &&
26-
github.actor != 'claude[bot]' &&
37+
github.event.sender.login != 'claude[bot]' &&
2738
github.event.pull_request.head.repo.full_name == github.repository
2839
) ||
2940
github.event_name == 'workflow_dispatch'
@@ -77,6 +88,20 @@ jobs:
7788
Post all review findings in a single summary comment only — never as inline PR review comments.
7889
</commitment>
7990
91+
<step name="triage">
92+
Before doing any work, assess the PR scope:
93+
94+
1. Run `gh pr diff ${{ github.event.pull_request.number }} --name-only` to get changed files.
95+
2. Classify as TRIVIAL if ALL changed files are:
96+
- Config/CI files (.github/, .tessl/, *.toml, *.lock, *.json, *.yml, *.yaml)
97+
- Documentation (*.md, docs/)
98+
- Non-production code (demos/, experiments/, code_to_optimize/)
99+
- Only whitespace, formatting, or comment changes
100+
101+
If TRIVIAL: post a single comment "No substantive code changes to review." and stop — do not execute any further steps.
102+
Otherwise: continue with the full review below.
103+
</step>
104+
80105
<step name="lint_and_typecheck">
81106
Run checks on files changed in this PR and auto-fix what you can.
82107
@@ -167,12 +192,6 @@ jobs:
167192
*Last updated: <timestamp>*
168193
</step>
169194
170-
<step name="simplify">
171-
Run /simplify to review recently changed code for reuse, quality, and efficiency opportunities.
172-
If improvements are found, commit with "refactor: simplify <description>" and push.
173-
Only make behavior-preserving changes.
174-
</step>
175-
176195
<step name="merge_optimization_prs">
177196
Check for open PRs from codeflash-ai[bot]:
178197
`gh pr list --author "codeflash-ai[bot]" --state open --json number,title,headRefName,createdAt,mergeable`
@@ -194,7 +213,7 @@ jobs:
194213
- All findings are in a single summary comment (no inline review comments were created)
195214
- If fixes were made, they were verified with prek
196215
</verification>
197-
claude_args: '--model us.anthropic.claude-opus-4-6-v1 --max-turns 25 --allowedTools "Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh pr checks:*),Bash(gh pr merge:*),Bash(gh issue view:*),Bash(gh issue list:*),Bash(gh api:*),Bash(uv run prek *),Bash(uv run mypy *),Bash(uv run coverage *),Bash(uv run pytest *),Bash(git status*),Bash(git add *),Bash(git commit *),Bash(git push*),Bash(git diff *),Bash(git checkout *),Read,Glob,Grep,Edit,Skill"'
216+
claude_args: '--model us.anthropic.claude-sonnet-4-6 --allowedTools "Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh pr checks:*),Bash(gh pr merge:*),Bash(gh pr close:*),Bash(gh issue view:*),Bash(gh issue list:*),Bash(gh api:*),Bash(uv run prek *),Bash(uv run mypy *),Bash(uv run coverage *),Bash(uv run pytest *),Bash(git status*),Bash(git add *),Bash(git commit *),Bash(git push*),Bash(git diff *),Bash(git checkout *),Read,Glob,Grep,Edit"'
198217
additional_permissions: |
199218
actions: read
200219
@@ -272,6 +291,6 @@ jobs:
272291
uses: anthropics/claude-code-action@v1
273292
with:
274293
use_bedrock: "true"
275-
claude_args: '--model us.anthropic.claude-opus-4-6-v1 --allowedTools "Read,Edit,Write,Glob,Grep,Bash(git status*),Bash(git diff*),Bash(git add *),Bash(git commit *),Bash(git push*),Bash(git log*),Bash(git merge*),Bash(git fetch*),Bash(git checkout*),Bash(git branch*),Bash(uv run prek *),Bash(prek *),Bash(uv run ruff *),Bash(uv run pytest *),Bash(uv run mypy *),Bash(uv run coverage *),Bash(gh pr comment*),Bash(gh pr view*),Bash(gh pr diff*),Bash(gh pr merge*),Bash(gh pr close*)"'
294+
claude_args: '--model us.anthropic.claude-sonnet-4-6 --allowedTools "Read,Edit,Write,Glob,Grep,Bash(git status*),Bash(git diff*),Bash(git add *),Bash(git commit *),Bash(git push*),Bash(git log*),Bash(git merge*),Bash(git fetch*),Bash(git checkout*),Bash(git branch*),Bash(uv run prek *),Bash(prek *),Bash(uv run ruff *),Bash(uv run pytest *),Bash(uv run mypy *),Bash(uv run coverage *),Bash(gh pr comment*),Bash(gh pr view*),Bash(gh pr diff*),Bash(gh pr merge*),Bash(gh pr close*)"'
276295
additional_permissions: |
277296
actions: read
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Codeflash Configuration for Mocha CJS JavaScript Project
2+
module_root: "."
3+
tests_root: "tests"
4+
test_framework: "mocha"
5+
formatter_cmds: []
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Fibonacci implementations - CommonJS module
3+
* Intentionally inefficient for optimization testing.
4+
*/
5+
6+
/**
7+
* Calculate the nth Fibonacci number using naive recursion.
8+
* This is intentionally slow to demonstrate optimization potential.
9+
* @param {number} n - The index of the Fibonacci number to calculate
10+
* @returns {number} The nth Fibonacci number
11+
*/
12+
function fibonacci(n) {
13+
if (n <= 1) {
14+
return n;
15+
}
16+
return fibonacci(n - 1) + fibonacci(n - 2);
17+
}
18+
19+
/**
20+
* Check if a number is a Fibonacci number.
21+
* @param {number} num - The number to check
22+
* @returns {boolean} True if num is a Fibonacci number
23+
*/
24+
function isFibonacci(num) {
25+
// A number is Fibonacci if one of (5*n*n + 4) or (5*n*n - 4) is a perfect square
26+
const check1 = 5 * num * num + 4;
27+
const check2 = 5 * num * num - 4;
28+
return isPerfectSquare(check1) || isPerfectSquare(check2);
29+
}
30+
31+
/**
32+
* Check if a number is a perfect square.
33+
* @param {number} n - The number to check
34+
* @returns {boolean} True if n is a perfect square
35+
*/
36+
function isPerfectSquare(n) {
37+
const sqrt = Math.sqrt(n);
38+
return sqrt === Math.floor(sqrt);
39+
}
40+
41+
/**
42+
* Generate an array of Fibonacci numbers up to n.
43+
* @param {number} n - The number of Fibonacci numbers to generate
44+
* @returns {number[]} Array of Fibonacci numbers
45+
*/
46+
function fibonacciSequence(n) {
47+
const result = [];
48+
for (let i = 0; i < n; i++) {
49+
result.push(fibonacci(i));
50+
}
51+
return result;
52+
}
53+
54+
// CommonJS exports
55+
module.exports = {
56+
fibonacci,
57+
isFibonacci,
58+
isPerfectSquare,
59+
fibonacciSequence,
60+
};

0 commit comments

Comments
 (0)