Skip to content
Merged
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
12 changes: 12 additions & 0 deletions apps/cli/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions apps/cli/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
2 changes: 2 additions & 0 deletions apps/cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
1 change: 1 addition & 0 deletions apps/cli/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
58 changes: 58 additions & 0 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "cli",
"version": "0.0.0",
"license": "MIT",
"bin": "dist/cli.js",
"type": "module",
"engines": {
"node": ">=16"
},
Comment on lines +7 to +9
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify Node.js version requirement for React 19.

The manifest specifies Node >=16, but React 19 is a recent release that may require a newer Node.js version. Node 16 reached end-of-life in September 2023.

Verify the minimum Node.js version required by React 19:


🌐 Web query:

What is the minimum Node.js version required for React 19?

💡 Result:

React itself (React 19) has no strict minimum Node.js requirement — it's a client library; the React 19 upgrade guide doesn't set a Node version. [1]

However, many popular toolchains and frameworks used with React 19 (Vite, Next, Chakra, etc.) require modern Node — commonly Node 20+ (or Node 18.18+/22+ for some tools). So upgrade your Node runtime to at least Node 20 to avoid toolchain/CI issues. [1][2]

Sources:

  • React 19 upgrade guide (react.dev). [1]
  • Chakra UI (Vite) docs mentioning Node 20.x minimum for Vite-based setups. [2]

🏁 Script executed:

#!/bin/bash
# Check the full package.json to see all dependencies and toolchain
cat apps/cli/package.json

Length of output: 1226


🏁 Script executed:

#!/bin/bash
# Check if there's a build script or toolchain configuration
rg -n "vite|webpack|esbuild|tsx|tsc|typescript" apps/cli/package.json -A2 -B2

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Check if React is directly used or is a transitive dependency
rg -n "react|@react" apps/cli/ --type=ts --type=tsx --type=js -l | head -20

Length of output: 27


🏁 Script executed:

#!/bin/bash
# Search for React/Ink usage in source files to confirm context
find apps/cli/source -type f \( -name "*.js" -o -name "*.jsx" \) 2>/dev/null | head -5

Length of output: 45


🏁 Script executed:

#!/bin/bash
# Check Node requirement across key dependencies in package.json
# Look for engines field in installed packages or npm registry info
npm view ink@4.1.0 engines 2>/dev/null || echo "Ink check failed"
npm view meow@11.0.0 engines 2>/dev/null || echo "Meow check failed"
npm view ava@5.2.0 engines 2>/dev/null || echo "Ava check failed"

Length of output: 86


🏁 Script executed:

#!/bin/bash
# Check Babel 7.21.0 Node requirement
npm view @babel/cli@7.21.0 engines 2>/dev/null || echo "Babel check failed"

Length of output: 19


Update Node.js engine requirement to >=16.15 minimum.

The specification ">=16" is insufficient because ava 5.2.0 requires Node >=16.15 when using the Node 16 track. This means Node 16.0–16.14 would fail tests. Since Node 16 is EOL (September 2023), consider updating to ">=18" for better alignment with modern toolchains.

🤖 Prompt for AI Agents
In apps/cli/package.json around lines 7–9, the Node engine requirement is ">=16"
which allows unsupported 16.0–16.14 and can break ava 5.2.0; update the
"engines.node" value to ">=16.15" to satisfy ava's minimum Node 16 track
requirement (or set to ">=18" if you prefer to require a more modern LTS), and
ensure package.json formatting remains valid.

"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"start": "bun watch.ts",
"typecheck": "tsc --noEmit",
"test": "prettier --check . && xo && ava",
"lint": "biome check --write .",
"lint:check": "biome check .",
"format": "biome format --write .",
"format:check": "biome format ."
},
"files": [
"dist"
],
"dependencies": {
"ink": "^4.1.0",
"meow": "^11.0.0",
"react": "^19.1.1"
},
Comment on lines +24 to +28
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify React 19.1.1 compatibility with Ink 4.1.0.

React 19 is a very recent release. Ensure that Ink 4.1.0 has been tested and verified to work with React 19, as terminal UI rendering can be sensitive to React internals.

You may search the web for documentation or recent issues to confirm compatibility:


🌐 Web query:

Is Ink 4.1.0 compatible with React 19?

💡 Result:

No — Ink 4.1.0 is not compatible with React 19. (React 19 support was added later; Ink v6+ requires/supports React 19.) [1][2]

Sources:

  • Issue reporting React 19 incompatibility in Ink. [1]
  • Ink v6 release notes: “React 19 support” / “Require React 19”. [2]

Ink 4.1.0 is incompatible with React 19.1.1 — update to Ink v6+ or downgrade React.

Ink 4.1.0 does not support React 19; React 19 support was added in Ink v6+. The current dependency configuration will fail at runtime. Either upgrade Ink to v6+ (which requires React 19) or downgrade React to a version compatible with Ink 4.1.0.

File: apps/cli/package.json (lines 18–22)

"devDependencies": {
"@sindresorhus/tsconfig": "^3.0.1",
"@types/react": "^19.1.11",
"@vdemedes/prettier-config": "^2.0.1",
"ava": "^5.2.0",
"chalk": "^5.6.2",
"chokidar": "^3.5.3",
"eslint-config-xo-react": "^0.27.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"ink-testing-library": "^3.0.0",
"prettier": "^2.8.7",
"typescript": "^5.9.3",
"xo": "^0.53.1"
},
"ava": {
"extensions": {
"ts": "module",
"tsx": "module"
}
},
"xo": {
"extends": "xo-react",
"prettier": true,
"rules": {
"react/prop-types": "off"
}
},
"prettier": "@vdemedes/prettier-config"
}
25 changes: 25 additions & 0 deletions apps/cli/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# cli

> This readme is automatically generated by [create-ink-app](https://github.com/vadimdemedes/create-ink-app)

## Install

```bash
$ npm install --global cli
```

## CLI

```
$ cli --help

Usage
$ cli

Options
--name Your name

Examples
$ cli --name=Jane
Hello, Jane
```
63 changes: 63 additions & 0 deletions apps/cli/source/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { Box, Text, useApp, useInput } from "ink";
import React, { useEffect, useState } from "react";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Remove unused React import causing pipeline failure.

The React import is not needed in modern React with the JSX transform and is causing a CI failure.

Apply this diff:

 import { Box, Text, useApp, useInput } from "ink";
-import React, { useEffect, useState } from "react";
+import { useEffect, useState } from "react";
📝 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
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
🧰 Tools
🪛 GitHub Actions: CI

[error] 2-2: lint/correctness/noUnusedImports FIXABLE - Import 'React' is unused.

🤖 Prompt for AI Agents
In apps/cli/source/app.tsx around line 2, the import "React" is unused and
causing CI to fail; remove the React named import from the import statement so
it only imports the used hooks (useEffect, useState) — i.e., change the import
to import only what’s used or delete the import entirely if nothing is used; run
TypeScript/TSX build to confirm the pipeline passes.


type Props = {
name: string | undefined;
};

export default function App({ name = "Stranger" }: Props) {
const [counter, setCounter] = useState(0);
const [input, setInput] = useState("");
const { exit } = useApp();

useEffect(() => {
const timer = setInterval(() => {
setCounter((c) => c + 1);
}, 1000);

return () => clearInterval(timer);
}, []);

useInput((input, key) => {
if (key.escape || (key.ctrl && input === "c")) {
exit();
}

if (key.return) {
setInput("");
} else if (key.backspace || key.delete) {
setInput((prev) => prev.slice(0, -1));
} else if (!key.ctrl && !key.meta) {
setInput((prev) => prev + input);
}
});

return (
<Box
flexDirection="column"
padding={1}
borderStyle="round"
borderColor="red"
>
<Text>
👋 Welcome,{" "}
<Text color="red" bold>
{name}
</Text>
! 🚀
</Text>
<Text color="green">⏱️ Runtime: {counter}s</Text>
<Box marginTop={1}>
<Text>
Type something:{" "}
<Text color="yellow" bold>
{input}
</Text>
</Text>
</Box>
<Box marginTop={1}>
<Text dimColor>Press ESC or Ctrl+C to exit</Text>
</Box>
</Box>
);
}
29 changes: 29 additions & 0 deletions apps/cli/source/cli.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env node
import React from "react";
import { render } from "ink";
import meow from "meow";
import App from "./app.js";

const cli = meow(
`
Usage
$ cli

Options
--name Your name

Examples
$ cli --name=Jane
Hello, Jane
`,
{
importMeta: import.meta,
flags: {
name: {
type: "string",
},
},
},
);

render(<App name={cli.flags.name} />);
17 changes: 17 additions & 0 deletions apps/cli/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
import chalk from "chalk";
import test from "ava";
import { render } from "ink-testing-library";
import App from "./source/app.js";

test("greet unknown user", (t) => {
const { lastFrame } = render(<App />);

t.is(lastFrame(), `Hello, ${chalk.green("Stranger")}`);
});

test("greet user with a name", (t) => {
const { lastFrame } = render(<App name="Jane" />);

t.is(lastFrame(), `Hello, ${chalk.green("Jane")}`);
});
9 changes: 9 additions & 0 deletions apps/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@sindresorhus/tsconfig",
"compilerOptions": {
"outDir": "dist",
"skipLibCheck": true,
"types": []
},
"include": ["source"]
}
45 changes: 45 additions & 0 deletions apps/cli/watch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env node
import { spawn, type ChildProcess } from "node:child_process";
import chokidar from "chokidar";

Comment on lines +2 to +4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix import sorting to resolve pipeline failure.

The imports are not sorted according to the project's linting rules, causing a CI failure.

Apply this diff:

-import { spawn, type ChildProcess } from "node:child_process";
-import chokidar from "chokidar";
+import chokidar from "chokidar";
+import { spawn, type ChildProcess } from "node:child_process";
📝 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
import { spawn, type ChildProcess } from "node:child_process";
import chokidar from "chokidar";
import chokidar from "chokidar";
import { spawn, type ChildProcess } from "node:child_process";
🧰 Tools
🪛 GitHub Actions: CI

[warning] 2-4: assist/source/organizeImports FIXABLE - The imports and exports are not sorted.

🤖 Prompt for AI Agents
In apps/cli/watch.ts around lines 2 to 4, the module imports are not sorted per
project linting rules; reorder the imports into the canonical groups and order
(builtin modules first, then external packages) and sort alphabetically within
each group — e.g., keep "import { spawn, type ChildProcess } from
'node:child_process';" before "import chokidar from 'chokidar';" — so the file
complies with the import-sorting rule and CI will pass.

let child: ChildProcess | null = null;

function startApp() {
if (child) {
child.kill();
}

console.log("\x1b[36m[watch] Starting app...\x1b[0m");
child = spawn("node", ["dist/cli.js"], {
stdio: "inherit",
shell: false,
});

child.on("exit", (code) => {
if (code !== null && code !== 0 && code !== 130) {
console.log(`\x1b[33m[watch] App exited with code ${code}\x1b[0m`);
}
});
}

const watcher = chokidar.watch("dist/**/*", {
ignoreInitial: false,
persistent: true,
});

watcher.on("ready", () => {
console.log("\x1b[36m[watch] Watching dist/ for changes...\x1b[0m");
startApp();
});

watcher.on("change", (path) => {
console.log(`\x1b[36m[watch] File changed: ${path}\x1b[0m`);
startApp();
});

process.on("SIGINT", () => {
if (child) {
child.kill();
}
process.exit(0);
});
Loading
Loading