Skip to content

Commit bd6eff9

Browse files
authored
Merge pull request #50 from AnExiledDev/feat/cli-features
Add plugin, config, and review commands to CLI
2 parents c763769 + 00c5808 commit bd6eff9

Some content is hidden

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

58 files changed

+4108
-74
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: CI
33
on:
44
push:
55
branches: [main, staging]
6-
paths: ['container/**']
6+
paths: ['container/**', 'cli/**']
77
pull_request:
88
branches: [main, staging]
9-
paths: ['container/**']
9+
paths: ['container/**', 'cli/**']
1010

1111
jobs:
1212
test:
@@ -41,7 +41,10 @@ jobs:
4141
working-directory: container
4242

4343
test-cli:
44-
runs-on: ubuntu-latest
44+
runs-on: ${{ matrix.os }}
45+
strategy:
46+
matrix:
47+
os: [ubuntu-latest, windows-latest, macos-latest]
4548
steps:
4649
- uses: actions/checkout@v6
4750
- uses: oven-sh/setup-bun@v2

.github/workflows/release-cli.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Release CLI
2+
3+
on:
4+
push:
5+
tags: ['cli-v*']
6+
7+
jobs:
8+
validate:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
version: ${{ steps.extract.outputs.version }}
12+
steps:
13+
- uses: actions/checkout@v6
14+
- id: extract
15+
name: Extract and validate version
16+
run: |
17+
TAG="${GITHUB_REF#refs/tags/cli-v}"
18+
PKG=$(node -p "require('./cli/package.json').version")
19+
echo "version=$TAG" >> "$GITHUB_OUTPUT"
20+
if [ "$TAG" != "$PKG" ]; then
21+
echo "::error::Tag cli-v${TAG} does not match cli/package.json version ${PKG}"
22+
exit 1
23+
fi
24+
25+
publish-and-release:
26+
needs: validate
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: write
30+
steps:
31+
- uses: actions/checkout@v6
32+
33+
- uses: oven-sh/setup-bun@v2
34+
35+
- name: Install dependencies
36+
run: bun install
37+
working-directory: cli
38+
39+
- name: Run tests
40+
run: bun test
41+
working-directory: cli
42+
43+
- name: Build
44+
run: bun run build
45+
working-directory: cli
46+
47+
- uses: actions/setup-node@v6
48+
with:
49+
node-version: 18
50+
registry-url: https://registry.npmjs.org
51+
52+
- name: Publish to npm
53+
run: npm publish
54+
working-directory: cli
55+
env:
56+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
58+
- name: Extract changelog section
59+
id: changelog
60+
run: |
61+
VERSION="${{ needs.validate.outputs.version }}"
62+
NOTES=$(sed -n "/^## v${VERSION}/,/^## v/{ /^## v${VERSION}/d; /^## v/d; p; }" cli/CHANGELOG.md)
63+
[ -z "$NOTES" ] && NOTES="CLI Release v${VERSION}"
64+
echo "$NOTES" > /tmp/release-notes.md
65+
66+
- name: Create GitHub Release
67+
env:
68+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
run: |
70+
VERSION="cli-v${{ needs.validate.outputs.version }}"
71+
gh release create "$VERSION" --title "$VERSION" --notes-file /tmp/release-notes.md

cli/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# CodeForge CLI Changelog
2+
3+
## v0.1.0 — 2026-03-05
4+
5+
Initial release.
6+
7+
- Session search, list, and show commands
8+
- Plan search command
9+
- Plugin management (list, show, enable, disable, hooks, agents, skills)
10+
- Config apply and show commands
11+
- AI-powered code review with 3-pass analysis (correctness, security, quality)

cli/bun.lock

Lines changed: 0 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/package.json

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
{
2-
"name": "codeforge-cli",
2+
"name": "codeforge-dev-cli",
33
"version": "0.1.0",
44
"description": "CLI for CodeForge development workflows",
5+
"keywords": [
6+
"codeforge",
7+
"cli",
8+
"code-review",
9+
"developer-tools",
10+
"devcontainer",
11+
"claude"
12+
],
513
"type": "module",
614
"bin": {
715
"codeforge": "./dist/codeforge.js"
816
},
917
"scripts": {
10-
"build": "bun build src/index.ts --outdir dist --target bun",
18+
"build": "bun build src/index.ts --outfile dist/codeforge.js --target bun",
1119
"dev": "bun run src/index.ts",
12-
"test": "bun test"
20+
"test": "bun test",
21+
"prepublishOnly": "bun run build && bun test"
1322
},
1423
"dependencies": {
1524
"commander": "^13.0.0",
16-
"chalk": "^5.4.0",
17-
"fast-glob": "^3.3.0"
25+
"chalk": "^5.4.0"
1826
},
1927
"devDependencies": {
2028
"@types/bun": "^1.3.10",
@@ -32,6 +40,11 @@
3240
"directory": "cli"
3341
},
3442
"homepage": "https://github.com/AnExiledDev/CodeForge/tree/main/cli#readme",
43+
"files": [
44+
"dist/",
45+
"prompts/",
46+
"README.md"
47+
],
3548
"bugs": {
3649
"url": "https://github.com/AnExiledDev/CodeForge/issues"
3750
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
You are a code reviewer focused exclusively on correctness — bugs, logic errors, and behavioral defects that cause wrong results or runtime failures.
2+
3+
You DO NOT review: style, naming conventions, performance, code quality, or security vulnerabilities. Those are handled by separate specialized review passes.
4+
5+
## Issue Taxonomy
6+
7+
### Control Flow Errors
8+
9+
- Off-by-one in loops (fence-post errors) — CWE-193
10+
- Wrong boolean logic (De Morgan violations, inverted conditions)
11+
- Unreachable code or dead branches after early return
12+
- Missing break in switch/case (fall-through bugs)
13+
- Infinite loops from wrong termination conditions
14+
- Incorrect short-circuit evaluation order
15+
16+
### Null/Undefined Safety
17+
18+
- Property access on potentially null or undefined values — CWE-476
19+
- Missing optional chaining or null guards
20+
- Uninitialized variables used before assignment
21+
- Destructuring from nullable sources without defaults
22+
- Accessing .length or iterating over potentially undefined collections
23+
24+
### Error Handling Defects
25+
26+
- Uncaught exceptions from JSON.parse, network calls, file I/O, or regex
27+
- Empty catch blocks that silently swallow errors
28+
- Error objects discarded (catch without using or rethrowing the error)
29+
- Missing finally blocks for resource cleanup (streams, handles, connections)
30+
- Async errors: unhandled promise rejections, missing await on try/catch
31+
- Incorrect error propagation (throwing strings instead of Error objects)
32+
33+
### Type and Data Errors
34+
35+
- Implicit type coercion bugs (== vs ===, string + number concatenation)
36+
- Array index out of bounds on fixed-size or empty arrays — CWE-129
37+
- Integer overflow/underflow in arithmetic — CWE-190
38+
- Incorrect API usage (wrong argument order, missing required params, wrong return type handling)
39+
- String/number confusion in comparisons or map keys
40+
- Incorrect regular expression patterns (catastrophic backtracking, wrong escaping)
41+
42+
### Concurrency and Timing
43+
44+
- Race conditions in async code (TOCTOU: check-then-act) — CWE-367
45+
- Missing await on async functions (using the Promise instead of the resolved value)
46+
- Shared mutable state modified from concurrent async operations
47+
- Event ordering assumptions that may not hold (setup before listener, response before request)
48+
- Promise.all with side effects that assume sequential execution
49+
50+
### Edge Cases
51+
52+
- Empty collections (arrays, maps, sets, strings) not handled before access
53+
- Boundary values: 0, -1, MAX_SAFE_INTEGER, empty string, undefined, NaN
54+
- Unicode/encoding issues in string operations (multi-byte chars, surrogate pairs)
55+
- Large inputs causing stack overflow (deep recursion) or memory exhaustion
56+
57+
## Analysis Method
58+
59+
Think step by step. For each changed file, mentally execute the code:
60+
61+
1. **Identify inputs.** What data enters this function? What are its possible types and values, including null, undefined, empty, and malformed?
62+
2. **Trace control flow.** At each branch point, ask: what happens when the condition is false? What happens when both branches are taken across consecutive calls?
63+
3. **Check data access safety.** At each property access, array index, or method call, ask: can the receiver be null, undefined, or the wrong type?
64+
4. **Verify loop correctness.** For each loop: is initialization correct? Does termination trigger at the right time? Does the increment/decrement step cover all cases? Is the loop body idempotent when it needs to be?
65+
5. **Audit async paths.** For each async call: is there an await? Is the error handled? Could concurrent calls interleave unsafely?
66+
6. **Self-check.** Review your findings. Remove any that lack concrete evidence from the actual code. If you cannot point to a specific line and explain exactly how the bug manifests, do not report it.
67+
68+
## Severity Calibration
69+
70+
- **critical**: Will crash, corrupt data, or produce wrong results in normal usage — not just edge cases. High confidence required.
71+
- **high**: Will fail under realistic but less common conditions (specific input patterns, certain timing).
72+
- **medium**: Edge case that requires specific inputs or unusual conditions to trigger, but is a real bug.
73+
- **low**: Defensive improvement; unlikely to manifest in practice but worth fixing for robustness.
74+
- **info**: Observation or suggestion, not a concrete bug.
75+
76+
Only report issues you can point to in the actual code with a specific line number. Do not invent hypothetical scenarios unsupported by the diff. If you're uncertain whether something is a real bug, err on the side of not reporting it.
77+
78+
## Output Quality
79+
80+
- Every finding MUST include the exact file path and line number.
81+
- Every finding MUST include a concrete, actionable fix suggestion.
82+
- Descriptions must explain WHY it's a problem (what goes wrong), not just WHAT the issue is (what the code does).
83+
- **category**: Use the taxonomy headers from this prompt (e.g., "Control Flow Errors", "Null/Undefined Safety", "Error Handling Defects", "Type and Data Errors", "Concurrency and Timing", "Edge Cases").
84+
- **title**: Concise and specific, under 80 characters. "Missing null check on user.profile" — not "Potential issue with data handling."
85+
- After drafting all findings, re-read each one and ask: "Is this a real bug with evidence, or am I speculating?" Remove speculative findings.
86+
- If you find no issues, that is a valid and expected outcome. Do not manufacture findings to appear thorough.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Review this git diff for correctness issues ONLY.
2+
3+
Apply your analysis method systematically to each changed file:
4+
5+
1. **Read beyond the diff.** Use the surrounding context to understand function signatures, types, and data flow. If a changed line references a variable defined outside the diff, consider what that variable could be.
6+
2. **Trace inputs through the changes.** Identify every input to the changed code (function parameters, external data, return values from calls) and consider their full range of possible values — including null, undefined, empty, and error cases.
7+
3. **Walk each execution path.** For every branch, loop, and error handler in the changed code, mentally execute both the happy path and the failure path. Ask: what state is the program in after each path?
8+
4. **Apply the issue taxonomy.** Systematically check each category: control flow errors, null/undefined safety, error handling defects, type/data errors, concurrency issues, and edge cases.
9+
5. **Calibrate severity.** Use the severity definitions from your instructions. A bug that only triggers with empty input on a function that always receives validated data is low, not critical.
10+
6. **Self-check before reporting.** For each potential finding, verify: Can I point to the exact line? Can I describe how it fails? If not, discard it.
11+
12+
Do NOT flag: style issues, naming choices, performance concerns, or security vulnerabilities. Those are handled by separate review passes.
13+
14+
Only report issues with concrete evidence from the code. Do not speculate.
15+
16+
<diff>
17+
{{DIFF}}
18+
</diff>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
You previously reviewed this diff for correctness and security issues. Now review it for CODE QUALITY issues only.
2+
3+
Apply your analysis method systematically:
4+
5+
1. **Readability** — is the intent clear to a newcomer? Are names specific? Is the abstraction level consistent?
6+
2. **Complexity** — identify input sizes for loops, count nesting levels and responsibilities per function.
7+
3. **Duplication** — scan for repeated patterns (5+ lines or 3+ occurrences). Do not flag trivial similarity.
8+
4. **Error handling** — do messages include context? Are patterns consistent within each module?
9+
5. **API design** — are signatures consistent? Do public functions have clear contracts?
10+
6. **Calibrate** — apply the "real burden vs style preference" test. Remove subjective findings.
11+
12+
Do NOT re-report correctness or security findings from previous passes — they are already captured.
13+
Prioritize findings that will create real maintenance burden over cosmetic suggestions.
14+
15+
If a finding seems to overlap with a previous pass (e.g., poor error handling that is both a quality issue and a correctness bug), only report the quality-specific aspects: the maintenance burden, the readability impact, and the improvement suggestion. Do not duplicate the correctness or security perspective.

0 commit comments

Comments
 (0)