@plot-app/cli 0.0.1 → 0.0.2
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 +215 -17
- package/bin/plot.js +23 -96
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,33 +1,231 @@
|
|
|
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
|
-
##
|
|
5
|
+
## Agent Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
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`, and `message`.
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
- The `plot` binary installed and available on `PATH`.
|
|
36
|
+
- A Plot account with access to the workspace you want to inspect or update.
|
|
37
|
+
- Network access to Plot.
|
|
38
|
+
- For headless agents, a Plot Personal Access Token.
|
|
39
|
+
|
|
40
|
+
End users do not need Bun, pnpm, Node.js, repository source code, or internal service configuration.
|
|
41
|
+
|
|
42
|
+
## Authentication
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
plot login # OAuth with local callback on 127.0.0.1:7568-7578
|
|
46
|
+
plot login --token "$PLOT_API_TOKEN"
|
|
47
|
+
plot whoami
|
|
48
|
+
plot auth status --format json
|
|
49
|
+
plot logout
|
|
10
50
|
```
|
|
11
51
|
|
|
12
|
-
|
|
13
|
-
launcher. It does not include the Plot CLI TypeScript source, tests, monorepo
|
|
14
|
-
configuration, local credentials, or environment files.
|
|
52
|
+
Credentials are stored locally by the CLI. Use `plot logout` to remove the active workspace credentials.
|
|
15
53
|
|
|
16
|
-
|
|
54
|
+
## Common Workflows
|
|
55
|
+
|
|
56
|
+
### Orient In A Workspace
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
plot workspace info --format json
|
|
60
|
+
plot team list --format json
|
|
61
|
+
plot user list --format json
|
|
62
|
+
plot search "launch checklist" --format json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Inspect And Update Tasks
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
plot task list --team ENG --limit 20 --format json
|
|
69
|
+
plot task get ENG-042 --format json
|
|
70
|
+
plot task update ENG-042 --status-id status_done --format json
|
|
71
|
+
plot comment add --task-id ENG-042 --body "Implemented and verified." --format json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Create A Task With Dependencies
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
plot task create \
|
|
78
|
+
--name "Write checkout regression tests" \
|
|
79
|
+
--team-id ENG \
|
|
80
|
+
--project-id checkout-redesign-a1b2c3d4e5f6 \
|
|
81
|
+
--blocked-by ENG-041 \
|
|
82
|
+
--format json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Create A Parent Task Tree
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
cat <<'JSON' | plot task create-tree --format json
|
|
89
|
+
{
|
|
90
|
+
"name": "Ship checkout polish",
|
|
91
|
+
"teamId": "ENG",
|
|
92
|
+
"projectId": "checkout-redesign-a1b2c3d4e5f6",
|
|
93
|
+
"subtasks": [
|
|
94
|
+
{ "name": "Fix empty state", "ref": "empty-state" },
|
|
95
|
+
{ "name": "Add regression coverage", "blockedBy": ["@empty-state"] }
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
JSON
|
|
99
|
+
```
|
|
17
100
|
|
|
18
|
-
-
|
|
19
|
-
- macOS x64
|
|
20
|
-
- Linux arm64
|
|
21
|
-
- Linux x64
|
|
101
|
+
`create-tree` supports one level of subtasks. Subtasks inherit `teamId`, `projectId`, `assigneeId`, and `visibility` unless overridden.
|
|
22
102
|
|
|
23
|
-
|
|
24
|
-
or OAuth credential is embedded in this package.
|
|
103
|
+
### Batch Commands
|
|
25
104
|
|
|
26
|
-
|
|
105
|
+
`plot batch` reads a JSON array from stdin and executes entries sequentially.
|
|
27
106
|
|
|
28
107
|
```bash
|
|
29
|
-
plot
|
|
108
|
+
cat <<'JSON' | plot batch
|
|
109
|
+
[
|
|
110
|
+
{
|
|
111
|
+
"command": "task",
|
|
112
|
+
"action": "create",
|
|
113
|
+
"args": {
|
|
114
|
+
"name": "Triage checkout logs",
|
|
115
|
+
"teamId": "ENG"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"command": "task",
|
|
120
|
+
"action": "list",
|
|
121
|
+
"args": {
|
|
122
|
+
"team": "ENG",
|
|
123
|
+
"limit": 5
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
JSON
|
|
30
128
|
```
|
|
31
129
|
|
|
32
|
-
|
|
33
|
-
|
|
130
|
+
Supported batch keys: `task.create`, `task.update`, `task.delete`, `task.get`, `task.list`, and `project.update`.
|
|
131
|
+
|
|
132
|
+
## Commands
|
|
133
|
+
|
|
134
|
+
Run `plot <command> --help` for command-specific options.
|
|
135
|
+
|
|
136
|
+
| Command | Purpose |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| `login`, `auth login` | Authenticate with OAuth or `--token`. |
|
|
139
|
+
| `logout`, `auth logout` | Remove stored credentials. |
|
|
140
|
+
| `whoami`, `auth whoami` | Print current user and workspace. |
|
|
141
|
+
| `auth status` | Show active workspace and credential storage status. |
|
|
142
|
+
| `workspace list` | List authenticated workspaces. |
|
|
143
|
+
| `workspace use <slug>` | Set the active workspace. |
|
|
144
|
+
| `workspace info` | Print workspace orientation data. |
|
|
145
|
+
| `task list` | List recent tasks with filters. |
|
|
146
|
+
| `task get <id>` | Get task details with hydrated relations. |
|
|
147
|
+
| `task create` | Create a task. |
|
|
148
|
+
| `task create-tree` | Create a parent task with subtasks and dependencies. |
|
|
149
|
+
| `task update <id>` | Update mutable task fields. |
|
|
150
|
+
| `task delete <id>` | Soft-delete a task. |
|
|
151
|
+
| `task add-dependency` | Mark one task as blocked by another. |
|
|
152
|
+
| `task remove-dependency` | Remove a blocking relationship. |
|
|
153
|
+
| `task set-parent <id>` | Convert a task into a subtask. |
|
|
154
|
+
| `task remove-parent <id>` | Promote a subtask back to a top-level task. |
|
|
155
|
+
| `project list` | List projects. |
|
|
156
|
+
| `project get <id>` | Get project details. |
|
|
157
|
+
| `project summary <id>` | Print project health. |
|
|
158
|
+
| `doc list`, `doc get`, `doc create`, `doc update` | Read and mutate documents. |
|
|
159
|
+
| `collection list`, `collection get`, `collection create`, `collection update` | Read and mutate collections. |
|
|
160
|
+
| `team list`, `team get <id>` | List and inspect teams. |
|
|
161
|
+
| `task-status list --team-id <id>` | List valid task statuses for a team. |
|
|
162
|
+
| `label list --team-id <id>` | List task labels for a team. |
|
|
163
|
+
| `user list`, `user get <id>`, `user by-team <team-id>` | Discover users. |
|
|
164
|
+
| `user combined-members` | List users with access across projects, teams, and/or a task. |
|
|
165
|
+
| `activity list` | List activity feed entries. |
|
|
166
|
+
| `inbox list`, `inbox read <id>`, `inbox archive <id>` | Read and manage notifications. |
|
|
167
|
+
| `search <query>` | Search tasks, projects, documents, teams, and users. |
|
|
168
|
+
| `comment list`, `comment add` | List or add comments on tasks and projects. |
|
|
169
|
+
| `batch` | Execute a JSON command array from stdin. |
|
|
170
|
+
| `commands` | Print the machine-readable command manifest. |
|
|
171
|
+
| `help identifiers` | Print handle and URL parsing conventions. |
|
|
172
|
+
|
|
173
|
+
## Identifiers
|
|
174
|
+
|
|
175
|
+
Use the shortest stable handle the CLI accepts.
|
|
176
|
+
|
|
177
|
+
| Entity | Preferred handle | Example |
|
|
178
|
+
| --- | --- | --- |
|
|
179
|
+
| Task | `pathId` | `ENG-042` |
|
|
180
|
+
| Team | `publicId` | `ENG` |
|
|
181
|
+
| Project | slug or trailing `publicId` | `checkout-redesign-a1b2c3d4e5f6` |
|
|
182
|
+
| Document | slug or trailing `publicId` | `launch-checklist-78utu4m1d7iz` |
|
|
183
|
+
| Collection | slug | `growth` |
|
|
184
|
+
| User | `@username` | `@abraham` |
|
|
185
|
+
|
|
186
|
+
Copied Plot URLs follow:
|
|
187
|
+
|
|
188
|
+
```text
|
|
189
|
+
https://go.plot.app/{workspaceSlug}/{entityType}/{identifier}/{optionalContext}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Extract the workspace slug first. If it differs from the active workspace, run `plot workspace use <workspaceSlug>`.
|
|
193
|
+
|
|
194
|
+
## Output And Errors
|
|
195
|
+
|
|
196
|
+
Most commands accept `--format json` or `--format markdown`. JSON is the default.
|
|
197
|
+
|
|
198
|
+
Errors are structured:
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"error": true,
|
|
203
|
+
"code": "AUTH_REQUIRED",
|
|
204
|
+
"message": "No active workspace. Run `plot login` to authenticate."
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Error code groups:
|
|
209
|
+
|
|
210
|
+
| Exit | Meaning |
|
|
211
|
+
| --- | --- |
|
|
212
|
+
| `1` | Validation, not found, forbidden, not implemented, or unknown failure. |
|
|
213
|
+
| `2` | Authentication required or expired. |
|
|
214
|
+
| `3` | Network or sync failure. |
|
|
215
|
+
|
|
216
|
+
## Runtime Notes
|
|
217
|
+
|
|
218
|
+
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.
|
|
219
|
+
|
|
220
|
+
Use these commands when a session appears stale:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
plot auth status --format json
|
|
224
|
+
plot logout
|
|
225
|
+
plot login
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Security Notes
|
|
229
|
+
|
|
230
|
+
- Personal access tokens and OAuth credentials grant access to Plot workspace data. Do not paste them into prompts, logs, comments, or issues.
|
|
231
|
+
- `plot help identifiers` prints URL parsing examples. Check copied links before sharing output externally.
|
package/bin/plot.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
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}`;
|
|
5
|
+
const restartAfterUpdateExitCode = 75;
|
|
11
6
|
const packages = {
|
|
12
7
|
'darwin-arm64': '@plot-app/cli-darwin-arm64',
|
|
13
8
|
'darwin-x64': '@plot-app/cli-darwin-x64',
|
|
@@ -15,110 +10,42 @@ const packages = {
|
|
|
15
10
|
'linux-x64': '@plot-app/cli-linux-x64',
|
|
16
11
|
};
|
|
17
12
|
const binaryPackageName = packages[key];
|
|
18
|
-
const updateStatePath = join(homedir(), '.plot', 'update-check.json');
|
|
19
13
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const readLastUpdateCheck = () => {
|
|
23
|
-
try {
|
|
24
|
-
return JSON.parse(readFileSync(updateStatePath, 'utf8')).checkedAt ?? 0;
|
|
25
|
-
} catch (error) {
|
|
26
|
-
return 0;
|
|
27
|
-
}
|
|
14
|
+
const writeError = (message) => {
|
|
15
|
+
process.stderr.write(`${message}\n`);
|
|
28
16
|
};
|
|
29
17
|
|
|
30
|
-
|
|
18
|
+
if (!binaryPackageName) {
|
|
19
|
+
writeError(`Plot CLI does not ship a binary for ${key}.`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const resolveBinary = () => {
|
|
31
24
|
try {
|
|
32
|
-
|
|
33
|
-
writeFileSync(updateStatePath, JSON.stringify({ checkedAt: Date.now() }));
|
|
25
|
+
return require.resolve(binaryPackageName);
|
|
34
26
|
} catch (error) {
|
|
27
|
+
writeError(`Plot CLI binary package is missing for ${key}.`);
|
|
28
|
+
writeError('Reinstall with: npm install -g @plot-app/cli');
|
|
29
|
+
process.exit(1);
|
|
35
30
|
}
|
|
36
31
|
};
|
|
37
32
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const latestVersion = () => {
|
|
44
|
-
const result = spawnSync(npmCommand, ['view', `${packageName}@latest`, 'version', '--silent'], {
|
|
45
|
-
encoding: 'utf8',
|
|
46
|
-
env: process.env,
|
|
33
|
+
const runBinary = (env) =>
|
|
34
|
+
spawnSync(resolveBinary(), process.argv.slice(2), {
|
|
35
|
+
stdio: 'inherit',
|
|
36
|
+
env,
|
|
47
37
|
});
|
|
48
|
-
if (result.status !== 0) return null;
|
|
49
|
-
const version = result.stdout.trim();
|
|
50
|
-
return version.length > 0 ? version : null;
|
|
51
|
-
};
|
|
52
38
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
39
|
+
let result = runBinary(process.env);
|
|
40
|
+
if (result.status === restartAfterUpdateExitCode) {
|
|
41
|
+
result = runBinary({
|
|
42
|
+
...process.env,
|
|
43
|
+
PLOT_CLI_SKIP_UPDATE_CHECK: '1',
|
|
57
44
|
});
|
|
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
45
|
}
|
|
100
46
|
|
|
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
|
-
|
|
115
|
-
const result = spawnSync(binary, process.argv.slice(2), {
|
|
116
|
-
stdio: 'inherit',
|
|
117
|
-
env: process.env,
|
|
118
|
-
});
|
|
119
|
-
|
|
120
47
|
if (result.error) {
|
|
121
|
-
|
|
48
|
+
writeError(result.error.message);
|
|
122
49
|
process.exit(1);
|
|
123
50
|
}
|
|
124
51
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plot-app/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Programmatic access to Plot workspaces for agents.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"bin": {
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"node": ">=18"
|
|
23
23
|
},
|
|
24
24
|
"optionalDependencies": {
|
|
25
|
-
"@plot-app/cli-darwin-arm64": "0.0.
|
|
26
|
-
"@plot-app/cli-darwin-x64": "0.0.
|
|
27
|
-
"@plot-app/cli-linux-x64": "0.0.
|
|
28
|
-
"@plot-app/cli-linux-arm64": "0.0.
|
|
25
|
+
"@plot-app/cli-darwin-arm64": "0.0.2",
|
|
26
|
+
"@plot-app/cli-darwin-x64": "0.0.2",
|
|
27
|
+
"@plot-app/cli-linux-x64": "0.0.2",
|
|
28
|
+
"@plot-app/cli-linux-arm64": "0.0.2"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public",
|