anvil-engineering-workbench 1.0.6 → 1.0.7
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 +24 -2
- package/README.md +34 -35
- package/SECURITY.md +51 -10
- package/dist/ai/provider.js +6 -5
- package/dist/ai/provider.js.map +1 -1
- package/dist/cli.js +123 -6
- package/dist/cli.js.map +1 -1
- package/dist/core/adr-engine.d.ts +30 -0
- package/dist/core/adr-engine.js +163 -0
- package/dist/core/adr-engine.js.map +1 -0
- package/dist/core/code-review.js +6 -6
- package/dist/core/dashboard-server.js +222 -14
- package/dist/core/dashboard-server.js.map +1 -1
- package/dist/core/project-cleaner.js +32 -7
- package/dist/core/project-cleaner.js.map +1 -1
- package/dist/core/security-scanner.d.ts +37 -0
- package/dist/core/security-scanner.js +325 -0
- package/dist/core/security-scanner.js.map +1 -0
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# ANVIL Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.7 — Architecture Decision Records (ADR), Deep Security Scanner & Live Workflow DAG Runner
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
### Features & Capabilities
|
|
8
|
+
- **Architecture Decision Records Engine (`anvil adr` & Web Dashboard):**
|
|
9
|
+
- MADR (Markdown Architectural Decision Records) 3.0 standard directory structure initialized via `anvil adr init` under `docs/adr/`.
|
|
10
|
+
- Create structured decision records with status (`proposed`, `accepted`, `rejected`, `superseded`, `deprecated`), context, consequences, and alternatives via `anvil adr new "Title"`.
|
|
11
|
+
- 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.
|
|
12
|
+
- Interactive visual ADR viewer and creator in the web dashboard under Architecture & Graph.
|
|
13
|
+
- **Deep Security & Secret Scanner (`anvil security` & Web Dashboard):**
|
|
14
|
+
- 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`).
|
|
15
|
+
- Detection of dangerous shell practices (unvetted `curl ... | bash` in scripts) and unencrypted HTTP package dependencies.
|
|
16
|
+
- Detection of exposed, unignored sensitive files (`.env`, `.pem`, `.key`, `.pfx`, `.p12`).
|
|
17
|
+
- Automated one-click remediation with `--fix` (`POST /api/security/fix`), updating `.gitignore` to safely quarantine exposed files and credentials.
|
|
18
|
+
- Interactive Security Audit card in the dashboard's Self-Healing & Security tab with real-time status and "Auto-Fix via .gitignore" action.
|
|
19
|
+
- **Interactive Live DAG Workflow Runner:**
|
|
20
|
+
- One-click live execution (`POST /api/workflows/:id/execute`) directly from the dashboard visual canvas and saved workflow cards.
|
|
21
|
+
- Real-time Server-Sent Events (SSE) telemetry broadcast: `workflow_started`, `workflow_task_settled`, and `workflow_completed`.
|
|
22
|
+
- Realistic multi-agent task execution simulation powered by `advanceRun` and `DemoAgentProvider`.
|
|
23
|
+
- **Interactive Landing Page Enhancements:** Added terminal tabs (`09 adr`, `10 security`) and updated live npm badges to v1.0.7.
|
|
24
|
+
|
|
3
25
|
## 1.0.6 — AI Harness MCP Wizard & Dashboard Project Memory Hub
|
|
4
26
|
|
|
5
27
|
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 +60,9 @@ ANVIL 1.0.4 introduces production-grade safety nets and developer velocity super
|
|
|
38
60
|
- **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
61
|
- **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
62
|
|
|
41
|
-
## 1.0.3 — Multi-Language Architecture Mapping,
|
|
63
|
+
## 1.0.3 — Multi-Language Architecture Mapping, Workspace Cleaner & Self-Healing Wizard
|
|
42
64
|
|
|
43
|
-
ANVIL 1.0.3 introduces comprehensive multi-language architecture mapping (Python, Go, Rust, Java, C/C++), an automated junk/
|
|
65
|
+
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
66
|
|
|
45
67
|
### Features & Capabilities
|
|
46
68
|
- **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.
|
|
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.
|
|
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
|
-
#
|
|
138
|
-
anvil doctor
|
|
124
|
+
# 1. Run environment and project health diagnostics
|
|
125
|
+
anvil doctor
|
|
139
126
|
|
|
140
|
-
#
|
|
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
|
-
#
|
|
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.
|
|
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
|
-
#
|
|
167
|
-
anvil doctor
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
538
|
+
- uses: anvil-workbench/ANVIL@v1.0.7
|
|
542
539
|
with:
|
|
543
|
-
version: v1.0.
|
|
540
|
+
version: v1.0.7
|
|
544
541
|
project-path: .
|
|
545
542
|
operation: inspect
|
|
546
543
|
```
|
|
@@ -744,7 +741,9 @@ Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.
|
|
|
744
741
|
|
|
745
742
|
## Project history
|
|
746
743
|
|
|
747
|
-
ANVIL's v1.0.
|
|
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.
|
|
748
747
|
|
|
749
748
|
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
749
|
|
package/SECURITY.md
CHANGED
|
@@ -1,17 +1,58 @@
|
|
|
1
1
|
# Security Policy
|
|
2
2
|
|
|
3
|
-
ANVIL
|
|
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
|
-
|
|
5
|
+
## Supported Versions
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Only the latest minor release line receives security updates. We strongly encourage all users to keep their installation updated.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| Version | Supported | Release Date |
|
|
10
|
+
|:-------:|:---------:|:------------:|
|
|
11
|
+
| 1.0.x | ✅ Yes | November 2026 |
|
|
12
|
+
| < 1.0.0 | ❌ No | Unsupported |
|
|
10
13
|
|
|
11
|
-
|
|
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
|
-
|
|
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
|
+
We adhere to the following response timeline for security issues:
|
|
37
|
+
- **Initial Acknowledgment:** Within **48 hours** of report receipt.
|
|
38
|
+
- **Triage & Severity Assessment:** Within **5 business days**, with confirmation of reproducer and severity score (CVSS).
|
|
39
|
+
- **Patch Development & Testing:** Within **14 days** for critical/high vulnerabilities; within **30 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
|
+
## Scope & Security Model
|
|
43
|
+
|
|
44
|
+
The following areas are in-scope for security review:
|
|
45
|
+
- **Sandbox Escapes:** Execution of arbitrary shell scripts outside of designated sandbox boundaries or container policies.
|
|
46
|
+
- **Local Dashboard Security:** DNS-rebinding attacks, host-header injection, or unauthorized external network access to the loopback dashboard server (`127.0.0.1`).
|
|
47
|
+
- **Path Traversal:** File access outside the intended project directory or workspace root via CLI options, dashboard APIs, or MCP protocol calls.
|
|
48
|
+
- **Secret & Credential Handling:** Unsanitized leakage of API keys, tokens, or environment variables in logs, traces, or public exports.
|
|
49
|
+
- **MCP Server Protocol:** Unauthorized mutations through read-only tools or injection via JSON-RPC inputs.
|
|
50
|
+
|
|
51
|
+
## Safe Harbor
|
|
52
|
+
|
|
53
|
+
We consider security research conducted in accordance with this policy to be authorized. We will not pursue legal action against researchers who:
|
|
54
|
+
- Make a good-faith effort to avoid privacy violations, data destruction, and service interruption.
|
|
55
|
+
- Give maintainers reasonable time to remediate vulnerabilities before public disclosure.
|
|
56
|
+
- Do not exploit a vulnerability beyond the minimum necessary to demonstrate its existence.
|
|
57
|
+
|
|
58
|
+
Thank you for helping keep ANVIL and the developer community safe.
|
package/dist/ai/provider.js
CHANGED
|
@@ -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
|
|
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, ...(
|
|
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
|
|
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:
|
|
25
|
+
model: modelOverride ?? defaults.model,
|
|
25
26
|
...(apiKey ? { apiKey } : {}),
|
|
26
27
|
...(baseUrl ? { baseUrl } : {}),
|
|
27
28
|
};
|
package/dist/ai/provider.js.map
CHANGED
|
@@ -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;IACxD,MAAM,EAAE,EAAE,GAAG,EAAE,aAAa,EA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AAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;QACnG,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,EAAE;YACjB,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,YAAY;YACpC,IAAI,EAAE;gBACJ,8BAA8B;gBAC9B,wEAAwE;gBACxE,iBAAiB,CAAC,CAAC,CAAC,kBAAkB,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,4BAA4B;gBAC9G,6EAA6E;aAC9E,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAwB;IACvD,IAAI,MAAM,CAAC,QAAQ,KAAK,MAAM;QAAE,OAAO,IAAI,cAAc,EAAE,CAAC;IAC5D,IAAI,MAAM,CAAC,QAAQ,KAAK,aAAa;QAAE,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAClH,MAAM,IAAI,KAAK,CACb,OAAO,MAAM,CAAC,QAAQ,wIAAwI,CAC/J,CAAC;AACJ,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -46,6 +46,8 @@ import { analyzeDependencies, formatDependencyIntelligence } from "./core/depend
|
|
|
46
46
|
import { generateRemediationPlan, formatRemediationPlan } from "./core/remediation-planner.js";
|
|
47
47
|
import { addProjectMemory, buildProjectMemoryContext, listProjectMemory, removeProjectMemory } from "./core/project-memory.js";
|
|
48
48
|
import { setupHarnessMcp, resolveMcpServerScript } from "./core/mcp-setup.js";
|
|
49
|
+
import { initAdrDirectory, listAdrs, createAdr, syncMemoryToAdrs } from "./core/adr-engine.js";
|
|
50
|
+
import { scanProjectSecurity, applySecurityFixes, formatSecurityReport } from "./core/security-scanner.js";
|
|
49
51
|
import { formatSkillContext, loadSkillRegistry, selectSkills } from "./core/skill-registry.js";
|
|
50
52
|
import { applyBeforeAgentHooks, loadHooks } from "./core/hook-engine.js";
|
|
51
53
|
import { assertSupportedAgentPolicy, loadPermissionPolicy } from "./core/permission-policy.js";
|
|
@@ -126,7 +128,7 @@ function readAgentDurationBudgets() {
|
|
|
126
128
|
}
|
|
127
129
|
return budgets;
|
|
128
130
|
}
|
|
129
|
-
const VERSION = "1.0.
|
|
131
|
+
const VERSION = "1.0.7";
|
|
130
132
|
const HELP = `
|
|
131
133
|
ANVIL — The AI Engineering Workbench
|
|
132
134
|
|
|
@@ -149,7 +151,7 @@ Commands:
|
|
|
149
151
|
agent-release <prepare|list|show|approve|reject> [options] Gate agent configuration promotion
|
|
150
152
|
experiment <capture|show|compare> [options] Capture and compare reproducible benchmark manifests
|
|
151
153
|
quality [path] Generate an evidence-based static engineering quality report
|
|
152
|
-
clean [path] Clean
|
|
154
|
+
clean [path] Clean workspace junk files and logs; use --apply to delete, --fix to repair code
|
|
153
155
|
fix [path] Auto-fix code issues, unused imports, and formatting
|
|
154
156
|
deps [path] Analyze npm dependencies, licenses, and imported security reports
|
|
155
157
|
remediate [path] Advisory remediation plan for vulnerable and outdated dependencies
|
|
@@ -185,10 +187,12 @@ Commands:
|
|
|
185
187
|
map [path] Map source modules and import relationships
|
|
186
188
|
agents [path] List built-in and workspace agent roles
|
|
187
189
|
memory <action> Manage local project memory (add, list, remove, context)
|
|
190
|
+
adr <action> Manage Architecture Decision Records (init, new, list, sync)
|
|
188
191
|
mcp [setup] Model Context Protocol server and harness setup (cursor, claude, windsurf)
|
|
189
192
|
skills [path] List built-in and workspace skills
|
|
190
193
|
hooks [path] List configured declarative lifecycle hooks
|
|
191
194
|
agent-security [path] Audit agent instructions, skills, hooks, and permissions
|
|
195
|
+
security [path] Audit repository for hardcoded secrets, keys, and script vulnerabilities
|
|
192
196
|
plan --goal TEXT Create and save a reviewable draft plan
|
|
193
197
|
run --goal TEXT Run the plan using a configured AI provider
|
|
194
198
|
runs [path] List locally saved run history (add --json for versioned JSON)
|
|
@@ -925,7 +929,8 @@ async function main(args) {
|
|
|
925
929
|
skipValues.add(i + 1);
|
|
926
930
|
}
|
|
927
931
|
const positional = memoryArgs.filter((arg, i) => !arg.startsWith("--") && !skipValues.has(i));
|
|
928
|
-
const
|
|
932
|
+
const targetPath = positional.find(arg => !arg.startsWith("mem-")) ?? ".";
|
|
933
|
+
const target = path.resolve(targetPath);
|
|
929
934
|
try {
|
|
930
935
|
if (action === "list") {
|
|
931
936
|
const entries = await listProjectMemory(target);
|
|
@@ -1004,6 +1009,116 @@ async function main(args) {
|
|
|
1004
1009
|
}
|
|
1005
1010
|
return;
|
|
1006
1011
|
}
|
|
1012
|
+
case "adr": {
|
|
1013
|
+
if (rest.includes("--help") || rest.includes("-h") || rest[0] === "help") {
|
|
1014
|
+
process.stdout.write(`Usage: anvil adr <subcommand> [options]
|
|
1015
|
+
|
|
1016
|
+
Manage Architecture Decision Records (ADR) using the MADR 3.0 standard.
|
|
1017
|
+
|
|
1018
|
+
Subcommands:
|
|
1019
|
+
init [path] Initialize docs/adr/ directory with template
|
|
1020
|
+
new "Title" [path] [--status STATUS] Create a new ADR record
|
|
1021
|
+
list [path] List all recorded ADRs
|
|
1022
|
+
sync [path] Sync decisions from project memory to docs/adr/
|
|
1023
|
+
`);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
const [action = "list", ...adrArgs] = rest;
|
|
1027
|
+
const option = (name) => { const index = adrArgs.indexOf(name); return index >= 0 ? adrArgs[index + 1] : undefined; };
|
|
1028
|
+
const skipValues = new Set();
|
|
1029
|
+
for (let i = 0; i < adrArgs.length; i++) {
|
|
1030
|
+
if (adrArgs[i]?.startsWith("--"))
|
|
1031
|
+
skipValues.add(i + 1);
|
|
1032
|
+
}
|
|
1033
|
+
const positional = adrArgs.filter((arg, i) => !arg.startsWith("--") && !skipValues.has(i));
|
|
1034
|
+
try {
|
|
1035
|
+
if (action === "init") {
|
|
1036
|
+
const target = path.resolve(positional[0] ?? ".");
|
|
1037
|
+
const res = await initAdrDirectory(target);
|
|
1038
|
+
process.stdout.write(res.created ? `Initialized Architecture Decision Records in ${res.path}\n` : `ADR directory already initialized in ${res.path}\n`);
|
|
1039
|
+
}
|
|
1040
|
+
else if (action === "new") {
|
|
1041
|
+
const title = positional[0];
|
|
1042
|
+
if (!title)
|
|
1043
|
+
throw new Error("Usage: anvil adr new \"Title of decision\" [path] [--status Proposed|Accepted]");
|
|
1044
|
+
const target = path.resolve(positional[1] ?? ".");
|
|
1045
|
+
const status = (option("--status") ?? "Accepted");
|
|
1046
|
+
const context = option("--context");
|
|
1047
|
+
const decision = option("--decision");
|
|
1048
|
+
const record = await createAdr(target, title, { status, context, decision });
|
|
1049
|
+
process.stdout.write(`Created ADR ${record.id}: ${record.filename}\n`);
|
|
1050
|
+
}
|
|
1051
|
+
else if (action === "sync") {
|
|
1052
|
+
const target = path.resolve(positional[0] ?? ".");
|
|
1053
|
+
const res = await syncMemoryToAdrs(target);
|
|
1054
|
+
process.stdout.write(res.syncedCount > 0
|
|
1055
|
+
? `Synced ${res.syncedCount} decisions from project memory to docs/adr/:\n` + res.createdAdrs.map(a => ` - [${a.id}] ${a.filename}`).join("\n") + "\n"
|
|
1056
|
+
: `All project memory decisions are already synced to docs/adr/.\n`);
|
|
1057
|
+
}
|
|
1058
|
+
else if (action === "list") {
|
|
1059
|
+
const target = path.resolve(positional[0] ?? ".");
|
|
1060
|
+
const records = await listAdrs(target);
|
|
1061
|
+
if (!records.length) {
|
|
1062
|
+
process.stdout.write("No Architecture Decision Records found. Run 'anvil adr init' to get started.\n");
|
|
1063
|
+
}
|
|
1064
|
+
else {
|
|
1065
|
+
process.stdout.write(`Architecture Decision Records (${records.length}):\n\n`);
|
|
1066
|
+
for (const r of records) {
|
|
1067
|
+
process.stdout.write(` [${r.id}] ${r.title} (${r.status}, ${r.date})\n`);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
throw new Error("ADR actions: init, new, list, sync.");
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
catch (error) {
|
|
1076
|
+
process.stderr.write("ANVIL ADR command failed: " + (error instanceof Error ? error.message : String(error)) + "\n");
|
|
1077
|
+
process.exitCode = 1;
|
|
1078
|
+
}
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
case "security": {
|
|
1082
|
+
if (rest.includes("--help") || rest.includes("-h") || rest[0] === "help") {
|
|
1083
|
+
process.stdout.write(`Usage: anvil security [path] [options]
|
|
1084
|
+
|
|
1085
|
+
Deep scan repository for hardcoded secrets, exposed tokens, sensitive files, and dangerous script patterns.
|
|
1086
|
+
|
|
1087
|
+
Options:
|
|
1088
|
+
--fix Auto-remediate exposed credentials by updating .gitignore
|
|
1089
|
+
--json Output report in machine-readable JSON format
|
|
1090
|
+
--help Show this help message
|
|
1091
|
+
`);
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
const isJson = rest.includes("--json");
|
|
1095
|
+
const shouldFix = rest.includes("--fix");
|
|
1096
|
+
const positional = rest.filter(arg => !arg.startsWith("--"));
|
|
1097
|
+
const target = path.resolve(positional[0] ?? ".");
|
|
1098
|
+
try {
|
|
1099
|
+
const report = await scanProjectSecurity(target);
|
|
1100
|
+
if (shouldFix && report.findings.length > 0) {
|
|
1101
|
+
const fixResult = await applySecurityFixes(target, report.findings);
|
|
1102
|
+
if (fixResult.fixedCount > 0) {
|
|
1103
|
+
process.stdout.write(`Applied ${fixResult.fixedCount} security fix(es):\n` + fixResult.details.map(d => ` ✓ ${d}`).join("\n") + "\n\n");
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
if (isJson) {
|
|
1107
|
+
process.stdout.write(JSON.stringify(report, null, 2) + "\n");
|
|
1108
|
+
}
|
|
1109
|
+
else {
|
|
1110
|
+
process.stdout.write(formatSecurityReport(report));
|
|
1111
|
+
}
|
|
1112
|
+
if (!report.passed) {
|
|
1113
|
+
process.exitCode = 1;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
catch (error) {
|
|
1117
|
+
process.stderr.write("ANVIL security audit failed: " + (error instanceof Error ? error.message : String(error)) + "\n");
|
|
1118
|
+
process.exitCode = 1;
|
|
1119
|
+
}
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1007
1122
|
case "plan": {
|
|
1008
1123
|
const goalIndex = rest.indexOf("--goal");
|
|
1009
1124
|
const pathIndex = rest.indexOf("--path");
|
|
@@ -1098,11 +1213,13 @@ async function main(args) {
|
|
|
1098
1213
|
const traceRunUsage = priorTraceEntries.reduce((total, entry) => total + entry.inputTokensEstimate + entry.outputTokensEstimate, 0);
|
|
1099
1214
|
const priorAgentUsage = savedRun.tokenUsage?.estimatedTokensByAgent ?? traceAgentUsage;
|
|
1100
1215
|
const priorRunUsage = savedRun.tokenUsage?.estimatedTokensUsed ?? traceRunUsage;
|
|
1101
|
-
const router = new ModelRouter({
|
|
1216
|
+
const router = new ModelRouter({
|
|
1217
|
+
fastModel: process.env.FORGE_MODEL_FAST ?? baseModel, balancedModel: process.env.FORGE_MODEL_BALANCED ?? baseModel, reasoningModel: process.env.FORGE_MODEL_REASONING ?? baseModel, ...(process.env.FORGE_FALLBACK_MODEL ? { fallbackModel: process.env.FORGE_FALLBACK_MODEL } : {}), retryAttempts: Number(process.env.FORGE_MODEL_RETRY_ATTEMPTS ?? 2), retryDelayMs: Number(process.env.FORGE_MODEL_RETRY_DELAY_MS ?? 500), ...(process.env.FORGE_MAX_INPUT_TOKENS_PER_TASK ? { maxInputTokensPerTask: Number(process.env.FORGE_MAX_INPUT_TOKENS_PER_TASK) } : {}), ...(process.env.FORGE_MAX_OUTPUT_TOKENS_PER_TASK ? { maxOutputTokensPerTask: Number(process.env.FORGE_MAX_OUTPUT_TOKENS_PER_TASK) } : {}), ...(process.env.FORGE_MAX_ESTIMATED_TOKENS_PER_RUN ? { maxEstimatedTokensPerRun: Number(process.env.FORGE_MAX_ESTIMATED_TOKENS_PER_RUN) } : {}),
|
|
1102
1218
|
...(process.env.FORGE_MAX_ESTIMATED_TOKENS_PER_AGENT ? { maxEstimatedTokensPerAgent: readAgentTokenBudgets() } : {}),
|
|
1103
1219
|
...(process.env.FORGE_MAX_TASK_DURATION_MS ? { maxTaskDurationMs: Number(process.env.FORGE_MAX_TASK_DURATION_MS) } : {}),
|
|
1104
1220
|
...(process.env.FORGE_MAX_TASK_DURATION_MS_BY_AGENT ? { maxTaskDurationMsByAgent: readAgentDurationBudgets() } : {}),
|
|
1105
|
-
initialEstimatedTokensUsed: priorRunUsage, initialEstimatedTokensByAgent: priorAgentUsage, createProvider
|
|
1221
|
+
initialEstimatedTokensUsed: priorRunUsage, initialEstimatedTokensByAgent: priorAgentUsage, createProvider
|
|
1222
|
+
});
|
|
1106
1223
|
const memory = await buildProjectMemoryContext(target, savedRun.goal);
|
|
1107
1224
|
// Re-check current workspace policy before resuming any task that has not completed.
|
|
1108
1225
|
// Previously applied hook guidance is kept in the saved prompt and is not appended twice.
|
|
@@ -1967,7 +2084,7 @@ async function main(args) {
|
|
|
1967
2084
|
case "clean":
|
|
1968
2085
|
case "fix": {
|
|
1969
2086
|
if (rest.includes("--help")) {
|
|
1970
|
-
process.stdout.write(`Usage: anvil ${command} [path] [--apply] [--fix] [--json]\n Clean
|
|
2087
|
+
process.stdout.write(`Usage: anvil ${command} [path] [--apply] [--fix] [--json]\n Clean workspace junk clutter, downloads, logs, and auto-repair code issues.\n`);
|
|
1971
2088
|
return;
|
|
1972
2089
|
}
|
|
1973
2090
|
const json = rest.includes("--json");
|