feat/14 append file tool#15
Conversation
|
Caution Review failedThe pull request is closed. Recent review infoRun configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Files selected for processing (19)
WalkthroughWalkthroughTwo new tools are added: ChangesNew tools, linting setup, and minor fixes
Sequence DiagramsequenceDiagram
participant Caller
participant ghPrReviewTool
participant ghCLI
Caller->>ghPrReviewTool: execute(args, ctx)
ghPrReviewTool->>ghPrReviewTool: resolve repo from args.repo or ctx
ghPrReviewTool->>ghCLI: gh pr view pr --json comments,reviews
ghCLI-->>ghPrReviewTool: raw JSON output
ghPrReviewTool->>ghPrReviewTool: parse JSON, filter empty-body reviews
ghPrReviewTool->>ghPrReviewTool: format Reviews and Comments sections
ghPrReviewTool-->>Caller: formatted report text or error string
Estimated code review effort3 (Moderate) | 25 minutes Possibly related issues
Finishing TouchesGenerate docstrings
Generate unit tests (beta)
Resolve merge conflicts
Simplify code
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Comment |
17f23d3 to
cf2579b
Compare
There was a problem hiding this comment.
2 issues found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/tools/gh-pr-review.ts">
<violation number="1" location="src/tools/gh-pr-review.ts:55">
P2: Review-state data is lost by filtering out bodyless reviews. Tool can report “No review comments” even when formal review decisions exist.</violation>
</file>
<file name="src/tools/append-file.ts">
<violation number="1" location="src/tools/append-file.ts:48">
P1: `after_line: -1` is placed at the wrong position in prepend mode. It can insert at the beginning (or after the last content line) instead of before the last line.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| } | ||
| // after_line=0 means position 0 (before first line). | ||
| // after_line=N (N>0) means after line at index N, so position N+1. | ||
| const insertPos = insertAt === 0 ? 0 : insertAt + 1; |
There was a problem hiding this comment.
P1: after_line: -1 is placed at the wrong position in prepend mode. It can insert at the beginning (or after the last content line) instead of before the last line.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/tools/append-file.ts, line 48:
<comment>`after_line: -1` is placed at the wrong position in prepend mode. It can insert at the beginning (or after the last content line) instead of before the last line.</comment>
<file context>
@@ -0,0 +1,73 @@
+ }
+ // after_line=0 means position 0 (before first line).
+ // after_line=N (N>0) means after line at index N, so position N+1.
+ const insertPos = insertAt === 0 ? 0 : insertAt + 1;
+ const before = lines.slice(0, insertPos);
+ const after = lines.slice(insertPos);
</file context>
| const reviews = data.reviews ?? []; | ||
|
|
||
| // Filter out empty-body reviews (e.g. bare APPROVED clicks) | ||
| const substantiveReviews = reviews.filter((r) => r.body && r.body.trim().length > 0); |
There was a problem hiding this comment.
P2: Review-state data is lost by filtering out bodyless reviews. Tool can report “No review comments” even when formal review decisions exist.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/tools/gh-pr-review.ts, line 55:
<comment>Review-state data is lost by filtering out bodyless reviews. Tool can report “No review comments” even when formal review decisions exist.</comment>
<file context>
@@ -0,0 +1,107 @@
+ const reviews = data.reviews ?? [];
+
+ // Filter out empty-body reviews (e.g. bare APPROVED clicks)
+ const substantiveReviews = reviews.filter((r) => r.body && r.body.trim().length > 0);
+
+ if (comments.length === 0 && substantiveReviews.length === 0) {
</file context>
|
@cubic-dev-ai Thanks for the review!
Both fixes tracked as follow-up issues from this merged PR. |
@four-bytes-robby Sounds good, those both make sense as follow-up work. On P1 ( On P2 (bodyless reviews): yep, a bare Nothing urgent here — both are minor and contained. Ship it. Tip: get faster answers by chatting with cubic’s review copilot in the review UI |
|
@cubic-dev-ai Both fixes now in PRs:
Both PRs ready for review. Thanks for the catch! |
@four-bytes-robby I have started the AI code review. It will take a few minutes to complete. |
Closes #14
Summary by cubic
Adds
append_filefor fast append/prepend-only edits andgh_pr_reviewfor structured GitHub PR review data. Cuts token use, bumps@four-bytes/four-opencode-supertoolsto 0.4.1, fixes CI fetch-depth for git-diff tests, and cleans up ESLint.New Features
append_file: append or prepend; optionalafter_line; ensures trailing newline. ~95% fewer tokens vspatch_file. Implements feat: add append_file tool for simple file appending #14.gh_pr_review: fetches review states and comments viagh; returns concise structured output with truncation.Bug Fixes
fetch-depth: 0in PR workflow to support git-diff tests using HEAD~1.datatoanyfor clearer error messages.lintscript.@typescript-eslint/no-unused-vars, and underscore unused params (no functional changes).Written for commit 157f604. Summary will update on new commits.
Summary by CodeRabbit
Release Notes v0.4.1
New Features
Bug Fixes
Tests
Chores