neodrop-cli 1.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/LICENSE +21 -0
- package/README.md +77 -0
- package/SKILL.md +84 -0
- package/bin/neodrop.mjs +629 -0
- package/lib/api.mjs +104 -0
- package/lib/credentials.mjs +58 -0
- package/lib/install-skill.mjs +42 -0
- package/lib/origins.mjs +32 -0
- package/lib/output.mjs +19 -0
- package/lib/web-urls.mjs +30 -0
- package/package.json +36 -0
- package/references/auth.md +84 -0
- package/references/commands.md +74 -0
- package/references/troubleshooting.md +37 -0
- package/references/url-routing.md +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Neodrop AI
|
|
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,77 @@
|
|
|
1
|
+
# neodrop-cli
|
|
2
|
+
|
|
3
|
+
> Operate the [Neodrop](https://neodrop.ai) platform **as yourself** from the command line — built to be driven by an AI agent (Claude Code / Cursor / Codex), usable by hand. Every `stdout` is valid JSON.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/neodrop-cli)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
|
|
9
|
+
`neodrop-cli` calls the Neodrop API **as the currently logged-in user** — browse and search channels, read posts, manage subscriptions, and create channels. It handles auth, JSON serialization, error codes and locale defaults for you, so an agent never has to hand-roll HTTP.
|
|
10
|
+
|
|
11
|
+
## Install & run
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Recommended — no install, npx fetches it on demand (Node 18+)
|
|
15
|
+
npx neodrop-cli <command>
|
|
16
|
+
|
|
17
|
+
# Or install globally, then call the `neodrop` bin directly
|
|
18
|
+
npm i -g neodrop-cli
|
|
19
|
+
neodrop <command>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx neodrop-cli login # prints a neodrop.ai/cli-auth URL — open it, approve, done
|
|
26
|
+
npx neodrop-cli me # who am I
|
|
27
|
+
npx neodrop-cli feed # latest from the channels you subscribe to
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`login` prints a `https://neodrop.ai/cli-auth?session=…` URL. Open it in **any** browser (this machine, your phone, another laptop), sign in, confirm the client on the consent page, and the CLI detects approval by polling and writes a Personal Access Token to `~/.neodrop/credentials.json` (`chmod 0600`).
|
|
31
|
+
|
|
32
|
+
No browser is auto-launched, no local port is opened, no callback is needed — so the same command works over SSH, in a cloud sandbox, or inside a Docker container, as long as the terminal can print a URL.
|
|
33
|
+
|
|
34
|
+
## Output contract
|
|
35
|
+
|
|
36
|
+
- **`stdout` is always valid JSON** — parse it directly (`JSON.parse` / `json.loads`). Add `--pretty` for indented JSON; both are valid.
|
|
37
|
+
- **`stderr`** carries human-readable logs, progress, error descriptions, and canonical `🔗 <url>` links — ignore it unless a command fails.
|
|
38
|
+
- **Exit codes**: `0` success · `1` business error (auth / not found / rejected input) · `2` usage error (bad CLI arguments).
|
|
39
|
+
|
|
40
|
+
## Commands
|
|
41
|
+
|
|
42
|
+
| Area | Commands |
|
|
43
|
+
|---|---|
|
|
44
|
+
| Identity | `me` · `whoami` · `tokens list` |
|
|
45
|
+
| Channels | `channels list` · `get` · `search` · `create` · `subscribe` · `unsubscribe` · `categories` · `by-category` |
|
|
46
|
+
| Posts | `posts list` · `get` · `search` · `feed` |
|
|
47
|
+
| Raw procedure | `api <procedure> [--json '…' \| --stdin] [--mutation]` |
|
|
48
|
+
|
|
49
|
+
Full command reference: [`references/commands.md`](https://github.com/NeoDropAI/neodrop-skills/blob/main/skills/neodrop-cli/references/commands.md).
|
|
50
|
+
|
|
51
|
+
## Use as an AI-agent skill
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx neodrop-cli install-skill
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Copies the skill definition into `~/.claude/skills/neodrop-cli/` so an agent routes Neodrop requests to this CLI automatically. The agent-facing routing doc lives in [`SKILL.md`](https://github.com/NeoDropAI/neodrop-skills/blob/main/skills/neodrop-cli/SKILL.md).
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
- [Auth & security model](https://github.com/NeoDropAI/neodrop-skills/blob/main/skills/neodrop-cli/references/auth.md) — full login flow, reusing credentials across machines, self-hosting
|
|
62
|
+
- [Command reference](https://github.com/NeoDropAI/neodrop-skills/blob/main/skills/neodrop-cli/references/commands.md)
|
|
63
|
+
- [URL routing](https://github.com/NeoDropAI/neodrop-skills/blob/main/skills/neodrop-cli/references/url-routing.md) — map a pasted Neodrop link to the right command
|
|
64
|
+
- [Troubleshooting](https://github.com/NeoDropAI/neodrop-skills/blob/main/skills/neodrop-cli/references/troubleshooting.md) — error codes
|
|
65
|
+
|
|
66
|
+
## Environment variables
|
|
67
|
+
|
|
68
|
+
| Variable | Purpose | Default |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `NEODROP_SERVER` | Web origin used by `login` | `https://neodrop.ai` |
|
|
71
|
+
| `NEODROP_API` | API origin used by `login` | Inferred from `NEODROP_SERVER` |
|
|
72
|
+
|
|
73
|
+
Credentials persist `webOrigin` / `apiOrigin`, so every other command reads them from the credential file — you don't pass them each time.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
[MIT](./LICENSE)
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: neodrop-cli
|
|
3
|
+
version: 1.1.0
|
|
4
|
+
tested_with:
|
|
5
|
+
neodrop_api: "2026-06"
|
|
6
|
+
node: ">=18"
|
|
7
|
+
description: Operate the Neodrop platform (neodrop.ai) as the current user — create channels, subscribe / unsubscribe, search public channels and content, browse categories, list your own channels, and read post details. Trigger this skill whenever the user mentions Neodrop or neodrop.ai, "my channels" / "what am I subscribed to", "post" / "posts" (Neodrop's content units — also called "grain" / "grains", the legacy name), "create a channel" / "subscribe to this channel" / "search channels", public content / public feed / subscribed feed — or the same intent in any language. Always call `npx neodrop-cli <command>`; do NOT use fetch / curl / hand-rolled HTTP — this skill already handles auth, JSON serialization, error codes and locale defaults.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# neodrop-cli skill
|
|
11
|
+
|
|
12
|
+
Call the Neodrop platform API **as the currently logged-in user** via `npx neodrop-cli`. Auth uses a PAT (Personal Access Token) stored at `~/.neodrop/credentials.json` (`chmod 0600`).
|
|
13
|
+
|
|
14
|
+
## How to invoke
|
|
15
|
+
|
|
16
|
+
The CLI ships as the npm package `neodrop-cli`. Commands below are written as `neodrop <command>`; actually invoke them as:
|
|
17
|
+
|
|
18
|
+
- Default: `npx neodrop-cli <command>` (no pre-install needed; npx fetches it automatically; requires Node 18+)
|
|
19
|
+
- Explicit package + bin form: `npx -p neodrop-cli neodrop <command>`
|
|
20
|
+
- If globally installed (`npm i -g neodrop-cli`): `neodrop <command>` directly
|
|
21
|
+
|
|
22
|
+
First time wiring up an agent: `npx neodrop-cli install-skill` copies this SKILL.md + references into `~/.claude/skills/neodrop-cli/` so the agent routes to this skill.
|
|
23
|
+
|
|
24
|
+
## Output contract
|
|
25
|
+
|
|
26
|
+
- `stdout` is **always valid JSON** — parse it directly with `JSON.parse` / `json.loads`.
|
|
27
|
+
- `stderr` carries human-readable logs, progress and error descriptions — usually ignore it unless a command fails and needs explaining.
|
|
28
|
+
- Exit codes: `0` success / `1` business error (auth / not found / input rejected by backend) / `2` usage error (wrong CLI arguments).
|
|
29
|
+
|
|
30
|
+
`stdout` defaults to single-line JSON; add `--pretty` for indented JSON — both are valid JSON.
|
|
31
|
+
|
|
32
|
+
## When to use / when not to
|
|
33
|
+
|
|
34
|
+
| Use it | Don't |
|
|
35
|
+
|---|---|
|
|
36
|
+
| User asks "what channels am I subscribed to" / "what's new in my channels" | The content is a regular web page (not a Neodrop channel / post) |
|
|
37
|
+
| User wants to view or create a Neodrop channel ("build me a channel tracking the AI industry") | The content is already pasted in the conversation — no API call needed |
|
|
38
|
+
| User shares a Neodrop link and wants details | Debugging/analyzing the Neodrop backend itself (use ops tools like `lark-cli`) |
|
|
39
|
+
| User asks whether the public pool has a channel on some topic | Creating many objects at once (the CLI is one call per invocation — think before looping) |
|
|
40
|
+
|
|
41
|
+
**Don't proactively push Neodrop in general chat** — only call it when the user explicitly hits the left-column scenarios above.
|
|
42
|
+
|
|
43
|
+
## First run: log in
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx neodrop-cli login
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The CLI prints a `https://neodrop.ai/cli-auth?session=…` URL → the user opens it in **any** browser (same machine / phone / another laptop) → signs in → confirms the client name on the consent page → approves → the CLI detects it by polling → writes the credential to `~/.neodrop/credentials.json` (`chmod 0600`).
|
|
50
|
+
|
|
51
|
+
**No browser is auto-launched, no local port is opened, no callback is needed** — the same command works on this machine / SSH / cloud sandbox / Docker container, as long as the terminal can print a URL and the user has any browser.
|
|
52
|
+
|
|
53
|
+
Full flow + security model + reusing credentials across machines: [`references/auth.md`](references/auth.md).
|
|
54
|
+
|
|
55
|
+
**On "not logged in" / `[UNAUTHORIZED]`**: tell the user to run `npx neodrop-cli login`. **Do NOT try to log in yourself** — it requires the user to act in a browser.
|
|
56
|
+
|
|
57
|
+
## Command routing (by scenario)
|
|
58
|
+
|
|
59
|
+
| Scenario | Command | Details |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| Current user / token | `me` / `whoami` / `tokens list` | [`references/commands.md#identity`](references/commands.md#identity) |
|
|
62
|
+
| View / search / create / subscribe channels | `channels list/get/search/create/subscribe/unsubscribe`, `channels categories`, `channels by-category` | [`references/commands.md#channels`](references/commands.md#channels) |
|
|
63
|
+
| View / search post content | `posts list/get/search`, `feed` | [`references/commands.md#posts`](references/commands.md#posts) |
|
|
64
|
+
| A procedure with no sugar command | `api <procedure> [--json '…' \| --stdin] [--mutation]` | [`references/commands.md#api`](references/commands.md#api) |
|
|
65
|
+
| User pasted a Neodrop URL and wants details | Map URL → id, call the matching `get` command | [`references/url-routing.md`](references/url-routing.md) |
|
|
66
|
+
| Failure / error | Read the error code on stderr | [`references/troubleshooting.md`](references/troubleshooting.md) |
|
|
67
|
+
|
|
68
|
+
## Hard rules for the AI
|
|
69
|
+
|
|
70
|
+
- **De-dupe before creating a channel**: run `channels list --mine` to check you don't already own one on the topic, then `channels search` against the public pool for a same-name channel — avoid duplicates.
|
|
71
|
+
- **`channels get <id>` before subscribing** to check locale / private / topic — don't subscribe blindly.
|
|
72
|
+
- **Never hand-craft links from memory** — `posts get` / `channels get` / `me` already print `🔗 <canonical-url>` to stderr; use that line.
|
|
73
|
+
- **`api` defaults to a GET query** — write operations MUST add `--mutation` explicitly, or the backend rejects them.
|
|
74
|
+
|
|
75
|
+
## Environment variables
|
|
76
|
+
|
|
77
|
+
| Variable | Purpose | Default |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `NEODROP_SERVER` | Web origin used by `login` (product domain) | `https://neodrop.ai` |
|
|
80
|
+
| `NEODROP_API` | API origin used by `login` (backend domain) | Inferred from `NEODROP_SERVER` (prod → `api.neodrop.ai`; `localhost:4001` → `localhost:3001`) |
|
|
81
|
+
|
|
82
|
+
Credentials store both `webOrigin` / `apiOrigin`; all commands read them from the credential file, so you don't pass them each time.
|
|
83
|
+
|
|
84
|
+
Private deployment / self-host: [`references/auth.md#self-hosting`](references/auth.md#self-hosting).
|