@oomfware/cgr 0.1.0 → 0.1.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/dist/index.mjs CHANGED
@@ -305,14 +305,22 @@ const listCachedRepos = () => {
305
305
  /**
306
306
  * prompts the user for confirmation.
307
307
  * @param msg the prompt message
308
- * @returns promise that resolves to true if confirmed
308
+ * @returns promise that resolves to true if confirmed, or exits on interrupt
309
309
  */
310
310
  const confirm = (msg) => new Promise((resolve) => {
311
+ let answered = false;
311
312
  const rl = createInterface({
312
313
  input: process.stdin,
313
314
  output: process.stdout
314
315
  });
316
+ rl.on("close", () => {
317
+ if (!answered) {
318
+ console.log();
319
+ process.exit(130);
320
+ }
321
+ });
315
322
  rl.question(`${msg} [y/N] `, (answer) => {
323
+ answered = true;
316
324
  rl.close();
317
325
  resolve(answer.toLowerCase() === "y");
318
326
  });
@@ -372,6 +380,7 @@ const handler = async (args) => {
372
380
  //#endregion
373
381
  //#region src/index.ts
374
382
  const result = run(or(command("ask", schema$1, { description: message`ask a question about a repository` }), command("clean", schema, { description: message`remove cached repositories` })), {
383
+ programName: "cgr",
375
384
  help: "both",
376
385
  version: {
377
386
  value: "0.1.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oomfware/cgr",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "ask questions about git repositories using Claude Code",
5
5
  "license": "0BSD",
6
6
  "repository": {
@@ -113,15 +113,24 @@ const listCachedRepos = (): {
113
113
  /**
114
114
  * prompts the user for confirmation.
115
115
  * @param msg the prompt message
116
- * @returns promise that resolves to true if confirmed
116
+ * @returns promise that resolves to true if confirmed, or exits on interrupt
117
117
  */
118
118
  const confirm = (msg: string): Promise<boolean> =>
119
119
  new Promise((resolve) => {
120
+ let answered = false;
120
121
  const rl = createInterface({
121
122
  input: process.stdin,
122
123
  output: process.stdout,
123
124
  });
125
+ rl.on('close', () => {
126
+ if (!answered) {
127
+ // handle Ctrl+C or stream close
128
+ console.log();
129
+ process.exit(130);
130
+ }
131
+ });
124
132
  rl.question(`${msg} [y/N] `, (answer) => {
133
+ answered = true;
125
134
  rl.close();
126
135
  resolve(answer.toLowerCase() === 'y');
127
136
  });
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ const parser = or(
16
16
  );
17
17
 
18
18
  const result = run(parser, {
19
+ programName: 'cgr',
19
20
  help: 'both',
20
21
  version: { value: '0.1.0', mode: 'option' },
21
22
  brief: message`ask questions about git repositories using Claude Code`,