@claudetools/tools 0.3.9 → 0.5.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.
Files changed (47) hide show
  1. package/README.md +60 -4
  2. package/dist/cli.js +0 -0
  3. package/dist/codedna/generators/base.d.ts +41 -0
  4. package/dist/codedna/generators/base.js +102 -0
  5. package/dist/codedna/generators/express-api.d.ts +12 -0
  6. package/dist/codedna/generators/express-api.js +61 -0
  7. package/dist/codedna/index.d.ts +4 -0
  8. package/dist/codedna/index.js +7 -0
  9. package/dist/codedna/parser.d.ts +117 -0
  10. package/dist/codedna/parser.js +233 -0
  11. package/dist/codedna/registry.d.ts +60 -0
  12. package/dist/codedna/registry.js +217 -0
  13. package/dist/codedna/template-engine.d.ts +17 -0
  14. package/dist/codedna/template-engine.js +183 -0
  15. package/dist/codedna/types.d.ts +64 -0
  16. package/dist/codedna/types.js +4 -0
  17. package/dist/handlers/codedna-handlers.d.ts +122 -0
  18. package/dist/handlers/codedna-handlers.js +194 -0
  19. package/dist/handlers/tool-handlers.js +593 -14
  20. package/dist/helpers/api-client.d.ts +37 -0
  21. package/dist/helpers/api-client.js +70 -0
  22. package/dist/helpers/codedna-monitoring.d.ts +34 -0
  23. package/dist/helpers/codedna-monitoring.js +159 -0
  24. package/dist/helpers/error-tracking.d.ts +73 -0
  25. package/dist/helpers/error-tracking.js +164 -0
  26. package/dist/helpers/library-detection.d.ts +26 -0
  27. package/dist/helpers/library-detection.js +145 -0
  28. package/dist/helpers/tasks-retry.d.ts +49 -0
  29. package/dist/helpers/tasks-retry.js +168 -0
  30. package/dist/helpers/tasks.d.ts +24 -1
  31. package/dist/helpers/tasks.js +146 -50
  32. package/dist/helpers/usage-analytics.d.ts +91 -0
  33. package/dist/helpers/usage-analytics.js +256 -0
  34. package/dist/helpers/workers.d.ts +25 -0
  35. package/dist/helpers/workers.js +80 -0
  36. package/dist/templates/claude-md.d.ts +1 -1
  37. package/dist/templates/claude-md.js +16 -5
  38. package/dist/tools.js +314 -0
  39. package/docs/AUTO-REGISTRATION.md +353 -0
  40. package/docs/CLAUDE4_PROMPT_ANALYSIS.md +589 -0
  41. package/docs/ENTITY_DSL_REFERENCE.md +685 -0
  42. package/docs/MODERN_STACK_COMPLETE_GUIDE.md +706 -0
  43. package/docs/PROMPT_STANDARDIZATION_RESULTS.md +324 -0
  44. package/docs/PROMPT_TIER_TEMPLATES.md +787 -0
  45. package/docs/RESEARCH_METHODOLOGY_EXTRACTION.md +336 -0
  46. package/package.json +14 -3
  47. package/scripts/verify-prompt-compliance.sh +197 -0
package/dist/tools.js CHANGED
@@ -668,6 +668,128 @@ export function registerToolDefinitions(server) {
668
668
  properties: {},
669
669
  },
670
670
  },
671
+ {
672
+ name: 'task_epic_status',
673
+ description: 'Get epic progress status with task counts by status. Auto-completes epic when all child tasks are done. Use this to track epic progress and see completion percentage.',
674
+ inputSchema: {
675
+ type: 'object',
676
+ properties: {
677
+ epic_id: {
678
+ type: 'string',
679
+ description: 'The epic ID to get status for',
680
+ },
681
+ },
682
+ required: ['epic_id'],
683
+ },
684
+ },
685
+ {
686
+ name: 'task_detect_timeouts',
687
+ description: 'Detect tasks that have timed out (lock expired while in_progress). These are likely abandoned or failed tasks that need attention.',
688
+ inputSchema: {
689
+ type: 'object',
690
+ properties: {
691
+ project_id: {
692
+ type: 'string',
693
+ description: 'Project ID (optional, uses default if not provided)',
694
+ },
695
+ },
696
+ },
697
+ },
698
+ {
699
+ name: 'task_retry',
700
+ description: 'Retry a failed or timed-out task. Resets task to ready status if under retry limit, or marks as failed permanently if limit exceeded.',
701
+ inputSchema: {
702
+ type: 'object',
703
+ properties: {
704
+ task_id: {
705
+ type: 'string',
706
+ description: 'The task ID to retry',
707
+ },
708
+ max_retries: {
709
+ type: 'number',
710
+ description: 'Maximum number of retries allowed (default: 3)',
711
+ },
712
+ error_context: {
713
+ type: 'string',
714
+ description: 'Description of the error or failure reason',
715
+ },
716
+ project_id: {
717
+ type: 'string',
718
+ description: 'Project ID (optional, uses default if not provided)',
719
+ },
720
+ },
721
+ required: ['task_id'],
722
+ },
723
+ },
724
+ {
725
+ name: 'task_fail',
726
+ description: 'Explicitly mark a task as failed with error context. Use when a task cannot be completed.',
727
+ inputSchema: {
728
+ type: 'object',
729
+ properties: {
730
+ task_id: {
731
+ type: 'string',
732
+ description: 'The task ID to mark as failed',
733
+ },
734
+ error_context: {
735
+ type: 'string',
736
+ description: 'Description of why the task failed',
737
+ },
738
+ agent_id: {
739
+ type: 'string',
740
+ description: 'Agent ID (optional, defaults to "claude-code")',
741
+ },
742
+ project_id: {
743
+ type: 'string',
744
+ description: 'Project ID (optional, uses default if not provided)',
745
+ },
746
+ },
747
+ required: ['task_id', 'error_context'],
748
+ },
749
+ },
750
+ {
751
+ name: 'task_auto_retry_timeouts',
752
+ description: 'Automatically detect and retry all timed-out tasks. Tasks under retry limit are reset to ready, those exceeding limit are marked as failed.',
753
+ inputSchema: {
754
+ type: 'object',
755
+ properties: {
756
+ max_retries: {
757
+ type: 'number',
758
+ description: 'Maximum number of retries per task (default: 3)',
759
+ },
760
+ project_id: {
761
+ type: 'string',
762
+ description: 'Project ID (optional, uses default if not provided)',
763
+ },
764
+ },
765
+ },
766
+ },
767
+ {
768
+ name: 'task_orchestrate',
769
+ description: 'Orchestrate autonomous multi-agent execution for an epic. Dispatches parallel workers, monitors progress, handles failures, and continues until completion.',
770
+ inputSchema: {
771
+ type: 'object',
772
+ properties: {
773
+ epic_id: {
774
+ type: 'string',
775
+ description: 'Epic ID to orchestrate',
776
+ },
777
+ max_parallel: {
778
+ type: 'number',
779
+ description: 'Max parallel tasks (default: 5)',
780
+ },
781
+ max_retries: {
782
+ type: 'number',
783
+ description: 'Max retries per task (default: 3)',
784
+ },
785
+ dry_run: {
786
+ type: 'boolean',
787
+ description: 'Preview without executing (default: false)',
788
+ },
789
+ },
790
+ required: ['epic_id'],
791
+ },
792
+ },
671
793
  // =========================================================================
672
794
  // CODEBASE MAPPING TOOLS
673
795
  // =========================================================================
@@ -743,6 +865,198 @@ export function registerToolDefinitions(server) {
743
865
  required: ['function_name'],
744
866
  },
745
867
  },
868
+ // =========================================================================
869
+ // DOCUMENTATION CACHING TOOLS
870
+ // =========================================================================
871
+ {
872
+ name: 'docs_cache',
873
+ description: 'Ensure documentation for a library is cached. Automatically fetches from Context7 if not already cached. Use simple library names like "react", "next.js", "zod", "tanstack-query".',
874
+ inputSchema: {
875
+ type: 'object',
876
+ properties: {
877
+ library: {
878
+ type: 'string',
879
+ description: 'Library name to cache docs for (e.g., "react", "next.js", "zod", "tanstack-query", "supabase")',
880
+ },
881
+ topic: {
882
+ type: 'string',
883
+ description: 'Optional topic to focus on (e.g., "routing", "authentication")',
884
+ },
885
+ },
886
+ required: ['library'],
887
+ },
888
+ },
889
+ {
890
+ name: 'docs_list',
891
+ description: 'List all cached documentation libraries (global cache shared across projects).',
892
+ inputSchema: {
893
+ type: 'object',
894
+ properties: {},
895
+ },
896
+ },
897
+ {
898
+ name: 'docs_get',
899
+ description: 'Get cached documentation for a specific library. Returns the full cached content.',
900
+ inputSchema: {
901
+ type: 'object',
902
+ properties: {
903
+ library: {
904
+ type: 'string',
905
+ description: 'Library name to get docs for (e.g., "react", "next.js")',
906
+ },
907
+ topic: {
908
+ type: 'string',
909
+ description: 'Optional topic to filter docs by',
910
+ },
911
+ },
912
+ required: ['library'],
913
+ },
914
+ },
915
+ // =========================================================================
916
+ // CODEDNA CODE GENERATION TOOLS
917
+ // =========================================================================
918
+ {
919
+ name: 'codedna_generate_api',
920
+ description: 'Generate a complete REST API with CRUD operations from an Entity DSL specification. Saves 95-99% tokens vs writing code manually. Example: codedna_generate_api("User(email:string:unique, password:string:hashed)", "express", { auth: true })',
921
+ inputSchema: {
922
+ type: 'object',
923
+ properties: {
924
+ spec: {
925
+ type: 'string',
926
+ description: 'Entity DSL specification (e.g., "User(email:string:unique:required, password:string:hashed, age:integer:min(18))")',
927
+ },
928
+ framework: {
929
+ type: 'string',
930
+ enum: ['express', 'fastapi', 'nestjs'],
931
+ description: 'API framework to use',
932
+ },
933
+ options: {
934
+ type: 'object',
935
+ properties: {
936
+ auth: {
937
+ type: 'boolean',
938
+ description: 'Include JWT authentication middleware',
939
+ },
940
+ validation: {
941
+ type: 'boolean',
942
+ description: 'Add input validation',
943
+ },
944
+ tests: {
945
+ type: 'boolean',
946
+ description: 'Generate test files',
947
+ },
948
+ database: {
949
+ type: 'string',
950
+ enum: ['postgresql', 'mysql', 'mongodb'],
951
+ description: 'Target database',
952
+ },
953
+ },
954
+ },
955
+ },
956
+ required: ['spec', 'framework'],
957
+ },
958
+ },
959
+ {
960
+ name: 'codedna_generate_frontend',
961
+ description: 'Generate frontend application with forms and tables from Entity DSL. Saves 95-99% tokens vs writing components manually.',
962
+ inputSchema: {
963
+ type: 'object',
964
+ properties: {
965
+ spec: {
966
+ type: 'string',
967
+ description: 'Entity DSL specification',
968
+ },
969
+ framework: {
970
+ type: 'string',
971
+ enum: ['nextjs', 'react', 'vue'],
972
+ description: 'Frontend framework to use',
973
+ },
974
+ options: {
975
+ type: 'object',
976
+ properties: {
977
+ ui: {
978
+ type: 'string',
979
+ enum: ['shadcn', 'mui', 'chakra'],
980
+ description: 'UI component library',
981
+ },
982
+ forms: {
983
+ type: 'boolean',
984
+ description: 'Generate forms',
985
+ },
986
+ tables: {
987
+ type: 'boolean',
988
+ description: 'Generate data tables',
989
+ },
990
+ routing: {
991
+ type: 'boolean',
992
+ description: 'Setup routing',
993
+ },
994
+ },
995
+ },
996
+ },
997
+ required: ['spec', 'framework'],
998
+ },
999
+ },
1000
+ {
1001
+ name: 'codedna_generate_component',
1002
+ description: 'Generate single UI component (form, table, card, modal) from Entity DSL.',
1003
+ inputSchema: {
1004
+ type: 'object',
1005
+ properties: {
1006
+ spec: {
1007
+ type: 'string',
1008
+ description: 'Entity DSL specification or component spec',
1009
+ },
1010
+ type: {
1011
+ type: 'string',
1012
+ enum: ['form', 'table', 'card', 'modal'],
1013
+ description: 'Component type to generate',
1014
+ },
1015
+ framework: {
1016
+ type: 'string',
1017
+ enum: ['react', 'vue', 'svelte'],
1018
+ description: 'Frontend framework',
1019
+ },
1020
+ options: {
1021
+ type: 'object',
1022
+ properties: {
1023
+ ui: {
1024
+ type: 'string',
1025
+ enum: ['shadcn', 'mui', 'chakra'],
1026
+ description: 'UI library',
1027
+ },
1028
+ validation: {
1029
+ type: 'boolean',
1030
+ description: 'Include validation',
1031
+ },
1032
+ },
1033
+ },
1034
+ },
1035
+ required: ['spec', 'type', 'framework'],
1036
+ },
1037
+ },
1038
+ {
1039
+ name: 'codedna_list_generators',
1040
+ description: 'List all available code generators and their capabilities.',
1041
+ inputSchema: {
1042
+ type: 'object',
1043
+ properties: {},
1044
+ },
1045
+ },
1046
+ {
1047
+ name: 'codedna_validate_spec',
1048
+ description: 'Validate Entity DSL syntax without generating code. Returns parsed structure or errors.',
1049
+ inputSchema: {
1050
+ type: 'object',
1051
+ properties: {
1052
+ spec: {
1053
+ type: 'string',
1054
+ description: 'Entity DSL specification to validate',
1055
+ },
1056
+ },
1057
+ required: ['spec'],
1058
+ },
1059
+ },
746
1060
  ],
747
1061
  }));
748
1062
  }
@@ -0,0 +1,353 @@
1
+ # Auto Project Registration
2
+
3
+ The ClaudeTools Memory MCP server now supports automatic project registration. When you use the server in a new directory, it will automatically register that directory as a project with the ClaudeTools API and cache the binding locally.
4
+
5
+ ## How It Works
6
+
7
+ ### 1. Project ID Resolution Flow
8
+
9
+ ```
10
+ MCP Server Starts
11
+
12
+ Check CLAUDETOOLS_PROJECT_ID env var
13
+ ↓ (if not set)
14
+ Check ~/.claudetools/projects.json cache
15
+ ↓ (if no binding found)
16
+ Auto-register via API (if autoRegister: true)
17
+
18
+ Cache project_id locally
19
+
20
+ Use project_id for all memory operations
21
+ ```
22
+
23
+ ### 2. System Registration
24
+
25
+ On first use, the server registers your machine:
26
+
27
+ - **System ID**: Unique identifier for this machine (e.g., `sys_abc123...`)
28
+ - **Hostname**: Your machine's hostname
29
+ - **Platform**: Operating system (darwin, linux, win32)
30
+ - **Username**: Current user
31
+
32
+ The system ID is cached in `~/.claudetools/projects.json`:
33
+
34
+ ```json
35
+ {
36
+ "system_id": "sys_bdbcff93724e4a05b488",
37
+ "bindings": [...],
38
+ "last_sync": "2025-12-03T02:37:44.635Z"
39
+ }
40
+ ```
41
+
42
+ ### 3. Project Binding
43
+
44
+ When you use the MCP server in a directory for the first time:
45
+
46
+ 1. **Detects** project metadata:
47
+ - Project name (from directory name)
48
+ - Local path (absolute path)
49
+ - Git remote (if available)
50
+
51
+ 2. **Registers** via API:
52
+ - Creates project in your ClaudeTools account
53
+ - Returns project_id (UUID format: `proj_xxxxxxxxxxxxxxxxxxxx`)
54
+
55
+ 3. **Creates binding** linking:
56
+ - System ID (your machine)
57
+ - Project ID (the project)
58
+ - Local path (where the project lives)
59
+
60
+ 4. **Caches** binding locally in `~/.claudetools/projects.json`:
61
+
62
+ ```json
63
+ {
64
+ "bindings": [
65
+ {
66
+ "binding_id": "bind_904de164763a47d0924e",
67
+ "project_id": "proj_3a33ce7579874351b990",
68
+ "system_id": "sys_bdbcff93724e4a05b488",
69
+ "local_path": "/Users/you/Projects/myproject",
70
+ "git_remote": "git@github.com:you/myproject.git",
71
+ "project_name": "myproject",
72
+ "org_id": "your-org-id",
73
+ "cached_at": "2025-12-03T02:37:44.635Z"
74
+ }
75
+ ],
76
+ "system_id": "sys_bdbcff93724e4a05b488",
77
+ "last_sync": "2025-12-03T02:37:44.635Z"
78
+ }
79
+ ```
80
+
81
+ ## Configuration
82
+
83
+ ### Enable/Disable Auto-Registration
84
+
85
+ Edit `~/.claudetools/config.json`:
86
+
87
+ ```json
88
+ {
89
+ "autoRegister": true, // Enable auto-registration (default)
90
+ "apiUrl": "https://api.claudetools.dev",
91
+ "apiKey": "ct_live_..."
92
+ }
93
+ ```
94
+
95
+ To disable auto-registration:
96
+
97
+ ```json
98
+ {
99
+ "autoRegister": false
100
+ }
101
+ ```
102
+
103
+ ### Set API Key
104
+
105
+ Three ways to configure your API key:
106
+
107
+ 1. **Environment variable** (highest priority):
108
+ ```bash
109
+ export CLAUDETOOLS_API_KEY="ct_live_..."
110
+ # or
111
+ export MEMORY_API_KEY="ct_live_..."
112
+ ```
113
+
114
+ 2. **Config file**:
115
+ ```json
116
+ {
117
+ "apiKey": "ct_live_..."
118
+ }
119
+ ```
120
+
121
+ 3. **.env file** (in project root):
122
+ ```bash
123
+ MEMORY_API_KEY=ct_live_...
124
+ ```
125
+
126
+ ### Manual Project ID
127
+
128
+ If you want to use a specific project ID instead of auto-registering:
129
+
130
+ ```bash
131
+ export CLAUDETOOLS_PROJECT_ID="proj_xxxxxxxxxxxxxxxxxxxx"
132
+ ```
133
+
134
+ ## Project ID Format Validation
135
+
136
+ All project IDs must follow the format:
137
+ - Prefix: `proj_`
138
+ - 20 hexadecimal characters
139
+ - Example: `proj_3a33ce7579874351b990`
140
+
141
+ Invalid formats will be rejected with a clear error message.
142
+
143
+ ## Cache Management
144
+
145
+ ### View Cache
146
+
147
+ ```bash
148
+ cat ~/.claudetools/projects.json
149
+ ```
150
+
151
+ ### Clear Cache
152
+
153
+ ```bash
154
+ rm ~/.claudetools/projects.json
155
+ ```
156
+
157
+ The server will auto-register on next use (if `autoRegister: true`).
158
+
159
+ ### Sync from API
160
+
161
+ Future feature - will pull all your project bindings from the API:
162
+
163
+ ```typescript
164
+ import { syncProjectsFromAPI } from './helpers/project-registration.js';
165
+ await syncProjectsFromAPI();
166
+ ```
167
+
168
+ ## Path Matching
169
+
170
+ The server uses smart path matching:
171
+
172
+ 1. **Exact match**: `/Users/you/Projects/myproject` matches exactly
173
+ 2. **Prefix match**: `/Users/you/Projects/myproject/src` uses parent binding
174
+ 3. **Longest match**: If multiple bindings match, uses the longest path
175
+
176
+ Example:
177
+ ```json
178
+ {
179
+ "bindings": [
180
+ {"local_path": "/Users/you/Projects"},
181
+ {"local_path": "/Users/you/Projects/myproject"}
182
+ ]
183
+ }
184
+ ```
185
+
186
+ Using server from `/Users/you/Projects/myproject/src`:
187
+ - ✅ Uses: `/Users/you/Projects/myproject` (longer match)
188
+ - ❌ Not: `/Users/you/Projects` (shorter match)
189
+
190
+ ## Error Handling
191
+
192
+ ### No API Key
193
+
194
+ ```
195
+ Error: No API key found. Set CLAUDETOOLS_API_KEY or MEMORY_API_KEY in environment,
196
+ or configure via ~/.claudetools/config.json
197
+ ```
198
+
199
+ **Solution**: Set API key using one of the methods above.
200
+
201
+ ### Auto-Registration Disabled
202
+
203
+ ```
204
+ Error: No project binding found for /path/to/project and auto-registration is disabled.
205
+ To register this project:
206
+ 1. Set CLAUDETOOLS_PROJECT_ID environment variable with a valid proj_* UUID
207
+ 2. Enable autoRegister in ~/.claudetools/config.json
208
+ 3. Or manually register via API
209
+ ```
210
+
211
+ **Solution**: Either:
212
+ - Enable auto-registration in config
213
+ - Set `CLAUDETOOLS_PROJECT_ID` manually
214
+ - Register project via ClaudeTools dashboard
215
+
216
+ ### Invalid Project ID Format
217
+
218
+ ```
219
+ Error: Invalid project ID format: my-project-123
220
+ Expected format: proj_xxxxxxxxxxxxxxxxxxxx (20 hex chars)
221
+ ```
222
+
223
+ **Solution**: Use a valid UUID format or let the system auto-register.
224
+
225
+ ### Network Error
226
+
227
+ ```
228
+ Error: Failed to auto-register project: API error: 500 Internal Server Error
229
+ ```
230
+
231
+ **Solution**: Check:
232
+ 1. API URL is correct in config
233
+ 2. Network connectivity to `api.claudetools.dev`
234
+ 3. API service status
235
+
236
+ ## Testing
237
+
238
+ Run the registration test suite:
239
+
240
+ ```bash
241
+ cd mcp-server
242
+ npm run build
243
+ npx tsx test-registration.ts
244
+ ```
245
+
246
+ Expected output:
247
+ ```
248
+ ================================================================================
249
+ Testing Auto-Registration System
250
+ ================================================================================
251
+
252
+ Test 1: Direct registration via getOrRegisterProject()
253
+ ✅ Success: proj_3a33ce7579874351b990
254
+
255
+ Test 2: Resolution via resolveProjectIdAsync()
256
+ ✅ Success: proj_3a33ce7579874351b990
257
+
258
+ Test 3: Verify consistency
259
+ ✅ Both methods returned same ID: proj_3a33ce7579874351b990
260
+
261
+ Test 4: Check cache file
262
+ Cache file exists at: /Users/you/.claudetools/projects.json
263
+ Bindings count: 1
264
+ System ID: sys_bdbcff93724e4a05b488
265
+
266
+ ✅ All tests passed!
267
+ ================================================================================
268
+ ```
269
+
270
+ ## Known Issues
271
+
272
+ ### API Schema Error (Temporary)
273
+
274
+ Currently, the project creation endpoint has a schema issue:
275
+ ```
276
+ Error: table projects has no column named created_by
277
+ ```
278
+
279
+ **Workaround**: Use an existing cached binding or manually set `CLAUDETOOLS_PROJECT_ID`.
280
+
281
+ This will be fixed in the next API deployment.
282
+
283
+ ## Migration from Name-Based IDs
284
+
285
+ If you were previously using name-based IDs like `claude-code-myproject`:
286
+
287
+ 1. **Delete old cache**: `rm ~/.claudetools/projects.json`
288
+ 2. **Set API key**: Export `CLAUDETOOLS_API_KEY`
289
+ 3. **Restart server**: Will auto-register with proper UUID
290
+
291
+ Or keep using the old ID by setting:
292
+ ```bash
293
+ export CLAUDETOOLS_PROJECT_ID="claude-code-myproject"
294
+ ```
295
+
296
+ However, this is **not recommended** as UUID-based IDs provide:
297
+ - ✅ Global uniqueness
298
+ - ✅ Cross-machine project sharing
299
+ - ✅ Proper project management in ClaudeTools dashboard
300
+ - ✅ Multi-system bindings
301
+
302
+ ## Architecture
303
+
304
+ ### Key Files
305
+
306
+ - `src/helpers/project-registration.ts` - Registration logic
307
+ - `src/helpers/config.ts` - Project ID resolution
308
+ - `src/helpers/config-manager.ts` - Configuration management
309
+ - `~/.claudetools/config.json` - User configuration
310
+ - `~/.claudetools/projects.json` - Cached bindings
311
+
312
+ ### API Endpoints
313
+
314
+ - `POST /api/v1/systems/register` - Register machine
315
+ - `POST /api/v1/projects` - Create project
316
+ - `POST /api/v1/systems/{system_id}/bindings` - Create binding
317
+ - `GET /api/v1/systems/{system_id}/bindings` - List bindings (future)
318
+
319
+ ### Data Flow
320
+
321
+ ```
322
+ User → MCP Server → resolveProjectIdAsync()
323
+
324
+ Check cache
325
+ ↓ (miss)
326
+ getOrRegisterProject()
327
+
328
+ ensureSystemRegistered() → API
329
+
330
+ registerProject() → API
331
+
332
+ updateProjectsCache()
333
+
334
+ Return project_id
335
+ ```
336
+
337
+ ## Best Practices
338
+
339
+ 1. **Set API key globally**: Use environment variable or config file
340
+ 2. **Enable auto-registration**: Let the system handle project setup
341
+ 3. **One binding per project**: Don't create multiple bindings for same path
342
+ 4. **Git remotes help**: They make project identification easier
343
+ 5. **Cache is local**: Each machine has its own bindings cache
344
+
345
+ ## Future Enhancements
346
+
347
+ - [ ] Sync bindings from API on startup
348
+ - [ ] Detect project changes (git remote updates)
349
+ - [ ] Multi-org support
350
+ - [ ] Project metadata updates
351
+ - [ ] Binding removal/cleanup
352
+ - [ ] Cross-machine project resolution
353
+ - [ ] Project templates