opencode-prompt-recorder 1.2.2 → 1.2.4
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 +2 -14
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
// index.ts
|
|
2
|
-
import { mkdir, appendFile, readdir
|
|
3
|
-
import { join
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
var packageJsonPath = join(__dirname2, "package.json");
|
|
7
|
-
async function getVersion() {
|
|
8
|
-
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf-8"));
|
|
9
|
-
return packageJson.version;
|
|
10
|
-
}
|
|
2
|
+
import { mkdir, appendFile, readdir } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
11
4
|
function sanitizeFilename(str) {
|
|
12
5
|
return str.replace(/[<>:"/\\|?*\x00-\x1f]/g, "").substring(0, 50).trim();
|
|
13
6
|
}
|
|
@@ -50,12 +43,8 @@ async function findExistingFile(directory, sessionId) {
|
|
|
50
43
|
}
|
|
51
44
|
var OpenCodePromptRecorder = async ({ directory, client }) => {
|
|
52
45
|
let lastUserMessage = "";
|
|
53
|
-
const versionFilePath = join(process.env.HOME || "", ".config", "opencode", "opencode-prompt-recorder-version.txt");
|
|
54
46
|
return {
|
|
55
47
|
"chat.message": async (input, output) => {
|
|
56
|
-
const version = await getVersion();
|
|
57
|
-
await mkdir(join(process.env.HOME || "", ".config", "opencode"), { recursive: true });
|
|
58
|
-
await writeFile(versionFilePath, version);
|
|
59
48
|
if (output.message.role === "user") {
|
|
60
49
|
const text = output.parts.map((p) => p.type === "text" ? p.text : "").join("");
|
|
61
50
|
const sessionId = input.sessionID;
|
|
@@ -92,7 +81,6 @@ ${text}`;
|
|
|
92
81
|
};
|
|
93
82
|
var opencode_prompt_recorder_default = OpenCodePromptRecorder;
|
|
94
83
|
export {
|
|
95
|
-
findExistingFile,
|
|
96
84
|
opencode_prompt_recorder_default as default,
|
|
97
85
|
OpenCodePromptRecorder
|
|
98
86
|
};
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-prompt-recorder",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
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.2.
|
|
3
|
+
"version": "1.2.4",
|
|
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",
|