@plot-app/cli 0.0.1 → 0.0.3

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/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Plot CLI Changelog
2
+
3
+ ## 0.0.3 - 2026-04-29
4
+
5
+ **Commands**
6
+
7
+ - Auth: login flow with credential storage, `whoami` (fixed)
8
+ - Tasks: full CRUD
9
+ - Read commands for projects, docs, collections, teams, statuses, labels, and
10
+ users
11
+ - `activity`, `inbox`, `search`, and `comments` commands
12
+ - Workspace commands and batch operations
13
+ - `user combined-members` command
14
+
15
+ **Workflow**
16
+
17
+ - Context defaults integrated across commands so workspace/team/project flags
18
+ can be inferred
19
+ - Daemon runtime with scope-aware activity and Zero `byIds` queries for faster
20
+ lookups
21
+
22
+ **UX**
23
+
24
+ - New Flexoki color theme
25
+ - UX polish across agent and interactive flows
26
+
27
+ **Fixes**
28
+
29
+ - `whoami` error resolved
package/README.md CHANGED
@@ -1,33 +1,291 @@
1
1
  # Plot CLI
2
2
 
3
- Programmatic access to Plot workspaces for agents.
3
+ Programmatic access to Plot workspaces for agents. The CLI is built around stable handles and JSON output so coding agents can inspect and update Plot data without scraping the web app.
4
4
 
5
- ## Install
5
+ ## Agent Quick Start
6
6
 
7
7
  ```bash
8
- npm install -g @plot-app/cli
8
+ # Authenticate. Use OAuth for an interactive shell, or a PAT for headless agents.
9
9
  plot login
10
+ plot login --token "$PLOT_API_TOKEN"
11
+
12
+ # Confirm identity and choose a workspace.
13
+ plot whoami
14
+ plot workspace list --format json
15
+ plot workspace use scalespark-media --format json
16
+
17
+ # Pull orientation data before changing work.
18
+ plot workspace info --format json
19
+ plot commands --format json
20
+ plot help identifiers
21
+ ```
22
+
23
+ ## Agent Operating Contract
24
+
25
+ - Prefer `--format json`. It is the default for most commands and is the safest shape for agents to parse.
26
+ - Run `plot commands --format json` when you need the current command manifest.
27
+ - Run `plot help identifiers` before resolving copied Plot URLs or user-provided handles.
28
+ - Prefer handles over UUIDs: task `pathId` (`ENG-042`), team `publicId` (`ENG`), project/document slug or trailing `publicId`, collection slug, and user `@username`.
29
+ - Switch workspaces explicitly with `plot workspace use <slug>` when a copied URL contains a different workspace slug.
30
+ - Batch dependent writes through `plot batch` or `plot task create-tree` to reduce round trips and keep outputs machine-readable.
31
+ - Treat every non-zero exit as structured failure. The CLI writes errors as JSON with `error`, `code`, `message`, and (when applicable) a `hint` describing the next step an agent can take.
32
+ - Pass `--quiet` to suppress spinners and progress messages — stdout will only contain the formatted result.
33
+ - In CI or tight automation loops, set `PLOT_CLI_SKIP_UPDATE_CHECK=1` to suppress the background self-update check and keep the per-invocation overhead minimal.
34
+
35
+ ## Requirements
36
+
37
+ - The `plot` binary installed and available on `PATH`.
38
+ - A Plot account with access to the workspace you want to inspect or update.
39
+ - Network access to Plot.
40
+ - For headless agents, a Plot Personal Access Token.
41
+
42
+ End users do not need Bun, pnpm, Node.js, repository source code, or internal service configuration.
43
+
44
+ ## Authentication
45
+
46
+ ```bash
47
+ plot login # OAuth with local callback on 127.0.0.1:7568-7578
48
+ plot login --token "$PLOT_API_TOKEN"
49
+ plot whoami
50
+ plot auth status --format json
51
+ plot logout
52
+ ```
53
+
54
+ Credentials are stored locally by the CLI. Use `plot logout` to remove the active workspace credentials.
55
+
56
+ ## Common Workflows
57
+
58
+ ### Orient In A Workspace
59
+
60
+ ```bash
61
+ plot workspace info --format json
62
+ plot team list --format json
63
+ plot user list --format json
64
+ plot search "launch checklist" --format json
65
+ ```
66
+
67
+ ### Inspect And Update Tasks
68
+
69
+ ```bash
70
+ plot task list --team ENG --limit 20 --format json
71
+ plot task list --parent none --limit 20 --format json # only top-level (non-subtask) tasks
72
+ plot task list --parent ENG-042 --format json # subtasks of ENG-042
73
+ plot task get ENG-042 --format json
74
+ plot task update ENG-042 --status-id status_done --format json
75
+ plot task update ENG-042 --add-labels label_abc,label_def --format json
76
+ plot task update ENG-042 --remove-labels label_xyz --format json
77
+ plot task update ENG-042 --set-labels label_abc,label_def --format json # replace label set; pass "" to clear
78
+ plot comment add --task-id ENG-042 --body "Implemented and verified." --format json
79
+ ```
80
+
81
+ `task update` label semantics: `--add-labels` appends, `--remove-labels` detaches, `--set-labels` replaces the full set. `--add-labels`/`--remove-labels` can be combined; `--set-labels` cannot be combined with the other two. `--labels` is kept as a back-compat alias for `--add-labels`.
82
+
83
+ ### Create A Task With Dependencies
84
+
85
+ ```bash
86
+ plot task create \
87
+ --name "Write checkout regression tests" \
88
+ --team-id ENG \
89
+ --project-id checkout-redesign-a1b2c3d4e5f6 \
90
+ --blocked-by ENG-041 \
91
+ --format json
92
+ ```
93
+
94
+ `task create` is all-or-nothing: if any subsequent step (label add, dependency wiring, status/priority patch) fails, the created task is rolled back so the workspace is left without orphaned partial state.
95
+
96
+ ### Create A Parent Task Tree
97
+
98
+ ```bash
99
+ cat <<'JSON' | plot task create-tree --format json
100
+ {
101
+ "name": "Ship checkout polish",
102
+ "teamId": "ENG",
103
+ "projectId": "checkout-redesign-a1b2c3d4e5f6",
104
+ "subtasks": [
105
+ { "name": "Fix empty state", "ref": "empty-state" },
106
+ { "name": "Add regression coverage", "blockedBy": ["@empty-state"] }
107
+ ]
108
+ }
109
+ JSON
110
+ ```
111
+
112
+ `create-tree` supports one level of subtasks. Subtasks inherit `teamId`, `projectId`, `assigneeId`, and `visibility` unless overridden.
113
+
114
+ ### Batch Commands
115
+
116
+ `plot batch` reads a JSON array from stdin and executes entries sequentially.
117
+
118
+ ```bash
119
+ cat <<'JSON' | plot batch
120
+ [
121
+ {
122
+ "command": "task",
123
+ "action": "create",
124
+ "args": {
125
+ "name": "Triage checkout logs",
126
+ "teamId": "ENG"
127
+ }
128
+ },
129
+ {
130
+ "command": "task",
131
+ "action": "list",
132
+ "args": {
133
+ "team": "ENG",
134
+ "limit": 5
135
+ }
136
+ }
137
+ ]
138
+ JSON
10
139
  ```
11
140
 
12
- This public npm package contains compiled Plot CLI executables and a small
13
- launcher. It does not include the Plot CLI TypeScript source, tests, monorepo
14
- configuration, local credentials, or environment files.
141
+ Supported batch keys: `task.create`, `task.update`, `task.delete`, `task.get`, `task.list`, and `project.update`.
15
142
 
16
- Supported platforms:
143
+ ## Commands
17
144
 
18
- - macOS arm64
19
- - macOS x64
20
- - Linux arm64
21
- - Linux x64
145
+ Run `plot <command> --help` for command-specific options.
22
146
 
23
- The CLI stores user credentials locally after `plot login`. No Plot API token
24
- or OAuth credential is embedded in this package.
147
+ | Command | Purpose |
148
+ | --- | --- |
149
+ | `login`, `auth login` | Authenticate with OAuth or `--token`. |
150
+ | `logout`, `auth logout` | Remove stored credentials. |
151
+ | `whoami`, `auth whoami` | Print current user and workspace. |
152
+ | `auth status` | Show active workspace and credential storage status. |
153
+ | `workspace list` | List authenticated workspaces. |
154
+ | `workspace use <slug>` | Set the active workspace. |
155
+ | `workspace info` | Print workspace orientation data. |
156
+ | `task list` | List recent tasks with filters. |
157
+ | `task get <id>` | Get task details with hydrated relations. |
158
+ | `task create` | Create a task. |
159
+ | `task create-tree` | Create a parent task with subtasks and dependencies. |
160
+ | `task update <id>` | Update mutable task fields. |
161
+ | `task delete <id>` | Soft-delete a task. |
162
+ | `task add-dependency` | Mark one task as blocked by another. |
163
+ | `task remove-dependency` | Remove a blocking relationship. |
164
+ | `task set-parent <id>` | Convert a task into a subtask. |
165
+ | `task remove-parent <id>` | Promote a subtask back to a top-level task. |
166
+ | `project list` | List projects. |
167
+ | `project get <id>` | Get project details. |
168
+ | `project summary <id>` | Print project health. |
169
+ | `doc list`, `doc get`, `doc create`, `doc update` | Read and mutate documents. |
170
+ | `collection list`, `collection get`, `collection create`, `collection update` | Read and mutate collections. |
171
+ | `team list`, `team get <id>` | List and inspect teams. |
172
+ | `task-status list --team-id <id>` | List valid task statuses for a team. |
173
+ | `label list --team-id <id>` | List task labels for a team. |
174
+ | `user list`, `user get <id>`, `user by-team <team-id>` | Discover users. |
175
+ | `user combined-members` | List users with access across projects, teams, and/or a task. |
176
+ | `activity list` | List activity feed entries. |
177
+ | `inbox list`, `inbox read <id>`, `inbox archive <id>` | Read and manage notifications. |
178
+ | `search <query>` | Search tasks, projects, documents, teams, and users. |
179
+ | `comment list`, `comment add` | List or add comments on tasks and projects. |
180
+ | `batch` | Execute a JSON command array from stdin. |
181
+ | `commands` | Print the machine-readable command manifest. |
182
+ | `help identifiers` | Print handle and URL parsing conventions. |
25
183
 
26
- ## Updates
184
+ ## Identifiers
185
+
186
+ Use the shortest stable handle the CLI accepts.
187
+
188
+ | Entity | Preferred handle | Example |
189
+ | --- | --- | --- |
190
+ | Task | `pathId` | `ENG-042` |
191
+ | Team | `publicId` | `ENG` |
192
+ | Project | slug or trailing `publicId` | `checkout-redesign-a1b2c3d4e5f6` |
193
+ | Document | slug or trailing `publicId` | `launch-checklist-78utu4m1d7iz` |
194
+ | Collection | slug | `growth` |
195
+ | User | `@username` | `@abraham` |
196
+
197
+ Copied Plot URLs follow:
198
+
199
+ ```text
200
+ https://go.plot.app/{workspaceSlug}/{entityType}/{identifier}/{optionalContext}
201
+ ```
202
+
203
+ Extract the workspace slug first. If it differs from the active workspace, run `plot workspace use <workspaceSlug>`.
204
+
205
+ ## Output And Errors
206
+
207
+ Most commands accept `--format json` or `--format markdown`. JSON is the default.
208
+
209
+ ### List Envelope
210
+
211
+ Every list command (e.g., `task list`, `project list`, `team list`, `doc list`, `collection list`, `user list`, `inbox list`, `comment list`, `activity list`, `search`) returns the same pagination envelope shape in JSON:
212
+
213
+ ```json
214
+ {
215
+ "<itemsKey>": [...],
216
+ "count": 3,
217
+ "startAt": 0,
218
+ "limit": 20,
219
+ "hasMore": false,
220
+ "nextStartAt": null
221
+ }
222
+ ```
223
+
224
+ The `<itemsKey>` is the plural entity name (`tasks`, `projects`, `teams`, `documents`, `collections`, `users`, `notifications`, `comments`, `entries`, `results`). Markdown output renders each item, then a footer line:
225
+
226
+ ```text
227
+ _count: 3, startAt: 0, limit: 20, hasMore: false_
228
+ ```
229
+
230
+ Empty lists still render the footer.
231
+
232
+ ### Quiet Mode
233
+
234
+ Pass `--quiet` (or `-q`) to suppress spinners and progress messages on any data-loading command. Stdout will only contain the formatted result, which lets agents pipe `--format json --quiet` directly into a JSON parser without filtering chrome.
235
+
236
+ Errors are structured. When the failure is recoverable, an optional `hint` field describes the concrete next step an agent should take.
237
+
238
+ ```json
239
+ {
240
+ "error": true,
241
+ "code": "AUTH_REQUIRED",
242
+ "message": "No active workspace. Run `plot login` to authenticate.",
243
+ "hint": "Run 'plot login' to authenticate."
244
+ }
245
+ ```
246
+
247
+ ```json
248
+ {
249
+ "error": true,
250
+ "code": "NOT_FOUND",
251
+ "message": "Task \"NOPE-999\" not found.",
252
+ "hint": "Run 'plot help identifiers' for handle formats, or 'plot task list' to discover ids."
253
+ }
254
+ ```
255
+
256
+ The `hint` field is optional. Agents should prefer it when present, but fall back to `code` + `message` for branching.
257
+
258
+ Error code groups:
259
+
260
+ | Exit | Meaning |
261
+ | --- | --- |
262
+ | `1` | Validation, not found, forbidden, not implemented, or unknown failure. |
263
+ | `2` | Authentication required or expired. |
264
+ | `3` | Network or sync failure. |
265
+
266
+ ## Runtime Notes
267
+
268
+ The CLI manages its own local runtime state. The first data command after login may take longer while Plot data is prepared locally; later commands should be faster.
269
+
270
+ Use these commands when a session appears stale:
271
+
272
+ ```bash
273
+ plot auth status --format json
274
+ plot logout
275
+ plot login
276
+ ```
277
+
278
+ ### Self-Update Behavior
279
+
280
+ The CLI checks for new releases at most once per day in the background, on a best-effort basis (failures are silent and never block the current command). To force an immediate check and install the latest release, run:
27
281
 
28
282
  ```bash
29
283
  plot update
30
284
  ```
31
285
 
32
- The launcher also checks npm for updates on first run and then at most once per
33
- day. Set `PLOT_CLI_SKIP_UPDATE_CHECK=1` to disable automatic checks.
286
+ In CI or batch automation loops, set `PLOT_CLI_SKIP_UPDATE_CHECK=1` to suppress the background check entirely.
287
+
288
+ ## Security Notes
289
+
290
+ - Personal access tokens and OAuth credentials grant access to Plot workspace data. Do not paste them into prompts, logs, comments, or issues.
291
+ - `plot help identifiers` prints URL parsing examples. Check copied links before sharing output externally.
package/bin/plot.js CHANGED
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  const { spawnSync } = require('node:child_process');
3
- const { mkdirSync, readFileSync, writeFileSync } = require('node:fs');
4
- const { homedir } = require('node:os');
5
- const { dirname, join } = require('node:path');
6
3
 
7
- const packageName = '@plot-app/cli';
8
- const currentVersion = '0.0.1';
9
- const updateIntervalMs = 24 * 60 * 60 * 1000;
10
4
  const key = `${process.platform}-${process.arch}`;
11
5
  const packages = {
12
6
  'darwin-arm64': '@plot-app/cli-darwin-arm64',
@@ -15,110 +9,36 @@ const packages = {
15
9
  'linux-x64': '@plot-app/cli-linux-x64',
16
10
  };
17
11
  const binaryPackageName = packages[key];
18
- const updateStatePath = join(homedir(), '.plot', 'update-check.json');
19
12
 
20
- const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
21
-
22
- const readLastUpdateCheck = () => {
23
- try {
24
- return JSON.parse(readFileSync(updateStatePath, 'utf8')).checkedAt ?? 0;
25
- } catch (error) {
26
- return 0;
27
- }
13
+ const writeError = (message) => {
14
+ process.stderr.write(`${message}\n`);
28
15
  };
29
16
 
30
- const writeLastUpdateCheck = () => {
17
+ if (!binaryPackageName) {
18
+ writeError(`Plot CLI does not ship a binary for ${key}.`);
19
+ process.exit(1);
20
+ }
21
+
22
+ const resolveBinary = () => {
31
23
  try {
32
- mkdirSync(dirname(updateStatePath), { recursive: true });
33
- writeFileSync(updateStatePath, JSON.stringify({ checkedAt: Date.now() }));
24
+ return require.resolve(binaryPackageName);
34
25
  } catch (error) {
26
+ writeError(`Plot CLI binary package is missing for ${key}.`);
27
+ writeError('Reinstall with: npm install -g @plot-app/cli');
28
+ process.exit(1);
35
29
  }
36
30
  };
37
31
 
38
- const shouldCheckForUpdate = () => {
39
- if (process.env.PLOT_CLI_SKIP_UPDATE_CHECK === '1') return false;
40
- return Date.now() - readLastUpdateCheck() > updateIntervalMs;
41
- };
42
-
43
- const latestVersion = () => {
44
- const result = spawnSync(npmCommand, ['view', `${packageName}@latest`, 'version', '--silent'], {
45
- encoding: 'utf8',
46
- env: process.env,
32
+ const runBinary = (env) =>
33
+ spawnSync(resolveBinary(), process.argv.slice(2), {
34
+ stdio: 'inherit',
35
+ env,
47
36
  });
48
- if (result.status !== 0) return null;
49
- const version = result.stdout.trim();
50
- return version.length > 0 ? version : null;
51
- };
52
-
53
- const installLatest = (stdio) =>
54
- spawnSync(npmCommand, ['install', '-g', `${packageName}@latest`], {
55
- stdio,
56
- env: process.env,
57
- });
58
-
59
- const update = (force) => {
60
- const version = latestVersion();
61
- writeLastUpdateCheck();
62
-
63
- if (!version) {
64
- if (force) {
65
- console.error('Could not check the latest Plot CLI version from npm.');
66
- return 1;
67
- }
68
- return 0;
69
- }
70
-
71
- if (version === currentVersion) {
72
- if (force) console.log(`Plot CLI is already up to date (${currentVersion}).`);
73
- return 0;
74
- }
75
-
76
- if (force) {
77
- console.log(`Updating Plot CLI from ${currentVersion} to ${version}...`);
78
- }
79
- const result = installLatest(force ? 'inherit' : 'ignore');
80
- if (result.status === 0) {
81
- if (force) console.log(`Updated Plot CLI to ${version}.`);
82
- return 0;
83
- }
84
-
85
- if (force) {
86
- console.error('Plot CLI update failed.');
87
- console.error(`Try manually: npm install -g ${packageName}@latest`);
88
- return typeof result.status === 'number' ? result.status : 1;
89
- }
90
- return 0;
91
- };
92
-
93
- if (process.argv[2] === 'update') {
94
- process.exit(update(true));
95
- }
96
-
97
- if (shouldCheckForUpdate()) {
98
- update(false);
99
- }
100
-
101
- if (!binaryPackageName) {
102
- console.error(`Plot CLI does not ship a binary for ${key}.`);
103
- process.exit(1);
104
- }
105
-
106
- let binary;
107
- try {
108
- binary = require.resolve(binaryPackageName);
109
- } catch (error) {
110
- console.error(`Plot CLI binary package is missing for ${key}.`);
111
- console.error('Reinstall with: npm install -g @plot-app/cli');
112
- process.exit(1);
113
- }
114
37
 
115
- const result = spawnSync(binary, process.argv.slice(2), {
116
- stdio: 'inherit',
117
- env: process.env,
118
- });
38
+ const result = runBinary(process.env);
119
39
 
120
40
  if (result.error) {
121
- console.error(result.error.message);
41
+ writeError(result.error.message);
122
42
  process.exit(1);
123
43
  }
124
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plot-app/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Programmatic access to Plot workspaces for agents.",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
@@ -8,7 +8,8 @@
8
8
  },
9
9
  "files": [
10
10
  "bin",
11
- "README.md"
11
+ "README.md",
12
+ "CHANGELOG.md"
12
13
  ],
13
14
  "os": [
14
15
  "darwin",
@@ -22,10 +23,10 @@
22
23
  "node": ">=18"
23
24
  },
24
25
  "optionalDependencies": {
25
- "@plot-app/cli-darwin-arm64": "0.0.1",
26
- "@plot-app/cli-darwin-x64": "0.0.1",
27
- "@plot-app/cli-linux-x64": "0.0.1",
28
- "@plot-app/cli-linux-arm64": "0.0.1"
26
+ "@plot-app/cli-darwin-arm64": "0.0.3",
27
+ "@plot-app/cli-darwin-x64": "0.0.3",
28
+ "@plot-app/cli-linux-x64": "0.0.3",
29
+ "@plot-app/cli-linux-arm64": "0.0.3"
29
30
  },
30
31
  "publishConfig": {
31
32
  "access": "public",