@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.
@@ -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 user message as the prompt
48
- const userMessage = inputMessages.find(m => m.role === 'user');
49
- if (!userMessage || !userMessage.content) {
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
- // Extract content (handle both string and array formats)
54
- let content = userMessage.content;
55
- if (Array.isArray(content)) {
56
- content = content
57
- .filter(c => c.type === 'text')
58
- .map(c => c.text)
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.2",
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": "./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"
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"