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

@@ -0,0 +1,48 @@
---
name: Bug report
about: Report a problem with LexAI (Chrome, VS Code, or CLI)
title: "[bug] "
labels: bug
---
## Summary
A clear, one-sentence description of the bug.
## Package
Which LexAI surface is affected?
- [ ] Chrome extension (`packages/chrome`)
- [ ] VS Code / Cursor extension (`packages/vscode`)
- [ ] CLI Prompt Builder (`packages/cli`)
- [ ] Shared library (`src/lib`) / unclear
## Environment
- LexAI version / commit (if known):
- OS:
- Browser / VS Code / Cursor version (if relevant):
- Provider + model (no API keys):
## Steps to reproduce
1.
2.
3.
## Expected behavior
What you expected to happen.
## Actual behavior
What happened instead. Include error messages (redact secrets).
## Screenshots / logs
Attach if helpful. **Never paste API keys or encrypted key material.**
## Additional context
Anything else that might help (page type, selection size, offline, etc.).

View File

@@ -0,0 +1,24 @@
## Summary
Briefly describe what this PR changes and why.
## Package(s)
- [ ] `packages/chrome`
- [ ] `packages/vscode`
- [ ] `packages/cli`
- [ ] `src/lib` (shared)
- [ ] Docs / CI / repo meta
## Test plan
- [ ] `npm run chrome:typecheck` / `npm run chrome:test` (if Chrome or shared lib)
- [ ] `npm run vscode:typecheck` / `npm run vscode:build` (if VS Code)
- [ ] `npm run cli:typecheck` / `npm run cli:build` (if CLI)
- [ ] Manual check (describe):
## Checklist
- [ ] No API keys, tokens, or personal data in the diff
- [ ] Docs / README updated if user-facing behavior changed
- [ ] Related issue linked (if any): #

View File

@@ -29,32 +29,30 @@ jobs:
git checkout ${{ gitea.sha }}
fi
- name: Install dependencies
- name: Install Chrome package dependencies
run: npm ci --prefer-offline --no-audit --no-fund
working-directory: /tmp/lexai
working-directory: /tmp/lexai/packages/chrome
# Generates .wxt/types (ImportMeta.env etc.) required by typecheck.
# Also runs via the postinstall hook — kept explicit so a future
# --ignore-scripts install can't silently break the typecheck step.
- name: Prepare WXT types
run: npx wxt prepare
working-directory: /tmp/lexai
working-directory: /tmp/lexai/packages/chrome
- name: Type check
run: npm run typecheck
working-directory: /tmp/lexai
working-directory: /tmp/lexai/packages/chrome
- name: Run unit tests
run: npm test -- --run
working-directory: /tmp/lexai
working-directory: /tmp/lexai/packages/chrome
- name: Build extension
run: npm run build
working-directory: /tmp/lexai
working-directory: /tmp/lexai/packages/chrome
- name: Verify build output
run: ls -la .output/chrome-mv3/
working-directory: /tmp/lexai
working-directory: /tmp/lexai/packages/chrome
- name: Package as ZIP
run: |
@@ -64,7 +62,7 @@ jobs:
zip -r /tmp/lexai-chrome-mv3-${VERSION}.zip .output/chrome-mv3/
echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
echo "✅ Packaged: lexai-chrome-mv3-${VERSION}.zip"
working-directory: /tmp/lexai
working-directory: /tmp/lexai/packages/chrome
- name: Publish to Gitea Package Registry
if: gitea.event_name == 'push'

View File

@@ -30,24 +30,29 @@ jobs:
- name: Install dependencies
run: npm ci
working-directory: packages/chrome
# Same gates as CI — a release must never check less than a push.
- name: Prepare WXT types
run: npx wxt prepare
working-directory: packages/chrome
- name: Type check
run: npm run typecheck
working-directory: packages/chrome
- name: Run tests
run: npm test -- --run
working-directory: packages/chrome
- name: Build extension
run: npm run build
working-directory: packages/chrome
- name: Package as ZIP
run: |
VERSION=${{ gitea.ref_name || 'manual' }}
ZIPFILE="$(pwd)/lexai-chrome-mv3-${VERSION}.zip"
ZIPFILE="$(cd ../.. && pwd)/lexai-chrome-mv3-${VERSION}.zip"
# Verify manifest exists and check version
node -e "console.log('Manifest version:', require('./.output/chrome-mv3/manifest.json').version)"
# Zip from inside the chrome-mv3 dir so manifest.json is at root
@@ -55,6 +60,7 @@ jobs:
echo "ZIP_FILE=${ZIPFILE}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "✅ Packaged: lexai-chrome-mv3-${VERSION}.zip"
working-directory: packages/chrome
- name: Get Chrome Web Store OAuth2 Token

View File

@@ -23,21 +23,26 @@ jobs:
- name: Install dependencies
run: npm ci
working-directory: packages/chrome
- name: Type check
run: npm run typecheck
working-directory: packages/chrome
- name: Run unit tests
run: npm test -- --run
working-directory: packages/chrome
- name: Build extension
run: npm run build
working-directory: packages/chrome
- name: Package preview ZIP
run: |
PR_NUM=${{ gitea.event.pull_request.number }}
zip -r lexai-pr-${PR_NUM}-preview.zip .output/chrome-mv3/
zip -r ../../lexai-pr-${PR_NUM}-preview.zip .output/chrome-mv3/
echo "✅ PR #${PR_NUM} build successful"
working-directory: packages/chrome
- name: Comment on PR
run: |

View File

@@ -23,20 +23,24 @@ jobs:
- name: Install dependencies
run: npm ci
working-directory: packages/chrome
- name: Run tests
run: npm test -- --run
working-directory: packages/chrome
- name: Build extension
run: npm run build
working-directory: packages/chrome
- name: Package as ZIP
run: |
VERSION=${{ gitea.ref_name }}
ZIPFILE="$(pwd)/lexai-chrome-mv3-${VERSION}.zip"
ZIPFILE="$(cd ../.. && pwd)/lexai-chrome-mv3-${VERSION}.zip"
# Zip from inside the chrome-mv3 dir so manifest.json is at root of the archive
cd .output/chrome-mv3 && zip -r "$ZIPFILE" . && cd -
echo "ZIP_FILE=${ZIPFILE}" >> $GITHUB_ENV
working-directory: packages/chrome
- name: Create Release
run: |