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.
- package/.github/ISSUE_TEMPLATE/bug_report.yml +63 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +48 -0
- package/.github/pull_request_template.md +27 -0
- package/.github/workflows/ci.yml +45 -0
- package/.github/workflows/release.yml +46 -0
- package/AGENTS.md +42 -10
- package/CHANGELOG.md +79 -0
- package/CONTRIBUTING.md +50 -0
- package/INSTALL.md +211 -0
- package/README.md +255 -71
- package/SECURITY.md +20 -0
- package/VERSION +1 -1
- package/assets/code-archaeology-banner.svg +195 -0
- package/commands/code-archaeology.md +7 -5
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +137 -0
- package/dist/cli.js.map +1 -0
- 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 +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -0
- 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 +123 -0
- package/docs/INSTALL.md +156 -0
- package/docs/README.md +72 -0
- package/docs/RELEASE.md +139 -0
- package/docs/SECURITY_AUDIT.md +38 -0
- 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 +47 -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 +41 -6
- package/prompts/dead_code.md +45 -0
- package/prompts/dependencies.md +49 -0
- package/prompts/discovery.md +47 -0
- package/prompts/dry.md +49 -0
- package/prompts/errors.md +52 -0
- package/prompts/final_verify.md +58 -0
- package/prompts/legacy.md +49 -0
- package/prompts/polish.md +48 -0
- package/prompts/types_consolidate.md +48 -0
- package/prompts/types_harden.md +51 -0
- 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 +34 -0
- package/wiki/Home.md +27 -0
- package/wiki/Installation.md +44 -0
- package/wiki/Release-Process.md +31 -0
- package/wiki/Security-and-Safety.md +21 -0
- package/plugins/code-archaeology.ts +0 -8
package/docs/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Code Archaeology Documentation
|
|
2
|
+
|
|
3
|
+
Excavate technical debt. Restore with confidence.
|
|
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 only modifies source files in `restore` mode after review and verification.
|
|
6
|
+
|
|
7
|
+
The public landing page is [`index.html`](index.html). These Markdown files remain the detailed documentation source.
|
|
8
|
+
|
|
9
|
+
## Quick Links
|
|
10
|
+
|
|
11
|
+
- [Install Guide](INSTALL.md)
|
|
12
|
+
- [Architecture](ARCHITECTURE.md)
|
|
13
|
+
- [Release Process](RELEASE.md)
|
|
14
|
+
- [Security Audit](SECURITY_AUDIT.md)
|
|
15
|
+
- [Repository README](../README.md)
|
|
16
|
+
- [Root Install Handoff](../INSTALL.md)
|
|
17
|
+
- [Hermes Integration](../skills/hermes/INTEGRATION.md)
|
|
18
|
+
- [Hermes Skill](../skills/hermes/README.md)
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### OpenCode
|
|
23
|
+
|
|
24
|
+
Install the package globally, register the plugin, then verify the CLI:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g opencode-code-archaeology@2.2.0 && opencode-code-archaeology install && opencode-code-archaeology doctor
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or tell OpenCode:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
Fetch and follow the instructions in the installed package's INSTALL.md at $(npm root -g)/opencode-code-archaeology/INSTALL.md for opencode-code-archaeology@2.2.0
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Restart OpenCode in the repository you want to inspect and start with the non-destructive default command:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
/code-archaeology
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This runs the full 10-phase survey chain without per-phase prompts, writes reports under `.archaeology/`, and makes no source-code changes.
|
|
43
|
+
|
|
44
|
+
Review `.archaeology/site_survey.md` and expedition reports before using:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
/code-archaeology-excavate
|
|
48
|
+
/code-archaeology-restore
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Hermes Agent
|
|
52
|
+
|
|
53
|
+
Setup the Hermes runtime and create a cronjob:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cd ~/projects/Code-Archaeology
|
|
57
|
+
bash hooks/hermes/setup.sh
|
|
58
|
+
|
|
59
|
+
hermes cronjob create \
|
|
60
|
+
--name "code-archaeology-expedition" \
|
|
61
|
+
--schedule "every 15m" \
|
|
62
|
+
--workdir ~/projects/Code-Archaeology \
|
|
63
|
+
--prompt "Run one Code Archaeology expedition phase. Read .archaeology/session.json, execute current phase with test/typecheck verification, advance to next phase. STOP after one phase."
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Each cron run executes exactly **one** phase. Ten phases complete in ~2.5 hours minimum.
|
|
67
|
+
|
|
68
|
+
## Safety Warning
|
|
69
|
+
|
|
70
|
+
`/code-archaeology` defaults to survey mode and writes reports only. `excavate` mode writes reports and mock patches. `restore` mode can edit source files and should only run after report review, on an isolated branch, with tests or type checks available.
|
|
71
|
+
|
|
72
|
+
Do not commit `.archaeology/`; it is local runtime state.
|
package/docs/RELEASE.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
This checklist is for future `opencode-code-archaeology` releases. `v2.1.0` is the current release example; replace it with the next version when preparing a new release.
|
|
4
|
+
|
|
5
|
+
## 1. Preflight
|
|
6
|
+
|
|
7
|
+
- Work from the release readiness branch or a dedicated release worktree.
|
|
8
|
+
- Confirm the worktree has no unrelated changes you intend to publish accidentally.
|
|
9
|
+
- Confirm no secrets or local runtime state are staged.
|
|
10
|
+
- Review `README.md`, `INSTALL.md`, `docs/`, `wiki/`, `CHANGELOG.md`, and package metadata for version-specific claims.
|
|
11
|
+
- Confirm `.archaeology/`, `.superpowers/`, `node_modules/`, and logs are ignored.
|
|
12
|
+
|
|
13
|
+
## 2. Version Bump
|
|
14
|
+
|
|
15
|
+
For a future release, replace `2.1.0` with the target version:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm version 2.1.0 --no-git-tag-version
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Update `VERSION` to the same value:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
2.1.0
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Confirm `package.json`, `package-lock.json`, and `VERSION` agree.
|
|
28
|
+
|
|
29
|
+
## 3. Changelog
|
|
30
|
+
|
|
31
|
+
- Add a `v2.1.0` entry, or the future target version, to `CHANGELOG.md`.
|
|
32
|
+
- Include user-visible changes, safety notes, and any migration instructions.
|
|
33
|
+
- Keep the release notes factual and avoid claiming publication steps that have not happened yet.
|
|
34
|
+
|
|
35
|
+
## 4. Verification
|
|
36
|
+
|
|
37
|
+
Run focused release checks before committing:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install
|
|
41
|
+
npm run build
|
|
42
|
+
npm run typecheck
|
|
43
|
+
npm audit --audit-level=moderate
|
|
44
|
+
npm outdated --json
|
|
45
|
+
bash -n hooks/opencode/*.sh
|
|
46
|
+
bash -n hooks/hermes/*.sh
|
|
47
|
+
npm pack --json --dry-run
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Expected outcomes:
|
|
51
|
+
|
|
52
|
+
- Build and typecheck pass.
|
|
53
|
+
- npm audit reports no moderate-or-higher vulnerabilities.
|
|
54
|
+
- npm outdated reports `{}` or no actionable outdated dependencies.
|
|
55
|
+
- Shell hooks pass syntax checks (both OpenCode and Hermes).
|
|
56
|
+
- The package dry run includes required files.
|
|
57
|
+
|
|
58
|
+
## 5. npm Pack Required Files
|
|
59
|
+
|
|
60
|
+
Inspect `npm pack --json --dry-run` output for the package contents. Required files should include:
|
|
61
|
+
|
|
62
|
+
- `dist/`
|
|
63
|
+
- `assets/`
|
|
64
|
+
- `hooks/`
|
|
65
|
+
- `commands/`
|
|
66
|
+
- `skills/`
|
|
67
|
+
- `schema/`
|
|
68
|
+
- `prompts/`
|
|
69
|
+
- `docs/`
|
|
70
|
+
- `wiki/`
|
|
71
|
+
- `AGENTS.md`
|
|
72
|
+
- `VERSION`
|
|
73
|
+
- `INSTALL.md`
|
|
74
|
+
- `README.md`
|
|
75
|
+
- `CHANGELOG.md`
|
|
76
|
+
- `CONTRIBUTING.md`
|
|
77
|
+
- `SECURITY.md`
|
|
78
|
+
- `LICENSE`
|
|
79
|
+
|
|
80
|
+
`plugins/` is intentionally repo-local and should not appear in npm package contents.
|
|
81
|
+
|
|
82
|
+
If any required file is missing, update the `files` array in `package.json`, rerun `npm install` if the lockfile needs to change, and repeat the package dry run.
|
|
83
|
+
|
|
84
|
+
## 6. Commit, Tag, And Push
|
|
85
|
+
|
|
86
|
+
Only perform these steps after verification passes and after confirming the branch is safe to publish:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git status --short
|
|
90
|
+
git add README.md INSTALL.md docs wiki assets .github SECURITY.md CONTRIBUTING.md CHANGELOG.md package.json package-lock.json VERSION .gitignore
|
|
91
|
+
git commit -m "chore: prepare v2.1.0 release"
|
|
92
|
+
git tag v2.1.0
|
|
93
|
+
git push origin HEAD
|
|
94
|
+
git push origin v2.1.0
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
For a future release, use the future version in the commit message and tag.
|
|
98
|
+
|
|
99
|
+
## 7. GitHub Release
|
|
100
|
+
|
|
101
|
+
Create the GitHub release from the matching tag:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
gh release create v2.1.0 --title "v2.1.0" --notes-file CHANGELOG.md
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Before publishing, trim the notes to the specific version section if `CHANGELOG.md` contains multiple releases.
|
|
108
|
+
|
|
109
|
+
## 8. npm Publish
|
|
110
|
+
|
|
111
|
+
Publishing is performed by `.github/workflows/release.yml` through npm trusted publishing. Configure npm Trusted Publisher with:
|
|
112
|
+
|
|
113
|
+
- Publisher: `GitHub Actions`
|
|
114
|
+
- Organization or user: `Maleick`
|
|
115
|
+
- Repository: `Code-Archaeology`
|
|
116
|
+
- Workflow filename: `release.yml`
|
|
117
|
+
- Environment name: leave blank unless the workflow adds a GitHub Actions `environment`
|
|
118
|
+
|
|
119
|
+
If publishing fails, do not create a replacement tag unless the failure requires a new package version. Fix the issue, rerun verification, and follow npm versioning rules.
|
|
120
|
+
|
|
121
|
+
## 9. Final Checks
|
|
122
|
+
|
|
123
|
+
Confirm the public release surfaces report the expected version:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm view opencode-code-archaeology version
|
|
127
|
+
npm view opencode-code-archaeology dist-tags
|
|
128
|
+
gh release view v2.1.0
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Optionally verify a fresh install path:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npm install -g opencode-code-archaeology@latest
|
|
135
|
+
opencode-code-archaeology doctor
|
|
136
|
+
opencode-code-archaeology version
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Do not claim GitHub Pages is enabled unless repository settings confirm it.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Security Audit Notes
|
|
2
|
+
|
|
3
|
+
These notes capture the current release-readiness security posture for Code Archaeology. They are intended to accompany the release checklist and should be refreshed before each publication.
|
|
4
|
+
|
|
5
|
+
## Current Findings
|
|
6
|
+
|
|
7
|
+
- `npm audit --audit-level=moderate` is expected to be clean for the current dependency set.
|
|
8
|
+
- `npm outdated --json` is expected to be clean for the current dependency set.
|
|
9
|
+
- No hardcoded secrets are expected in source, docs, hooks, commands, prompts, schemas, or package metadata.
|
|
10
|
+
- `.archaeology/` is local runtime state and is ignored by Git.
|
|
11
|
+
- `.superpowers/` is local planning state and is ignored by Git.
|
|
12
|
+
- Shell hooks in `hooks/opencode/` are syntax-checkable with `bash -n hooks/opencode/*.sh`.
|
|
13
|
+
|
|
14
|
+
## Local State
|
|
15
|
+
|
|
16
|
+
Code Archaeology writes operational state into `.archaeology/` in the target repository. This directory can contain project structure, findings, generated reports, mock patches, and restoration logs. It should stay local unless a maintainer intentionally extracts a report for review.
|
|
17
|
+
|
|
18
|
+
## Restore-Mode Safety Caveat
|
|
19
|
+
|
|
20
|
+
`restore` mode can modify source files. It 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
|
+
|
|
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
|
+
|
|
24
|
+
## Release Checklist
|
|
25
|
+
|
|
26
|
+
Before publishing a release:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
npm run build
|
|
31
|
+
npm run typecheck
|
|
32
|
+
npm audit --audit-level=moderate
|
|
33
|
+
npm outdated --json
|
|
34
|
+
bash -n hooks/opencode/*.sh
|
|
35
|
+
npm pack --json --dry-run
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Inspect the package dry run for required files and for accidental inclusion of local state. Do not publish if `.archaeology/`, `.superpowers/`, credentials, logs, or editor state appear in the package contents.
|