chat2diff 0.0.0-stage → 1.3.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to **Chat2Diff** are documented in this file.
4
+
5
+ ## [1.3.1] - 2026-11-25
6
+
7
+ ### Added
8
+ * **Opt-In `.gitignore` Support:** Added a **Show .gitignore** toggle (off by default) in the **Project Files** panel so AI agents can access gitignored files and folders (e.g. local docs, plans, or notes) with amber `ignored` badges, while keeping `node_modules`, `.git`, `.chat2diff`, build outputs, secrets (`.env`/keys), and binaries excluded.
9
+
10
+ ## [1.3.0] - 2026-11-24
11
+
12
+ ### Added
13
+ * **2-Mode Local Workbench (`npx chat2diff`):** Collapsible split-screen **Prepare & Send** view paired with **Review & Apply**.
14
+ * **Grounded Multi-Turn Follow-Up Sync:** **New Chat** vs **Same Chat (Follow-Up)** modes with persistent SHA-256 file hash tracking and automatic sync reports (`applied`, `partial`, `skipped`, `failed`, `undone`).
15
+ * **Zero-Bloat File Attachment & Native Clipboard:** Overwrites a single temporary cache file in `~/.chat2diff/cache/` and places the native file object on the OS clipboard (Windows, macOS, Linux) with both **1-Paste Magic** and **Separate File + Prompt** modes.
16
+ * **Hardened Multi-Format Patch Engine:** 4-backtick fenced Search/Replace parser and Unified Git Diff engine with multi-tier self-healing, explicit malformed-block reporting, smart path resolution, and automatic on-disk source attachment in **Copy Fix Prompt**.
17
+ * **IDE-Style Diff Reviewer:** Side-by-side and unified views with word-level highlighting, line wrapping, collapsible unchanged gaps, per-hunk apply, single-file apply, and 1-click Undo snapshots.
18
+ * **Local Security & CLI Polish:** `127.0.0.1` Host validation, constant-time per-session token auth, root-jail path guard, secret redaction, `--help`/`--version` CLI flags, Vitest suite, and cross-OS GitHub Actions CI.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Devansh Sharma (RootDeveloperDS)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,3 +1,90 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # Chat2Diff
2
+
3
+ **Turn any AI chatbot (ChatGPT, Gemini, Claude, DeepSeek, Grok, or local Web UIs) into a safe, visual, multi-file coding workbench on your machine.**
4
+
5
+ No API keys. No IDE agent quotas. No browser scraping or ToS ban risks. Works on **Windows, macOS, and Linux** across any language or framework (TypeScript, Python, Rust, Go, Java, HTML, Markdown, and more).
6
+
7
+ ---
8
+
9
+ ## Quick Start
10
+
11
+ Requires **Node.js 20.11+**. Run inside any project folder (Git or non-Git):
12
+
13
+ ```bash
14
+ npx chat2diff
15
+ ```
16
+
17
+ Or target a specific folder directly:
18
+
19
+ ```bash
20
+ npx chat2diff ./path/to/your-project
21
+ ```
22
+
23
+ Chat2Diff starts a local server on `127.0.0.1` with a random per-session token and opens the visual workbench in your browser.
24
+
25
+ ---
26
+
27
+ ## How It Works (2-Mode Workflow)
28
+
29
+ ### 1. Prepare & Send
30
+ * **Pick only what matters:** Select your full project, check 2–3 specific folders, or click **Changed** to select uncommitted Git files. `.gitignore` rules, binaries, lockfiles, and `.env` / private key files are excluded automatically.
31
+ * **Describe your task in plain English:** Pick a preset (**Fix a Bug**, **Add a Feature**, **Improve Code**, **Review Only**), optionally paste compiler or runtime logs, and choose **Search & Replace** (default) or **Unified Git Diff**.
32
+ * **Zero Downloads bloat:** Paste text directly for small selections, or use **Attach as File** — Chat2Diff overwrites a single temporary cache file and copies the native file object to your clipboard so pressing `Ctrl+V` in Gemini, ChatGPT, or Claude attaches it immediately without cluttering your `Downloads` folder.
33
+ * **1-Paste Magic:** Packages task instructions + code inside one file (`Ctrl+V` → type `go`).
34
+ * **Separate File + Prompt:** Step 1 copies the code file, Step 2 copies your readable prompt.
35
+ * **Grounded Multi-Turn Follow-Ups:** Switch to **Same Chat (Follow-Up)** on Turn 2+ to report exact applied, partial, skipped, failed, and undone files to the AI without re-uploading unchanged files every turn.
36
+
37
+ ### 2. Review & Apply
38
+ * **Automatic Clipboard Detection & Paste-Anywhere:** Copy the AI's reply (or press `Ctrl+V` anywhere in the app) to open the visual diff viewer immediately.
39
+ * **Self-Healing Patch Engine:** Handles 4-backtick Search/Replace blocks, Unified Git Diffs, indentation drift, CRLF/LF preservation, and smart path resolution. If any file still fails, **Copy Fix Prompt** automatically attaches that file's exact current on-disk source for one-shot recovery.
40
+ * **Granular Control:** Inspect changes **Side-by-Side** or **Unified** with word-level highlighting and line wrapping. Apply a single change block (hunk), one file at a time, or a checked batch without losing your place.
41
+ * **1-Click Undo History:** Every apply saves a local pre-apply backup snapshot (`.git/chat2diff/snapshots/` or `.chat2diff/snapshots/`). Revert any batch byte-for-byte in one click.
42
+
43
+ ---
44
+
45
+ ## CLI Options
46
+
47
+ ```text
48
+ Usage: npx chat2diff [directory] [options]
49
+
50
+ Options:
51
+ -p, --port <num> Localhost port to bind (default: 4310, auto-increments if busy)
52
+ --no-open Start server without auto-opening your browser
53
+ --no-watch Start with automatic clipboard listener paused
54
+ -v, --version Print Chat2Diff version
55
+ -h, --help Show help message
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Privacy & Local Security
61
+
62
+ * **100% Local-First:** Zero telemetry, zero cloud accounts, zero outbound API calls.
63
+ * **Hardened Local Server:** Binds strictly to `127.0.0.1`, validates the `Host` header against DNS rebinding, and enforces a random per-launch `X-Chat2Diff-Token` via constant-time comparison on all API and WebSocket routes.
64
+ * **Root-Jail Path Guard:** Hard-blocks `../` traversal, absolute paths, escaping symlinks, and `.git/` writes.
65
+ * **Secret Protection:** Automatically excludes `.env*` and private keys from file scanning, and detects/redacts common API keys before copying to external AI chats.
66
+
67
+ See [SECURITY.md](./SECURITY.md) for full details.
68
+
69
+ ---
70
+
71
+ ## Local Development
72
+
73
+ ```bash
74
+ git clone https://github.com/RootDeveloperDS/Chat2Diff.git
75
+ cd Chat2Diff
76
+ npm install
77
+ npm run dev
78
+ ```
79
+
80
+ Open `http://localhost:5173`. Run the full quality gate anytime:
81
+
82
+ ```bash
83
+ npm run check
84
+ ```
85
+
86
+ ---
87
+
88
+ ## License
89
+
90
+ [MIT](./LICENSE) — Created by [Devansh Sharma (RootDeveloperDS)](https://github.com/RootDeveloperDS).
package/SECURITY.md ADDED
@@ -0,0 +1,24 @@
1
+ # Security Policy
2
+
3
+ Chat2Diff runs locally on your machine with filesystem read/write access inside your chosen project directory. Security is enforced across four layers:
4
+
5
+ ## 1. Localhost Network Isolation
6
+ * The HTTP and WebSocket server binds exclusively to **`127.0.0.1`** (never `0.0.0.0`).
7
+ * Every request validates the `Host` header against `localhost` / `127.0.0.1` to prevent DNS-rebinding attacks.
8
+ * Every `/api/*` request and `/ws` connection requires a random 192-bit per-launch session token (`X-Chat2Diff-Token`) verified using `crypto.timingSafeEqual`.
9
+ * The browser extracts `#token=...` into `sessionStorage` on boot and immediately removes it from the address bar via `history.replaceState`.
10
+
11
+ ## 2. Filesystem Root-Jail (`src/server/core/pathGuard.ts`)
12
+ * Every read, preview, write, delete, and undo operation passes through `resolveSafeRepoPath`.
13
+ * Hard-blocks empty paths, absolute POSIX/Windows paths, `..` traversal segments, `.git/` and `.chat2diff/` internal directories, and symlinks resolving outside the active repository root.
14
+
15
+ ## 3. Secret Protection & Sensitive File Warnings
16
+ * `.env*` (except `.env.example`, `.env.sample`, `.env.template`), private key files (`.pem`, `.key`, `id_rsa`, `id_ed25519`), and service account files are hidden during scanning.
17
+ * `secretGuard.ts` scans selected source files for common API tokens (OpenAI, Google, GitHub, AWS, Groq, Slack, PEM private keys) and masks them by default before copying or exporting.
18
+ * Incoming AI patches touching `.env`, `.github/workflows`, `package.json`, `Dockerfile`, or credential files display an explicit warning banner before apply.
19
+
20
+ ## 4. Zero External Automation or Telemetry
21
+ * Chat2Diff makes zero outbound network requests, collects zero analytics, and never scrapes or automates third-party AI web sessions.
22
+
23
+ ## Reporting a Vulnerability
24
+ Please open a private security advisory on GitHub at [https://github.com/RootDeveloperDS/Chat2Diff/security/advisories](https://github.com/RootDeveloperDS/Chat2Diff/security/advisories) or report responsibly via the repository maintainer.