@mmmjk/context-bridge 0.1.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.
@@ -0,0 +1,30 @@
1
+ import { readFileSync, writeFileSync } from "node:fs";
2
+ import { mkdirSync } from "node:fs";
3
+ import { dirname } from "node:path";
4
+ export function readJsonl(path) {
5
+ const text = readFileSync(path, "utf8");
6
+ const rows = [];
7
+ for (const raw of text.split(/\r?\n/)) {
8
+ const line = raw.trim();
9
+ if (!line)
10
+ continue;
11
+ rows.push(JSON.parse(line));
12
+ }
13
+ return rows;
14
+ }
15
+ export function writeJsonl(path, rows) {
16
+ mkdirSync(dirname(path), { recursive: true });
17
+ writeFileSync(path, rows.map((r) => JSON.stringify(r)).join("\n") + "\n", "utf8");
18
+ }
19
+ export function readJsonFile(path, fallback) {
20
+ try {
21
+ return JSON.parse(readFileSync(path, "utf8"));
22
+ }
23
+ catch {
24
+ return fallback;
25
+ }
26
+ }
27
+ export function writeJsonFile(path, value) {
28
+ mkdirSync(dirname(path), { recursive: true });
29
+ writeFileSync(path, JSON.stringify(value, null, 2), "utf8");
30
+ }
@@ -0,0 +1,12 @@
1
+ import { homedir } from "node:os";
2
+ import { resolve } from "node:path";
3
+ export function expandHome(path) {
4
+ if (path === "~")
5
+ return homedir();
6
+ if (path.startsWith("~/"))
7
+ return resolve(homedir(), path.slice(2));
8
+ return path;
9
+ }
10
+ export function envPath(name, fallback) {
11
+ return process.env[name] || fallback;
12
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@mmmjk/context-bridge",
3
+ "version": "0.1.0",
4
+ "description": "Local-first session bridge to translate, copy, and sync coding-agent histories across Claude Code, Codex, and MCP tools.",
5
+ "type": "module",
6
+ "homepage": "https://www.npmjs.com/package/@mmmjk/context-bridge",
7
+ "bugs": {
8
+ "url": "https://www.npmjs.com/package/@mmmjk/context-bridge"
9
+ },
10
+ "bin": {
11
+ "context-bridge": "dist/src/cli.js",
12
+ "ctxb": "dist/src/cli.js"
13
+ },
14
+ "files": [
15
+ "dist/src/",
16
+ "README.md",
17
+ "CHANGELOG.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "test": "npm run build && node scripts/run-tests.mjs",
23
+ "test:unit": "npm run build && node --test",
24
+ "prepack": "npm run build",
25
+ "pack:dry": "npm pack --dry-run",
26
+ "publish:dry": "npm publish --dry-run --access public"
27
+ },
28
+ "keywords": [
29
+ "ai",
30
+ "agents",
31
+ "agent-session",
32
+ "session",
33
+ "resume",
34
+ "translator",
35
+ "migration",
36
+ "claude-code",
37
+ "codex",
38
+ "mcp",
39
+ "cli"
40
+ ],
41
+ "license": "MIT",
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^20.19.0",
50
+ "typescript": "^5.8.0"
51
+ }
52
+ }