@openape/apes 0.7.1 → 0.7.2

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/cli.js CHANGED
@@ -2385,7 +2385,7 @@ var mcpCommand = defineCommand25({
2385
2385
  if (transport !== "stdio" && transport !== "sse") {
2386
2386
  throw new Error('Transport must be "stdio" or "sse"');
2387
2387
  }
2388
- const { startMcpServer } = await import("./server-UTCZSPCU.js");
2388
+ const { startMcpServer } = await import("./server-GPETT3ON.js");
2389
2389
  await startMcpServer(transport, port);
2390
2390
  }
2391
2391
  });
@@ -2960,10 +2960,10 @@ if (shellRewrite) {
2960
2960
  if (shellRewrite.action === "rewrite") {
2961
2961
  process.argv = shellRewrite.argv;
2962
2962
  } else if (shellRewrite.action === "version") {
2963
- console.log(`ape-shell ${"0.7.1"} (OpenApe DDISA shell wrapper)`);
2963
+ console.log(`ape-shell ${"0.7.2"} (OpenApe DDISA shell wrapper)`);
2964
2964
  process.exit(0);
2965
2965
  } else if (shellRewrite.action === "help") {
2966
- console.log(`ape-shell ${"0.7.1"} \u2014 OpenApe DDISA shell wrapper`);
2966
+ console.log(`ape-shell ${"0.7.2"} \u2014 OpenApe DDISA shell wrapper`);
2967
2967
  console.log("");
2968
2968
  console.log("Usage:");
2969
2969
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -3020,7 +3020,7 @@ var configCommand = defineCommand31({
3020
3020
  var main = defineCommand31({
3021
3021
  meta: {
3022
3022
  name: "apes",
3023
- version: "0.7.1",
3023
+ version: "0.7.2",
3024
3024
  description: "Unified CLI for OpenApe"
3025
3025
  },
3026
3026
  subCommands: {
@@ -301,7 +301,7 @@ function registerAdapterTools(server) {
301
301
  async function startMcpServer(transport, port) {
302
302
  const server = new McpServer({
303
303
  name: "apes",
304
- version: true ? "0.7.1" : "0.1.0"
304
+ version: true ? "0.7.2" : "0.1.0"
305
305
  });
306
306
  registerStaticTools(server);
307
307
  registerAdapterTools(server);
@@ -329,4 +329,4 @@ async function startMcpServer(transport, port) {
329
329
  export {
330
330
  startMcpServer
331
331
  };
332
- //# sourceMappingURL=server-UTCZSPCU.js.map
332
+ //# sourceMappingURL=server-GPETT3ON.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openape/apes",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "turbo": {
5
5
  "tags": [
6
6
  "publishable"
@@ -20,6 +20,7 @@
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
+ "scripts",
23
24
  "README.md"
24
25
  ],
25
26
  "dependencies": {
@@ -0,0 +1,103 @@
1
+ #!/bin/bash
2
+ # -----------------------------------------------------------------------------
3
+ # ape-shell login-shell wrapper
4
+ # -----------------------------------------------------------------------------
5
+ #
6
+ # The `@openape/apes` CLI is a Node.js script with a `#!/usr/bin/env node`
7
+ # shebang. When `ape-shell` is set as a user's login shell via `chsh`, the
8
+ # kernel invokes it BEFORE any rc file has run — so only the system default
9
+ # PATH is visible, which typically does NOT include Homebrew or nvm paths.
10
+ # The shebang then fails with:
11
+ #
12
+ # env: node: No such file or directory
13
+ #
14
+ # This wrapper is the actual file pointed at by `chsh` and by the
15
+ # `/usr/local/bin/ape-shell` symlink. It:
16
+ #
17
+ # 1. Prepends known node install locations to PATH (Homebrew, nvm)
18
+ # 2. Sets APES_SHELL_WRAPPER=1 so the CLI knows it was invoked via this
19
+ # wrapper (because argv[0]/argv[1] inspection gets clobbered when we
20
+ # exec Node through the wrapper)
21
+ # 3. Exec's node with the real dist/cli.js path, preserving the original
22
+ # argv[0] via `exec -a "$0"` so login-shell detection ("-ape-shell"
23
+ # prefix) still works inside the CLI
24
+ #
25
+ # To install, point a symlink at this file:
26
+ #
27
+ # sudo ln -sf /path/to/ape-shell-wrapper.sh /usr/local/bin/ape-shell
28
+ # sudo chsh -s /usr/local/bin/ape-shell <user>
29
+ #
30
+ # You can override the node binary via APES_SHELL_NODE, and the CLI entry
31
+ # point via APES_SHELL_CLI_JS, for environments where the defaults don't
32
+ # apply.
33
+ # -----------------------------------------------------------------------------
34
+
35
+ set -e
36
+
37
+ # Known node install locations searched in order. The first one found wins.
38
+ # Users with exotic setups can override via APES_SHELL_NODE env var.
39
+ _node_candidates=(
40
+ "${APES_SHELL_NODE:-}"
41
+ "/opt/homebrew/bin/node"
42
+ "/usr/local/bin/node"
43
+ "/usr/bin/node"
44
+ )
45
+
46
+ _node_bin=""
47
+ for candidate in "${_node_candidates[@]}"; do
48
+ if [ -n "$candidate" ] && [ -x "$candidate" ]; then
49
+ _node_bin="$candidate"
50
+ break
51
+ fi
52
+ done
53
+
54
+ if [ -z "$_node_bin" ]; then
55
+ echo "ape-shell: no node binary found. Install Node.js or set APES_SHELL_NODE." >&2
56
+ exit 127
57
+ fi
58
+
59
+ # Locate the CLI JS. Default: sibling of this wrapper script via a known
60
+ # relative path (assumes the wrapper lives in packages/apes/scripts). Can be
61
+ # overridden via APES_SHELL_CLI_JS for production installs where the paths
62
+ # might differ.
63
+ #
64
+ # Symlink resolution: when the wrapper is installed as a symlink (e.g.
65
+ # /usr/local/bin/ape-shell → /path/to/packages/apes/scripts/ape-shell-wrapper.sh)
66
+ # BASH_SOURCE[0] points at the symlink, not the real file. We must walk the
67
+ # symlink chain before computing the relative `../dist/cli.js` path, otherwise
68
+ # it ends up as `/usr/local/bin/../dist/cli.js` = `/usr/local/dist/cli.js`
69
+ # which doesn't exist. macOS's readlink lacks `-f`, so use the portable
70
+ # loop idiom.
71
+ if [ -z "${APES_SHELL_CLI_JS:-}" ]; then
72
+ _source="${BASH_SOURCE[0]}"
73
+ while [ -L "$_source" ]; do
74
+ _target="$(readlink "$_source")"
75
+ case "$_target" in
76
+ /*) _source="$_target" ;;
77
+ *) _source="$(cd -P "$(dirname "$_source")" >/dev/null && pwd)/$_target" ;;
78
+ esac
79
+ done
80
+ _wrapper_dir="$(cd -P "$(dirname "$_source")" >/dev/null && pwd)"
81
+ _cli_js="$_wrapper_dir/../dist/cli.js"
82
+ else
83
+ _cli_js="$APES_SHELL_CLI_JS"
84
+ fi
85
+
86
+ if [ ! -f "$_cli_js" ]; then
87
+ echo "ape-shell: cli.js not found at $_cli_js. Set APES_SHELL_CLI_JS to override." >&2
88
+ exit 127
89
+ fi
90
+
91
+ # Prepend common node install dirs to PATH so anything spawned inside the
92
+ # shell (or by the interactive REPL's bash child) can also find node.
93
+ export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
94
+
95
+ # Signal to the CLI that it was invoked via this wrapper, so invocation-mode
96
+ # detection can fall back to this hint when argv-based detection fails (the
97
+ # argv[1] basename check becomes `cli.js` once we exec node directly).
98
+ export APES_SHELL_WRAPPER=1
99
+
100
+ # exec -a preserves the original argv[0] that login/sshd/su gave us — notably
101
+ # the leading "-" prefix for a login shell. The CLI still sees it via
102
+ # process.argv0, so its login-shell detection keeps working.
103
+ exec -a "$0" "$_node_bin" "$_cli_js" "$@"
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Workaround for pnpm 10 losing execute permissions on `spawn-helper`
4
+ * binaries shipped in node-pty prebuilds.
5
+ *
6
+ * Without exec bit, `pty.spawn(...)` fails at runtime with
7
+ * Error: posix_spawnp failed.
8
+ *
9
+ * This script runs after `pnpm install` and chmods the helper for every
10
+ * platform's prebuild directory that it can find. Missing directories are
11
+ * ignored silently so it's safe to run on any host.
12
+ */
13
+ import { chmodSync, existsSync } from 'node:fs'
14
+ import { createRequire } from 'node:module'
15
+ import { dirname, join } from 'node:path'
16
+
17
+ const require = createRequire(import.meta.url)
18
+
19
+ let ptyRoot
20
+ try {
21
+ ptyRoot = dirname(require.resolve('node-pty/package.json'))
22
+ }
23
+ catch {
24
+ // node-pty not installed yet (prepare runs before install in some flows) — nothing to do.
25
+ process.exit(0)
26
+ }
27
+
28
+ const platforms = ['darwin-arm64', 'darwin-x64', 'linux-x64', 'linux-arm64']
29
+ for (const platform of platforms) {
30
+ const helper = join(ptyRoot, 'prebuilds', platform, 'spawn-helper')
31
+ if (existsSync(helper)) {
32
+ try {
33
+ chmodSync(helper, 0o755)
34
+ }
35
+ catch (err) {
36
+ console.warn(`[fix-node-pty-perms] failed to chmod ${helper}:`, err instanceof Error ? err.message : String(err))
37
+ }
38
+ }
39
+ }