cntx-ui 2.0.13 → 2.0.15

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 (44) hide show
  1. package/bin/cntx-ui.js +137 -55
  2. package/lib/agent-runtime.js +1480 -0
  3. package/lib/agent-tools.js +368 -0
  4. package/lib/api-router.js +978 -0
  5. package/lib/bundle-manager.js +471 -0
  6. package/lib/configuration-manager.js +725 -0
  7. package/lib/file-system-manager.js +472 -0
  8. package/lib/heuristics-manager.js +425 -0
  9. package/lib/mcp-server.js +1054 -1
  10. package/lib/semantic-splitter.js +7 -14
  11. package/lib/simple-vector-store.js +329 -0
  12. package/lib/websocket-manager.js +470 -0
  13. package/package.json +10 -3
  14. package/server.js +662 -1933
  15. package/templates/activities/README.md +67 -0
  16. package/templates/activities/activities/create-project-bundles/README.md +83 -0
  17. package/templates/activities/activities/create-project-bundles/notes.md +102 -0
  18. package/templates/activities/activities/create-project-bundles/progress.md +63 -0
  19. package/templates/activities/activities/create-project-bundles/tasks.md +39 -0
  20. package/templates/activities/activities.json +219 -0
  21. package/templates/activities/lib/.markdownlint.jsonc +18 -0
  22. package/templates/activities/lib/create-activity.mdc +63 -0
  23. package/templates/activities/lib/generate-tasks.mdc +64 -0
  24. package/templates/activities/lib/process-task-list.mdc +52 -0
  25. package/templates/agent-config.yaml +78 -0
  26. package/templates/agent-instructions.md +218 -0
  27. package/templates/agent-rules/capabilities/activities-system.md +147 -0
  28. package/templates/agent-rules/capabilities/bundle-system.md +131 -0
  29. package/templates/agent-rules/capabilities/vector-search.md +135 -0
  30. package/templates/agent-rules/core/codebase-navigation.md +91 -0
  31. package/templates/agent-rules/core/performance-hierarchy.md +48 -0
  32. package/templates/agent-rules/core/response-formatting.md +120 -0
  33. package/templates/agent-rules/project-specific/architecture.md +145 -0
  34. package/templates/config.json +76 -0
  35. package/templates/hidden-files.json +14 -0
  36. package/web/dist/assets/heuristics-manager-browser-DfonOP5I.js +1 -0
  37. package/web/dist/assets/index-dF3qg-y_.js +2486 -0
  38. package/web/dist/assets/index-h5FGSg_P.css +1 -0
  39. package/web/dist/cntx-ui.svg +18 -0
  40. package/web/dist/index.html +25 -8
  41. package/lib/semantic-integration.js +0 -441
  42. package/web/dist/assets/index-Ci1Q-YrQ.js +0 -611
  43. package/web/dist/assets/index-IUp4q_fr.css +0 -1
  44. package/web/dist/vite.svg +0 -21
package/bin/cntx-ui.js CHANGED
@@ -1,9 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { readFileSync } from 'fs';
4
+ import { dirname, join } from 'path';
5
+ import { fileURLToPath } from 'url';
3
6
  import { startServer, startMCPServer, generateBundle, initConfig, getStatus, setupMCP } from '../server.js';
4
7
 
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const packagePath = join(__dirname, '..', 'package.json');
10
+ const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));
11
+
5
12
  const args = process.argv.slice(2);
6
- const command = args[0] || 'watch';
13
+ const command = args[0] || 'help';
14
+ const isVerbose = args.includes('--verbose');
7
15
 
8
16
  // Graceful shutdown
9
17
  process.on('SIGINT', () => {
@@ -11,63 +19,137 @@ process.on('SIGINT', () => {
11
19
  process.exit(0);
12
20
  });
13
21
 
14
- switch (command) {
15
- case 'watch':
16
- const port = parseInt(args[1]) || 3333;
17
- const withMcp = args.includes('--with-mcp');
18
- startServer({ port, withMcp });
19
- break;
20
-
21
- case 'mcp':
22
- // MCP server mode - runs on stdio
23
- startMCPServer({ cwd: process.cwd() });
24
- break;
25
-
26
- case 'bundle':
27
- const bundleName = args[1] || 'master';
28
- try {
29
- generateBundle(bundleName);
30
- console.log(`✅ Bundle '${bundleName}' generated`);
31
- } catch (e) {
32
- console.error(`❌ Bundle '${bundleName}' not found`);
33
- }
34
- break;
22
+ function showHelp() {
23
+ console.log(`cntx-ui v${packageJson.version}
35
24
 
36
- case 'init':
37
- initConfig();
38
- break;
25
+ ${packageJson.description}
39
26
 
40
- case 'status':
41
- getStatus();
42
- break;
27
+ Usage:
28
+ cntx-ui <command> [options]
43
29
 
44
- case 'setup-mcp':
45
- setupMCP();
46
- break;
30
+ Commands:
31
+ init Initialize configuration in current directory
32
+ watch [port] Start web server (default port: 3333)
33
+ mcp Start MCP server (stdio transport)
34
+ bundle [name] Generate specific bundle (default: master)
35
+ status Show current project status
36
+ setup-mcp Add this project to Claude Desktop MCP config
37
+
38
+ Options:
39
+ --verbose Enable detailed logging
40
+ --with-mcp Start web server with MCP status tracking
41
+ --version, -v Show version number
42
+ --help, -h Show this help message
47
43
 
48
- default:
49
- console.log(`cntx-ui v2.0.8
50
-
51
- Usage:
52
- cntx-ui init Initialize configuration
53
- cntx-ui watch [port] Start web server (default port: 3333)
54
- cntx-ui watch --with-mcp Start web server with MCP status tracking
55
- cntx-ui mcp Start MCP server (stdio transport)
56
- cntx-ui setup-mcp Add this project to Claude Desktop MCP config
57
- cntx-ui bundle [name] Generate specific bundle (default: master)
58
- cntx-ui status Show current status
59
-
60
44
  Examples:
61
- cntx-ui init
62
- cntx-ui watch 8080
63
- cntx-ui watch --with-mcp
64
- cntx-ui setup-mcp
65
- cntx-ui mcp
66
- cntx-ui bundle api
67
-
68
- MCP Usage:
69
- The MCP server provides AI-accessible bundle management:
70
- - Resources: Access bundles and files via cntx:// URIs
71
- - Tools: List bundles, generate bundles, get project status
72
- - Integration: Use with Claude Desktop, Cursor, or other MCP clients`);
45
+ cntx-ui init Initialize a new project
46
+ cntx-ui watch Start web server on port 3333
47
+ cntx-ui watch 8080 Start web server on port 8080
48
+ cntx-ui watch --verbose Start with detailed logs
49
+ cntx-ui watch --with-mcp Start with MCP integration
50
+ cntx-ui bundle api Generate 'api' bundle
51
+ cntx-ui status Show project status
52
+ cntx-ui setup-mcp Configure Claude Desktop integration
53
+
54
+ MCP Integration:
55
+ The MCP server provides AI-accessible bundle management for Claude Desktop
56
+ and other MCP-compatible clients. Use 'setup-mcp' to configure automatic
57
+ integration with Claude Desktop.
58
+
59
+ Agent Collaboration:
60
+ To get an external agent up to speed with your project, use this prompt:
61
+
62
+ "I'm working in a project that uses cntx-ui for file organization and AI
63
+ collaboration. Please read these files to understand the project structure
64
+ and help me with activities:
65
+
66
+ @.cntx/agent-instructions.md
67
+ @.cntx/activities/README.md
68
+ @.cntx/activities/activities.json
69
+
70
+ After reading those, please also examine:
71
+ @.cntx/activities/lib/create-activity.mdc
72
+ @.cntx/activities/lib/generate-tasks.mdc
73
+ @.cntx/activities/lib/process-task-list.mdc
74
+
75
+ These files contain the complete workflow for creating and managing
76
+ activities with agent assistance."
77
+
78
+ Repository: ${packageJson.repository.url}
79
+ Author: ${packageJson.author}
80
+ License: ${packageJson.license}`);
81
+ }
82
+
83
+ function showVersion() {
84
+ console.log(`cntx-ui v${packageJson.version}`);
73
85
  }
86
+
87
+ async function main() {
88
+ // Handle version flags
89
+ if (args.includes('--version') || args.includes('-v')) {
90
+ return showVersion();
91
+ }
92
+
93
+ // Handle help flags
94
+ if (args.includes('--help') || args.includes('-h') || command === 'help') {
95
+ return showHelp();
96
+ }
97
+
98
+ // Handle default command (watch if no command provided and no flags)
99
+ const actualCommand = command === 'help' ? 'watch' : command;
100
+
101
+ try {
102
+ switch (actualCommand) {
103
+ case 'watch':
104
+ case 'w':
105
+ const port = parseInt(args[1]) || 3333;
106
+ const withMcp = args.includes('--with-mcp');
107
+ await startServer({ port, withMcp, verbose: isVerbose });
108
+ break;
109
+
110
+ case 'mcp':
111
+ // MCP server mode - runs on stdio
112
+ await startMCPServer({ cwd: process.cwd(), verbose: isVerbose });
113
+ break;
114
+
115
+ case 'bundle':
116
+ case 'b':
117
+ const bundleName = args[1] || 'master';
118
+ try {
119
+ await generateBundle(bundleName);
120
+ console.log(`✅ Bundle '${bundleName}' generated successfully`);
121
+ } catch (error) {
122
+ console.error(`❌ Failed to generate bundle '${bundleName}': ${error.message}`);
123
+ process.exit(1);
124
+ }
125
+ break;
126
+
127
+ case 'init':
128
+ case 'i':
129
+ await initConfig();
130
+ break;
131
+
132
+ case 'status':
133
+ case 's':
134
+ await getStatus();
135
+ break;
136
+
137
+ case 'setup-mcp':
138
+ setupMCP();
139
+ break;
140
+
141
+ default:
142
+ console.error(`❌ Unknown command: ${command}`);
143
+ console.log('Run "cntx-ui --help" for usage information.');
144
+ process.exit(1);
145
+ }
146
+ } catch (error) {
147
+ console.error(`❌ Error: ${error.message}`);
148
+ if (isVerbose) {
149
+ console.error(error.stack);
150
+ }
151
+ process.exit(1);
152
+ }
153
+ }
154
+
155
+ main().catch(console.error);