coder-config 0.40.1

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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +553 -0
  3. package/cli.js +431 -0
  4. package/config-loader.js +294 -0
  5. package/hooks/activity-track.sh +56 -0
  6. package/hooks/codex-workstream.sh +44 -0
  7. package/hooks/gemini-workstream.sh +44 -0
  8. package/hooks/workstream-inject.sh +20 -0
  9. package/lib/activity.js +283 -0
  10. package/lib/apply.js +344 -0
  11. package/lib/cli.js +267 -0
  12. package/lib/config.js +171 -0
  13. package/lib/constants.js +55 -0
  14. package/lib/env.js +114 -0
  15. package/lib/index.js +47 -0
  16. package/lib/init.js +122 -0
  17. package/lib/mcps.js +139 -0
  18. package/lib/memory.js +201 -0
  19. package/lib/projects.js +138 -0
  20. package/lib/registry.js +83 -0
  21. package/lib/utils.js +129 -0
  22. package/lib/workstreams.js +652 -0
  23. package/package.json +80 -0
  24. package/scripts/capture-screenshots.js +142 -0
  25. package/scripts/postinstall.js +122 -0
  26. package/scripts/release.sh +71 -0
  27. package/scripts/sync-version.js +77 -0
  28. package/scripts/tauri-prepare.js +328 -0
  29. package/shared/mcp-registry.json +76 -0
  30. package/ui/dist/assets/index-DbZ3_HBD.js +3204 -0
  31. package/ui/dist/assets/index-DjLdm3Mr.css +32 -0
  32. package/ui/dist/icons/icon-192.svg +16 -0
  33. package/ui/dist/icons/icon-512.svg +16 -0
  34. package/ui/dist/index.html +39 -0
  35. package/ui/dist/manifest.json +25 -0
  36. package/ui/dist/sw.js +24 -0
  37. package/ui/dist/tutorial/claude-settings.png +0 -0
  38. package/ui/dist/tutorial/header.png +0 -0
  39. package/ui/dist/tutorial/mcp-registry.png +0 -0
  40. package/ui/dist/tutorial/memory-view.png +0 -0
  41. package/ui/dist/tutorial/permissions.png +0 -0
  42. package/ui/dist/tutorial/plugins-view.png +0 -0
  43. package/ui/dist/tutorial/project-explorer.png +0 -0
  44. package/ui/dist/tutorial/projects-view.png +0 -0
  45. package/ui/dist/tutorial/sidebar.png +0 -0
  46. package/ui/dist/tutorial/tutorial-view.png +0 -0
  47. package/ui/dist/tutorial/workstreams-view.png +0 -0
  48. package/ui/routes/activity.js +58 -0
  49. package/ui/routes/commands.js +74 -0
  50. package/ui/routes/configs.js +329 -0
  51. package/ui/routes/env.js +40 -0
  52. package/ui/routes/file-explorer.js +668 -0
  53. package/ui/routes/index.js +41 -0
  54. package/ui/routes/mcp-discovery.js +235 -0
  55. package/ui/routes/memory.js +385 -0
  56. package/ui/routes/package.json +3 -0
  57. package/ui/routes/plugins.js +466 -0
  58. package/ui/routes/projects.js +198 -0
  59. package/ui/routes/registry.js +30 -0
  60. package/ui/routes/rules.js +74 -0
  61. package/ui/routes/search.js +125 -0
  62. package/ui/routes/settings.js +381 -0
  63. package/ui/routes/subprojects.js +208 -0
  64. package/ui/routes/tool-sync.js +127 -0
  65. package/ui/routes/updates.js +339 -0
  66. package/ui/routes/workstreams.js +224 -0
  67. package/ui/server.cjs +773 -0
  68. package/ui/terminal-server.cjs +160 -0
package/lib/utils.js ADDED
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Core utility functions
3
+ */
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+
8
+ /**
9
+ * Load JSON file
10
+ */
11
+ function loadJson(filePath) {
12
+ try {
13
+ if (!fs.existsSync(filePath)) return null;
14
+ return JSON.parse(fs.readFileSync(filePath, 'utf8'));
15
+ } catch (error) {
16
+ console.error(`Error loading ${filePath}:`, error.message);
17
+ return null;
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Save JSON file
23
+ */
24
+ function saveJson(filePath, data) {
25
+ fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n');
26
+ }
27
+
28
+ /**
29
+ * Load environment variables from .env file
30
+ */
31
+ function loadEnvFile(envPath) {
32
+ if (!fs.existsSync(envPath)) return {};
33
+ const envVars = {};
34
+ const lines = fs.readFileSync(envPath, 'utf8').split('\n');
35
+ for (const line of lines) {
36
+ const trimmed = line.trim();
37
+ if (trimmed && !trimmed.startsWith('#')) {
38
+ const eqIndex = trimmed.indexOf('=');
39
+ if (eqIndex > 0) {
40
+ const key = trimmed.substring(0, eqIndex).trim();
41
+ let value = trimmed.substring(eqIndex + 1).trim();
42
+ if ((value.startsWith('"') && value.endsWith('"')) ||
43
+ (value.startsWith("'") && value.endsWith("'"))) {
44
+ value = value.slice(1, -1);
45
+ }
46
+ envVars[key] = value;
47
+ }
48
+ }
49
+ }
50
+ return envVars;
51
+ }
52
+
53
+ /**
54
+ * Interpolate ${VAR} in object values
55
+ */
56
+ function interpolate(obj, env) {
57
+ if (typeof obj === 'string') {
58
+ return obj.replace(/\$\{([^}]+)\}/g, (match, varName) => {
59
+ return env[varName] || process.env[varName] || match;
60
+ });
61
+ }
62
+ if (Array.isArray(obj)) {
63
+ return obj.map(v => interpolate(v, env));
64
+ }
65
+ if (obj !== null && typeof obj === 'object') {
66
+ const result = {};
67
+ for (const [k, v] of Object.entries(obj)) {
68
+ result[k] = interpolate(v, env);
69
+ }
70
+ return result;
71
+ }
72
+ return obj;
73
+ }
74
+
75
+ /**
76
+ * Resolve ${VAR} to actual values (for tools that don't support interpolation)
77
+ */
78
+ function resolveEnvVars(obj, env) {
79
+ if (typeof obj === 'string') {
80
+ return obj.replace(/\$\{([^}]+)\}/g, (match, varName) => {
81
+ const value = env[varName] || process.env[varName];
82
+ if (!value) {
83
+ console.warn(`Warning: Environment variable ${varName} not set`);
84
+ return '';
85
+ }
86
+ return value;
87
+ });
88
+ }
89
+ if (Array.isArray(obj)) {
90
+ return obj.map(v => resolveEnvVars(v, env));
91
+ }
92
+ if (obj && typeof obj === 'object') {
93
+ const result = {};
94
+ for (const [key, value] of Object.entries(obj)) {
95
+ result[key] = resolveEnvVars(value, env);
96
+ }
97
+ return result;
98
+ }
99
+ return obj;
100
+ }
101
+
102
+ /**
103
+ * Recursively copy directory
104
+ */
105
+ function copyDirRecursive(src, dest) {
106
+ if (!fs.existsSync(dest)) {
107
+ fs.mkdirSync(dest, { recursive: true });
108
+ }
109
+
110
+ for (const item of fs.readdirSync(src)) {
111
+ const srcPath = path.join(src, item);
112
+ const destPath = path.join(dest, item);
113
+
114
+ if (fs.statSync(srcPath).isDirectory()) {
115
+ copyDirRecursive(srcPath, destPath);
116
+ } else {
117
+ fs.copyFileSync(srcPath, destPath);
118
+ }
119
+ }
120
+ }
121
+
122
+ module.exports = {
123
+ loadJson,
124
+ saveJson,
125
+ loadEnvFile,
126
+ interpolate,
127
+ resolveEnvVars,
128
+ copyDirRecursive,
129
+ };