opencode-prompt-recorder 1.2.4 → 1.3.0
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 +18 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
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
|
+
async function getVersion() {
|
|
7
|
+
try {
|
|
8
|
+
const packageJson = JSON.parse(await readFile(join(__dirname2, "package.json"), "utf-8"));
|
|
9
|
+
return packageJson.version;
|
|
10
|
+
} catch {
|
|
11
|
+
return "unknown";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
4
14
|
function sanitizeFilename(str) {
|
|
5
15
|
return str.replace(/[<>:"/\\|?*\x00-\x1f]/g, "").substring(0, 50).trim();
|
|
6
16
|
}
|
|
@@ -45,6 +55,12 @@ var OpenCodePromptRecorder = async ({ directory, client }) => {
|
|
|
45
55
|
let lastUserMessage = "";
|
|
46
56
|
return {
|
|
47
57
|
"chat.message": async (input, output) => {
|
|
58
|
+
try {
|
|
59
|
+
const version = await getVersion();
|
|
60
|
+
const versionDir = join(process.env.HOME || "", ".config", "opencode");
|
|
61
|
+
await mkdir(versionDir, { recursive: true });
|
|
62
|
+
await writeFile(join(versionDir, "opencode-prompt-recorder-version.txt"), version);
|
|
63
|
+
} catch (e) {}
|
|
48
64
|
if (output.message.role === "user") {
|
|
49
65
|
const text = output.parts.map((p) => p.type === "text" ? p.text : "").join("");
|
|
50
66
|
const sessionId = input.sessionID;
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-prompt-recorder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-prompt-recorder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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",
|