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.
- package/LICENSE +21 -0
- package/README.md +553 -0
- package/cli.js +431 -0
- package/config-loader.js +294 -0
- package/hooks/activity-track.sh +56 -0
- package/hooks/codex-workstream.sh +44 -0
- package/hooks/gemini-workstream.sh +44 -0
- package/hooks/workstream-inject.sh +20 -0
- package/lib/activity.js +283 -0
- package/lib/apply.js +344 -0
- package/lib/cli.js +267 -0
- package/lib/config.js +171 -0
- package/lib/constants.js +55 -0
- package/lib/env.js +114 -0
- package/lib/index.js +47 -0
- package/lib/init.js +122 -0
- package/lib/mcps.js +139 -0
- package/lib/memory.js +201 -0
- package/lib/projects.js +138 -0
- package/lib/registry.js +83 -0
- package/lib/utils.js +129 -0
- package/lib/workstreams.js +652 -0
- package/package.json +80 -0
- package/scripts/capture-screenshots.js +142 -0
- package/scripts/postinstall.js +122 -0
- package/scripts/release.sh +71 -0
- package/scripts/sync-version.js +77 -0
- package/scripts/tauri-prepare.js +328 -0
- package/shared/mcp-registry.json +76 -0
- package/ui/dist/assets/index-DbZ3_HBD.js +3204 -0
- package/ui/dist/assets/index-DjLdm3Mr.css +32 -0
- package/ui/dist/icons/icon-192.svg +16 -0
- package/ui/dist/icons/icon-512.svg +16 -0
- package/ui/dist/index.html +39 -0
- package/ui/dist/manifest.json +25 -0
- package/ui/dist/sw.js +24 -0
- package/ui/dist/tutorial/claude-settings.png +0 -0
- package/ui/dist/tutorial/header.png +0 -0
- package/ui/dist/tutorial/mcp-registry.png +0 -0
- package/ui/dist/tutorial/memory-view.png +0 -0
- package/ui/dist/tutorial/permissions.png +0 -0
- package/ui/dist/tutorial/plugins-view.png +0 -0
- package/ui/dist/tutorial/project-explorer.png +0 -0
- package/ui/dist/tutorial/projects-view.png +0 -0
- package/ui/dist/tutorial/sidebar.png +0 -0
- package/ui/dist/tutorial/tutorial-view.png +0 -0
- package/ui/dist/tutorial/workstreams-view.png +0 -0
- package/ui/routes/activity.js +58 -0
- package/ui/routes/commands.js +74 -0
- package/ui/routes/configs.js +329 -0
- package/ui/routes/env.js +40 -0
- package/ui/routes/file-explorer.js +668 -0
- package/ui/routes/index.js +41 -0
- package/ui/routes/mcp-discovery.js +235 -0
- package/ui/routes/memory.js +385 -0
- package/ui/routes/package.json +3 -0
- package/ui/routes/plugins.js +466 -0
- package/ui/routes/projects.js +198 -0
- package/ui/routes/registry.js +30 -0
- package/ui/routes/rules.js +74 -0
- package/ui/routes/search.js +125 -0
- package/ui/routes/settings.js +381 -0
- package/ui/routes/subprojects.js +208 -0
- package/ui/routes/tool-sync.js +127 -0
- package/ui/routes/updates.js +339 -0
- package/ui/routes/workstreams.js +224 -0
- package/ui/server.cjs +773 -0
- 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
|
+
};
|