hsh19900502 1.0.19 → 1.0.21
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/dist/commands/ide.d.ts +1 -1
- package/dist/commands/ide.js +24 -0
- package/dist/hsh.js +3 -3
- package/package.json +1 -1
- package/src/commands/ide.ts +25 -1
- package/src/hsh.ts +3 -3
package/dist/commands/ide.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'zx/globals';
|
|
2
|
-
export declare const openIDE: (ideType: "cursor" | "
|
|
2
|
+
export declare const openIDE: (ideType: "cursor" | "claude") => Promise<void>;
|
package/dist/commands/ide.js
CHANGED
|
@@ -3,6 +3,7 @@ import 'zx/globals';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import inquirerAutocomplete from 'inquirer-autocomplete-prompt';
|
|
5
5
|
import { readConfig } from '../util.js';
|
|
6
|
+
import { spawn } from 'child_process';
|
|
6
7
|
// Register autocomplete prompt
|
|
7
8
|
inquirer.registerPrompt('autocomplete', inquirerAutocomplete);
|
|
8
9
|
let reposConfig;
|
|
@@ -70,6 +71,29 @@ export const openIDE = async (ideType) => {
|
|
|
70
71
|
]);
|
|
71
72
|
const selectedProject = secondLevelAnswer.project;
|
|
72
73
|
const projectPath = reposConfig[currentCategory][selectedProject];
|
|
74
|
+
if (ideType === 'claude') {
|
|
75
|
+
// Use spawn with inherited stdio to support interactive TTY
|
|
76
|
+
const claudeProcess = spawn('claude', [], {
|
|
77
|
+
cwd: projectPath,
|
|
78
|
+
stdio: 'inherit', // Inherit stdin, stdout, stderr from parent process
|
|
79
|
+
shell: true,
|
|
80
|
+
});
|
|
81
|
+
// Wait for the process to exit
|
|
82
|
+
await new Promise((resolve, reject) => {
|
|
83
|
+
claudeProcess.on('close', (code) => {
|
|
84
|
+
if (code === 0) {
|
|
85
|
+
resolve();
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
reject(new Error(`Claude process exited with code ${code}`));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
claudeProcess.on('error', (error) => {
|
|
92
|
+
reject(error);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
73
97
|
// Open project in IDE
|
|
74
98
|
await $ `${ideType} ${projectPath}`;
|
|
75
99
|
console.log(chalk.green(`Opening ${selectedProject} in ${ideType}...`));
|
package/dist/hsh.js
CHANGED
|
@@ -60,10 +60,10 @@ program.command('cursor')
|
|
|
60
60
|
.action(async () => {
|
|
61
61
|
await openIDE('cursor');
|
|
62
62
|
});
|
|
63
|
-
program.command('
|
|
64
|
-
.description('open project in
|
|
63
|
+
program.command('claude')
|
|
64
|
+
.description('open project in Claude')
|
|
65
65
|
.action(async () => {
|
|
66
|
-
await openIDE('
|
|
66
|
+
await openIDE('claude');
|
|
67
67
|
});
|
|
68
68
|
// Cloud infrastructure management commands
|
|
69
69
|
const cloudCommand = program
|
package/package.json
CHANGED
package/src/commands/ide.ts
CHANGED
|
@@ -3,6 +3,7 @@ import 'zx/globals';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import inquirerAutocomplete from 'inquirer-autocomplete-prompt';
|
|
5
5
|
import { readConfig } from '../util.js';
|
|
6
|
+
import { spawn } from 'child_process';
|
|
6
7
|
|
|
7
8
|
interface ReposConfig {
|
|
8
9
|
[key: string]: {
|
|
@@ -66,7 +67,7 @@ async function searchProjects(answers: any, input = '') {
|
|
|
66
67
|
.map(p => p.name);
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
export const openIDE = async (ideType: 'cursor' | '
|
|
70
|
+
export const openIDE = async (ideType: 'cursor' | 'claude') => {
|
|
70
71
|
try {
|
|
71
72
|
await loadConfig();
|
|
72
73
|
|
|
@@ -97,6 +98,29 @@ export const openIDE = async (ideType: 'cursor' | 'surf') => {
|
|
|
97
98
|
const selectedProject = secondLevelAnswer.project;
|
|
98
99
|
const projectPath = reposConfig[currentCategory][selectedProject];
|
|
99
100
|
|
|
101
|
+
if(ideType === 'claude') {
|
|
102
|
+
// Use spawn with inherited stdio to support interactive TTY
|
|
103
|
+
const claudeProcess = spawn('claude', [], {
|
|
104
|
+
cwd: projectPath,
|
|
105
|
+
stdio: 'inherit', // Inherit stdin, stdout, stderr from parent process
|
|
106
|
+
shell: true,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Wait for the process to exit
|
|
110
|
+
await new Promise<void>((resolve, reject) => {
|
|
111
|
+
claudeProcess.on('close', (code) => {
|
|
112
|
+
if (code === 0) {
|
|
113
|
+
resolve();
|
|
114
|
+
} else {
|
|
115
|
+
reject(new Error(`Claude process exited with code ${code}`));
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
claudeProcess.on('error', (error) => {
|
|
119
|
+
reject(error);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
100
124
|
// Open project in IDE
|
|
101
125
|
await $`${ideType} ${projectPath}`;
|
|
102
126
|
console.log(chalk.green(`Opening ${selectedProject} in ${ideType}...`));
|
package/src/hsh.ts
CHANGED
|
@@ -74,10 +74,10 @@ program.command('cursor')
|
|
|
74
74
|
await openIDE('cursor');
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
program.command('
|
|
78
|
-
.description('open project in
|
|
77
|
+
program.command('claude')
|
|
78
|
+
.description('open project in Claude')
|
|
79
79
|
.action(async () => {
|
|
80
|
-
await openIDE('
|
|
80
|
+
await openIDE('claude');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
// Cloud infrastructure management commands
|