coder-config 0.46.1 → 0.46.3-beta

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/config-loader.js CHANGED
@@ -33,6 +33,7 @@ const { getActivityPath, getDefaultActivity, loadActivity, saveActivity, detectP
33
33
  const { getLoopsPath, loadLoops, saveLoops, loadLoopState, saveLoopState, loadHistory, saveHistory, loopList, loopCreate, loopGet, loopUpdate, loopDelete, loopStart, loopPause, loopResume, loopCancel, loopApprove, loopComplete, loopFail, loopStatus, loopHistory, loopConfig, getActiveLoop, recordIteration, saveClarifications, savePlan, loadClarifications, loadPlan, loopInject, archiveLoop } = require('./lib/loops');
34
34
  const { getSessionStatus, showSessionStatus, flushContext, clearContext, installHooks: sessionInstallHooks, getFlushedContext, installFlushCommand, installAll: sessionInstallAll, SESSION_DIR, FLUSHED_CONTEXT_FILE } = require('./lib/sessions');
35
35
  const { runCli } = require('./lib/cli');
36
+ const { shellStatus, shellInstall, shellUninstall, printShellStatus } = require('./lib/shell');
36
37
 
37
38
  class ClaudeConfigManager {
38
39
  constructor() {
@@ -275,6 +276,12 @@ class ClaudeConfigManager {
275
276
  getSessionDir() { return SESSION_DIR; }
276
277
  getFlushedContextPath() { return FLUSHED_CONTEXT_FILE; }
277
278
 
279
+ // Shell integration
280
+ shellStatus() { return printShellStatus(); }
281
+ shellInstall() { return shellInstall(); }
282
+ shellUninstall() { return shellUninstall(); }
283
+ getShellStatus() { return shellStatus(); }
284
+
278
285
  // Update - check npm for updates or update from local source
279
286
  async update(args = []) {
280
287
  const https = require('https');
package/lib/cli.js CHANGED
@@ -318,6 +318,17 @@ function runCli(manager) {
318
318
  uiServer.start();
319
319
  break;
320
320
  }
321
+ // Shell integration
322
+ case 'shell':
323
+ if (args[1] === 'install') {
324
+ manager.shellInstall();
325
+ } else if (args[1] === 'uninstall') {
326
+ manager.shellUninstall();
327
+ } else {
328
+ manager.shellStatus();
329
+ }
330
+ break;
331
+
321
332
  case 'version':
322
333
  case '-v':
323
334
  case '--version':
@@ -449,6 +460,14 @@ ${chalk.dim('Configuration manager for AI coding tools (Claude Code, Gemini CLI,
449
460
  ]));
450
461
  console.log();
451
462
 
463
+ // Shell Integration
464
+ console.log(box('Shell', [
465
+ cmd('shell', 'Show shell integration status'),
466
+ cmd('shell install', 'Add to ~/.zshrc'),
467
+ cmd('shell uninstall', 'Remove from ~/.zshrc'),
468
+ ]));
469
+ console.log();
470
+
452
471
  // UI & Maintenance
453
472
  console.log(box('UI & Maintenance', [
454
473
  cmd('ui', 'Start web UI (daemon mode)'),
package/lib/constants.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Constants and tool path configurations
3
3
  */
4
4
 
5
- const VERSION = '0.46.1';
5
+ const VERSION = '0.46.3-beta';
6
6
 
7
7
  // Tool-specific path configurations
8
8
  const TOOL_PATHS = {
package/lib/shell.js ADDED
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Shell integration management
3
+ */
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const os = require('os');
8
+
9
+ // Marker comments for identifying our integration
10
+ const MARKER_START = '# >>> coder-config shell integration >>>';
11
+ const MARKER_END = '# <<< coder-config shell integration <<<';
12
+
13
+ /**
14
+ * Get the path to the shell config file
15
+ */
16
+ function getShellConfigPath() {
17
+ const shell = process.env.SHELL || '/bin/zsh';
18
+ const shellName = path.basename(shell);
19
+
20
+ if (shellName === 'zsh') {
21
+ return path.join(os.homedir(), '.zshrc');
22
+ } else if (shellName === 'bash') {
23
+ // Check for .bash_profile first (macOS), then .bashrc
24
+ const bashProfile = path.join(os.homedir(), '.bash_profile');
25
+ if (fs.existsSync(bashProfile)) {
26
+ return bashProfile;
27
+ }
28
+ return path.join(os.homedir(), '.bashrc');
29
+ }
30
+
31
+ // Default to zshrc
32
+ return path.join(os.homedir(), '.zshrc');
33
+ }
34
+
35
+ /**
36
+ * Get the path to the shell integration script
37
+ */
38
+ function getShellScriptPath() {
39
+ // Check if installed globally via npm
40
+ const globalPath = path.join(__dirname, '..', 'shell', 'coder-config.zsh');
41
+ if (fs.existsSync(globalPath)) {
42
+ return globalPath;
43
+ }
44
+
45
+ // Check in node_modules
46
+ try {
47
+ const pkgPath = require.resolve('coder-config/shell/coder-config.zsh');
48
+ return pkgPath;
49
+ } catch {
50
+ // Not found in node_modules
51
+ }
52
+
53
+ return globalPath;
54
+ }
55
+
56
+ /**
57
+ * Check if shell integration is installed
58
+ */
59
+ function shellStatus() {
60
+ const rcPath = getShellConfigPath();
61
+ const scriptPath = getShellScriptPath();
62
+ const shell = path.basename(process.env.SHELL || '/bin/zsh');
63
+
64
+ const result = {
65
+ shell,
66
+ rcFile: rcPath,
67
+ scriptPath,
68
+ installed: false,
69
+ scriptExists: fs.existsSync(scriptPath)
70
+ };
71
+
72
+ if (!fs.existsSync(rcPath)) {
73
+ return result;
74
+ }
75
+
76
+ const content = fs.readFileSync(rcPath, 'utf8');
77
+ result.installed = content.includes(MARKER_START) ||
78
+ content.includes('coder-config.zsh') ||
79
+ content.includes('source') && content.includes('coder-config');
80
+
81
+ return result;
82
+ }
83
+
84
+ /**
85
+ * Install shell integration
86
+ */
87
+ function shellInstall() {
88
+ const status = shellStatus();
89
+
90
+ if (!status.scriptExists) {
91
+ console.error('Error: Shell integration script not found at:');
92
+ console.error(` ${status.scriptPath}`);
93
+ console.error('');
94
+ console.error('Try reinstalling coder-config:');
95
+ console.error(' npm install -g coder-config');
96
+ return false;
97
+ }
98
+
99
+ if (status.installed) {
100
+ console.log('Shell integration is already installed.');
101
+ console.log(` RC file: ${status.rcFile}`);
102
+ console.log('');
103
+ console.log('To apply changes, run:');
104
+ console.log(` source ${status.rcFile}`);
105
+ return true;
106
+ }
107
+
108
+ // Build the integration block
109
+ const integrationBlock = `
110
+ ${MARKER_START}
111
+ # Shell integration for coder-config (Claude Code, Gemini CLI, Codex CLI)
112
+ # Provides: completions, auto-apply on cd, workstream management
113
+ source "${status.scriptPath}"
114
+ ${MARKER_END}
115
+ `;
116
+
117
+ // Read existing content or create empty
118
+ let content = '';
119
+ if (fs.existsSync(status.rcFile)) {
120
+ content = fs.readFileSync(status.rcFile, 'utf8');
121
+ }
122
+
123
+ // Append integration block
124
+ content = content.trimEnd() + '\n' + integrationBlock;
125
+
126
+ fs.writeFileSync(status.rcFile, content);
127
+
128
+ console.log('✓ Shell integration installed');
129
+ console.log('');
130
+ console.log(` RC file: ${status.rcFile}`);
131
+ console.log(` Script: ${status.scriptPath}`);
132
+ console.log('');
133
+ console.log('Features enabled:');
134
+ console.log(' • Tab completions for all commands');
135
+ console.log(' • Auto-apply config on cd into projects');
136
+ console.log(' • Workstream session management');
137
+ console.log('');
138
+ console.log('To apply now, run:');
139
+ console.log(` source ${status.rcFile}`);
140
+ console.log('');
141
+ console.log('Or restart your terminal.');
142
+
143
+ return true;
144
+ }
145
+
146
+ /**
147
+ * Uninstall shell integration
148
+ */
149
+ function shellUninstall() {
150
+ const status = shellStatus();
151
+
152
+ if (!status.installed) {
153
+ console.log('Shell integration is not installed.');
154
+ return true;
155
+ }
156
+
157
+ if (!fs.existsSync(status.rcFile)) {
158
+ console.log('RC file not found:', status.rcFile);
159
+ return false;
160
+ }
161
+
162
+ let content = fs.readFileSync(status.rcFile, 'utf8');
163
+
164
+ // Remove the integration block (with markers)
165
+ const markerRegex = new RegExp(
166
+ `\\n?${MARKER_START.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?${MARKER_END.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\n?`,
167
+ 'g'
168
+ );
169
+ content = content.replace(markerRegex, '\n');
170
+
171
+ // Also remove any standalone source lines for coder-config.zsh
172
+ content = content.replace(/\n?.*source.*coder-config\.zsh.*\n?/g, '\n');
173
+
174
+ // Clean up multiple blank lines
175
+ content = content.replace(/\n{3,}/g, '\n\n');
176
+
177
+ fs.writeFileSync(status.rcFile, content);
178
+
179
+ console.log('✓ Shell integration removed');
180
+ console.log('');
181
+ console.log(` RC file: ${status.rcFile}`);
182
+ console.log('');
183
+ console.log('To apply, restart your terminal or run:');
184
+ console.log(` source ${status.rcFile}`);
185
+
186
+ return true;
187
+ }
188
+
189
+ /**
190
+ * Print shell status
191
+ */
192
+ function printShellStatus() {
193
+ const status = shellStatus();
194
+
195
+ console.log(`Shell: ${status.shell}`);
196
+ console.log(`RC file: ${status.rcFile}`);
197
+ console.log(`Script: ${status.scriptPath}`);
198
+ console.log(`Script exists: ${status.scriptExists ? 'yes' : 'no'}`);
199
+ console.log(`Installed: ${status.installed ? 'yes' : 'no'}`);
200
+
201
+ if (!status.installed) {
202
+ console.log('');
203
+ console.log('To install, run:');
204
+ console.log(' coder-config shell install');
205
+ }
206
+ }
207
+
208
+ module.exports = {
209
+ shellStatus,
210
+ shellInstall,
211
+ shellUninstall,
212
+ printShellStatus,
213
+ getShellConfigPath,
214
+ getShellScriptPath,
215
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder-config",
3
- "version": "0.46.1",
3
+ "version": "0.46.3-beta",
4
4
  "description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
5
5
  "author": "regression.io",
6
6
  "main": "config-loader.js",
@@ -71,6 +71,7 @@
71
71
  "shared/**",
72
72
  "scripts/**",
73
73
  "hooks/**",
74
+ "shell/**",
74
75
  "README.md"
75
76
  ],
76
77
  "devDependencies": {