@promptcellar/pc 0.5.5 → 0.6.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.
@@ -16,7 +16,7 @@
16
16
  */
17
17
 
18
18
  import { capturePrompt } from '../src/lib/api.js';
19
- import { getFullContext } from '../src/lib/context.js';
19
+ import { getFullContext, collectContextFileContents } from '../src/lib/context.js';
20
20
  import { isLoggedIn, isVaultAvailable } from '../src/lib/config.js';
21
21
  import { encryptPrompt } from '../src/lib/crypto.js';
22
22
  import { requireVaultKey } from '../src/lib/keychain.js';
@@ -84,6 +84,15 @@ async function main() {
84
84
  process.exit(0);
85
85
  }
86
86
 
87
+ // Collect and encrypt context files once for the session
88
+ let encrypted_context_files, context_files_iv;
89
+ const contextFileContents = collectContextFileContents('codex', event.cwd || process.cwd());
90
+ if (contextFileContents) {
91
+ const enc = encryptPrompt(JSON.stringify(contextFileContents), vaultKey);
92
+ encrypted_context_files = enc.encrypted_content;
93
+ context_files_iv = enc.content_iv;
94
+ }
95
+
87
96
  // Capture each new message
88
97
  for (const message of newMessages) {
89
98
  const content = extractContent(message);
@@ -103,7 +112,9 @@ async function main() {
103
112
  await capturePrompt({
104
113
  ...context,
105
114
  encrypted_content,
106
- content_iv
115
+ content_iv,
116
+ encrypted_context_files,
117
+ context_files_iv,
107
118
  });
108
119
  }
109
120
 
@@ -16,7 +16,7 @@
16
16
  */
17
17
 
18
18
  import { capturePrompt } from '../src/lib/api.js';
19
- import { getFullContext } from '../src/lib/context.js';
19
+ import { getFullContext, collectContextFileContents } from '../src/lib/context.js';
20
20
  import { isLoggedIn, isVaultAvailable } from '../src/lib/config.js';
21
21
  import { encryptPrompt } from '../src/lib/crypto.js';
22
22
  import { requireVaultKey } from '../src/lib/keychain.js';
@@ -85,10 +85,20 @@ async function main() {
85
85
  }
86
86
  const { encrypted_content, content_iv } = encryptPrompt(content, vaultKey);
87
87
 
88
+ let encrypted_context_files, context_files_iv;
89
+ const contextFileContents = collectContextFileContents('gemini', event.cwd || process.cwd());
90
+ if (contextFileContents) {
91
+ const enc = encryptPrompt(JSON.stringify(contextFileContents), vaultKey);
92
+ encrypted_context_files = enc.encrypted_content;
93
+ context_files_iv = enc.content_iv;
94
+ }
95
+
88
96
  await capturePrompt({
89
97
  ...context,
90
98
  encrypted_content,
91
- content_iv
99
+ content_iv,
100
+ encrypted_context_files,
101
+ context_files_iv,
92
102
  });
93
103
 
94
104
  respond();
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import { capturePrompt } from '../src/lib/api.js';
14
- import { getFullContext } from '../src/lib/context.js';
14
+ import { getFullContext, collectContextFileContents } from '../src/lib/context.js';
15
15
  import { isLoggedIn, isVaultAvailable } from '../src/lib/config.js';
16
16
  import { encryptPrompt } from '../src/lib/crypto.js';
17
17
  import { requireVaultKey } from '../src/lib/keychain.js';
@@ -68,10 +68,20 @@ async function main() {
68
68
  }
69
69
  const { encrypted_content, content_iv } = encryptPrompt(promptContent, vaultKey);
70
70
 
71
+ let encrypted_context_files, context_files_iv;
72
+ const contextFileContents = collectContextFileContents('claude-code', event.cwd || process.cwd());
73
+ if (contextFileContents) {
74
+ const enc = encryptPrompt(JSON.stringify(contextFileContents), vaultKey);
75
+ encrypted_context_files = enc.encrypted_content;
76
+ context_files_iv = enc.content_iv;
77
+ }
78
+
71
79
  await capturePrompt({
72
80
  ...context,
73
81
  encrypted_content,
74
- content_iv
82
+ content_iv,
83
+ encrypted_context_files,
84
+ context_files_iv,
75
85
  });
76
86
 
77
87
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptcellar/pc",
3
- "version": "0.5.5",
3
+ "version": "0.6.0",
4
4
  "description": "CLI for Prompt Cellar - sync prompts between your terminal and the cloud",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -2,6 +2,7 @@ import { getCaptureLevel, getSessionId } from './config.js';
2
2
  import {
3
3
  getGitContext as coreGitContext,
4
4
  getFullContext as coreFullContext,
5
+ collectContextFileContents as coreCollectContextFileContents,
5
6
  } from '@promptcellar/core/context';
6
7
 
7
8
  export { sanitizeGitRemote } from '@promptcellar/core/context';
@@ -21,4 +22,8 @@ export function getFullContext(tool, model, overrides = {}) {
21
22
  });
22
23
  }
23
24
 
24
- export default { getGitContext, getFullContext };
25
+ export function collectContextFileContents(tool, cwd) {
26
+ return coreCollectContextFileContents({ tool, cwd });
27
+ }
28
+
29
+ export default { getGitContext, getFullContext, collectContextFileContents };