anvil-engineering-workbench 1.0.6 → 1.0.8

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 (38) hide show
  1. package/CHANGELOG.md +47 -2
  2. package/README.md +41 -35
  3. package/SECURITY.md +54 -10
  4. package/dist/ai/claude-code-provider.js +4 -3
  5. package/dist/ai/claude-code-provider.js.map +1 -1
  6. package/dist/ai/provider.js +7 -6
  7. package/dist/ai/provider.js.map +1 -1
  8. package/dist/cli.js +273 -59
  9. package/dist/cli.js.map +1 -1
  10. package/dist/core/adr-engine.d.ts +30 -0
  11. package/dist/core/adr-engine.js +163 -0
  12. package/dist/core/adr-engine.js.map +1 -0
  13. package/dist/core/code-review.js +6 -6
  14. package/dist/core/container-sandbox.js +1 -1
  15. package/dist/core/container-sandbox.js.map +1 -1
  16. package/dist/core/dashboard-server.js +222 -14
  17. package/dist/core/dashboard-server.js.map +1 -1
  18. package/dist/core/env-compat.d.ts +11 -0
  19. package/dist/core/env-compat.js +32 -0
  20. package/dist/core/env-compat.js.map +1 -0
  21. package/dist/core/hosted-agent-provider.js +11 -6
  22. package/dist/core/hosted-agent-provider.js.map +1 -1
  23. package/dist/core/project-cleaner.d.ts +7 -0
  24. package/dist/core/project-cleaner.js +258 -19
  25. package/dist/core/project-cleaner.js.map +1 -1
  26. package/dist/core/provider-diagnostics.js +3 -3
  27. package/dist/core/provider-diagnostics.js.map +1 -1
  28. package/dist/core/sarif-formatter.d.ts +12 -0
  29. package/dist/core/sarif-formatter.js +121 -0
  30. package/dist/core/sarif-formatter.js.map +1 -0
  31. package/dist/core/security-scanner.d.ts +37 -0
  32. package/dist/core/security-scanner.js +325 -0
  33. package/dist/core/security-scanner.js.map +1 -0
  34. package/dist/core/verification.js +2 -1
  35. package/dist/core/verification.js.map +1 -1
  36. package/dist/mcp/server.js +52 -32
  37. package/dist/mcp/server.js.map +1 -1
  38. package/package.json +9 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # ANVIL Changelog
2
2
 
3
+ ## 1.0.8 — Adoption Readiness: CI Gate, OASIS SARIF v2.1.0, String-Safe Cleaner & FORGE Deprecation
4
+
5
+ ANVIL 1.0.8 focuses on enterprise company-adoption readiness, addressing third-party audit findings across supply-chain security, automated CI/CD gating, string-safe code cleanup, and complete transition away from legacy FORGE prefixes.
6
+
7
+ ### Features & Capabilities
8
+ - **CI Gate & Policy-as-Code (`anvil gate` & GitHub Action):**
9
+ - Added native `anvil gate [path] [--sarif PATH] [--policy PATH] [--fail-on-warnings] [--json]` CI verification mode with standard Unix exit codes (exit `0` on clean verification, exit `1` on blocking/high-severity findings).
10
+ - Built-in OASIS SARIF v2.1.0 report generator (`--sarif results.sarif`) for direct integration with GitHub Advanced Security code scanning tabs.
11
+ - Policy-as-code enforcement via `docs/anvil-policy.schema.json` and `.anvil/policy.json` (max critical secrets: 0, max high findings, required check passes).
12
+ - Updated `action.yml` to default to `operation: gate` with `sarif-file` output and pinned commit SHAs.
13
+ - **String-Safe Code Cleaner:**
14
+ - Enhanced cleaner algorithm (`src/core/project-cleaner.ts`) with multiline string awareness (`getProtectedMultilineLines`).
15
+ - Protects JavaScript / TypeScript template literals (`` `...` ``), Python triple quotes (`"""..."""` / `'''...'''`), and Go backticks from accidental whitespace stripping or blank-line collapsing.
16
+ - **Finished FORGE Renaming & Deprecation:**
17
+ - Modernized environment variable resolution prioritizing `ANVIL_*` prefixes with graceful backward-compatible fallback to `FORGE_*` (logging one-time deprecation warnings).
18
+ - Registered dual MCP tools (`anvil_*` as canonical, with `forge_*` alias) ensuring backward compatibility for existing MCP client configurations.
19
+ - **Supply-Chain & Security Policy Hardening:**
20
+ - Pinned all GitHub Actions in CI/CD workflows (`ci.yml`, `release.yml`, `codeql.yml`, `pages.yml`) to immutable full 40-character commit SHAs.
21
+ - Loosened CI security audit gate to `npm audit --audit-level=high --omit=dev` to prevent transient dev-dependency advisories from blocking production builds.
22
+ - Added `lint`, `format:check`, and `test:coverage` scripts and contributor metadata to `package.json`.
23
+ - Updated `SECURITY.md` with realistic solo maintainer SLAs (48–72h initial response) and explicitly documented GitHub Private Vulnerability Reporting enablement.
24
+ - Clarified architectural provenance in `README.md` affirming 100% original, clean-room MIT-licensed code.
25
+
26
+ ## 1.0.7 — Architecture Decision Records (ADR), Deep Security Scanner & Live Workflow DAG Runner
27
+
28
+ ANVIL 1.0.7 introduces an integrated Architecture Decision Records (ADR) engine following the MADR standard, a comprehensive repository security and secret scanner with automated `.gitignore` auto-fix, and a real-time interactive multi-agent workflow DAG runner in the web dashboard.
29
+
30
+ ### Features & Capabilities
31
+ - **Architecture Decision Records Engine (`anvil adr` & Web Dashboard):**
32
+ - MADR (Markdown Architectural Decision Records) 3.0 standard directory structure initialized via `anvil adr init` under `docs/adr/`.
33
+ - Create structured decision records with status (`proposed`, `accepted`, `rejected`, `superseded`, `deprecated`), context, consequences, and alternatives via `anvil adr new "Title"`.
34
+ - Automated project memory synchronization via `anvil adr sync` (`POST /api/adrs/sync`), converting ephemeral decisions in `.anvil/memory.json` into permanent, version-controlled markdown ADRs.
35
+ - Interactive visual ADR viewer and creator in the web dashboard under Architecture & Graph.
36
+ - **Deep Security & Secret Scanner (`anvil security` & Web Dashboard):**
37
+ - High-entropy regex and format scanning for exposed API keys: OpenAI (`sk-...`), Anthropic (`sk-ant-...`), GitHub (`ghp_...`, `gho_...`, `github_pat_...`), AWS access keys (`AKIA...`), Google API keys (`AIza...`), Slack tokens (`xoxb-...`), and private keys (`BEGIN RSA/OPENSSH PRIVATE KEY`).
38
+ - Detection of dangerous shell practices (unvetted `curl ... | bash` in scripts) and unencrypted HTTP package dependencies.
39
+ - Detection of exposed, unignored sensitive files (`.env`, `.pem`, `.key`, `.pfx`, `.p12`).
40
+ - Automated one-click remediation with `--fix` (`POST /api/security/fix`), updating `.gitignore` to safely quarantine exposed files and credentials.
41
+ - Interactive Security Audit card in the dashboard's Self-Healing & Security tab with real-time status and "Auto-Fix via .gitignore" action.
42
+ - **Interactive Live DAG Workflow Runner:**
43
+ - One-click live execution (`POST /api/workflows/:id/execute`) directly from the dashboard visual canvas and saved workflow cards.
44
+ - Real-time Server-Sent Events (SSE) telemetry broadcast: `workflow_started`, `workflow_task_settled`, and `workflow_completed`.
45
+ - Realistic multi-agent task execution simulation powered by `advanceRun` and `DemoAgentProvider`.
46
+ - **Interactive Landing Page Enhancements:** Added terminal tabs (`09 adr`, `10 security`) and updated live npm badges to v1.0.7.
47
+
3
48
  ## 1.0.6 — AI Harness MCP Wizard & Dashboard Project Memory Hub
4
49
 
5
50
  ANVIL 1.0.6 introduces automated AI harness integration for modern editors (Cursor, Claude Code, Windsurf, VS Code), a dedicated Project Memory & Architectural Decisions hub, and native dual-path memory retention.
@@ -38,9 +83,9 @@ ANVIL 1.0.4 introduces production-grade safety nets and developer velocity super
38
83
  - **Framework-Aware Entry Point Manifests:** Solves false-positive orphan file detection across modern full-stack frameworks including Next.js, Remix, Nuxt, SvelteKit, FastAPI, Django, Celery, and Go/Rust CLI binaries. Convention-based routes (`page.tsx`, `layout.tsx`, `route.ts`, `urls.py`, `conftest.py`, `build.rs`, `cmd/**/main.go`) are automatically recognized as entrypoints.
39
84
  - **Automated Git Pre-commit Hook (`anvil hook install`):** Generates and installs a lightweight `.git/hooks/pre-commit` hook that intercepts commits and prevents OS junk, partial downloads, and syntax errors from entering Git staging.
40
85
 
41
- ## 1.0.3 — Multi-Language Architecture Mapping, Farzi Cleaner & Self-Healing Wizard
86
+ ## 1.0.3 — Multi-Language Architecture Mapping, Workspace Cleaner & Self-Healing Wizard
42
87
 
43
- ANVIL 1.0.3 introduces comprehensive multi-language architecture mapping (Python, Go, Rust, Java, C/C++), an automated junk/farzi-file scrubber (`anvil clean`), automated code repair (`anvil fix`), and a one-command environment doctor auto-fix wizard (`anvil doctor --fix`).
88
+ ANVIL 1.0.3 introduces comprehensive multi-language architecture mapping (Python, Go, Rust, Java, C/C++), an automated junk/clutter-file scrubber (`anvil clean`), automated code repair (`anvil fix`), and a one-command environment doctor auto-fix wizard (`anvil doctor --fix`).
44
89
 
45
90
  ### Features & Capabilities
46
91
  - **Multi-Language Architecture Mapping (`anvil map`):** Expanded from JS/TS to Python (with relative package imports), Go, Rust (`mod` resolution), Java/Kotlin, and C/C++ (`#include`). Internal import resolution accurately maps hundreds of module relationships across mixed-language repositories with 0 false-positive circular loops.
package/README.md CHANGED
@@ -32,19 +32,6 @@
32
32
  <img src="https://img.shields.io/badge/Architecture-Local--first-0f766e?logo=shield&logoColor=white" alt="Local-first architecture" />
33
33
  </p>
34
34
 
35
- <p align="center">
36
- <a href="https://www.star-history.com/anvil-workbench/ANVIL">
37
- <img src="https://img.shields.io/badge/GitHub%20Trending-Not%20ranked%20yet-64748b?style=for-the-badge&logo=github&logoColor=white" alt="GitHub Trending — not ranked yet" />
38
- </a>
39
- <a href="https://www.star-history.com/anvil-workbench/ANVIL">
40
- <img src="https://img.shields.io/badge/Star%20History%20Global%20Rank-Pending-64748b?style=for-the-badge&logo=starship&logoColor=white" alt="Star History global rank — pending" />
41
- </a>
42
- </p>
43
-
44
- <p align="center">
45
- <sub>These are live-status placeholders until Star History publishes a trending record and global rank for ANVIL. They will be replaced with Star History's live badge images once those records are available.</sub>
46
- </p>
47
-
48
35
  <p align="center">
49
36
  <strong>Built and maintained by <a href="https://github.com/AdityaaaTiwari">Aditya Tiwari</a></strong>
50
37
  </p>
@@ -62,7 +49,7 @@
62
49
  ---
63
50
 
64
51
  > [!NOTE]
65
- > **ANVIL v1.0.6 — AI harness foundation.** The local CLI, local dashboard, agent orchestration, MCP server, provider adapters, GitHub Action, automated self-healing cleaner, byte-accurate rollback (`anvil undo`), pre-commit hooks (`anvil hook install`), AI harness wizard (`anvil mcp setup`), and GitHub App installation/authentication foundation are available. See [Current capabilities and boundaries](#current-capabilities-and-boundaries).
52
+ > **ANVIL v1.0.7 — AI harness foundation.** The local CLI, local dashboard, agent orchestration, MCP server, provider adapters, GitHub Action, automated self-healing cleaner, byte-accurate rollback (`anvil undo`), pre-commit hooks (`anvil hook install`), AI harness wizard (`anvil mcp setup`), Architecture Decision Records (`anvil adr`), Security & Secret Scanner (`anvil security --fix`), and live interactive workflow DAG runner are available. See [Current capabilities and boundaries](#current-capabilities-and-boundaries).
66
53
 
67
54
  ## What is ANVIL?
68
55
 
@@ -117,7 +104,7 @@ npm install --global anvil-engineering-workbench
117
104
  Or install directly from the GitHub repository:
118
105
 
119
106
  ```bash
120
- npm install --global git+https://github.com/anvil-workbench/ANVIL.git#v1.0.6
107
+ npm install --global git+https://github.com/anvil-workbench/ANVIL.git#v1.0.7
121
108
  ```
122
109
 
123
110
  Verify the installation:
@@ -134,19 +121,24 @@ Open a terminal in the repository you want to work on:
134
121
  ```bash
135
122
  cd /path/to/your-project
136
123
 
137
- # Initialize or auto-scaffold workspace configuration
138
- anvil doctor --fix
124
+ # 1. Run environment and project health diagnostics
125
+ anvil doctor
139
126
 
140
- # Clean temporary farzi files, caches, and auto-fix code issues
141
- anvil clean . --apply --fix
142
-
143
- # Inspect the project
127
+ # 2. Inspect project architecture, tooling, and dependencies
144
128
  anvil inspect .
145
129
 
146
- # Start the local dashboard
130
+ # 3. Preview workspace clutter and unused imports (safe dry run)
131
+ anvil clean .
132
+
133
+ # 4. Start the local engineering dashboard
147
134
  anvil dashboard .
148
135
  ```
149
136
 
137
+ To execute cleanup and code auto-repair with automatic byte-accurate snapshot backup:
138
+ ```bash
139
+ anvil clean . --apply --fix
140
+ ```
141
+
150
142
  ANVIL prints the dashboard's local URL. Open that address in your browser.
151
143
 
152
144
  ### Windows PowerShell
@@ -158,15 +150,15 @@ npm --version
158
150
  git --version
159
151
 
160
152
  # Install ANVIL
161
- npm install --global git+https://github.com/anvil-workbench/ANVIL.git#v1.0.6
153
+ npm install --global git+https://github.com/anvil-workbench/ANVIL.git#v1.0.7
162
154
 
163
155
  # Move into your project
164
156
  cd C:\Users\YourName\Projects\my-project
165
157
 
166
- # Initialize, clean, inspect and launch
167
- anvil doctor --fix
168
- anvil clean . --apply --fix
158
+ # Run diagnostics, inspect, preview clean, and launch dashboard
159
+ anvil doctor
169
160
  anvil inspect .
161
+ anvil clean .
170
162
  anvil dashboard .
171
163
  ```
172
164
 
@@ -335,7 +327,7 @@ Run `anvil --help` for the complete command list and `anvil <command> --help` fo
335
327
  | Command | Purpose |
336
328
  |---|---|
337
329
  | `anvil init [path]` | Create a local `.ANVIL` starter workspace |
338
- | `anvil clean [path]` | Scan & scrub farzi files, logs, temp downloads; add `--apply` to delete, `--fix` to repair code, `--verify` to run test gate |
330
+ | `anvil clean [path]` | Scan & scrub junk files, logs, temp downloads; add `--apply` to delete, `--fix` to repair code, `--verify` to run test gate |
339
331
  | `anvil fix [path]` | Auto-repair code: prune unused imports, normalize whitespace and blank lines; add `--verify` |
340
332
  | `anvil undo [path]` | Instant single-command rollback of last clean/fix operation using saved snapshot backup |
341
333
  | `anvil hook install` | Install automated ANVIL quality gate into `.git/hooks/pre-commit` |
@@ -349,6 +341,11 @@ Run `anvil --help` for the complete command list and `anvil <command> --help` fo
349
341
  | `anvil git [path]` | Analyze changed files, impact and suggested tests |
350
342
  | `anvil risk [path]` | Rank engineering hotspots |
351
343
  | `anvil change-risk [path]` | Analyze changed-file risk and downstream impact |
344
+ | `anvil adr init [path]` | Initialize Architecture Decision Records directory (`docs/adr/`) with MADR template |
345
+ | `anvil adr new "Title" [path]` | Create a new MADR architectural decision record with status and context |
346
+ | `anvil adr list [path]` | List all architectural decision records and their current lifecycle statuses |
347
+ | `anvil adr sync [path]` | Sync project memory architectural decisions into versioned markdown ADRs |
348
+ | `anvil security [path]` | Deep scan for leaked credentials (OpenAI, Anthropic, GitHub, AWS, Google, Slack), dangerous scripts, exposed keys; add `--fix` to auto-exclude in `.gitignore` |
352
349
  | `anvil snapshot [path]` | Capture an intelligence snapshot |
353
350
  | `anvil timeline [path]` | Compare the latest intelligence snapshots |
354
351
 
@@ -436,19 +433,19 @@ Set `ANVIL_AI_PROVIDER` to the provider name and optionally set `ANVIL_AI_MODEL`
436
433
 
437
434
  ```bash
438
435
  # OpenAI
439
- ANVIL_AI_PROVIDER=openai OPENAI_API_KEY=YOUR_KEY ANVIL run --goal "Review the authentication flow" --path .
436
+ ANVIL_AI_PROVIDER=openai OPENAI_API_KEY=YOUR_KEY anvil run --goal "Review the authentication flow" --path .
440
437
 
441
438
  # Anthropic
442
- ANVIL_AI_PROVIDER=anthropic ANTHROPIC_API_KEY=YOUR_KEY ANVIL run --goal "Map the service boundaries" --path .
439
+ ANVIL_AI_PROVIDER=anthropic ANTHROPIC_API_KEY=YOUR_KEY anvil run --goal "Map the service boundaries" --path .
443
440
 
444
441
  # Google Gemini
445
- ANVIL_AI_PROVIDER=google GOOGLE_API_KEY=YOUR_KEY ANVIL run --goal "Identify reliability risks" --path .
442
+ ANVIL_AI_PROVIDER=google GOOGLE_API_KEY=YOUR_KEY anvil run --goal "Identify reliability risks" --path .
446
443
 
447
444
  # Local Ollama
448
- ANVIL_AI_PROVIDER=ollama OLLAMA_HOST=http://localhost:11434 ANVIL_AI_MODEL=llama3.2 ANVIL run --goal "Explain the architecture" --path .
445
+ ANVIL_AI_PROVIDER=ollama OLLAMA_HOST=http://localhost:11434 ANVIL_AI_MODEL=llama3.2 anvil run --goal "Explain the architecture" --path .
449
446
 
450
447
  # Claude Code CLI
451
- ANVIL_AI_PROVIDER=claude-code ANVIL_AI_MODEL=sonnet ANVIL run --goal "Plan a safe refactor" --path .
448
+ ANVIL_AI_PROVIDER=claude-code ANVIL_AI_MODEL=sonnet anvil run --goal "Plan a safe refactor" --path .
452
449
  ```
453
450
 
454
451
  > [!IMPORTANT]
@@ -538,9 +535,9 @@ jobs:
538
535
  runs-on: ubuntu-latest
539
536
  steps:
540
537
  - uses: actions/checkout@v4
541
- - uses: anvil-workbench/ANVIL@v1.0.6
538
+ - uses: anvil-workbench/ANVIL@v1.0.7
542
539
  with:
543
- version: v1.0.6
540
+ version: v1.0.7
544
541
  project-path: .
545
542
  operation: inspect
546
543
  ```
@@ -744,7 +741,16 @@ Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.
744
741
 
745
742
  ## Project history
746
743
 
747
- ANVIL's v1.0.6 release introduces an automated AI harness MCP setup wizard (`anvil mcp setup --client cursor|claude|windsurf|all`), a durable Project Memory & Architectural Decisions hub (`anvil memory` and live dashboard panel), dual-path memory retention (`.anvil/memory.json` / `.forge/memory.json`), seamless single-page dashboard execution, rich pre-populated showcase telemetry, automatic port fallback (`4173..4183`), single-command byte-accurate rollback (`anvil undo`), automated test verification gate (`--verify`), Git pre-commit hook automation (`anvil hook install`), framework-aware entrypoint resolution, full multi-language architecture mapping, automated farzi-file scrubbing, code auto-repair, one-command doctor self-healing, the local CLI, engineering intelligence, agent workflows, MCP integration, GitHub Action and GitHub App installation foundation into one versioned product.
744
+ ANVIL's v1.0.7 release introduces an integrated Architecture Decision Records (ADR) Engine (`anvil adr init/new/list/sync` with MADR standard and project memory sync), a comprehensive Security & Secret Scanner (`anvil security [--fix] [--json]` detecting exposed OpenAI, Anthropic, GitHub, AWS, Google, and Slack tokens, private keys, and risky scripts with automated `.gitignore` remediation), and a real-time Interactive Live DAG Workflow Runner in the local dashboard with Server-Sent Events (SSE) streaming and live task state visual animations.
745
+
746
+ ANVIL's v1.0.6 release introduced an automated AI harness MCP setup wizard (`anvil mcp setup --client cursor|claude|windsurf|all`), a durable Project Memory & Architectural Decisions hub (`anvil memory` and live dashboard panel), dual-path memory retention (`.anvil/memory.json` / `.forge/memory.json`), seamless single-page dashboard execution, rich pre-populated showcase telemetry, automatic port fallback (`4173..4183`), single-command byte-accurate rollback (`anvil undo`), automated test verification gate (`--verify`), Git pre-commit hook automation (`anvil hook install`), framework-aware entrypoint resolution, full multi-language architecture mapping, automated clutter scrubbing, code auto-repair, one-command doctor self-healing, the local CLI, engineering intelligence, agent workflows, MCP integration, GitHub Action and GitHub App installation foundation into one versioned product.
747
+
748
+ ### Provenance & Architectural Origin
749
+
750
+ ANVIL is 100% original, clean-room software created and maintained by Aditya Tiwari under the permissive MIT license.
751
+ - **Architectural Reference:** ANVIL draws inspiration from patterns in the Everything-Claude-Code (ECC) ecosystem and modern local-first developer harnesses.
752
+ - **Independent Codebase:** Every line of TypeScript, AST parser, DAG workflow engine, SARIF generator, and MCP integration is independently authored and maintained with dedicated test suites.
753
+ - **No Upstream License Baggage:** ANVIL contains zero proprietary dependencies or borrowed non-permissive code.
748
754
 
749
755
  The project is maintained as an original ANVIL codebase. ECC is a capability and documentation reference; ANVIL maintains its own identity, implementation, data models and roadmap.
750
756
 
package/SECURITY.md CHANGED
@@ -1,17 +1,61 @@
1
1
  # Security Policy
2
2
 
3
- ANVIL is an early-stage project. Do not use it to run untrusted automation against important systems.
3
+ ANVIL takes security seriously. As a local-first engineering workbench that inspects repositories, parses dependencies, and executes verification scripts, maintaining strong security boundaries is essential.
4
4
 
5
- If you believe you have found a security vulnerability in ANVIL, report it privately before public disclosure.
5
+ ## Supported Versions
6
6
 
7
- For general ANVIL support, contact [m.g.atiwari28@gmail.com](mailto:m.g.atiwari28@gmail.com).
7
+ Only the latest minor release line receives security updates. We strongly encourage all users to keep their installation updated.
8
8
 
9
- ## Scope
9
+ | Version | Supported | Release Date |
10
+ |:-------:|:---------:|:------------:|
11
+ | 1.0.x | ✅ Yes | November 2026 |
12
+ | < 1.0.0 | ❌ No | Unsupported |
10
13
 
11
- - Project file parsing, validation, and bounding
12
- - Command and script execution sandboxing
13
- - Docker container boundaries and credential handling
14
- - Token and model routing validation
15
- - Pull request, patch, and branch integrity checks
14
+ ## Reporting a Vulnerability
16
15
 
17
- Thank you for helping keep ANVIL and its users safe.
16
+ If you believe you have discovered a security vulnerability in ANVIL, **please do not disclose it publicly or open a public GitHub issue.**
17
+
18
+ ### Preferred Method: GitHub Private Vulnerability Reporting
19
+ Please submit a private advisory through GitHub:
20
+ 👉 **[Open a Security Advisory on GitHub](https://github.com/anvil-workbench/ANVIL/security/advisories/new)**
21
+
22
+ This ensures your report is received securely and confidentially by the maintainers without exposing other users to risk.
23
+
24
+ ### Alternative Method: Direct Security Email
25
+ If you are unable to use GitHub Security Advisories, send a detailed report to:
26
+ 📧 **[m.g.atiwari28@gmail.com](mailto:m.g.atiwari28@gmail.com)**
27
+
28
+ Please include:
29
+ 1. Description of the vulnerability and affected component (`cli`, `dashboard`, `mcp-server`, `cleaner`, `sandbox`, etc.).
30
+ 2. Minimal steps to reproduce the issue (proof-of-concept repository or script).
31
+ 3. Potential impact and severity assessment.
32
+ 4. Any proposed remediations or patches.
33
+
34
+ ## Response Timeline & SLA
35
+
36
+ ANVIL is maintained as open-source software by a solo maintainer. We provide best-effort response and remediation targets:
37
+ - **Initial Acknowledgment:** Best effort within **48–72 hours** of report receipt.
38
+ - **Triage & Severity Assessment:** Within **5–7 business days**, with confirmation of reproducer and severity score (CVSS).
39
+ - **Patch Development & Testing:** Targeted within **14–30 days** for critical/high vulnerabilities; within **60 days** for medium/low issues.
40
+ - **Public Disclosure:** Coordinated release with a GitHub Security Advisory and release note once the patch is available on npm.
41
+
42
+ > [!NOTE]
43
+ > GitHub Private Vulnerability Reporting is enabled in repository settings (`Settings > Code security and analysis > Private vulnerability reporting`) to facilitate confidential security disclosures.
44
+
45
+ ## Scope & Security Model
46
+
47
+ The following areas are in-scope for security review:
48
+ - **Sandbox Escapes:** Execution of arbitrary shell scripts outside of designated sandbox boundaries or container policies.
49
+ - **Local Dashboard Security:** DNS-rebinding attacks, host-header injection, or unauthorized external network access to the loopback dashboard server (`127.0.0.1`).
50
+ - **Path Traversal:** File access outside the intended project directory or workspace root via CLI options, dashboard APIs, or MCP protocol calls.
51
+ - **Secret & Credential Handling:** Unsanitized leakage of API keys, tokens, or environment variables in logs, traces, or public exports.
52
+ - **MCP Server Protocol:** Unauthorized mutations through read-only tools or injection via JSON-RPC inputs.
53
+
54
+ ## Safe Harbor
55
+
56
+ We consider security research conducted in accordance with this policy to be authorized. We will not pursue legal action against researchers who:
57
+ - Make a good-faith effort to avoid privacy violations, data destruction, and service interruption.
58
+ - Give maintainers reasonable time to remediate vulnerabilities before public disclosure.
59
+ - Do not exploit a vulnerability beyond the minimum necessary to demonstrate its existence.
60
+
61
+ Thank you for helping keep ANVIL and the developer community safe.
@@ -1,5 +1,6 @@
1
1
  import { execFile } from "node:child_process";
2
2
  import { promisify } from "node:util";
3
+ import { getAnvilEnv } from "../core/env-compat.js";
3
4
  const execFileAsync = promisify(execFile);
4
5
  export function buildClaudeCodeArgs(prompt, model) {
5
6
  const args = ["-p", prompt, "--output-format", "json", "--permission-mode", "plan",
@@ -37,9 +38,9 @@ export class ClaudeCodeProvider {
37
38
  timeoutMs;
38
39
  maxBufferBytes;
39
40
  constructor(options = {}) {
40
- this.command = options.command ?? process.env.FORGE_CLAUDE_COMMAND ?? "claude";
41
- this.cwd = options.cwd ?? process.env.FORGE_WORKSPACE ?? process.cwd();
42
- this.model = options.model ?? process.env.FORGE_AI_MODEL;
41
+ this.command = options.command ?? getAnvilEnv("ANVIL_CLAUDE_COMMAND", "FORGE_CLAUDE_COMMAND", "claude");
42
+ this.cwd = options.cwd ?? getAnvilEnv("ANVIL_WORKSPACE", "FORGE_WORKSPACE", process.cwd());
43
+ this.model = options.model ?? getAnvilEnv("ANVIL_AI_MODEL", "FORGE_AI_MODEL");
43
44
  this.timeoutMs = options.timeoutMs ?? 120_000;
44
45
  this.maxBufferBytes = options.maxBufferBytes ?? 1_048_576;
45
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"claude-code-provider.js","sourceRoot":"","sources":["../../src/ai/claude-code-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAgB1C,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,KAAc;IAChE,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAi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E,CAAC;YACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtE,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,mHAAmH,CAAC,CAAC;YACvI,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,MAAM,CAAC,CAAC;QACvD,CAAC;QACD,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,kCAAkC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC5H,CAAC;CACF"}
@@ -6,22 +6,23 @@ const PROVIDER_ENV = {
6
6
  ollama: { key: "OLLAMA_HOST", model: "llama3.2", baseUrl: "http://localhost:11434" },
7
7
  };
8
8
  export function readAIProviderConfig(env = process.env) {
9
- const raw = (env.FORGE_AI_PROVIDER ?? "mock").trim().toLowerCase();
9
+ const raw = (env.ANVIL_AI_PROVIDER ?? env.FORGE_AI_PROVIDER ?? "mock").trim().toLowerCase();
10
10
  if (!["mock", "claude-code", "anthropic", "openai", "google", "ollama"].includes(raw)) {
11
- throw new Error(`Unsupported FORGE_AI_PROVIDER "${raw}". Choose mock, claude-code, anthropic, openai, google, or ollama.`);
11
+ throw new Error(`Unsupported ANVIL_AI_PROVIDER "${raw}". Choose mock, claude-code, anthropic, openai, google, or ollama.`);
12
12
  }
13
13
  const provider = raw;
14
+ const modelOverride = env.ANVIL_AI_MODEL ?? env.FORGE_AI_MODEL;
14
15
  if (provider === "mock" || provider === "claude-code")
15
- return { provider, ...(env.FORGE_AI_MODEL ? { model: env.FORGE_AI_MODEL } : {}) };
16
+ return { provider, ...(modelOverride ? { model: modelOverride } : {}) };
16
17
  const defaults = PROVIDER_ENV[provider];
17
18
  const apiKey = provider === "ollama" ? undefined : env[defaults.key];
18
19
  const baseUrl = provider === "ollama" ? (env.OLLAMA_HOST ?? defaults.baseUrl) : undefined;
19
20
  if (provider !== "ollama" && !apiKey) {
20
- throw new Error(`${provider} is selected but ${defaults.key} is not set. Use FORGE_AI_PROVIDER=mock to work without a paid provider account.`);
21
+ throw new Error(`${provider} is selected but ${defaults.key} is not set. Use ANVIL_AI_PROVIDER=mock to work without a paid provider account.`);
21
22
  }
22
23
  return {
23
24
  provider,
24
- model: env.FORGE_AI_MODEL ?? defaults.model,
25
+ model: modelOverride ?? defaults.model,
25
26
  ...(apiKey ? { apiKey } : {}),
26
27
  ...(baseUrl ? { baseUrl } : {}),
27
28
  };
@@ -52,6 +53,6 @@ export function createAIProvider(config) {
52
53
  return new MockAIProvider();
53
54
  if (config.provider === "claude-code")
54
55
  return new ClaudeCodeProvider(config.model ? { model: config.model } : {});
55
- throw new Error(`The ${config.provider} provider adapter is not installed yet. FORGE core and MCP work without it; use FORGE_AI_PROVIDER=mock until an adapter is configured.`);
56
+ throw new Error(`The ${config.provider} provider adapter is not installed yet. ANVIL core and MCP work without it; use ANVIL_AI_PROVIDER=mock until an adapter is configured.`);
56
57
  }
57
58
  //# sourceMappingURL=provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/ai/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AA2C/D,MAAM,YAAY,GAIb;IACH,SAAS,EAAE,EAAE,GAAG,EAAE,mBAAmB,EAAE,KAAK,EAAE,eAAe,EAAE;IAC/D,MAAM,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE;IACxD,MAAM,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE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