mellos-mapping 0.12.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.
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "mellos-mapping",
3
+ "version": "0.12.0",
4
+ "description": "A live layered dependency map for bottom-up development — MCP server + terminal pane. Ghost the design first, then light nodes up from the bottom as they are built and verified.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Mellos",
8
+ "homepage": "https://github.com/GuangminJu/mellos-mapping#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/GuangminJu/mellos-mapping.git"
12
+ },
13
+ "bugs": "https://github.com/GuangminJu/mellos-mapping/issues",
14
+ "keywords": [
15
+ "mcp",
16
+ "mcp-server",
17
+ "claude-code",
18
+ "codex",
19
+ "visualization",
20
+ "dependency-graph",
21
+ "bottom-up",
22
+ "terminal",
23
+ "tui"
24
+ ],
25
+ "bin": {
26
+ "mellos-mapping": "dist/server.mjs",
27
+ "mellos-mapping-watch": "dist/watch.mjs"
28
+ },
29
+ "publishConfig": {
30
+ "registry": "https://registry.npmjs.org/"
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "README.zh-CN.md",
35
+ "scripts/codex-register.mjs"
36
+ ],
37
+ "engines": {
38
+ "node": ">=18"
39
+ },
40
+ "scripts": {
41
+ "test": "vitest run",
42
+ "typecheck": "tsc --noEmit",
43
+ "build": "node build.mjs",
44
+ "verify": "npm run typecheck && npm run test && npm run build"
45
+ },
46
+ "devDependencies": {
47
+ "@modelcontextprotocol/sdk": "^1.12.0",
48
+ "@types/node": "^24.0.0",
49
+ "esbuild": "^0.25.0",
50
+ "typescript": "^5.8.0",
51
+ "vitest": "^3.1.0",
52
+ "zod": "^3.24.0"
53
+ }
54
+ }
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Register the bundled MCP server with Codex CLI — run once after installing
4
+ * or updating the plugin: `node <plugin root>/scripts/codex-register.mjs`.
5
+ *
6
+ * Why this script exists instead of a plugin-shipped .mcp.json: Codex spawns
7
+ * plugin-bundled MCP servers inside the plugin cache and gives them no way to
8
+ * learn the user's workspace (no ${PLUGIN_ROOT}-style expansion in args, cwd
9
+ * locked to the plugin root when set — verified empirically against
10
+ * codex-cli 0.147.0). The state file would land in the cache instead of the
11
+ * project. A user-level `codex mcp add` entry inherits the session's working
12
+ * directory, which is exactly the contract dist/server.mjs already expects.
13
+ * The registered path is absolute and version-specific, so re-run after
14
+ * every plugin update.
15
+ */
16
+ import { spawnSync } from 'node:child_process';
17
+ import { dirname, join } from 'node:path';
18
+ import { fileURLToPath } from 'node:url';
19
+
20
+ const pluginRoot = dirname(dirname(fileURLToPath(import.meta.url)));
21
+ const serverPath = join(pluginRoot, 'dist', 'server.mjs');
22
+
23
+ function codex(args) {
24
+ if (process.platform !== 'win32') {
25
+ return spawnSync('codex', args, { stdio: 'pipe', encoding: 'utf8' });
26
+ }
27
+ // Windows: codex may be an .exe or an npm .cmd shim; only a shell resolves
28
+ // both. The shell needs explicit quoting for paths with spaces.
29
+ const line = ['codex', ...args].map((a) => (/[\s"]/.test(a) ? `"${a}"` : a)).join(' ');
30
+ return spawnSync(line, { shell: true, stdio: 'pipe', encoding: 'utf8' });
31
+ }
32
+
33
+ // Idempotent: drop any previous (possibly stale, version-specific) entry.
34
+ codex(['mcp', 'remove', 'mellos-mapping']);
35
+
36
+ const added = codex(['mcp', 'add', 'mellos-mapping', '--', 'node', serverPath]);
37
+ if (added.error !== undefined || added.status !== 0) {
38
+ process.stderr.write(added.stderr ?? '');
39
+ console.error(
40
+ added.error !== undefined
41
+ ? 'codex CLI not found on PATH — install Codex first, then re-run this script.'
42
+ : `codex mcp add failed (exit ${added.status}).`,
43
+ );
44
+ process.exit(1);
45
+ }
46
+ process.stdout.write(added.stdout ?? '');
47
+ console.log(`mellos-mapping MCP registered with Codex: node ${serverPath}`);
48
+ console.log('State files resolve to each session’s working directory (.claude/mellos-mapping.json).');