opencode-prompt-recorder 1.2.0 → 1.2.2
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 +6 -3
- package/dist/package.json +53 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,8 +4,10 @@ import { join, dirname } from "path";
|
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
var packageJsonPath = join(__dirname2, "package.json");
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
async function getVersion() {
|
|
8
|
+
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf-8"));
|
|
9
|
+
return packageJson.version;
|
|
10
|
+
}
|
|
9
11
|
function sanitizeFilename(str) {
|
|
10
12
|
return str.replace(/[<>:"/\\|?*\x00-\x1f]/g, "").substring(0, 50).trim();
|
|
11
13
|
}
|
|
@@ -51,8 +53,9 @@ var OpenCodePromptRecorder = async ({ directory, client }) => {
|
|
|
51
53
|
const versionFilePath = join(process.env.HOME || "", ".config", "opencode", "opencode-prompt-recorder-version.txt");
|
|
52
54
|
return {
|
|
53
55
|
"chat.message": async (input, output) => {
|
|
56
|
+
const version = await getVersion();
|
|
54
57
|
await mkdir(join(process.env.HOME || "", ".config", "opencode"), { recursive: true });
|
|
55
|
-
await writeFile(versionFilePath,
|
|
58
|
+
await writeFile(versionFilePath, version);
|
|
56
59
|
if (output.message.role === "user") {
|
|
57
60
|
const text = output.parts.map((p) => p.type === "text" ? p.text : "").join("");
|
|
58
61
|
const sessionId = input.sessionID;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-prompt-recorder",
|
|
3
|
+
"version": "1.2.2",
|
|
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.2.
|
|
3
|
+
"version": "1.2.2",
|
|
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
|
},
|