@claudetools/tools 0.3.4 → 0.3.5

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.
@@ -14,7 +14,8 @@ export interface ProjectsCache {
14
14
  last_sync: string;
15
15
  }
16
16
  /**
17
- * Validates that a project ID is a proper UUID format
17
+ * Validates that a project ID is in a valid format
18
+ * Accepts both API-registered (proj_*) and local fallback (local_*) formats
18
19
  */
19
20
  export declare function isValidProjectId(id: string): boolean;
20
21
  /**
@@ -13,10 +13,19 @@ export const PROJECTS_FILE = getProjectsPath();
13
13
  // Cache for resolved project ID
14
14
  let resolvedProjectId = null;
15
15
  /**
16
- * Validates that a project ID is a proper UUID format
16
+ * Validates that a project ID is in a valid format
17
+ * Accepts both API-registered (proj_*) and local fallback (local_*) formats
17
18
  */
18
19
  export function isValidProjectId(id) {
19
- return /^proj_[a-f0-9]{20}$/.test(id);
20
+ // API-registered format: proj_ followed by 20 hex chars
21
+ if (/^proj_[a-f0-9]{20}$/.test(id)) {
22
+ return true;
23
+ }
24
+ // Local fallback format: local_ followed by sanitized project name
25
+ if (/^local_[a-z0-9_]+$/.test(id)) {
26
+ return true;
27
+ }
28
+ return false;
20
29
  }
21
30
  /**
22
31
  * Finds a project binding in the cache by directory path
@@ -78,7 +87,7 @@ export async function resolveProjectIdAsync() {
78
87
  // Validate UUID format
79
88
  if (!isValidProjectId(envProjectId)) {
80
89
  throw new Error(`Invalid project ID format in CLAUDETOOLS_PROJECT_ID: ${envProjectId}. ` +
81
- `Expected format: proj_xxxxxxxxxxxxxxxxxxxx (20 hex chars)`);
90
+ `Expected format: proj_xxxxxxxxxxxxxxxxxxxx or local_projectname`);
82
91
  }
83
92
  resolvedProjectId = envProjectId;
84
93
  mcpLogger.debug('MEMORY', `Using project ID from env: ${resolvedProjectId}`);
@@ -135,7 +144,7 @@ export function getDefaultProjectId() {
135
144
  if (config.defaultProjectId) {
136
145
  if (!isValidProjectId(config.defaultProjectId)) {
137
146
  throw new Error(`Invalid defaultProjectId in config: ${config.defaultProjectId}. ` +
138
- `Expected format: proj_xxxxxxxxxxxxxxxxxxxx (20 hex chars)`);
147
+ `Expected format: proj_xxxxxxxxxxxxxxxxxxxx or local_projectname`);
139
148
  }
140
149
  _defaultProjectId = config.defaultProjectId;
141
150
  return _defaultProjectId;
@@ -155,7 +164,7 @@ export async function getDefaultProjectIdAsync() {
155
164
  if (config.defaultProjectId) {
156
165
  if (!isValidProjectId(config.defaultProjectId)) {
157
166
  throw new Error(`Invalid defaultProjectId in config: ${config.defaultProjectId}. ` +
158
- `Expected format: proj_xxxxxxxxxxxxxxxxxxxx (20 hex chars)`);
167
+ `Expected format: proj_xxxxxxxxxxxxxxxxxxxx or local_projectname`);
159
168
  }
160
169
  _defaultProjectId = config.defaultProjectId;
161
170
  return _defaultProjectId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudetools/tools",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Persistent AI memory, task management, and codebase intelligence for Claude Code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",