opencode-magi 0.0.0-dev-20260714064227 → 0.0.0-dev-20260714065541
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/dist/magi.js +13 -20
- package/dist/utils/fs.js +24 -0
- package/dist/utils/index.js +1 -0
- package/package.json +1 -1
package/dist/magi.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createOpencodeClient } from "@opencode-ai/sdk/v2";
|
|
2
2
|
import { print } from "graphql";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
|
-
import { appendFile, mkdir, readdir, readFile,
|
|
5
|
-
import { dirname, isAbsolute, join
|
|
4
|
+
import { appendFile, mkdir, readdir, readFile, writeFile, } from "node:fs/promises";
|
|
5
|
+
import { dirname, isAbsolute, join } from "node:path";
|
|
6
6
|
import { Octokit } from "octokit";
|
|
7
7
|
import { getConfig, resolvePermissions, validateConfig } from "@/config";
|
|
8
8
|
import { graphql } from "@/graphql";
|
|
9
|
-
import { command, createExec, filterEmpty, isArray, isNumber, isObject, merge, quote, } from "@/utils";
|
|
9
|
+
import { command, createExec, filterEmpty, isArray, isNumber, isObject, merge, quote, rm, } from "@/utils";
|
|
10
10
|
const active = new Set(["preparing", "running"]);
|
|
11
11
|
export class MagiError extends Error {
|
|
12
12
|
status;
|
|
@@ -267,7 +267,11 @@ export class Magi {
|
|
|
267
267
|
try {
|
|
268
268
|
const path = this.getPath(value);
|
|
269
269
|
await this.exec(command("git", "worktree", "remove", "--force", quote(path)));
|
|
270
|
-
await rm(path, {
|
|
270
|
+
await rm(path, {
|
|
271
|
+
force: true,
|
|
272
|
+
prune: this.input.directory,
|
|
273
|
+
recursive: true,
|
|
274
|
+
});
|
|
271
275
|
return 1;
|
|
272
276
|
}
|
|
273
277
|
catch {
|
|
@@ -286,22 +290,11 @@ export class Magi {
|
|
|
286
290
|
async deleteOutput(path) {
|
|
287
291
|
try {
|
|
288
292
|
const resolvedPath = this.getPath(path);
|
|
289
|
-
await rm(resolvedPath, {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
break;
|
|
295
|
-
try {
|
|
296
|
-
if ((await readdir(dir)).length)
|
|
297
|
-
break;
|
|
298
|
-
await rmdir(dir);
|
|
299
|
-
}
|
|
300
|
-
catch {
|
|
301
|
-
break;
|
|
302
|
-
}
|
|
303
|
-
dir = dirname(dir);
|
|
304
|
-
}
|
|
293
|
+
await rm(resolvedPath, {
|
|
294
|
+
force: true,
|
|
295
|
+
prune: this.input.directory,
|
|
296
|
+
recursive: true,
|
|
297
|
+
});
|
|
305
298
|
return 1;
|
|
306
299
|
}
|
|
307
300
|
catch {
|
package/dist/utils/fs.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { rm as originalRm, readdir, rmdir } from "node:fs/promises";
|
|
2
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
3
|
+
import { isString } from "./assertion";
|
|
4
|
+
export async function rm(path, { prune, ...options } = {}) {
|
|
5
|
+
await originalRm(path, options);
|
|
6
|
+
if (!prune)
|
|
7
|
+
return;
|
|
8
|
+
const root = resolve(isString(prune) ? prune : process.cwd());
|
|
9
|
+
let dir = dirname(resolve(path));
|
|
10
|
+
while (dir !== root) {
|
|
11
|
+
const value = relative(root, dir);
|
|
12
|
+
if (!value || value.startsWith("..") || isAbsolute(value))
|
|
13
|
+
break;
|
|
14
|
+
try {
|
|
15
|
+
if ((await readdir(dir)).length)
|
|
16
|
+
break;
|
|
17
|
+
await rmdir(dir);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
dir = dirname(dir);
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-magi",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260714065541",
|
|
4
4
|
"description": "Multi-agent PR review and merge orchestration plugin for OpenCode.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",
|