@mechanai/deepreview 1.0.1 → 2.0.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/.opencode/plugins/deepreview.ts +45 -0
- package/README.md +48 -100
- package/agents/deepreview-review-formatter.md +66 -0
- package/commands/_deepreview-pipeline.md +57 -0
- package/commands/deepreview-pr-review.md +61 -0
- package/package.json +30 -5
- package/src/diff-classifier.test.ts +45 -0
- package/src/diff-classifier.ts +63 -0
- package/src/graphql.ts +183 -0
- package/src/parse-threads.test.ts +58 -0
- package/src/parse-threads.ts +117 -0
- package/src/post-review.test.ts +52 -0
- package/src/post-review.ts +325 -0
- package/src/review-api.ts +253 -0
- package/src/review-helpers.ts +65 -0
- package/src/cli.js +0 -103
package/src/cli.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
"use strict";
|
|
4
|
-
|
|
5
|
-
const fs = require("node:fs");
|
|
6
|
-
const path = require("node:path");
|
|
7
|
-
const os = require("node:os");
|
|
8
|
-
|
|
9
|
-
const PACKAGE_ROOT = path.resolve(__dirname, "..");
|
|
10
|
-
const CONFIG_DIR = path.join(os.homedir(), ".config", "opencode");
|
|
11
|
-
const GITIGNORE_ENTRY = ".ai/deepreview/";
|
|
12
|
-
|
|
13
|
-
function ensureGitignore(filepath) {
|
|
14
|
-
let content = "";
|
|
15
|
-
if (fs.existsSync(filepath)) {
|
|
16
|
-
content = fs.readFileSync(filepath, "utf8");
|
|
17
|
-
if (content.split("\n").some((line) => line.trim() === GITIGNORE_ENTRY)) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const newline = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
|
|
22
|
-
fs.writeFileSync(filepath, content + newline + GITIGNORE_ENTRY + "\n");
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function globalGitignorePath() {
|
|
27
|
-
const { execSync } = require("node:child_process");
|
|
28
|
-
try {
|
|
29
|
-
return execSync("git config --global core.excludesFile", { encoding: "utf8" }).trim();
|
|
30
|
-
} catch {
|
|
31
|
-
return path.join(os.homedir(), ".config", "git", "ignore");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function install(flags) {
|
|
36
|
-
const agentsSrc = path.join(PACKAGE_ROOT, "agents");
|
|
37
|
-
const commandsSrc = path.join(PACKAGE_ROOT, "commands");
|
|
38
|
-
const agentsDest = path.join(CONFIG_DIR, "agents");
|
|
39
|
-
const commandsDest = path.join(CONFIG_DIR, "commands");
|
|
40
|
-
|
|
41
|
-
fs.mkdirSync(agentsDest, { recursive: true });
|
|
42
|
-
fs.mkdirSync(commandsDest, { recursive: true });
|
|
43
|
-
|
|
44
|
-
let count = 0;
|
|
45
|
-
|
|
46
|
-
for (const file of fs.readdirSync(agentsSrc)) {
|
|
47
|
-
if (!file.endsWith(".md")) continue;
|
|
48
|
-
fs.copyFileSync(path.join(agentsSrc, file), path.join(agentsDest, file));
|
|
49
|
-
count++;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
for (const file of fs.readdirSync(commandsSrc)) {
|
|
53
|
-
if (!file.endsWith(".md")) continue;
|
|
54
|
-
fs.copyFileSync(path.join(commandsSrc, file), path.join(commandsDest, file));
|
|
55
|
-
count++;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
console.log(`Installed ${count} files to ${CONFIG_DIR}`);
|
|
59
|
-
|
|
60
|
-
if (flags.has("--gitignore-global")) {
|
|
61
|
-
const ignorePath = globalGitignorePath();
|
|
62
|
-
fs.mkdirSync(path.dirname(ignorePath), { recursive: true });
|
|
63
|
-
if (ensureGitignore(ignorePath)) {
|
|
64
|
-
console.log(`Added ${GITIGNORE_ENTRY} to ${ignorePath}`);
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
const localIgnore = path.join(process.cwd(), ".gitignore");
|
|
68
|
-
if (ensureGitignore(localIgnore)) {
|
|
69
|
-
console.log(`Added ${GITIGNORE_ENTRY} to .gitignore`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function uninstall() {
|
|
75
|
-
const agentsDest = path.join(CONFIG_DIR, "agents");
|
|
76
|
-
const commandsDest = path.join(CONFIG_DIR, "commands");
|
|
77
|
-
let count = 0;
|
|
78
|
-
|
|
79
|
-
for (const dir of [agentsDest, commandsDest]) {
|
|
80
|
-
if (!fs.existsSync(dir)) continue;
|
|
81
|
-
for (const file of fs.readdirSync(dir)) {
|
|
82
|
-
if (!file.startsWith("deepreview") || !file.endsWith(".md")) continue;
|
|
83
|
-
fs.unlinkSync(path.join(dir, file));
|
|
84
|
-
count++;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
console.log(`Removed ${count} files from ${CONFIG_DIR}`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const args = process.argv.slice(2);
|
|
92
|
-
const command = args.find((a) => !a.startsWith("-"));
|
|
93
|
-
const flags = new Set(args.filter((a) => a.startsWith("-")));
|
|
94
|
-
|
|
95
|
-
if (command === "install") {
|
|
96
|
-
install(flags);
|
|
97
|
-
} else if (command === "uninstall") {
|
|
98
|
-
uninstall();
|
|
99
|
-
} else {
|
|
100
|
-
console.log("Usage: deepreview install [--gitignore-global]");
|
|
101
|
-
console.log(" deepreview uninstall");
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|