@fnnas-labs/fnos-cli 0.0.0-stage → 0.2.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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +169 -2
  3. package/THIRD_PARTY_NOTICES.txt +38904 -0
  4. package/cordis.patch.yml +3 -0
  5. package/npm/README.dsh.md +49 -0
  6. package/npm/acceptance-report.cjs +53 -0
  7. package/npm/dsh-integration.mjs +159 -0
  8. package/npm/dsh-test-support.mjs +55 -0
  9. package/npm/dsh.mjs +31 -0
  10. package/npm/install.cjs +130 -0
  11. package/npm/package-lib.cjs +274 -0
  12. package/npm/run.cjs +39 -0
  13. package/package.json +46 -4
  14. package/skill/LICENSE +21 -0
  15. package/skill/SKILL.md +143 -0
  16. package/skill/THIRD_PARTY_NOTICES.txt +38904 -0
  17. package/skill/bin/trim-cli-darwin-arm64 +0 -0
  18. package/skill/bin/trim-cli-darwin-x64 +0 -0
  19. package/skill/bin/trim-cli-linux-arm64 +0 -0
  20. package/skill/bin/trim-cli-linux-x64 +0 -0
  21. package/skill/bin/trim-cli-windows-arm64.exe +0 -0
  22. package/skill/bin/trim-cli-windows-x64.exe +0 -0
  23. package/skill/build-provenance.json +44 -0
  24. package/skill/entries/trim-app.md +63 -0
  25. package/skill/entries/trim-baidu-netdisk.md +42 -0
  26. package/skill/entries/trim-docker.md +35 -0
  27. package/skill/entries/trim-download.md +38 -0
  28. package/skill/entries/trim-file.md +30 -0
  29. package/skill/entries/trim-log.md +32 -0
  30. package/skill/entries/trim-monitor.md +41 -0
  31. package/skill/entries/trim-network.md +22 -0
  32. package/skill/entries/trim-photos.md +32 -0
  33. package/skill/entries/trim-shared.md +54 -0
  34. package/skill/entries/trim-storage.md +34 -0
  35. package/skill/entries/trim-system.md +59 -0
  36. package/skill/entries/trim-user.md +28 -0
  37. package/skill/manifest.json +43 -0
  38. package/skill/reference/_conventions.md +76 -0
  39. package/skill/reference/_index.md +78 -0
  40. package/skill/reference/app-center.md +234 -0
  41. package/skill/reference/baidu-netdisk.md +221 -0
  42. package/skill/reference/dockermgr.md +244 -0
  43. package/skill/reference/download.md +357 -0
  44. package/skill/reference/file.md +752 -0
  45. package/skill/reference/log.md +224 -0
  46. package/skill/reference/network.md +41 -0
  47. package/skill/reference/oauth.md +51 -0
  48. package/skill/reference/photos.md +158 -0
  49. package/skill/reference/power.md +34 -0
  50. package/skill/reference/resmon.md +160 -0
  51. package/skill/reference/stor.md +525 -0
  52. package/skill/reference/sysinfo.md +133 -0
  53. package/skill/reference/user.md +139 -0
  54. package/skill/reference/workflows/device-validation.md +66 -0
  55. package/skill/reference/workflows/file-routing.md +44 -0
  56. package/skill/reference/workflows/file-upload-validation.md +63 -0
  57. package/skill/reference/workflows/photos-routing.md +83 -0
  58. package/skill/reference/workflows/storage-dangerous-ops.md +53 -0
  59. package/skill/scripts/fnos-cli +63 -0
  60. package/skill/scripts/fnos-cli.cmd +36 -0
  61. package/skill/scripts/fnos-cli.ps1 +31 -0
  62. package/skill/scripts/trim-cli +63 -0
  63. package/skill/scripts/trim-cli.cmd +36 -0
  64. package/skill/scripts/trim-cli.ps1 +31 -0
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,44 @@
1
+ {
2
+ "schema": 1,
3
+ "version": "0.2.0",
4
+ "commit": "847034326e2a48518a69a3f0e46bd47adcdb9f7b",
5
+ "sourceSha256": "eafe5fd9f54061032ba8f3d3eebdf023ad0bb6b8ca5e6652ef0327e0db4d4b70",
6
+ "binaries": {
7
+ "darwin-arm64": {
8
+ "target": "aarch64-apple-darwin",
9
+ "file": "bin/trim-cli-darwin-arm64",
10
+ "version": "0.2.0",
11
+ "sha256": "0fa8a006bf49e8a548cc83ad0962953613c1c212745b7117a44f7e0f4756ad50"
12
+ },
13
+ "darwin-x64": {
14
+ "target": "x86_64-apple-darwin",
15
+ "file": "bin/trim-cli-darwin-x64",
16
+ "version": "0.2.0",
17
+ "sha256": "f0909085e64644f60737b862ba0272df3e96664e004815d4350d906c1c05f807"
18
+ },
19
+ "linux-arm64": {
20
+ "target": "aarch64-unknown-linux-gnu",
21
+ "file": "bin/trim-cli-linux-arm64",
22
+ "version": "0.2.0",
23
+ "sha256": "c83bf57f871df5930944d098841372a2f52af031fbc54d825f8920d0741dfb1c"
24
+ },
25
+ "linux-x64": {
26
+ "target": "x86_64-unknown-linux-gnu",
27
+ "file": "bin/trim-cli-linux-x64",
28
+ "version": "0.2.0",
29
+ "sha256": "941f0d53434a2d02410f2759b81866b0b13e6a6750d919cd56aed8950abf5261"
30
+ },
31
+ "windows-arm64": {
32
+ "target": "aarch64-pc-windows-gnullvm",
33
+ "file": "bin/trim-cli-windows-arm64.exe",
34
+ "version": "0.2.0",
35
+ "sha256": "77b2445261afbbc3549572e4093107cae51b395e2bb3742cab1a0623a9b8c811"
36
+ },
37
+ "windows-x64": {
38
+ "target": "x86_64-pc-windows-gnullvm",
39
+ "file": "bin/trim-cli-windows-x64.exe",
40
+ "version": "0.2.0",
41
+ "sha256": "c3254dbd4a64853064cffbf3a03f75579f830fa8dac5ba0e645ef47ecbb9b4f5"
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: trim-app
3
+ description: Manage installed applications, App Center installation, FPK packages, updates, application entries and lifecycle operations.
4
+ ---
5
+
6
+ # App Center
7
+
8
+ Manage fnOS apps: list, inspect, install, install FPKs, update, start,
9
+ stop and uninstall. See `../reference/app-center.md` for endpoints and fields;
10
+ use `trim-shared.md` for connection or session failures.
11
+
12
+ ## Rules
13
+
14
+ - Writes, including installation, updates and lifecycle changes, require explicit `--yes`.
15
+ - Only flows without UI decisions run automatically. License approval requires
16
+ `--accept-license`; dependency changes and running dependent apps require App
17
+ Center UI. Supply explicit `--custom-parameters` for custom wizard input.
18
+ - `app install` / `app update` create and poll a download task, then start and
19
+ wait for the installation/update task. `--dry-run` only downloads/parses the
20
+ package, reads info and runs safety guards; it does not start installation.
21
+ - Preflight local FPKs with `app install-fpk <file> --volume-id <id> --dry-run --yes`.
22
+ This uploads/parses the FPK and checks guards without installing it.
23
+ - NAS FPKs use `--remote-path /vol.../demo.fpk`: a concrete NAS FPK path, at most 10GB.
24
+ - Upload error `20001` means unavailable storage; check that `--volume-id` exists,
25
+ is mounted and healthy.
26
+ - Supply `--source-id` for a new app when known; updates resolve `sourceID` from
27
+ the installed list.
28
+ - Prefer explicit `--volume-id`. Otherwise the CLI uses App Center's default
29
+ download/install volume, and refuses when no usable default exists.
30
+ - `--custom-parameters '<jsonArray>'` maps to `customParameters`;
31
+ `--api-scope '<jsonObject>'` maps to `systemParameters.apiScope`. Missing required
32
+ custom wizard input stops the command and directs the user to App Center UI.
33
+ - `--cancel-on-failure` attempts the matching cancel endpoint on task failure and
34
+ includes its result in the error.
35
+ - `app openapi ...` manages application user authorization paths; additions need
36
+ `--yes` and concrete `/vol...` paths.
37
+ - `app entry list`, `app desktop list` and `app sac app-store-list` use
38
+ `appcgi.sac.entry.v1.*` WebSocket CGI, not legacy entry REST.
39
+ - Desktop entry writes without named commands use `raw` with explicit `--yes`.
40
+ - `app config set-sys` rejects invalid default volumes, update windows, cloud
41
+ policies and boolean settings before sending. `autoCreateDesktopIcon` is sent
42
+ only with `--allow-desktop-icon-field` after backend compatibility is confirmed.
43
+ - Apps start after installation by default; use `--no-start` to leave them stopped.
44
+
45
+ ## Commands
46
+
47
+ ```bash
48
+ fnos-cli --host <host> --port <port> app list
49
+ fnos-cli --host <host> --port <port> app status <appName>
50
+ fnos-cli app entry list
51
+ fnos-cli app desktop list
52
+ fnos-cli app sac app-store-list
53
+ fnos-cli app install <appName> --version <version> --source-id <sourceID> --volume-id <volumeId> --dry-run --yes
54
+ fnos-cli app install <appName> --version <version> --volume-id <volumeId> --custom-parameters '[{"key":"port","value":8080}]' --api-scope '{"API.User.FileAccess":true}' --yes
55
+ fnos-cli app install <appName> --version <version> --volume-id <volumeId> --accept-license --cancel-on-failure --yes
56
+ fnos-cli app install-fpk <localFile.fpk> --volume-id <volumeId> --dry-run --yes
57
+ fnos-cli app install-fpk --remote-path /vol1/1000/demo.fpk --volume-id <volumeId> --dry-run --yes
58
+ fnos-cli app update <appName> --version <version> --volume-id <volumeId> --dry-run --yes
59
+ fnos-cli app openapi add-user-auth-path <appName> /vol1/1000/docs --yes
60
+ fnos-cli app start <appName> --yes
61
+ fnos-cli app stop <appName> --yes
62
+ fnos-cli app uninstall <appName> --yes
63
+ ```
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: trim-baidu-netdisk
3
+ description: Check Baidu Netdisk authorization, quota, cloud files, saved shares, NAS transfers and scheduled synchronization.
4
+ ---
5
+
6
+ # Baidu Netdisk
7
+
8
+ Use for cloud file browsing/search/metadata, file changes, saving shares to NAS,
9
+ upload/download tasks, and scheduled sync. Read `../reference/baidu-netdisk.md`
10
+ for full commands, fields and errors; `trim-shared.md` covers fnOS profiles.
11
+
12
+ ## Rules
13
+
14
+ - Run `baidu-netdisk status` first. If unauthorized, the user completes authorization
15
+ in the NAS Baidu Netdisk app. The CLI does not perform Baidu OAuth.
16
+ - Cloud paths start with `/`; NAS paths are concrete `/vol{n}/...` paths. Keep them distinct.
17
+ - File, transfer and sync changes require explicit `--yes`.
18
+ - Successful `upload` means task submission only; `data: null` is normal. Check
19
+ `task list --state running`, then `--state completed` for the final result.
20
+ - `status=6`, `failCode=42610` means insufficient cloud space. Free or expand space before retrying.
21
+ - `info --dlink` returns a sensitive temporary URL; CLI output redacts `dlink`.
22
+ - The final `move` / `copy` argument is the destination directory; earlier arguments are sources.
23
+ - Prefer `share-save --all`. To select known share IDs, repeat `--fsid` instead;
24
+ `--all` and `--fsid` are mutually exclusive.
25
+ - Share extraction codes are detected automatically or supplied with `--password`.
26
+ Keep share shortcodes, extraction codes, `spwd` and intermediate task IDs out of replies and logs.
27
+
28
+ ## Commands
29
+
30
+ ```bash
31
+ fnos-cli baidu-netdisk status
32
+ fnos-cli baidu-netdisk quota
33
+ fnos-cli baidu-netdisk ls / --limit 80
34
+ fnos-cli baidu-netdisk search <keyword> --dir / --recursive
35
+ fnos-cli baidu-netdisk info <fsid...>
36
+ fnos-cli baidu-netdisk mkdir /backup --yes
37
+ fnos-cli baidu-netdisk upload /backup /vol1/1000/data --yes
38
+ fnos-cli baidu-netdisk download /vol1/1000/downloads <fsid...> --yes
39
+ fnos-cli baidu-netdisk share-save '<shareUrlWithPassword>' /vol1/1000/downloads --all --yes
40
+ fnos-cli baidu-netdisk task list --transfer download
41
+ fnos-cli baidu-netdisk sync list
42
+ ```
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: trim-docker
3
+ description: Inspect and manage Docker images, containers, Compose projects and long-running lifecycle operations.
4
+ ---
5
+
6
+ # Docker
7
+
8
+ Read `../reference/dockermgr.md` for the API contract. Observe with `docker stats`,
9
+ `image ls` and `container ls` before making changes.
10
+
11
+ ## Rules
12
+
13
+ - `container ls` lists running containers only. Use `--all` or `container inspect <id>`
14
+ to check stopped/created containers or whether a container still exists.
15
+ - `container top` requires a running container; inspect `State.Running=true` first.
16
+ - Pulling images and stopping/restarting containers can take longer than read requests.
17
+ - `image pull` and `container create/update/start/stop/restart/kill` require `--yes`.
18
+ Agent/noninteractive deletion also passes `--yes`; `--force` does not replace it.
19
+ - `container update` may return a new ID; older firmware requires follow-up resource
20
+ and network checks. Use the ID returned by the command for later operations.
21
+ - Image references and container IDs are different identifiers.
22
+ - Unwrapped `appcgi.dockermgr.*` endpoints use `docker request` with explicit
23
+ `--yes`. Probe read-only state before system/network/Compose writes.
24
+
25
+ ## Commands
26
+
27
+ ```bash
28
+ fnos-cli docker stats
29
+ fnos-cli docker image ls
30
+ fnos-cli docker image pull <imageRef> --yes
31
+ fnos-cli docker container ls
32
+ fnos-cli docker container ls --all
33
+ fnos-cli docker compose ls
34
+ fnos-cli docker request appcgi.dockermgr.networkList --json '{}' --yes
35
+ ```
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: trim-download
3
+ description: List, search, create and control download tasks; inspect task files, statistics and state transitions.
4
+ ---
5
+
6
+ # Downloads
7
+
8
+ Read `../reference/download.md` for command signatures and endpoint fields.
9
+ Use for URI, magnet and torrent tasks, save directories, priorities and task retries.
10
+
11
+ ## Rules
12
+
13
+ - Creating tasks uses `download add-uri <uri> <saveDir>` or
14
+ `download add-path <path> <saveDir>`; save directories are concrete `/vol{n}/...` paths.
15
+ - `download stat` reports aggregate statistics, not one file's metadata.
16
+ - `download pause|resume|retry|rm <id...>` affects existing tasks and does not infer paths.
17
+ - Task creation and control require explicit `--yes`.
18
+ - Paths in `download info` / `download files` directly reflect fnOS volume
19
+ definitions; use the returned paths rather than deriving replacements.
20
+ - Unwrapped `appcgi.downloadcenter.*` endpoints use `download request`; omit
21
+ `req` and `reqid` from JSON.
22
+
23
+ ## Commands
24
+
25
+ ```bash
26
+ fnos-cli download ls
27
+ fnos-cli download ls installer
28
+ fnos-cli download info <id>
29
+ fnos-cli download files <id>
30
+ fnos-cli download add-uri https://example.com/file.iso /vol1/download --yes
31
+ fnos-cli download add-path /vol1/source.torrent /vol1/download --yes
32
+ fnos-cli download pause <id...> --yes
33
+ fnos-cli download resume <id...> --yes
34
+ fnos-cli download retry <id...> --yes
35
+ fnos-cli download rm <id...> --yes
36
+ fnos-cli download stat
37
+ fnos-cli download request appcgi.downloadcenter.tracker.query --json '{}' --yes
38
+ ```
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: trim-file
3
+ description: List and search files, upload local files, inspect shared directories and ACLs, or determine current-user and NAS path semantics.
4
+ ---
5
+
6
+ # Files
7
+
8
+ Read `../reference/workflows/file-routing.md` to choose the command, then
9
+ `../reference/file.md` for endpoint fields.
10
+
11
+ ## Rules
12
+
13
+ - Both `file ls` and `file ls /` omit the request's `path`.
14
+ - Writes require a concrete `/vol{n}/...` path by default.
15
+ - `file share.*` manages shared directories, not share links.
16
+ - `file search-others` searches files shared with the current user; it is not a shared-directory listing.
17
+ - `file upload` takes a remote directory; the CLI appends the local filename.
18
+ - `file check-upload` may allocate a temporary placeholder; both upload and preflight require `--yes`.
19
+ - `file fav add/del` changes the current user's favorites and requires `--yes`.
20
+
21
+ ## Commands
22
+
23
+ ```bash
24
+ fnos-cli file ls
25
+ fnos-cli file ls /vol1/downloads
26
+ fnos-cli file search <key>
27
+ fnos-cli file upload /vol1/1000/uploads ./local-file.txt --overwrite rename --yes
28
+ fnos-cli file share list
29
+ fnos-cli file acl get /vol1/1000/docs
30
+ ```
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: trim-log
3
+ description: Browse and filter logs, enumerate modules, clear or export logs, configure archives, and copy or cancel diagnostic logs.
4
+ ---
5
+
6
+ # Logs
7
+
8
+ Read `../reference/log.md` for log structures and command parameters.
9
+
10
+ ## Rules
11
+
12
+ - Choose explicit `level`, `module` and `locale` values for filtering and export.
13
+ - Legacy `log.*` and `appcgi.eventlogger.common.*` (`logger`) coexist; keep their results separate.
14
+ - `logger export` can be large; confirm writable output storage.
15
+ `logger archive set` changes policy; confirm the intended configuration first.
16
+ - `diagnostic-log export --output-dir` is a mounted device-side path, such as
17
+ `/vol1/<dir>` or `/vol00/<mount>/<dir>`.
18
+ - Inspect state with paged `logger list` before clearing or changing archives.
19
+ - Clearing, exporting, archive settings and diagnostic task control require explicit `--yes`.
20
+
21
+ ## Commands
22
+
23
+ ```bash
24
+ fnos-cli logger list --page <n> --page-size <n> --level <n> --module <n> --locale <locale>
25
+ fnos-cli logger modules --locale <locale>
26
+ fnos-cli logger clear --level <level> --module <module> --yes
27
+ fnos-cli logger export --level <level> --module <module> --locale <locale> --yes
28
+ fnos-cli logger archive set --switch <0|1> --file-path <path> --size-gt <n> --date-unit <n> --date-before <n> --yes
29
+ fnos-cli logger archive query
30
+ fnos-cli diagnostic-log export --output-dir /vol1/<dir> --srv-type 0,1,2 --yes
31
+ fnos-cli diagnostic-log stop --task-id <taskId> --yes
32
+ ```
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: trim-monitor
3
+ description: Inspect runtime CPU, memory, network, disk, process, service, battery, fan, GPU/NPU and alarm-beeper metrics.
4
+ ---
5
+
6
+ # Monitoring
7
+
8
+ Read `../reference/resmon.md`. Runtime metrics use `monitor`; static system
9
+ identity, model and configuration use `trim-system.md`.
10
+
11
+ ## Rules
12
+
13
+ - `monitor cpu` / `monitor memory` return time-series samples. Explain the returned
14
+ `usage`, `cores` and related fields in context.
15
+ - `monitor gen --item` accepts comma-separated or repeated values, limited to
16
+ `storeSpeed`, `netSpeed`, `cpuBusy` and `memPercent`.
17
+ - `monitor proc-info --pids` accepts positive integer PIDs, separated by commas.
18
+ - Most commands are read-only; `monitor mute-beeper` and `monitor request`
19
+ require confirmation or explicit `--yes`.
20
+ - `monitor request` allows only `appcgi.resmon.*`; omit `req` and `reqid` from JSON.
21
+
22
+ ## Commands
23
+
24
+ ```bash
25
+ fnos-cli monitor cpu
26
+ fnos-cli monitor memory
27
+ fnos-cli monitor net
28
+ fnos-cli monitor disk
29
+ fnos-cli monitor gen --item storeSpeed,netSpeed --item cpuBusy
30
+ fnos-cli monitor proc-list
31
+ fnos-cli monitor proc-info --pids 123,456
32
+ fnos-cli monitor proc-srv
33
+ fnos-cli monitor sys-warn
34
+ fnos-cli monitor battery
35
+ fnos-cli monitor sys-fan
36
+ fnos-cli monitor beep-supported
37
+ fnos-cli monitor beep-events
38
+ fnos-cli monitor beep-reasons
39
+ fnos-cli monitor mute-beeper --yes
40
+ fnos-cli monitor request appcgi.resmon.gen --json '{"item":["cpuBusy"]}' --yes
41
+ ```
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: trim-network
3
+ description: Manage network service switches, including enabling or disabling SSH, and check write confirmation requirements.
4
+ ---
5
+
6
+ # Networking
7
+
8
+ Read `../reference/network.md` for fields and `trim-shared.md` for connections
9
+ and sessions.
10
+
11
+ ## Rules
12
+
13
+ - Enabling SSH is security-sensitive and requires explicit user authorization.
14
+ - After confirming authorization, Agent commands pass `--yes` explicitly.
15
+ - Exactly one of `--enable` and `--disable` is required.
16
+
17
+ ## Commands
18
+
19
+ ```bash
20
+ fnos-cli network ssh switch --enable --yes
21
+ fnos-cli network ssh switch --disable --yes
22
+ ```
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: trim-photos
3
+ description: Browse photo folders, search photos, inspect details, and obtain thumbnail or original preview links.
4
+ ---
5
+
6
+ # Photos
7
+
8
+ Photos reuses the current profile's system OAuth session through the native
9
+ Photos HTTP API proxy. Read `../reference/photos.md` for fields and
10
+ `../reference/workflows/photos-routing.md` for statistics, AI search and sampled previews.
11
+
12
+ ## Rules
13
+
14
+ - Complete OAuth `login` first; Photos needs no separate app login or signature.
15
+ - `--filter` and `--exclude-filter` take repeatable `name=value` arguments.
16
+ - Preview sizes are `xxs`, `xs`, `s`, `m` and `o` (original).
17
+ - Preview URLs are absolute, but the browser usually still needs a signed-in fnOS cookie.
18
+ - Natural-language AI search uses `magic-search`, not an alias of `photos search`.
19
+ Without a stable `total`, report only the returned result count.
20
+ - Unwrapped endpoints use `photos request`; non-GET requests require confirmation by default.
21
+ - Inspect both `httpStatus` and `response.code`, not only the CLI exit code.
22
+
23
+ ## Commands
24
+
25
+ ```bash
26
+ fnos-cli photos folders
27
+ fnos-cli photos search IMG --limit 20
28
+ fnos-cli photos search Beijing --filter file_type=photo
29
+ fnos-cli photos info <photoId>
30
+ fnos-cli photos preview <photoId> --size m
31
+ fnos-cli photos preview <photoId> --size o --open
32
+ ```
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: trim-shared
3
+ description: Sign in, select connection targets or profiles, troubleshoot sessions and connections, validate devices, and apply common safety rules.
4
+ ---
5
+
6
+ # Connections and authentication
7
+
8
+ Start with `../SKILL.md` and `../reference/_index.md`.
9
+ Device validation follows `../reference/workflows/device-validation.md`.
10
+
11
+ ## Rules
12
+
13
+ - The default loopback target is `http://localhost:5666`.
14
+ - Global `--profile <name>` selects an independent session profile.
15
+ - With `--scheme auto` and no explicit port, loopback defaults to `http:5666`,
16
+ remote IPs to `https:5667`, and remote domains to `https:443`.
17
+ - An explicit `--port` takes precedence; the CLI then resolves only the scheme.
18
+ - Omitted connection options reuse the saved host, port, scheme and TLS settings.
19
+ Profile fallback, login writes and logout cleanup affect only the selected profile.
20
+ - Self-signed HTTPS may need explicit `--tls-insecure`; remote plain HTTP needs
21
+ explicit `--allow-insecure-http`.
22
+ - Sessions default to platform secure storage. Use `TRIM_CLI_SESSION_STORAGE=file`
23
+ only for isolated tests or CI. `TRIM_CLI_SESSION_STORAGE=ask-file` explicitly
24
+ asks the user before a lower-trust file fallback after secure-storage failure.
25
+ - OAuth PKCE is the login flow. The user handles credentials and 2FA in the browser.
26
+ - Production login is a single interactive `login`: the user opens the link,
27
+ signs in, authorizes, and pastes the one-time code into the CLI. The Agent does
28
+ not enter credentials, approve access or read browser codes.
29
+ - For DSH, log in on the same Host, system user and configuration environment,
30
+ with the same `--profile`. Sessions do not automatically transfer to remote
31
+ browsers, SSH shells or containers. macOS background Keychain access may need approval.
32
+ - Access tokens refresh near expiry; `login --refresh` can request refresh.
33
+ - Refresh checks writable session storage first; failed preflight preserves the
34
+ old session and sends no refresh. Concurrent processes reuse newer profile
35
+ sessions rather than overwriting rotated tokens.
36
+ - Connection failures should identify the attempted `host:port`.
37
+ - Profile names are nonempty and contain only ASCII letters, digits, `_`, `-`, `.`.
38
+ - Input guards reject control characters, empty values and excessive lengths instead of silently rewriting them.
39
+ - `raw` omits `--yes` only for built-in audited read-only endpoints. Other and
40
+ unknown endpoints require it; endpoint names alone do not establish read-only behavior.
41
+
42
+ ## Commands
43
+
44
+ The user runs login in their own interactive terminal:
45
+
46
+ ```bash
47
+ fnos-cli --profile home --host <host> --port <port> login
48
+ fnos-cli --profile home --host <host> --port <port> login --no-open
49
+ fnos-cli --host <host> --scheme https --tls-insecure login
50
+ fnos-cli --profile home system info
51
+ fnos-cli --profile home raw appcgi.system.getInfo --json '{"language":"zh-CN"}'
52
+ fnos-cli --profile home raw appcgi.network.ssh.switch --json '{"enable":true}' --yes
53
+ fnos-cli --profile home logout
54
+ ```
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: trim-storage
3
+ description: Inspect storage pools, disks and SMART data, or perform mounting, expansion, disk replacement, formatting and other high-risk storage writes.
4
+ ---
5
+
6
+ # Storage
7
+
8
+ Read `../reference/workflows/storage-dangerous-ops.md` before writes, and
9
+ `../reference/stor.md` for the API contract.
10
+
11
+ ## Rules
12
+
13
+ - Pools use UUIDs or `trim_*` identifiers; disks use plain device names such as
14
+ `sda` or `nvme0n1`.
15
+ - Before high-risk writes, run `storage pools` and `storage disks`.
16
+ - Before creating a pool, run `storage free-disks`. For free space on the system
17
+ disk, use the returned `part`, not the whole-disk name.
18
+ - Stop when a required password is unavailable; do not assume a default.
19
+ - Prefer named commands. `storage request` rejects endpoints already covered by named commands.
20
+
21
+ ## Commands
22
+
23
+ ```bash
24
+ fnos-cli storage overview
25
+ fnos-cli storage pools
26
+ fnos-cli storage disks
27
+ fnos-cli storage free-disks
28
+ fnos-cli storage disk-info <disk>
29
+ fnos-cli storage disk-mount <disk> --yes
30
+ fnos-cli storage disk-umount <disk> --yes
31
+ fnos-cli storage smart <disk>
32
+ fnos-cli storage health <disk>
33
+ fnos-cli storage request stor.getConf --json '{"uuid":"trim_pool"}' --yes
34
+ ```
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: trim-system
3
+ description: Inspect static system identity, model, versions, volumes, hardware and power schedules, or reboot and power off a device.
4
+ ---
5
+
6
+ # System and power
7
+
8
+ Read `../reference/sysinfo.md` and `../reference/power.md`. Query the matching
9
+ `system` commands individually for hardware, volumes and power plans.
10
+
11
+ ## Rules
12
+
13
+ - Static identity/configuration belongs here; CPU and memory runtime metrics use `trim-monitor.md`.
14
+ - Named `system` commands are read-only; generic `system request` requires
15
+ confirmation or explicit `--yes` by default.
16
+ - `power reboot` / `power poweroff` interrupt services. Confirm the target and
17
+ user authorization before passing `--yes`.
18
+ - `system request` allows only `appcgi.sysinfo.*`; omit `req` and `reqid` from JSON.
19
+ - Generic requests authenticate with the saved session; sign in to the target first.
20
+ - Machine type and version fields vary with CLI/firmware. Treat current
21
+ `system info` output as authoritative; report unexpected or empty fields as
22
+ possible version differences rather than inventing values.
23
+
24
+ ## Commands
25
+
26
+ ```bash
27
+ fnos-cli system info
28
+ fnos-cli system trim-version
29
+ fnos-cli system kernel-version
30
+ fnos-cli system host-name
31
+ fnos-cli system machine-id
32
+ fnos-cli system uptime
33
+ fnos-cli system all-vols
34
+ fnos-cli system vols
35
+ fnos-cli system docker
36
+ fnos-cli system unix-time
37
+ fnos-cli system boot-on-power
38
+ fnos-cli system hardware
39
+ fnos-cli system reserved-partition
40
+ fnos-cli system is-trim-machine
41
+ fnos-cli system trim-feature
42
+ fnos-cli system fan-mode
43
+ fnos-cli system trim-disk
44
+ fnos-cli system time-setting --lang en-US
45
+ fnos-cli system timezone-list --lang en-US
46
+ fnos-cli system power-plan
47
+ fnos-cli system next-power-off-time
48
+ fnos-cli system power-plan-status
49
+ fnos-cli system power-on-seconds
50
+ fnos-cli system inited-timestamp
51
+ fnos-cli system request appcgi.sysinfo.getTrimVersion --yes
52
+ ```
53
+
54
+ ## Power operations
55
+
56
+ ```bash
57
+ fnos-cli power reboot --yes
58
+ fnos-cli power poweroff --yes
59
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: trim-user
3
+ description: Inspect users, groups, signed-in devices and current permissions, manage users, or choose the correct authenticated profile.
4
+ ---
5
+
6
+ # Users and permissions
7
+
8
+ Read `../reference/user.md` and `../reference/workflows/device-validation.md`.
9
+
10
+ ## Rules
11
+
12
+ - Most device operations require a signed-in session.
13
+ - Device validation uses only the current profile's OAuth session. Select a
14
+ different profile explicitly when switching identities.
15
+ - OAuth PKCE login leaves credentials and 2FA to the user; never construct
16
+ password, 2FA or manual access-token login commands.
17
+ - Production login is interactive: the user signs in and authorizes in the
18
+ browser, then pastes the one-time code into the CLI prompt.
19
+ - Unwrapped `user.*` endpoints use `user request`. User and signed-in-device
20
+ writes require confirmation by default; Agent writes explicitly pass `--yes`.
21
+
22
+ ## Commands
23
+
24
+ ```bash
25
+ fnos-cli --host <host> --port <port> login
26
+ fnos-cli logout
27
+ fnos-cli user request user.checkNewUser --json '{"user":"<new-user>"}' --yes
28
+ ```
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "fnos-cli",
3
+ "version": "0.2.0",
4
+ "description": "Use fnos-cli to sign in to and manage fnOS devices, including files, photos, applications, Docker, downloads, logs, monitoring, networking, storage, users, and Baidu Netdisk. Use when the user mentions fnOS, Feiniu OS, or a mainland China device. Excludes Media APIs and international-edition devices.",
5
+ "entry": "SKILL.md",
6
+ "bin": {
7
+ "darwin-arm64": "bin/trim-cli-darwin-arm64",
8
+ "darwin-x64": "bin/trim-cli-darwin-x64",
9
+ "linux-arm64": "bin/trim-cli-linux-arm64",
10
+ "linux-x64": "bin/trim-cli-linux-x64",
11
+ "windows-arm64": "bin/trim-cli-windows-arm64.exe",
12
+ "windows-x64": "bin/trim-cli-windows-x64.exe"
13
+ },
14
+ "reference": "reference/",
15
+ "entriesDir": "entries/",
16
+ "entries": [
17
+ "entries/trim-app.md",
18
+ "entries/trim-baidu-netdisk.md",
19
+ "entries/trim-docker.md",
20
+ "entries/trim-download.md",
21
+ "entries/trim-file.md",
22
+ "entries/trim-log.md",
23
+ "entries/trim-monitor.md",
24
+ "entries/trim-network.md",
25
+ "entries/trim-photos.md",
26
+ "entries/trim-shared.md",
27
+ "entries/trim-storage.md",
28
+ "entries/trim-system.md",
29
+ "entries/trim-user.md"
30
+ ],
31
+ "capabilities": [
32
+ "authentication",
33
+ "file-management",
34
+ "storage-management",
35
+ "docker-management",
36
+ "download-tasks",
37
+ "system-monitoring",
38
+ "network-management",
39
+ "user-management",
40
+ "photo-library",
41
+ "baidu-netdisk"
42
+ ]
43
+ }