opencode-prompt-recorder 1.1.0 → 1.2.1

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/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  // index.ts
2
- import { mkdir, appendFile, readdir } from "fs/promises";
3
- import { join } from "path";
2
+ import { mkdir, appendFile, readdir, writeFile, readFile } from "fs/promises";
3
+ import { join, dirname } from "path";
4
+ import { fileURLToPath } from "url";
5
+ var __dirname2 = dirname(fileURLToPath(import.meta.url));
6
+ var packageJsonPath = join(__dirname2, "package.json");
7
+ var packageJson = JSON.parse(await readFile(packageJsonPath, "utf-8"));
8
+ var PLUGIN_VERSION = packageJson.version;
4
9
  function sanitizeFilename(str) {
5
10
  return str.replace(/[<>:"/\\|?*\x00-\x1f]/g, "").substring(0, 50).trim();
6
11
  }
@@ -43,8 +48,11 @@ async function findExistingFile(directory, sessionId) {
43
48
  }
44
49
  var OpenCodePromptRecorder = async ({ directory, client }) => {
45
50
  let lastUserMessage = "";
51
+ const versionFilePath = join(process.env.HOME || "", ".config", "opencode", "opencode-prompt-recorder-version.txt");
46
52
  return {
47
53
  "chat.message": async (input, output) => {
54
+ await mkdir(join(process.env.HOME || "", ".config", "opencode"), { recursive: true });
55
+ await writeFile(versionFilePath, PLUGIN_VERSION);
48
56
  if (output.message.role === "user") {
49
57
  const text = output.parts.map((p) => p.type === "text" ? p.text : "").join("");
50
58
  const sessionId = input.sessionID;
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "opencode-prompt-recorder",
3
+ "version": "1.2.1",
4
+ "description": "OpenCode plugin for recording user prompts. Automatically saves user messages to a local file system with organized directory structure.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "bun build index.ts --outdir dist --target node && cp package.json dist/",
21
+ "prepublishOnly": "bun run build",
22
+ "test": "npx tsx test/index.ts"
23
+ },
24
+ "keywords": [
25
+ "opencode",
26
+ "prompt",
27
+ "recording",
28
+ "logging",
29
+ "plugin",
30
+ "llm",
31
+ "ai",
32
+ "audit"
33
+ ],
34
+ "author": "anarckk",
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/anarckk/opencode-prompt-recorder.git"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/anarckk/opencode-prompt-recorder/issues"
42
+ },
43
+ "homepage": "https://github.com/anarckk/opencode-prompt-recorder#readme",
44
+ "peerDependencies": {
45
+ "@opencode-ai/plugin": ">=0.15.0",
46
+ "typescript": ">=5.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@opencode-ai/plugin": "^0.15.0",
50
+ "@types/bun": "^1.3.1",
51
+ "typescript": "^5.9.3"
52
+ }
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-prompt-recorder",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "OpenCode plugin for recording user prompts. Automatically saves user messages to a local file system with organized directory structure.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "scripts": {
20
- "build": "bun build index.ts --outdir dist --target node",
20
+ "build": "bun build index.ts --outdir dist --target node && cp package.json dist/",
21
21
  "prepublishOnly": "bun run build",
22
22
  "test": "npx tsx test/index.ts"
23
23
  },