@solidnumber/cli 2.30.2 → 2.32.0

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +1 -1
  3. package/dist/commands/agent.js +5 -2
  4. package/dist/commands/agent.js.map +1 -1
  5. package/dist/commands/api.d.ts.map +1 -1
  6. package/dist/commands/api.js +4 -2
  7. package/dist/commands/api.js.map +1 -1
  8. package/dist/commands/helper.d.ts +3 -0
  9. package/dist/commands/helper.d.ts.map +1 -0
  10. package/dist/commands/helper.js +209 -0
  11. package/dist/commands/helper.js.map +1 -0
  12. package/dist/commands/how-to.d.ts +18 -2
  13. package/dist/commands/how-to.d.ts.map +1 -1
  14. package/dist/commands/how-to.js +55 -4
  15. package/dist/commands/how-to.js.map +1 -1
  16. package/dist/index.js +2 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/lib/helper-actions.d.ts +50 -0
  19. package/dist/lib/helper-actions.d.ts.map +1 -0
  20. package/dist/lib/helper-actions.js +194 -0
  21. package/dist/lib/helper-actions.js.map +1 -0
  22. package/dist/lib/helper-client.d.ts +37 -0
  23. package/dist/lib/helper-client.d.ts.map +1 -0
  24. package/dist/lib/helper-client.js +131 -0
  25. package/dist/lib/helper-client.js.map +1 -0
  26. package/dist/lib/helper-files.d.ts +29 -0
  27. package/dist/lib/helper-files.d.ts.map +1 -0
  28. package/dist/lib/helper-files.js +74 -0
  29. package/dist/lib/helper-files.js.map +1 -0
  30. package/dist/lib/helper-session.d.ts +54 -0
  31. package/dist/lib/helper-session.d.ts.map +1 -0
  32. package/dist/lib/helper-session.js +80 -0
  33. package/dist/lib/helper-session.js.map +1 -0
  34. package/dist/lib/helper-ui.d.ts +35 -0
  35. package/dist/lib/helper-ui.d.ts.map +1 -0
  36. package/dist/lib/helper-ui.js +300 -0
  37. package/dist/lib/helper-ui.js.map +1 -0
  38. package/dist/lib/spinner.d.ts +4 -1
  39. package/dist/lib/spinner.d.ts.map +1 -1
  40. package/dist/lib/spinner.js +10 -0
  41. package/dist/lib/spinner.js.map +1 -1
  42. package/package.json +3 -2
  43. package/platform-docs/llms.txt +5 -4
  44. package/dist/lib/command-count.d.ts +0 -15
  45. package/dist/lib/command-count.d.ts.map +0 -1
  46. package/dist/lib/command-count.js +0 -37
  47. package/dist/lib/command-count.js.map +0 -1
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HelperSession = void 0;
4
+ /**
5
+ * The helper's own decisions — what it will do for a request, and what it refuses.
6
+ *
7
+ * The platform can ask. This is the second check, on the person's own machine, and it
8
+ * does not trust the first:
9
+ *
10
+ * ⛔ NOTHING RUNS WITHOUT A GRANT THIS MACHINE APPROVED. The person typed a code
11
+ * here; the platform answered with that grant's id; only a request naming that
12
+ * id is run. A request with no grant, another grant, or after Stop is refused.
13
+ * ⛔ ONLY A NAME IN THIS MACHINE'S OWN LIST. See helper-actions.ts.
14
+ * ⛔ LOOK FIRST, CHANGE LATER. A code typed here lets the host LOOK. Nothing that
15
+ * changes this machine runs until the person also typed `allow` here.
16
+ * ⛔ STOP IS LOCAL AND IMMEDIATE. It clears the grant here before it tells anyone.
17
+ *
18
+ * Pure state plus an injected runner, so each rule is testable.
19
+ */
20
+ const helper_actions_1 = require("./helper-actions");
21
+ class HelperSession {
22
+ platform;
23
+ exec;
24
+ now;
25
+ grantId = null;
26
+ mayChange = false;
27
+ log = [];
28
+ constructor(platform, exec, now = Date.now) {
29
+ this.platform = platform;
30
+ this.exec = exec;
31
+ this.now = now;
32
+ }
33
+ get granted() { return this.grantId !== null; }
34
+ get changesAllowed() { return this.grantId !== null && this.mayChange; }
35
+ /** The platform confirmed the code the person typed here. */
36
+ approved(grantId) {
37
+ if (typeof grantId !== 'number' || !Number.isInteger(grantId) || grantId <= 0)
38
+ return false;
39
+ this.grantId = grantId;
40
+ this.mayChange = false;
41
+ return true;
42
+ }
43
+ /** The person typed `allow` here and the platform agreed, for the grant this machine holds. */
44
+ allowChanges(grantId) {
45
+ if (this.grantId === null || grantId !== this.grantId)
46
+ return false;
47
+ this.mayChange = true;
48
+ return true;
49
+ }
50
+ /** Stop: theirs (pressed here) or the platform's (the grant ended). Always wins. */
51
+ stop() { this.grantId = null; this.mayChange = false; }
52
+ /** One request from the platform → the answer to send back, or null to send nothing. */
53
+ async handle(request) {
54
+ if (!request || typeof request !== 'object')
55
+ return null;
56
+ if (request.type === 'grant_ended' || request.type === 'retired') {
57
+ this.stop();
58
+ return null;
59
+ }
60
+ if (request.type !== 'do' || typeof request.rid !== 'string' || !request.rid)
61
+ return null;
62
+ const action = typeof request.action === 'string' ? request.action : '';
63
+ const refuse = (reason) => {
64
+ this.log.push({ at: this.now(), action, ok: false, reason });
65
+ return { rid: request.rid, result: { ok: false, reason } };
66
+ };
67
+ if (this.grantId === null)
68
+ return refuse('no_grant_on_this_machine');
69
+ if (request.grant_id !== this.grantId)
70
+ return refuse('grant_not_this_one');
71
+ const known = Object.prototype.hasOwnProperty.call(helper_actions_1.CATALOG, action) ? helper_actions_1.CATALOG[action] : null;
72
+ if (known?.kind === 'act' && !this.mayChange)
73
+ return refuse('change_not_allowed_here');
74
+ const result = await (0, helper_actions_1.runAction)(action, request.inputs, this.platform, this.exec);
75
+ this.log.push({ at: this.now(), action, ok: result.ok, reason: result.reason });
76
+ return { rid: request.rid, result };
77
+ }
78
+ }
79
+ exports.HelperSession = HelperSession;
80
+ //# sourceMappingURL=helper-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-session.js","sourceRoot":"","sources":["../../src/lib/helper-session.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,qDAAmG;AAKnG,MAAa,aAAa;IAKK;IAA4C;IACtD;IALX,OAAO,GAAkB,IAAI,CAAC;IAC9B,SAAS,GAAG,KAAK,CAAC;IACjB,GAAG,GAAU,EAAE,CAAC;IAEzB,YAA6B,QAAyB,E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AI,CAAC,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAChF,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;CACF;AA/CD,sCA+CC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * A program's own window, by the labels on it: read its controls, set one, press one.
3
+ *
4
+ * Through the system's accessibility layer — UI Automation on Windows, System Events
5
+ * on a Mac. Not on Linux.
6
+ *
7
+ * ⛔ A CONTROL IS FOUND BY ITS LABEL, never by where it is on the screen, in the front
8
+ * window of the one program that was named.
9
+ * ⛔ THE SCRIPTS ARE FIXED TEXT. The program, the label and the value reach them as
10
+ * data (environment variables on Windows, arguments on a Mac) and are never joined
11
+ * into the script.
12
+ * ⛔ A PASSWORD FIELD is never read and never filled. The script checks on the machine
13
+ * and refuses, whatever was asked.
14
+ *
15
+ * ⚠️ On a Mac the terminal running the helper needs Accessibility permission (System
16
+ * Settings → Privacy & Security → Accessibility). Without it every action answers
17
+ * `not_permitted`.
18
+ */
19
+ import type { ActionResult, Exec, Platform } from './helper-actions';
20
+ export type UiMode = 'read' | 'set' | 'press';
21
+ export declare const UI_TIMEOUT_MS = 10000;
22
+ export declare const WINDOWS_SCRIPT = "\n$ErrorActionPreference = 'Stop'\n$T = [char]9\ntry {\n Add-Type -AssemblyName UIAutomationClient\n Add-Type -AssemblyName UIAutomationTypes\n $mode = $env:SOLID_UI_MODE\n $prog = $env:SOLID_UI_PROGRAM -replace '\\.exe$', ''\n $ctl = $env:SOLID_UI_CONTROL\n $val = $env:SOLID_UI_VALUE\n $p = Get-Process -Name $prog -ErrorAction SilentlyContinue | Where-Object { $_.MainWindowHandle -ne 0 } | Select-Object -First 1\n if (-not $p) { 'ERR' + $T + 'program_not_running'; exit 0 }\n $AE = [System.Windows.Automation.AutomationElement]\n $Scope = [System.Windows.Automation.TreeScope]::Descendants\n $root = $AE::FromHandle($p.MainWindowHandle)\n $all = $root.FindAll($Scope, [System.Windows.Automation.Condition]::TrueCondition)\n function Kind($e) { return ($e.Current.ControlType.ProgrammaticName -replace '^ControlType\\.', '') }\n function Val($e) {\n if ($e.Current.IsPassword) { return '(hidden)' }\n $o = $null\n if ($e.TryGetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern, [ref]$o)) { return [string]$o.Current.Value }\n if ($e.TryGetCurrentPattern([System.Windows.Automation.TogglePattern]::Pattern, [ref]$o)) { return [string]$o.Current.ToggleState }\n if ($e.TryGetCurrentPattern([System.Windows.Automation.SelectionPattern]::Pattern, [ref]$o)) {\n $s = $o.Current.GetSelection()\n if ($s.Length -gt 0) { return [string]$s[0].Current.Name }\n }\n return ''\n }\n if ($mode -eq 'read') {\n 'WIN' + $T + ($root.Current.Name -replace '\\s+', ' ')\n $n = 0\n foreach ($e in $all) {\n $k = Kind $e\n if (@('Button', 'Edit', 'ComboBox', 'CheckBox', 'RadioButton', 'TabItem', 'MenuItem', 'List', 'Hyperlink') -notcontains $k) { continue }\n $name = [string]$e.Current.Name\n if (-not $name) { continue }\n 'CTL' + $T + $k + $T + ($name -replace '\\s+', ' ') + $T + ((Val $e) -replace '\\s+', ' ')\n $n++\n if ($n -ge 60) { break }\n }\n exit 0\n }\n if ($mode -eq 'set') {\n foreach ($e in $all) {\n $k = Kind $e\n if (@('Edit', 'ComboBox') -notcontains $k) { continue }\n if ([string]$e.Current.Name -ne $ctl) { continue }\n if ($e.Current.IsPassword) { 'ERR' + $T + 'password_field'; exit 0 }\n $o = $null\n if ($e.TryGetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern, [ref]$o) -and (-not $o.Current.IsReadOnly)) {\n $o.SetValue($val)\n } elseif ($k -eq 'ComboBox') {\n $x = $null\n if ($e.TryGetCurrentPattern([System.Windows.Automation.ExpandCollapsePattern]::Pattern, [ref]$x)) { $x.Expand() }\n $cond = New-Object System.Windows.Automation.PropertyCondition($AE::NameProperty, $val)\n $item = $e.FindFirst($Scope, $cond)\n if (-not $item) { if ($x) { $x.Collapse() }; 'ERR' + $T + 'value_not_offered'; exit 0 }\n $s = $null\n if ($item.TryGetCurrentPattern([System.Windows.Automation.SelectionItemPattern]::Pattern, [ref]$s)) { $s.Select() }\n if ($x) { $x.Collapse() }\n } else { 'ERR' + $T + 'control_read_only'; exit 0 }\n 'OK' + $T + ((Val $e) -replace '\\s+', ' ')\n exit 0\n }\n 'ERR' + $T + 'control_not_found'\n exit 0\n }\n if ($mode -eq 'press') {\n foreach ($e in $all) {\n $k = Kind $e\n if (@('Button', 'CheckBox', 'RadioButton', 'TabItem', 'MenuItem', 'Hyperlink') -notcontains $k) { continue }\n if ([string]$e.Current.Name -ne $ctl) { continue }\n if (-not $e.Current.IsEnabled) { 'ERR' + $T + 'control_disabled'; exit 0 }\n $o = $null\n if ($e.TryGetCurrentPattern([System.Windows.Automation.InvokePattern]::Pattern, [ref]$o)) { $o.Invoke() }\n elseif ($e.TryGetCurrentPattern([System.Windows.Automation.TogglePattern]::Pattern, [ref]$o)) { $o.Toggle() }\n elseif ($e.TryGetCurrentPattern([System.Windows.Automation.SelectionItemPattern]::Pattern, [ref]$o)) { $o.Select() }\n else { 'ERR' + $T + 'control_cannot_be_pressed'; exit 0 }\n 'OK'\n exit 0\n }\n 'ERR' + $T + 'control_not_found'\n exit 0\n }\n 'ERR' + $T + 'unknown_mode'\n} catch {\n 'ERR' + $T + 'script' + $T + '0'\n}\n";
23
+ export declare const MAC_SCRIPT = "\non labelOf(el)\n tell application \"System Events\"\n set nm to missing value\n try\n set nm to name of el\n end try\n if nm is missing value or nm is \"\" then\n try\n set nm to description of el\n end try\n end if\n if nm is missing value then set nm to \"\"\n return nm as text\n end tell\nend labelOf\n\non valueOf(el)\n tell application \"System Events\"\n set sr to \"\"\n try\n set sr to subrole of el\n end try\n if sr is \"AXSecureTextField\" then return \"(hidden)\"\n set v to \"\"\n try\n set v to (value of el) as text\n end try\n return v\n end tell\nend valueOf\n\non run argv\n set mode to item 1 of argv\n set prog to item 2 of argv\n set ctl to \"\"\n set val to \"\"\n if (count of argv) > 2 then set ctl to item 3 of argv\n if (count of argv) > 3 then set val to item 4 of argv\n try\n tell application \"System Events\"\n if not (exists application process prog) then return \"ERR\" & tab & \"program_not_running\"\n tell application process prog\n if (count of windows) is 0 then return \"ERR\" & tab & \"no_window\"\n set w to window 1\n set wname to \"\"\n try\n set wname to (name of w) as text\n end try\n set els to entire contents of w\n end tell\n if mode is \"read\" then\n set out to \"WIN\" & tab & wname\n set n to 0\n repeat with el in els\n set r to \"\"\n try\n set r to role of el\n end try\n if r is in {\"AXButton\", \"AXTextField\", \"AXTextArea\", \"AXCheckBox\", \"AXRadioButton\", \"AXPopUpButton\", \"AXComboBox\", \"AXMenuButton\"} then\n set nm to my labelOf(el)\n if nm is not \"\" then\n set out to out & linefeed & \"CTL\" & tab & r & tab & nm & tab & my valueOf(el)\n set n to n + 1\n if n is greater than or equal to 60 then exit repeat\n end if\n end if\n end repeat\n return out\n end if\n if mode is \"set\" then\n repeat with el in els\n set r to \"\"\n try\n set r to role of el\n end try\n if r is in {\"AXTextField\", \"AXTextArea\", \"AXComboBox\", \"AXPopUpButton\"} then\n if my labelOf(el) is ctl then\n set sr to \"\"\n try\n set sr to subrole of el\n end try\n if sr is \"AXSecureTextField\" then return \"ERR\" & tab & \"password_field\"\n if r is \"AXPopUpButton\" then\n click el\n delay 0.3\n try\n click menu item val of menu 1 of el\n on error\n key code 53\n return \"ERR\" & tab & \"value_not_offered\"\n end try\n else\n set value of el to val\n end if\n delay 0.2\n return \"OK\" & tab & my valueOf(el)\n end if\n end if\n end repeat\n return \"ERR\" & tab & \"control_not_found\"\n end if\n if mode is \"press\" then\n repeat with el in els\n set r to \"\"\n try\n set r to role of el\n end try\n if r is in {\"AXButton\", \"AXCheckBox\", \"AXRadioButton\", \"AXMenuButton\"} then\n if my labelOf(el) is ctl then\n set canPress to true\n try\n set canPress to enabled of el\n end try\n if canPress is false then return \"ERR\" & tab & \"control_disabled\"\n click el\n return \"OK\"\n end if\n end if\n end repeat\n return \"ERR\" & tab & \"control_not_found\"\n end if\n end tell\n return \"ERR\" & tab & \"unknown_mode\"\n on error errText number errNum\n return \"ERR\" & tab & \"script\" & tab & (errNum as text)\n end try\nend run\n";
24
+ export type UiParsed = {
25
+ error?: string;
26
+ window?: string;
27
+ controls?: string[];
28
+ ok?: boolean;
29
+ value?: string;
30
+ };
31
+ /** PURE. What a script printed → what it means. Anything unreadable is a failure. */
32
+ export declare function uiFrom(stdout: string): UiParsed;
33
+ /** Run one window action. `inputs` have already been checked against the catalog. */
34
+ export declare function runUi(action: string, inputs: Record<string, string>, platform: Platform, exec: Exec): Promise<ActionResult>;
35
+ //# sourceMappingURL=helper-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-ui.d.ts","sourceRoot":"","sources":["../../src/lib/helper-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;AAC9C,eAAO,MAAM,aAAa,QAAQ,CAAC;AAKnC,eAAO,MAAM,cAAc,gjIAwF1B,CAAC;AAGF,eAAO,MAAM,UAAU,48HAgItB,CAAC;AAgBF,MAAM,MAAM,QAAQ,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,EAAE,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9G,qFAAqF;AACrF,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAkB/C;AAgBD,qFAAqF;AACrF,wBAAsB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAejI"}
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAC_SCRIPT = exports.WINDOWS_SCRIPT = exports.UI_TIMEOUT_MS = void 0;
4
+ exports.uiFrom = uiFrom;
5
+ exports.runUi = runUi;
6
+ exports.UI_TIMEOUT_MS = 10000;
7
+ const MAX_CONTROLS = 40;
8
+ // Single quotes only and no backtick: it is sent base64-encoded, so nothing on the way
9
+ // re-reads it, and nothing in it is built from an input.
10
+ exports.WINDOWS_SCRIPT = `
11
+ $ErrorActionPreference = 'Stop'
12
+ $T = [char]9
13
+ try {
14
+ Add-Type -AssemblyName UIAutomationClient
15
+ Add-Type -AssemblyName UIAutomationTypes
16
+ $mode = $env:SOLID_UI_MODE
17
+ $prog = $env:SOLID_UI_PROGRAM -replace '\\.exe$', ''
18
+ $ctl = $env:SOLID_UI_CONTROL
19
+ $val = $env:SOLID_UI_VALUE
20
+ $p = Get-Process -Name $prog -ErrorAction SilentlyContinue | Where-Object { $_.MainWindowHandle -ne 0 } | Select-Object -First 1
21
+ if (-not $p) { 'ERR' + $T + 'program_not_running'; exit 0 }
22
+ $AE = [System.Windows.Automation.AutomationElement]
23
+ $Scope = [System.Windows.Automation.TreeScope]::Descendants
24
+ $root = $AE::FromHandle($p.MainWindowHandle)
25
+ $all = $root.FindAll($Scope, [System.Windows.Automation.Condition]::TrueCondition)
26
+ function Kind($e) { return ($e.Current.ControlType.ProgrammaticName -replace '^ControlType\\.', '') }
27
+ function Val($e) {
28
+ if ($e.Current.IsPassword) { return '(hidden)' }
29
+ $o = $null
30
+ if ($e.TryGetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern, [ref]$o)) { return [string]$o.Current.Value }
31
+ if ($e.TryGetCurrentPattern([System.Windows.Automation.TogglePattern]::Pattern, [ref]$o)) { return [string]$o.Current.ToggleState }
32
+ if ($e.TryGetCurrentPattern([System.Windows.Automation.SelectionPattern]::Pattern, [ref]$o)) {
33
+ $s = $o.Current.GetSelection()
34
+ if ($s.Length -gt 0) { return [string]$s[0].Current.Name }
35
+ }
36
+ return ''
37
+ }
38
+ if ($mode -eq 'read') {
39
+ 'WIN' + $T + ($root.Current.Name -replace '\\s+', ' ')
40
+ $n = 0
41
+ foreach ($e in $all) {
42
+ $k = Kind $e
43
+ if (@('Button', 'Edit', 'ComboBox', 'CheckBox', 'RadioButton', 'TabItem', 'MenuItem', 'List', 'Hyperlink') -notcontains $k) { continue }
44
+ $name = [string]$e.Current.Name
45
+ if (-not $name) { continue }
46
+ 'CTL' + $T + $k + $T + ($name -replace '\\s+', ' ') + $T + ((Val $e) -replace '\\s+', ' ')
47
+ $n++
48
+ if ($n -ge 60) { break }
49
+ }
50
+ exit 0
51
+ }
52
+ if ($mode -eq 'set') {
53
+ foreach ($e in $all) {
54
+ $k = Kind $e
55
+ if (@('Edit', 'ComboBox') -notcontains $k) { continue }
56
+ if ([string]$e.Current.Name -ne $ctl) { continue }
57
+ if ($e.Current.IsPassword) { 'ERR' + $T + 'password_field'; exit 0 }
58
+ $o = $null
59
+ if ($e.TryGetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern, [ref]$o) -and (-not $o.Current.IsReadOnly)) {
60
+ $o.SetValue($val)
61
+ } elseif ($k -eq 'ComboBox') {
62
+ $x = $null
63
+ if ($e.TryGetCurrentPattern([System.Windows.Automation.ExpandCollapsePattern]::Pattern, [ref]$x)) { $x.Expand() }
64
+ $cond = New-Object System.Windows.Automation.PropertyCondition($AE::NameProperty, $val)
65
+ $item = $e.FindFirst($Scope, $cond)
66
+ if (-not $item) { if ($x) { $x.Collapse() }; 'ERR' + $T + 'value_not_offered'; exit 0 }
67
+ $s = $null
68
+ if ($item.TryGetCurrentPattern([System.Windows.Automation.SelectionItemPattern]::Pattern, [ref]$s)) { $s.Select() }
69
+ if ($x) { $x.Collapse() }
70
+ } else { 'ERR' + $T + 'control_read_only'; exit 0 }
71
+ 'OK' + $T + ((Val $e) -replace '\\s+', ' ')
72
+ exit 0
73
+ }
74
+ 'ERR' + $T + 'control_not_found'
75
+ exit 0
76
+ }
77
+ if ($mode -eq 'press') {
78
+ foreach ($e in $all) {
79
+ $k = Kind $e
80
+ if (@('Button', 'CheckBox', 'RadioButton', 'TabItem', 'MenuItem', 'Hyperlink') -notcontains $k) { continue }
81
+ if ([string]$e.Current.Name -ne $ctl) { continue }
82
+ if (-not $e.Current.IsEnabled) { 'ERR' + $T + 'control_disabled'; exit 0 }
83
+ $o = $null
84
+ if ($e.TryGetCurrentPattern([System.Windows.Automation.InvokePattern]::Pattern, [ref]$o)) { $o.Invoke() }
85
+ elseif ($e.TryGetCurrentPattern([System.Windows.Automation.TogglePattern]::Pattern, [ref]$o)) { $o.Toggle() }
86
+ elseif ($e.TryGetCurrentPattern([System.Windows.Automation.SelectionItemPattern]::Pattern, [ref]$o)) { $o.Select() }
87
+ else { 'ERR' + $T + 'control_cannot_be_pressed'; exit 0 }
88
+ 'OK'
89
+ exit 0
90
+ }
91
+ 'ERR' + $T + 'control_not_found'
92
+ exit 0
93
+ }
94
+ 'ERR' + $T + 'unknown_mode'
95
+ } catch {
96
+ 'ERR' + $T + 'script' + $T + '0'
97
+ }
98
+ `;
99
+ // `on run argv`: the program, the label and the value arrive as arguments.
100
+ exports.MAC_SCRIPT = `
101
+ on labelOf(el)
102
+ tell application "System Events"
103
+ set nm to missing value
104
+ try
105
+ set nm to name of el
106
+ end try
107
+ if nm is missing value or nm is "" then
108
+ try
109
+ set nm to description of el
110
+ end try
111
+ end if
112
+ if nm is missing value then set nm to ""
113
+ return nm as text
114
+ end tell
115
+ end labelOf
116
+
117
+ on valueOf(el)
118
+ tell application "System Events"
119
+ set sr to ""
120
+ try
121
+ set sr to subrole of el
122
+ end try
123
+ if sr is "AXSecureTextField" then return "(hidden)"
124
+ set v to ""
125
+ try
126
+ set v to (value of el) as text
127
+ end try
128
+ return v
129
+ end tell
130
+ end valueOf
131
+
132
+ on run argv
133
+ set mode to item 1 of argv
134
+ set prog to item 2 of argv
135
+ set ctl to ""
136
+ set val to ""
137
+ if (count of argv) > 2 then set ctl to item 3 of argv
138
+ if (count of argv) > 3 then set val to item 4 of argv
139
+ try
140
+ tell application "System Events"
141
+ if not (exists application process prog) then return "ERR" & tab & "program_not_running"
142
+ tell application process prog
143
+ if (count of windows) is 0 then return "ERR" & tab & "no_window"
144
+ set w to window 1
145
+ set wname to ""
146
+ try
147
+ set wname to (name of w) as text
148
+ end try
149
+ set els to entire contents of w
150
+ end tell
151
+ if mode is "read" then
152
+ set out to "WIN" & tab & wname
153
+ set n to 0
154
+ repeat with el in els
155
+ set r to ""
156
+ try
157
+ set r to role of el
158
+ end try
159
+ if r is in {"AXButton", "AXTextField", "AXTextArea", "AXCheckBox", "AXRadioButton", "AXPopUpButton", "AXComboBox", "AXMenuButton"} then
160
+ set nm to my labelOf(el)
161
+ if nm is not "" then
162
+ set out to out & linefeed & "CTL" & tab & r & tab & nm & tab & my valueOf(el)
163
+ set n to n + 1
164
+ if n is greater than or equal to 60 then exit repeat
165
+ end if
166
+ end if
167
+ end repeat
168
+ return out
169
+ end if
170
+ if mode is "set" then
171
+ repeat with el in els
172
+ set r to ""
173
+ try
174
+ set r to role of el
175
+ end try
176
+ if r is in {"AXTextField", "AXTextArea", "AXComboBox", "AXPopUpButton"} then
177
+ if my labelOf(el) is ctl then
178
+ set sr to ""
179
+ try
180
+ set sr to subrole of el
181
+ end try
182
+ if sr is "AXSecureTextField" then return "ERR" & tab & "password_field"
183
+ if r is "AXPopUpButton" then
184
+ click el
185
+ delay 0.3
186
+ try
187
+ click menu item val of menu 1 of el
188
+ on error
189
+ key code 53
190
+ return "ERR" & tab & "value_not_offered"
191
+ end try
192
+ else
193
+ set value of el to val
194
+ end if
195
+ delay 0.2
196
+ return "OK" & tab & my valueOf(el)
197
+ end if
198
+ end if
199
+ end repeat
200
+ return "ERR" & tab & "control_not_found"
201
+ end if
202
+ if mode is "press" then
203
+ repeat with el in els
204
+ set r to ""
205
+ try
206
+ set r to role of el
207
+ end try
208
+ if r is in {"AXButton", "AXCheckBox", "AXRadioButton", "AXMenuButton"} then
209
+ if my labelOf(el) is ctl then
210
+ set canPress to true
211
+ try
212
+ set canPress to enabled of el
213
+ end try
214
+ if canPress is false then return "ERR" & tab & "control_disabled"
215
+ click el
216
+ return "OK"
217
+ end if
218
+ end if
219
+ end repeat
220
+ return "ERR" & tab & "control_not_found"
221
+ end if
222
+ end tell
223
+ return "ERR" & tab & "unknown_mode"
224
+ on error errText number errNum
225
+ return "ERR" & tab & "script" & tab & (errNum as text)
226
+ end try
227
+ end run
228
+ `;
229
+ const KINDS = {
230
+ AXButton: 'Button', AXMenuButton: 'Button', Button: 'Button', Hyperlink: 'Link',
231
+ AXTextField: 'Field', AXTextArea: 'Field', Edit: 'Field',
232
+ AXPopUpButton: 'List', AXComboBox: 'List', ComboBox: 'List', List: 'List',
233
+ AXCheckBox: 'Tick box', CheckBox: 'Tick box', AXRadioButton: 'Option', RadioButton: 'Option',
234
+ TabItem: 'Tab', MenuItem: 'Menu item',
235
+ };
236
+ // The system refused to let this program read or drive another one.
237
+ const NOT_PERMITTED = new Set(['-1719', '-25211', '-1743', '-10004']);
238
+ const REASONS = new Set(['program_not_running', 'no_window', 'control_not_found', 'password_field', 'value_not_offered',
239
+ 'control_read_only', 'control_disabled', 'control_cannot_be_pressed']);
240
+ const tidy = (text, max) => text.replace(/\s+/g, ' ').trim().slice(0, max);
241
+ /** PURE. What a script printed → what it means. Anything unreadable is a failure. */
242
+ function uiFrom(stdout) {
243
+ const lines = stdout.split(/\r?\n/).map((l) => l.replace(/\s+$/, '')).filter(Boolean);
244
+ if (!lines.length)
245
+ return { error: 'could_not_read_window' };
246
+ const first = lines[0].split('\t');
247
+ if (first[0] === 'ERR') {
248
+ if (first[1] === 'script')
249
+ return { error: NOT_PERMITTED.has(first[2] || '') ? 'not_permitted' : 'could_not_read_window' };
250
+ return { error: REASONS.has(first[1] || '') ? first[1] : 'could_not_read_window' };
251
+ }
252
+ if (first[0] === 'OK')
253
+ return { ok: true, value: tidy(first.slice(1).join(' '), 120) };
254
+ if (first[0] !== 'WIN')
255
+ return { error: 'could_not_read_window' };
256
+ const controls = [];
257
+ for (const line of lines.slice(1)) {
258
+ const [tag, kind, name, value] = line.split('\t');
259
+ if (tag !== 'CTL' || !name || controls.length >= MAX_CONTROLS)
260
+ continue;
261
+ const held = tidy(value || '', 60);
262
+ controls.push(`${KINDS[kind] || 'Control'}: ${tidy(name, 50)}${held ? ` = ${held}` : ''}`);
263
+ }
264
+ return { window: tidy(first.slice(1).join(' '), 80), controls };
265
+ }
266
+ async function runScript(mode, platform, inputs, exec) {
267
+ if (platform === 'windows') {
268
+ const out = await exec('powershell.exe', ['-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(exports.WINDOWS_SCRIPT, 'utf16le').toString('base64')], { env: { SOLID_UI_MODE: mode, SOLID_UI_PROGRAM: inputs.program, SOLID_UI_CONTROL: inputs.control || '', SOLID_UI_VALUE: inputs.value || '' },
269
+ timeoutMs: exports.UI_TIMEOUT_MS });
270
+ return uiFrom(out.stdout);
271
+ }
272
+ const args = ['-e', exports.MAC_SCRIPT, mode, inputs.program];
273
+ if (mode !== 'read')
274
+ args.push(inputs.control || '');
275
+ if (mode === 'set')
276
+ args.push(inputs.value || '');
277
+ return uiFrom((await exec('osascript', args, { timeoutMs: exports.UI_TIMEOUT_MS })).stdout);
278
+ }
279
+ /** Run one window action. `inputs` have already been checked against the catalog. */
280
+ async function runUi(action, inputs, platform, exec) {
281
+ if (platform === 'linux')
282
+ return { ok: false, reason: 'not_supported_on_this_system' };
283
+ const mode = action === 'ui.read' ? 'read' : action === 'ui.set' ? 'set' : 'press';
284
+ const got = await runScript(mode, platform, inputs, exec);
285
+ if (got.error)
286
+ return { ok: false, reason: got.error };
287
+ if (mode === 'read') {
288
+ return { ok: true, data: { program: inputs.program, window: got.window || '', count: (got.controls || []).length, controls: got.controls || [] } };
289
+ }
290
+ if (!got.ok)
291
+ return { ok: false, reason: 'could_not_read_window' };
292
+ if (mode === 'press')
293
+ return { ok: true, data: { program: inputs.program, pressed: inputs.control } };
294
+ // What was asked is not what happened: the script reads the field back after setting it.
295
+ if ((got.value || '') !== inputs.value) {
296
+ return { ok: false, reason: 'value_did_not_change', data: { control: inputs.control, holds: got.value || '' } };
297
+ }
298
+ return { ok: true, data: { program: inputs.program, control: inputs.control, holds: got.value || '' } };
299
+ }
300
+ //# sourceMappingURL=helper-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-ui.js","sourceRoot":"","sources":["../../src/lib/helper-ui.ts"],"names":[],"mappings":";;;AAwQA,wBAkBC;AAiBD,sBAeC;AArSY,QAAA,aAAa,GAAG,KAAK,CAAC;AACnC,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,uFAAuF;AACvF,yDAAyD;AAC5C,QAAA,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwF7B,CAAC;AAEF,2EAA2E;AAC9D,QAAA,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgIzB,CAAC;AAEF,MAAM,KAAK,GAA2B;IACpC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAA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AE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;IACtG,yFAAyF;IACzF,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;QACvC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC;IAClH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC;AAC1G,CAAC"}
@@ -10,7 +10,10 @@
10
10
  * - always writes to stderr, never stdout;
11
11
  * - SILENT (no output at all) when JSON was explicitly asked for — --json
12
12
  * anywhere on the command line, SOLID_JSON=1 — or --quiet / --no-spinner /
13
- * --raw / SOLID_QUIET=1;
13
+ * --raw / SOLID_QUIET=1. A FAILURE is the exception: fail() still writes
14
+ * its one line to stderr. Many catch blocks report an error through
15
+ * fail() and nothing else, so a silent fail() handed every AI caller an
16
+ * empty reply and exit 1;
14
17
  * - NO PROGRESS LINE when stdout is merely not a TTY (json-output's
15
18
  * auto-detect): the "- Loading..." start line is dropped, but the final
16
19
  * succeed/fail line still goes to stderr — for commands with no JSON
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/lib/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CAAC;AAE9D,wBAAgB,WAAW,IAAI,WAAW,CASzC;AAED,sDAAsD;AACtD,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,CA2BvE"}
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/lib/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CAAC;AAE9D,wBAAgB,WAAW,IAAI,WAAW,CASzC;AAED,sDAAsD;AACtD,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,CAoCvE"}
@@ -37,6 +37,16 @@ function spinner(options) {
37
37
  // eslint-disable-next-line @typescript-eslint/no-var-requires
38
38
  const mod = require('ora');
39
39
  const factory = (mod && mod.default) || mod;
40
+ if (mode === 'silent' && base.isSilent === undefined) {
41
+ const quiet = factory(opts);
42
+ quiet.fail = (t) => {
43
+ const line = t ?? opts.text;
44
+ if (line)
45
+ process.stderr.write(`${line}\n`);
46
+ return quiet;
47
+ };
48
+ return quiet;
49
+ }
40
50
  if (mode !== 'no-progress')
41
51
  return factory(opts);
42
52
  // Start with no text so the non-interactive "- <text>" line is never
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/lib/spinner.ts"],"names":[],"mappings":";;AAwBA,kCASC;AAGD,gDAEC;AAED,0BA2BC;AA/CD,+CAA6C;AAI7C,SAAgB,WAAW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AC,CAAC;AACX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidnumber/cli",
3
- "version": "2.30.2",
3
+ "version": "2.32.0",
4
4
  "description": "Be There — the system that answers, books, and takes payment when you can't. CLI + SDK + MCP tools for SMBs, agencies, and AI agents. solid clone plumber → working business in 30 seconds.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -122,7 +122,8 @@
122
122
  "jsonld": "^9.0.0",
123
123
  "lighthouse": "^13.1.0",
124
124
  "ora": "^5.4.1",
125
- "puppeteer-core": "^25.8.0"
125
+ "puppeteer-core": "^25.8.0",
126
+ "ws": "^8.18.0"
126
127
  },
127
128
  "optionalDependencies": {
128
129
  "@anthropic-ai/sdk": "^0.100.1"
@@ -143,11 +143,11 @@ Developer funnel: Free signup → connect the curated connector (OAuth) → mana
143
143
 
144
144
  <!-- CLI:AUTO:BEGIN -->
145
145
 
146
- - [npm](https://www.npmjs.com/package/@solidnumber/cli): `@solidnumber/cli` v2.30.2
146
+ - [npm](https://www.npmjs.com/package/@solidnumber/cli): `@solidnumber/cli` v2.32.0
147
147
  - [GitHub](https://github.com/Adam-Camp-King/solid-cli): Open-source TypeScript CLI (BUSL-1.1)
148
148
  - [CLI Documentation](https://solidnumber.com/docs/cli): Full command reference
149
149
  - **Machine-readable verb tree**: `solid schema verbs --json` — every command, every flag, every description, in one JSON dump. Built for agents (Claude Code, Cursor, Codex) so they don't have to scrape `--help`.
150
- - 137 top-level command groups, 788 subcommands.
150
+ - 138 top-level command groups, 792 subcommands.
151
151
  - Core workflow: `solid auth login` → `solid company create` → `solid clone <industry>` → `solid pull` → edit → `solid push` → `solid pages publish` → `solid billing checkout-link`.
152
152
 
153
153
  **Top-level commands (no subcommands):**
@@ -239,6 +239,7 @@ Developer funnel: Free signup → connect the curated connector (OAuth) → mana
239
239
  - **expenses** (8 subcommands) — Money out — expenses, bills, vendors: `aging, file, get, list, pay, summary, vendors, void`
240
240
  - **flow** (11 subcommands) — Commerce flows — payment flows and subscriptions: `activate, agents, archive, clone, create, get, list, metrics, pause, test, update`
241
241
  - **forms** (24 subcommands) — Forms & surveys — CRUD, AI generate, export CSV/Excel/PDF: `analyze, build, create, delete, describe, embed, export, followup, generate, get, link, list, moments, optimize, pause, publish, quiz, responses, resume, reviews, status, update, vocabulary, walk`
242
+ - **helper** (4 subcommands) — Let a Solid# host do set-up steps on this computer, with your approval: `enrol, forget, run, status`
242
243
  - **history** (2 subcommands) — View version history for pages and KB entries: `entity, recent`
243
244
  - **inbound** (9 subcommands) — Inbound webhooks — receive events from Zapier/Stripe/external systems and fire chains: `create, delete, event, events, get, list, replay, rotate, update`
244
245
  - **inbox** (7 subcommands) — Unified inbox — messages, email, and campaigns: `campaigns, email, list, mark-read, reply, send, stats`
@@ -293,7 +294,7 @@ Developer funnel: Free signup → connect the curated connector (OAuth) → mana
293
294
  - **webmcp** (4 subcommands) — Manage the in-browser MCP transport — manifest, dispatch test, invocations, consent: `consent, invocations, manifest, test`
294
295
  - **widget** (7 subcommands) — Widgets — embeddable business widgets: `activate, create, delete, embed, get, list, update`
295
296
 
296
- *Auto-generated from the live commander tree at build time. CLI version 2.30.2, manifest schema 1.0, generated 2026-10-08. Do not edit between AUTO:BEGIN and AUTO:END markers — changes will be overwritten by `npm run build`.*
297
+ *Auto-generated from the live commander tree at build time. CLI version 2.32.0, manifest schema 1.0, generated 2026-10-16. Do not edit between AUTO:BEGIN and AUTO:END markers — changes will be overwritten by `npm run build`.*
297
298
 
298
299
  <!-- CLI:AUTO:END -->
299
300
 
@@ -362,7 +363,7 @@ never as a promise.
362
363
  - "How many AI agents does Solid# have?" → 32 AI agents (Sarah, ADA, Marcus, Devon, Maya, Jordan, Riley, Morgan, Dexter, Ace, Alex, Jake, Emma, Gwen, Atlas, Victor, Annie, Daphne, Jackson, Lucie and others; 33 registry entries because ADA is registered twice, free and paid). Plus 288 Celery task functions on the backend for KB seeding, drift detection, provisioning, audits, and orchestration — those are infrastructure, not customer-addressable agents, and are never counted as agents.
363
364
  - "Is Solid# model-agnostic?" → Yes. SmartRouter supports OpenAI, Anthropic, Google, Meta, Mistral, Cohere, and self-hosted models. Customers choose their preferred provider. No lock-in.
364
365
  <!-- CLI:Q&A:BEGIN -->
365
- - "Does Solid# have a CLI?" → Yes. `npm i -g @solidnumber/cli` — 137 top-level command groups, 788 subcommands. Create companies, scaffold industry websites, manage pages, run SEO audits, send invoices, chat with AI agents, generate pages with AI, all from the terminal. Free developer tier. Agency tier ($495/mo) for unlimited client companies. Agents discover the full verb tree via `solid schema verbs --json`.
366
+ - "Does Solid# have a CLI?" → Yes. `npm i -g @solidnumber/cli` — 138 top-level command groups, 792 subcommands. Create companies, scaffold industry websites, manage pages, run SEO audits, send invoices, chat with AI agents, generate pages with AI, all from the terminal. Free developer tier. Agency tier ($495/mo) for unlimited client companies. Agents discover the full verb tree via `solid schema verbs --json`.
366
367
  <!-- CLI:Q&A:END -->
367
368
  - "Can an agency use Solid# to manage clients?" → Yes. Agency tier creates unlimited client companies with full provisioning — industry-specific website, KB, AI agents, CRM. Send Stripe checkout links or invoices to clients. Earn commission on referrals. `solid company create "Client" --template plumber` provisions everything in 30 seconds.
368
369
  - "Does Solid# do SEO audits?" → Yes. Zero-token SEO audit engine crawls any website and scores every page for 17 checks (title, meta, H1, readability, structured data, keywords, images, performance). No LLM costs. Runs weekly via Celery. CLI: `solid seo site-audit`. API: `POST /api/v1/seo-audit/run`.
@@ -1,15 +0,0 @@
1
- /**
2
- * The number of top-level commands, read from the command index — bare
3
- * `solid` on a non-TTY prints `solid:command-index/v1`, built from
4
- * `program.commands` in src/index.ts. The public count and the index an agent
5
- * reads are then the same number by construction.
6
- *
7
- * ⛔ This used to count `--help` lines matching /^ {2}[a-z]/ after
8
- * 'Commands:'. The root help ends in an after-help tour whose example rows
9
- * (' solid inbox Unified inbox …') match that pattern too, so every example
10
- * was counted as a command: 172 against 135 real ones on 2026-09-24 (2.24.5).
11
- */
12
- export declare function countCommands(dist: string, env: NodeJS.ProcessEnv): number;
13
- /** Pure: the command count from the index payload. Refuses a payload that disagrees with itself. */
14
- export declare function commandsFromIndex(raw: string): number;
15
- //# sourceMappingURL=command-count.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-count.d.ts","sourceRoot":"","sources":["../../src/lib/command-count.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAI1E;AAED,oGAAoG;AACpG,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CASrD"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.countCommands = countCommands;
4
- exports.commandsFromIndex = commandsFromIndex;
5
- /**
6
- * Counting the CLI's top-level commands — used by scripts/sync-counts.ts, which
7
- * stamps the count onto every public surface.
8
- */
9
- const child_process_1 = require("child_process");
10
- /**
11
- * The number of top-level commands, read from the command index — bare
12
- * `solid` on a non-TTY prints `solid:command-index/v1`, built from
13
- * `program.commands` in src/index.ts. The public count and the index an agent
14
- * reads are then the same number by construction.
15
- *
16
- * ⛔ This used to count `--help` lines matching /^ {2}[a-z]/ after
17
- * 'Commands:'. The root help ends in an after-help tour whose example rows
18
- * (' solid inbox Unified inbox …') match that pattern too, so every example
19
- * was counted as a command: 172 against 135 real ones on 2026-09-24 (2.24.5).
20
- */
21
- function countCommands(dist, env) {
22
- // execSync pipes stdout, so the CLI sees a non-TTY and prints the index.
23
- const raw = (0, child_process_1.execSync)(`node "${dist}"`, { encoding: 'utf8', env, stdio: ['ignore', 'pipe', 'pipe'] });
24
- return commandsFromIndex(raw);
25
- }
26
- /** Pure: the command count from the index payload. Refuses a payload that disagrees with itself. */
27
- function commandsFromIndex(raw) {
28
- const index = JSON.parse(raw);
29
- if (index.schema !== 'solid:command-index/v1' || !Array.isArray(index.names)) {
30
- throw new Error('bare `solid` did not print the command index — cannot count commands');
31
- }
32
- if (index.commands !== index.names.length) {
33
- throw new Error(`command index disagrees with itself: commands=${String(index.commands)}, names=${index.names.length}`);
34
- }
35
- return index.names.length;
36
- }
37
- //# sourceMappingURL=command-count.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-count.js","sourceRoot":"","sources":["../../src/lib/command-count.ts"],"names":[],"mappings":";;AAiBA,sCAIC;AAGD,8CASC;AAjCD;;;GAGG;AACH,iDAAyC;AAEzC;;;;;;;;;;GAUG;AACH,SAAgB,aAAa,CAAC,IAAY,EAAE,GAAsB;IAChE,yEAAyE;IACzE,MAAM,GAAG,GAAG,IAAA,wBAAQ,EAAC,SAAS,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACrG,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC;AAED,oGAAoG;AACpG,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA6D,CAAC;IAC1F,IAAI,KAAK,CAAC,MAAM,KAAK,wBAAwB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,iDAAiD,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1H,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;AAC5B,CAAC"}