@nomac/cli 0.21.0 → 0.21.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/package.json +1 -1
- package/skill/SKILL.md +6 -3
- package/src/phone-tools.json +3 -3
- package/src/self-update-worker.mjs +6 -5
- package/src/self-update.mjs +19 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomac/cli",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "A real cloud Mac for AI agents: Xcode, the iOS Simulator, signing, TestFlight and App Store publishing, by the minute, over MCP, SSH and HTTPS.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
package/skill/SKILL.md
CHANGED
|
@@ -105,9 +105,12 @@ keyboard and mouse, also on the lock screen and in password dialogs, use
|
|
|
105
105
|
`mac_input`): each answers with a screenshot. Drive the Simulator with
|
|
106
106
|
simulator-use, preinstalled: `simulator-use look` reads the screen as text,
|
|
107
107
|
`simulator-use act 'tap "Sign In"'` taps and types by label, `simulator-use run`
|
|
108
|
-
builds, installs and launches (simctl works too),
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
builds, installs and launches (simctl works too), `simulator-use app launch ID
|
|
109
|
+
-Onboarding 3` opens a screen with launch arguments (UserDefaults) and
|
|
110
|
+
`simulator-use look --out shot.jpg` saves it once still (`.png`: full size),
|
|
111
|
+
and `simulator-use app storekit Products.storekit --app ID` tests in-app
|
|
112
|
+
purchases from the app's `.storekit` file (the App Store's sandbox cannot buy
|
|
113
|
+
in a Simulator). Give the human
|
|
111
114
|
`open_mac_desktop` when they want to see the screen.
|
|
112
115
|
`get_mac_session` (and `nomac status --json`) lists what
|
|
113
116
|
is installed: Node, Python, uv, nvm, Ruby with CocoaPods, xcbeautify, xcodegen,
|
package/src/phone-tools.json
CHANGED
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
224
|
"name": "phone_app_control",
|
|
225
|
-
"description": "Cloud iPhone: Launch, install, stop or remove an app; open a URL or deep link; grant, revoke or reset
|
|
225
|
+
"description": "Cloud iPhone: Launch, install, stop or remove an app; open a URL or deep link; grant, revoke or reset permissions; set location; send a push; test purchases (.storekit); set appearance, locale, time zone, text size or a clean status bar. launch answers with its first screen.",
|
|
226
226
|
"inputSchema": {
|
|
227
227
|
"type": "object",
|
|
228
228
|
"properties": {
|
|
@@ -249,11 +249,11 @@
|
|
|
249
249
|
"description": "What to do"
|
|
250
250
|
},
|
|
251
251
|
"app": {
|
|
252
|
-
"description": "Bundle id
|
|
252
|
+
"description": "Bundle id (default: last launched); install: a Simulator .app path",
|
|
253
253
|
"type": "string"
|
|
254
254
|
},
|
|
255
255
|
"value": {
|
|
256
|
-
"description": "URL, permission, lat,long, push text/JSON, light/dark, locale (fr_FR), time zone (Europe/Paris), text size
|
|
256
|
+
"description": "Per action: URL, permission, lat,long, push text/JSON, launch args (-Key value; no secrets), light/dark, locale (fr_FR), time zone (Europe/Paris), text size, clean/clear",
|
|
257
257
|
"type": "string"
|
|
258
258
|
},
|
|
259
259
|
"device": {
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
5
|
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
-
import { installedBin, pruneInstalls } from "./self-update.mjs";
|
|
7
|
+
import { installedBin, npmCommand, pruneInstalls } from "./self-update.mjs";
|
|
8
8
|
|
|
9
9
|
const [version, dir] = process.argv.slice(2);
|
|
10
10
|
if (!/^\d{1,4}\.\d{1,4}\.\d{1,4}$/.test(version ?? "") || !dir) process.exit(2);
|
|
11
|
-
const windows = process.platform === "win32";
|
|
12
11
|
try {
|
|
13
12
|
rmSync(dir, { recursive: true, force: true });
|
|
14
13
|
mkdirSync(dir, { recursive: true });
|
|
15
|
-
const npm =
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const npm = npmCommand();
|
|
15
|
+
// Through a shell (npm.cmd on PATH, Windows) the words are joined as they are: a home folder with a space is quoted.
|
|
16
|
+
const words = ["install", "--prefix", dir, "--no-audit", "--no-fund", "--omit=dev", "--loglevel=error", `@nomac/cli@${version}`].map(word => (npm.shell && /\s/.test(word) ? `"${word}"` : word));
|
|
17
|
+
const install = spawnSync(npm.command, [...npm.args, ...words], { stdio: "ignore", timeout: 10 * 60_000, shell: npm.shell, windowsHide: true });
|
|
18
|
+
if (install.status !== 0) throw new Error("npm install failed");
|
|
18
19
|
const check = spawnSync(process.execPath, [installedBin(version), "--version"], { encoding: "utf8", timeout: 30_000, env: { ...process.env, NOMAC_CLI_DELEGATED: "check", NOMAC_NO_AUTO_UPDATE: "1" }, windowsHide: true });
|
|
19
20
|
if (check.status !== 0 || !check.stdout.includes(version)) throw new Error("the installed CLI did not run");
|
|
20
21
|
writeFileSync(join(dir, ".nomac-ready"), `${new Date().toISOString()}\n`);
|
package/src/self-update.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { CLI_VERSION } from "./client-info.mjs";
|
|
7
7
|
|
|
@@ -105,6 +105,23 @@ export function updateNotice(state = readState(), now = Date.now()) {
|
|
|
105
105
|
return `NoMac CLI ${state.latest} is out (this is ${CLI_VERSION}): npm install -g @nomac/cli@latest, or run nomac update.`;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* The npm that came with the Node running this CLI, run by that Node: an editor's SSH ProxyCommand or a desktop MCP
|
|
110
|
+
* client often starts the CLI by Node's full path with a PATH that has no npm, and an install that looked npm up on
|
|
111
|
+
* PATH failed there every time, silently (an account ran 0.13.6 for five days, about 24,000 commands, October 30).
|
|
112
|
+
* The places: beside node (a link to npm-cli.js: Linux packages, nvm, the official tarball), the prefix's lib or
|
|
113
|
+
* Homebrew's libexec, and Windows' node_modules beside node.exe. Else npm on PATH, as before.
|
|
114
|
+
*/
|
|
115
|
+
export function npmCommand({ execPath = process.execPath, platform = process.platform, exists = existsSync, realpath = realpathSync } = {}) {
|
|
116
|
+
const bin = dirname(execPath), prefix = dirname(bin);
|
|
117
|
+
const beside = platform === "win32" ? [] : [join(bin, "npm")].filter(exists).map(link => { try { return realpath(link); } catch { return ""; } }).filter(file => file.endsWith(".js"));
|
|
118
|
+
const places = [...beside, ...(platform === "win32" ? [join(bin, "node_modules", "npm", "bin", "npm-cli.js")]
|
|
119
|
+
: [join(prefix, "lib", "node_modules", "npm", "bin", "npm-cli.js"), join(prefix, "libexec", "lib", "node_modules", "npm", "bin", "npm-cli.js")])];
|
|
120
|
+
const cli = places.find(file => exists(file));
|
|
121
|
+
if (cli) return { command: execPath, args: [cli], shell: false };
|
|
122
|
+
return platform === "win32" ? { command: "npm.cmd", args: [], shell: true } : { command: "npm", args: [], shell: false };
|
|
123
|
+
}
|
|
124
|
+
|
|
108
125
|
/** Removes installed versions older than keep's predecessor (one older version stays for running commands). */
|
|
109
126
|
export function pruneInstalls(keep) {
|
|
110
127
|
const versions = installedVersions().filter(v => v !== keep).sort((a, b) => (newer(a, b) ? -1 : 1));
|