happy-coder 0.7.1-beta.2 → 0.7.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/README.md CHANGED
@@ -32,7 +32,10 @@ This will:
32
32
 
33
33
  ## Requirements
34
34
 
35
- - Node.js >= 18.0.0
35
+ - Node.js >= 20.0.0
36
+ - Required by `eventsource-parser@3.0.5`, which is required by
37
+ `@modelcontextprotocol/sdk`, which we used to implement permission forwarding
38
+ to mobile app
36
39
  - Claude CLI installed & logged in (`claude` command available in PATH)
37
40
 
38
41
  ## License
package/bin/happy.mjs CHANGED
@@ -1,2 +1,35 @@
1
- #!/usr/bin/env node --no-warnings --no-deprecation
2
- import "../dist/index.mjs";
1
+ #!/usr/bin/env node
2
+
3
+ import { execFileSync } from 'child_process';
4
+ import { fileURLToPath } from 'url';
5
+ import { join, dirname } from 'path';
6
+
7
+ // Check if we're already running with the flags
8
+ const hasNoWarnings = process.execArgv.includes('--no-warnings');
9
+ const hasNoDeprecation = process.execArgv.includes('--no-deprecation');
10
+
11
+ if (!hasNoWarnings || !hasNoDeprecation) {
12
+ // Get path to the actual CLI entrypoint
13
+ const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
14
+ const entrypoint = join(projectRoot, 'dist', 'index.mjs');
15
+
16
+ // Execute the actual CLI directly with the correct flags
17
+ try {
18
+ execFileSync(process.execPath, [
19
+ '--no-warnings',
20
+ '--no-deprecation',
21
+ entrypoint,
22
+ ...process.argv.slice(2)
23
+ ], {
24
+ stdio: 'inherit',
25
+ env: process.env
26
+ });
27
+ } catch (error) {
28
+ // execFileSync throws if the process exits with non-zero
29
+ process.exit(error.status || 1);
30
+ }
31
+ } else {
32
+ // We're running Node with the flags we wanted, import the CLI entrypoint
33
+ // module to avoid creating a new process.
34
+ import("../dist/index.mjs");
35
+ }