opencode-magi 0.0.0-dev-20260630073732 → 0.0.0-dev-20260630082136

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 (2) hide show
  1. package/dist/magi.js +19 -3
  2. package/package.json +1 -1
package/dist/magi.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createOpencodeClient } from "@opencode-ai/sdk/v2";
2
2
  import { print } from "graphql";
3
3
  import { randomUUID } from "node:crypto";
4
- import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
5
- import { dirname, isAbsolute, join } from "node:path";
4
+ import { mkdir, readdir, readFile, rm, rmdir, writeFile, } from "node:fs/promises";
5
+ import { dirname, isAbsolute, join, relative } from "node:path";
6
6
  import { Octokit } from "octokit";
7
7
  import { getConfig, resolvePermissions, validateConfig } from "@/config";
8
8
  import { graphql } from "@/graphql";
@@ -309,7 +309,23 @@ export class Magi {
309
309
  }
310
310
  async deleteOutput(path) {
311
311
  try {
312
- await rm(path, { force: true, recursive: true });
312
+ const resolvedPath = this.getPath(path);
313
+ await rm(resolvedPath, { force: true, recursive: true });
314
+ let dir = dirname(resolvedPath);
315
+ while (dir !== this.input.directory) {
316
+ const value = relative(this.input.directory, dir);
317
+ if (!value || value.startsWith("..") || isAbsolute(value))
318
+ break;
319
+ try {
320
+ if ((await readdir(dir)).length)
321
+ break;
322
+ await rmdir(dir);
323
+ }
324
+ catch {
325
+ break;
326
+ }
327
+ dir = dirname(dir);
328
+ }
313
329
  return 1;
314
330
  }
315
331
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magi",
3
- "version": "0.0.0-dev-20260630073732",
3
+ "version": "0.0.0-dev-20260630082136",
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>",