@aopslabs/aops 0.2.0 → 0.3.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.
- package/README.md +29 -23
- package/assets/agent-assets/core/references/aops-cli-core/SKILL.md +9 -7
- package/assets/agent-assets/core/references/chatv3/SKILL.md +2 -1
- package/assets/agent-assets/core/user-guides/aops-cli.md +15 -16
- package/assets/skills/aops-install/SKILL.md +24 -23
- package/dist/commands/agent.js +1 -5
- package/dist/commands/api.js +1 -5
- package/dist/commands/assets.js +2 -134
- package/dist/commands/community-auth.js +1 -1
- package/dist/commands/community-setup.js +91 -68
- package/dist/commands/init.js +5 -17
- package/dist/commands/start.js +5 -76
- package/dist/lib/community-setup-server-env.js +2 -28
- package/dist/lib/setup-docker-server.js +666 -0
- package/dist/lib/setup-init-orchestrator.js +14 -267
- package/dist/lib/setup-install-guide.js +1 -1
- package/dist/lib/tui-launcher.js +0 -4
- package/dist/main.js +0 -2
- package/native/tui/win32-x64/aops-tui.exe +0 -0
- package/package.json +4 -4
- package/dist/commands/community-console.js +0 -109
- package/dist/utils/prompts.js +0 -70
package/README.md
CHANGED
|
@@ -6,8 +6,9 @@ Server.
|
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
npm install --global @aopslabs/aops
|
|
9
|
+
aops
|
|
9
10
|
aops --help
|
|
10
|
-
aops setup
|
|
11
|
+
aops setup --help
|
|
11
12
|
aops setup ai
|
|
12
13
|
aops setup guide
|
|
13
14
|
aops setup init
|
|
@@ -36,14 +37,19 @@ hosts. Explicit `aops server ...` commands operate the API on port `5900`,
|
|
|
36
37
|
while `aops cockpit start|stop|restart|status|health|logs` independently
|
|
37
38
|
operates Cockpit on port `5922`.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
On Windows x64, parameterless `aops` opens the bundled Rust TUI. This release
|
|
41
|
+
does not include native TUI payloads for macOS or Linux; use explicit CLI
|
|
42
|
+
commands such as `aops setup init`, `aops server status`, or `aops --help` there.
|
|
43
|
+
Explicit commands retain the same CLI behavior on every supported platform.
|
|
41
44
|
When stdin or stdout is not an interactive terminal, parameterless `aops`
|
|
42
45
|
prints short CLI guidance instead of trying to draw the TUI.
|
|
43
|
-
`aops setup`
|
|
44
|
-
|
|
46
|
+
`aops setup` prints its subcommand help instead of opening a second interactive
|
|
47
|
+
menu. The Rust TUI owns the operator setup experience, while explicit setup
|
|
48
|
+
subcommands remain stable engines for the TUI, agents, and automation.
|
|
49
|
+
`aops setup ai` prints a safe prompt that can be handed to Codex, Claude, or another terminal AI agent.
|
|
45
50
|
The prompt routes the agent to the packaged `aops-install` skill and keeps
|
|
46
|
-
secrets in
|
|
51
|
+
secrets in documented environment variables or private files instead of chat
|
|
52
|
+
or argv.
|
|
47
53
|
|
|
48
54
|
The default `trusted-local` server remains bound only to
|
|
49
55
|
`127.0.0.1:5900`. It does not trust LAN or Tailscale interfaces. AOPS Server
|
|
@@ -85,19 +91,18 @@ role export; every migrated user must authenticate again through South.
|
|
|
85
91
|
`aops auth logout --target remote --local-only` deliberately clears only the
|
|
86
92
|
local encrypted credentials when remote revocation is unavailable.
|
|
87
93
|
|
|
88
|
-
`aops setup init` is the
|
|
89
|
-
|
|
90
|
-
or a dedicated AOPS role/database
|
|
94
|
+
`aops setup init` is the argument-driven cross-platform setup engine used by the
|
|
95
|
+
TUI and automation. An explicit path selects an existing PostgreSQL connection,
|
|
96
|
+
an automatic Docker PostgreSQL 17 container, or a dedicated AOPS role/database
|
|
97
|
+
created in PostgreSQL installed on this computer,
|
|
91
98
|
uses the standard `default` instance with server port `5900` and Cockpit port
|
|
92
99
|
`5922`, installs all registered
|
|
93
100
|
runtime pointers, reconciles the bundled signed official catalog without
|
|
94
101
|
activating its skills, and leaves starter/demo user data untouched. Setup may
|
|
95
102
|
reconcile only the catalog's required internal state. Managed PostgreSQL uses a
|
|
96
|
-
generated strong password by default
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
animated progress and `--json` remains machine-clean. Interactive setup applies
|
|
100
|
-
the chosen path immediately after collecting its required private inputs; the
|
|
103
|
+
generated strong password by default. All database paths verify migrations
|
|
104
|
+
before readiness and `--json` remains machine-clean. Setup applies only with an
|
|
105
|
+
explicit path and `--apply --yes`; the
|
|
101
106
|
verified global AOPS core/runtime gateways are automatic and have no extra
|
|
102
107
|
selection or confirmation questions. Signed collaboration
|
|
103
108
|
and working-discipline packages are imported as discoverable catalog choices,
|
|
@@ -137,11 +142,13 @@ aops setup init --path 4 \
|
|
|
137
142
|
```
|
|
138
143
|
|
|
139
144
|
Setup path 3 probes loopback PostgreSQL without relying on `psql` being on
|
|
140
|
-
`PATH
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
`PATH`. The Rust TUI collects the administrator role/password for operator-led
|
|
146
|
+
setup; direct CLI automation must provide the role explicitly and pass the
|
|
147
|
+
password through `AOPS_LOCAL_POSTGRES_ADMIN_PASSWORD`. The administrator
|
|
148
|
+
password is transient; AOPS stores only its generated application connection in
|
|
149
|
+
the private user server-env. If PostgreSQL is absent or stopped, readiness
|
|
150
|
+
returns platform-specific Windows, macOS, or Linux install/start guidance
|
|
151
|
+
instead of silently invoking an elevated package manager.
|
|
145
152
|
|
|
146
153
|
The existing-PostgreSQL path supports managed providers such as Supabase and
|
|
147
154
|
Neon. Readiness compares only the migration-derived AOPS-owned table, column,
|
|
@@ -168,11 +175,10 @@ same setup command without reset or duplicate rollback copies; same-root npm
|
|
|
168
175
|
byte drift still requires reinstalling the package.
|
|
169
176
|
|
|
170
177
|
`aops setup guide` prints the packaged agent-readable installation skill before
|
|
171
|
-
the server is initialized. `aops assets`
|
|
172
|
-
|
|
178
|
+
the server is initialized. `aops assets` prints its explicit subcommand catalog.
|
|
179
|
+
Those commands install or update the verified AOPS Gateway skill, repair global pointers, report
|
|
173
180
|
status, and can safely remove recognized pointers while retaining the local
|
|
174
|
-
verified core.
|
|
175
|
-
an explicit path with `--apply --yes`.
|
|
181
|
+
verified core. Setup uses an explicit path with `--apply --yes`.
|
|
176
182
|
The official npm package supplies an independently signed
|
|
177
183
|
Gateway/client-core closure and inert official catalog snapshot, so normal
|
|
178
184
|
installation does not depend on an application-image release or ask for a
|
|
@@ -21,12 +21,14 @@ aops server health --json
|
|
|
21
21
|
aops cockpit
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
`aops
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
Parameterless `aops` opens the Rust TUI for operator-led first-run choices.
|
|
25
|
+
`aops setup init` is its argument-driven engine for an existing PostgreSQL,
|
|
26
|
+
AOPS-managed PostgreSQL container, detected local PostgreSQL, or a remote AOPS
|
|
27
|
+
server. Local server paths plan/apply/verify migrations, start the npm server,
|
|
28
|
+
leave starter/demo user data untouched, and install verified agent assets. The
|
|
29
|
+
CLI never opens a menu or asks a question. Database secrets belong only in TUI
|
|
30
|
+
private fields or private input files/environment; never paste them into chat
|
|
31
|
+
or argv.
|
|
30
32
|
|
|
31
33
|
For an unattended run, inspect readiness before apply:
|
|
32
34
|
|
|
@@ -98,7 +100,7 @@ validation error and inspect full schema/OpenAPI.
|
|
|
98
100
|
## Guard contract
|
|
99
101
|
|
|
100
102
|
- `--json`: stable automation output.
|
|
101
|
-
- `--yes`:
|
|
103
|
+
- `--yes`: compatibility/fail-fast behavior; never implies mutation approval.
|
|
102
104
|
- `--preview`: validate/plan without applying when supported.
|
|
103
105
|
- `--apply`: execute a guarded write.
|
|
104
106
|
- `--confirm`: acknowledge destructive scope.
|
|
@@ -34,7 +34,8 @@ aops agent schema --tool chatv3.channel.list --summary --json
|
|
|
34
34
|
|
|
35
35
|
ChatV3 may keep invite, member-token, and room-key context in a private local
|
|
36
36
|
session store. Never paste those values into chat, logs, source files, or raw
|
|
37
|
-
shell history. Use
|
|
37
|
+
shell history. Use supported secure-store, input-file, or environment
|
|
38
|
+
mechanisms; the CLI does not collect secrets through terminal prompts.
|
|
38
39
|
|
|
39
40
|
For a write not exposed by sugar, inspect the exact live schema before invoke:
|
|
40
41
|
|
|
@@ -8,12 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
## 2 En kisa kurulum akisi
|
|
10
10
|
|
|
11
|
-
### 2.1
|
|
11
|
+
### 2.1 TUI-guided npm installation
|
|
12
12
|
|
|
13
13
|
#### 2.1.1 Overview
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
aops setup init
|
|
17
16
|
aops
|
|
18
17
|
aops server status --json
|
|
19
18
|
aops host health
|
|
@@ -24,7 +23,8 @@ AOPS-owned PostgreSQL container, create a dedicated AOPS role/database in a
|
|
|
24
23
|
supported local PostgreSQL, or configure this CLI for an existing AOPS Server
|
|
25
24
|
through path `4`. Local-server paths verify migrations and start the npm
|
|
26
25
|
server. Path `4` does not install or operate local PostgreSQL or server
|
|
27
|
-
processes. Use
|
|
26
|
+
processes. Use the Rust TUI private fields for operator-led setup, or documented
|
|
27
|
+
private environment/configuration inputs for direct CLI automation.
|
|
28
28
|
|
|
29
29
|
Parameterless `aops` opens the bundled Rust TUI without changing either
|
|
30
30
|
service. Argument-bearing invocations retain the existing CLI behavior. AOPS
|
|
@@ -39,7 +39,7 @@ closing that terminal stops the foreground server. The matching
|
|
|
39
39
|
background mode. These scripts accept `--instance` and `--data-root`, not
|
|
40
40
|
database credentials.
|
|
41
41
|
|
|
42
|
-
### 2.2
|
|
42
|
+
### 2.2 Browser-approved auth
|
|
43
43
|
|
|
44
44
|
#### 2.2.1 Overview
|
|
45
45
|
|
|
@@ -99,9 +99,10 @@ aops target use remote --apply
|
|
|
99
99
|
### 4.1 Overview
|
|
100
100
|
|
|
101
101
|
`aops setup server-env` owns the private PostgreSQL connection used by local
|
|
102
|
-
server paths.
|
|
103
|
-
|
|
104
|
-
URL or password in argv,
|
|
102
|
+
server paths. The TUI may pass the URL through a private child-process
|
|
103
|
+
environment. Direct CLI automation must use `AOPS_PG_URL` or an existing
|
|
104
|
+
owner-only environment file; never put a PostgreSQL URL or password in argv,
|
|
105
|
+
chat, or committed files.
|
|
105
106
|
|
|
106
107
|
The default provider is `trusted-local`. Before an explicit non-loopback host,
|
|
107
108
|
generate the complete AuthV2 runtime closure in the same owner-only file:
|
|
@@ -119,11 +120,9 @@ provider and secrets when rerun without `--auth`.
|
|
|
119
120
|
### 5.1 Overview
|
|
120
121
|
|
|
121
122
|
Use `aops setup first-admin --target <target-name>` only while AuthV2 reports
|
|
122
|
-
that no first admin exists.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
`AOPS_ADMIN_KEY` in its private process environment. Secret command arguments
|
|
126
|
-
are refused.
|
|
123
|
+
that no first admin exists. The TUI owns operator input. Direct CLI automation
|
|
124
|
+
may use `AOPS_AUTH_EMAIL`, `AOPS_AUTH_PASSWORD`, and `AOPS_ADMIN_KEY` in its
|
|
125
|
+
private process environment. Secret command arguments are refused.
|
|
127
126
|
|
|
128
127
|
## 6 User yonetimi
|
|
129
128
|
|
|
@@ -148,8 +147,8 @@ Login stores encrypted credentials bound to the selected target endpoint.
|
|
|
148
147
|
Normal logout revokes the remote session before clearing the local copy. If the
|
|
149
148
|
server is unavailable and the explicit intent is local cleanup, use
|
|
150
149
|
`aops auth logout --target remote --local-only`. Passwords and tokens belong
|
|
151
|
-
only in
|
|
152
|
-
argv.
|
|
150
|
+
only in TUI private fields, secure stores, browser-approved flows, or documented
|
|
151
|
+
private environment variables, never argv.
|
|
153
152
|
|
|
154
153
|
## 8 Diagnostik
|
|
155
154
|
|
|
@@ -791,7 +790,7 @@ Retrieval notes:
|
|
|
791
790
|
High-signal operator notes:
|
|
792
791
|
|
|
793
792
|
1. First cold hosted calls can take around 20 seconds; use `--timeout-ms 120000` for schema, doc, skill, or file smoke commands.
|
|
794
|
-
2. `--yes`
|
|
793
|
+
2. `--yes` is a compatibility/fail-fast flag. The CLI never prompts, and the flag is not a magic fix for validation errors.
|
|
795
794
|
3. In PowerShell, quote file pointers for multiline or quote-heavy content: `--content '@file'` or `--input '@file.json'`.
|
|
796
795
|
4. If sugar returns validation errors, stop retrying guessed flags. Read `<command> --help`; for raw invokes, read `agent schema`.
|
|
797
796
|
5. If command help and skill text disagree, command help wins.
|
|
@@ -876,7 +875,7 @@ Guard flags are consistent across AOPS sugar:
|
|
|
876
875
|
| `--confirm` | Confirm destructive actions such as delete, restore overwrite, cleanup, or reset. |
|
|
877
876
|
| `--idempotency-key <key>` | Make write retries deterministic when the command supports it. |
|
|
878
877
|
| `--json` | Return scriptable structured output. |
|
|
879
|
-
| `--yes` |
|
|
878
|
+
| `--yes` | Compatibility/fail-fast mode; missing required choices remain errors. |
|
|
880
879
|
|
|
881
880
|
Read commands need no guard. Normal writes require `--apply`. Destructive writes require `--apply --confirm`. `--preview` without `--apply` should not mutate; if a command mutates during preview, file an issue.
|
|
882
881
|
|
|
@@ -27,7 +27,8 @@ detail is needed.
|
|
|
27
27
|
|
|
28
28
|
Never place any PostgreSQL URL, application password, path 3 administrator
|
|
29
29
|
password, AuthV2 password, admin key, or token in argv, logs, committed files,
|
|
30
|
-
or chat. Use AOPS
|
|
30
|
+
or chat. Use the AOPS TUI private fields or the documented private process
|
|
31
|
+
environment/configuration files.
|
|
31
32
|
|
|
32
33
|
## Route by need
|
|
33
34
|
|
|
@@ -35,7 +36,8 @@ or chat. Use AOPS masked prompts or the documented private process environment.
|
|
|
35
36
|
| --- | --- |
|
|
36
37
|
| inspect choices and readiness | `aops setup init --yes --json` |
|
|
37
38
|
| give any terminal AI agent a safe setup handoff | `aops setup ai` |
|
|
38
|
-
| normal operator installation | `aops
|
|
39
|
+
| normal operator installation | `aops` (Rust TUI) |
|
|
40
|
+
| headless setup/automation | `aops setup init --path <1|2|3|4> ...` |
|
|
39
41
|
| use an existing database URL | path `1`, then `aops setup server-env` |
|
|
40
42
|
| let AOPS manage Docker PostgreSQL | path `2` |
|
|
41
43
|
| create AOPS DB in PostgreSQL on this computer | path `3` |
|
|
@@ -46,21 +48,21 @@ or chat. Use AOPS masked prompts or the documented private process environment.
|
|
|
46
48
|
Load only the section needed for the selected path. The current nested `--help`
|
|
47
49
|
owns exact flags.
|
|
48
50
|
|
|
49
|
-
## Normal
|
|
51
|
+
## Normal TUI installation
|
|
50
52
|
|
|
51
|
-
Prefer the
|
|
53
|
+
Prefer the TUI for operator-led setup:
|
|
52
54
|
|
|
53
55
|
```sh
|
|
54
|
-
aops
|
|
56
|
+
aops
|
|
55
57
|
```
|
|
56
58
|
|
|
57
59
|
All local-server paths use the normal `default` instance, API port `5900`, and
|
|
58
60
|
independently supervised Cockpit port `5922`, verify
|
|
59
61
|
migrations, install the verified Gateway for registered runtimes, reconcile the inert signed
|
|
60
|
-
official catalog, and leave starter/demo user data untouched.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
official catalog, and leave starter/demo user data untouched. The TUI collects
|
|
63
|
+
the selected path's required private inputs and calls only explicit CLI commands.
|
|
64
|
+
The CLI itself never opens a menu or asks a question. Setup automatically
|
|
65
|
+
installs or repairs the verified AOPS core and
|
|
64
66
|
gateway for every registered runtime. The core supplies a small neutral router,
|
|
65
67
|
rich on-demand mounted-domain user guides, and public-safe collaboration and
|
|
66
68
|
working-discipline references. Setup makes disciplines available but does not
|
|
@@ -77,7 +79,7 @@ For automatic Docker PostgreSQL, the container port is loopback-only and dynamic
|
|
|
77
79
|
|
|
78
80
|
```sh
|
|
79
81
|
aops server reset --remove-managed-postgres --confirm-data-loss --confirm-instance default
|
|
80
|
-
aops
|
|
82
|
+
aops
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
Global AOPS skills and pointers are shared installation assets and remain installed after server reset.
|
|
@@ -95,30 +97,29 @@ the rewrite removes retired local-auth assignments without printing them.
|
|
|
95
97
|
Git clone is a secondary development path. The optional application image is
|
|
96
98
|
built from the same exact public npm CLI/server closure and runs the normal
|
|
97
99
|
`aops server setup` lifecycle inside the container. It is a distribution path,
|
|
98
|
-
not a fifth
|
|
100
|
+
not a fifth TUI setup path. Path `2` manages only its namespaced,
|
|
99
101
|
label-verified PostgreSQL resources; unrelated Docker resources remain
|
|
100
102
|
operator-owned.
|
|
101
103
|
|
|
102
104
|
For path `1`, PostgreSQL is operator-owned and may be local, remote, managed,
|
|
103
|
-
or separately containerized.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
unencrypted transport. For
|
|
110
|
-
non-interactive work, inject `AOPS_PG_URL` privately or prepare it with
|
|
105
|
+
or separately containerized. Select path `1` in the TUI; it collects the
|
|
106
|
+
PostgreSQL URL privately and immediately tests the connection with TLS
|
|
107
|
+
`require`. A saved URL can be kept or replaced. Use `verify-full` with a trusted
|
|
108
|
+
CA and matching hostname; use `disable` only when the operator explicitly
|
|
109
|
+
accepts unencrypted transport. For direct CLI work, inject `AOPS_PG_URL`
|
|
110
|
+
privately or prepare it with
|
|
111
111
|
`aops setup server-env`, then inspect `aops setup init --path 1
|
|
112
112
|
--postgres-tls <policy> --yes --json`.
|
|
113
113
|
|
|
114
|
-
For path `3`, prefer
|
|
115
|
-
|
|
114
|
+
For path `3`, prefer the TUI. It probes loopback PostgreSQL, collects an existing
|
|
115
|
+
administrator role/password privately, creates a new
|
|
116
116
|
dedicated login and database with a generated application password, stores only
|
|
117
117
|
the application URL in the private user server-env, and runs the normal external
|
|
118
118
|
migrations. The administrator password is never stored. If PostgreSQL is absent
|
|
119
119
|
or stopped, return the platform-specific install/start actions reported by
|
|
120
|
-
readiness; do not silently run an elevated package manager.
|
|
121
|
-
the
|
|
120
|
+
readiness; do not silently run an elevated package manager. Direct CLI use must
|
|
121
|
+
provide the administrator role explicitly and may use the private
|
|
122
|
+
`AOPS_LOCAL_POSTGRES_ADMIN_PASSWORD` environment variable.
|
|
122
123
|
`--local-postgres-admin-no-password` works only with PostgreSQL TCP trust auth;
|
|
123
124
|
it does not bypass authentication or make Linux peer/socket auth work over
|
|
124
125
|
loopback TCP. If the administrator password is unknown, stop and ask the
|
package/dist/commands/agent.js
CHANGED
|
@@ -3,7 +3,6 @@ import { Command } from 'commander';
|
|
|
3
3
|
import { banner, logError, logInfo, logSuccess } from '@aopslabs/xf-cli-ui';
|
|
4
4
|
import { applyCommonOptions, compactPayload, normalizeNonEmpty } from '../utils/command.js';
|
|
5
5
|
import { buildAgentContextHeaders, invokeHostedToolWithApiState, parseJsonInput, requireApiState, unwrapHostedToolResult, } from '../utils/agent-gateway.js';
|
|
6
|
-
import { promptInput } from '../utils/prompts.js';
|
|
7
6
|
function augmentAgentInvokeErrorMessage(toolId, message) {
|
|
8
7
|
const normalized = String(message ?? '').toLowerCase();
|
|
9
8
|
if (normalized.includes('apply_required')) {
|
|
@@ -506,10 +505,7 @@ export async function runAgentInvoke(options = {}) {
|
|
|
506
505
|
const apiState = await requireApiState(options);
|
|
507
506
|
if (!apiState)
|
|
508
507
|
return;
|
|
509
|
-
|
|
510
|
-
if (!toolId && interactive) {
|
|
511
|
-
toolId = normalizeNonEmpty(await promptInput({ message: 'Tool id:' }))?.toLowerCase();
|
|
512
|
-
}
|
|
508
|
+
const toolId = normalizeNonEmpty(options.tool)?.toLowerCase();
|
|
513
509
|
if (!toolId) {
|
|
514
510
|
logError('Missing tool id. Provide --tool <id>.');
|
|
515
511
|
process.exitCode = 1;
|
package/dist/commands/api.js
CHANGED
|
@@ -3,16 +3,12 @@ import { banner, logError, logInfo, logSuccess } from '@aopslabs/xf-cli-ui';
|
|
|
3
3
|
import { appendQueryToPath, buildDomainApiPath, parseJsonInput, } from '../utils/operator-runtime.js';
|
|
4
4
|
import { applyCommonOptions, normalizeNonEmpty, } from '../utils/command.js';
|
|
5
5
|
import { buildAgentContextHeaders, requireApiState } from '../utils/agent-gateway.js';
|
|
6
|
-
import { promptInput } from '../utils/prompts.js';
|
|
7
6
|
export async function runApiCall(options = {}) {
|
|
8
7
|
const interactive = !options.yes && !options.json;
|
|
9
8
|
const apiState = await requireApiState(options);
|
|
10
9
|
if (!apiState)
|
|
11
10
|
return;
|
|
12
|
-
|
|
13
|
-
if (!domain && interactive) {
|
|
14
|
-
domain = normalizeNonEmpty(await promptInput({ message: 'Domain (e.g. docman):' }));
|
|
15
|
-
}
|
|
11
|
+
const domain = normalizeNonEmpty(options.domain);
|
|
16
12
|
if (!domain) {
|
|
17
13
|
logError('Missing domain. Provide --domain <id>.');
|
|
18
14
|
process.exitCode = 1;
|
package/dist/commands/assets.js
CHANGED
|
@@ -2,7 +2,6 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { Command } from 'commander';
|
|
5
|
-
import { banner, logError, logInfo, logSuccess } from '@aopslabs/xf-cli-ui';
|
|
6
5
|
import { AgentAssetsError, agentAssetsFailure, agentAssetsSuccess, assertBoundedDiscoveryEnvelope, } from '../lib/agent-assets/envelope.js';
|
|
7
6
|
import { resolveAgentAssetsMutationGuard } from '../lib/agent-assets/guards.js';
|
|
8
7
|
import { discoverHostedSkills } from '../lib/agent-assets/hosted-discovery.js';
|
|
@@ -14,10 +13,8 @@ import { resolveAgentAssetsRoots } from '../lib/agent-assets/roots.js';
|
|
|
14
13
|
import { inspectRuntimeGatewayBindings } from '../lib/agent-assets/runtime-binding-reader.js';
|
|
15
14
|
import { readAgentAssetsStoreStatus, readAgentAssetsRollbackTarget, readAgentAssetsPrunePlan, readResolvedAgentAssetPackage, resolveAgentAsset, } from '../lib/agent-assets/store-reader.js';
|
|
16
15
|
import { applyVerifiedCommunityCore, applyVerifiedHostedSkillPackage, cleanupAgentAssetsStaging, pinAgentAssetsExactVersion, pruneAgentAssets, repairAgentAssetRuntimeBindings, rollbackAgentAssets, } from '../lib/agent-assets/store-writer.js';
|
|
17
|
-
import { createSetupAgentAssetsProvider, } from '../lib/setup-agent-assets-bridge.js';
|
|
18
16
|
import { resolveSetupAgentAssetsReleaseV1 } from '../lib/setup-agent-assets-release.js';
|
|
19
|
-
import {
|
|
20
|
-
import { promptConfirm, promptMultiSelect, promptSelect } from '../utils/prompts.js';
|
|
17
|
+
import { collectAgentAssetTarget, resolveAgentAssetTargetSelection, selectAgentAssetRuntimeHomes, } from '../lib/agent-assets/runtime-targets.js';
|
|
21
18
|
function stableRootId(kind, absolutePath) {
|
|
22
19
|
const canonicalPath = process.platform === 'win32'
|
|
23
20
|
? path.normalize(absolutePath).toLowerCase()
|
|
@@ -1108,135 +1105,6 @@ Notes:
|
|
|
1108
1105
|
.action(action('assets.migrate.legacy-pointers', runner));
|
|
1109
1106
|
return command;
|
|
1110
1107
|
}
|
|
1111
|
-
export const AGENT_ASSETS_HOME = `AOPS Agent Assets
|
|
1112
|
-
|
|
1113
|
-
Global Gateway skill pointers:
|
|
1114
|
-
Status aops assets status --verify full
|
|
1115
|
-
Install aops assets install --apply
|
|
1116
|
-
Update aops assets update --apply
|
|
1117
|
-
Repair pointers aops assets repair --repair-bindings --apply
|
|
1118
|
-
Remove pointers aops assets uninstall --apply --confirm
|
|
1119
|
-
|
|
1120
|
-
Targets: --target codex | --target claude | --target codex,claude | --target all
|
|
1121
|
-
`;
|
|
1122
|
-
function menuStatusData(status) {
|
|
1123
|
-
return (status.data ?? {});
|
|
1124
|
-
}
|
|
1125
|
-
function showAgentAssetsStatus(status) {
|
|
1126
|
-
const data = menuStatusData(status);
|
|
1127
|
-
logInfo(status.summary);
|
|
1128
|
-
logInfo(`Core: ${data.store?.state ?? 'unknown'}`);
|
|
1129
|
-
logInfo(`Codex pointer: ${data.runtimeBindings?.codex?.state ?? 'unknown'}`);
|
|
1130
|
-
logInfo(`Claude pointer: ${data.runtimeBindings?.claude?.state ?? 'unknown'}`);
|
|
1131
|
-
}
|
|
1132
|
-
async function selectAgentAssetsTarget() {
|
|
1133
|
-
const selected = await promptMultiSelect({
|
|
1134
|
-
message: 'Registered runtime targets:',
|
|
1135
|
-
choices: AGENT_ASSET_RUNTIME_REGISTRY.map((runtime) => ({
|
|
1136
|
-
name: runtime.label,
|
|
1137
|
-
value: runtime.id,
|
|
1138
|
-
checked: true,
|
|
1139
|
-
})),
|
|
1140
|
-
});
|
|
1141
|
-
if (selected.length === 0) {
|
|
1142
|
-
throw new AgentAssetsError('schema_incompatible', 'Select at least one registered runtime.', {
|
|
1143
|
-
nextActions: ['Select one or more runtimes, or leave every registered runtime checked for all.'],
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
return resolveAgentAssetTargetSelection(selected.length === AGENT_ASSET_RUNTIME_IDS.length ? 'all' : selected);
|
|
1147
|
-
}
|
|
1148
|
-
function selectedRuntimeHomes(roots, target) {
|
|
1149
|
-
return selectAgentAssetRuntimeHomes(target, {
|
|
1150
|
-
codex: roots.runtimeHomes.codex.absolutePath,
|
|
1151
|
-
claude: roots.runtimeHomes.claude.absolutePath,
|
|
1152
|
-
});
|
|
1153
|
-
}
|
|
1154
|
-
async function resolveAgentAssetsReleaseForMenu(provider) {
|
|
1155
|
-
const resolved = await provider.resolveRelease?.({});
|
|
1156
|
-
if (!resolved?.fromRelease) {
|
|
1157
|
-
throw new Error('agent_assets_bundled_source_unavailable:reinstall_the_official_aops_cli_package');
|
|
1158
|
-
}
|
|
1159
|
-
logInfo(resolved.source === 'bundled-npm'
|
|
1160
|
-
? 'Using the verified Gateway assets bundled with this AOPS CLI installation.'
|
|
1161
|
-
: `Using verified Gateway assets from ${resolved.source}.`);
|
|
1162
|
-
return resolved.fromRelease;
|
|
1163
|
-
}
|
|
1164
|
-
export async function runAgentAssetsMenu(provider = createSetupAgentAssetsProvider()) {
|
|
1165
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
1166
|
-
process.stdout.write(AGENT_ASSETS_HOME);
|
|
1167
|
-
return;
|
|
1168
|
-
}
|
|
1169
|
-
banner('AOPS Agent Assets');
|
|
1170
|
-
logInfo('Manage the verified AOPS Gateway skill pointers for registered agent runtimes.');
|
|
1171
|
-
while (true) {
|
|
1172
|
-
const status = await provider.status();
|
|
1173
|
-
showAgentAssetsStatus(status);
|
|
1174
|
-
const storeReady = menuStatusData(status).store?.state === 'ready';
|
|
1175
|
-
const action = await promptSelect({
|
|
1176
|
-
message: 'Agent assets action:',
|
|
1177
|
-
choices: [
|
|
1178
|
-
{ name: 'Inspect status', value: 'status' },
|
|
1179
|
-
{ name: storeReady ? 'Update verified Gateway core' : 'Install verified Gateway core', value: 'install-update' },
|
|
1180
|
-
{ name: 'Repair global pointers', value: 'repair' },
|
|
1181
|
-
{ name: 'Remove global pointers', value: 'uninstall' },
|
|
1182
|
-
{ name: 'Quick command help', value: 'help' },
|
|
1183
|
-
{ name: 'Back', value: 'back' },
|
|
1184
|
-
],
|
|
1185
|
-
pageSize: 6,
|
|
1186
|
-
});
|
|
1187
|
-
if (action === 'back')
|
|
1188
|
-
return;
|
|
1189
|
-
if (action === 'status')
|
|
1190
|
-
continue;
|
|
1191
|
-
if (action === 'help') {
|
|
1192
|
-
process.stdout.write(AGENT_ASSETS_HOME);
|
|
1193
|
-
continue;
|
|
1194
|
-
}
|
|
1195
|
-
try {
|
|
1196
|
-
const target = await selectAgentAssetsTarget();
|
|
1197
|
-
if (action === 'uninstall') {
|
|
1198
|
-
const confirmed = await promptConfirm({
|
|
1199
|
-
message: 'Remove only the selected recognized AOPS global pointer files?',
|
|
1200
|
-
default: false,
|
|
1201
|
-
});
|
|
1202
|
-
if (!confirmed)
|
|
1203
|
-
continue;
|
|
1204
|
-
const roots = resolveAgentAssetsRoots({});
|
|
1205
|
-
const removed = removeAopsGatewayPointers({
|
|
1206
|
-
assetRoot: roots.assetRoot,
|
|
1207
|
-
runtimeHomes: selectedRuntimeHomes(roots, target),
|
|
1208
|
-
});
|
|
1209
|
-
logSuccess(removed.removed.length > 0
|
|
1210
|
-
? `Removed: ${removed.removed.join(', ')}. Verified core and receipts were retained.`
|
|
1211
|
-
: 'Selected global pointers were already absent.');
|
|
1212
|
-
continue;
|
|
1213
|
-
}
|
|
1214
|
-
if (!provider.apply)
|
|
1215
|
-
throw new Error('agent_assets_apply_unavailable');
|
|
1216
|
-
if (action === 'repair') {
|
|
1217
|
-
if (!await promptConfirm({ message: 'Repair the selected managed AOPS pointers now?', default: true }))
|
|
1218
|
-
continue;
|
|
1219
|
-
const repaired = await provider.apply({ action: 'repair', target: target.selector });
|
|
1220
|
-
showAgentAssetsStatus(repaired);
|
|
1221
|
-
logSuccess('Gateway pointer repair completed.');
|
|
1222
|
-
continue;
|
|
1223
|
-
}
|
|
1224
|
-
const operation = storeReady ? 'update' : 'install';
|
|
1225
|
-
const fromRelease = await resolveAgentAssetsReleaseForMenu(provider);
|
|
1226
|
-
if (!await promptConfirm({
|
|
1227
|
-
message: `${operation === 'install' ? 'Install' : 'Update'} the verified Gateway core for ${target.selector}?`,
|
|
1228
|
-
default: true,
|
|
1229
|
-
}))
|
|
1230
|
-
continue;
|
|
1231
|
-
const applied = await provider.apply({ action: operation, fromRelease, target: target.selector });
|
|
1232
|
-
showAgentAssetsStatus(applied);
|
|
1233
|
-
logSuccess(`Gateway ${operation} completed.`);
|
|
1234
|
-
}
|
|
1235
|
-
catch (error) {
|
|
1236
|
-
logError(error instanceof Error ? error.message : String(error));
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
1108
|
export function makeAssetsCommand(runner = defaultAgentAssetsCommandRunner) {
|
|
1241
1109
|
const command = new Command('assets')
|
|
1242
1110
|
.description(`Install, inspect, update, repair, remove pointers, and roll back verified AOPS client assets in
|
|
@@ -1409,6 +1277,6 @@ Notes:
|
|
|
1409
1277
|
`)
|
|
1410
1278
|
.action(action('assets.prune', runner));
|
|
1411
1279
|
command.addCommand(makeMigrateCommand(runner));
|
|
1412
|
-
command.action(() =>
|
|
1280
|
+
command.action(() => command.outputHelp());
|
|
1413
1281
|
return command;
|
|
1414
1282
|
}
|
|
@@ -16,7 +16,7 @@ export function guardCommunitySecretArgv(argv) {
|
|
|
16
16
|
for (const token of argv.slice(2)) {
|
|
17
17
|
const flag = token.split('=', 1)[0]?.toLowerCase();
|
|
18
18
|
if (SECRET_ARGV.has(flag)) {
|
|
19
|
-
throw new Error(`community_secret_argv_refused:${flag}:
|
|
19
|
+
throw new Error(`community_secret_argv_refused:${flag}:use_secure_store_browser_or_environment`);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|