sessiongraph 1.0.11 → 1.0.13

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.
@@ -9,18 +9,27 @@ import { createInterface } from 'node:readline';
9
9
  const require = createRequire(import.meta.url);
10
10
  const root = dirname(dirname(fileURLToPath(import.meta.url)));
11
11
  const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
12
- const args = new Set(process.argv.slice(2));
13
- if (args.has('--version')) { console.log(`SessionGraph ${pkg.version}`); process.exit(0); }
14
- if (args.has('--help')) {
15
- console.log(`SessionGraph — Explore & visualize all your LLM sessions\n\n npx ${pkg.name} Open the desktop app\n npx ${pkg.name} --browser Open the local browser app\n\nChoose session sources on first launch. All imports and indexing stay local.`); process.exit(0);
16
- }
12
+ const argv = process.argv.slice(2);
13
+ if (argv.length === 1 && ['--version', '-v'].includes(argv[0])) { console.log(`SessionGraph ${pkg.version}`); process.exit(0); }
17
14
  if (Number(process.versions.node.split('.')[0]) < 24) { console.error('SessionGraph requires Node.js 24 or later for its launcher.'); process.exit(1); }
15
+ process.stdout.on('error', error => { if (error.code === 'EPIPE') process.exit(0); else throw error; });
16
+ if (argv.length && !(argv.length === 1 && argv[0] === '--browser')) {
17
+ try {
18
+ const { runCli } = await import('../dist-server/cli.mjs');
19
+ process.exitCode = await runCli(argv, { version: pkg.version });
20
+ } catch (error) {
21
+ const message = error.code === 'ERR_MODULE_NOT_FOUND' ? 'CLI bundle missing. Run pnpm build in a source checkout, or reinstall sessiongraph.' : error.message;
22
+ if (argv.includes('--json')) console.log(JSON.stringify({ schemaVersion: 1, command: 'cli', error: { code: 'STARTUP_FAILED', message } }));
23
+ else console.error(message);
24
+ process.exitCode = 1;
25
+ }
26
+ } else {
18
27
  function open(target) {
19
28
  const [file, params] = process.platform === 'darwin' ? ['open', [target]] : process.platform === 'win32' ? ['rundll32.exe', ['url.dll,FileProtocolHandler', target]] : ['xdg-open', [target]];
20
29
  const child = spawn(file, params, { stdio: 'ignore', detached: true });
21
30
  child.on('error', () => console.error('Could not open the application. Check your desktop environment.')); child.unref();
22
31
  }
23
- if (!args.has('--browser')) {
32
+ if (!argv.includes('--browser')) {
24
33
  const name = `${pkg.name}-app-${process.platform}-${process.arch}`;
25
34
  try {
26
35
  const manifest = require.resolve(`${name}/package.json`);
@@ -41,3 +50,4 @@ if (!args.has('--browser')) {
41
50
  child.on('exit', (code) => { process.exitCode = code || 0; });
42
51
  for (const signal of ['SIGINT', 'SIGTERM']) process.on(signal, () => { child.kill(); });
43
52
  }
53
+ }
@@ -1 +1 @@
1
- import{n as u}from"./index-DPovJIlT.js";function p(t,e,c){t.open&&(t.addEventListener("close",()=>c(e),{once:!0}),t.close())}function b(t,e,c){const l=document.createDocumentFragment(),i=document.createElement("header");i.className="sharing-header";const s=document.createElement("h2");s.id=`sharing-${e}-title`,s.textContent="Share SessionGraph",t.setAttribute("aria-labelledby",s.id);const n=document.createElement("button");n.type="button",n.className="text-button",n.textContent="Close",n.setAttribute("aria-label","Close sharing"),n.onclick=()=>t.close(),i.append(s,n);const r=document.createElement("div");r.className="sharing-modes",r.setAttribute("role","group"),r.setAttribute("aria-label","Share method");for(const a of["publish","video"]){const o=document.createElement("button");o.type="button",o.dataset.shareMode=a,o.textContent=a==="publish"?"Publish":"Video",o.setAttribute("aria-pressed",String(a===e)),o.onclick=()=>{a!==e&&p(t,a,c)},r.append(o)}return l.append(i,r),l}async function d(t,e){await u("plugin:opener|open_url",{url:t,with:e})}function h(t){const e=new URL(t);if(!["https:","http:"].includes(e.protocol)||e.username||e.password)throw new Error("Choose a valid web link.");return e.href}async function f(t,e=d){await e(h(t))}export{h as e,f as o,b as s};
1
+ import{n as u}from"./index-CDA8pT1Q.js";function p(t,e,c){t.open&&(t.addEventListener("close",()=>c(e),{once:!0}),t.close())}function b(t,e,c){const l=document.createDocumentFragment(),i=document.createElement("header");i.className="sharing-header";const s=document.createElement("h2");s.id=`sharing-${e}-title`,s.textContent="Share SessionGraph",t.setAttribute("aria-labelledby",s.id);const n=document.createElement("button");n.type="button",n.className="text-button",n.textContent="Close",n.setAttribute("aria-label","Close sharing"),n.onclick=()=>t.close(),i.append(s,n);const r=document.createElement("div");r.className="sharing-modes",r.setAttribute("role","group"),r.setAttribute("aria-label","Share method");for(const a of["publish","video"]){const o=document.createElement("button");o.type="button",o.dataset.shareMode=a,o.textContent=a==="publish"?"Publish":"Video",o.setAttribute("aria-pressed",String(a===e)),o.onclick=()=>{a!==e&&p(t,a,c)},r.append(o)}return l.append(i,r),l}async function d(t,e){await u("plugin:opener|open_url",{url:t,with:e})}function h(t){const e=new URL(t);if(!["https:","http:"].includes(e.protocol)||e.username||e.password)throw new Error("Choose a valid web link.");return e.href}async function f(t,e=d){await e(h(t))}export{h as e,f as o,b as s};