opencode-code-archaeology 2.0.0 → 2.2.0

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 (76) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +63 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.yml +48 -0
  3. package/.github/pull_request_template.md +27 -0
  4. package/.github/workflows/ci.yml +45 -0
  5. package/.github/workflows/release.yml +46 -0
  6. package/AGENTS.md +42 -10
  7. package/CHANGELOG.md +79 -0
  8. package/CONTRIBUTING.md +50 -0
  9. package/INSTALL.md +211 -0
  10. package/README.md +255 -71
  11. package/SECURITY.md +20 -0
  12. package/VERSION +1 -1
  13. package/assets/code-archaeology-banner.svg +195 -0
  14. package/commands/code-archaeology.md +7 -5
  15. package/dist/cli.d.ts +3 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +137 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/index.d.ts +1 -5
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -17
  22. package/dist/index.js.map +1 -1
  23. package/dist/platform.d.ts +4 -0
  24. package/dist/platform.d.ts.map +1 -0
  25. package/dist/platform.js +11 -0
  26. package/dist/platform.js.map +1 -0
  27. package/dist/plugin.d.ts +3 -0
  28. package/dist/plugin.d.ts.map +1 -0
  29. package/dist/plugin.js +3 -0
  30. package/dist/plugin.js.map +1 -0
  31. package/dist/runtime.d.ts +18 -0
  32. package/dist/runtime.d.ts.map +1 -0
  33. package/dist/runtime.js +49 -0
  34. package/dist/runtime.js.map +1 -0
  35. package/dist/types.d.ts +1 -6
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js.map +1 -1
  38. package/docs/ARCHITECTURE.md +123 -0
  39. package/docs/INSTALL.md +156 -0
  40. package/docs/README.md +72 -0
  41. package/docs/RELEASE.md +139 -0
  42. package/docs/SECURITY_AUDIT.md +38 -0
  43. package/docs/index.html +740 -0
  44. package/hooks/hermes/runner.ps1 +247 -0
  45. package/hooks/hermes/runner.sh +262 -0
  46. package/hooks/hermes/setup.ps1 +41 -0
  47. package/hooks/hermes/setup.sh +41 -0
  48. package/hooks/opencode/init.ps1 +83 -0
  49. package/hooks/opencode/revert-phase.ps1 +12 -0
  50. package/hooks/opencode/revert-phase.sh +3 -8
  51. package/hooks/opencode/update-expedition.ps1 +51 -0
  52. package/hooks/opencode/verify-package.sh +47 -0
  53. package/hooks/opencode/verify-phase.ps1 +35 -0
  54. package/hooks/opencode/verify-phase.sh +7 -7
  55. package/hooks/shared/command-utils.ps1 +100 -0
  56. package/package.json +41 -6
  57. package/prompts/dead_code.md +45 -0
  58. package/prompts/dependencies.md +49 -0
  59. package/prompts/discovery.md +47 -0
  60. package/prompts/dry.md +49 -0
  61. package/prompts/errors.md +52 -0
  62. package/prompts/final_verify.md +58 -0
  63. package/prompts/legacy.md +49 -0
  64. package/prompts/polish.md +48 -0
  65. package/prompts/types_consolidate.md +48 -0
  66. package/prompts/types_harden.md +51 -0
  67. package/skills/code-archaeology/SKILL.md +2 -2
  68. package/skills/hermes/INTEGRATION.md +120 -0
  69. package/skills/hermes/README.md +167 -0
  70. package/skills/hermes/code-archaeology-prompt.md +203 -0
  71. package/wiki/Expedition-Workflow.md +34 -0
  72. package/wiki/Home.md +27 -0
  73. package/wiki/Installation.md +44 -0
  74. package/wiki/Release-Process.md +31 -0
  75. package/wiki/Security-and-Safety.md +21 -0
  76. package/plugins/code-archaeology.ts +0 -8
package/README.md CHANGED
@@ -1,71 +1,220 @@
1
- # Code Archaeology
1
+ <h1 align="center">Code Archaeology</h1>
2
+
3
+ <p align="center">
4
+ <img src="assets/code-archaeology-banner.svg" alt="Code Archaeology multi-runtime banner" width="900">
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/Maleick/Code-Archaeology/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/Maleick/Code-Archaeology?style=flat-square"></a>
9
+ <a href="https://github.com/Maleick/Code-Archaeology/commits/main"><img alt="Last commit" src="https://img.shields.io/github/last-commit/Maleick/Code-Archaeology?style=flat-square"></a>
10
+ <a href="https://github.com/Maleick/Code-Archaeology/releases"><img alt="GitHub release" src="https://img.shields.io/github/v/release/Maleick/Code-Archaeology?style=flat-square"></a>
11
+ <a href="https://www.npmjs.com/package/opencode-code-archaeology"><img alt="npm version" src="https://img.shields.io/npm/v/opencode-code-archaeology?style=flat-square"></a>
12
+ <a href="LICENSE"><img alt="License" src="https://img.shields.io/github/license/Maleick/Code-Archaeology?style=flat-square"></a>
13
+ <a href="docs/README.md"><img alt="Docs" src="https://img.shields.io/badge/docs-open-blue?style=flat-square"></a>
14
+ <a href="https://github.com/sponsors/Maleick"><img alt="Sponsor" src="https://img.shields.io/badge/sponsor-Maleick-fafbfc?style=flat-square&logo=github-sponsors"></a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="#installation">Install</a> |
19
+ <a href="docs/README.md">Docs</a> |
20
+ <a href="https://github.com/Maleick/Code-Archaeology/wiki">Wiki</a> |
21
+ <a href="#commands">Commands</a> |
22
+ <a href="#safety-model">Safety</a> |
23
+ <a href="#release-docs">Release</a>
24
+ </p>
25
+
26
+ Excavate technical debt. Restore with confidence.
27
+
28
+ Code Archaeology is a multi-runtime plugin that surveys, catalogs, and safely restores codebases by removing accumulated technical sediment in a fixed, test-gated expedition order. It runs on **OpenCode** (interactive slash commands) and **Hermes Agent** (cron-based background execution).
29
+
30
+ ```text
31
+ +---------------------------------------------------------------+
32
+ | CODE ARCHAEOLOGY CAPABILITY PANEL |
33
+ +-------------------+-------------------------------------------+
34
+ | Default mode | survey: reports only, zero source edits |
35
+ | Review mode | excavate: reports plus mock patches |
36
+ | Restore mode | applies approved changes with test gates |
37
+ | Local state | .archaeology/ runtime artifacts |
38
+ | Runtimes | OpenCode plugin + Hermes Agent cron |
39
+ | Platforms | macOS/Linux (bash) + Windows (PowerShell) |
40
+ | Expedition order | fixed stratigraphy from survey to catalog |
41
+ +-------------------+-------------------------------------------+
42
+ ```
2
43
 
3
- A systematic excavation plugin for OpenCode. Removes accumulated sediment from a codebase—dead code, legacy fallbacks, circular dependencies, weak types, and defensive programming slop—to restore the original architecture.
44
+ ## What It Does
4
45
 
5
- ## ⚠️ Site Safety
46
+ Code Archaeology runs a systematic excavation of a repository before it changes code. It inventories the site, identifies technical debt strata, writes reviewable reports, and only applies approved changes in `restore` mode.
6
47
 
7
- This plugin modifies code. By default it runs in **survey** mode, producing site reports only. Review these before switching to `restore` mode.
48
+ - Catalogs dead code, unused exports, unreachable functions, and stale artifacts.
49
+ - Removes legacy fallbacks, deprecated shims, and compatibility layers after review.
50
+ - Maps circular dependencies before extraction or type consolidation work.
51
+ - Consolidates duplicate type definitions only after dead code and legacy layers are removed.
52
+ - Hardens weak types without guessing uncertain replacements.
53
+ - Finds semantic duplication and error-handling slop while preserving I/O boundaries.
54
+ - Produces `.archaeology/` reports that stay local to the working repository.
55
+ - Supports both **OpenCode** interactive sessions and **Hermes Agent** cron-based phased execution.
8
56
 
9
- ## Prerequisites
57
+ ## Installation
10
58
 
11
- - Git repo with clean working tree
12
- - Passing test suite (even if minimal)
13
- - Type checker / linter installed
14
- - `opencode` CLI available
59
+ ### OpenCode
15
60
 
16
- ## Installation
61
+ Paste this handoff into your agent:
62
+
63
+ ```text
64
+ Run `npm pack opencode-code-archaeology@2.2.0`, extract the tarball, then open `package/INSTALL.md` from that archive and follow its instructions.
65
+ ```
66
+
67
+ Recommended plugin install in `opencode.json`:
68
+
69
+ ```json
70
+ {
71
+ "plugin": [
72
+ "opencode-code-archaeology@2.2.0"
73
+ ]
74
+ }
75
+ ```
76
+
77
+ Global npm install path:
17
78
 
18
79
  ```bash
19
- # As an OpenCode plugin
20
- npm install -g opencode-code-archaeology
80
+ npm install -g opencode-code-archaeology@2.2.0 && opencode-code-archaeology install && opencode-code-archaeology doctor
81
+ ```
82
+
83
+ One-time package runner path, if your OpenCode setup supports package execution through Bun:
21
84
 
22
- # Or clone and link
23
- git clone https://github.com/Maleick/Code-Archaeology.git
24
- cd Code-Archaeology
25
- npm link
85
+ ```bash
86
+ bunx opencode-code-archaeology@2.2.0 install
87
+ bunx opencode-code-archaeology@2.2.0 doctor
26
88
  ```
27
89
 
28
- ## Usage
90
+ ### Hermes Agent
29
91
 
30
92
  ```bash
31
- # 1. Survey — catalog artifacts, zero changes
32
- opencode run code-archaeology --mode survey
93
+ npm install -g opencode-code-archaeology@2.2.0
94
+ cd ~/projects/Code-Archaeology
95
+ bash hooks/hermes/setup.sh
96
+
97
+ hermes cronjob create \
98
+ --name "code-archaeology-expedition" \
99
+ --schedule "every 15m" \
100
+ --workdir ~/projects/Code-Archaeology \
101
+ --prompt "Run one Code Archaeology expedition phase. Read .archaeology/session.json, execute current phase with verification, advance to next phase."
102
+ ```
103
+
104
+ See [`INSTALL.md`](INSTALL.md) for prerequisites, verification, updating, and troubleshooting.
105
+
106
+ ## Quick Start
33
107
 
34
- # 2. Review reports in .archaeology/
35
- cat .archaeology/expedition1-report.md
36
- # ... etc
108
+ ### OpenCode
37
109
 
38
- # 3. Restore high-confidence findings only
39
- opencode run code-archaeology --mode restore --strict_mode false
110
+ Run the command family from inside the repository you want to inspect:
40
111
 
41
- # 4. Or restore medium+high confidence
42
- opencode run code-archaeology --mode restore --strict_mode true
112
+ ```text
113
+ /code-archaeology
43
114
  ```
44
115
 
45
- ## Parameters
116
+ `/code-archaeology` runs the full 10-phase survey chain without per-phase prompts. It writes reports under `.archaeology/` and makes no source-code changes. Review the reports, then choose whether to generate mock patches or apply approved changes:
46
117
 
47
- | Parameter | Default | Description |
48
- |-----------|---------|-------------|
49
- | `repo_path` | `.` | Target repository |
50
- | `language` | `typescript` | Primary language |
51
- | `mode` | `survey` | `survey`, `excavate`, or `restore` |
52
- | `strict_mode` | `false` | Auto-restore medium-confidence findings |
53
- | `test_command` | `npm test` | Test runner command |
54
- | `typecheck_command` | `npx tsc --noEmit` | Type check command |
55
- | `branch_name` | `refactor/archaeology` | Git branch to create |
118
+ ```text
119
+ /code-archaeology-survey
120
+ /code-archaeology-excavate
121
+ /code-archaeology-restore
122
+ ```
56
123
 
57
- ## Output Artifacts
124
+ ### Hermes Agent
58
125
 
59
- All artifacts are written to `.archaeology/`:
126
+ Each cron run executes exactly **one** phase. The runner reads `.archaeology/session.json`, runs the current phase with verification, and advances to the next phase:
60
127
 
61
- - `site_survey.md` — baseline inventory and stratum graph
62
- - `expedition1-report.md` through `expedition8-report.md` — per-expedition findings
63
- - `FINAL_CATALOG.md` — completed excavation metrics and recommendations
64
- - `excavation_log.txt` — `git diff --stat`
128
+ ```bash
129
+ bash hooks/hermes/runner.sh
130
+ ```
131
+
132
+ Ten phases complete in ~2.5 hours minimum (15-minute intervals).
133
+
134
+ ## Runtime Surfaces
135
+
136
+ | Feature | OpenCode | Hermes Agent |
137
+ |---------|----------|--------------|
138
+ | Entry | `/code-archaeology` slash command | `cronjob` |
139
+ | Phases | All in one session | One per cron run |
140
+ | Verification | Between expeditions | Between every phase |
141
+ | Revert | Manual or automatic | Automatic on failure |
142
+ | State | `.archaeology/session.json` | Same file |
143
+ | Background | Plugin stays active | Cron resumes automatically |
144
+ | Real-time | Yes | Delayed (15-min intervals) |
145
+
146
+ ## Expedition Flow
147
+
148
+ ```mermaid
149
+ flowchart TD
150
+ A[Start] --> B[Site Survey and Baseline]
151
+ B --> C[Dead Code Excavation]
152
+ C --> D[Legacy Stratum Removal]
153
+ D --> E[Circular Dependency Cartography]
154
+ E --> F[Type Catalog Consolidation]
155
+ F --> G[Type Restoration and Hardening]
156
+ G --> H[DRY Stratification]
157
+ H --> I[Error Handling Stratigraphy]
158
+ I --> J[Artifact Cleaning and Documentation]
159
+ J --> K[Site Preservation and Final Catalog]
160
+ ```
161
+
162
+ ## Safety Model
163
+
164
+ ```mermaid
165
+ flowchart LR
166
+ Survey[survey mode] --> Reports[write site reports]
167
+ Reports --> Review[human review]
168
+ Review --> Excavate[excavate mode: mock patches]
169
+ Review --> Restore[restore mode: approved changes]
170
+ Restore --> Verify[verify phase]
171
+ Verify -->|pass| Next[next expedition]
172
+ Verify -->|fail| Revert[revert phase and stop]
173
+ ```
65
174
 
66
- ## Expedition Order (Fixed)
175
+ - `survey` is the default and writes reports only.
176
+ - `restore` modifies code and should run only after reports are reviewed.
177
+ - `.archaeology/` is local runtime state and should not be committed.
178
+ - Work is isolated to a configurable branch, `refactor/archaeology` by default.
179
+ - Tests and type checks gate each restore phase.
180
+ - Failed restore phases are reverted before the next expedition can proceed.
181
+ - Try/catch blocks around I/O and external input boundaries are never removed automatically.
67
182
 
68
- The expeditions MUST run in this order due to stratigraphic dependencies:
183
+ ## Commands
184
+
185
+ ### OpenCode
186
+
187
+ | Command | Purpose | File changes |
188
+ | --- | --- | --- |
189
+ | `/code-archaeology` | Run the full 10-phase survey chain without per-phase prompts. | None outside `.archaeology/`. |
190
+ | `/code-archaeology-survey` | Generate site reports for review. | None outside `.archaeology/`. |
191
+ | `/code-archaeology-excavate` | Generate reports and mock patches. | None outside `.archaeology/patches/`. |
192
+ | `/code-archaeology-restore` | Apply approved high-confidence changes. | Yes, test-gated. |
193
+
194
+ ### Hermes Agent
195
+
196
+ | OpenCode Equivalent | Hermes Mechanism | File changes |
197
+ | --- | --- | --- |
198
+ | `/code-archaeology` | `cronjob` runs expedition loop | Depends on mode |
199
+ | `/code-archaeology-survey` | `mode = "survey"` in `session.json` | None outside `.archaeology/` |
200
+ | `/code-archaeology-excavate` | `mode = "excavate"` in `session.json` | None outside `.archaeology/patches/` |
201
+ | `/code-archaeology-restore` | `mode = "restore"` in `session.json` | Yes, test-gated |
202
+
203
+ ## Parameters
204
+
205
+ | Parameter | Default | Description | Hermes Notes |
206
+ | --- | --- | --- | --- |
207
+ | `repo_path` | `.` | Target repository to excavate. | Set in `session.json` before first cron run. |
208
+ | `language` | `typescript` | Primary language for tooling selection. | Same |
209
+ | `mode` | `survey` | `survey`, `excavate`, or `restore`. | Change in `session.json` to switch modes. |
210
+ | `strict_mode` | `false` | When true, restore may also apply medium-confidence findings. | Same |
211
+ | `test_command` | `npm test` | Recorded session default only; verification hooks do not execute repository-local command values. Use `CODE_ARCHAEOLOGY_TEST_COMMAND` to approve an override for the current process. | Same |
212
+ | `typecheck_command` | `npx tsc --noEmit` | Recorded session default only; verification hooks do not execute repository-local command values. Use `CODE_ARCHAEOLOGY_TYPECHECK_COMMAND` to approve an override for the current process. | Same |
213
+ | `branch_name` | `refactor/archaeology` | Branch used for isolated restore work. | Same |
214
+
215
+ ## Expedition Order
216
+
217
+ The expedition order is fixed because each layer depends on the previous excavation:
69
218
 
70
219
  1. Site Survey & Baseline
71
220
  2. Dead Code Excavation
@@ -78,51 +227,86 @@ The expeditions MUST run in this order due to stratigraphic dependencies:
78
227
  9. Artifact Cleaning & Documentation
79
228
  10. Site Preservation & Final Catalog
80
229
 
81
- **Why this order?** You cannot consolidate types before removing dead code (you might catalog code that should be discarded). You cannot DRY before untangling cycles (abstractions over cyclic deps create worse stratification).
230
+ Do not consolidate types before dead code and legacy removal. Do not DRY code before dependency cycles are mapped.
82
231
 
83
- ## Language-Specific Tooling
232
+ ## Language Tooling
84
233
 
85
234
  | Language | Dead Code | Dependencies | Types | DRY |
86
- |----------|-----------|--------------|-------|-----|
87
- | TypeScript | `knip`, `unimported` | `madge` | `tsc` | `jscpd` |
88
- | JavaScript | `knip`, `depcheck` | `madge` | N/A | `jscpd` |
235
+ | --- | --- | --- | --- | --- |
236
+ | TypeScript | `knip` | `madge` | `tsc` | `jscpd` |
237
+ | JavaScript | `knip` | `madge` | N/A | `jscpd` |
89
238
  | Python | `vulture` | `pydeps` | `mypy` | `pylint` |
90
- | Go | `deadcode`, `staticcheck` | `godepgraph` | `go vet` | `golangci-lint` |
91
- | Rust | `cargo-udeps`, `rustc` | `cargo-deps` | `rustc` | `clippy` |
239
+ | Go | `deadcode` | `godepgraph` | `go vet` | `golangci-lint` |
240
+ | Rust | `cargo-udeps` | `cargo-deps` | `rustc` | `clippy` |
92
241
 
93
- If tools are missing, the skill falls back to AST-based manual analysis.
242
+ If a preferred tool is missing, Code Archaeology falls back to AST-based manual analysis and flags uncertain findings for human review.
94
243
 
95
244
  ## Architecture
96
245
 
97
- ```
246
+ ```text
98
247
  Code-Archaeology/
99
- ├── src/ # TypeScript source (plugin entry, types)
100
- ├── plugins/ # OpenCode plugin entry point
101
- ├── skills/ # Agent skill definitions (SKILL.md)
102
- ├── commands/ # CLI command documentation
103
- ├── hooks/ # Shell scripts for expedition workflow
104
- ├── prompts/ # Detailed expedition prompts
105
- ├── schema/ # JSON schemas for reports
106
- ├── AGENTS.md # Agent runtime guide
107
- └── README.md # This file
248
+ |-- assets/ # README and repository visual assets
249
+ |-- commands/ # OpenCode slash command definitions
250
+ |-- dist/ # Built package output for GitHub-based installs
251
+ |-- docs/ # Public docs and release notes
252
+ |-- hooks/opencode/ # Init, verification, revert, and status hooks
253
+ |-- hooks/hermes/ # Setup and runner hooks for Hermes Agent
254
+ |-- plugins/ # Repo-local legacy plugin shim
255
+ |-- prompts/ # Expedition prompts by phase
256
+ |-- schema/ # JSON schemas for reports
257
+ |-- skills/ # Code Archaeology skill definitions
258
+ | |-- code-archaeology/ # OpenCode skill
259
+ | `-- hermes/ # Hermes Agent skill and integration docs
260
+ |-- src/ # TypeScript source
261
+ |-- INSTALL.md # Multi-runtime install handoff
262
+ |-- README.md # Public project overview
263
+ `-- AGENTS.md # Agent runtime guide
108
264
  ```
109
265
 
110
- ## Development
266
+ ## Runtime Artifacts
267
+
268
+ All expedition state is written to `.archaeology/` inside the target repository:
269
+
270
+ | Artifact | Purpose |
271
+ | --- | --- |
272
+ | `session.json` | Current expedition progress and configuration. |
273
+ | `site_survey.md` | Baseline inventory and stratum graph. |
274
+ | `expedition1-report.md` through `expedition8-report.md` | Per-expedition findings. |
275
+ | `FINAL_CATALOG.md` | Final excavation summary and recommendations. |
276
+ | `excavation_log.txt` | `git diff --stat` for applied restoration work. |
277
+ | `patches/` | Mock patches generated by `excavate` mode. |
278
+ | `hermes-runtime.json` | Hermes runtime configuration (Hermes only). |
279
+
280
+ ## Local Testing
281
+
282
+ For plugin development:
111
283
 
112
284
  ```bash
113
- # Install dependencies
114
285
  npm install
115
-
116
- # Build
117
286
  npm run build
118
-
119
- # Type check
120
287
  npm run typecheck
288
+ npm pack --json --dry-run
289
+ bash -n hooks/opencode/*.sh
290
+ bash -n hooks/hermes/*.sh
291
+ ```
121
292
 
122
- # Verify package
123
- npm run verify:pack
293
+ For a restore expedition, run the configured test and type-check commands between phases. The bundled verification hooks are:
294
+
295
+ ```bash
296
+ # OpenCode
297
+ bash hooks/opencode/verify-phase.sh final_verify
298
+
299
+ # Hermes
300
+ bash hooks/hermes/runner.sh
124
301
  ```
125
302
 
303
+ ## Release Docs
304
+
305
+ - [`docs/README.md`](docs/README.md) is the documentation landing page.
306
+ - [`docs/RELEASE.md`](docs/RELEASE.md) covers release preparation and publishing.
307
+ - [`INSTALL.md`](INSTALL.md) is the raw handoff for multi-runtime installation.
308
+ - [GitHub Releases](https://github.com/Maleick/Code-Archaeology/releases) lists published versions.
309
+
126
310
  ## License
127
311
 
128
- MIT
312
+ MIT. See [`LICENSE`](LICENSE).
package/SECURITY.md ADDED
@@ -0,0 +1,20 @@
1
+ # Security Policy
2
+
3
+ ## Reporting A Vulnerability
4
+
5
+ Please report suspected vulnerabilities through a GitHub private security advisory for this repository. Do not open a public issue for vulnerabilities, secrets, private repository contents, or exploit details.
6
+
7
+ Include the affected version or commit, a concise reproduction, expected impact, and any relevant sanitized logs. A maintainer will review the advisory and coordinate a fix before public disclosure.
8
+
9
+ ## Safety Model
10
+
11
+ Code Archaeology is designed to inspect and improve repositories without surprising users:
12
+
13
+ - `survey` is the default mode and produces reports without changing project files.
14
+ - `excavate` produces reports and mock patches without applying changes.
15
+ - `restore` can modify code only after review and should be run with tests or type checks available.
16
+ - Failed restore phases should be reverted before continuing.
17
+ - Runtime state is written to `.archaeology/` and should remain ignored and local.
18
+ - Documentation and examples must not include secrets, tokens, credentials, or private code.
19
+
20
+ The plugin must not remove try/catch blocks around I/O or external input boundaries automatically, and uncertain type replacements should be flagged for human review.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.2.0
@@ -0,0 +1,195 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 460" width="1200" height="460" role="img" aria-labelledby="title desc">
2
+ <title id="title">Code Archaeology — Multi-runtime Plugin</title>
3
+ <desc id="desc">Dark-themed archaeological excavation banner showing code strata layers, dual runtime badges for OpenCode and Hermes, and a 10-phase expedition indicator.</desc>
4
+
5
+ <defs>
6
+ <!-- Background gradient -->
7
+ <linearGradient id="bgGrad" x1="0" y1="0" x2="0" y2="1">
8
+ <stop offset="0" stop-color="#0b1020"/>
9
+ <stop offset="1" stop-color="#1e293b"/>
10
+ </linearGradient>
11
+
12
+ <!-- Strata gradients -->
13
+ <linearGradient id="surfaceGrad" x1="0" y1="0" x2="1" y2="0">
14
+ <stop offset="0" stop-color="#334155"/>
15
+ <stop offset="1" stop-color="#475569"/>
16
+ </linearGradient>
17
+ <linearGradient id="legacyGrad" x1="0" y1="0" x2="1" y2="0">
18
+ <stop offset="0" stop-color="#78350f"/>
19
+ <stop offset="1" stop-color="#92400e"/>
20
+ </linearGradient>
21
+ <linearGradient id="bedrockGrad" x1="0" y1="0" x2="1" y2="0">
22
+ <stop offset="0" stop-color="#1e1b4b"/>
23
+ <stop offset="1" stop-color="#312e81"/>
24
+ </linearGradient>
25
+
26
+ <!-- Glow filter for accents -->
27
+ <filter id="glow" x="-30%" y="-30%" width="160%" height="160%">
28
+ <feGaussianBlur stdDeviation="3" result="blur"/>
29
+ <feMerge>
30
+ <feMergeNode in="blur"/>
31
+ <feMergeNode in="SourceGraphic"/>
32
+ </feMerge>
33
+ </filter>
34
+
35
+ <!-- Subtle grid pattern -->
36
+ <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
37
+ <path d="M 40 0 L 0 0 0 40" fill="none" stroke="#1e293b" stroke-width="0.5" opacity="0.3"/>
38
+ </pattern>
39
+ </defs>
40
+
41
+ <!-- Background -->
42
+ <rect width="1200" height="460" fill="url(#bgGrad)"/>
43
+ <rect width="1200" height="460" fill="url(#grid)"/>
44
+
45
+ <!-- Geological strata layers (left side, showing code layers) -->
46
+ <g transform="translate(60, 80)">
47
+ <!-- Surface layer -->
48
+ <path d="M0 0 L280 0 L260 55 L20 55 Z" fill="url(#surfaceGrad)" stroke="#64748b" stroke-width="1.5"/>
49
+ <text x="140" y="35" text-anchor="middle" font-family="SFMono-Regular, Consolas, monospace" font-size="14" fill="#94a3b8">Surface // Active Code</text>
50
+
51
+ <!-- Legacy layer -->
52
+ <path d="M20 55 L260 55 L240 115 L40 115 Z" fill="url(#legacyGrad)" stroke="#f97316" stroke-width="1.5" opacity="0.85"/>
53
+ <text x="140" y="92" text-anchor="middle" font-family="SFMono-Regular, Consolas, monospace" font-size="14" fill="#fdba74">Legacy // Deprecated Shims</text>
54
+
55
+ <!-- Bedrock layer -->
56
+ <path d="M40 115 L240 115 L220 180 L60 180 Z" fill="url(#bedrockGrad)" stroke="#6366f1" stroke-width="1.5" opacity="0.9"/>
57
+ <text x="140" y="155" text-anchor="middle" font-family="SFMono-Regular, Consolas, monospace" font-size="14" fill="#a5b4fc">Bedrock // Core Types</text>
58
+
59
+ <!-- Stratum divider lines -->
60
+ <line x1="290" y1="27" x2="340" y2="27" stroke="#64748b" stroke-width="1" stroke-dasharray="4 3"/>
61
+ <line x1="270" y1="85" x2="340" y2="85" stroke="#f97316" stroke-width="1" stroke-dasharray="4 3"/>
62
+ <line x1="250" y1="147" x2="340" y2="147" stroke="#6366f1" stroke-width="1" stroke-dasharray="4 3"/>
63
+ </g>
64
+
65
+ <!-- Archaeologist / excavation tools (right side) -->
66
+ <g transform="translate(980, 70)">
67
+ <!-- Brush -->
68
+ <rect x="15" y="0" width="12" height="70" rx="3" fill="#78350f" opacity="0.9"/>
69
+ <rect x="10" y="65" width="22" height="35" rx="4" fill="#d97706" opacity="0.9"/>
70
+ <line x1="21" y1="100" x2="21" y2="130" stroke="#d97706" stroke-width="3" stroke-linecap="round"/>
71
+
72
+ <!-- Trowel -->
73
+ <path d="M60 20 L75 20 L85 80 L50 80 Z" fill="#475569" stroke="#94a3b8" stroke-width="1.5"/>
74
+ <line x1="67" y1="80" x2="67" y2="130" stroke="#64748b" stroke-width="4" stroke-linecap="round"/>
75
+
76
+ <!-- Small artifacts / code fragments -->
77
+ <text x="-30" y="160" font-family="SFMono-Regular, Consolas, monospace" font-size="11" fill="#fbbf24" opacity="0.7">{ }</text>
78
+ <text x="10" y="175" font-family="SFMono-Regular, Consolas, monospace" font-size="10" fill="#f97316" opacity="0.6">// TODO</text>
79
+ <text x="45" y="155" font-family="SFMono-Regular, Consolas, monospace" font-size="9" fill="#a5b4fc" opacity="0.5">fn main()</text>
80
+ </g>
81
+
82
+ <!-- Wordmark -->
83
+ <g transform="translate(420, 105)">
84
+ <text x="0" y="0" font-family="Inter, Segoe UI, Arial, sans-serif" font-size="56" font-weight="900" fill="#f8fafc" letter-spacing="-1">Code Archaeology</text>
85
+ <text x="2" y="42" font-family="Inter, Segoe UI, Arial, sans-serif" font-size="20" font-weight="600" fill="#fbbf24">Excavate technical debt. Restore with confidence.</text>
86
+ </g>
87
+
88
+ <!-- Runtime badges -->
89
+ <g transform="translate(420, 185)">
90
+ <!-- OpenCode badge -->
91
+ <rect x="0" y="0" width="130" height="32" rx="8" fill="#0f172a" stroke="#38bdf8" stroke-width="1.5"/>
92
+ <circle cx="20" cy="16" r="5" fill="#38bdf8"/>
93
+ <text x="34" y="21" font-family="SFMono-Regular, Consolas, monospace" font-size="13" fill="#e0f2fe" font-weight="600">OpenCode</text>
94
+
95
+ <!-- Hermes badge -->
96
+ <rect x="150" y="0" width="120" height="32" rx="8" fill="#0f172a" stroke="#a78bfa" stroke-width="1.5"/>
97
+ <circle cx="170" cy="16" r="5" fill="#a78bfa"/>
98
+ <text x="184" y="21" font-family="SFMono-Regular, Consolas, monospace" font-size="13" fill="#ede9fe" font-weight="600">Hermes</text>
99
+
100
+ <!-- Multi-runtime label -->
101
+ <text x="290" y="21" font-family="Inter, Segoe UI, Arial, sans-serif" font-size="14" fill="#94a3b8" font-weight="500">Multi-runtime plugin</text>
102
+ </g>
103
+
104
+ <!-- 10-phase indicator -->
105
+ <g transform="translate(420, 255)">
106
+ <text x="0" y="-10" font-family="Inter, Segoe UI, Arial, sans-serif" font-size="12" fill="#64748b" font-weight="600" letter-spacing="2">10-PHASE EXPEDITION</text>
107
+
108
+ <!-- Phase boxes 1-10 -->
109
+ <g font-family="SFMono-Regular, Consolas, monospace" font-size="11" font-weight="700">
110
+ <!-- Phase 1 -->
111
+ <rect x="0" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#38bdf8" stroke-width="1.5"/>
112
+ <text x="18" y="19" text-anchor="middle" fill="#e0f2fe">1</text>
113
+ <!-- Arrow -->
114
+ <text x="42" y="19" fill="#475569">→</text>
115
+
116
+ <!-- Phase 2 -->
117
+ <rect x="56" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#38bdf8" stroke-width="1.5"/>
118
+ <text x="74" y="19" text-anchor="middle" fill="#e0f2fe">2</text>
119
+ <text x="98" y="19" fill="#475569">→</text>
120
+
121
+ <!-- Phase 3 -->
122
+ <rect x="112" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#38bdf8" stroke-width="1.5"/>
123
+ <text x="130" y="19" text-anchor="middle" fill="#e0f2fe">3</text>
124
+ <text x="154" y="19" fill="#475569">→</text>
125
+
126
+ <!-- Phase 4 -->
127
+ <rect x="168" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#38bdf8" stroke-width="1.5"/>
128
+ <text x="186" y="19" text-anchor="middle" fill="#e0f2fe">4</text>
129
+ <text x="210" y="19" fill="#475569">→</text>
130
+
131
+ <!-- Phase 5 -->
132
+ <rect x="224" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#fbbf24" stroke-width="1.5"/>
133
+ <text x="242" y="19" text-anchor="middle" fill="#fef3c7">5</text>
134
+ <text x="266" y="19" fill="#475569">→</text>
135
+
136
+ <!-- Phase 6 -->
137
+ <rect x="280" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#fbbf24" stroke-width="1.5"/>
138
+ <text x="298" y="19" text-anchor="middle" fill="#fef3c7">6</text>
139
+ <text x="322" y="19" fill="#475569">→</text>
140
+
141
+ <!-- Phase 7 -->
142
+ <rect x="336" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#f97316" stroke-width="1.5"/>
143
+ <text x="354" y="19" text-anchor="middle" fill="#ffedd5">7</text>
144
+ <text x="378" y="19" fill="#475569">→</text>
145
+
146
+ <!-- Phase 8 -->
147
+ <rect x="392" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#f97316" stroke-width="1.5"/>
148
+ <text x="410" y="19" text-anchor="middle" fill="#ffedd5">8</text>
149
+ <text x="434" y="19" fill="#475569">→</text>
150
+
151
+ <!-- Phase 9 -->
152
+ <rect x="448" y="0" width="36" height="28" rx="5" fill="#0f172a" stroke="#a78bfa" stroke-width="1.5"/>
153
+ <text x="466" y="19" text-anchor="middle" fill="#ede9fe">9</text>
154
+ <text x="490" y="19" fill="#475569">→</text>
155
+
156
+ <!-- Phase 10 -->
157
+ <rect x="504" y="0" width="42" height="28" rx="5" fill="#0f172a" stroke="#a78bfa" stroke-width="1.5"/>
158
+ <text x="525" y="19" text-anchor="middle" fill="#ede9fe">10</text>
159
+ </g>
160
+ </g>
161
+
162
+ <!-- Bottom info bar -->
163
+ <g transform="translate(420, 340)">
164
+ <rect x="0" y="0" width="560" height="42" rx="10" fill="#020617" opacity="0.72" stroke="#334155" stroke-width="1"/>
165
+ <text x="20" y="26" font-family="SFMono-Regular, Consolas, monospace" font-size="13" fill="#94a3b8">survey · excavate · restore · verify · dead code · legacy · cycles · types · DRY · errors</text>
166
+ </g>
167
+
168
+ <!-- Decorative particles / dust motes -->
169
+ <g opacity="0.4" fill="#fbbf24">
170
+ <circle cx="1100" cy="60" r="2"/>
171
+ <circle cx="1150" cy="120" r="1.5"/>
172
+ <circle cx="1080" cy="200" r="2.5"/>
173
+ <circle cx="1120" cy="280" r="1.8"/>
174
+ <circle cx="1160" cy="350" r="2"/>
175
+ <circle cx="1090" cy="400" r="1.5"/>
176
+ <circle cx="1140" cy="430" r="2"/>
177
+ </g>
178
+
179
+ <!-- Subtle excavation grid markers -->
180
+ <g opacity="0.15" stroke="#fbbf24" stroke-width="1" fill="none">
181
+ <rect x="50" y="70" width="300" height="200" rx="4"/>
182
+ <line x1="50" y1="130" x2="350" y2="130"/>
183
+ <line x1="50" y1="190" x2="350" y2="190"/>
184
+ <line x1="150" y1="70" x2="150" y2="270"/>
185
+ <line x1="250" y1="70" x2="250" y2="270"/>
186
+ </g>
187
+
188
+ <!-- Corner accent lines -->
189
+ <g opacity="0.3" stroke="#f97316" stroke-width="2" fill="none">
190
+ <path d="M0 0 L60 0 L0 60 Z" fill="#f97316" opacity="0.05"/>
191
+ <path d="M1140 0 L1200 0 L1200 60 Z" fill="#f97316" opacity="0.05"/>
192
+ <path d="M0 400 L0 460 L60 460 Z" fill="#f97316" opacity="0.05"/>
193
+ <path d="M1140 460 L1200 460 L1200 400 Z" fill="#f97316" opacity="0.05"/>
194
+ </g>
195
+ </svg>
@@ -13,6 +13,8 @@ trigger:
13
13
 
14
14
  Excavate, catalog, and restore a codebase by removing accumulated sediment: dead code, legacy fallbacks, circular dependencies, weak types, and defensive programming slop. Produces human-reviewable site reports before any artifacts are disturbed. Non-destructive by default.
15
15
 
16
+ By default, `/code-archaeology` runs the full 10-phase survey chain without stopping for a prompt between phases. It generates the complete report set in `.archaeology/` and makes zero source-code changes. To apply changes after review, use `/code-archaeology-restore` explicitly.
17
+
16
18
  ## Quick Start
17
19
 
18
20
  ```
@@ -36,7 +38,7 @@ Run: /code-archaeology
36
38
 
37
39
  | Command | Description |
38
40
  |---------|-------------|
39
- | `/code-archaeology` | Start full expedition (default: survey mode) |
41
+ | `/code-archaeology` | Run the full 10-phase survey chain without per-phase prompts |
40
42
  | `/code-archaeology-survey` | Site survey only — zero file changes |
41
43
  | `/code-archaeology-excavate` | Generate reports + mock patches for review |
42
44
  | `/code-archaeology-restore` | Execute approved changes after review |
@@ -49,8 +51,8 @@ Run: /code-archaeology
49
51
  | `language` | `typescript` | Primary language |
50
52
  | `mode` | `survey` | `survey`, `excavate`, or `restore` |
51
53
  | `strict_mode` | `false` | Auto-restore medium-confidence findings |
52
- | `test_command` | `npm test` | Test runner command |
53
- | `typecheck_command` | `npx tsc --noEmit` | Type check command |
54
+ | `test_command` | `npm test` | Recorded session default only; verification uses `CODE_ARCHAEOLOGY_TEST_COMMAND` for operator-approved overrides |
55
+ | `typecheck_command` | `npx tsc --noEmit` | Recorded session default only; verification uses `CODE_ARCHAEOLOGY_TYPECHECK_COMMAND` for operator-approved overrides |
54
56
  | `branch_name` | `refactor/archaeology` | Git branch to create |
55
57
 
56
58
  ## Requirements
@@ -62,9 +64,9 @@ Run: /code-archaeology
62
64
 
63
65
  ## Safety
64
66
 
65
- - **Survey mode (default)**: Zero file changes. Only reports generated.
67
+ - **Survey mode (default)**: Zero file changes. Runs every phase and generates the full report set.
66
68
  - **Excavate mode**: Mock patches for human review. No actual modifications.
67
- - **Restore mode**: Applies approved changes. Always runs tests between phases.
69
+ - **Restore mode**: Applies approved changes only when explicitly requested with `/code-archaeology-restore`. Always runs tests between phases.
68
70
  - **Branch isolation**: All work happens on `refactor/archaeology` (configurable).
69
71
  - **Test gating**: Any phase that breaks tests is automatically reverted.
70
72
 
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map