Our goal is to upgrade the current AI chat‑driven coding environment into a first‑class, IDE‑calibre assistant that can understand, debug, refactor, and validate code with minimal human supervision. We will give the AI the same power‑tools senior engineers rely on—scoped context, live debugging, automated refactors, formatting, linting, type‑checking, and test‑running—wired together in a transactional pipeline that iterates until the suite is green.
- Reduce cognitive load for both user and model by providing only relevant, type‑rich context.
- Enable safe code changes via language‑server refactors instead of string edits.
- Close the feedback loop with runtime introspection (log‑points & debugger watch values).
- Guard quality by automatically formatting, linting, type‑checking and testing every AI patch.
- Accelerate delivery so that a failing test can be triaged and fixed in ≤ 2 AI iterations.
# | Capability | Purpose |
---|---|---|
1 | Test‑anchored tree‑shaking | Feed AI only the code executed by the failing unit‑test plus dependencies. |
2 | Inferred TS types | Insert /*: type */ comments from the TypeScript Language Server so the AI reasons with full type info. |
3 | Inline log‑points /*? */ |
AI drops markers → re‑runner replaces them with live values, producing self‑contained traces. |
4 | Debugger watch‑grid | Time‑travel replay exposes variable values at every executed line for AI queries. |
5 | Snapshot‑first assertions | If AI can’t infer an expected value it writes toMatchSnapshot() , then surfaces the snapshot for user edit. |
# | Command | Backing Tool | Wrapper Method |
---|---|---|---|
6 | Rename symbol | TS Language Server | RefactoringEngine.renameSymbol() |
7 | Dead‑code prune | knip | CodeCleaner.removeUnused() |
8 | Format code | prettier | Formatter.format() |
9 | Lint & autofix | eslint --fix | Linter.lint() |
10 | Strict type‑check | tsc |
TypeChecker.validate() |
11 | Run tests & coverage | jest / vitest | TestRunner.run() |
graph TD
A[AI proposes patch] --> B[Refactor / Rename]
B --> C[Formatter]
C --> D[ESLint autofix]
D --> E[Dead‑code prune]
E --> F[Formatter again]
F --> G[Type‑check]
G --> H[Test run + coverage]
H --> I{All green?}
I --yes--> Commit
I --no--> J[Send JSON errors back to AI] --> A
Any stage can abort & roll back, returning a structured error report for the AI’s next attempt.
┌────────────┐ ┌────────────────┐
│ Chat UI │←──►│ ContextBuilder │
└─────┬──────┘ └────┬───────────┘
│ enhanced ctx │
▼ ▼
┌────────────┐ ┌────────────────┐
│ AI LLM │ │ RecordingDbg │
└─────┬──────┘ └────────┬───────┘
│ patch / queries │ watch values / log‑expansions
▼ ▼
┌──────────────────────────────────────────────┐
│ Orchestrator Runner │
│ (rename → format → lint → knip → tsc → test)│
└──────────────────────────────────────────────┘
- Failing Test Discovered — CoverageAnalyzer builds a minimal context bundle.
- AI Analysis — Reads bundle, adds
/*? */
, queries debugger, proposes patch. - Pipeline Execution — Orchestrator applies patch and runs the full quality gate.
- Iterate or Commit — Structured errors loop back to AI; on green the patch is committed.
Metric | Target |
---|---|
Context size vs full project | ≤ 5 % |
Patches compiling on first try | ≥ 90 % |
Iterations to green tests | ≤ 2 |
Lines removed by knip / week | Track downward trend |
Snapshot edits per run | ≤ 2 |
Phase | Duration | Key Deliverables |
---|---|---|
Architectural Skeleton | 2 wks | ContextBuilder, Orchestrator stubs |
Type‑Aware Context | 3 wks | TS LS bridge, annotator prototype |
Tree‑Shaking & Coverage | 3 wks | Minimal bundle generator |
Replay Debugger & Log‑Points | 4 wks | Watch‑grid API, /*? */ expander |
Refactor & Quality Wrappers | 3 wks | Rename, knip, prettier, eslint, tsc wrappers |
Test Playground & Snapshots | 4 wks | Snapshot collaborator, visual test runner |
UI Integration | 3 wks | EnhancedWorkbench, CommandPalette |
Hardening & E2E Tests | 2 wks | Green CI, success‑metric dashboards |
- Coverage‑driven bundler on sample Jest test.
- Type comment annotator proof‑of‑concept.
-
/*? */
transform + re‑runner. - Orchestrator MVP with prettier & eslint only.
- Replay watch‑grid schema draft.
Once these spikes validate feasibility, we’ll lock scope, allocate resources, and begin phased delivery.
From autocomplete → autonomous dev: an AI that proposes, refactors, formats, type‑checks, tests, and commits — while you watch it work.