Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8af3383
feat: add universal website cloner command, formatted html engine, an…
Mausam5055 Sep 12, 2026
7c56a05
feat: add /react, /diff, and /zip slash commands with React converter…
Mausam5055 Sep 12, 2026
e6e8058
feat: add Ink-powered React terminal UI for interactive cloning studio
Mausam5055 Sep 12, 2026
e6e6d8b
feat: add Design System Extractor and AI Design Skill Generator (/des…
Mausam5055 Sep 12, 2026
64cf432
feat: enhance design system extractor with comprehensive enterprise t…
Mausam5055 Sep 12, 2026
af7ae96
feat: serve refreshed light theme design system studio with live cach…
Mausam5055 Sep 12, 2026
a65a3ca
feat: automatically launch browser to design system preview on comple…
Mausam5055 Sep 12, 2026
2444193
feat: upgrade terminal UI with cyberpunk telemetry, animated block pr…
Mausam5055 Sep 12, 2026
a5c6508
feat: add real-time 6-channel technical activity stream and micro-ste…
Mausam5055 Sep 12, 2026
d710ac5
feat: anchor all clones and design system artifacts directly into pro…
Mausam5055 Sep 12, 2026
27fbdf0
feat: upgrade terminal interface to executive Unix aesthetic with cle…
Mausam5055 Sep 12, 2026
760562f
feat: replace broken ASCII blocks with clean universal UTF-8 header a…
Mausam5055 Sep 12, 2026
76f0d1b
feat: eliminate terminal resize ghosting and restore compact pixelate…
Mausam5055 Sep 12, 2026
c213c79
feat(cloner): add WCAG 2.1 accessibility audit, studio UI tabs, figma…
Mausam5055 Sep 12, 2026
af36ed9
fix(figma): format figma-tokens.json to standard W3C DTCG for Figma D…
Mausam5055 Sep 12, 2026
ca7d0f1
feat: add webcmd-extension, webcmd-main, and refund-commander integra…
Rachit-Tiwari-7 Sep 12, 2026
c65bd41
feat: organize repository into modular suite (cloner, browser-router,…
Rachit-Tiwari-7 Sep 12, 2026
74c854c
fix(react): upgrade react and @types/react to ^19.2.4 for Ink 7 useEf…
Rachit-Tiwari-7 Sep 12, 2026
9072dfe
fix(ppt): clean up deckFilePath CLI output
Rachit-Tiwari-7 Sep 12, 2026
2fbf2e9
chore: ignore dispute audit test files in .gitignore
Rachit-Tiwari-7 Sep 12, 2026
6153090
docs: add comprehensive technical DOCUMENTATION.md
Rachit-Tiwari-7 Sep 12, 2026
cf7b1d3
fix(ppt): guard CDPClient resolution for standalone headed mode
Rachit-Tiwari-7 Sep 12, 2026
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ dist/
*.tsbuildinfo
hosted-contract.json
plugin-command-manifest.json
.webcmd/
/.webcmd/
webcmd-browser-router/.webcmd/profiles/
webcmd-browser-router/.webcmd/decks/
webcmd-ppt/.webcmd/decks/
dispute-audit-*.json
.superpowers/
.worktrees/
.agents/*
Expand All @@ -23,6 +27,7 @@ docs/superpowers/
instagram-test/
llms.txt
sitemaps/
clones/

# Extensions & Secrets
*.pem
Expand Down
202 changes: 202 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
# Webcmd Suite — Comprehensive Technical Documentation 📖

> **Self-Learning Browser Infrastructure, Universal Website Cloner, Adaptive CDP Routing & Sub-Second AI Presentation Generation**

Webcmd is an enterprise-grade autonomous browser automation and replication suite designed to eliminate redundant LLM exploration, provide self-healing execution across changing web layouts, and deliver state-of-the-art developer tools for website cloning, design token extraction, and executive slide synthesis.

---

## 🏛️ System Architecture

```mermaid
graph TD
User([Developer / AI Agent]) --> CLI[Root CLI: @agentrhq/webcmd]

subgraph "Modular Packages"
CLI --> Cloner["webcmd-cloner<br/>(Ink React TUI Cloner)"]
CLI --> Router["webcmd-browser-router<br/>(Go + Node Adaptive Engine)"]
CLI --> PPT["webcmd-ppt<br/>(Groq AI Slide Synthesizer)"]
CLI --> Ext["webcmd-extension<br/>(Chrome MV3 Daemon Bridge)"]
end

subgraph "Core Capabilities"
Cloner --> ClonerOut["• React + Tailwind TSX<br/>• W3C / Figma Design Tokens<br/>• WCAG 2.1 Audits<br/>• Portable ZIP Bundles"]
Router --> RouterOut["• CDP Automation<br/>• Scrapling Self-Healing<br/>• Workflow Persistence<br/>• Negative Verification"]
PPT --> PPTOut["• Sub-500ms Groq Inference<br/>• Interactive HTML Slide Decks<br/>• Automated Canva Navigation"]
Ext --> ExtOut["• Visual DOM Overlay<br/>• Local REST Bridge (9799)<br/>• Session Injection"]
end
```

---

## 📦 Modular Packages & Components

### 1. `webcmd-cloner` 🌐
**Location:** [`webcmd-cloner/`](./webcmd-cloner) | **Command:** `npm run clone`

An interactive terminal application built with **React and Ink 7** for downloading, cloning, and decomposing live websites.

#### Key Features:
* **Interactive Ink TUI**: Cyberpunk-styled terminal interface with real-time spinners, animated step trackers, and interactive command loop.
* **Modular React Synthesis (`/react <url>`)**: Analyzes the cloned DOM and synthesizes modern React 19 + Tailwind components (`Navbar.tsx`, `Sections.tsx`, and `App.tsx`) with zero layout drift.
* **Design Token Extraction (`/design <url>`)**: Extracts 11-step color scales and W3C Design Token Community Group (DTCG) formats ready for the Figma Design Tokens Manager.
* **WCAG 2.1 Accessibility Audits (`/audit <url>`)**: Evaluates color contrast ratios and semantic HTML landmarks.
* **Instant Preview Server**: Automatically spins up a local HTTP server with live reloading and visual diff sliders.

#### Usage:
```bash
# Launch interactive TUI
npm run clone

# Clone directly with options
npx tsx webcmd-cloner/src/cli.ts https://example.com --output ./clones/example --serve
```

---

### 2. `webcmd-browser-router` ⚡
**Location:** [`webcmd-browser-router/`](./webcmd-browser-router) | **Command:** `npm run router`

The core self-learning execution and adaptive recovery engine.

#### Key Features:
* **Go Process Router**: High-throughput process pool written in Go (`main.go`) translating HTTP requests into sandboxed browser routines.
* **CDP Automation Engine**: Direct Chrome DevTools Protocol client with anti-bot evasion and persistent browser profiles.
* **Scrapling Adaptive Self-Healing**: When a website updates its class names or layout:
1. Primary selector failure triggers semantic DOM snapshot extraction.
2. Evaluates multi-dimensional topological similarity matrices (tag, attributes, text, hierarchy).
3. Relocates the matching element (typically with >90% confidence) and patches the stored workflow in `.webcmd/workflows/`.
* **Zero False-Positive Verification**: Rigorous assertion rules (`url_contains`, `url_not`, `element_visible`, `text_matches`) ensuring agents never falsely report success.

#### Usage:
```bash
# Run preflight diagnostics
npm run router doctor

# Run headless adaptive demonstration
npm run router demo

# Run with headed browser display
npm run router demo:headed
```

---

### 3. `webcmd-ppt` 📊
**Location:** [`webcmd-ppt/`](./webcmd-ppt) | **Command:** `npm run ppt "[Topic]"`

Sub-second AI executive presentation synthesizer.

#### Key Features:
* **Groq Ultra-Fast Inference**: Queries Groq's high-speed LPU infrastructure (500–800 tokens/sec) for sub-second slide outline compilation.
* **Deterministic Fallback**: If offline or no `GROQ_API_KEY` is provided, instantly switches to semantic fallback templates for 100% demo reliability.
* **Interactive HTML Deck Output**: Compiles self-contained dark-mode HTML presentations equipped with:
* Fullscreen mode (`F`)
* Keyboard navigation (`Left/Right Arrow`, `Space`, `Backspace`)
* Slide progress indicator
* Visual stat counters and architecture grids
* **Canva Automation**: Automated CDP navigation to open Canva templates and populate generated slides.

#### Usage:
```bash
# Generate presentation
npm run ppt "Autonomous Browser Infrastructure"

# Launch visible browser for Canva editing
npm run ppt "Q3 Engineering Roadmap" --headed
```

---

### 4. `webcmd-extension` 🧩
**Location:** [`webcmd-extension/`](./webcmd-extension)

Chrome Manifest V3 browser extension bridging live user sessions to Webcmd automation.

#### Key Features:
* **Local Daemon Bridge**: Communicates with the local background server over `http://127.0.0.1:9799`.
* **Visual Overlay**: Real-time bounding-box element inspection and feedback banner directly injected into the active webpage.
* **One-Click Workflow Run**: Trigger learned workflows and monitor self-healing status from the Chrome toolbar.

#### Installation:
1. Navigate to `chrome://extensions` in Google Chrome.
2. Enable **Developer mode** in the top-right corner.
3. Click **Load unpacked** and select the [`webcmd-extension`](./webcmd-extension) folder.

---

### 5. Refund-Commander & Ego-Lite Engine 🛡️
**Location:** [`src/refund-commander/`](./src/refund-commander)

Enterprise dispute resolution and refund engine demonstrating multi-tiered autonomous agent reliability:

* **Tier 1 (Deterministic Fast-Path)**: Native Webcmd adapter execution (< 50ms latency, 98.2% token reduction).
* **Tier 2 (Ego-Lite Fallback)**: Isolated browser task space resolving unexpected DOM shifts and capturing semantic snapshots.
* **Tier 3 (Auto-Healing & Sync)**: Programmatic sitemap memory synchronization patching the site profile for future runs.

---

## 🛠️ Installation & Setup

### Prerequisites
* **Node.js**: `v20.6.0` or higher
* **npm**: `v10.0.0` or higher
* **Google Chrome / Chromium**: Installed locally

### Setup Steps
```bash
# 1. Clone repository
git clone https://github.com/Rachit-Tiwari-7/webcmd.git
cd webcmd

# 2. Install all dependencies
npm install

# 3. Compile TypeScript bundle and CLI manifests
npm run build

# 4. Verify system readiness
npm run router doctor
```

---

## 🧪 Testing & Verification

The suite is backed by comprehensive automated test coverage:

```bash
# Run complete Vitest suite (1,400+ unit tests)
npm test

# Run strict TypeScript typecheck
npm run typecheck

# Run Webcmd Browser Router tests
cd webcmd-browser-router
node tests/test-adaptive.js
node tests/test-verifier.js
node tests/test-negative-verification.js
node tests/test-workflow.js
node tests/test-full-lifecycle.js
```

---

## 📋 Central Scripts Reference

| Command | Action |
| :--- | :--- |
| `npm run clone` | Launch the interactive Ink React TUI website cloner |
| `npm run ppt "[topic]"` | Synthesize an AI executive presentation deck |
| `npm run router doctor` | Check Chromium, profiles, and anti-bot stealth diagnostics |
| `npm run router demo` | Run the adaptive self-healing browser simulation |
| `npm run typecheck` | Validate TypeScript types without emitting code |
| `npm run build` | Clean `dist/`, copy assets, build TypeScript, and compile manifests |
| `npm test` | Run unit tests across all surfaces |

---

## 📄 License

Apache License 2.0. See [LICENSE](./LICENSE) for details.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

**Self-learning browser infra for AI agents.**

[![Documentation](https://img.shields.io/badge/Full%20Documentation-DOCUMENTATION.md-brightgreen.svg?style=for-the-badge)](./DOCUMENTATION.md)

Webcmd learns the navigational context of websites as agents use them, then
turns that knowledge into local memory for faster, cheaper, more reliable
browser automation. The goal is simple: stop making agents rediscover the same
Expand All @@ -35,6 +37,15 @@ Webcmd pairs live browser control with a self-learning memory layer:
| 0. Live browser control | The site is unfamiliar. | Use `webcmd browser` to inspect, click, type, extract, capture network calls, and complete the task in a real browser. |
| 1. Sitemap memory | The site is familiar, but the action space is not fully known. | Capture an agent-facing sitemap of observed pages, states, actions, workflows, APIs, pitfalls, and fallback paths. |

## 📦 Modular Ecosystem & Packages

| Package | Purpose | Entry Command |
| :--- | :--- | :--- |
| [**`webcmd-cloner`**](./webcmd-cloner) | Universal Website Cloner with interactive **Ink React TUI**, React TSX component decomposition, and Figma W3C tokens | `npm run clone` |
| [**`webcmd-browser-router`**](./webcmd-browser-router) | Go + Node CDP routing engine, adaptive self-healing recovery, and persistent workflow store | `npm run router` |
| [**`webcmd-ppt`**](./webcmd-ppt) | Sub-second AI executive presentation synthesizer powered by Groq ultra-fast inference | `npm run ppt` |
| [**`webcmd-extension`**](./webcmd-extension) | Chrome MV3 browser extension for live visual overlays, inspector, and daemon bridge | Chrome Extension |

## Demo

https://github.com/user-attachments/assets/bdb65307-9e2a-4d58-9175-45d59528ae37
Expand Down
21 changes: 21 additions & 0 deletions bin/webcmd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env node
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const distMain = path.resolve(__dirname, '../dist/src/main.js');

if (fs.existsSync(distMain)) {
await import(pathToFileURL(distMain).href);
} else {
const { spawn } = await import('node:child_process');
const isWin = process.platform === 'win32';
const tsxBin = path.resolve(__dirname, '../node_modules/.bin', isWin ? 'tsx.cmd' : 'tsx');
const srcMain = path.resolve(__dirname, '../src/main.ts');
const child = spawn(tsxBin, [srcMain, ...process.argv.slice(2)], {
stdio: 'inherit',
shell: isWin
});
child.on('exit', (code) => process.exit(code ?? 0));
}
Loading