Skip to content

agent: @U0AJM7X8FBR @U0AJM7X8FBR become an expert at this repo https://github.c#15

Open
recoup-coding-agent wants to merge 1 commit intomainfrom
agent/-u0ajm7x8fbr--u0ajm7x8fbr-beco-1773529339998
Open

agent: @U0AJM7X8FBR @U0AJM7X8FBR become an expert at this repo https://github.c#15
recoup-coding-agent wants to merge 1 commit intomainfrom
agent/-u0ajm7x8fbr--u0ajm7x8fbr-beco-1773529339998

Conversation

@recoup-coding-agent
Copy link
Copy Markdown

@recoup-coding-agent recoup-coding-agent commented Mar 14, 2026

Automated PR from coding agent.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a reset command to the agent CLI that clears conversation history.
  • Documentation

    • Added comprehensive documentation to internal functions and APIs across the codebase.
  • Style

    • Improved code formatting and consistency throughout the application.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bash Ready Ready Preview Mar 14, 2026 11:12pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 14, 2026

📝 Walkthrough

Walkthrough

The pull request adds JSDoc documentation comments to numerous functions and methods across the codebase, simplifies arrow function syntax throughout (removing parentheses from single parameters), and reformats code formatting for consistency. Additionally, a new "reset" command is introduced to the agent CLI that clears message history, and a default endpoint parameter is added to the agent command factory function.

Changes

Cohort / File(s) Summary
API Routes
app/api/agent/new/route.ts, app/api/agent/route.ts, app/api/fs/route.ts
Added JSDoc documentation blocks; simplified arrow function parameter syntax (removed parentheses from single parameters); minor formatting adjustments.
Terminal Components
app/components/lite-terminal/LiteTerminal.ts, app/components/lite-terminal/ansi-parser.ts, app/components/lite-terminal/index.ts, app/components/lite-terminal/input-handler.ts
Added JSDoc/@param annotations to multiple methods; simplified arrow function syntax; consolidated multi-line expressions to single-line forms; reformatted export statement.
Terminal Command Parts
app/components/terminal-parts/agent-command.ts, app/components/terminal-parts/commands.ts, app/components/terminal-parts/input-handler.ts, app/components/terminal-parts/markdown.ts, app/components/terminal-parts/welcome.ts
Added JSDoc documentation; implemented new "reset" command to clear agent message history; added default value for agentEndpoint parameter; simplified arrow function syntax and formatting.
Hooks
app/hooks/useSetupSandbox.ts
Added empty documentation comment block above function.
Markdown Routes
app/md/[[...path]]/route.ts
Added JSDoc block; reformatted arrow function syntax; adjusted object key syntax and spacing.
Agent Library
lib/agent/createAgentResponse.ts, lib/agent/handleAgentRequest.ts
Added JSDoc documentation blocks; reformatted function signatures across multiple lines; consolidated filter/map chains.
Sandbox Library
lib/recoup-api/createSandbox.ts, lib/recoup-api/getSandboxes.ts, lib/recoup-api/setupSandbox.ts, lib/recoup-api/updateAccountSnapshot.ts, lib/sandbox/createFreshSandbox.ts, lib/sandbox/createSnapshotSandbox.ts, lib/sandbox/readSourceFiles.ts, lib/sandbox/saveSnapshot.ts
Added JSDoc parameter documentation blocks to all functions; no functional or control-flow changes.
Configuration
next.config.ts
Added trailing comma to rewrites closure in object literal; minor syntactic adjustment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hopping through the code with glee,
Adding docs for all to see,
Arrow functions lean and bright,
Reset commands set things right—
Polish, shine, and cleanup's done!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title contains user mentions and truncated URLs that appear to be noise/artifacts rather than a clear description of the changeset's primary purpose. Replace the title with a concise, descriptive summary of the main change (e.g., 'docs: Add JSDoc comments and minor formatting cleanup' or 'refactor: Improve code documentation across agent and terminal components').
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch agent/-u0ajm7x8fbr--u0ajm7x8fbr-beco-1773529339998
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
app/hooks/useSetupSandbox.ts (1)

14-26: ⚠️ Potential issue | 🟠 Major

hasRun is flipped too early and can block valid retries.

At Line 15, hasRun.current = true executes before token/data checks. If Line 20 or Line 23 early-returns once, setup won’t be attempted again.

🔧 Proposed fix
   useEffect(() => {
     if (!authenticated || hasRun.current) return;
-    hasRun.current = true;
 
     (async () => {
       try {
         const token = await getAccessToken();
         if (!token) return;
@@
         const data = await getSandboxes(token);
         if (!data) return;
         if (data.snapshot_id && data.github_repo) return;
 
+        hasRun.current = true;
         setupSandbox(token);
       } catch {
         // Silent — background provisioning only
       }
     })();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/hooks/useSetupSandbox.ts` around lines 14 - 26, The hasRun flag is set
too early which prevents retries when getAccessToken or getSandboxes return
falsy; update useSetupSandbox so hasRun.current is only set after the checks
succeed (or immediately after setupSandbox is invoked) — i.e., remove/move the
hasRun.current = true assignment out of the top of the async block and place it
after you verify token and data (and/or after calling setupSandbox), referencing
the hasRun variable along with getAccessToken(), getSandboxes(), setupSandbox()
and authenticated to ensure early returns do not permanently block future
attempts.
lib/recoup-api/setupSandbox.ts (1)

7-11: ⚠️ Potential issue | 🔴 Critical

Add explicit error handling and timeout to fire-and-forget fetch.

The fetch() call at line 8 lacks error handling and timeout protection. Network failures are silently dropped, and the request could hang indefinitely. Even for fire-and-forget operations, add .catch() for errors and AbortSignal.timeout() for timeout protection.

🔧 Proposed fix
-export function setupSandbox(bearerToken: string) {
-  fetch(`${RECOUP_API_URL}/api/sandboxes/setup`, {
-    method: "POST",
-    headers: { Authorization: `Bearer ${bearerToken}` },
-  });
-}
+export function setupSandbox(bearerToken: string): void {
+  void fetch(`${RECOUP_API_URL}/api/sandboxes/setup`, {
+    method: "POST",
+    headers: { Authorization: `Bearer ${bearerToken}` },
+    signal: AbortSignal.timeout(10000),
+  })
+    .then(response => {
+      if (!response.ok) {
+        console.warn("Failed to setup sandbox:", response.status);
+      }
+    })
+    .catch(error => {
+      console.warn("Error setting up sandbox:", error);
+    });
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/recoup-api/setupSandbox.ts` around lines 7 - 11, The fire-and-forget
fetch in setupSandbox (calling fetch(`${RECOUP_API_URL}/api/sandboxes/setup`,
...)) needs explicit timeout and error handling: wrap the request with
AbortSignal.timeout(...) to enforce a max wait and attach a .catch(...) to log
or handle errors (use bearerToken in the Authorization header as before) so
network failures or hangs are not silently dropped; ensure the timeout and catch
are applied even though the call remains non-blocking.
🧹 Nitpick comments (18)
app/api/fs/route.ts (1)

11-16: Empty JSDoc blocks should be completed or removed.

Lines 11-16 and Line 90 add placeholder JSDoc without usable descriptions. Please fill in intent/return details or drop the blocks.

Also applies to: 90-92

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/api/fs/route.ts` around lines 11 - 16, The JSDoc placeholders in this
file are empty; update or remove them so docs are useful—specifically either add
meaningful descriptions/param types/return info for the readAllFiles function
(params: dir, baseDir; returns Promise<Record<string,string>>) and for the other
documented symbol around lines 90–92, or delete those JSDoc blocks entirely;
locate the JSDoc immediately above the readAllFiles function and the other empty
block (referencing the surrounding function or export name) and replace the
empty tags with concise `@param` and `@returns` descriptions or remove the comment
block.
app/components/terminal-parts/commands.ts (1)

8-26: Extract shared command factory to remove duplication.

The three command definitions repeat the same shape (stdout/stderr/exitCode). A tiny helper will keep this file cleaner and easier to extend.

♻️ Proposed refactor
 export function createStaticCommands() {
-  const aboutCmd = defineCommand("about", async () => ({
-    stdout: getTerminalData("cmd-about"),
-    stderr: "",
-    exitCode: 0,
-  }));
-
-  const installCmd = defineCommand("install", async () => ({
-    stdout: getTerminalData("cmd-install"),
-    stderr: "",
-    exitCode: 0,
-  }));
-
-  const githubCmd = defineCommand("github", async () => ({
-    stdout: getTerminalData("cmd-github"),
-    stderr: "",
-    exitCode: 0,
-  }));
+  const makeStaticCommand = (name: string, dataKey: string) =>
+    defineCommand(name, async () => ({
+      stdout: getTerminalData(dataKey),
+      stderr: "",
+      exitCode: 0,
+    }));
+
+  const aboutCmd = makeStaticCommand("about", "cmd-about");
+  const installCmd = makeStaticCommand("install", "cmd-install");
+  const githubCmd = makeStaticCommand("github", "cmd-github");
 
   return { aboutCmd, installCmd, githubCmd };
 }
As per coding guidelines, "Apply DRY (Don't Repeat Yourself) - extract shared logic into reusable utilities".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/terminal-parts/commands.ts` around lines 8 - 26, The three
command definitions (aboutCmd, installCmd, githubCmd) repeat the same result
shape; extract a small factory helper (e.g., makeSimpleCmd) that takes a
terminal key and returns an async handler calling getTerminalData and returning
{ stdout, stderr: "", exitCode: 0 }, then replace each defineCommand call to use
defineCommand("name", makeSimpleCmd("cmd-key")); reference the existing
defineCommand, getTerminalData, and the command constants (aboutCmd, installCmd,
githubCmd) when implementing the helper.
lib/sandbox/createFreshSandbox.ts (1)

4-7: Replace placeholder JSDoc with meaningful documentation (or remove it).

Line 4 adds an empty JSDoc block with only @param name. Please add a short summary/param intent, or remove the block to avoid doc noise.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/sandbox/createFreshSandbox.ts` around lines 4 - 7, The JSDoc above the
createFreshSandbox function is a placeholder with only "@param agentDataDir";
either replace it with a brief descriptive summary plus a clear description of
the agentDataDir parameter (its purpose, expected type/format, and side effects)
or remove the JSDoc entirely to avoid noisy/empty comments; update the block
that references createFreshSandbox and the agentDataDir param accordingly so the
doc accurately describes the function contract.
lib/recoup-api/getSandboxes.ts (1)

3-6: Incomplete JSDoc documentation.

The JSDoc block is empty except for the @param tag without a description. Either provide meaningful documentation describing what the function does and what bearerToken represents, or omit the JSDoc entirely.

 /**
- *
- * `@param` bearerToken
+ * Fetches all sandboxes associated with the authenticated user.
+ * `@param` bearerToken - The authentication token for API authorization
+ * `@returns` The sandbox list or null if the request fails
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/recoup-api/getSandboxes.ts` around lines 3 - 6, The JSDoc above the
getSandboxes function is incomplete; either add a concise description of what
getSandboxes does and a clear description for the bearerToken parameter (e.g.,
"Bearer token used for Authorization header") or remove the JSDoc block
entirely; update the JSDoc associated with the getSandboxes function and its
bearerToken parameter to be meaningful and accurate so the function signature
(getSandboxes(bearerToken)) is properly documented.
lib/recoup-api/createSandbox.ts (1)

3-6: Incomplete JSDoc documentation.

Same issue as other files—the JSDoc block lacks a description and the @param tag has no explanation. Consider adding a meaningful description or removing the empty documentation block.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/recoup-api/createSandbox.ts` around lines 3 - 6, The JSDoc above the
createSandbox function is empty and its `@param` bearerToken tag has no
description; update the JSDoc for createSandbox to include a one-line summary of
what the function does and a brief description for the bearerToken parameter (or
remove the block entirely if you prefer no JSDoc). Locate the JSDoc directly
above the createSandbox declaration and either add meaningful descriptions for
the function and its bearerToken param or delete the empty comment to avoid
misleading/empty documentation.
lib/agent/handleAgentRequest.ts (1)

6-10: Incomplete JSDoc documentation.

The @param tags have no descriptions. Documenting what req should contain (expected body shape) and the purpose of createSandbox would be valuable, otherwise remove the empty block.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/agent/handleAgentRequest.ts` around lines 6 - 10, The JSDoc above the
handleAgentRequest function is incomplete: update the comment block to either
remove the empty `@param` tags or add concise descriptions for both parameters —
describe the expected structure of req (e.g., required properties on req.body
such as input, userId, metadata) and explain createSandbox (e.g., a
factory/function that returns an isolated execution environment or sandbox
instance used for running agent tasks). Keep the JSDoc aligned with the function
name handleAgentRequest and ensure parameter names match exactly.
lib/sandbox/saveSnapshot.ts (1)

4-8: Incomplete JSDoc documentation.

The @param tags lack descriptions. Either document the parameters meaningfully (e.g., what sandbox represents, what bearerToken is used for) or omit the empty JSDoc.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/sandbox/saveSnapshot.ts` around lines 4 - 8, The JSDoc for the function
in saveSnapshot.ts is incomplete: either add meaningful descriptions for the
existing `@param` tags (e.g., describe what the sandbox object represents and the
purpose/format of bearerToken) or remove the empty JSDoc block entirely; update
the comment above the saveSnapshot function (referencing the sandbox parameter
and bearerToken parameter) so each `@param` has a concise description or delete
the unused JSDoc.
lib/sandbox/createSnapshotSandbox.ts (1)

5-9: Incomplete JSDoc documentation.

The @param tags have no descriptions. Add meaningful documentation or remove the empty block.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/sandbox/createSnapshotSandbox.ts` around lines 5 - 9, The JSDoc block
above the createSnapshotSandbox function is incomplete: fill in meaningful
descriptions for the `@param` tags (e.g., describe bearerToken as the auth token
used for sandbox creation and agentDataDir as the path to the agent's data
directory) and add any missing `@returns` or `@throws` tags to document return
values or errors; alternatively, remove the empty JSDoc block if you prefer to
rely on TypeScript types instead. Ensure the comment sits immediately above the
createSnapshotSandbox function declaration so tools and editors pick up the
updated documentation.
app/components/terminal-parts/welcome.ts (1)

9-12: Incomplete JSDoc documentation.

The JSDoc block is effectively empty. The Terminal type is locally defined and self-explanatory, so either add a meaningful function description or remove the empty block.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/terminal-parts/welcome.ts` around lines 9 - 12, The JSDoc
block above the function that accepts the term parameter is empty; either remove
it or replace it with a meaningful description and param tag—e.g., add a
one-line summary of what the function does and a `@param` {Terminal} term
description referencing the local Terminal type so the doc is useful; update the
JSDoc immediately above the function that takes term in
app/components/terminal-parts/welcome.ts.
app/components/terminal-parts/markdown.ts (1)

13-14: Incomplete JSDoc documentation.

The @param text tag lacks a description. The existing comment block (lines 10-12) already provides good context about the function's purpose, so either complete the @param documentation or remove the empty tag.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/terminal-parts/markdown.ts` around lines 13 - 14, The JSDoc
for the function in app/components/terminal-parts/markdown.ts contains an empty
`@param` text tag; update the docblock for the function that takes the text
parameter by either adding a concise description for `@param` text (e.g., "text -
markdown string to be rendered" or similar) or remove the empty `@param` tag
entirely so the JSDoc is not incomplete; keep the rest of the existing comment
intact to preserve the purpose context.
app/components/lite-terminal/ansi-parser.ts (1)

103-106: Empty JSDoc pattern continues.

The parseSGR, parse, handleCSI, and handleOSC methods have incomplete JSDoc blocks. Same feedback as noted in other files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/lite-terminal/ansi-parser.ts` around lines 103 - 106, The
JSDoc blocks for parseSGR, parse, handleCSI, and handleOSC in ansi-parser.ts are
incomplete; update each JSDoc to include a concise one-line description, typed
`@param` tags for every parameter (e.g., params, style, data, etc.), and an
`@returns` tag if the function returns a value (or `@returns` {void} if not). Locate
the methods by name (parseSGR, parse, handleCSI, handleOSC) and add complete
descriptions and parameter types consistent with the surrounding code (e.g.,
string, number, Style object), keeping wording brief and matching existing
project JSDoc style.
app/components/terminal-parts/agent-command.ts (1)

16-19: Empty JSDoc blocks.

Same pattern as other files. The formatForTerminal and createAgentCommand functions have incomplete JSDoc.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/terminal-parts/agent-command.ts` around lines 16 - 19, The
JSDoc blocks for formatForTerminal and createAgentCommand are empty; fill them
with concise descriptions, parameter and return tags: for formatForTerminal
document what input "text" is (type string), what formatting it performs and the
return type (string), and for createAgentCommand describe the function's
purpose, its parameters (types and meaning) and the returned command object
(type/shape). Reference the functions by name (formatForTerminal,
createAgentCommand) and ensure each JSDoc includes `@param` and `@returns` entries
matching the actual implementation.
app/components/lite-terminal/input-handler.ts (1)

20-22: Same empty JSDoc pattern continues here.

The attach, onData, emit, and scrollCursorIntoView methods have been annotated with empty JSDoc blocks. Same feedback applies as noted in other files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/lite-terminal/input-handler.ts` around lines 20 - 22, The
empty JSDoc blocks for the methods attach, onData, emit, and
scrollCursorIntoView should be removed or replaced with concise, meaningful
JSDoc comments: for attach(document what it attaches to and return behavior),
for onData(describe expected data parameter and side effects), for emit(specify
event name and payload shape), and for scrollCursorIntoView(describe scrolling
behavior and any DOM side effects); update each JSDoc to include parameter types
and return descriptions (or delete the empty block if no documentation is
needed) to avoid placeholder/empty comments and improve code clarity.
app/components/terminal-parts/input-handler.ts (1)

14-18: Pattern of empty JSDoc blocks across the file.

Multiple functions (findPrevWordBoundary, findNextWordBoundary, getCompletionContext, createInputHandler) have been annotated with empty JSDoc blocks that only list parameter names without descriptions. These add clutter without providing value. Consider either adding meaningful descriptions or removing them.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/terminal-parts/input-handler.ts` around lines 14 - 18, Remove
the empty/param-only JSDoc blocks for findPrevWordBoundary,
findNextWordBoundary, getCompletionContext, and createInputHandler in
input-handler.ts (or replace them with meaningful descriptions if you prefer);
specifically delete JSDoc blocks that only list `@param` names without
descriptions or, if keeping JSDoc, update each block to include a short
description for the function and each parameter and the return value so the
comments are useful. Ensure no stray empty comment blocks remain so the file no
longer contains cluttering placeholder JSDoc entries.
app/api/agent/route.ts (1)

5-8: Empty JSDoc provides no value.

The JSDoc block has an empty description and only lists @param req without any type or description. Either add meaningful documentation explaining what this endpoint does, or remove the empty block entirely.

Suggested improvement
-/**
- *
- * `@param` req
- */
+/**
+ * Handles agent requests using a snapshot sandbox for state persistence.
+ * `@param` req - The incoming HTTP request containing agent messages
+ */

Or simply remove the empty JSDoc:

-/**
- *
- * `@param` req
- */
 export async function POST(req: Request) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/api/agent/route.ts` around lines 5 - 8, Remove or replace the empty JSDoc
block above the route handler that only lists "@param req": either delete the
entire block if it adds no value, or replace it with a concise description of
the endpoint and a proper param/return annotation (e.g., describe what the route
does, document "req" type and expected request body or query params, and
document the response shape). Locate the JSDoc immediately above the route
handler (the handler that receives "req") and update accordingly.
app/api/agent/new/route.ts (1)

5-8: Empty JSDoc provides no value.

Same issue as in app/api/agent/route.ts - the JSDoc block has no meaningful content. Add a description or remove it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/api/agent/new/route.ts` around lines 5 - 8, The JSDoc block above the
route handler in app/api/agent/new/route.ts is empty and should be either
removed or replaced with a meaningful description; update the JSDoc to describe
the purpose, parameters, and return value of the exported route handler (the
function handling requests in this file) or delete the empty /** */ block
entirely to avoid clutter.
app/md/[[...path]]/route.ts (1)

27-32: JSDoc uses cryptic auto-generated parameter names.

The parameter names root0 and root0.params appear to be auto-generated and don't convey meaning. Either add meaningful descriptions or remove this incomplete JSDoc.

Suggested improvement
 /**
- *
- * `@param` _request
- * `@param` root0
- * `@param` root0.params
+ * Serves static markdown and JSON files from the FILES mapping.
+ * `@param` _request - The incoming request (unused)
+ * `@param` context - Route context containing path parameters
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/md/`[[...path]]/route.ts around lines 27 - 32, The JSDoc block contains
auto-generated, unclear parameter names (`root0` / `root0.params`); replace them
with meaningful names or remove the incomplete JSDoc. Update the JSDoc for the
route handler (the function that takes `_request` and the context object) to use
real parameter names and types — e.g. `@param {Request} request` for `_request`
and `@param {{ params: Record<string, string> }} context` (or `@param {{ params:
{ path?: string } }} context` if more specific) — and add brief descriptions, or
simply delete the JSDoc block if it offers no value. Ensure the names match the
actual function signature (the route handler in this file) so tooling and
readers get correct info.
app/components/lite-terminal/LiteTerminal.ts (1)

42-45: Tighten JSDoc blocks so they add signal, not noise.

Several new doc blocks have empty summaries and @param tags without descriptions. Consider either adding short intent/constraint notes per param or removing the placeholder tags.

As per coding guidelines, "Apply KISS (Keep It Simple) - prefer simple solutions over clever ones".

Also applies to: 95-97, 143-145, 153-155, 177-179, 246-248, 275-277, 290-292, 408-412, 433-435, 475-478, 493-495, 556-558, 567-570, 634-637, 678-682, 728-732, 786-788, 810-812

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/components/lite-terminal/LiteTerminal.ts` around lines 42 - 45, The file
contains multiple empty or placeholder JSDoc blocks (e.g., the block above the
"options" param in LiteTerminal) that add noise; either remove these empty
summaries/`@param` tags or replace them with a single short intent sentence and
a concise param description (e.g., for the constructor/initializer that accepts
"options" state what the options are for and list required/optional keys), and
apply the same treatment consistently to the other empty blocks noted in the
comment (all JSDoc blocks in LiteTerminal.ts that currently only have an empty
summary and `@param` tag should be trimmed or tightened to a one-line purpose
and brief param descriptions).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/md/`[[...path]]/route.ts:
- Line 34: The destructured variable "path" from "let { path } = await params;"
is never reassigned, so replace the mutable declaration with an immutable one by
changing the declaration to use const (i.e., use "const { path } = await
params;") inside the async route handler where the destructuring occurs to
satisfy the prefer-const rule and avoid unnecessary mutability.

---

Outside diff comments:
In `@app/hooks/useSetupSandbox.ts`:
- Around line 14-26: The hasRun flag is set too early which prevents retries
when getAccessToken or getSandboxes return falsy; update useSetupSandbox so
hasRun.current is only set after the checks succeed (or immediately after
setupSandbox is invoked) — i.e., remove/move the hasRun.current = true
assignment out of the top of the async block and place it after you verify token
and data (and/or after calling setupSandbox), referencing the hasRun variable
along with getAccessToken(), getSandboxes(), setupSandbox() and authenticated to
ensure early returns do not permanently block future attempts.

In `@lib/recoup-api/setupSandbox.ts`:
- Around line 7-11: The fire-and-forget fetch in setupSandbox (calling
fetch(`${RECOUP_API_URL}/api/sandboxes/setup`, ...)) needs explicit timeout and
error handling: wrap the request with AbortSignal.timeout(...) to enforce a max
wait and attach a .catch(...) to log or handle errors (use bearerToken in the
Authorization header as before) so network failures or hangs are not silently
dropped; ensure the timeout and catch are applied even though the call remains
non-blocking.

---

Nitpick comments:
In `@app/api/agent/new/route.ts`:
- Around line 5-8: The JSDoc block above the route handler in
app/api/agent/new/route.ts is empty and should be either removed or replaced
with a meaningful description; update the JSDoc to describe the purpose,
parameters, and return value of the exported route handler (the function
handling requests in this file) or delete the empty /** */ block entirely to
avoid clutter.

In `@app/api/agent/route.ts`:
- Around line 5-8: Remove or replace the empty JSDoc block above the route
handler that only lists "@param req": either delete the entire block if it adds
no value, or replace it with a concise description of the endpoint and a proper
param/return annotation (e.g., describe what the route does, document "req" type
and expected request body or query params, and document the response shape).
Locate the JSDoc immediately above the route handler (the handler that receives
"req") and update accordingly.

In `@app/api/fs/route.ts`:
- Around line 11-16: The JSDoc placeholders in this file are empty; update or
remove them so docs are useful—specifically either add meaningful
descriptions/param types/return info for the readAllFiles function (params: dir,
baseDir; returns Promise<Record<string,string>>) and for the other documented
symbol around lines 90–92, or delete those JSDoc blocks entirely; locate the
JSDoc immediately above the readAllFiles function and the other empty block
(referencing the surrounding function or export name) and replace the empty tags
with concise `@param` and `@returns` descriptions or remove the comment block.

In `@app/components/lite-terminal/ansi-parser.ts`:
- Around line 103-106: The JSDoc blocks for parseSGR, parse, handleCSI, and
handleOSC in ansi-parser.ts are incomplete; update each JSDoc to include a
concise one-line description, typed `@param` tags for every parameter (e.g.,
params, style, data, etc.), and an `@returns` tag if the function returns a value
(or `@returns` {void} if not). Locate the methods by name (parseSGR, parse,
handleCSI, handleOSC) and add complete descriptions and parameter types
consistent with the surrounding code (e.g., string, number, Style object),
keeping wording brief and matching existing project JSDoc style.

In `@app/components/lite-terminal/input-handler.ts`:
- Around line 20-22: The empty JSDoc blocks for the methods attach, onData,
emit, and scrollCursorIntoView should be removed or replaced with concise,
meaningful JSDoc comments: for attach(document what it attaches to and return
behavior), for onData(describe expected data parameter and side effects), for
emit(specify event name and payload shape), and for
scrollCursorIntoView(describe scrolling behavior and any DOM side effects);
update each JSDoc to include parameter types and return descriptions (or delete
the empty block if no documentation is needed) to avoid placeholder/empty
comments and improve code clarity.

In `@app/components/lite-terminal/LiteTerminal.ts`:
- Around line 42-45: The file contains multiple empty or placeholder JSDoc
blocks (e.g., the block above the "options" param in LiteTerminal) that add
noise; either remove these empty summaries/`@param` tags or replace them with a
single short intent sentence and a concise param description (e.g., for the
constructor/initializer that accepts "options" state what the options are for
and list required/optional keys), and apply the same treatment consistently to
the other empty blocks noted in the comment (all JSDoc blocks in LiteTerminal.ts
that currently only have an empty summary and `@param` tag should be trimmed or
tightened to a one-line purpose and brief param descriptions).

In `@app/components/terminal-parts/agent-command.ts`:
- Around line 16-19: The JSDoc blocks for formatForTerminal and
createAgentCommand are empty; fill them with concise descriptions, parameter and
return tags: for formatForTerminal document what input "text" is (type string),
what formatting it performs and the return type (string), and for
createAgentCommand describe the function's purpose, its parameters (types and
meaning) and the returned command object (type/shape). Reference the functions
by name (formatForTerminal, createAgentCommand) and ensure each JSDoc includes
`@param` and `@returns` entries matching the actual implementation.

In `@app/components/terminal-parts/commands.ts`:
- Around line 8-26: The three command definitions (aboutCmd, installCmd,
githubCmd) repeat the same result shape; extract a small factory helper (e.g.,
makeSimpleCmd) that takes a terminal key and returns an async handler calling
getTerminalData and returning { stdout, stderr: "", exitCode: 0 }, then replace
each defineCommand call to use defineCommand("name", makeSimpleCmd("cmd-key"));
reference the existing defineCommand, getTerminalData, and the command constants
(aboutCmd, installCmd, githubCmd) when implementing the helper.

In `@app/components/terminal-parts/input-handler.ts`:
- Around line 14-18: Remove the empty/param-only JSDoc blocks for
findPrevWordBoundary, findNextWordBoundary, getCompletionContext, and
createInputHandler in input-handler.ts (or replace them with meaningful
descriptions if you prefer); specifically delete JSDoc blocks that only list
`@param` names without descriptions or, if keeping JSDoc, update each block to
include a short description for the function and each parameter and the return
value so the comments are useful. Ensure no stray empty comment blocks remain so
the file no longer contains cluttering placeholder JSDoc entries.

In `@app/components/terminal-parts/markdown.ts`:
- Around line 13-14: The JSDoc for the function in
app/components/terminal-parts/markdown.ts contains an empty `@param` text tag;
update the docblock for the function that takes the text parameter by either
adding a concise description for `@param` text (e.g., "text - markdown string to
be rendered" or similar) or remove the empty `@param` tag entirely so the JSDoc is
not incomplete; keep the rest of the existing comment intact to preserve the
purpose context.

In `@app/components/terminal-parts/welcome.ts`:
- Around line 9-12: The JSDoc block above the function that accepts the term
parameter is empty; either remove it or replace it with a meaningful description
and param tag—e.g., add a one-line summary of what the function does and a
`@param` {Terminal} term description referencing the local Terminal type so the
doc is useful; update the JSDoc immediately above the function that takes term
in app/components/terminal-parts/welcome.ts.

In `@app/md/`[[...path]]/route.ts:
- Around line 27-32: The JSDoc block contains auto-generated, unclear parameter
names (`root0` / `root0.params`); replace them with meaningful names or remove
the incomplete JSDoc. Update the JSDoc for the route handler (the function that
takes `_request` and the context object) to use real parameter names and types —
e.g. `@param {Request} request` for `_request` and `@param {{ params:
Record<string, string> }} context` (or `@param {{ params: { path?: string } }}
context` if more specific) — and add brief descriptions, or simply delete the
JSDoc block if it offers no value. Ensure the names match the actual function
signature (the route handler in this file) so tooling and readers get correct
info.

In `@lib/agent/handleAgentRequest.ts`:
- Around line 6-10: The JSDoc above the handleAgentRequest function is
incomplete: update the comment block to either remove the empty `@param` tags or
add concise descriptions for both parameters — describe the expected structure
of req (e.g., required properties on req.body such as input, userId, metadata)
and explain createSandbox (e.g., a factory/function that returns an isolated
execution environment or sandbox instance used for running agent tasks). Keep
the JSDoc aligned with the function name handleAgentRequest and ensure parameter
names match exactly.

In `@lib/recoup-api/createSandbox.ts`:
- Around line 3-6: The JSDoc above the createSandbox function is empty and its
`@param` bearerToken tag has no description; update the JSDoc for createSandbox to
include a one-line summary of what the function does and a brief description for
the bearerToken parameter (or remove the block entirely if you prefer no JSDoc).
Locate the JSDoc directly above the createSandbox declaration and either add
meaningful descriptions for the function and its bearerToken param or delete the
empty comment to avoid misleading/empty documentation.

In `@lib/recoup-api/getSandboxes.ts`:
- Around line 3-6: The JSDoc above the getSandboxes function is incomplete;
either add a concise description of what getSandboxes does and a clear
description for the bearerToken parameter (e.g., "Bearer token used for
Authorization header") or remove the JSDoc block entirely; update the JSDoc
associated with the getSandboxes function and its bearerToken parameter to be
meaningful and accurate so the function signature (getSandboxes(bearerToken)) is
properly documented.

In `@lib/sandbox/createFreshSandbox.ts`:
- Around line 4-7: The JSDoc above the createFreshSandbox function is a
placeholder with only "@param agentDataDir"; either replace it with a brief
descriptive summary plus a clear description of the agentDataDir parameter (its
purpose, expected type/format, and side effects) or remove the JSDoc entirely to
avoid noisy/empty comments; update the block that references createFreshSandbox
and the agentDataDir param accordingly so the doc accurately describes the
function contract.

In `@lib/sandbox/createSnapshotSandbox.ts`:
- Around line 5-9: The JSDoc block above the createSnapshotSandbox function is
incomplete: fill in meaningful descriptions for the `@param` tags (e.g., describe
bearerToken as the auth token used for sandbox creation and agentDataDir as the
path to the agent's data directory) and add any missing `@returns` or `@throws` tags
to document return values or errors; alternatively, remove the empty JSDoc block
if you prefer to rely on TypeScript types instead. Ensure the comment sits
immediately above the createSnapshotSandbox function declaration so tools and
editors pick up the updated documentation.

In `@lib/sandbox/saveSnapshot.ts`:
- Around line 4-8: The JSDoc for the function in saveSnapshot.ts is incomplete:
either add meaningful descriptions for the existing `@param` tags (e.g., describe
what the sandbox object represents and the purpose/format of bearerToken) or
remove the empty JSDoc block entirely; update the comment above the saveSnapshot
function (referencing the sandbox parameter and bearerToken parameter) so each
`@param` has a concise description or delete the unused JSDoc.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d92e7219-8104-4bb1-9acc-1c680c5757a8

📥 Commits

Reviewing files that changed from the base of the PR and between 4f11645 and 060ac63.

📒 Files selected for processing (25)
  • app/api/agent/new/route.ts
  • app/api/agent/route.ts
  • app/api/fs/route.ts
  • app/components/lite-terminal/LiteTerminal.ts
  • app/components/lite-terminal/ansi-parser.ts
  • app/components/lite-terminal/index.ts
  • app/components/lite-terminal/input-handler.ts
  • app/components/terminal-parts/agent-command.ts
  • app/components/terminal-parts/commands.ts
  • app/components/terminal-parts/input-handler.ts
  • app/components/terminal-parts/markdown.ts
  • app/components/terminal-parts/welcome.ts
  • app/hooks/useSetupSandbox.ts
  • app/md/[[...path]]/route.ts
  • lib/agent/createAgentResponse.ts
  • lib/agent/handleAgentRequest.ts
  • lib/recoup-api/createSandbox.ts
  • lib/recoup-api/getSandboxes.ts
  • lib/recoup-api/setupSandbox.ts
  • lib/recoup-api/updateAccountSnapshot.ts
  • lib/sandbox/createFreshSandbox.ts
  • lib/sandbox/createSnapshotSandbox.ts
  • lib/sandbox/readSourceFiles.ts
  • lib/sandbox/saveSnapshot.ts
  • next.config.ts

* @param root0.params
*/
export async function GET(_request: Request, { params }: { params: Promise<{ path?: string[] }> }) {
let { path } = await params;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use const instead of let for destructured path.

The path variable is never reassigned, so const should be used per the prefer-const rule.

Proposed fix
-  let { path } = await params;
+  const { path } = await params;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let { path } = await params;
const { path } = await params;
🧰 Tools
🪛 ESLint

[error] 34-34: 'path' is never reassigned. Use 'const' instead.

(prefer-const)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/md/`[[...path]]/route.ts at line 34, The destructured variable "path"
from "let { path } = await params;" is never reassigned, so replace the mutable
declaration with an immutable one by changing the declaration to use const
(i.e., use "const { path } = await params;") inside the async route handler
where the destructuring occurs to satisfy the prefer-const rule and avoid
unnecessary mutability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant