resumecontext 0.1.1 → 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.
package/dist/browser.js CHANGED
@@ -1,20 +1,32 @@
1
1
  import { spawn } from "node:child_process";
2
- /** Best-effort -- opens the user's default browser to `url`. Never throws:
3
- * the CLI always prints the URL first, so a failure here just means the
4
- * user opens it by hand instead of automatically. */
5
- export function openInBrowser(url) {
2
+ /** Starts `command` detached and forgets about it. A missing command (no
3
+ * xdg-open on a headless server, say) is not thrown by spawn: it arrives
4
+ * later as an 'error' event, and an EventEmitter with no 'error' listener
5
+ * crashes the whole process. So both the synchronous throw and the event
6
+ * are swallowed here. */
7
+ export function launchDetached(command, args, options = {}) {
6
8
  try {
7
- if (process.platform === "darwin") {
8
- spawn("open", [url], { stdio: "ignore", detached: true }).unref();
9
- }
10
- else if (process.platform === "win32") {
11
- spawn("cmd", ["/c", "start", '""', url], { stdio: "ignore", detached: true, shell: true }).unref();
12
- }
13
- else {
14
- spawn("xdg-open", [url], { stdio: "ignore", detached: true }).unref();
15
- }
9
+ const child = spawn(command, args, { stdio: "ignore", detached: true, ...options });
10
+ child.on("error", () => {
11
+ // fine -- the caller has a fallback
12
+ });
13
+ child.unref();
16
14
  }
17
15
  catch {
18
- // fine -- URL was already printed
16
+ // fine -- the caller has a fallback
17
+ }
18
+ }
19
+ /** Best-effort -- opens the user's default browser to `url`. Never throws
20
+ * and never crashes the CLI: the URL is always printed first, so a failure
21
+ * here just means the user opens it by hand instead of automatically. */
22
+ export function openInBrowser(url) {
23
+ if (process.platform === "darwin") {
24
+ launchDetached("open", [url]);
25
+ }
26
+ else if (process.platform === "win32") {
27
+ launchDetached("cmd", ["/c", "start", '""', url], { shell: true });
28
+ }
29
+ else {
30
+ launchDetached("xdg-open", [url]);
19
31
  }
20
32
  }
@@ -61,6 +61,15 @@ export function readProjectMarker(root) {
61
61
  * commands/init.ts for why that's deliberate, not some inferred parent
62
62
  * directory). */
63
63
  export function writeMarker(root, projectId) {
64
+ // Re-running `init` where this project's marker already exists -- setting
65
+ // up another machine from a clone, or just checking -- leaves the file as
66
+ // it is. createdAt is when the project began: the Cursor importer skips
67
+ // sessions older than it, so resetting it to now would silently drop that
68
+ // machine's earlier sessions, and would dirty a file that is usually
69
+ // committed.
70
+ const existing = readMarker(root);
71
+ if (existing?.projectId === projectId && !Number.isNaN(Date.parse(existing.createdAt)))
72
+ return existing;
64
73
  const marker = { projectId, createdAt: new Date().toISOString() };
65
74
  fs.writeFileSync(path.join(root, MARKER_FILENAME), JSON.stringify(marker, null, 2) + "\n");
66
75
  return marker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resumecontext",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Sync your coding-agent sessions to a shared archive your agents can search over MCP.",
5
5
  "keywords": [
6
6
  "mcp",