envseed 0.2.0 → 0.2.1
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/lib/log-incident.mjs +21 -2
- package/lib/redaction-review.mjs +5 -1
- package/package.json +1 -1
- package/postinstall.mjs +19 -9
package/lib/log-incident.mjs
CHANGED
|
@@ -195,12 +195,31 @@ async function main() {
|
|
|
195
195
|
const cwd = process.argv[3] || process.cwd();
|
|
196
196
|
const userNotes = process.argv.slice(4).join(' ') || '';
|
|
197
197
|
|
|
198
|
+
const log = (msg) => process.stdout.write(msg + '\n');
|
|
199
|
+
|
|
200
|
+
// Check upload credentials before doing any work
|
|
201
|
+
let config = {};
|
|
202
|
+
try {
|
|
203
|
+
config = JSON.parse(fs.readFileSync(path.join(INSTALL_DIR, 'config.json'), 'utf8'));
|
|
204
|
+
} catch {}
|
|
205
|
+
|
|
206
|
+
const hasDirectS3 = config.s3Bucket && config.s3Profile;
|
|
207
|
+
const hasApiKey = !!config.apiKey;
|
|
208
|
+
|
|
209
|
+
if (!hasDirectS3 && !hasApiKey) {
|
|
210
|
+
log('');
|
|
211
|
+
log('\x1b[31mError: No upload credentials configured.\x1b[0m');
|
|
212
|
+
log('');
|
|
213
|
+
log('Run \x1b[1menvseed login\x1b[0m to authenticate via GitHub and get an API key.');
|
|
214
|
+
log('');
|
|
215
|
+
log('Or set s3Profile in ~/.envseed/config.json for direct S3 upload.');
|
|
216
|
+
process.exit(1);
|
|
217
|
+
}
|
|
218
|
+
|
|
198
219
|
const incidentId = generateId();
|
|
199
220
|
const incidentDir = path.join(INCIDENTS_DIR, incidentId);
|
|
200
221
|
ensureDir(incidentDir);
|
|
201
222
|
|
|
202
|
-
const log = (msg) => process.stdout.write(msg + '\n');
|
|
203
|
-
|
|
204
223
|
log(`Incident ID: ${incidentId}`);
|
|
205
224
|
log(`Session: ${sessionId}`);
|
|
206
225
|
log(`CWD: ${cwd}`);
|
package/lib/redaction-review.mjs
CHANGED
|
@@ -193,13 +193,17 @@ function openTerminalWithClaude(stagingDir, log) {
|
|
|
193
193
|
fs.writeFileSync(promptFilePath, initialPrompt);
|
|
194
194
|
|
|
195
195
|
fs.writeFileSync(launcherPath, `#!/bin/bash
|
|
196
|
+
# Mark review complete on exit (normal, SIGHUP from terminal close, or SIGTERM)
|
|
197
|
+
mark_complete() {
|
|
198
|
+
touch "${stagingDir}/.redaction-complete"
|
|
199
|
+
}
|
|
200
|
+
trap mark_complete EXIT
|
|
196
201
|
cd "${stagingDir}" || exit 1
|
|
197
202
|
PROMPT=$(cat "${promptFilePath}")
|
|
198
203
|
claude \\
|
|
199
204
|
--allowedTools ${allowedTools} \\
|
|
200
205
|
--append-system-prompt "${APPEND_SYSTEM_PROMPT.replace(/"/g, '\\"')}" \\
|
|
201
206
|
"$PROMPT"
|
|
202
|
-
touch "${stagingDir}/.redaction-complete"
|
|
203
207
|
echo ""
|
|
204
208
|
echo "Redaction complete. You can close this tab."
|
|
205
209
|
`);
|
package/package.json
CHANGED
package/postinstall.mjs
CHANGED
|
@@ -22,10 +22,10 @@ const DEFAULT_CONFIG = {
|
|
|
22
22
|
alertThreshold: 3,
|
|
23
23
|
logAllEvents: true,
|
|
24
24
|
maxLogSizeMB: 500,
|
|
25
|
-
s3Bucket: '
|
|
26
|
-
s3Region: 'us-
|
|
25
|
+
s3Bucket: 'envseed-harvests',
|
|
26
|
+
s3Region: 'us-west-2',
|
|
27
27
|
s3Profile: '',
|
|
28
|
-
uploadEndpoint: 'https://
|
|
28
|
+
uploadEndpoint: 'https://w218r55zt6.execute-api.us-west-2.amazonaws.com',
|
|
29
29
|
githubClientId: 'Ov23lid2fKxyN7lOd9qv',
|
|
30
30
|
apiKey: '',
|
|
31
31
|
simulationCount: 2,
|
|
@@ -157,20 +157,30 @@ try {
|
|
|
157
157
|
|
|
158
158
|
// Auto-launch login if not already logged in and running interactively
|
|
159
159
|
if (!config.apiKey && process.stdout.isTTY) {
|
|
160
|
-
console.log('
|
|
160
|
+
console.log(' \x1b[33mOne more step:\x1b[0m Sign in to enable incident uploads.');
|
|
161
|
+
console.log(' This uses GitHub Device Flow — a code will appear that you');
|
|
162
|
+
console.log(' paste into GitHub to authorize envseed.');
|
|
161
163
|
console.log('');
|
|
162
164
|
try {
|
|
163
165
|
const binPath = path.join(INSTALL_DIR, 'bin', 'envseed.mjs');
|
|
164
|
-
spawnSync('node', [binPath, 'login'], { stdio: 'inherit' });
|
|
166
|
+
const result = spawnSync('node', [binPath, 'login'], { stdio: 'inherit' });
|
|
167
|
+
if (result.status === 0) {
|
|
168
|
+
console.log('');
|
|
169
|
+
console.log(' \x1b[32mAll set!\x1b[0m Restart Claude Code to activate monitoring.');
|
|
170
|
+
} else {
|
|
171
|
+
console.log('');
|
|
172
|
+
console.log(' Login skipped. Run \x1b[1menvseed login\x1b[0m later to enable uploads.');
|
|
173
|
+
console.log(' Monitoring will still run locally without login.');
|
|
174
|
+
}
|
|
165
175
|
} catch {
|
|
166
|
-
console.log(' Run
|
|
176
|
+
console.log(' Run \x1b[1menvseed login\x1b[0m to sign in.');
|
|
167
177
|
}
|
|
168
178
|
} else if (config.apiKey) {
|
|
169
|
-
console.log(`
|
|
179
|
+
console.log(` \x1b[32mAlready logged in.\x1b[0m`);
|
|
170
180
|
console.log(' Restart Claude Code to activate monitoring.');
|
|
171
181
|
} else {
|
|
172
|
-
console.log(' Next: run
|
|
173
|
-
console.log('
|
|
182
|
+
console.log(' Next: run \x1b[1menvseed login\x1b[0m to sign in.');
|
|
183
|
+
console.log(' Monitoring runs locally without login, but uploads require it.');
|
|
174
184
|
}
|
|
175
185
|
|
|
176
186
|
} catch (err) {
|