opencode-code-archaeology 2.0.2 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +42 -10
- package/CHANGELOG.md +66 -0
- package/CONTRIBUTING.md +2 -0
- package/INSTALL.md +90 -20
- package/README.md +90 -29
- package/VERSION +1 -1
- package/assets/code-archaeology-banner.svg +173 -44
- package/commands/code-archaeology.md +7 -5
- package/dist/cli.js +28 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -17
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts +4 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +11 -0
- package/dist/platform.js.map +1 -0
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +2 -1
- package/dist/plugin.js.map +1 -1
- package/dist/runtime.d.ts +18 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +49 -0
- package/dist/runtime.js.map +1 -0
- package/dist/types.d.ts +1 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/ARCHITECTURE.md +41 -10
- package/docs/INSTALL.md +50 -11
- package/docs/README.md +37 -9
- package/docs/RELEASE.md +20 -16
- package/docs/index.html +740 -0
- package/hooks/hermes/runner.ps1 +247 -0
- package/hooks/hermes/runner.sh +262 -0
- package/hooks/hermes/setup.ps1 +41 -0
- package/hooks/hermes/setup.sh +41 -0
- package/hooks/opencode/init.ps1 +83 -0
- package/hooks/opencode/revert-phase.ps1 +12 -0
- package/hooks/opencode/revert-phase.sh +3 -8
- package/hooks/opencode/update-expedition.ps1 +51 -0
- package/hooks/opencode/verify-package.sh +1 -0
- package/hooks/opencode/verify-phase.ps1 +35 -0
- package/hooks/opencode/verify-phase.sh +7 -7
- package/hooks/shared/command-utils.ps1 +100 -0
- package/package.json +16 -3
- package/skills/code-archaeology/SKILL.md +2 -2
- package/skills/hermes/INTEGRATION.md +120 -0
- package/skills/hermes/README.md +167 -0
- package/skills/hermes/code-archaeology-prompt.md +203 -0
- package/wiki/Expedition-Workflow.md +3 -1
- package/wiki/Home.md +2 -2
- package/wiki/Installation.md +2 -0
- package/wiki/Release-Process.md +6 -6
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -63
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -48
- package/.github/pull_request_template.md +0 -26
- package/.github/workflows/ci.yml +0 -45
- package/plugins/code-archaeology.ts +0 -8
package/AGENTS.md
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
# Code Archaeology Agent Guide
|
|
2
2
|
|
|
3
|
-
Code Archaeology is
|
|
3
|
+
Code Archaeology is a multi-runtime plugin for systematic codebase excavation, cataloging, and restoration. It supports both **OpenCode** and **Hermes Agent** runtimes.
|
|
4
4
|
|
|
5
5
|
## Runtime Policy
|
|
6
6
|
|
|
7
|
-
- OpenCode is the
|
|
7
|
+
- **OpenCode** is the primary interactive runtime (slash commands).
|
|
8
|
+
- **Hermes Agent** is the cron-based background runtime (one phase per 15-minute run).
|
|
8
9
|
- The plugin operates entirely within the target repository.
|
|
9
10
|
- All changes are isolated to a configurable branch (`refactor/archaeology` by default).
|
|
10
11
|
|
|
11
12
|
## Available Hooks
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
- `init.sh` — Initialize `.archaeology/` directory and session state
|
|
15
|
-
- `verify-phase.sh` — Run tests and typecheck between phases
|
|
16
|
-
- `revert-phase.sh` — Revert changes if a phase fails verification
|
|
17
|
-
- `update-expedition.sh` — Update expedition status in session.json
|
|
14
|
+
### OpenCode hooks (`hooks/opencode/`)
|
|
15
|
+
- `init.sh` / `init.ps1` — Initialize `.archaeology/` directory and session state
|
|
16
|
+
- `verify-phase.sh` / `verify-phase.ps1` — Run tests and typecheck between phases
|
|
17
|
+
- `revert-phase.sh` / `revert-phase.ps1` — Revert changes if a phase fails verification
|
|
18
|
+
- `update-expedition.sh` / `update-expedition.ps1` — Update expedition status in session.json
|
|
19
|
+
|
|
20
|
+
### Hermes hooks (`hooks/hermes/`)
|
|
21
|
+
- `setup.sh` / `setup.ps1` — Detect Hermes capabilities and write `hermes-runtime.json`
|
|
22
|
+
- `runner.sh` / `runner.ps1` — Execute one expedition phase per cron run with test gates
|
|
23
|
+
|
|
24
|
+
**Platform support:** `.sh` scripts run on macOS/Linux; `.ps1` scripts run on Windows (PowerShell).
|
|
18
25
|
|
|
19
26
|
## Safety Hooks
|
|
20
27
|
|
|
21
|
-
- `verify-phase.sh` — Mandatory test/typecheck gate between expeditions
|
|
22
|
-
- `revert-phase.sh` — Automatic rollback on failure
|
|
28
|
+
- `verify-phase.sh` — Mandatory test/typecheck gate between expeditions (OpenCode)
|
|
29
|
+
- `revert-phase.sh` — Automatic rollback on failure (OpenCode)
|
|
30
|
+
- `runner.sh` — Built-in pre/post verification and auto-revert (Hermes)
|
|
23
31
|
|
|
24
|
-
## Workflow
|
|
32
|
+
## OpenCode Workflow
|
|
25
33
|
|
|
26
34
|
1. Run `hooks/opencode/init.sh` to initialize the session
|
|
27
35
|
2. For each expedition:
|
|
@@ -31,6 +39,19 @@ Core hooks in `hooks/opencode/`:
|
|
|
31
39
|
d. Run `hooks/opencode/update-expedition.sh <phase> <status> [findings]`
|
|
32
40
|
3. Final verification runs all checks and generates `FINAL_CATALOG.md`
|
|
33
41
|
|
|
42
|
+
## Hermes Workflow
|
|
43
|
+
|
|
44
|
+
1. Run `hooks/hermes/setup.sh` to detect Hermes capabilities
|
|
45
|
+
2. Create a Hermes cronjob (see `skills/hermes/INTEGRATION.md`)
|
|
46
|
+
3. Each cron run executes **exactly ONE** phase:
|
|
47
|
+
a. Read `.archaeology/session.json` for current phase and mode
|
|
48
|
+
b. Run the phase (survey, excavate, or restore)
|
|
49
|
+
c. Run test/typecheck verification
|
|
50
|
+
d. Keep or revert changes automatically
|
|
51
|
+
e. Advance to next phase in `session.json`
|
|
52
|
+
f. **STOP** — next cron run continues
|
|
53
|
+
4. After 10 phases, `FINAL_CATALOG.md` is generated
|
|
54
|
+
|
|
34
55
|
## Local State
|
|
35
56
|
|
|
36
57
|
`.archaeology/` is runtime state and must not be committed.
|
|
@@ -42,6 +63,7 @@ Key files:
|
|
|
42
63
|
- `FINAL_CATALOG.md` — Completed excavation summary
|
|
43
64
|
- `excavation_log.txt` — `git diff --stat`
|
|
44
65
|
- `patches/` — Mock patches (excavate mode)
|
|
66
|
+
- `hermes-runtime.json` — Hermes runtime configuration (Hermes only)
|
|
45
67
|
|
|
46
68
|
## Modes
|
|
47
69
|
|
|
@@ -63,6 +85,8 @@ Key files:
|
|
|
63
85
|
|
|
64
86
|
## Verification
|
|
65
87
|
|
|
88
|
+
### OpenCode
|
|
89
|
+
|
|
66
90
|
Before claiming work is complete:
|
|
67
91
|
|
|
68
92
|
```bash
|
|
@@ -70,6 +94,14 @@ bash hooks/opencode/verify-phase.sh final_verify
|
|
|
70
94
|
bash -n hooks/opencode/*.sh
|
|
71
95
|
```
|
|
72
96
|
|
|
97
|
+
### Hermes
|
|
98
|
+
|
|
99
|
+
Verification is built into `runner.sh`:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
bash hooks/hermes/runner.sh
|
|
103
|
+
```
|
|
104
|
+
|
|
73
105
|
## Language Support
|
|
74
106
|
|
|
75
107
|
| Language | Dead Code | Dependencies | Types | DRY |
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
|
+
## [2.2.1](https://github.com/Maleick/Code-Archaeology/compare/v2.2.0...v2.2.1) (2026-05-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* opt actions into Node 24 runtime ([#14](https://github.com/Maleick/Code-Archaeology/issues/14)) ([1d2b797](https://github.com/Maleick/Code-Archaeology/commit/1d2b797c629ba0c3a7b9245cb596e3fac2c42cd7))
|
|
7
|
+
|
|
8
|
+
# [2.2.0](https://github.com/Maleick/Code-Archaeology/compare/v2.1.0...v2.2.0) (2026-05-07)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* avoid session-sourced verification commands ([#10](https://github.com/Maleick/Code-Archaeology/issues/10)) ([9d3296d](https://github.com/Maleick/Code-Archaeology/commit/9d3296d1551ed7c97b90aca5c4be932bad5042e6))
|
|
14
|
+
* harden PowerShell verification hooks ([#6](https://github.com/Maleick/Code-Archaeology/issues/6)) ([ae1c1fa](https://github.com/Maleick/Code-Archaeology/commit/ae1c1fab3b1ce84872ad8217959d321e8e42266b))
|
|
15
|
+
* harden trusted publishing safety ([c78ee2e](https://github.com/Maleick/Code-Archaeology/commit/c78ee2e9bc75ff6554e75f848f64a3054a74344e))
|
|
16
|
+
* **hermes:** require operator approval for restore mode ([#8](https://github.com/Maleick/Code-Archaeology/issues/8)) ([772cd67](https://github.com/Maleick/Code-Archaeology/commit/772cd67df32f853c562fe8ed46f6d1528b477fda))
|
|
17
|
+
* only set completed_at when status is completed ([ebf1040](https://github.com/Maleick/Code-Archaeology/commit/ebf1040fb8a4a9ff23a40d6fa6042313e590b363))
|
|
18
|
+
* pass model router args safely ([#11](https://github.com/Maleick/Code-Archaeology/issues/11)) ([a7379fc](https://github.com/Maleick/Code-Archaeology/commit/a7379fcf425eab70f2906de75f0a158e7d418e85))
|
|
19
|
+
* secure Hermes session rewrites ([#7](https://github.com/Maleick/Code-Archaeology/issues/7)) ([55d5694](https://github.com/Maleick/Code-Archaeology/commit/55d5694684158d1ae471fed25b4f8de0706c7810))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* Add Windows/PowerShell support ([a6b74ea](https://github.com/Maleick/Code-Archaeology/commit/a6b74ea75c1eb60263e939df3dc27fa4cc8b7a72)), closes [#4](https://github.com/Maleick/Code-Archaeology/issues/4)
|
|
25
|
+
|
|
26
|
+
# [2.1.0](https://github.com/Maleick/Code-Archaeology/compare/v2.0.2...v2.1.0) (2026-05-05)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* align analysis tool types ([65b19b2](https://github.com/Maleick/Code-Archaeology/commit/65b19b2b581c2e3f196f3d53886fd8dfdab23ea2))
|
|
32
|
+
* block invalid Hermes sessions ([aaafd4f](https://github.com/Maleick/Code-Archaeology/commit/aaafd4f0a0d6652ae92b5513caa13b2fabcab06e))
|
|
33
|
+
* harden Hermes install checks ([bc034cc](https://github.com/Maleick/Code-Archaeology/commit/bc034cca6cb8af88287cc3656cd72adf8a4246c1))
|
|
34
|
+
* remove embedded worktree and ignore .autoship/ ([400b554](https://github.com/Maleick/Code-Archaeology/commit/400b55452f96f604074d73f6eea79cf996a91aad))
|
|
35
|
+
* remove stale PluginServer stub ([#3](https://github.com/Maleick/Code-Archaeology/issues/3)) ([f8b15a3](https://github.com/Maleick/Code-Archaeology/commit/f8b15a306f55cfa6e036cc05e115357ec68df023)), closes [#2](https://github.com/Maleick/Code-Archaeology/issues/2)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
* **hermes:** add full Hermes Agent runtime support ([2f4ad41](https://github.com/Maleick/Code-Archaeology/commit/2f4ad41060994802c1fb3c5a480e88728838130b)), closes [#hermes-support](https://github.com/Maleick/Code-Archaeology/issues/hermes-support) [#multi-runtime](https://github.com/Maleick/Code-Archaeology/issues/multi-runtime)
|
|
41
|
+
* prepare v2.1.0 release ([54507d4](https://github.com/Maleick/Code-Archaeology/commit/54507d423b421535116363be86fbcba30b161d9e))
|
|
42
|
+
* **routing:** add intelligent model routing for free-tier priority ([a456556](https://github.com/Maleick/Code-Archaeology/commit/a45655602106933de64a0af5b63e18e6378847d7))
|
|
43
|
+
|
|
1
44
|
# Changelog
|
|
2
45
|
|
|
46
|
+
## Unreleased
|
|
47
|
+
|
|
48
|
+
- Switched release publishing to npm trusted publishing with GitHub Actions OIDC.
|
|
49
|
+
- Hardened Hermes restore mode so it blocks explicitly until implemented instead of reporting a successful no-op restore.
|
|
50
|
+
- Changed OpenCode revert handling to preserve failed phase changes in a named git stash instead of dropping them.
|
|
51
|
+
- Exposed public type definitions through package exports and excluded the repo-local legacy plugin shim from npm package contents.
|
|
52
|
+
|
|
53
|
+
## v2.1.0
|
|
54
|
+
|
|
55
|
+
- Changed `/code-archaeology` to run the full 10-phase survey chain by default without per-phase prompts.
|
|
56
|
+
- Kept the default OpenCode flow non-destructive: survey mode writes report artifacts under `.archaeology/` only.
|
|
57
|
+
- Clarified that `/code-archaeology-restore` remains the explicit command for applying source changes.
|
|
58
|
+
- Updated command, CLI, plugin, and release tests for the new default survey-chain behavior.
|
|
59
|
+
|
|
60
|
+
## v2.0.3
|
|
61
|
+
|
|
62
|
+
- Hardened Hermes runner startup so clean repositories initialize `.archaeology/session.json` without requiring prior setup.
|
|
63
|
+
- Added clear blocked-state handling for malformed Hermes session phases instead of allowing low-level `jq` failures.
|
|
64
|
+
- Added invalid JSON protection for Hermes session files so corrupted state is reported without being overwritten.
|
|
65
|
+
- Expanded CLI `doctor` checks and tests to verify Hermes hooks and integration docs are packaged alongside OpenCode assets.
|
|
66
|
+
- Aligned the exported analysis-tool type contract with the documented TypeScript, JavaScript, Python, Go, and Rust tool matrix.
|
|
67
|
+
- Updated install documentation to cover Hermes verification and troubleshooting parity with OpenCode.
|
|
68
|
+
|
|
3
69
|
## v2.0.2
|
|
4
70
|
|
|
5
71
|
- Added release-ready repository parity files: CI workflow, issue templates, PR template, security policy, contribution guide, and changelog.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -34,6 +34,8 @@ npm pack --json --dry-run
|
|
|
34
34
|
|
|
35
35
|
If a restore-mode change modifies behavior, verify it against a disposable repository or fixture and document the result.
|
|
36
36
|
|
|
37
|
+
Before committing, pushing, or opening a PR, run a polish pass over the changed surface. Check wording, links, visuals, accessibility, package contents, and whether the repository presentation still looks complete.
|
|
38
|
+
|
|
37
39
|
## Documentation Expectations
|
|
38
40
|
|
|
39
41
|
- Update `README.md`, `INSTALL.md`, `docs/`, or `wiki/` when installation, commands, workflow, safety, or release behavior changes.
|
package/INSTALL.md
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
# Install Code Archaeology
|
|
2
2
|
|
|
3
|
-
Code Archaeology is
|
|
3
|
+
Code Archaeology is a multi-runtime plugin for systematic codebase excavation. It is non-destructive by default: `survey` mode writes reports only, while `restore` mode modifies code after review and verification.
|
|
4
|
+
|
|
5
|
+
## Runtimes
|
|
6
|
+
|
|
7
|
+
- **OpenCode** — Interactive slash-command runtime (`/code-archaeology`)
|
|
8
|
+
- **Hermes Agent** — Cron-based background runtime (one phase per 15-minute run)
|
|
4
9
|
|
|
5
10
|
## OpenCode Handoff
|
|
6
11
|
|
|
7
12
|
Paste this into OpenCode if you want the agent to install and verify the plugin for you:
|
|
8
13
|
|
|
9
14
|
```text
|
|
10
|
-
|
|
15
|
+
Run `npm pack opencode-code-archaeology@2.2.0`, extract the resulting tarball, then open and follow `package/INSTALL.md` from that tarball. If you need a concrete command sequence: `npm pack opencode-code-archaeology@2.2.0 && tar -xof opencode-code-archaeology-2.2.0.tgz && cat package/INSTALL.md`.
|
|
11
16
|
```
|
|
12
17
|
|
|
13
18
|
## Prerequisites
|
|
14
19
|
|
|
15
|
-
-
|
|
16
|
-
- Node.js with npm, or Bun if your OpenCode setup uses Bun package resolution.
|
|
20
|
+
- Node.js with npm, or Bun if your setup uses Bun package resolution.
|
|
17
21
|
- Git installed and available in your shell.
|
|
18
22
|
- A target repository with tests or type checks available before you run `restore` mode.
|
|
23
|
+
- For Hermes: Hermes Agent CLI or an active Hermes session.
|
|
24
|
+
- **Windows**: PowerShell 5.1 or later (hooks use `.ps1` scripts on Windows).
|
|
19
25
|
|
|
20
26
|
## Recommended OpenCode Plugin Install
|
|
21
27
|
|
|
@@ -24,7 +30,7 @@ Add Code Archaeology to your `opencode.json` plugin array:
|
|
|
24
30
|
```json
|
|
25
31
|
{
|
|
26
32
|
"plugin": [
|
|
27
|
-
"opencode-code-archaeology@
|
|
33
|
+
"opencode-code-archaeology@2.2.0"
|
|
28
34
|
]
|
|
29
35
|
}
|
|
30
36
|
```
|
|
@@ -38,12 +44,48 @@ Restart OpenCode after editing the configuration. The command family should then
|
|
|
38
44
|
/code-archaeology-restore
|
|
39
45
|
```
|
|
40
46
|
|
|
47
|
+
`/code-archaeology` runs the full 10-phase survey chain by default without per-phase prompts. It writes reports under `.archaeology/` and makes no source-code changes. Use `/code-archaeology-restore` only after reviewing the reports and deciding to apply changes.
|
|
48
|
+
|
|
49
|
+
## Hermes Setup
|
|
50
|
+
|
|
51
|
+
### 1. Install Code Archaeology CLI
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install -g opencode-code-archaeology@2.2.0
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. Setup Hermes Runtime
|
|
58
|
+
|
|
59
|
+
**macOS/Linux:**
|
|
60
|
+
```bash
|
|
61
|
+
cd ~/projects/Code-Archaeology
|
|
62
|
+
bash hooks/hermes/setup.sh
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Windows:**
|
|
66
|
+
```powershell
|
|
67
|
+
cd ~/projects/Code-Archaeology
|
|
68
|
+
.\hooks\hermes\setup.ps1
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 3. Create Hermes Cronjob
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
hermes cronjob create \
|
|
75
|
+
--name "code-archaeology-expedition" \
|
|
76
|
+
--schedule "every 15m" \
|
|
77
|
+
--workdir ~/projects/Code-Archaeology \
|
|
78
|
+
--prompt "Run one Code Archaeology expedition phase. Read .archaeology/session.json, execute current phase with verification, advance to next phase."
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
See `skills/hermes/INTEGRATION.md` for full Hermes integration details.
|
|
82
|
+
|
|
41
83
|
## npm Global Install
|
|
42
84
|
|
|
43
85
|
If you prefer a global package install:
|
|
44
86
|
|
|
45
87
|
```bash
|
|
46
|
-
npm install -g opencode-code-archaeology
|
|
88
|
+
npm install -g opencode-code-archaeology@2.2.0
|
|
47
89
|
opencode-code-archaeology install
|
|
48
90
|
opencode-code-archaeology doctor
|
|
49
91
|
opencode-code-archaeology version
|
|
@@ -52,7 +94,7 @@ opencode-code-archaeology version
|
|
|
52
94
|
Then restart OpenCode and run:
|
|
53
95
|
|
|
54
96
|
```text
|
|
55
|
-
/code-archaeology
|
|
97
|
+
/code-archaeology
|
|
56
98
|
```
|
|
57
99
|
|
|
58
100
|
## One-Time Bun Path
|
|
@@ -60,8 +102,8 @@ Then restart OpenCode and run:
|
|
|
60
102
|
If your environment supports one-time package execution through Bun:
|
|
61
103
|
|
|
62
104
|
```bash
|
|
63
|
-
bunx opencode-code-archaeology install
|
|
64
|
-
bunx opencode-code-archaeology doctor
|
|
105
|
+
bunx opencode-code-archaeology@2.2.0 install
|
|
106
|
+
bunx opencode-code-archaeology@2.2.0 doctor
|
|
65
107
|
```
|
|
66
108
|
|
|
67
109
|
Use the plugin-array install for normal OpenCode usage.
|
|
@@ -83,41 +125,68 @@ npm install
|
|
|
83
125
|
npm run build
|
|
84
126
|
npm run typecheck
|
|
85
127
|
bash -n hooks/opencode/*.sh
|
|
128
|
+
bash -n hooks/hermes/*.sh
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Windows:**
|
|
132
|
+
```powershell
|
|
133
|
+
npm install
|
|
134
|
+
npm run build
|
|
135
|
+
npm run typecheck
|
|
136
|
+
Get-ChildItem hooks/opencode/*.ps1 | ForEach-Object { Get-Command $_.FullName }
|
|
137
|
+
Get-ChildItem hooks/hermes/*.ps1 | ForEach-Object { Get-Command $_.FullName }
|
|
86
138
|
```
|
|
87
139
|
|
|
88
140
|
To verify command availability, restart OpenCode in a Git repository and run:
|
|
89
141
|
|
|
90
142
|
```text
|
|
91
|
-
/code-archaeology
|
|
143
|
+
/code-archaeology
|
|
92
144
|
```
|
|
93
145
|
|
|
94
|
-
The survey should create `.archaeology/` reports without modifying source files.
|
|
146
|
+
The default survey chain should create `.archaeology/` reports without modifying source files or asking to proceed phase by phase.
|
|
95
147
|
|
|
96
148
|
## Updating
|
|
97
149
|
|
|
98
|
-
For plugin-array installs, update
|
|
150
|
+
For plugin-array installs, update by changing the package version to a reviewed npm release, then restart OpenCode. Do not point OpenCode at a mutable Git branch such as `main` for automatic updates.
|
|
99
151
|
|
|
100
152
|
For npm global installs:
|
|
101
153
|
|
|
102
154
|
```bash
|
|
103
|
-
npm install -g opencode-code-archaeology@
|
|
155
|
+
npm install -g opencode-code-archaeology@2.2.0
|
|
104
156
|
npm list -g opencode-code-archaeology --depth=0
|
|
105
157
|
```
|
|
106
158
|
|
|
107
159
|
## Troubleshooting
|
|
108
160
|
|
|
109
|
-
### Plugin Not Loading
|
|
161
|
+
### Plugin Not Loading (OpenCode)
|
|
110
162
|
|
|
111
163
|
- Confirm `opencode.json` is valid JSON.
|
|
112
164
|
- Confirm the plugin entry is in the top-level `plugin` array.
|
|
113
165
|
- Restart OpenCode after changing the config.
|
|
114
|
-
- Check that
|
|
166
|
+
- Check that npm can resolve the pinned `opencode-code-archaeology` release.
|
|
115
167
|
|
|
116
|
-
### Commands Not Found
|
|
168
|
+
### Commands Not Found (OpenCode)
|
|
117
169
|
|
|
118
170
|
- Restart OpenCode so it reloads plugin commands.
|
|
119
171
|
- Confirm the package installed successfully with `npm list -g opencode-code-archaeology --depth=0` if using the global path.
|
|
120
|
-
- Run `/code-archaeology
|
|
172
|
+
- Run `/code-archaeology` from inside a Git repository, not from an empty directory.
|
|
173
|
+
|
|
174
|
+
### Cron Not Running (Hermes)
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
hermes cronjob list
|
|
178
|
+
hermes cronjob log code-archaeology-expedition
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Phase Blocked (Hermes)
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Check blocker
|
|
185
|
+
cat .archaeology/session.json | jq '.flags.blocked_reason'
|
|
186
|
+
|
|
187
|
+
# Reset and retry
|
|
188
|
+
jq '.status = "running" | del(.flags.blocked_reason)' .archaeology/session.json > tmp.json && mv tmp.json .archaeology/session.json
|
|
189
|
+
```
|
|
121
190
|
|
|
122
191
|
### Stale Cache
|
|
123
192
|
|
|
@@ -127,10 +196,10 @@ npm list -g opencode-code-archaeology --depth=0
|
|
|
127
196
|
|
|
128
197
|
### Restore Safety
|
|
129
198
|
|
|
130
|
-
- Start with `/code-archaeology
|
|
199
|
+
- Start with `/code-archaeology` (OpenCode) or `mode = "survey"` (Hermes); it writes reports only.
|
|
131
200
|
- Review `.archaeology/site_survey.md` and expedition reports before restore.
|
|
132
|
-
- Use `/code-archaeology-excavate` for mock patches if you want another review gate.
|
|
133
|
-
- Run `/code-archaeology-restore` only when the target repository has tests or type checks available.
|
|
201
|
+
- Use `/code-archaeology-excavate` (OpenCode) or `mode = "excavate"` (Hermes) for mock patches if you want another review gate.
|
|
202
|
+
- Run `/code-archaeology-restore` (OpenCode) or `mode = "restore"` (Hermes) only when the target repository has tests or type checks available.
|
|
134
203
|
- Do not commit `.archaeology/`; it is local runtime state.
|
|
135
204
|
|
|
136
205
|
## Links
|
|
@@ -139,3 +208,4 @@ npm list -g opencode-code-archaeology --depth=0
|
|
|
139
208
|
- Wiki: https://github.com/Maleick/Code-Archaeology/wiki
|
|
140
209
|
- Releases: https://github.com/Maleick/Code-Archaeology/releases
|
|
141
210
|
- Issues: https://github.com/Maleick/Code-Archaeology/issues
|
|
211
|
+
- Hermes docs: https://hermes-agent.nousresearch.com/docs
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<h1 align="center">Code Archaeology</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="assets/code-archaeology-banner.svg" alt="Code Archaeology
|
|
4
|
+
<img src="assets/code-archaeology-banner.svg" alt="Code Archaeology multi-runtime banner" width="900">
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
<a href="#release-docs">Release</a>
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
|
-
|
|
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).
|
|
27
29
|
|
|
28
30
|
```text
|
|
29
31
|
+---------------------------------------------------------------+
|
|
@@ -33,7 +35,8 @@ Code Archaeology is an OpenCode plugin that surveys, catalogs, and safely restor
|
|
|
33
35
|
| Review mode | excavate: reports plus mock patches |
|
|
34
36
|
| Restore mode | applies approved changes with test gates |
|
|
35
37
|
| Local state | .archaeology/ runtime artifacts |
|
|
36
|
-
|
|
|
38
|
+
| Runtimes | OpenCode plugin + Hermes Agent cron |
|
|
39
|
+
| Platforms | macOS/Linux (bash) + Windows (PowerShell) |
|
|
37
40
|
| Expedition order | fixed stratigraphy from survey to catalog |
|
|
38
41
|
+-------------------+-------------------------------------------+
|
|
39
42
|
```
|
|
@@ -49,13 +52,16 @@ Code Archaeology runs a systematic excavation of a repository before it changes
|
|
|
49
52
|
- Hardens weak types without guessing uncertain replacements.
|
|
50
53
|
- Finds semantic duplication and error-handling slop while preserving I/O boundaries.
|
|
51
54
|
- Produces `.archaeology/` reports that stay local to the working repository.
|
|
55
|
+
- Supports both **OpenCode** interactive sessions and **Hermes Agent** cron-based phased execution.
|
|
52
56
|
|
|
53
57
|
## Installation
|
|
54
58
|
|
|
55
|
-
|
|
59
|
+
### OpenCode
|
|
60
|
+
|
|
61
|
+
Paste this handoff into your agent:
|
|
56
62
|
|
|
57
63
|
```text
|
|
58
|
-
|
|
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.
|
|
59
65
|
```
|
|
60
66
|
|
|
61
67
|
Recommended plugin install in `opencode.json`:
|
|
@@ -63,7 +69,7 @@ Recommended plugin install in `opencode.json`:
|
|
|
63
69
|
```json
|
|
64
70
|
{
|
|
65
71
|
"plugin": [
|
|
66
|
-
"opencode-code-archaeology@
|
|
72
|
+
"opencode-code-archaeology@2.2.0"
|
|
67
73
|
]
|
|
68
74
|
}
|
|
69
75
|
```
|
|
@@ -71,30 +77,43 @@ Recommended plugin install in `opencode.json`:
|
|
|
71
77
|
Global npm install path:
|
|
72
78
|
|
|
73
79
|
```bash
|
|
74
|
-
npm install -g opencode-code-archaeology
|
|
75
|
-
opencode-code-archaeology install
|
|
76
|
-
opencode-code-archaeology doctor
|
|
77
|
-
opencode-code-archaeology version
|
|
80
|
+
npm install -g opencode-code-archaeology@2.2.0 && opencode-code-archaeology install && opencode-code-archaeology doctor
|
|
78
81
|
```
|
|
79
82
|
|
|
80
83
|
One-time package runner path, if your OpenCode setup supports package execution through Bun:
|
|
81
84
|
|
|
82
85
|
```bash
|
|
83
|
-
bunx opencode-code-archaeology install
|
|
84
|
-
bunx opencode-code-archaeology doctor
|
|
86
|
+
bunx opencode-code-archaeology@2.2.0 install
|
|
87
|
+
bunx opencode-code-archaeology@2.2.0 doctor
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Hermes Agent
|
|
91
|
+
|
|
92
|
+
```bash
|
|
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."
|
|
85
102
|
```
|
|
86
103
|
|
|
87
104
|
See [`INSTALL.md`](INSTALL.md) for prerequisites, verification, updating, and troubleshooting.
|
|
88
105
|
|
|
89
106
|
## Quick Start
|
|
90
107
|
|
|
108
|
+
### OpenCode
|
|
109
|
+
|
|
91
110
|
Run the command family from inside the repository you want to inspect:
|
|
92
111
|
|
|
93
112
|
```text
|
|
94
113
|
/code-archaeology
|
|
95
114
|
```
|
|
96
115
|
|
|
97
|
-
|
|
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:
|
|
98
117
|
|
|
99
118
|
```text
|
|
100
119
|
/code-archaeology-survey
|
|
@@ -102,11 +121,33 @@ Start non-destructively, review the reports, then choose whether to generate moc
|
|
|
102
121
|
/code-archaeology-restore
|
|
103
122
|
```
|
|
104
123
|
|
|
124
|
+
### Hermes Agent
|
|
125
|
+
|
|
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:
|
|
127
|
+
|
|
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
|
+
|
|
105
146
|
## Expedition Flow
|
|
106
147
|
|
|
107
148
|
```mermaid
|
|
108
149
|
flowchart TD
|
|
109
|
-
A[Start
|
|
150
|
+
A[Start] --> B[Site Survey and Baseline]
|
|
110
151
|
B --> C[Dead Code Excavation]
|
|
111
152
|
C --> D[Legacy Stratum Removal]
|
|
112
153
|
D --> E[Circular Dependency Cartography]
|
|
@@ -141,24 +182,35 @@ flowchart LR
|
|
|
141
182
|
|
|
142
183
|
## Commands
|
|
143
184
|
|
|
185
|
+
### OpenCode
|
|
186
|
+
|
|
144
187
|
| Command | Purpose | File changes |
|
|
145
188
|
| --- | --- | --- |
|
|
146
|
-
| `/code-archaeology` |
|
|
189
|
+
| `/code-archaeology` | Run the full 10-phase survey chain without per-phase prompts. | None outside `.archaeology/`. |
|
|
147
190
|
| `/code-archaeology-survey` | Generate site reports for review. | None outside `.archaeology/`. |
|
|
148
191
|
| `/code-archaeology-excavate` | Generate reports and mock patches. | None outside `.archaeology/patches/`. |
|
|
149
192
|
| `/code-archaeology-restore` | Apply approved high-confidence changes. | Yes, test-gated. |
|
|
150
193
|
|
|
151
|
-
|
|
194
|
+
### Hermes Agent
|
|
152
195
|
|
|
153
|
-
|
|
|
196
|
+
| OpenCode Equivalent | Hermes Mechanism | File changes |
|
|
154
197
|
| --- | --- | --- |
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `mode`
|
|
158
|
-
| `
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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 |
|
|
162
214
|
|
|
163
215
|
## Expedition Order
|
|
164
216
|
|
|
@@ -198,12 +250,15 @@ Code-Archaeology/
|
|
|
198
250
|
|-- dist/ # Built package output for GitHub-based installs
|
|
199
251
|
|-- docs/ # Public docs and release notes
|
|
200
252
|
|-- hooks/opencode/ # Init, verification, revert, and status hooks
|
|
201
|
-
|--
|
|
253
|
+
|-- hooks/hermes/ # Setup and runner hooks for Hermes Agent
|
|
254
|
+
|-- plugins/ # Repo-local legacy plugin shim
|
|
202
255
|
|-- prompts/ # Expedition prompts by phase
|
|
203
256
|
|-- schema/ # JSON schemas for reports
|
|
204
|
-
|-- skills/ # Code Archaeology skill
|
|
257
|
+
|-- skills/ # Code Archaeology skill definitions
|
|
258
|
+
| |-- code-archaeology/ # OpenCode skill
|
|
259
|
+
| `-- hermes/ # Hermes Agent skill and integration docs
|
|
205
260
|
|-- src/ # TypeScript source
|
|
206
|
-
|-- INSTALL.md #
|
|
261
|
+
|-- INSTALL.md # Multi-runtime install handoff
|
|
207
262
|
|-- README.md # Public project overview
|
|
208
263
|
`-- AGENTS.md # Agent runtime guide
|
|
209
264
|
```
|
|
@@ -220,6 +275,7 @@ All expedition state is written to `.archaeology/` inside the target repository:
|
|
|
220
275
|
| `FINAL_CATALOG.md` | Final excavation summary and recommendations. |
|
|
221
276
|
| `excavation_log.txt` | `git diff --stat` for applied restoration work. |
|
|
222
277
|
| `patches/` | Mock patches generated by `excavate` mode. |
|
|
278
|
+
| `hermes-runtime.json` | Hermes runtime configuration (Hermes only). |
|
|
223
279
|
|
|
224
280
|
## Local Testing
|
|
225
281
|
|
|
@@ -231,19 +287,24 @@ npm run build
|
|
|
231
287
|
npm run typecheck
|
|
232
288
|
npm pack --json --dry-run
|
|
233
289
|
bash -n hooks/opencode/*.sh
|
|
290
|
+
bash -n hooks/hermes/*.sh
|
|
234
291
|
```
|
|
235
292
|
|
|
236
|
-
For a restore expedition, run the configured test and type-check commands between phases. The bundled verification
|
|
293
|
+
For a restore expedition, run the configured test and type-check commands between phases. The bundled verification hooks are:
|
|
237
294
|
|
|
238
295
|
```bash
|
|
296
|
+
# OpenCode
|
|
239
297
|
bash hooks/opencode/verify-phase.sh final_verify
|
|
298
|
+
|
|
299
|
+
# Hermes
|
|
300
|
+
bash hooks/hermes/runner.sh
|
|
240
301
|
```
|
|
241
302
|
|
|
242
303
|
## Release Docs
|
|
243
304
|
|
|
244
305
|
- [`docs/README.md`](docs/README.md) is the documentation landing page.
|
|
245
306
|
- [`docs/RELEASE.md`](docs/RELEASE.md) covers release preparation and publishing.
|
|
246
|
-
- [`INSTALL.md`](INSTALL.md) is the raw handoff for
|
|
307
|
+
- [`INSTALL.md`](INSTALL.md) is the raw handoff for multi-runtime installation.
|
|
247
308
|
- [GitHub Releases](https://github.com/Maleick/Code-Archaeology/releases) lists published versions.
|
|
248
309
|
|
|
249
310
|
## License
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0
|
|
1
|
+
2.2.0
|