opencode-code-archaeology 2.0.0 → 2.0.2
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 +26 -0
- package/.github/workflows/ci.yml +45 -0
- package/CHANGELOG.md +20 -0
- package/CONTRIBUTING.md +48 -0
- package/INSTALL.md +141 -0
- package/README.md +194 -71
- package/SECURITY.md +20 -0
- package/VERSION +1 -1
- package/assets/code-archaeology-banner.svg +66 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +111 -0
- package/dist/cli.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +2 -0
- package/dist/plugin.js.map +1 -0
- package/docs/ARCHITECTURE.md +92 -0
- package/docs/INSTALL.md +117 -0
- package/docs/README.md +44 -0
- package/docs/RELEASE.md +135 -0
- package/docs/SECURITY_AUDIT.md +38 -0
- package/hooks/opencode/verify-package.sh +46 -0
- package/package.json +26 -5
- 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/wiki/Expedition-Workflow.md +32 -0
- package/wiki/Home.md +27 -0
- package/wiki/Installation.md +42 -0
- package/wiki/Release-Process.md +31 -0
- package/wiki/Security-and-Safety.md +21 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report a problem with the Code Archaeology OpenCode plugin.
|
|
3
|
+
title: "bug: "
|
|
4
|
+
labels:
|
|
5
|
+
- bug
|
|
6
|
+
body:
|
|
7
|
+
- type: markdown
|
|
8
|
+
attributes:
|
|
9
|
+
value: Thanks for helping improve Code Archaeology. Do not include secrets, private code, or full `.archaeology/` state.
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: summary
|
|
12
|
+
attributes:
|
|
13
|
+
label: Summary
|
|
14
|
+
description: What went wrong?
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: dropdown
|
|
18
|
+
id: mode
|
|
19
|
+
attributes:
|
|
20
|
+
label: Mode
|
|
21
|
+
options:
|
|
22
|
+
- survey
|
|
23
|
+
- excavate
|
|
24
|
+
- restore
|
|
25
|
+
- install or CLI
|
|
26
|
+
- documentation
|
|
27
|
+
- other
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
- type: input
|
|
31
|
+
id: version
|
|
32
|
+
attributes:
|
|
33
|
+
label: Version
|
|
34
|
+
description: Package version, commit SHA, or install source.
|
|
35
|
+
placeholder: v2.0.2
|
|
36
|
+
- type: textarea
|
|
37
|
+
id: steps
|
|
38
|
+
attributes:
|
|
39
|
+
label: Steps to reproduce
|
|
40
|
+
placeholder: |
|
|
41
|
+
1. Run ...
|
|
42
|
+
2. See ...
|
|
43
|
+
validations:
|
|
44
|
+
required: true
|
|
45
|
+
- type: textarea
|
|
46
|
+
id: expected
|
|
47
|
+
attributes:
|
|
48
|
+
label: Expected behavior
|
|
49
|
+
validations:
|
|
50
|
+
required: true
|
|
51
|
+
- type: textarea
|
|
52
|
+
id: actual
|
|
53
|
+
attributes:
|
|
54
|
+
label: Actual behavior
|
|
55
|
+
description: Include sanitized logs or error output when useful.
|
|
56
|
+
validations:
|
|
57
|
+
required: true
|
|
58
|
+
- type: textarea
|
|
59
|
+
id: environment
|
|
60
|
+
attributes:
|
|
61
|
+
label: Environment
|
|
62
|
+
description: OS, Node version, OpenCode version, package manager, and target language.
|
|
63
|
+
placeholder: macOS 14, Node 20, OpenCode ..., npm ..., TypeScript
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an improvement for the Code Archaeology OpenCode plugin.
|
|
3
|
+
title: "feat: "
|
|
4
|
+
labels:
|
|
5
|
+
- enhancement
|
|
6
|
+
body:
|
|
7
|
+
- type: markdown
|
|
8
|
+
attributes:
|
|
9
|
+
value: Please focus on the user workflow and safety impact. Do not include private repository contents.
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: problem
|
|
12
|
+
attributes:
|
|
13
|
+
label: Problem
|
|
14
|
+
description: What workflow or limitation should this improve?
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: proposal
|
|
19
|
+
attributes:
|
|
20
|
+
label: Proposed solution
|
|
21
|
+
description: What should Code Archaeology do differently?
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: dropdown
|
|
25
|
+
id: area
|
|
26
|
+
attributes:
|
|
27
|
+
label: Area
|
|
28
|
+
options:
|
|
29
|
+
- survey reporting
|
|
30
|
+
- excavate mock patches
|
|
31
|
+
- restore safety
|
|
32
|
+
- language support
|
|
33
|
+
- CLI or install
|
|
34
|
+
- documentation
|
|
35
|
+
- CI or release
|
|
36
|
+
- other
|
|
37
|
+
validations:
|
|
38
|
+
required: true
|
|
39
|
+
- type: textarea
|
|
40
|
+
id: alternatives
|
|
41
|
+
attributes:
|
|
42
|
+
label: Alternatives considered
|
|
43
|
+
description: Any workaround or simpler approach?
|
|
44
|
+
- type: textarea
|
|
45
|
+
id: safety
|
|
46
|
+
attributes:
|
|
47
|
+
label: Safety considerations
|
|
48
|
+
description: Could this modify user code, expose local state, or affect restore behavior?
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
-
|
|
4
|
+
|
|
5
|
+
## Verification
|
|
6
|
+
|
|
7
|
+
- [ ] `npm run build`
|
|
8
|
+
- [ ] `npm run typecheck`
|
|
9
|
+
- [ ] `npm test`
|
|
10
|
+
- [ ] `npm audit --audit-level=moderate`
|
|
11
|
+
- [ ] `bash -n hooks/opencode/*.sh`
|
|
12
|
+
- [ ] `npm pack --json --dry-run`
|
|
13
|
+
|
|
14
|
+
## Safety Checklist
|
|
15
|
+
|
|
16
|
+
- [ ] I did not commit `.archaeology/`, `.superpowers/`, secrets, logs, or local editor state.
|
|
17
|
+
- [ ] Restore-mode changes are backed by reviewed survey or excavate output.
|
|
18
|
+
- [ ] I did not remove try/catch around I/O or external input boundaries.
|
|
19
|
+
- [ ] I flagged uncertain type or behavior changes for review instead of guessing.
|
|
20
|
+
|
|
21
|
+
## Docs And Release Checklist
|
|
22
|
+
|
|
23
|
+
- [ ] README, INSTALL, docs, and wiki source are updated if user behavior changed.
|
|
24
|
+
- [ ] CHANGELOG includes user-visible changes.
|
|
25
|
+
- [ ] Package metadata and npm package contents are correct for release-impacting changes.
|
|
26
|
+
- [ ] Version, tag, publish, and release steps are not included unless this PR is the release PR.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
verify:
|
|
13
|
+
name: Verify
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 20
|
|
24
|
+
cache: npm
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Build
|
|
30
|
+
run: npm run build
|
|
31
|
+
|
|
32
|
+
- name: Typecheck
|
|
33
|
+
run: npm run typecheck
|
|
34
|
+
|
|
35
|
+
- name: Test
|
|
36
|
+
run: npm test
|
|
37
|
+
|
|
38
|
+
- name: Audit dependencies
|
|
39
|
+
run: npm audit --audit-level=moderate
|
|
40
|
+
|
|
41
|
+
- name: Check shell hook syntax
|
|
42
|
+
run: bash -n hooks/opencode/*.sh
|
|
43
|
+
|
|
44
|
+
- name: Validate npm package contents
|
|
45
|
+
run: npm pack --json --dry-run
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v2.0.2
|
|
4
|
+
|
|
5
|
+
- Added release-ready repository parity files: CI workflow, issue templates, PR template, security policy, contribution guide, and changelog.
|
|
6
|
+
- Added npm CLI and install documentation so users can install from npm, GitHub, or OpenCode plugin configuration paths.
|
|
7
|
+
- Added security audit and safety documentation covering local state, restore-mode review, dependency audit expectations, and secret-free examples.
|
|
8
|
+
- Prepared package metadata and package contents for npm release readiness, including docs, wiki source, assets, prompts, and release support files.
|
|
9
|
+
|
|
10
|
+
## v2.0.1
|
|
11
|
+
|
|
12
|
+
- Committed built `dist/` artifacts so GitHub-based installs can load the plugin without requiring a local build step.
|
|
13
|
+
- Updated installation and auto-update documentation.
|
|
14
|
+
- Bumped package version to `2.0.1`.
|
|
15
|
+
|
|
16
|
+
## v2.0.0
|
|
17
|
+
|
|
18
|
+
- Converted Code Archaeology into an OpenCode plugin.
|
|
19
|
+
- Added commands, hooks, policies, prompts, schema, and plugin packaging for survey, excavate, and restore workflows.
|
|
20
|
+
- Established the archaeology workflow for dead code, legacy cleanup, dependency mapping, type work, DRY review, error handling, and final catalog verification.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for improving Code Archaeology, an OpenCode plugin for systematic codebase excavation, cataloging, and restoration.
|
|
4
|
+
|
|
5
|
+
## Local Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
npm run build
|
|
10
|
+
npm test
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Use Node 20 for CI parity. Node 18 or newer is supported by the package metadata.
|
|
14
|
+
|
|
15
|
+
## Branch Policy
|
|
16
|
+
|
|
17
|
+
- Do not commit directly to `main` or `master`.
|
|
18
|
+
- Use a focused branch or worktree for each change.
|
|
19
|
+
- Keep `.archaeology/`, `.superpowers/`, `node_modules/`, logs, secrets, and editor state out of commits.
|
|
20
|
+
- Do not commit, tag, push, or publish release artifacts unless you are intentionally performing a reviewed release step.
|
|
21
|
+
|
|
22
|
+
## Testing Commands
|
|
23
|
+
|
|
24
|
+
Run the most focused checks for your change, and run the release checks before release-impacting changes are merged:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm run build
|
|
28
|
+
npm run typecheck
|
|
29
|
+
npm test
|
|
30
|
+
npm audit --audit-level=moderate
|
|
31
|
+
bash -n hooks/opencode/*.sh
|
|
32
|
+
npm pack --json --dry-run
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If a restore-mode change modifies behavior, verify it against a disposable repository or fixture and document the result.
|
|
36
|
+
|
|
37
|
+
## Documentation Expectations
|
|
38
|
+
|
|
39
|
+
- Update `README.md`, `INSTALL.md`, `docs/`, or `wiki/` when installation, commands, workflow, safety, or release behavior changes.
|
|
40
|
+
- Keep documentation factual, concise, and ASCII.
|
|
41
|
+
- Do not include secrets, credentials, private repository contents, or full local runtime state.
|
|
42
|
+
- Preserve the safety model: survey first, excavate for mock patches, restore only after review.
|
|
43
|
+
|
|
44
|
+
## Release Notes Expectations
|
|
45
|
+
|
|
46
|
+
- Add user-visible changes to `CHANGELOG.md`.
|
|
47
|
+
- Mention install or CLI changes, safety changes, package metadata changes, and migration steps when relevant.
|
|
48
|
+
- Do not claim a GitHub release, npm publish, tag, or Pages update happened until it has been verified.
|
package/INSTALL.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Install Code Archaeology
|
|
2
|
+
|
|
3
|
+
Code Archaeology is an OpenCode 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
|
+
## OpenCode Handoff
|
|
6
|
+
|
|
7
|
+
Paste this into OpenCode if you want the agent to install and verify the plugin for you:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
Fetch and follow instructions from https://raw.githubusercontent.com/Maleick/Code-Archaeology/refs/heads/main/INSTALL.md
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- OpenCode installed and available in your shell.
|
|
16
|
+
- Node.js with npm, or Bun if your OpenCode setup uses Bun package resolution.
|
|
17
|
+
- Git installed and available in your shell.
|
|
18
|
+
- A target repository with tests or type checks available before you run `restore` mode.
|
|
19
|
+
|
|
20
|
+
## Recommended OpenCode Plugin Install
|
|
21
|
+
|
|
22
|
+
Add Code Archaeology to your `opencode.json` plugin array:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"plugin": [
|
|
27
|
+
"opencode-code-archaeology@git+https://github.com/Maleick/Code-Archaeology.git"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Restart OpenCode after editing the configuration. The command family should then be available inside your target repository:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
/code-archaeology
|
|
36
|
+
/code-archaeology-survey
|
|
37
|
+
/code-archaeology-excavate
|
|
38
|
+
/code-archaeology-restore
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## npm Global Install
|
|
42
|
+
|
|
43
|
+
If you prefer a global package install:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install -g opencode-code-archaeology
|
|
47
|
+
opencode-code-archaeology install
|
|
48
|
+
opencode-code-archaeology doctor
|
|
49
|
+
opencode-code-archaeology version
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then restart OpenCode and run:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
/code-archaeology-survey
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## One-Time Bun Path
|
|
59
|
+
|
|
60
|
+
If your environment supports one-time package execution through Bun:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
bunx opencode-code-archaeology install
|
|
64
|
+
bunx opencode-code-archaeology doctor
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Use the plugin-array install for normal OpenCode usage.
|
|
68
|
+
|
|
69
|
+
## Verification
|
|
70
|
+
|
|
71
|
+
These checks do not require secrets:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm view opencode-code-archaeology version
|
|
75
|
+
npm view opencode-code-archaeology dist-tags
|
|
76
|
+
opencode-code-archaeology doctor
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For a local clone:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm install
|
|
83
|
+
npm run build
|
|
84
|
+
npm run typecheck
|
|
85
|
+
bash -n hooks/opencode/*.sh
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To verify command availability, restart OpenCode in a Git repository and run:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
/code-archaeology-survey
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The survey should create `.archaeology/` reports without modifying source files.
|
|
95
|
+
|
|
96
|
+
## Updating
|
|
97
|
+
|
|
98
|
+
For plugin-array installs, update through your OpenCode package manager flow, then restart OpenCode. If your setup caches git plugins, clear the cached plugin package and let OpenCode reinstall it.
|
|
99
|
+
|
|
100
|
+
For npm global installs:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install -g opencode-code-archaeology@latest
|
|
104
|
+
npm list -g opencode-code-archaeology --depth=0
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Troubleshooting
|
|
108
|
+
|
|
109
|
+
### Plugin Not Loading
|
|
110
|
+
|
|
111
|
+
- Confirm `opencode.json` is valid JSON.
|
|
112
|
+
- Confirm the plugin entry is in the top-level `plugin` array.
|
|
113
|
+
- Restart OpenCode after changing the config.
|
|
114
|
+
- Check that Git can reach `https://github.com/Maleick/Code-Archaeology.git`.
|
|
115
|
+
|
|
116
|
+
### Commands Not Found
|
|
117
|
+
|
|
118
|
+
- Restart OpenCode so it reloads plugin commands.
|
|
119
|
+
- Confirm the package installed successfully with `npm list -g opencode-code-archaeology --depth=0` if using the global path.
|
|
120
|
+
- Run `/code-archaeology-survey` from inside a Git repository, not from an empty directory.
|
|
121
|
+
|
|
122
|
+
### Stale Cache
|
|
123
|
+
|
|
124
|
+
- Remove the cached OpenCode package for `opencode-code-archaeology` if your runtime keeps one.
|
|
125
|
+
- Reinstall or rerun the OpenCode plugin resolution step.
|
|
126
|
+
- Restart OpenCode before testing again.
|
|
127
|
+
|
|
128
|
+
### Restore Safety
|
|
129
|
+
|
|
130
|
+
- Start with `/code-archaeology-survey`; it writes reports only.
|
|
131
|
+
- 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.
|
|
134
|
+
- Do not commit `.archaeology/`; it is local runtime state.
|
|
135
|
+
|
|
136
|
+
## Links
|
|
137
|
+
|
|
138
|
+
- Documentation: https://github.com/Maleick/Code-Archaeology/tree/main/docs
|
|
139
|
+
- Wiki: https://github.com/Maleick/Code-Archaeology/wiki
|
|
140
|
+
- Releases: https://github.com/Maleick/Code-Archaeology/releases
|
|
141
|
+
- Issues: https://github.com/Maleick/Code-Archaeology/issues
|