Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/chat-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function parseBlocks(text: string): Block[] {
}

// ── Handle Paragraphs ────────────────────────
if (line.trim() === '') {
if (line.trim().length === 0) {
blocks.push({
type: 'paragraph',
text: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/pomodoro-timer/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class GradientProgressBar extends Widget {

const attrs = styleToCellAttrs(this._style);

const label = this._showLabel ? ` ${Math.round(this._value * 100)}%` : '';
const label = this._showLabel ? ` ${Math.round(this._value * 100 + Number.EPSILON)}%` : '';
const barWidth = Math.max(0, width - label.length);
const filled = this._value <= 0 ? 0 : Math.round(barWidth * this._value);
const empty = barWidth - filled;
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export class DevServer {

this._killChild();

await exitedPromise.catch(() => {});
await exitedPromise.catch( => console.error());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Fix the invalid arrow function syntax.

The arrow function ( => console.error()) is missing its parameter list. This is a syntax error and will fail to parse.

Biome confirms this: "Expected a parenthesis '(' but instead found '=>'."

Also pass the rejection reason to console.error, otherwise the log gives no information about the failure.

🐛 Proposed fix
-            await exitedPromise.catch( => console.error());
+            await exitedPromise.catch((err) => console.error(err));
📝 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
await exitedPromise.catch( => console.error());
await exitedPromise.catch((err) => console.error(err));
🧰 Tools
🪛 Biome (2.5.5)

[error] 383-383: Expected a parenthesis '(' but instead found '=>'.

(parse)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dev-server/src/server.ts` at line 383, Fix the rejection handler in
the exitedPromise flow by adding a valid arrow-function parameter and passing
the captured rejection reason to console.error, preserving the existing catch
behavior.

Source: Linters/SAST tools


if (this._running && this._entryFile) {
this._spawnChild();
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/TreeSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function _pathsEqual(a: number[], b: number[]): boolean {

function _valuesEqual(a: string[], b: string[]): boolean {
if (a.length !== b.length) return false;
const sortedA = [...a].sort();
const sortedA = [...a].sort((a, b) => a - b);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

file="packages/ui/src/TreeSelect.ts"

# Confirm both arrays use the same comparator.
rg -n -C 2 'sortedA|sortedB|sort\(' "$file"

# Locate the repository's declared type-check command.
rg -n '"(typecheck|type-check|build)"' package.json packages/ui/package.json 2>/dev/null || true

Repository: Karanjot786/TermUI

Length of output: 740


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

file="packages/ui/src/TreeSelect.ts"
sed -n '160,195p' "$file"
echo '---'
sed -n '1,60p' "$file"
echo '---'
node - <<'JS'
const a = ["2", "10"];
const b = ["10", "2"];
const sortedA = [...a].sort((x, y) => x - y);
const sortedB = [...b].sort();
console.log(JSON.stringify({a, b, sortedA, sortedB}));
console.log(sortedA.every((v, i) => v === sortedB[i]));
JS

Repository: Karanjot786/TermUI

Length of output: 3502


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

node - <<'TS'
// Read-only behavioral probe for JavaScript subtraction order on strings.
// This does not execute repository code; it only exercises runtime semantics.
const cases = [
  [
    ["2", "10"],
    ["10", "2"]
  ],
  [
    ["10", "2"],
    ["2", "10"]
  ],
  [
    ["1", "20", "3"],
    ["3", "20", "1"],
  ],
];

for (const [a, b] of cases) {
  const sortedA = [...a].sort((a, b) => a - b);
  const sortedB = [...b].sort();
  console.log(JSON.stringify({
    a,
    b,
    sortedA,
    sortedB,
    equal: sortedA.every((v, i) => v === sortedB[i])
  }));
}
TS

Repository: Karanjot786/TermUI

Length of output: 436


Use a shared numeric comparator for both value arrays.

_valuesEqual uses different sort orders: sortedA uses numeric coercion through subtraction, while sortedB uses default lexicographic ordering. Equal selections with multi-digit values, such as ["2", "10"] and ["10", "2"], compare unequal. Replace the string subtraction with an explicit Number(left) - Number(right) comparator applied to both arrays.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/TreeSelect.ts` at line 185, Update _valuesEqual so both
sorted arrays use the same explicit numeric comparator, replacing the existing
sortedA comparator and applying Number(left) - Number(right) to sortedB as well.
Preserve the existing equality comparison and handling of multi-digit string
values.

Source: Coding guidelines

const sortedB = [...b].sort();
for (let i = 0; i < sortedA.length; i++) {
if (sortedA[i] !== sortedB[i]) return false;
Expand Down
Loading