elsemeet-bridge 0.1.2 → 0.1.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.
@@ -3,7 +3,7 @@
3
3
  // bridge/bridge.ts
4
4
  import { spawn, spawnSync } from "node:child_process";
5
5
  import { createHash, randomBytes } from "node:crypto";
6
- import { copyFileSync, createWriteStream, existsSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
6
+ import { copyFileSync, createWriteStream, existsSync, mkdirSync, openSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
7
7
  import { createServer } from "node:http";
8
8
  import { homedir } from "node:os";
9
9
  import { basename, dirname, join, resolve } from "node:path";
@@ -40,7 +40,11 @@ var MCP_NAME = "elsemeet";
40
40
  var MAX_STARTS_PER_HOUR = 6;
41
41
  var WAIT_SECONDS = 50;
42
42
  var NO_SHIP = ["git push", "vercel", "npm publish", "gh"].flatMap((c) => [`Bash(${c}:*)`, `PowerShell(${c}:*)`]);
43
- var RUN_SETTINGS = JSON.stringify({ permissions: { blockReadsOutsideWorkingDirectories: true } });
43
+ var SECRET_FILES = ["**/.env", "**/.env.*", "**/*.pem", "**/*.key", "**/*.p12", "**/*.pfx", "**/id_rsa*", "**/id_ed25519*", "**/.npmrc", "**/.netrc", "**/credentials*.json", "**/service-account*.json"];
44
+ var RUN_SETTINGS = JSON.stringify({
45
+ permissions: { blockReadsOutsideWorkingDirectories: true, deny: SECRET_FILES.map((f) => `Read(${f})`) }
46
+ });
47
+ var LOGS_KEPT = 20;
44
48
  var RUN_WAIT_MINUTES = 45;
45
49
  function runNote(pushYes, startedAt = /* @__PURE__ */ new Date()) {
46
50
  const until = new Date(startedAt.getTime() + RUN_WAIT_MINUTES * 6e4).toISOString();
@@ -244,6 +248,7 @@ async function startAgent(productId, p, pushYes) {
244
248
  writeFileSync(mcpFile, mcpConfigFor(load().server, token), { mode: 384 });
245
249
  const { cmd: name, args: agentArgs } = agentCommand(p, mcpFile, pushYes);
246
250
  mkdirSync(file("logs"), { recursive: true });
251
+ pruneLogs();
247
252
  const logFile = file(`logs/${productId}-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}.jsonl`);
248
253
  const out = createWriteStream(logFile);
249
254
  log(`${p.name ?? productId}: starting ${name} /work in ${p.folder}${pushYes ? " \u2014 the Owner said yes to a push: this run may push" : ""} (log: ${logFile})`);
@@ -281,6 +286,14 @@ function updateProject(productId, change) {
281
286
  change(p);
282
287
  save(s);
283
288
  }
289
+ function pruneLogs() {
290
+ try {
291
+ const dir = file("logs");
292
+ const all = readdirSync(dir).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, t: statSync(join(dir, f)).mtimeMs })).sort((a, b) => b.t - a.t);
293
+ for (const { f } of all.slice(LOGS_KEPT - 1)) rmSync(join(dir, f), { force: true });
294
+ } catch {
295
+ }
296
+ }
284
297
  async function watch(productId, stop) {
285
298
  let backoff = 0;
286
299
  let ended;
@@ -508,6 +521,16 @@ Note: ${dir} has uncommitted changes. Your AI will work in this folder on its ow
508
521
  const pid = startBackground();
509
522
  console.log(`
510
523
  Connected: ${chosen.name} \u2192 ${dir}`);
524
+ console.log(
525
+ [
526
+ "",
527
+ "What this means for your data:",
528
+ " \xB7 Claude Code runs in this folder on its own and works as it always does: what it reads of your code goes to Anthropic, under your Claude account.",
529
+ " \xB7 What it writes into Elsemeet (the board, its reports) is seen by the people in this project; Talk may read it too (OpenAI).",
530
+ " \xB7 It may not read .env, keys or certificate files here \u2014 still, keep passwords and API keys out of your code and notes.",
531
+ ` \xB7 The log of each run stays on this computer only (${file("logs")}), the last ${LOGS_KEPT}.`
532
+ ].join("\n")
533
+ );
511
534
  console.log("Your Claude Code now starts here on its own when you mark a piece or propose something on the Work board, or Talk does it for you. A teammate\u2019s idea goes on the board, but does not start it.");
512
535
  console.log(`Running in the background (pid ${pid}); you can close this terminal.`);
513
536
  if (process.platform === "win32" && !autostartOn()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elsemeet-bridge",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Starts your Claude Code on /work when your Elsemeet project has something for it — connect once, in your project folder: npx elsemeet-bridge",
5
5
  "type": "module",
6
6
  "bin": { "elsemeet-bridge": "dist/elsemeet-bridge.mjs" },