@sriinnu/harmon 0.1.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 ADDED
@@ -0,0 +1,70 @@
1
+ # @sriinnu/harmon
2
+
3
+ ![logo](./logo.svg)
4
+
5
+ > Thin CLI and TypeScript client for controlling the Harmon daemon from the terminal.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ # Global CLI install
11
+ pnpm add -g @sriinnu/harmon
12
+
13
+ # Or run it without installing
14
+ pnpm dlx @sriinnu/harmon --help
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ # Start the daemon first
21
+ pnpm start:daemon
22
+
23
+ # If the daemon is protected
24
+ export HARMON_API_TOKEN="your_harmond_token"
25
+
26
+ # From an installed CLI
27
+ harmon --help
28
+ harmon status
29
+ harmon --provider spotify session start --mode focus
30
+
31
+ # From a repo checkout
32
+ pnpm --filter @sriinnu/harmon exec harmon --help
33
+ pnpm --filter @sriinnu/harmon exec harmon --provider youtube search song "late night focus"
34
+ ```
35
+
36
+ Browser-cookie auth import is safest against loopback or HTTPS daemon endpoints. When I am not running from a repo checkout, use `--cookie-path` or set `HARMON_SILO_HELPER` before `harmon auth import`.
37
+
38
+ ## Programmatic Use
39
+
40
+ ```typescript
41
+ import { createCLI, getDefaultEndpoint } from '@sriinnu/harmon';
42
+
43
+ const cli = createCLI({ endpoint: getDefaultEndpoint() });
44
+ const status = await cli.status();
45
+
46
+ await cli.command({
47
+ id: 'c_1',
48
+ ts: Date.now(),
49
+ source: { kind: 'cli', device: 'macos' },
50
+ type: 'session.start',
51
+ payload: { policy: { version: 1, provider: 'spotify', mode: 'focus' } },
52
+ });
53
+ ```
54
+
55
+ ## API Highlights
56
+
57
+ - `createCLI(config)`: create a typed daemon client
58
+ - `getDefaultEndpoint()`: resolve `HARMON_ENDPOINT` or `http://127.0.0.1:17373`
59
+ - `cli.status()`: read daemon and provider status
60
+ - `cli.command(cmd)`: send a typed command envelope
61
+ - `cli.spotifyPlay()` / `cli.applePlay()` / `cli.youtubePlay()`: provider play helpers
62
+ - `cli.youtubeNowPlaying()`: read daemon-managed YouTube browser-handoff state
63
+
64
+ ## Architecture
65
+
66
+ I am a stateless HTTP client over `harmond`. The TypeScript surface stays thin, and the CLI binary adds argument parsing, output formatting, and provider-aware ergonomics on top of the same daemon contract.
67
+
68
+ ## License
69
+
70
+ GNU Affero General Public License v3.0 only. See [LICENSE](../../LICENSE).
package/SKILL.md ADDED
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: harmon-cli
3
+ description: Thin HTTP client for controlling the harmon daemon from the terminal
4
+ capabilities:
5
+ - Play, pause, skip, and seek across Spotify and Apple Music via daemon endpoints
6
+ - Manage sessions (start, stop, nudge) and discover/switch playback devices
7
+ - Search music catalogs, handle OAuth login/logout, and import cookies
8
+ tags:
9
+ - cli
10
+ - terminal
11
+ - client
12
+ provider: harmon
13
+ version: 0.1.0
14
+ ---
15
+
16
+ # Harmon CLI
17
+
18
+ ## What this does
19
+ harmon-cli is a stateless HTTP client library that maps every harmond endpoint to a typed async method. It handles request timeouts via AbortController, auth headers, and JSON serialization. The CLI binary wraps this library with argument parsing and formatted terminal output, giving users full control over sessions, playback, search, and authentication from the command line.
20
+
21
+ ## When to use
22
+ - Controlling harmon playback (play/pause/next/prev) from a script or terminal
23
+ - Starting and managing music sessions with policy configuration
24
+ - Searching Spotify or Apple Music catalogs and managing OAuth flows programmatically
25
+
26
+ ## Key exports
27
+ - `createCLI` — factory that accepts `{ endpoint, token?, timeoutMs? }` and returns a client with all daemon methods
28
+
29
+ ## Example
30
+ ```typescript
31
+ import { createCLI, getDefaultEndpoint } from '@sriinnu/harmon';
32
+
33
+ const cli = createCLI({ endpoint: getDefaultEndpoint() });
34
+ await cli.status();
35
+ await cli.spotifyPlay({ uri: 'spotify:track:4uLU6hMCjMI75M1A2tKUQC' });
36
+ await cli.spotifyNext();
37
+ ```