opencode-debug-agent 0.1.3 → 0.1.5

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/index.js +30 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13933,7 +13933,7 @@ var cors = (options) => {
13933
13933
  };
13934
13934
 
13935
13935
  // src/server.ts
13936
- import { mkdir } from "fs/promises";
13936
+ import { mkdir, appendFile, readFile } from "fs/promises";
13937
13937
  import { dirname } from "path";
13938
13938
 
13939
13939
  class DebugServer {
@@ -13973,6 +13973,7 @@ class DebugServer {
13973
13973
  });
13974
13974
  app.get("/health", (c) => c.text("OK"));
13975
13975
  await mkdir(dirname(this.logFile), { recursive: true });
13976
+ await this.ensureGitignore();
13976
13977
  const file2 = Bun.file(this.logFile);
13977
13978
  this.writer = file2.writer({ highWaterMark: 1024 * 8 });
13978
13979
  this.server = Bun.serve({
@@ -14084,6 +14085,33 @@ class DebugServer {
14084
14085
  await mkdir(dirname(this.portFile), { recursive: true });
14085
14086
  await Bun.write(this.portFile, String(port));
14086
14087
  }
14088
+ async ensureGitignore() {
14089
+ const gitignorePath = ".gitignore";
14090
+ const entries = [".opencode/debug.port", ".opencode/debug.log"];
14091
+ try {
14092
+ let content = "";
14093
+ try {
14094
+ content = await readFile(gitignorePath, "utf-8");
14095
+ } catch {}
14096
+ const lines = content.split(`
14097
+ `).map((l) => l.trim());
14098
+ const toAdd = [];
14099
+ for (const entry of entries) {
14100
+ if (!lines.includes(entry)) {
14101
+ toAdd.push(entry);
14102
+ }
14103
+ }
14104
+ if (toAdd.length === 0) {
14105
+ return;
14106
+ }
14107
+ const newline = content.length > 0 && !content.endsWith(`
14108
+ `) ? `
14109
+ ` : "";
14110
+ await appendFile(gitignorePath, `${newline}${toAdd.join(`
14111
+ `)}
14112
+ `);
14113
+ } catch {}
14114
+ }
14087
14115
  }
14088
14116
  var debugServer = new DebugServer;
14089
14117
 
@@ -14290,7 +14318,7 @@ var DEBUG_SKILL = {
14290
14318
  > [Remove instrumentation from lines 42 and 67]
14291
14319
  \`\`\``
14292
14320
  };
14293
- var DebugAgentPlugin = async (ctx) => {
14321
+ var DebugAgentPlugin = async () => {
14294
14322
  return {
14295
14323
  tool: {
14296
14324
  debug_start: debugStart,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-debug-agent",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "OpenCode plugin for runtime debugging - capture and analyze execution data",
5
5
  "author": {
6
6
  "name": "anis00723",