@feralfile/cli 1.1.1

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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/config.json.example +96 -0
  4. package/dist/index.js +54 -0
  5. package/dist/src/ai-orchestrator/index.js +1019 -0
  6. package/dist/src/ai-orchestrator/registry.js +96 -0
  7. package/dist/src/commands/build.js +69 -0
  8. package/dist/src/commands/chat.js +189 -0
  9. package/dist/src/commands/config.js +68 -0
  10. package/dist/src/commands/device.js +278 -0
  11. package/dist/src/commands/helpers/config-files.js +62 -0
  12. package/dist/src/commands/helpers/device-discovery.js +111 -0
  13. package/dist/src/commands/helpers/playlist-display.js +161 -0
  14. package/dist/src/commands/helpers/prompt.js +65 -0
  15. package/dist/src/commands/helpers/ssh-helpers.js +44 -0
  16. package/dist/src/commands/play.js +110 -0
  17. package/dist/src/commands/publish.js +115 -0
  18. package/dist/src/commands/setup.js +225 -0
  19. package/dist/src/commands/sign.js +41 -0
  20. package/dist/src/commands/ssh.js +108 -0
  21. package/dist/src/commands/status.js +126 -0
  22. package/dist/src/commands/validate.js +18 -0
  23. package/dist/src/config.js +441 -0
  24. package/dist/src/intent-parser/index.js +1382 -0
  25. package/dist/src/intent-parser/utils.js +108 -0
  26. package/dist/src/logger.js +82 -0
  27. package/dist/src/main.js +459 -0
  28. package/dist/src/types.js +5 -0
  29. package/dist/src/utilities/address-validator.js +242 -0
  30. package/dist/src/utilities/device-default.js +36 -0
  31. package/dist/src/utilities/device-lookup.js +107 -0
  32. package/dist/src/utilities/device-normalize.js +62 -0
  33. package/dist/src/utilities/device-upsert.js +91 -0
  34. package/dist/src/utilities/domain-resolver.js +291 -0
  35. package/dist/src/utilities/ed25519-key-derive.js +155 -0
  36. package/dist/src/utilities/feed-fetcher.js +471 -0
  37. package/dist/src/utilities/ff1-compatibility.js +269 -0
  38. package/dist/src/utilities/ff1-device.js +250 -0
  39. package/dist/src/utilities/ff1-discovery.js +330 -0
  40. package/dist/src/utilities/functions.js +308 -0
  41. package/dist/src/utilities/index.js +469 -0
  42. package/dist/src/utilities/nft-indexer.js +1024 -0
  43. package/dist/src/utilities/playlist-builder.js +523 -0
  44. package/dist/src/utilities/playlist-publisher.js +131 -0
  45. package/dist/src/utilities/playlist-send.js +260 -0
  46. package/dist/src/utilities/playlist-signer.js +204 -0
  47. package/dist/src/utilities/playlist-signing-role.js +41 -0
  48. package/dist/src/utilities/playlist-source.js +128 -0
  49. package/dist/src/utilities/playlist-verifier.js +274 -0
  50. package/dist/src/utilities/ssh-access.js +145 -0
  51. package/dist/src/utils.js +48 -0
  52. package/docs/CONFIGURATION.md +206 -0
  53. package/docs/EXAMPLES.md +390 -0
  54. package/docs/FUNCTION_CALLING.md +96 -0
  55. package/docs/PROJECT_SPEC.md +228 -0
  56. package/docs/README.md +348 -0
  57. package/docs/RELEASING.md +73 -0
  58. package/package.json +76 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Feral File
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # ff-cli
2
+
3
+ A small Node.js CLI for building DP-1 playlists of digital art.
4
+
5
+ **Runtime:** Node.js 22 or newer (matches CI and the `dp1-js` dependency). That engine floor is a **breaking** change if you previously used Node 18 or 20—check the **GitHub Release** for the version you move to; release authors follow `docs/RELEASING.md` so the notes stay explicit.
6
+
7
+ ff-cli turns a simple prompt into a DP-1–conformant playlist you can preview on an Art Computer. The model orchestrates; deterministic tools do the real work (schema validation, indexing, JSON‑LD). If something comes back invalid, validation rejects it and we loop until it’s right.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm i -g @feralfile/cli
13
+ ```
14
+
15
+ ## Install (curl)
16
+
17
+ ```bash
18
+ curl -fsSL https://feralfile.com/ff-cli-install | bash
19
+ ```
20
+
21
+ Installs a prebuilt binary for macOS/Linux (no Node.js required).
22
+
23
+ ## One-off Usage (npx)
24
+
25
+ ```bash
26
+ npx @feralfile/cli setup
27
+ npx @feralfile/cli chat
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ **Set your LLM API key first (default Claude):** `export ANTHROPIC_API_KEY='sk-ant-your-api-key-here'`
33
+
34
+ ```bash
35
+ ff-cli setup
36
+ ff-cli chat
37
+ ff-cli play "https://example.com/video.mp4" --skip-verify
38
+ ```
39
+
40
+ If you need manual config actions instead of guided setup:
41
+
42
+ ```bash
43
+ ff-cli config init
44
+ ff-cli config validate
45
+ ```
46
+
47
+ ## Dev Quick Start
48
+
49
+ **Set your LLM API key first (default Claude):** `export ANTHROPIC_API_KEY='sk-ant-your-api-key-here'`
50
+
51
+ ```bash
52
+ npm ci
53
+ npm run dev -- setup
54
+ npm run dev -- chat
55
+ npm run dev -- play "https://example.com/video.mp4" --skip-verify
56
+ ```
57
+
58
+ ## Documentation
59
+
60
+ - Getting started and usage: `./docs/README.md`
61
+ - Configuration: `./docs/CONFIGURATION.md`
62
+ - Function calling architecture: `./docs/FUNCTION_CALLING.md`
63
+ - Examples: `./docs/EXAMPLES.md`
64
+ - SSH access: `ff-cli ssh enable|disable` in `./docs/README.md`
65
+
66
+ ## Verification
67
+
68
+ GitHub Actions runs `.github/workflows/ci.yml` for pull requests, pushes to `main`/`master`, and reusable `workflow_call` jobs. CI uses Node.js 22, installs dependencies with `npm ci`, sets `ANTHROPIC_API_KEY=dummy`, and runs the repo-wide verification entrypoint:
69
+
70
+ ```bash
71
+ ANTHROPIC_API_KEY=dummy npm run verify
72
+ ```
73
+
74
+ Run the same command locally before opening a PR. It checks formatting, lint, tests, TypeScript build, playlist validation smoke, and config validation smoke without mutating source files.
75
+
76
+ Other GitHub Actions workflows:
77
+
78
+ - `.github/workflows/build.yml` builds release assets when called by release automation or manually dispatched.
79
+ - `.github/workflows/release.yml` reuses CI, verifies the release version, publishes npm, uploads assets, and checks the published release.
80
+ - `.github/workflows/dependency-review.yml` reviews dependency changes on pull requests.
81
+ - `.github/workflows/codeql.yml` runs CodeQL analysis on pull requests and pushes to `main`/`master`.
82
+
83
+ ## Scripts
84
+
85
+ ```bash
86
+ npm run dev # Run CLI in dev (tsx)
87
+ npm run build # Build TypeScript
88
+ npm run check # Format check + lint + tests
89
+ npm run smoke # Build + CLI smoke checks
90
+ npm run verify # CI-equivalent validation entrypoint
91
+ npm run lint:fix # Optional mutating lint fix; review changes before committing
92
+ ```
93
+
94
+ ## License
95
+
96
+ MIT
@@ -0,0 +1,96 @@
1
+ {
2
+ "defaultModel": "claude",
3
+ "models": {
4
+ "claude": {
5
+ "apiKey": "YOUR_ANTHROPIC_API_KEY_FROM_CONSOLE_ANTHROPIC_COM",
6
+ "baseURL": "https://api.anthropic.com/v1/",
7
+ "model": "claude-sonnet-4-6",
8
+ "availableModels": [
9
+ "claude-opus-4-7",
10
+ "claude-sonnet-4-6",
11
+ "claude-haiku-4-5-20251001"
12
+ ],
13
+ "timeout": 30000,
14
+ "maxRetries": 3,
15
+ "temperature": 0.3,
16
+ "maxTokens": 4000,
17
+ "supportsFunctionCalling": true
18
+ },
19
+ "grok": {
20
+ "apiKey": "YOUR_GROK_API_KEY_FROM_X_AI_CONSOLE",
21
+ "baseURL": "https://api.x.ai/v1",
22
+ "model": "grok-beta",
23
+ "availableModels": [
24
+ "grok-beta",
25
+ "grok-2-1212",
26
+ "grok-2-vision-1212"
27
+ ],
28
+ "timeout": 120000,
29
+ "maxRetries": 3,
30
+ "temperature": 0.3,
31
+ "maxTokens": 4000,
32
+ "supportsFunctionCalling": true
33
+ },
34
+ "gpt": {
35
+ "apiKey": "YOUR_OPENAI_API_KEY_FROM_PLATFORM_OPENAI_COM",
36
+ "baseURL": "https://api.openai.com/v1",
37
+ "model": "gpt-4.1",
38
+ "availableModels": [
39
+ "gpt-4.1",
40
+ "gpt-4.1-mini",
41
+ "gpt-4o",
42
+ "gpt-4o-mini",
43
+ "gpt-4-turbo"
44
+ ],
45
+ "timeout": 30000,
46
+ "maxRetries": 3,
47
+ "temperature": 1,
48
+ "maxTokens": 4000,
49
+ "supportsFunctionCalling": true
50
+ },
51
+ "gemini": {
52
+ "apiKey": "YOUR_GOOGLE_AI_STUDIO_API_KEY_FROM_AISTUDIO_GOOGLE_COM",
53
+ "baseURL": "https://generativelanguage.googleapis.com/v1beta/openai/",
54
+ "model": "gemini-2.5-flash",
55
+ "availableModels": [
56
+ "gemini-2.5-flash-lite",
57
+ "gemini-2.5-flash",
58
+ "gemini-flash-lite-latest"
59
+ ],
60
+ "timeout": 30000,
61
+ "maxRetries": 3,
62
+ "temperature": 0.3,
63
+ "maxTokens": 4000,
64
+ "supportsFunctionCalling": true
65
+ }
66
+ },
67
+ "defaultDuration": 10,
68
+ "browser": {
69
+ "timeout": 90000,
70
+ "sanitizationLevel": "medium"
71
+ },
72
+ "feedServers": [
73
+ {
74
+ "baseUrl": "https://dp1-feed-operator-api-prod.autonomy-system.workers.dev/api/v1",
75
+ "apiKey": "YOUR_FEED_SERVER_API_KEY_OPTIONAL"
76
+ },
77
+ {
78
+ "baseUrl": "http://localhost:8787",
79
+ "apiKey": "YOUR_FEED_SERVER_API_KEY_OPTIONAL"
80
+ }
81
+ ],
82
+ "playlist": {
83
+ "privateKey": "YOUR_ED25519_PRIVATE_KEY_BASE64_OR_HEX",
84
+ "role": "agent"
85
+ },
86
+ "ff1Devices": {
87
+ "devices": [
88
+ {
89
+ "name": "DISPLAY_NAME_FOR_YOUR_FF1_DEVICE",
90
+ "host": "http://YOUR_FF1_IP_ADDRESS:1111",
91
+ "apiKey": "YOUR_FF1_DEVICE_API_KEY_FROM_DEVICE_SETTINGS",
92
+ "topicID": "YOUR_FF1_DEVICE_TOPIC_ID_FROM_DEVICE_SETTINGS"
93
+ }
94
+ ]
95
+ }
96
+ }
package/dist/index.js ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ // Suppress punycode deprecation warnings from dependencies.
5
+ process.on('warning', (warning) => {
6
+ if (warning.name === 'DeprecationWarning' && warning.message.includes('punycode')) {
7
+ return;
8
+ }
9
+ console.warn(warning.name + ': ' + warning.message);
10
+ });
11
+ require("dotenv/config");
12
+ const commander_1 = require("commander");
13
+ const fs_1 = require("fs");
14
+ const path_1 = require("path");
15
+ const setup_1 = require("./src/commands/setup");
16
+ const status_1 = require("./src/commands/status");
17
+ const chat_1 = require("./src/commands/chat");
18
+ const validate_1 = require("./src/commands/validate");
19
+ const sign_1 = require("./src/commands/sign");
20
+ const play_1 = require("./src/commands/play");
21
+ const publish_1 = require("./src/commands/publish");
22
+ const build_1 = require("./src/commands/build");
23
+ const config_1 = require("./src/commands/config");
24
+ const ssh_1 = require("./src/commands/ssh");
25
+ const device_1 = require("./src/commands/device");
26
+ // Load version from package.json. Try the built location first
27
+ // (dist/index.js -> ../package.json) and fall back to dev (./package.json).
28
+ let packageJsonPath = (0, path_1.resolve)((0, path_1.dirname)(__filename), '..', 'package.json');
29
+ try {
30
+ (0, fs_1.readFileSync)(packageJsonPath, 'utf8');
31
+ }
32
+ catch {
33
+ packageJsonPath = (0, path_1.resolve)((0, path_1.dirname)(__filename), 'package.json');
34
+ }
35
+ const { version: packageVersion } = JSON.parse((0, fs_1.readFileSync)(packageJsonPath, 'utf8'));
36
+ const program = new commander_1.Command();
37
+ program
38
+ .name('ff-cli')
39
+ .description('CLI for building DP-1 playlists of digital art using AI (Claude, Grok, ChatGPT, Gemini)')
40
+ .version(packageVersion)
41
+ .addHelpText('after', `\nQuick start:\n 1) ff-cli setup\n 2) ff-cli chat\n\nDocs: https://github.com/feral-file/ff-cli\n`);
42
+ program.addCommand(setup_1.setupCommand);
43
+ program.addCommand(status_1.statusCommand);
44
+ program.addCommand(chat_1.chatCommand);
45
+ program.addCommand(validate_1.verifyCommand);
46
+ program.addCommand(validate_1.validateCommand);
47
+ program.addCommand(sign_1.signCommand);
48
+ program.addCommand(play_1.playCommand);
49
+ program.addCommand(publish_1.publishCommand);
50
+ program.addCommand(build_1.buildCommand);
51
+ program.addCommand(config_1.configCommand);
52
+ program.addCommand(ssh_1.sshCommand);
53
+ program.addCommand(device_1.deviceCommand);
54
+ program.parse();