chrome-devtools-mcp-for-extension 0.16.4 → 0.17.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.
@@ -1,5 +1,5 @@
1
1
  // src/profile-resolver.ts
2
- // Phase 1 (v0.15.0) + v0.15.1 (MCP_CLIENT_ID support)
2
+ // Phase 1 (v0.15.0) + v0.15.1 (MCP_CLIENT_ID support) + v0.17.0 (Hierarchical profiles)
3
3
  // - Hybrid priority (CLI > MCP_USER_DATA_DIR > MCP_PROJECT_ID > AUTO > DEFAULT)
4
4
  // - Auto-detection (git root -> nearest package.json -> cwd)
5
5
  // - Realpath normalization
@@ -7,6 +7,7 @@
7
7
  // - Short SHA-256 hash (8 chars)
8
8
  // - CI detection => ephemeral session profile (unless MCP_PERSIST_PROFILES)
9
9
  // - Client ID isolation (MCP_CLIENT_ID environment variable)
10
+ // - Hierarchical structure: {project}/{client}/{channel} (v0.17.0)
10
11
  // - Minimal console.error() logging of decision
11
12
  import fs from 'node:fs';
12
13
  import os from 'node:os';
@@ -90,8 +91,8 @@ export function resolveUserDataDir(opts) {
90
91
  // 3) ENV: MCP_PROJECT_ID (project-scoped persistent profile)
91
92
  const projectId = sanitize(opts.env.MCP_PROJECT_ID || '');
92
93
  if (projectId) {
93
- const key = `${projectId}_${clientId}`;
94
- const p = projectProfilePath(key, channel);
94
+ const key = projectId; // v0.17.0: clientId removed from projectKey
95
+ const p = projectProfilePath(key, clientId, channel);
95
96
  const result = {
96
97
  path: p,
97
98
  reason: 'MCP_PROJECT_ID',
@@ -106,12 +107,15 @@ export function resolveUserDataDir(opts) {
106
107
  }
107
108
  // 4) AUTO: detect by root -> name -> hash
108
109
  try {
110
+ console.error(`[profiles] AUTO detection: cwd="${opts.cwd}"`);
109
111
  const root = detectProjectRoot(opts.cwd);
112
+ console.error(`[profiles] AUTO detection: root="${root}"`);
110
113
  const name = detectProjectName(root);
114
+ console.error(`[profiles] AUTO detection: name="${name}"`);
111
115
  const realRoot = realpathSafe(root);
112
116
  const hash = shortHash(realRoot);
113
- const key = `${sanitize(name)}_${hash}_${clientId}`;
114
- const p = projectProfilePath(key, channel);
117
+ const key = `${sanitize(name)}_${hash}`; // v0.17.0: clientId removed from projectKey
118
+ const p = projectProfilePath(key, clientId, channel);
115
119
  const result = {
116
120
  path: p,
117
121
  reason: 'AUTO',
@@ -125,9 +129,10 @@ export function resolveUserDataDir(opts) {
125
129
  return result;
126
130
  }
127
131
  catch (e) {
132
+ console.error(`[profiles] AUTO detection FAILED: ${e}`);
128
133
  // 5) DEFAULT fallback
129
- const key = `project-default_${clientId}`;
130
- const p = projectProfilePath(key, channel);
134
+ const key = 'project-default'; // v0.17.0: clientId removed from projectKey
135
+ const p = projectProfilePath(key, clientId, channel);
131
136
  const result = {
132
137
  path: p,
133
138
  reason: 'DEFAULT',
@@ -146,8 +151,9 @@ function isCI(env) {
146
151
  // Common CI signals
147
152
  return env.CI === 'true' || env.GITHUB_ACTIONS === 'true';
148
153
  }
149
- function projectProfilePath(projectKey, channel) {
150
- const base = path.join(CACHE_ROOT, 'profiles', projectKey, channel);
154
+ function projectProfilePath(projectKey, clientId, channel) {
155
+ // v0.17.0: Hierarchical structure - {project}/{client}/{channel}
156
+ const base = path.join(CACHE_ROOT, 'profiles', projectKey, clientId, channel);
151
157
  return pathNormalize(base);
152
158
  }
153
159
  function shortHash(s) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-devtools-mcp-for-extension",
3
- "version": "0.16.4",
3
+ "version": "0.17.0",
4
4
  "description": "MCP server for Chrome extension development with Web Store automation. Fork of chrome-devtools-mcp with extension-specific tools.",
5
5
  "type": "module",
6
6
  "bin": "./build/src/index.js",