kracked-core 1.5.0 → 1.5.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.
@@ -4,7 +4,7 @@ import { runInit } from '../src/wizard.mjs';
4
4
  import { runUninstall } from '../src/uninstall.mjs';
5
5
  import { runUpdate } from '../src/update.mjs';
6
6
  import { runStatus } from '../src/status.mjs';
7
- import { beginTypeAhead } from '../src/prompt.mjs';
7
+ import { beginTypeAhead, endTypeAhead } from '../src/prompt.mjs';
8
8
 
9
9
  const USAGE = `kracked-core — memory & workflow installer for AI coding agents
10
10
 
@@ -63,7 +63,16 @@ async function main() {
63
63
  process.exit(1);
64
64
  }
65
65
 
66
- main().catch((err) => {
67
- process.stderr.write(`\nkracked-core failed: ${err.message}\n`);
68
- process.exit(1);
69
- });
66
+ main()
67
+ .catch((err) => {
68
+ process.stderr.write(`\nkracked-core failed: ${err.message}\n`);
69
+ process.exitCode = 1;
70
+ })
71
+ // A raw-mode TTY stdin stays an ACTIVE HANDLE even after removeListener +
72
+ // pause(), so Node's event loop never drains and the terminal never returns —
73
+ // the command looks stuck even when it succeeded. Releasing stdin is not
74
+ // enough on its own; exit explicitly once the work is done.
75
+ .finally(() => {
76
+ endTypeAhead();
77
+ process.stdout.write('', () => process.exit(process.exitCode ?? 0));
78
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kracked-core",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Zero-dependency memory & workflow installer for AI coding agents — global identity, project memory, and skills that survive session restarts.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/prompt.mjs CHANGED
@@ -110,6 +110,26 @@ export function beginTypeAhead() {
110
110
  stdin.on('data', bufferEarlyKeys);
111
111
  }
112
112
 
113
+ /**
114
+ * Release stdin so the process can exit.
115
+ *
116
+ * An open stdin listener keeps Node's event loop alive indefinitely, so any
117
+ * command that finishes WITHOUT going through a prompt's cleanup (an early
118
+ * return, an error path, a completed run) leaves the terminal hanging with no
119
+ * output and no prompt back. `process.exitCode` sets the code but does not
120
+ * exit. Every command path must end here.
121
+ */
122
+ export function endTypeAhead() {
123
+ if (!stdin.isTTY) return;
124
+ stdin.removeListener('data', bufferEarlyKeys);
125
+ try {
126
+ if (stdin.isRaw) stdin.setRawMode(false);
127
+ } catch {
128
+ // Terminal already gone.
129
+ }
130
+ stdin.pause();
131
+ }
132
+
113
133
  function bufferEarlyKeys(chunk) {
114
134
  pendingKeys.push(...splitKeys(chunk));
115
135
  }
package/src/update.mjs CHANGED
@@ -87,10 +87,18 @@ export async function runUpdate() {
87
87
  stdout.write(`${bold('kracked-core update')} ${dim(`v${version}`)}\n\n`);
88
88
 
89
89
  if (!fs.existsSync(path.join(projectDir, '.kracked'))) {
90
- stdout.write(
91
- `No kracked-core install found in ${projectDir}\n\n` +
92
- 'Run `npx kracked-core init` to set it up first.\n'
93
- );
90
+ stdout.write(`No kracked-core install found in ${projectDir}\n\n`);
91
+
92
+ // Easy mistake: running this inside the package source rather than a
93
+ // project that uses it. Say so instead of just repeating the error.
94
+ if (fs.existsSync(path.join(projectDir, 'templates', 'loaders', 'AGENTS.md'))) {
95
+ stdout.write(
96
+ 'This looks like the kracked-core package source, not a project that\n' +
97
+ 'uses it. cd into your own project first, then run this again.\n'
98
+ );
99
+ } else {
100
+ stdout.write('Run `npx kracked-core@latest init` to set it up first.\n');
101
+ }
94
102
  process.exitCode = 1;
95
103
  return;
96
104
  }