feat(cli): add initial CLI implementation with argument parsing and prompt handling
Some checks failed
CI — Test & Build / Test & Build (pull_request) Has been cancelled
Preview — PR Build Check / PR Preview Build (pull_request) Has been cancelled

- Created package.json and package-lock.json for CLI package.
- Implemented argument parsing in args.ts to handle various flags and commands.
- Developed main CLI logic in cli.ts to execute commands and handle errors.
- Added configuration loading from a JSON file in config.ts, with environment variable support.
- Implemented prompt resolution and provider interaction in prompt.ts.
- Added usage documentation for the CLI.
- Configured TypeScript settings in tsconfig.json for the CLI package.
- Updated README in vscode package to reflect the new CLI functionality.
- Refactored root tsconfig.json to streamline project structure.
This commit is contained in:
john kevin asprec
2026-08-13 19:19:42 +08:00
parent d63d698b57
commit 2c00d2e431
37 changed files with 9303 additions and 166 deletions

View File

@@ -10,16 +10,16 @@
| Field | Value |
| --- | --- |
| Project | LexAI — BYO-LLM writing help (Chrome MV3 + VS Code) |
| Outcome | Select text → AI action (fix/rephrase/shorten/expand/explain/prompt) → replace in place (Chrome also Copy), with no backend and no subscription |
| Non-goals | no backend/account/subscription; no telemetry; no transmission of text/key except to the user's chosen provider; not a full editor; VS Code v1 skips floating toolbar / Prompt Builder / Copy As |
| Primary user | people who hold an LLM API key and want inline writing help without a SaaS subscription |
| Acceptance tests | Chrome: `typecheck` + `test -- --run` + loadable `.output/chrome-mv3/` + encrypted key path; VS Code: `vscode:typecheck` + `vscode:build` + Secret Storage key + selection replace |
| Constraints | WXT ^0.20 + React 18 + TS (Chrome); `packages/vscode` + esbuild; shared `src/lib`; Node 22; Gitea CI + Chrome Web Store |
| Source of truth | this file + `CLAUDE.md` + `docs/`; Plane (LEXAI); `docs/TASKS.md` |
| Reference bar | not yet concrete — proposal in `docs/REFERENCE_BAR.md`; no gauntlet until artifacts exist |
| Model routing | `docs/MODEL_ROUTING.md` — filled 2026-08-13 |
| Commands | `install: npm install` · `test: npm test -- --run` · `lint: npm run typecheck` · `build: npm run build` · `vscode:build` / `vscode:typecheck` / `vscode:package` |
| Project | LexAI — BYO-LLM writing help (Chrome MV3 + VS Code + CLI) |
| Outcome | Select text/code → AI help without LexAI backend or subscription |
| Non-goals | no backend/account/subscription; no telemetry; key/text only to user's provider; not a full editor |
| Primary user | people who hold an LLM API key and want inline writing / prompt help |
| Acceptance tests | `chrome:typecheck` + `chrome:test` + loadable `packages/chrome/.output/chrome-mv3/`; `vscode:typecheck` + `vscode:build`; `cli:typecheck` + `cli:build` |
| Constraints | Monorepo `packages/{chrome,vscode,cli}` + `src/lib`; Node 22; Gitea CI + Chrome Web Store |
| Source of truth | this file + `CLAUDE.md` + `docs/` + root `README.md`; Plane (LEXAI) |
| Reference bar | proposal in `docs/REFERENCE_BAR.md`; no gauntlet until artifacts exist |
| Model routing | `docs/MODEL_ROUTING.md` |
| Commands | `install:all` · `chrome:*` · `vscode:*` · `cli:*` |
### Definition of done