@promptcellar/pc 0.3.2 → 0.3.3
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/hooks/codex-capture.js +14 -10
- package/package.json +5 -5
package/hooks/codex-capture.js
CHANGED
|
@@ -39,24 +39,28 @@ async function main() {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Extract the user's input messages
|
|
42
|
+
// Codex passes input-messages as an array of strings
|
|
42
43
|
const inputMessages = event['input-messages'] || [];
|
|
43
44
|
if (inputMessages.length === 0) {
|
|
44
45
|
process.exit(0);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
// Get the first
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
48
|
+
// Get the first message as the prompt
|
|
49
|
+
const firstMessage = inputMessages[0];
|
|
50
|
+
if (!firstMessage) {
|
|
50
51
|
process.exit(0);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
//
|
|
54
|
-
let content
|
|
55
|
-
if (
|
|
56
|
-
content =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.join('\n')
|
|
54
|
+
// Handle both string format (current Codex) and object format (future-proofing)
|
|
55
|
+
let content;
|
|
56
|
+
if (typeof firstMessage === 'string') {
|
|
57
|
+
content = firstMessage;
|
|
58
|
+
} else if (firstMessage.content) {
|
|
59
|
+
content = Array.isArray(firstMessage.content)
|
|
60
|
+
? firstMessage.content.filter(c => c.type === 'text').map(c => c.text).join('\n')
|
|
61
|
+
: firstMessage.content;
|
|
62
|
+
} else {
|
|
63
|
+
process.exit(0);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
if (!content.trim()) {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptcellar/pc",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "CLI for PromptCellar - sync prompts between your terminal and the cloud",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"pc": "
|
|
9
|
-
"pc-capture": "
|
|
10
|
-
"pc-codex-capture": "
|
|
11
|
-
"pc-gemini-capture": "
|
|
8
|
+
"pc": "bin/pc.js",
|
|
9
|
+
"pc-capture": "hooks/prompt-capture.js",
|
|
10
|
+
"pc-codex-capture": "hooks/codex-capture.js",
|
|
11
|
+
"pc-gemini-capture": "hooks/gemini-capture.js"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"test": "echo \"Error: no test specified\" && exit 1"
|