opencode-code-archaeology 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +63 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.yml +48 -0
  3. package/.github/pull_request_template.md +27 -0
  4. package/.github/workflows/ci.yml +45 -0
  5. package/.github/workflows/release.yml +46 -0
  6. package/AGENTS.md +42 -10
  7. package/CHANGELOG.md +79 -0
  8. package/CONTRIBUTING.md +50 -0
  9. package/INSTALL.md +211 -0
  10. package/README.md +255 -71
  11. package/SECURITY.md +20 -0
  12. package/VERSION +1 -1
  13. package/assets/code-archaeology-banner.svg +195 -0
  14. package/commands/code-archaeology.md +7 -5
  15. package/dist/cli.d.ts +3 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +137 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/index.d.ts +1 -5
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -17
  22. package/dist/index.js.map +1 -1
  23. package/dist/platform.d.ts +4 -0
  24. package/dist/platform.d.ts.map +1 -0
  25. package/dist/platform.js +11 -0
  26. package/dist/platform.js.map +1 -0
  27. package/dist/plugin.d.ts +3 -0
  28. package/dist/plugin.d.ts.map +1 -0
  29. package/dist/plugin.js +3 -0
  30. package/dist/plugin.js.map +1 -0
  31. package/dist/runtime.d.ts +18 -0
  32. package/dist/runtime.d.ts.map +1 -0
  33. package/dist/runtime.js +49 -0
  34. package/dist/runtime.js.map +1 -0
  35. package/dist/types.d.ts +1 -6
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js.map +1 -1
  38. package/docs/ARCHITECTURE.md +123 -0
  39. package/docs/INSTALL.md +156 -0
  40. package/docs/README.md +72 -0
  41. package/docs/RELEASE.md +139 -0
  42. package/docs/SECURITY_AUDIT.md +38 -0
  43. package/docs/index.html +740 -0
  44. package/hooks/hermes/runner.ps1 +247 -0
  45. package/hooks/hermes/runner.sh +262 -0
  46. package/hooks/hermes/setup.ps1 +41 -0
  47. package/hooks/hermes/setup.sh +41 -0
  48. package/hooks/opencode/init.ps1 +83 -0
  49. package/hooks/opencode/revert-phase.ps1 +12 -0
  50. package/hooks/opencode/revert-phase.sh +3 -8
  51. package/hooks/opencode/update-expedition.ps1 +51 -0
  52. package/hooks/opencode/verify-package.sh +47 -0
  53. package/hooks/opencode/verify-phase.ps1 +35 -0
  54. package/hooks/opencode/verify-phase.sh +7 -7
  55. package/hooks/shared/command-utils.ps1 +100 -0
  56. package/package.json +41 -6
  57. package/prompts/dead_code.md +45 -0
  58. package/prompts/dependencies.md +49 -0
  59. package/prompts/discovery.md +47 -0
  60. package/prompts/dry.md +49 -0
  61. package/prompts/errors.md +52 -0
  62. package/prompts/final_verify.md +58 -0
  63. package/prompts/legacy.md +49 -0
  64. package/prompts/polish.md +48 -0
  65. package/prompts/types_consolidate.md +48 -0
  66. package/prompts/types_harden.md +51 -0
  67. package/skills/code-archaeology/SKILL.md +2 -2
  68. package/skills/hermes/INTEGRATION.md +120 -0
  69. package/skills/hermes/README.md +167 -0
  70. package/skills/hermes/code-archaeology-prompt.md +203 -0
  71. package/wiki/Expedition-Workflow.md +34 -0
  72. package/wiki/Home.md +27 -0
  73. package/wiki/Installation.md +44 -0
  74. package/wiki/Release-Process.md +31 -0
  75. package/wiki/Security-and-Safety.md +21 -0
  76. package/plugins/code-archaeology.ts +0 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/env node
2
+ import { copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
3
+ import { existsSync } from "node:fs";
4
+ import { dirname, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import process from "node:process";
7
+ import { isWindows } from "./platform.js";
8
+ const PLUGIN = "opencode-code-archaeology@git+https://github.com/Maleick/Code-Archaeology.git";
9
+ const REQUIRED_FILES = [
10
+ "commands/code-archaeology.md",
11
+ "skills/code-archaeology/SKILL.md",
12
+ "hooks/opencode/init.sh",
13
+ "hooks/opencode/verify-phase.sh",
14
+ "hooks/hermes/setup.sh",
15
+ "hooks/hermes/runner.sh",
16
+ "skills/hermes/INTEGRATION.md",
17
+ "AGENTS.md",
18
+ "README.md",
19
+ "INSTALL.md",
20
+ ];
21
+ const REQUIRED_FILES_PS1 = [
22
+ "commands/code-archaeology.md",
23
+ "skills/code-archaeology/SKILL.md",
24
+ "hooks/opencode/init.ps1",
25
+ "hooks/opencode/verify-phase.ps1",
26
+ "hooks/hermes/setup.ps1",
27
+ "hooks/hermes/runner.ps1",
28
+ "skills/hermes/INTEGRATION.md",
29
+ "AGENTS.md",
30
+ "README.md",
31
+ "INSTALL.md",
32
+ ];
33
+ const cliFile = fileURLToPath(import.meta.url);
34
+ const root = dirname(dirname(cliFile));
35
+ const skillsPath = join(root, "skills");
36
+ function configPath() {
37
+ const configDir = process.env.OPENCODE_CONFIG_DIR || join(process.env.HOME || ".", ".config", "opencode");
38
+ return join(configDir, "opencode.json");
39
+ }
40
+ function backupPath(target) {
41
+ let candidate = `${target}.bak`;
42
+ let index = 1;
43
+ while (existsSync(candidate)) {
44
+ candidate = `${target}.bak.${index}`;
45
+ index += 1;
46
+ }
47
+ return candidate;
48
+ }
49
+ async function readPackageVersion() {
50
+ const packageJson = JSON.parse(await readFile(join(root, "package.json"), "utf8"));
51
+ return packageJson.version;
52
+ }
53
+ function printHelp() {
54
+ console.log(`Code Archaeology CLI
55
+
56
+ Usage:
57
+ opencode-code-archaeology help
58
+ opencode-code-archaeology install
59
+ opencode-code-archaeology doctor
60
+ opencode-code-archaeology version
61
+
62
+ Commands:
63
+ install Add Code Archaeology to opencode.json plugin array
64
+ doctor Verify core package files are present
65
+ version Print the package version
66
+ help Show this help`);
67
+ }
68
+ async function install() {
69
+ const target = configPath();
70
+ let config = {};
71
+ const exists = existsSync(target);
72
+ if (exists) {
73
+ config = JSON.parse(await readFile(target, "utf8"));
74
+ }
75
+ const plugins = Array.isArray(config.plugin) ? config.plugin : [];
76
+ if (!plugins.includes(PLUGIN)) {
77
+ config.plugin = [...plugins, PLUGIN];
78
+ }
79
+ const skills = typeof config.skills === "object" && config.skills !== null ? config.skills : {};
80
+ const paths = Array.isArray(skills.paths)
81
+ ? skills.paths
82
+ : [];
83
+ if (!paths.includes(skillsPath)) {
84
+ config.skills = { ...skills, paths: [...paths, skillsPath] };
85
+ }
86
+ await mkdir(dirname(target), { recursive: true });
87
+ let backup;
88
+ if (exists) {
89
+ backup = backupPath(target);
90
+ await copyFile(target, backup);
91
+ }
92
+ await writeFile(target, `${JSON.stringify(config, null, 2)}\n`);
93
+ console.log(`Updated ${target}`);
94
+ if (backup) {
95
+ console.log(`Backup written to ${backup}`);
96
+ }
97
+ console.log("Next steps:");
98
+ console.log("1. Restart OpenCode.");
99
+ console.log("2. Run /code-archaeology-survey in your target repository.");
100
+ console.log("Cross-platform: uses .ps1 hooks on Windows, .sh hooks on Unix.");
101
+ }
102
+ function doctor() {
103
+ const files = isWindows() ? REQUIRED_FILES_PS1 : REQUIRED_FILES;
104
+ const missing = files.filter((file) => !existsSync(join(root, file)));
105
+ if (missing.length > 0) {
106
+ console.error("Missing Code Archaeology package files:");
107
+ for (const file of missing) {
108
+ console.error(`- ${file}`);
109
+ }
110
+ process.exitCode = 1;
111
+ return;
112
+ }
113
+ console.log("Code Archaeology package files present:");
114
+ for (const file of files) {
115
+ console.log(`- ${file}`);
116
+ }
117
+ }
118
+ const command = process.argv[2] || "help";
119
+ try {
120
+ if (command === "version") {
121
+ console.log(await readPackageVersion());
122
+ }
123
+ else if (command === "doctor") {
124
+ doctor();
125
+ }
126
+ else if (command === "install") {
127
+ await install();
128
+ }
129
+ else {
130
+ printHelp();
131
+ }
132
+ }
133
+ catch (error) {
134
+ console.error(error instanceof Error ? error.message : String(error));
135
+ process.exitCode = 1;
136
+ }
137
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,MAAM,GAAG,+EAA+E,CAAC;AAC/F,MAAM,cAAc,GAAG;IACrB,8BAA8B;IAC9B,kCAAkC;IAClC,wBAAwB;IACxB,gCAAgC;IAChC,uBAAuB;IACvB,wBAAwB;IACxB,8BAA8B;IAC9B,WAAW;IACX,WAAW;IACX,YAAY;CACb,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,8BAA8B;IAC9B,kCAAkC;IAClC,yBAAyB;IACzB,iCAAiC;IACjC,wBAAwB;IACxB,yBAAyB;IACzB,8BAA8B;IAC9B,WAAW;IACX,WAAW;IACX,YAAY;CACb,CAAC;AAEF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AACvC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAExC,SAAS,UAAU;IACjB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAE,SAAS,EAAE,UA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C,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- import type { PluginServer } from "./types.js";
2
- export declare const id = "code-archaeology";
3
- export declare const repoRoot: string;
4
- export declare const version: string;
5
- export declare function server(): Promise<PluginServer>;
1
+ export { codeArchaeologyPlugin as default } from "./runtime.js";
6
2
  export * from "./types.js";
7
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO/C,eAAO,MAAM,EAAE,qBAAqB,CAAC;AACrC,eAAO,MAAM,QAAQ,QAAc,CAAC;AAGpC,eAAO,MAAM,OAAO,QAA2C,CAAC;AAEhE,wBAAsB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC,CAMpD;AAED,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAChE,cAAc,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,19 +1,3 @@
1
- import { fileURLToPath } from "node:url";
2
- import { dirname, resolve } from "node:path";
3
- import { readFileSync } from "node:fs";
4
- const __filename = fileURLToPath(import.meta.url);
5
- const __dirname = dirname(__filename);
6
- const packageRoot = resolve(__dirname, "..");
7
- export const id = "code-archaeology";
8
- export const repoRoot = packageRoot;
9
- const versionPath = resolve(packageRoot, "VERSION");
10
- export const version = readFileSync(versionPath, "utf8").trim();
11
- export async function server() {
12
- return {
13
- event() {
14
- return undefined;
15
- },
16
- };
17
- }
1
+ export { codeArchaeologyPlugin as default } from "./runtime.js";
18
2
  export * from "./types.js";
19
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAE7C,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,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,OAAO;QACL,KAAK;YACH,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAChE,cAAc,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function isWindows(): boolean;
2
+ export declare function getHookExtension(): string;
3
+ export declare function getShellCommand(): string;
4
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
@@ -0,0 +1,11 @@
1
+ import process from "node:process";
2
+ export function isWindows() {
3
+ return process.platform === "win32";
4
+ }
5
+ export function getHookExtension() {
6
+ return isWindows() ? ".ps1" : ".sh";
7
+ }
8
+ export function getShellCommand() {
9
+ return isWindows() ? "powershell.exe" : "bash";
10
+ }
11
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +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;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,SAAS,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC;AACjD,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { codeArchaeologyPlugin as default } from "./runtime.js";
2
+ export * from "./types.js";
3
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAChE,cAAc,YAAY,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,3 @@
1
+ export { codeArchaeologyPlugin as default } from "./runtime.js";
2
+ export * from "./types.js";
3
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAChE,cAAc,YAAY,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare const packageRoot: string;
2
+ export declare const id = "code-archaeology";
3
+ export declare const repoRoot: string;
4
+ export declare const version: string;
5
+ type OpenCodeConfig = {
6
+ command?: Record<string, {
7
+ template: string;
8
+ description?: string;
9
+ }>;
10
+ skills?: {
11
+ paths?: string[];
12
+ };
13
+ };
14
+ export declare function codeArchaeologyPlugin(): Promise<{
15
+ config(config: OpenCodeConfig): void;
16
+ }>;
17
+ export {};
18
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,QAA2B,CAAC;AACpD,eAAO,MAAM,EAAE,qBAAqB,CAAC;AACrC,eAAO,MAAM,QAAQ,QAAc,CAAC;AAGpC,eAAO,MAAM,OAAO,QAA2C,CAAC;AAEhE,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"}
@@ -0,0 +1,49 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = dirname(__filename);
6
+ export const packageRoot = resolve(__dirname, "..");
7
+ export const id = "code-archaeology";
8
+ export const repoRoot = packageRoot;
9
+ const versionPath = resolve(packageRoot, "VERSION");
10
+ export const version = readFileSync(versionPath, "utf8").trim();
11
+ const commandFiles = [
12
+ "code-archaeology",
13
+ "code-archaeology-survey",
14
+ "code-archaeology-excavate",
15
+ "code-archaeology-restore",
16
+ ];
17
+ function parseCommand(name) {
18
+ const template = readFileSync(resolve(packageRoot, "commands", `${name}.md`), "utf8");
19
+ const match = template.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
20
+ if (!match) {
21
+ return { template };
22
+ }
23
+ const description = match[1]
24
+ .split("\n")
25
+ .find((line) => line.startsWith("description:"))
26
+ ?.slice("description:".length)
27
+ .trim();
28
+ return { template: match[2].trimStart(), description };
29
+ }
30
+ function loadCommands() {
31
+ return Object.fromEntries(commandFiles.map((name) => [name, parseCommand(name)]));
32
+ }
33
+ export async function codeArchaeologyPlugin() {
34
+ const skillsPath = resolve(packageRoot, "skills");
35
+ return {
36
+ config(config) {
37
+ config.command = {
38
+ ...(config.command ?? {}),
39
+ ...loadCommands(),
40
+ };
41
+ config.skills = config.skills ?? {};
42
+ config.skills.paths = config.skills.paths ?? [];
43
+ if (!config.skills.paths.includes(skillsPath)) {
44
+ config.skills.paths.push(skillsPath);
45
+ }
46
+ },
47
+ };
48
+ }
49
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +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;AAGzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAA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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
@@ -15,7 +15,7 @@ export type ConfidenceLevel = "HIGH" | "MEDIUM" | "LOW";
15
15
  /** Status values for expedition progress. */
16
16
  export type ExpeditionStatus = "pending" | "running" | "complete" | "failed" | "skipped";
17
17
  /** Tool types used for analysis. */
18
- export type AnalysisTool = "knip" | "vulture" | "madge" | "pydeps" | "jscpd" | "tsc" | "mypy" | "ast_grep" | "manual";
18
+ export type AnalysisTool = "knip" | "unimported" | "depcheck" | "vulture" | "deadcode" | "staticcheck" | "cargo-udeps" | "rustc" | "madge" | "pydeps" | "godepgraph" | "cargo-deps" | "jscpd" | "tsc" | "mypy" | "go vet" | "pylint" | "golangci-lint" | "clippy" | "ast_grep" | "manual";
19
19
  /** Event types emitted by the plugin. */
20
20
  export type EventType = "phase_complete" | "phase_failed" | "finding_detected" | "report_generated";
21
21
  /** Runtime parameters for an archaeology session. */
@@ -231,11 +231,6 @@ export interface FinalCatalog {
231
231
  /** Recommendations for future maintenance. */
232
232
  recommendations: string[];
233
233
  }
234
- /** Minimal OpenCode plugin server shape. */
235
- export interface PluginServer {
236
- /** Event handler (currently a no-op stub). */
237
- event(): undefined;
238
- }
239
234
  /** CLI argument shape for `opencode-code-archaeology`. */
240
235
  export interface CliArgs {
241
236
  /** Target repository path. */
@@ -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;AAEhE,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,SAAS,GACT,OAAO,GACP,QAAQ,GACR,OAAO,GACP,KAAK,GACL,MAAM,GACN,UAAU,GACV,QAAQ,CAAC;AAEb,yCAAyC;AACzC,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,cAAc,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAMpG,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;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AC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoEH,oCAAoC;AACpC,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC/C,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,YAAY;IACtB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,UAAU;IACxB,iBAAiB,EAAE,kBAAkB;IACrC,WAAW,EAAE,sBAAsB;CACpC,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgFH,oCAAoC;AACpC,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC/C,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,YAAY;IACtB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,UAAU;IACxB,iBAAiB,EAAE,kBAAkB;IACrC,WAAW,EAAE,sBAAsB;CACpC,CAAC"}
@@ -0,0 +1,123 @@
1
+ # Code Archaeology Architecture
2
+
3
+ Code Archaeology is a multi-runtime plugin that operates entirely inside the target repository. It coordinates slash commands (OpenCode), cron-based execution (Hermes), a domain skill, shell hooks, prompts, schemas, and local `.archaeology/` artifacts to run a fixed excavation workflow.
4
+
5
+ ## Repository Layout
6
+
7
+ ```text
8
+ Code-Archaeology/
9
+ |-- assets/ # README and repository visual assets
10
+ |-- commands/ # OpenCode slash command definitions
11
+ |-- dist/ # Built package output for GitHub-based installs
12
+ |-- docs/ # Public documentation and release notes
13
+ |-- hooks/opencode/ # Init, verification, revert, and status hooks
14
+ |-- hooks/hermes/ # Setup and runner hooks for Hermes Agent
15
+ |-- plugins/ # Repo-local legacy plugin shim
16
+ |-- prompts/ # Expedition prompts by phase
17
+ |-- schema/ # JSON schemas for reports
18
+ |-- skills/ # Code Archaeology skill definitions
19
+ | |-- code-archaeology/ # OpenCode skill
20
+ | `-- hermes/ # Hermes Agent skill and integration docs
21
+ |-- src/ # TypeScript package and CLI source
22
+ |-- wiki/ # Source pages for GitHub Wiki publication
23
+ |-- INSTALL.md # Root install handoff
24
+ |-- README.md # Public project overview
25
+ |-- AGENTS.md # Agent runtime guide
26
+ ```
27
+
28
+ ## Runtime Surfaces
29
+
30
+ ### OpenCode Plugin Surfaces
31
+
32
+ - `dist/index.js` and the `./plugin` package export expose the plugin entry point consumed by OpenCode. `plugins/` is a repo-local legacy shim and is not included in npm package contents.
33
+ - `commands/` defines the slash command family: `/code-archaeology`, `/code-archaeology-survey`, `/code-archaeology-excavate`, and `/code-archaeology-restore`. The default `/code-archaeology` command runs the full survey chain without per-phase prompts and remains non-destructive.
34
+ - `skills/code-archaeology/` contains the domain workflow instructions agents follow during an expedition.
35
+ - `hooks/opencode/` provides shell gates for session setup, verification, rollback, and status updates.
36
+ - `prompts/` and `schema/` provide phase-specific guidance and artifact structure.
37
+ - `src/` builds the npm package and CLI used by `opencode-code-archaeology install`, `doctor`, and `version`.
38
+
39
+ ### Hermes Agent Surfaces
40
+
41
+ - `hooks/hermes/setup.sh` detects Hermes capabilities and writes `hermes-runtime.json`.
42
+ - `hooks/hermes/runner.sh` executes one expedition phase per cron run with built-in verification.
43
+ - `skills/hermes/` contains the Hermes-specific skill prompt, integration guide, and README.
44
+ - Hermes uses the same `.archaeology/session.json` state file as OpenCode.
45
+
46
+ ## Commands, Skills, And Hooks
47
+
48
+ Commands are the user-facing entry points. `/code-archaeology` selects survey mode by default and runs all 10 phases to produce reports. The explicit restore command is required before source files are changed.
49
+
50
+ The Code Archaeology skill defines the expedition order, safety constraints, language-tool preferences, and reporting expectations. It is the agent-facing control layer that prevents phases from running out of order.
51
+
52
+ Hooks are the shell-level enforcement layer:
53
+
54
+ ### OpenCode hooks
55
+ - `init.sh` initializes `.archaeology/` and session state.
56
+ - `verify-phase.sh <phase>` runs configured tests and type checks between phases.
57
+ - `revert-phase.sh <phase>` reverts changes when a restore phase fails verification.
58
+ - `update-expedition.sh <phase> <status> [findings]` updates session progress.
59
+
60
+ ### Hermes hooks
61
+ - `setup.sh` detects Hermes CLI / active session and writes runtime config.
62
+ - `runner.sh` reads session state, executes one phase, verifies, and advances.
63
+
64
+ ## Expedition Flow
65
+
66
+ The phase order is fixed because later cleanup depends on earlier evidence:
67
+
68
+ 1. Site Survey & Baseline
69
+ 2. Dead Code Excavation
70
+ 3. Legacy Stratum Removal
71
+ 4. Circular Dependency Cartography
72
+ 5. Type Catalog Consolidation
73
+ 6. Type Restoration & Hardening
74
+ 7. DRY Stratification
75
+ 8. Error Handling Stratigraphy
76
+ 9. Artifact Cleaning & Documentation
77
+ 10. Site Preservation & Final Catalog
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.
80
+
81
+ ## Runtime Comparison
82
+
83
+ | Feature | OpenCode | Hermes |
84
+ |---------|----------|--------|
85
+ | Entry | `/code-archaeology` slash command | `cronjob` |
86
+ | Phases | All in one session | One per cron run |
87
+ | Verification | Between expeditions | Between every phase |
88
+ | Revert | Manual or automatic | Automatic on failure |
89
+ | State | `.archaeology/session.json` | Same file |
90
+ | Background | Plugin stays active | Cron resumes automatically |
91
+ | Real-time | Yes | Delayed (15-min intervals) |
92
+
93
+ ## Artifact Lifecycle
94
+
95
+ Runtime artifacts live in `.archaeology/` inside the target repository:
96
+
97
+ | Artifact | Purpose |
98
+ | --- | --- |
99
+ | `session.json` | Current expedition progress and configuration. |
100
+ | `site_survey.md` | Baseline inventory and site report. |
101
+ | `expedition1-report.md` through `expedition8-report.md` | Per-expedition findings. |
102
+ | `FINAL_CATALOG.md` | Final excavation summary and recommendations. |
103
+ | `excavation_log.txt` | `git diff --stat` for applied restoration work. |
104
+ | `patches/` | Mock patches generated by `excavate` mode. |
105
+ | `hermes-runtime.json` | Hermes runtime configuration (Hermes only). |
106
+
107
+ `.archaeology/` is ignored local state and should not be committed.
108
+
109
+ ## Safety Gates
110
+
111
+ - Default to `survey` mode for reports only.
112
+ - Write a site report before removing or modifying code.
113
+ - Never consolidate types before dead code and legacy removal.
114
+ - Never remove try/catch blocks from I/O or external input boundaries automatically.
115
+ - Flag uncertain type replacements for human review instead of guessing.
116
+ - Run `verify-phase.sh` between restore phases (OpenCode).
117
+ - Run built-in verification in `runner.sh` between phases (Hermes).
118
+ - Run `revert-phase.sh` and stop if a phase introduces test failures.
119
+ - Keep restore work isolated to the configured branch, `refactor/archaeology` by default.
120
+
121
+ ## Local State
122
+
123
+ The plugin keeps operational state in the target repository, not in a remote service. This makes expeditions reviewable and reproducible, but maintainers must keep `.archaeology/` out of commits and inspect generated reports before applying restore changes.
@@ -0,0 +1,156 @@
1
+ # Install Code Archaeology
2
+
3
+ This guide mirrors the root [`INSTALL.md`](../INSTALL.md) and covers the recommended OpenCode plugin configuration, npm CLI install path, and Hermes Agent setup.
4
+
5
+ ## Prerequisites
6
+
7
+ - OpenCode installed and available in your shell.
8
+ - Node.js 18 or newer with npm.
9
+ - Git installed and available in your shell.
10
+ - A target repository with tests or type checks before running `restore` mode.
11
+ - For Hermes: Hermes Agent CLI or an active Hermes session.
12
+
13
+ ## Recommended OpenCode Plugin Install
14
+
15
+ Add Code Archaeology to the top-level `plugin` array in `opencode.json`:
16
+
17
+ ```json
18
+ {
19
+ "plugin": [
20
+ "opencode-code-archaeology@2.2.0"
21
+ ]
22
+ }
23
+ ```
24
+
25
+ Restart OpenCode after editing the configuration. The command family should then be available inside a Git repository:
26
+
27
+ ```text
28
+ /code-archaeology
29
+ /code-archaeology-survey
30
+ /code-archaeology-excavate
31
+ /code-archaeology-restore
32
+ ```
33
+
34
+ `/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.
35
+
36
+ ## npm Global Install
37
+
38
+ Use the npm package when you want the CLI installer and diagnostics:
39
+
40
+ ```bash
41
+ npm install -g opencode-code-archaeology@2.2.0
42
+ opencode-code-archaeology install
43
+ opencode-code-archaeology doctor
44
+ opencode-code-archaeology version
45
+ ```
46
+
47
+ Then restart OpenCode and run:
48
+
49
+ ```text
50
+ /code-archaeology
51
+ ```
52
+
53
+ ## Hermes Setup
54
+
55
+ Install the CLI globally so Hermes can invoke Code Archaeology commands. To initialize Hermes runtime metadata, run the hook from a local clone or from the unpacked package contents:
56
+
57
+ ```bash
58
+ npm install -g opencode-code-archaeology@2.2.0
59
+ cd ~/projects/Code-Archaeology
60
+ bash hooks/hermes/setup.sh
61
+ ```
62
+
63
+ Create a cronjob that runs exactly one expedition phase per invocation:
64
+
65
+ ```bash
66
+ hermes cronjob create \
67
+ --name "code-archaeology-expedition" \
68
+ --schedule "every 15m" \
69
+ --workdir ~/projects/Code-Archaeology \
70
+ --prompt "Run one Code Archaeology expedition phase. Read .archaeology/session.json, execute current phase with verification, advance to next phase."
71
+ ```
72
+
73
+ See [`skills/hermes/INTEGRATION.md`](../skills/hermes/INTEGRATION.md) for the full Hermes workflow.
74
+
75
+ ## Verification
76
+
77
+ Confirm the published package and local CLI are visible:
78
+
79
+ ```bash
80
+ npm view opencode-code-archaeology version
81
+ npm view opencode-code-archaeology dist-tags
82
+ opencode-code-archaeology doctor
83
+ opencode-code-archaeology version
84
+ ```
85
+
86
+ For a local clone, run focused package checks:
87
+
88
+ ```bash
89
+ npm install
90
+ npm run build
91
+ npm run typecheck
92
+ bash -n hooks/opencode/*.sh
93
+ bash -n hooks/hermes/*.sh
94
+ ```
95
+
96
+ To verify plugin behavior, restart OpenCode in a Git repository and run:
97
+
98
+ ```text
99
+ /code-archaeology
100
+ ```
101
+
102
+ The default survey chain should create `.archaeology/` reports without modifying source files or asking to proceed phase by phase.
103
+
104
+ ## Updating
105
+
106
+ 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.
107
+
108
+ For npm global installs:
109
+
110
+ ```bash
111
+ npm install -g opencode-code-archaeology@2.2.0
112
+ npm list -g opencode-code-archaeology --depth=0
113
+ opencode-code-archaeology doctor
114
+ ```
115
+
116
+ ## Troubleshooting
117
+
118
+ ### Plugin Not Loading
119
+
120
+ - Confirm `opencode.json` is valid JSON.
121
+ - Confirm the package entry is in the top-level `plugin` array, not `plugins`.
122
+ - Restart OpenCode after changing configuration.
123
+ - Confirm npm can resolve the pinned `opencode-code-archaeology` release.
124
+
125
+ ### Commands Not Found
126
+
127
+ - Restart OpenCode so it reloads plugin commands.
128
+ - Confirm the npm package installed with `npm list -g opencode-code-archaeology --depth=0` if using the global path.
129
+ - Run `/code-archaeology` from inside a Git repository.
130
+
131
+ ### Cron Not Running
132
+
133
+ ```bash
134
+ hermes cronjob list
135
+ hermes cronjob log code-archaeology-expedition
136
+ ```
137
+
138
+ ### Phase Blocked
139
+
140
+ ```bash
141
+ cat .archaeology/session.json | jq '.flags.blocked_reason'
142
+ ```
143
+
144
+ ### Stale Cache
145
+
146
+ - Remove the cached OpenCode package for `opencode-code-archaeology` if your runtime keeps one.
147
+ - Reinstall or rerun OpenCode plugin resolution.
148
+ - Restart OpenCode before testing again.
149
+
150
+ ### Restore Safety
151
+
152
+ - Start with `/code-archaeology`; it writes reports only.
153
+ - Review `.archaeology/site_survey.md` and expedition reports before restore.
154
+ - Use `/code-archaeology-excavate` for mock patches if you want another review gate.
155
+ - Run `/code-archaeology-restore` only when the target repository has tests or type checks available.
156
+ - Do not commit `.archaeology/`; it is local runtime state.