fecode-cli 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +380 -0
  2. package/dist/index.js +3 -3
  3. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,380 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/Abhijat05/FeCode/master/assets/fecode-banner.jpg" alt="FeCode" width="100%" style="border-radius: 8px;" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>A safety-first, plan-driven terminal coding assistant for developers.</strong>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/fecode-cli"><img src="https://img.shields.io/badge/npm-fecode--cli-red.svg" alt="npm package" /></a>
11
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E=20.0.0-brightgreen.svg" alt="Node.js version" /></a>
12
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License" /></a>
13
+ <img src="https://img.shields.io/badge/typescript-strict%205.7+-blue.svg" alt="TypeScript Strict" />
14
+ <img src="https://img.shields.io/badge/tests-988%20passed-success.svg" alt="Tests" />
15
+ <img src="https://img.shields.io/badge/version-1.0.0-brightgreen.svg" alt="Version 1.0.0" />
16
+ </p>
17
+
18
+ ---
19
+
20
+ ## Table of Contents
21
+
22
+ - [Overview](#overview)
23
+ - [Why FeCode](#why-fecode)
24
+ - [Key Features](#key-features)
25
+ - [Execution Safety Model](#execution-safety-model)
26
+ - [Installation](#installation)
27
+ - [Quick Start](#quick-start)
28
+ - [Configuration](#configuration)
29
+ - [Supported Providers](#supported-providers)
30
+ - [CLI & Slash Commands](#cli--slash-commands)
31
+ - [Keyboard Shortcuts](#keyboard-shortcuts)
32
+ - [Git Awareness & Workspace Tracking](#git-awareness--workspace-tracking)
33
+ - [Diagnostics & Durable History](#diagnostics--durable-history)
34
+ - [Monorepo & Development](#monorepo--development)
35
+ - [Contributing](#contributing)
36
+ - [Security Policy](#security-policy)
37
+ - [License](#license)
38
+
39
+ ---
40
+
41
+ ## Overview
42
+
43
+ **FeCode** is an interactive, terminal-native AI coding assistant built for developers who want the velocity of LLM-assisted programming without surrendering control of their workspace.
44
+
45
+ Unlike traditional AI assistants that execute commands or alter code in uncontrolled loops, FeCode enforces an explicit engineering lifecycle:
46
+
47
+ $$\text{Prompt} \longrightarrow \text{Plan} \longrightarrow \text{Risk Assessment} \longrightarrow \text{Approval Gate} \longrightarrow \text{Execution Handoff} \longrightarrow \text{Verification}$$
48
+
49
+ FeCode runs 100% in your terminal through an interactive [Ink](https://github.com/vadimdemedes/ink)/React interface. It inspects local projects, generates structured task plans, classifies risks, acquires explicit human consent for state modifications, and verifies that code compiles and tests pass before declaring a task complete.
50
+
51
+ ---
52
+
53
+ ## Why FeCode
54
+
55
+ Traditional terminal coding assistants operate on a direct execution model:
56
+
57
+ ```text
58
+ Traditional Assistant:
59
+ User prompt ──▶ Model emits shell command / file edit ──▶ Blind execution ──▶ Unintended workspace corruption
60
+ ```
61
+
62
+ FeCode treats code mutation as a protected operational boundary:
63
+
64
+ ```text
65
+ FeCode Safety Pipeline:
66
+ User prompt
67
+ │
68
+ ▼
69
+ Repository Inspection & Context Detection
70
+ │
71
+ ▼
72
+ Structured Task Plan (Inspectable, Step-by-Step)
73
+ │
74
+ ▼
75
+ Deterministic Risk Classification (NORMAL · ELEVATED · CRITICAL)
76
+ │
77
+ ▼
78
+ Interactive Human Approval Gate (Single-use, Non-transferable)
79
+ │
80
+ ▼
81
+ Rollback Checkpoint Creation (Git snapshot / File backup)
82
+ │
83
+ ▼
84
+ ExecutionHandoffManager (Authoritative Protected Boundary)
85
+ │
86
+ ▼
87
+ Verification Loop (Unit tests, typechecks, drift detection)
88
+ │
89
+ ▼
90
+ Deterministic Completion Summary
91
+ ```
92
+
93
+ ### Core Tenets
94
+
95
+ - **Plan First**: Every complex request is decomposed into an ordered, inspectable plan before execution begins.
96
+ - **Explicit Authorization**: No file modification, file deletion, or terminal command executes without explicit approval.
97
+ - **Single-Use Consents**: Permissions cannot be silently inherited or reused across steps, tasks, or resumed sessions.
98
+ - **No Destructive Retries**: Destructive operations are never blindly re-executed on failure.
99
+ - **Durable History**: Runs are persisted to disk with sanitized credentials, enabling post-mortem diagnostics and deterministic resumption.
100
+
101
+ ---
102
+
103
+ ## Key Features
104
+
105
+ | Capability | Description |
106
+ | :--- | :--- |
107
+ | **Inspectable Planning** | Translates ambiguous developer requests into explicit, ordered plan steps. |
108
+ | **Deterministic Risk Engine** | Classifies every action into `NORMAL`, `ELEVATED`, or `CRITICAL` risk tiers based on files and tools touched. |
109
+ | **Authoritative Handoff** | All protected tool executions route exclusively through the `ExecutionHandoffManager` boundary. |
110
+ | **Single-Use Checkpoints** | Captures pre-execution Git state snapshots to allow safe inspection and deterministic rollback. |
111
+ | **Verification Loops** | Validates code modifications with compiler checks and test commands before claiming completion. |
112
+ | **Bounded Recovery** | Detects execution failures and offers guided remediation without unbounded autonomous looping. |
113
+ | **Fresh-Auth Resume** | Resumes interrupted or failed tasks under a new lineage with strictly re-prompted authorization. |
114
+ | **Git Drift Tracking** | Compares baseline workspace state against modified files to detect external edits and prevent data loss. |
115
+ | **Interactive TUI** | Built with Ink and React, providing a responsive terminal UI with progress bars, modals, and split views. |
116
+ | **Multi-Provider Support** | First-class support for Google Gemini, OpenAI, and local Ollama models. |
117
+
118
+ ---
119
+
120
+ ## Execution Safety Model
121
+
122
+ FeCode’s safety guarantees are formal system invariants verified by continuous automated test suites:
123
+
124
+ 1. **Authoritative Execution Boundary**: Tools cannot bypass the `ExecutionHandoffManager`. There is no direct execution route from the LLM prompt to the host operating system.
125
+ 2. **Deterministic Risk Invariance**: Action risk is calculated prior to execution and cannot be downgraded by prompt injection or model suggestion.
126
+ 3. **Approval Isolation**: Approvals granted for step $N$ expire immediately upon completion and cannot satisfy step $N+1$.
127
+ 4. **Resumed Run Isolation**: A resumed session receives a brand-new run ID. Approvals from the original run are void.
128
+ 5. **Bounded Retry Limit**: Flaky or failing commands are limited by bounded retry policies; FeCode never enters an infinite loop.
129
+ 6. **Credential Sanitization**: Persisted run history, telemetry dumps, and error logs automatically strip API keys and authorization tokens.
130
+
131
+ ---
132
+
133
+ ## Installation
134
+
135
+ FeCode requires **Node.js `>= 20.0.0`** and **npm `>= 10.0.0`**.
136
+
137
+ ### Global Package Installation (Recommended)
138
+
139
+ ```bash
140
+ # Install globally via npm
141
+ npm install -g fecode-cli
142
+
143
+ # Verify installation
144
+ fe --version
145
+ fecode --version
146
+ ```
147
+
148
+ ### Install From Source
149
+
150
+ ```bash
151
+ # Clone the repository
152
+ git clone https://github.com/Abhijat05/FeCode.git
153
+ cd FeCode
154
+
155
+ # Install dependencies and compile all packages
156
+ npm install
157
+ npm run build
158
+
159
+ # Link CLI locally
160
+ npm link --workspace=apps/cli
161
+ ```
162
+
163
+ *For detailed platform instructions and environment requirements, see the [Installation Guide](docs/v1/installation.md).*
164
+
165
+ ---
166
+
167
+ ## Quick Start
168
+
169
+ ### 1. Configure Provider Credentials
170
+
171
+ Set your provider and credentials using environment variables or a `.env` file in your workspace:
172
+
173
+ ```bash
174
+ # Option 1: Google Gemini (Recommended Default)
175
+ export FE_PROVIDER="gemini"
176
+ export FE_MODEL="gemini-2.5-flash"
177
+ export GEMINI_API_KEY="your-gemini-api-key"
178
+
179
+ # Option 2: OpenAI
180
+ export FE_PROVIDER="openai"
181
+ export FE_MODEL="gpt-4o"
182
+ export OPENAI_API_KEY="your-openai-api-key"
183
+
184
+ # Option 3: Local Ollama (Completely Offline)
185
+ export FE_PROVIDER="ollama"
186
+ export FE_MODEL="qwen2.5-coder"
187
+ export OLLAMA_BASE_URL="http://localhost:11434/v1"
188
+ ```
189
+
190
+ ### 2. Launch FeCode
191
+
192
+ Navigate to any project repository and run `fe`:
193
+
194
+ ```bash
195
+ cd /path/to/your/project
196
+ fe
197
+ ```
198
+
199
+ ### 3. Issue Your First Task
200
+
201
+ ```text
202
+ > Inspect this project, explain its architecture, and run the test suite.
203
+ ```
204
+
205
+ FeCode will:
206
+ 1. Detect project framework and package structure (`Node.js`, `TypeScript`, `Git`).
207
+ 2. Generate an explicit 3-step task plan.
208
+ 3. Display the plan in the terminal and request approval for any command execution.
209
+ 4. Execute inspected steps and stream formatted output.
210
+ 5. Provide a verified completion summary with Git change attribution.
211
+
212
+ *Read the complete [Getting Started Guide](docs/v1/getting-started.md) for deeper workflow examples.*
213
+
214
+ ---
215
+
216
+ ## Configuration
217
+
218
+ FeCode supports layered configuration with deterministic precedence:
219
+
220
+ ```text
221
+ CLI Flags ──▶ Environment Variables ──▶ Workspace .env ──▶ Built-in Defaults
222
+ (Highest) (Lowest)
223
+ ```
224
+
225
+ ### Environment Variables
226
+
227
+ | Variable | Description | Default |
228
+ | :--- | :--- | :--- |
229
+ | `FE_PROVIDER` | LLM provider backend (`gemini`, `openai`, `ollama`) | `gemini` |
230
+ | `FE_MODEL` | Model name override | `gemini-2.5-flash` / `gpt-4o` / `qwen2.5-coder` |
231
+ | `GEMINI_API_KEY` | API key for Google Gemini provider | None (Required for Gemini) |
232
+ | `OPENAI_API_KEY` | API key for OpenAI provider | None (Required for OpenAI) |
233
+ | `OLLAMA_BASE_URL` | Base API endpoint for local Ollama daemon | `http://localhost:11434/v1` |
234
+
235
+ *Refer to [Configuration Documentation](docs/v1/configuration.md) for full configuration specs.*
236
+
237
+ ---
238
+
239
+ ## Supported Providers
240
+
241
+ FeCode abstracts model providers behind a unified streaming interface in `@fecode/models`:
242
+
243
+ | Provider | Recommended Models | Streaming | Function Calling | Local / Offline |
244
+ | :--- | :--- | :---: | :---: | :---: |
245
+ | **Google Gemini** | `gemini-2.5-flash`, `gemini-1.5-pro` | Yes | Yes | Cloud |
246
+ | **OpenAI** | `gpt-4o`, `gpt-4o-mini` | Yes | Yes | Cloud |
247
+ | **Ollama** | `qwen2.5-coder`, `deepseek-coder` | Yes | Yes | **Local (100% Offline)** |
248
+
249
+ ---
250
+
251
+ ## CLI & Slash Commands
252
+
253
+ ### Command Line Flags
254
+
255
+ ```bash
256
+ fe [options]
257
+ fecode [options]
258
+
259
+ Options:
260
+ -v, --version Display FeCode version
261
+ -h, --help Display help and command overview
262
+ -r, --resume <id> Resume an interrupted session or historical run by ID
263
+ ```
264
+
265
+ ### Interactive In-Terminal Slash Commands
266
+
267
+ Inside the active FeCode terminal session, type `/` to access built-in commands with autocomplete:
268
+
269
+ | Slash Command | Description |
270
+ | :--- | :--- |
271
+ | `/help` | Display list of commands and keyboard shortcuts |
272
+ | `/status` | View active session, selected model, and project context |
273
+ | `/plan [runId]` | Display active task plan or inspect the plan of a previous run |
274
+ | `/replan` | Request plan adaptation or re-evaluation for current task |
275
+ | `/resume <id>` | Prepare and resume execution from a historical run |
276
+ | `/runs [limit]` | List recent durable runs recorded for this workspace |
277
+ | `/run <id>` | Inspect detailed execution record of a specific run |
278
+ | `/debug` | Display real-time diagnostics summary for current run |
279
+ | `/diagnostics` | Display complete telemetry and diagnostic trace |
280
+ | `/history` | View completed tasks and outputs in the current session |
281
+ | `/git` | Inspect Git repository status, active branch, and modified files |
282
+ | `/checkpoints` | List available rollback checkpoints |
283
+ | `/checkpoint` | Create a new manual workspace checkpoint |
284
+ | `/recover` | Inspect or initiate rollback recovery |
285
+ | `/sessions` | List saved interactive CLI sessions |
286
+ | `/delete-session <id>` | Delete a saved session from storage |
287
+ | `/clear` | Clear terminal conversation scrollback |
288
+ | `/exit` | Persist current session state and exit FeCode |
289
+
290
+ *For complete usage documentation, see [CLI Usage](docs/v1/cli-usage.md).*
291
+
292
+ ---
293
+
294
+ ## Keyboard Shortcuts
295
+
296
+ | Keybinding | Action | Context |
297
+ | :--- | :--- | :--- |
298
+ | `Tab` | Autocomplete selected slash command | Command input |
299
+ | `↑` / `↓` | Navigate autocomplete suggestions | Command palette |
300
+ | `Ctrl + C` | Cancel current generation / Cancel pending approval / Exit | Universal |
301
+ | `Esc` | Return to main terminal view | Secondary views (Help, Runs, Diagnostics) |
302
+ | `y` / `Enter` | Submit approval decision (`yes`) | Approval prompt |
303
+ | `n` / `c` | Submit rejection decision (`no` / `cancel`) | Approval prompt |
304
+
305
+ ---
306
+
307
+ ## Git Awareness & Workspace Tracking
308
+
309
+ FeCode integrates with Git to protect against silent data loss:
310
+ - **Baseline Snapshots**: Captures repository commit hash, branch, and untracked file state before task execution starts.
311
+ - **Drift Detection**: Detects if files were modified externally while a plan was in progress.
312
+ - **Attribution & Diffing**: Segregates changes made by FeCode from pre-existing uncommitted user changes.
313
+ - **No Automatic Commits**: FeCode **never** executes `git commit` or `git push` automatically. You retain complete authority over your commit history.
314
+
315
+ ---
316
+
317
+ ## Diagnostics & Durable History
318
+
319
+ Every execution creates a durable, sanitized run record on disk:
320
+ - **Telemetry**: Records tool invocation latencies, token consumption, and model round-trips.
321
+ - **Sanitized Storage**: Credentials, environment variables, and private auth headers are stripped prior to serialization.
322
+ - **Audit Trails**: Inspect any run using `/run <id>` or view active performance via `/diagnostics`.
323
+
324
+ *Learn more in the [Diagnostics & Telemetry Guide](docs/v1/diagnostics.md).*
325
+
326
+ ---
327
+
328
+ ## Monorepo & Development
329
+
330
+ ### Repository Structure
331
+
332
+ ```text
333
+ fecode/
334
+ ├── apps/
335
+ │ └── cli/ # Ink / React interactive terminal app (@fecode/cli)
336
+ ├── packages/
337
+ │ ├── agent/ # Agent runtime, planning, checkpoints, recovery (@fecode/agent)
338
+ │ ├── models/ # Model providers (Gemini, OpenAI, Ollama) (@fecode/models)
339
+ │ └── shared/ # Common utilities, config loader, logger (@fecode/shared)
340
+ ├── docs/v1/ # Comprehensive technical documentation
341
+ └── assets/ # Project visual assets
342
+ ```
343
+
344
+ ### Development Commands
345
+
346
+ ```bash
347
+ # Build all packages
348
+ npm run build
349
+
350
+ # Start interactive CLI in development mode (tsx)
351
+ npm run dev
352
+
353
+ # Run strict TypeScript compiler checks
354
+ npm run typecheck
355
+
356
+ # Run ESLint across entire codebase
357
+ npm run lint
358
+
359
+ # Run full Vitest automated test suite
360
+ npm test
361
+ ```
362
+
363
+ ---
364
+
365
+ ## Contributing
366
+
367
+ We welcome contributions from the community! Please read our [Contributing Guide](CONTRIBUTING.md) for setup instructions, coding conventions, and pull request workflows.
368
+
369
+ ---
370
+
371
+ ## Security Policy
372
+
373
+ For vulnerability reporting guidelines and our security policy, please review [SECURITY.md](SECURITY.md).
374
+
375
+ ---
376
+
377
+ ## License
378
+
379
+ FeCode is open-source software licensed under the [MIT License](LICENSE).
380
+ Copyright (c) 2026 Abhijat Sinha.
package/dist/index.js CHANGED
@@ -1194,7 +1194,7 @@ function R(e, t = {}) {
1194
1194
  //#region ../../packages/agent/src/git/parser.ts
1195
1195
  function ve(e) {
1196
1196
  let t = null, n = null, r = null, i = [], a = !1, o = e.split(/\r?\n/);
1197
- for (let e of o) if (!(!e || !e.trim())) {
1197
+ for (let e of o) if (e && e.trim()) {
1198
1198
  if (e.startsWith("##")) {
1199
1199
  let i = e.slice(2).trim();
1200
1200
  if (i.includes("(no branch)") || i.startsWith("HEAD (no branch)")) t = "HEAD detached";
@@ -2628,7 +2628,7 @@ var W = class {
2628
2628
  });
2629
2629
  }
2630
2630
  recordCommand(e) {
2631
- !e || !e.command || this.commandsList.push({
2631
+ e && e.command && this.commandsList.push({
2632
2632
  command: e.command.trim(),
2633
2633
  exitCode: e.exitCode,
2634
2634
  timedOut: !!e.timedOut,
@@ -15090,7 +15090,7 @@ var Ir = ({ role: n, content: r, isStreaming: i = !1, error: a }) => {
15090
15090
  //#region src/index.tsx
15091
15091
  async function Hr() {
15092
15092
  let e, t, r, i, a = process.argv.slice(2);
15093
- (a.includes("--version") || a.includes("-v")) && (console.log("1.0.0"), process.exit(0)), (a.includes("--help") || a.includes("-h")) && (console.log("FeCode - Interactive Terminal Coding Assistant (v1.0.0)\n\nUsage:\n fe [options]\n fecode [options]\n\nOptions:\n -v, --version Display FeCode version\n -h, --help Display this help message\n -r, --resume <id> Resume a previous session or historical run by ID\n\nEnvironment Variables:\n FE_PROVIDER LLM provider ('gemini', 'openai', 'ollama') [default: gemini]\n FE_MODEL Model name [default: gemini-2.5-flash / gpt-4o / qwen2.5-coder]\n GEMINI_API_KEY API key for Google Gemini provider\n OPENAI_API_KEY API key for OpenAI provider\n OLLAMA_BASE_URL Base URL for Ollama provider [default: http://localhost:11434/v1]\n\nInteractive Commands (inside TUI):\n /help Show in-terminal command list\n /plan [id] Display active plan or details for a run\n /replan Trigger plan re-evaluation and adaptation\n /resume <id> Prepare resume for historical run\n /diagnostics [id] Show diagnostics and telemetry for active/specified run\n /runs [limit] List historical runs for current project\n /git Inspect Git workspace status and modified files\n /clear Clear conversation turns\n /exit Exit FeCode"), process.exit(0));
15093
+ (a.includes("--version") || a.includes("-v")) && (console.log("1.0.1"), process.exit(0)), (a.includes("--help") || a.includes("-h")) && (console.log("FeCode - Interactive Terminal Coding Assistant (v1.0.1)\n\nUsage:\n fe [options]\n fecode [options]\n\nOptions:\n -v, --version Display FeCode version\n -h, --help Display this help message\n -r, --resume <id> Resume a previous session or historical run by ID\n\nEnvironment Variables:\n FE_PROVIDER LLM provider ('gemini', 'openai', 'ollama') [default: gemini]\n FE_MODEL Model name [default: gemini-2.5-flash / gpt-4o / qwen2.5-coder]\n GEMINI_API_KEY API key for Google Gemini provider\n OPENAI_API_KEY API key for OpenAI provider\n OLLAMA_BASE_URL Base URL for Ollama provider [default: http://localhost:11434/v1]\n\nInteractive Commands (inside TUI):\n /help Show in-terminal command list\n /plan [id] Display active plan or details for a run\n /replan Trigger plan re-evaluation and adaptation\n /resume <id> Prepare resume for historical run\n /diagnostics [id] Show diagnostics and telemetry for active/specified run\n /runs [limit] List historical runs for current project\n /git Inspect Git workspace status and modified files\n /clear Clear conversation turns\n /exit Exit FeCode"), process.exit(0));
15094
15094
  let o = new Yn(), s = process.cwd(), c;
15095
15095
  for (let e = 0; e < a.length; e++) if ((a[e] === "--resume" || a[e] === "-r") && e + 1 < a.length) {
15096
15096
  c = a[e + 1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fecode-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "FeCode - Interactive Terminal Coding Assistant",
5
5
  "type": "module",
6
6
  "bin": {