opencode-code-archaeology 2.2.6 → 2.3.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.
- package/AGENTS.md +1 -0
- package/CHANGELOG.md +20 -0
- package/INSTALL.md +4 -2
- package/README.md +7 -2
- package/VERSION +1 -1
- package/commands/code-archaeology.md +13 -3
- package/dist/platform.d.ts +0 -2
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +0 -6
- package/dist/platform.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +24 -2
- package/dist/runtime.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/INSTALL.md +3 -1
- package/docs/README.md +3 -2
- package/docs/SECURITY_AUDIT.md +1 -1
- package/hooks/hermes/runner.sh +34 -18
- package/package.json +2 -2
- package/prompts/dead_code.md +2 -0
- package/prompts/dependencies.md +2 -0
- package/prompts/dry.md +2 -0
- package/prompts/errors.md +2 -0
- package/prompts/legacy.md +2 -0
- package/prompts/polish.md +2 -0
- package/prompts/types_consolidate.md +2 -0
- package/prompts/types_harden.md +2 -0
- package/skills/code-archaeology/SKILL.md +6 -1
- package/skills/hermes/INTEGRATION.md +6 -1
- package/wiki/Expedition-Workflow.md +2 -1
- package/wiki/Home.md +2 -0
- package/wiki/Installation.md +2 -0
- package/wiki/Security-and-Safety.md +1 -1
package/AGENTS.md
CHANGED
|
@@ -72,6 +72,7 @@ Key files:
|
|
|
72
72
|
| `survey` | Reports only, zero file changes |
|
|
73
73
|
| `excavate` | Reports + mock patches, zero file changes |
|
|
74
74
|
| `restore` | Apply approved changes, test-gated |
|
|
75
|
+
| `yolo` | Apply approved + medium-confidence changes immediately (`strict_mode`-style), no review handoff |
|
|
75
76
|
|
|
76
77
|
## Constraints
|
|
77
78
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [2.3.0](https://github.com/Maleick/Code-Archaeology/compare/v2.2.6...v2.3.0) (2026-05-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* allow Hermes to initialize shared sessions ([#22](https://github.com/Maleick/Code-Archaeology/issues/22)) ([8a484c4](https://github.com/Maleick/Code-Archaeology/commit/8a484c481a895bc8c9b818c831551c435380a438))
|
|
7
|
+
* protect Hermes session initialization from symlinks ([#25](https://github.com/Maleick/Code-Archaeology/issues/25)) ([be855df](https://github.com/Maleick/Code-Archaeology/commit/be855dfeeb1c5173e4db3d5e4b4c32e17f3d2271))
|
|
8
|
+
* use local release version sync plugin ([#24](https://github.com/Maleick/Code-Archaeology/issues/24)) ([221085d](https://github.com/Maleick/Code-Archaeology/commit/221085dc0d3e958c824b474e958bfef15e726094))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* sync yolo docs and tests ([#23](https://github.com/Maleick/Code-Archaeology/issues/23)) ([b42d9b7](https://github.com/Maleick/Code-Archaeology/commit/b42d9b794fd9460dcfd82ff0b56ebdf18bb1d071))
|
|
14
|
+
|
|
15
|
+
## Unreleased
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add Hermes integration docs coverage for `yolo` and explicit docs smoke coverage for `--yolo` across wiki/INTEGRATION pages
|
|
20
|
+
|
|
1
21
|
## [2.2.6](https://github.com/Maleick/Code-Archaeology/compare/v2.2.5...v2.2.6) (2026-05-07)
|
|
2
22
|
|
|
3
23
|
|
package/INSTALL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Install Code Archaeology
|
|
2
2
|
|
|
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.
|
|
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, and `yolo` mode applies medium-confidence fixes in one step.
|
|
4
4
|
|
|
5
5
|
## Runtimes
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ Run `npm pack opencode-code-archaeology@2.2.0`, extract the resulting tarball, t
|
|
|
19
19
|
|
|
20
20
|
- Node.js with npm, or Bun if your setup uses Bun package resolution.
|
|
21
21
|
- Git installed and available in your shell.
|
|
22
|
-
- A target repository with tests or type checks available before you run `restore` mode.
|
|
22
|
+
- A target repository with tests or type checks available before you run `restore` or `yolo` mode.
|
|
23
23
|
- For Hermes: Hermes Agent CLI or an active Hermes session.
|
|
24
24
|
- **Windows**: PowerShell 5.1 or later (hooks use `.ps1` scripts on Windows).
|
|
25
25
|
|
|
@@ -42,9 +42,11 @@ Restart OpenCode after editing the configuration. The command family should then
|
|
|
42
42
|
/code-archaeology-survey
|
|
43
43
|
/code-archaeology-excavate
|
|
44
44
|
/code-archaeology-restore
|
|
45
|
+
/code-archaeology --yolo
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
`/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.
|
|
49
|
+
`/code-archaeology --yolo` runs full restoration in one shot with `strict_mode` enabled.
|
|
48
50
|
|
|
49
51
|
## Hermes Setup
|
|
50
52
|
|
package/README.md
CHANGED
|
@@ -111,6 +111,7 @@ Run the command family from inside the repository you want to inspect:
|
|
|
111
111
|
|
|
112
112
|
```text
|
|
113
113
|
/code-archaeology
|
|
114
|
+
/code-archaeology --yolo
|
|
114
115
|
```
|
|
115
116
|
|
|
116
117
|
`/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:
|
|
@@ -121,6 +122,8 @@ Run the command family from inside the repository you want to inspect:
|
|
|
121
122
|
/code-archaeology-restore
|
|
122
123
|
```
|
|
123
124
|
|
|
125
|
+
`--yolo` uses the full restore workflow in one shot (`yolo` mode), applying `HIGH` + `MEDIUM` confidence findings automatically.
|
|
126
|
+
|
|
124
127
|
### Hermes Agent
|
|
125
128
|
|
|
126
129
|
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:
|
|
@@ -173,7 +176,7 @@ flowchart LR
|
|
|
173
176
|
```
|
|
174
177
|
|
|
175
178
|
- `survey` is the default and writes reports only.
|
|
176
|
-
- `restore`
|
|
179
|
+
- `restore` and `yolo` modify code and should run only after reports are reviewed; `yolo` applies `MEDIUM` confidence fixes with no review handoff in one pass.
|
|
177
180
|
- `.archaeology/` is local runtime state and should not be committed.
|
|
178
181
|
- Work is isolated to a configurable branch, `refactor/archaeology` by default.
|
|
179
182
|
- Tests and type checks gate each restore phase.
|
|
@@ -187,6 +190,7 @@ flowchart LR
|
|
|
187
190
|
| Command | Purpose | File changes |
|
|
188
191
|
| --- | --- | --- |
|
|
189
192
|
| `/code-archaeology` | Run the full 10-phase survey chain without per-phase prompts. | None outside `.archaeology/`. |
|
|
193
|
+
| `/code-archaeology --yolo` | Run the full 10-phase chain in unattended restore mode. | Yes, test-gated. |
|
|
190
194
|
| `/code-archaeology-survey` | Generate site reports for review. | None outside `.archaeology/`. |
|
|
191
195
|
| `/code-archaeology-excavate` | Generate reports and mock patches. | None outside `.archaeology/patches/`. |
|
|
192
196
|
| `/code-archaeology-restore` | Apply approved high-confidence changes. | Yes, test-gated. |
|
|
@@ -206,7 +210,8 @@ flowchart LR
|
|
|
206
210
|
| --- | --- | --- | --- |
|
|
207
211
|
| `repo_path` | `.` | Target repository to excavate. | Set in `session.json` before first cron run. |
|
|
208
212
|
| `language` | `typescript` | Primary language for tooling selection. | Same |
|
|
209
|
-
| `mode` | `survey` | `survey`, `excavate`, or `
|
|
213
|
+
| `mode` | `survey` | `survey`, `excavate`, `restore`, or `yolo`. | Change in `session.json` to switch modes. |
|
|
214
|
+
| `yolo` | `false` | Force unattended `restore` + `strict_mode` behavior in one-shot mode. | Not implemented for Hermes by default. |
|
|
210
215
|
| `strict_mode` | `false` | When true, restore may also apply medium-confidence findings. | Same |
|
|
211
216
|
| `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
217
|
| `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 |
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.3.0
|
|
@@ -13,14 +13,22 @@ 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.
|
|
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. To run full unattended restoration, use `--yolo`.
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
19
19
|
|
|
20
20
|
```
|
|
21
|
-
|
|
21
|
+
/code-archaeology
|
|
22
|
+
/code-archaeology --yolo
|
|
22
23
|
```
|
|
23
24
|
|
|
25
|
+
### YOLO mode
|
|
26
|
+
|
|
27
|
+
`--yolo` runs the full expedition in an unattended restore flow with `strict_mode: true`.
|
|
28
|
+
It applies `HIGH` and `MEDIUM` confidence fixes directly and runs verification between phases.
|
|
29
|
+
|
|
30
|
+
Use this only in throwaway branches because it applies code changes without per-phase manual review.
|
|
31
|
+
|
|
24
32
|
## What It Does
|
|
25
33
|
|
|
26
34
|
1. **Surveys** the codebase — inventory, metrics, baseline
|
|
@@ -49,7 +57,8 @@ Run: /code-archaeology
|
|
|
49
57
|
|-----------|---------|-------------|
|
|
50
58
|
| `repo_path` | `.` | Target repository |
|
|
51
59
|
| `language` | `typescript` | Primary language |
|
|
52
|
-
| `mode` | `survey` | `survey`, `excavate`, or `
|
|
60
|
+
| `mode` | `survey` | `survey`, `excavate`, `restore`, or `yolo` |
|
|
61
|
+
| `yolo` | `false` | If `true`, force `restore` mode with `strict_mode: true` and no manual handoff |
|
|
53
62
|
| `strict_mode` | `false` | Auto-restore medium-confidence findings |
|
|
54
63
|
| `test_command` | `npm test` | Recorded session default only; verification uses `CODE_ARCHAEOLOGY_TEST_COMMAND` for operator-approved overrides |
|
|
55
64
|
| `typecheck_command` | `npx tsc --noEmit` | Recorded session default only; verification uses `CODE_ARCHAEOLOGY_TYPECHECK_COMMAND` for operator-approved overrides |
|
|
@@ -67,6 +76,7 @@ Run: /code-archaeology
|
|
|
67
76
|
- **Survey mode (default)**: Zero file changes. Runs every phase and generates the full report set.
|
|
68
77
|
- **Excavate mode**: Mock patches for human review. No actual modifications.
|
|
69
78
|
- **Restore mode**: Applies approved changes only when explicitly requested with `/code-archaeology-restore`. Always runs tests between phases.
|
|
79
|
+
- **YOLO mode (`--yolo`)**: Applies restore actions with `strict_mode` enabled and proceeds automatically without the review handoff.
|
|
70
80
|
- **Branch isolation**: All work happens on `refactor/archaeology` (configurable).
|
|
71
81
|
- **Test gating**: Any phase that breaks tests is automatically reverted.
|
|
72
82
|
|
package/dist/platform.d.ts
CHANGED
package/dist/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,IAAI,OAAO,CAEnC
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
|
package/dist/platform.js
CHANGED
|
@@ -2,10 +2,4 @@ import process from "node:process";
|
|
|
2
2
|
export function isWindows() {
|
|
3
3
|
return process.platform === "win32";
|
|
4
4
|
}
|
|
5
|
-
export function getHookExtension() {
|
|
6
|
-
return isWindows() ? ".ps1" : ".sh";
|
|
7
|
-
}
|
|
8
|
-
export function getShellCommand() {
|
|
9
|
-
return isWindows() ? "powershell.exe" : "bash";
|
|
10
|
-
}
|
|
11
5
|
//# sourceMappingURL=platform.js.map
|
package/dist/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACtC,CAAC
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACtC,CAAC"}
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,QAA2B,CAAC;AACpD,eAAO,MAAM,EAAE,qBAAqB,CAAC;AACrC,eAAO,MAAM,QAAQ,QAAc,CAAC;AA2BpC,eAAO,MAAM,OAAO,QAAmB,CAAC;AAExC,KAAK,cAAc,GAAG;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrE,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;CACH,CAAC;AA6BF,wBAAsB,qBAAqB;mBAIxB,cAAc;GAYhC"}
|
package/dist/runtime.js
CHANGED
|
@@ -7,7 +7,29 @@ export const packageRoot = resolve(__dirname, "..");
|
|
|
7
7
|
export const id = "code-archaeology";
|
|
8
8
|
export const repoRoot = packageRoot;
|
|
9
9
|
const versionPath = resolve(packageRoot, "VERSION");
|
|
10
|
-
|
|
10
|
+
const packageJsonPath = resolve(packageRoot, "package.json");
|
|
11
|
+
function readVersionText(path) {
|
|
12
|
+
const value = readFileSync(path, "utf8").trim();
|
|
13
|
+
return value.length > 0 ? value : "unknown";
|
|
14
|
+
}
|
|
15
|
+
function resolveVersion() {
|
|
16
|
+
try {
|
|
17
|
+
return readVersionText(versionPath);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
try {
|
|
21
|
+
const packageVersion = JSON.parse(readFileSync(packageJsonPath, "utf8")).version;
|
|
22
|
+
if (typeof packageVersion === "string" && packageVersion.length > 0) {
|
|
23
|
+
return packageVersion;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return "0.0.0";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return "0.0.0";
|
|
31
|
+
}
|
|
32
|
+
export const version = resolveVersion();
|
|
11
33
|
const commandFiles = [
|
|
12
34
|
"code-archaeology",
|
|
13
35
|
"code-archaeology-survey",
|
|
@@ -15,7 +37,7 @@ const commandFiles = [
|
|
|
15
37
|
"code-archaeology-restore",
|
|
16
38
|
];
|
|
17
39
|
function parseCommand(name) {
|
|
18
|
-
const template = readFileSync(resolve(packageRoot, "commands", `${name}.md`), "utf8");
|
|
40
|
+
const template = readFileSync(resolve(packageRoot, "commands", `${name}.md`), "utf8").replace(/\r\n/g, "\n");
|
|
19
41
|
const match = template.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
20
42
|
if (!match) {
|
|
21
43
|
return { template };
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,EAAE,GAAG,kBAAkB,CAAC;AACrC,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAC;AAEpC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACpD,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAE7D,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,OAAO,KAAK,CAAC,MAAM,GAAG,C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,MAAM,CAAC;SAC7B,IAAI,EAAE,CAAC;IAEV,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,YAAY;IACnB,OAAO,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAElD,OAAO;QACL,MAAM,CAAC,MAAsB;YAC3B,MAAM,CAAC,OAAO,GAAG;gBACf,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;gBACzB,GAAG,YAAY,EAAE;aAClB,CAAC;YACF,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;YACpC,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;YAChD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC9C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @module code-archaeology-types
|
|
6
6
|
*/
|
|
7
7
|
/** Valid operational modes. */
|
|
8
|
-
export type ArchaeologyMode = "survey" | "excavate" | "restore";
|
|
8
|
+
export type ArchaeologyMode = "survey" | "excavate" | "restore" | "yolo";
|
|
9
9
|
/** Supported programming languages. */
|
|
10
10
|
export type TargetLanguage = "typescript" | "javascript" | "python" | "go" | "rust";
|
|
11
11
|
/** Expedition phases in fixed order. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzE,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;AAEpF,wCAAwC;AACxC,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,cAAc,GACd,mBAAmB,GACnB,cAAc,GACd,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,cAAc,CAAC;AAEnB,sCAAsC;AACtC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExD,6CAA6C;AAC7C,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzF,oCAAoC;AACpC,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,YAAY,GACZ,UAAU,GACV,SAAS,GACT,UAAU,GACV,aAAa,GACb,aAAa,GACb,OAAO,GACP,OAAO,GACP,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,KAAK,GACL,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,QAAQ,GACR,UAAU,GACV,QAAQ,CAAC;AAEb,yCAAyC;AACzC,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B;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -76,7 +76,7 @@ The phase order is fixed because later cleanup depends on earlier evidence:
|
|
|
76
76
|
9. Artifact Cleaning & Documentation
|
|
77
77
|
10. Site Preservation & Final Catalog
|
|
78
78
|
|
|
79
|
-
`survey` mode writes reports only. `excavate` mode writes reports plus mock patches. `restore` mode applies approved changes and must pass verification between phases.
|
|
79
|
+
`survey` mode writes reports only. `excavate` mode writes reports plus mock patches. `restore` mode applies approved changes and must pass verification between phases. `yolo` mode applies the same restore sequence with `strict_mode` enabled and no manual review handoff.
|
|
80
80
|
|
|
81
81
|
## Runtime Comparison
|
|
82
82
|
|
package/docs/INSTALL.md
CHANGED
|
@@ -7,7 +7,7 @@ This guide mirrors the root [`INSTALL.md`](../INSTALL.md) and covers the recomme
|
|
|
7
7
|
- OpenCode installed and available in your shell.
|
|
8
8
|
- Node.js 18 or newer with npm.
|
|
9
9
|
- Git installed and available in your shell.
|
|
10
|
-
- A target repository with tests or type checks before running `restore` mode.
|
|
10
|
+
- A target repository with tests or type checks before running `restore` or `yolo` mode.
|
|
11
11
|
- For Hermes: Hermes Agent CLI or an active Hermes session.
|
|
12
12
|
|
|
13
13
|
## Recommended OpenCode Plugin Install
|
|
@@ -29,9 +29,11 @@ Restart OpenCode after editing the configuration. The command family should then
|
|
|
29
29
|
/code-archaeology-survey
|
|
30
30
|
/code-archaeology-excavate
|
|
31
31
|
/code-archaeology-restore
|
|
32
|
+
/code-archaeology --yolo
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
`/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.
|
|
36
|
+
`/code-archaeology --yolo` runs full restoration in one shot with `strict_mode` enabled.
|
|
35
37
|
|
|
36
38
|
## npm Global Install
|
|
37
39
|
|
package/docs/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Excavate technical debt. Restore with confidence.
|
|
4
4
|
|
|
5
|
-
Code Archaeology is a multi-runtime plugin for systematic codebase excavation, cataloging, and restoration. It supports both **OpenCode** (interactive slash commands) and **Hermes Agent** (cron-based background execution). It runs inside the target repository, writes local `.archaeology/` reports, and
|
|
5
|
+
Code Archaeology is a multi-runtime plugin for systematic codebase excavation, cataloging, and restoration. It supports both **OpenCode** (interactive slash commands) and **Hermes Agent** (cron-based background execution). It runs inside the target repository, writes local `.archaeology/` reports, and modifies source files in `restore` mode after review or in `yolo` mode when explicitly requested.
|
|
6
6
|
|
|
7
7
|
The public landing page is [`index.html`](index.html). These Markdown files remain the detailed documentation source.
|
|
8
8
|
|
|
@@ -37,6 +37,7 @@ Restart OpenCode in the repository you want to inspect and start with the non-de
|
|
|
37
37
|
|
|
38
38
|
```text
|
|
39
39
|
/code-archaeology
|
|
40
|
+
/code-archaeology --yolo
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
This runs the full 10-phase survey chain without per-phase prompts, writes reports under `.archaeology/`, and makes no source-code changes.
|
|
@@ -67,6 +68,6 @@ Each cron run executes exactly **one** phase. Ten phases complete in ~2.5 hours
|
|
|
67
68
|
|
|
68
69
|
## Safety Warning
|
|
69
70
|
|
|
70
|
-
`/code-archaeology` defaults to survey mode and writes reports only. `excavate` mode writes reports and mock patches. `restore` mode can edit source files
|
|
71
|
+
`/code-archaeology` defaults to survey mode and writes reports only. `excavate` mode writes reports and mock patches. `restore` mode can edit source files after report review, on an isolated branch, with tests or type checks available. `yolo` mode also edits source files in one shot with `strict_mode` enabled and no manual review gate.
|
|
71
72
|
|
|
72
73
|
Do not commit `.archaeology/`; it is local runtime state.
|
package/docs/SECURITY_AUDIT.md
CHANGED
|
@@ -17,7 +17,7 @@ Code Archaeology writes operational state into `.archaeology/` in the target rep
|
|
|
17
17
|
|
|
18
18
|
## Restore-Mode Safety Caveat
|
|
19
19
|
|
|
20
|
-
`restore` mode can modify source files.
|
|
20
|
+
`restore` mode can modify source files. `yolo` mode can also modify source files with `strict_mode` enabled and no manual handoff. Both should only run after `survey` reports are reviewed, preferably after `excavate` mock patches are reviewed, and only when the target repository has tests or type checks available. Failed restore phases should be reverted with the bundled revert hook before continuing.
|
|
21
21
|
|
|
22
22
|
The tool must not remove try/catch blocks around I/O or external input boundaries automatically, and uncertain type replacements should be flagged for human review instead of guessed.
|
|
23
23
|
|
package/hooks/hermes/runner.sh
CHANGED
|
@@ -44,6 +44,37 @@ write_session_jq() {
|
|
|
44
44
|
fi
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
require_safe_session_path() {
|
|
48
|
+
if [[ -L "$SESSION_FILE" ]]; then
|
|
49
|
+
echo "ERROR: Refusing to use symlinked Hermes session file: $SESSION_FILE" >&2
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
initialize_session() {
|
|
55
|
+
local current_phase="$1"
|
|
56
|
+
local tmp
|
|
57
|
+
tmp=$(mktemp "$ARCHAEOLOGY_DIR/session.json.XXXXXX")
|
|
58
|
+
cat > "$tmp" <<EOF
|
|
59
|
+
{
|
|
60
|
+
"runtime": "hermes",
|
|
61
|
+
"status": "running",
|
|
62
|
+
"current_phase": "$current_phase",
|
|
63
|
+
"completed_phases": [],
|
|
64
|
+
"mode": "survey",
|
|
65
|
+
"repo_path": ".",
|
|
66
|
+
"language": "typescript",
|
|
67
|
+
"test_command": "npm test",
|
|
68
|
+
"typecheck_command": "npx tsc --noEmit",
|
|
69
|
+
"branch_name": "refactor/archaeology",
|
|
70
|
+
"strict_mode": false,
|
|
71
|
+
"started_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
72
|
+
}
|
|
73
|
+
EOF
|
|
74
|
+
chmod 600 "$tmp" 2>/dev/null || true
|
|
75
|
+
mv -f "$tmp" "$SESSION_FILE"
|
|
76
|
+
}
|
|
77
|
+
|
|
47
78
|
read_session_string() {
|
|
48
79
|
local key="$1"
|
|
49
80
|
if ! jq -er --arg key "$key" '.[$key] | strings | select(test("\\S"))' "$SESSION_FILE" 2>/dev/null; then
|
|
@@ -70,6 +101,7 @@ validate_branch_name() {
|
|
|
70
101
|
}
|
|
71
102
|
|
|
72
103
|
require_jq
|
|
104
|
+
require_safe_session_path
|
|
73
105
|
|
|
74
106
|
# Phase definitions (fixed order)
|
|
75
107
|
PHASES=(
|
|
@@ -88,30 +120,14 @@ PHASES=(
|
|
|
88
120
|
# Detect current phase from session file
|
|
89
121
|
current_phase=""
|
|
90
122
|
if [[ -f "$SESSION_FILE" ]]; then
|
|
91
|
-
if ! current_phase=$(jq -
|
|
123
|
+
if ! current_phase=$(jq -r '.current_phase // empty' "$SESSION_FILE" 2>/dev/null); then
|
|
92
124
|
block_session "invalid session.json" "Invalid Hermes session file: $SESSION_FILE"
|
|
93
125
|
fi
|
|
94
126
|
fi
|
|
95
127
|
|
|
96
128
|
if [[ -z "$current_phase" ]]; then
|
|
97
129
|
current_phase="${PHASES[0]}"
|
|
98
|
-
|
|
99
|
-
cat > "$SESSION_FILE" <<EOF
|
|
100
|
-
{
|
|
101
|
-
"runtime": "hermes",
|
|
102
|
-
"status": "running",
|
|
103
|
-
"current_phase": "$current_phase",
|
|
104
|
-
"completed_phases": [],
|
|
105
|
-
"mode": "survey",
|
|
106
|
-
"repo_path": ".",
|
|
107
|
-
"language": "typescript",
|
|
108
|
-
"test_command": "npm test",
|
|
109
|
-
"typecheck_command": "npx tsc --noEmit",
|
|
110
|
-
"branch_name": "refactor/archaeology",
|
|
111
|
-
"strict_mode": false,
|
|
112
|
-
"started_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
113
|
-
}
|
|
114
|
-
EOF
|
|
130
|
+
initialize_session "$current_phase"
|
|
115
131
|
echo "Initialized Hermes session. Starting phase: $current_phase"
|
|
116
132
|
fi
|
|
117
133
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-code-archaeology",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Excavate, catalog, and restore a codebase by removing accumulated sediment—dead code, legacy fallbacks, circular dependencies, weak types, and defensive programming slop.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -90,6 +90,6 @@
|
|
|
90
90
|
"npm": "^11.14.0"
|
|
91
91
|
},
|
|
92
92
|
"engines": {
|
|
93
|
-
"node": ">=
|
|
93
|
+
"node": ">=22"
|
|
94
94
|
}
|
|
95
95
|
}
|
package/prompts/dead_code.md
CHANGED
|
@@ -38,6 +38,8 @@ Write to `.archaeology/expedition1-report.md`:
|
|
|
38
38
|
- NEVER remove LOW confidence artifacts
|
|
39
39
|
- Run tests after each removal batch
|
|
40
40
|
- Revert immediately if tests fail
|
|
41
|
+
- If `mode == yolo`:
|
|
42
|
+
- Same as restore with `strict_mode == true`
|
|
41
43
|
|
|
42
44
|
## Constraints
|
|
43
45
|
- NEVER remove code that is dynamically accessed (eval, require(variable), etc.)
|
package/prompts/dependencies.md
CHANGED
|
@@ -41,6 +41,8 @@ Write to `.archaeology/expedition3-report.md`:
|
|
|
41
41
|
- Flag complex cycles for human review
|
|
42
42
|
- NEVER create new abstractions that obscure the cycle—break it properly
|
|
43
43
|
- Run tests after each fix
|
|
44
|
+
- If `mode == yolo`:
|
|
45
|
+
- Same as restore with `strict_mode == true`
|
|
44
46
|
|
|
45
47
|
## Constraints
|
|
46
48
|
- NEVER introduce dynamic imports just to hide a cycle—fix the architecture
|
package/prompts/dry.md
CHANGED
|
@@ -40,6 +40,8 @@ Write to `.archaeology/expedition6-report.md`:
|
|
|
40
40
|
- Extract MEDIUM confidence only if `strict_mode == true`
|
|
41
41
|
- NEVER extract coincidental similarities—leave them inline
|
|
42
42
|
- Run tests after each extraction
|
|
43
|
+
- If `mode == yolo`:
|
|
44
|
+
- Same as restore with `strict_mode == true`
|
|
43
45
|
|
|
44
46
|
## Constraints
|
|
45
47
|
- NEVER extract code into a "utils" grab bag—use domain-appropriate names
|
package/prompts/errors.md
CHANGED
|
@@ -43,6 +43,8 @@ Write to `.archaeology/expedition7-report.md`:
|
|
|
43
43
|
- Add proper logging or propagation
|
|
44
44
|
- NEVER remove try/catch from I/O or external input boundaries
|
|
45
45
|
- Run tests after each change
|
|
46
|
+
- If `mode == yolo`:
|
|
47
|
+
- Same as restore with `strict_mode == true`
|
|
46
48
|
|
|
47
49
|
## Constraints
|
|
48
50
|
- NEVER remove try/catch from I/O operations (file read, network request, DB query)
|
package/prompts/legacy.md
CHANGED
|
@@ -41,6 +41,8 @@ Write to `.archaeology/expedition2-report.md`:
|
|
|
41
41
|
- Remove MEDIUM confidence only if `strict_mode == true`
|
|
42
42
|
- Update documentation to reflect removals
|
|
43
43
|
- Run tests after each batch
|
|
44
|
+
- If `mode == yolo`:
|
|
45
|
+
- Same as restore with `strict_mode == true`
|
|
44
46
|
|
|
45
47
|
## Constraints
|
|
46
48
|
- NEVER remove polyfills for features still needed by supported environments
|
package/prompts/polish.md
CHANGED
|
@@ -39,6 +39,8 @@ Write to `.archaeology/expedition8-report.md`:
|
|
|
39
39
|
- NEVER remove meaningful comments explaining complex logic
|
|
40
40
|
- NEVER change code semantics during cleanup
|
|
41
41
|
- Run tests after cleanup
|
|
42
|
+
- If `mode == yolo`:
|
|
43
|
+
- Same as restore with `strict_mode == true`
|
|
42
44
|
|
|
43
45
|
## Constraints
|
|
44
46
|
- NEVER remove comments explaining WHY (only remove WHAT comments that state the obvious)
|
|
@@ -39,6 +39,8 @@ Write to `.archaeology/expedition4-report.md`:
|
|
|
39
39
|
- Update all imports to point to canonical definitions
|
|
40
40
|
- Remove orphaned type definitions
|
|
41
41
|
- Run type checker after each consolidation batch
|
|
42
|
+
- If `mode == yolo`:
|
|
43
|
+
- Same as restore with `strict_mode == true`
|
|
42
44
|
|
|
43
45
|
## Constraints
|
|
44
46
|
- NEVER merge types that have semantic differences (even if structurally similar)
|
package/prompts/types_harden.md
CHANGED
|
@@ -42,6 +42,8 @@ Write to `.archaeology/expedition5-report.md`:
|
|
|
42
42
|
- Replace MEDIUM confidence only if `strict_mode == true`
|
|
43
43
|
- NEVER replace LOW confidence types—flag for human review
|
|
44
44
|
- Run type checker after each file—stop on errors
|
|
45
|
+
- If `mode == yolo`:
|
|
46
|
+
- Same as restore with `strict_mode == true`
|
|
45
47
|
|
|
46
48
|
## Constraints
|
|
47
49
|
- NEVER use `any` to "fix" a complex type—use proper typing
|
|
@@ -55,6 +55,7 @@ The expeditions MUST run in this order due to stratigraphic dependencies:
|
|
|
55
55
|
| `survey` | Zero | All | Initial audit, management review |
|
|
56
56
|
| `excavate` | Zero | All + mock patches | Pre-approval, team review |
|
|
57
57
|
| `restore` | Yes (HIGH confidence) | All | Executing approved changes |
|
|
58
|
+
| `yolo` | Yes (HIGH + MEDIUM confidence) | All | Unattended full restoration |
|
|
58
59
|
|
|
59
60
|
With `strict_mode: true`, restore also applies MEDIUM confidence findings.
|
|
60
61
|
|
|
@@ -74,7 +75,8 @@ With `strict_mode: true`, restore also applies MEDIUM confidence findings.
|
|
|
74
75
|
|-----------|---------|-------------|
|
|
75
76
|
| `repo_path` | `.` | Target repository |
|
|
76
77
|
| `language` | `typescript` | Primary language |
|
|
77
|
-
| `mode` | `survey` | `survey`, `excavate`, or `
|
|
78
|
+
| `mode` | `survey` | `survey`, `excavate`, `restore`, or `yolo` |
|
|
79
|
+
| `yolo` | `false` | If `true`, force `mode: yolo` |
|
|
78
80
|
| `strict_mode` | `false` | Auto-restore medium-confidence findings |
|
|
79
81
|
| `test_command` | `npm test` | Recorded session default only; verification uses `CODE_ARCHAEOLOGY_TEST_COMMAND` for operator-approved overrides |
|
|
80
82
|
| `typecheck_command` | `npx tsc --noEmit` | Recorded session default only; verification uses `CODE_ARCHAEOLOGY_TYPECHECK_COMMAND` for operator-approved overrides |
|
|
@@ -98,6 +100,9 @@ If tools are missing, the skill falls back to AST-based manual analysis.
|
|
|
98
100
|
# Survey only (zero changes)
|
|
99
101
|
opencode run code-archaeology --mode survey
|
|
100
102
|
|
|
103
|
+
# Full unattended restore
|
|
104
|
+
opencode run code-archaeology --yolo
|
|
105
|
+
|
|
101
106
|
# Generate mock patches for review
|
|
102
107
|
opencode run code-archaeology --mode excavate
|
|
103
108
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
5
|
Code Archaeology can run on Hermes Agent using cron-based phase execution. Each cron run executes exactly ONE expedition phase with test gates between phases.
|
|
6
|
+
Hermes does not expose `/code-archaeology --yolo` directly; instead, set `mode = "yolo"` in `session.json` to apply `restore` behavior with `strict_mode` enabled.
|
|
6
7
|
|
|
7
8
|
## Architecture
|
|
8
9
|
|
|
@@ -11,7 +12,7 @@ Hermes Cron (every 15m)
|
|
|
11
12
|
→ Read .archaeology/session.json
|
|
12
13
|
→ Detect current phase (1 of 10)
|
|
13
14
|
→ Execute ONE phase:
|
|
14
|
-
survey → excavate → restore (per phase)
|
|
15
|
+
survey → excavate → restore / yolo (per phase)
|
|
15
16
|
→ Run test/typecheck verification
|
|
16
17
|
→ Keep or revert changes
|
|
17
18
|
→ Advance to next phase
|
|
@@ -59,6 +60,7 @@ See `skills/hermes/code-archaeology-prompt.md` for the full cron prompt.
|
|
|
59
60
|
| `/code-archaeology-survey` | `mode = "survey"` in session.json |
|
|
60
61
|
| `/code-archaeology-excavate` | `mode = "excavate"` in session.json |
|
|
61
62
|
| `/code-archaeology-restore` | `mode = "restore"` in session.json |
|
|
63
|
+
| `/code-archaeology --yolo` | `mode = "yolo"` in session.json |
|
|
62
64
|
|
|
63
65
|
## Session File Format
|
|
64
66
|
|
|
@@ -81,6 +83,8 @@ Hermes uses the same `.archaeology/session.json` format as OpenCode:
|
|
|
81
83
|
}
|
|
82
84
|
```
|
|
83
85
|
|
|
86
|
+
To mirror `--yolo` on Hermes, set `mode: "yolo"` and keep `strict_mode` at `true` in `session.json`.
|
|
87
|
+
|
|
84
88
|
## 10-Phase Expedition Order
|
|
85
89
|
|
|
86
90
|
| # | Phase | Hermes Action |
|
|
@@ -101,6 +105,7 @@ Hermes uses the same `.archaeology/session.json` format as OpenCode:
|
|
|
101
105
|
Same as OpenCode:
|
|
102
106
|
- `survey` is default — reports only, zero edits
|
|
103
107
|
- `restore` modifies code only after review
|
|
108
|
+
- `yolo` applies restore behavior with strict confidence and no manual review gate
|
|
104
109
|
- Tests and type checks gate each phase
|
|
105
110
|
- Failed restores are automatically reverted
|
|
106
111
|
- Never remove try/catch from I/O boundaries
|
|
@@ -22,8 +22,9 @@ Code Archaeology runs phases in a fixed order so later changes are based on earl
|
|
|
22
22
|
| `survey` | Reports only; no source edits. |
|
|
23
23
|
| `excavate` | Reports plus mock patches in `.archaeology/patches/`. |
|
|
24
24
|
| `restore` | Applies approved changes with verification gates. |
|
|
25
|
+
| `yolo` | Unattended restore; applies HIGH + MEDIUM confidence findings with `strict_mode` enabled. |
|
|
25
26
|
|
|
26
|
-
Use `/code-archaeology-restore` explicitly
|
|
27
|
+
Use `/code-archaeology-restore` explicitly for reviewed changes or `/code-archaeology --yolo` for one-shot unattended restoration. The default `/code-archaeology` command remains survey-only and writes reports under `.archaeology/`.
|
|
27
28
|
|
|
28
29
|
## Local Artifacts
|
|
29
30
|
|
package/wiki/Home.md
CHANGED
|
@@ -22,6 +22,8 @@ Restart OpenCode inside a Git repository and run:
|
|
|
22
22
|
|
|
23
23
|
```text
|
|
24
24
|
/code-archaeology
|
|
25
|
+
/code-archaeology --yolo
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
`/code-archaeology` runs the full 10-phase survey chain without per-phase prompts, writes `.archaeology/` reports only, and makes no source-code changes. Review reports, then choose `excavate` for mock patches or `restore` for approved, test-gated changes.
|
|
29
|
+
`/code-archaeology --yolo` runs all phases in unattended restore mode using `strict_mode`.
|
package/wiki/Installation.md
CHANGED
|
@@ -21,9 +21,11 @@ Restart OpenCode. Commands should be available inside a Git repository:
|
|
|
21
21
|
/code-archaeology-survey
|
|
22
22
|
/code-archaeology-excavate
|
|
23
23
|
/code-archaeology-restore
|
|
24
|
+
/code-archaeology --yolo
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
`/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.
|
|
28
|
+
`/code-archaeology --yolo` runs full restoration in one shot with `strict_mode` enabled.
|
|
27
29
|
|
|
28
30
|
## npm CLI Path
|
|
29
31
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
## Restore Caveat
|
|
14
14
|
|
|
15
|
-
`restore` mode can edit source files. Run
|
|
15
|
+
`restore` mode can edit source files. `yolo` mode can also edit source files and applies medium-confidence fixes automatically. Run both only after reviewing `survey` reports, preferably after reviewing `excavate` mock patches, and only when tests or type checks are available.
|
|
16
16
|
|
|
17
17
|
Failed restore phases should be reverted before continuing. The workflow must not remove try/catch blocks around I/O or external input boundaries automatically, and uncertain type replacements should be flagged for review.
|
|
18
18
|
|