@tokenrip/cli 1.5.0 → 1.5.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/AGENTS.md +20 -2
- package/SKILL.md +31 -6
- package/dist/cjs/commands/artifact-diff.js +19 -0
- package/dist/cjs/commands/artifact-diff.js.map +1 -0
- package/dist/cjs/commands/bulk.js +63 -0
- package/dist/cjs/commands/bulk.js.map +1 -0
- package/dist/cjs/commands/folder.js +19 -14
- package/dist/cjs/commands/folder.js.map +1 -1
- package/dist/cjs/commands/mount-collection.js +95 -0
- package/dist/cjs/commands/mount-collection.js.map +1 -0
- package/dist/cjs/formatters.js +31 -1
- package/dist/cjs/formatters.js.map +1 -1
- package/dist/cli.js +128 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/artifact-diff.d.ts +3 -0
- package/dist/commands/artifact-diff.js +16 -0
- package/dist/commands/artifact-diff.js.map +1 -0
- package/dist/commands/bulk.d.ts +6 -0
- package/dist/commands/bulk.js +60 -0
- package/dist/commands/bulk.js.map +1 -0
- package/dist/commands/folder.d.ts +7 -0
- package/dist/commands/folder.js +18 -14
- package/dist/commands/folder.js.map +1 -1
- package/dist/commands/mount-collection.d.ts +17 -0
- package/dist/commands/mount-collection.js +88 -0
- package/dist/commands/mount-collection.js.map +1 -0
- package/dist/formatters.d.ts +1 -0
- package/dist/formatters.js +29 -0
- package/dist/formatters.js.map +1 -1
- package/package.json +1 -1
- package/references/agent-architecture.md +15 -1
package/AGENTS.md
CHANGED
|
@@ -136,6 +136,20 @@ rip artifact delete my-alias
|
|
|
136
136
|
rip artifact delete https://tokenrip.com/s/my-alias
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
+
### `rip artifact bulk <action>`
|
|
140
|
+
|
|
141
|
+
Move, archive, or delete many artifacts in one call. `<action>` is `move`,
|
|
142
|
+
`archive`, or `delete`. `--ids` is a comma-separated list of identifiers (UUID,
|
|
143
|
+
alias, or URL), up to 200. Output reports `succeeded` and `failed` ids.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
rip artifact bulk move --ids "id1,id2,id3" --folder reports
|
|
147
|
+
rip artifact bulk move --ids "id1,id2" --folder research --team my-team
|
|
148
|
+
rip artifact bulk move --ids "id1,id2" --unfiled
|
|
149
|
+
rip artifact bulk archive --ids "id1,id2,id3"
|
|
150
|
+
rip artifact bulk delete --ids "id1,id2"
|
|
151
|
+
```
|
|
152
|
+
|
|
139
153
|
### Share an artifact
|
|
140
154
|
|
|
141
155
|
```bash
|
|
@@ -161,6 +175,8 @@ rip artifact download <uuid-or-url> # download content to file
|
|
|
161
175
|
rip artifact download <uuid-or-url> --output ./report.pdf # custom output path
|
|
162
176
|
rip artifact download <uuid-or-url> --version <versionId> # specific version
|
|
163
177
|
rip artifact versions <uuid-or-url> # list all versions
|
|
178
|
+
rip artifact diff <uuid-or-url> # what changed vs. the previous version
|
|
179
|
+
rip artifact diff <uuid-or-url> --version <versionId> # diff a specific version
|
|
164
180
|
```
|
|
165
181
|
|
|
166
182
|
### Comments
|
|
@@ -240,10 +256,11 @@ These four commands are 1:1 mirrors of the MCP tools `agent_load`, `agent_record
|
|
|
240
256
|
Before publishing a manifest, publish every referenced brain artifact alias:
|
|
241
257
|
|
|
242
258
|
```bash
|
|
243
|
-
rip
|
|
244
|
-
rip artifact publish agents/office-hours/brain/office-hours-soul.md --type markdown --alias office-hours-soul --title "Office Hours Soul" --folder office-hours
|
|
259
|
+
rip artifact publish agents/office-hours/brain/office-hours-soul.md --type markdown --alias office-hours-soul --title "Office Hours Soul"
|
|
245
260
|
```
|
|
246
261
|
|
|
262
|
+
`rip agent publish` auto-creates a system-managed folder under the agent owner and files brain/sample/shared artifacts into it — you don't need to create or pass `--folder` yourself. That folder is locked (see `FOLDER_LOCKED` below): rename or delete only via the agent lifecycle.
|
|
263
|
+
|
|
247
264
|
**Memory primitives in the manifest:**
|
|
248
265
|
|
|
249
266
|
- `memoryCollections[]` — schema-bound rows. Scopes: `shared`, `team`, `operator-private`.
|
|
@@ -512,3 +529,4 @@ Use on artifact commands to build lineage and traceability:
|
|
|
512
529
|
| `INVALID_LOAD_PARAMS` | `agent_load` got both/neither of `slug`/`mountId` | Pass exactly one |
|
|
513
530
|
| `SESSION_OUTPUT_NOT_PERMITTED` | Agent forbids session outputs | Drop the session output |
|
|
514
531
|
| `ADMIN_REQUIRED` | Publisher approve/reject/revoke endpoint | Platform admin only |
|
|
532
|
+
| `FOLDER_LOCKED` | Tried to rename/delete or move artifacts in/out of a system-managed agent or mount folder | Don't touch agent/mount folders — they're managed by `rip agent publish`/`fork`/`mount`/`unmount` |
|
package/SKILL.md
CHANGED
|
@@ -14,7 +14,7 @@ description: >-
|
|
|
14
14
|
web browsing or scraping (use browser tools), database queries,
|
|
15
15
|
or git operations. Tokenrip is for publishing, sharing, and collaborating
|
|
16
16
|
on artifacts across agents — not for local development workflows.
|
|
17
|
-
version: 1.5.
|
|
17
|
+
version: 1.5.3
|
|
18
18
|
homepage: https://tokenrip.com
|
|
19
19
|
license: MIT
|
|
20
20
|
tags:
|
|
@@ -53,7 +53,7 @@ metadata:
|
|
|
53
53
|
- terminal
|
|
54
54
|
---
|
|
55
55
|
|
|
56
|
-
<!-- tokenrip-skill-version: 1.5.
|
|
56
|
+
<!-- tokenrip-skill-version: 1.5.2 -->
|
|
57
57
|
|
|
58
58
|
## Auto-Installation
|
|
59
59
|
|
|
@@ -64,14 +64,20 @@ if ! command -v rip &> /dev/null; then
|
|
|
64
64
|
fi
|
|
65
65
|
|
|
66
66
|
# Auto-update CLI and skill files if a newer version is available
|
|
67
|
-
SKILL_VER="1.5.
|
|
67
|
+
SKILL_VER="1.5.2"
|
|
68
68
|
REMOTE_VER=$(curl -fsSL "https://tokenrip.com/.well-known/skills/tokenrip/manifest.json" 2>/dev/null | grep -o '"version":"[^"]*"' | head -1 | cut -d'"' -f4)
|
|
69
69
|
if [ -n "$REMOTE_VER" ] && [ "$REMOTE_VER" != "$SKILL_VER" ]; then
|
|
70
70
|
rip update
|
|
71
71
|
BASE="https://tokenrip.com/.well-known/skills/tokenrip"
|
|
72
|
-
SKILL_DIR="
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
SKILL_DIR=""
|
|
73
|
+
_D="$PWD"
|
|
74
|
+
while [ "$_D" != "/" ] && [ -z "$SKILL_DIR" ]; do
|
|
75
|
+
[ -d "${_D}/.claude/skills/tokenrip" ] && SKILL_DIR="${_D}/.claude/skills/tokenrip"
|
|
76
|
+
_D="$(dirname "$_D")"
|
|
77
|
+
done
|
|
78
|
+
[ -z "$SKILL_DIR" ] && [ -d "${HOME}/.agents/skills/tokenrip" ] && SKILL_DIR="${HOME}/.agents/skills/tokenrip"
|
|
79
|
+
[ -z "$SKILL_DIR" ] && [ -d "${HOME}/.claude/skills/tokenrip" ] && SKILL_DIR="${HOME}/.claude/skills/tokenrip"
|
|
80
|
+
if [ -n "$SKILL_DIR" ]; then
|
|
75
81
|
curl -fsSL "$BASE/SKILL.md" -o "$SKILL_DIR/SKILL.md"
|
|
76
82
|
mkdir -p "$SKILL_DIR/references"
|
|
77
83
|
for ref in setup-and-identity agent-architecture output-and-provenance; do
|
|
@@ -192,6 +198,15 @@ Team inbox?
|
|
|
192
198
|
→ rip inbox --team <slug>
|
|
193
199
|
```
|
|
194
200
|
|
|
201
|
+
### Folders you can't touch
|
|
202
|
+
|
|
203
|
+
`rip agent publish` / `fork` / `mount` auto-create system-managed folders
|
|
204
|
+
(`kind='agent'` for an agent's package, `kind='mount'` for a mount's
|
|
205
|
+
materialized artifacts and themes). `rip folder rename`, `rip folder delete`,
|
|
206
|
+
and `rip artifact move` into or out of those folders return `FOLDER_LOCKED`
|
|
207
|
+
(HTTP 409). Use the agent lifecycle instead — delete the agent or `rip agent
|
|
208
|
+
unmount` to remove the folder; both cascade to the filed artifacts.
|
|
209
|
+
|
|
195
210
|
### Updating vs versioning
|
|
196
211
|
|
|
197
212
|
```
|
|
@@ -202,11 +217,20 @@ Fix metadata (title, description, alias) without a new version?
|
|
|
202
217
|
Publish a new version (content changed)?
|
|
203
218
|
→ rip artifact update <uuid> <file> --type markdown --label "revised"
|
|
204
219
|
|
|
220
|
+
See what changed between a version and the one before it?
|
|
221
|
+
→ rip artifact diff <id-or-alias> # current version vs. previous
|
|
222
|
+
→ rip artifact diff <id-or-alias> --version <versionId>
|
|
223
|
+
|
|
205
224
|
Archive (hide from listings, still accessible by ID)?
|
|
206
225
|
→ rip artifact archive <identifier>
|
|
207
226
|
|
|
208
227
|
Permanently delete?
|
|
209
228
|
→ rip artifact delete <identifier>
|
|
229
|
+
|
|
230
|
+
Move, archive, or delete many artifacts at once (up to 200)?
|
|
231
|
+
→ rip artifact bulk move --ids "id1,id2" --folder <slug>
|
|
232
|
+
→ rip artifact bulk archive --ids "id1,id2"
|
|
233
|
+
→ rip artifact bulk delete --ids "id1,id2"
|
|
210
234
|
```
|
|
211
235
|
|
|
212
236
|
### Aliases and resolution
|
|
@@ -305,6 +329,7 @@ For JSON output format, provenance flags, or `--json` details, read `references/
|
|
|
305
329
|
| `MOUNT_NAME_TAKEN` | Pick a different `--name` |
|
|
306
330
|
| `IMPRINT_NOT_LOADABLE` | Verify agent ownership or team membership |
|
|
307
331
|
| `TIMEOUT` / `NETWORK_ERROR` | Retry once; check connection with `rip config show` |
|
|
332
|
+
| `FOLDER_LOCKED` | Don't rename/delete or move into/out of system-managed agent/mount folders — manage via the agent lifecycle |
|
|
308
333
|
|
|
309
334
|
## CLI Updates
|
|
310
335
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.artifactDiff = artifactDiff;
|
|
4
|
+
const auth_client_js_1 = require("../auth-client.js");
|
|
5
|
+
const output_js_1 = require("../output.js");
|
|
6
|
+
const formatters_js_1 = require("../formatters.js");
|
|
7
|
+
const parse_artifact_id_js_1 = require("../parse-artifact-id.js");
|
|
8
|
+
async function artifactDiff(input, options) {
|
|
9
|
+
const uuid = (0, parse_artifact_id_js_1.parseArtifactId)(input);
|
|
10
|
+
const { client } = (0, auth_client_js_1.optionalAuthClient)();
|
|
11
|
+
let versionId = options.version;
|
|
12
|
+
if (!versionId) {
|
|
13
|
+
const { data } = await client.get(`/v0/artifacts/${uuid}`);
|
|
14
|
+
versionId = data.data.currentVersionId;
|
|
15
|
+
}
|
|
16
|
+
const { data } = await client.get(`/v0/artifacts/${uuid}/versions/${versionId}/diff`);
|
|
17
|
+
(0, output_js_1.outputSuccess)(data.data, formatters_js_1.formatVersionDiff);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=artifact-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-diff.js","sourceRoot":"","sources":["../../../src/commands/artifact-diff.ts"],"names":[],"mappings":";;AAKA,oCAeC;AApBD,sDAAuD;AACvD,4CAA6C;AAC7C,oDAAqD;AACrD,kEAA0D;AAEnD,KAAK,UAAU,YAAY,CAChC,KAAa,EACb,OAA6B;IAE7B,MAAM,IAAI,GAAG,IAAA,sCAAe,EAAC,KAAK,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,mCAAkB,GAAE,CAAC;IAExC,IAAI,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;QAC3D,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;IACzC,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,iBAAiB,IAAI,aAAa,SAAS,OAAO,CAAC,CAAC;IACtF,IAAA,yBAAa,EAAC,IAAI,CAAC,IAAI,EAAE,iCAAiB,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.artifactBulk = artifactBulk;
|
|
4
|
+
const auth_client_js_1 = require("../auth-client.js");
|
|
5
|
+
const errors_js_1 = require("../errors.js");
|
|
6
|
+
const output_js_1 = require("../output.js");
|
|
7
|
+
const parse_artifact_id_js_1 = require("../parse-artifact-id.js");
|
|
8
|
+
const folder_js_1 = require("./folder.js");
|
|
9
|
+
const VALID_ACTIONS = ['move', 'archive', 'delete'];
|
|
10
|
+
async function artifactBulk(action, options) {
|
|
11
|
+
if (!VALID_ACTIONS.includes(action)) {
|
|
12
|
+
throw new errors_js_1.CliError('INVALID_TYPE', `Invalid action "${action}". Must be one of: ${VALID_ACTIONS.join(', ')}`);
|
|
13
|
+
}
|
|
14
|
+
if (!options.ids) {
|
|
15
|
+
throw new errors_js_1.CliError('MISSING_FIELD', 'Provide --ids <csv> with comma-separated artifact identifiers');
|
|
16
|
+
}
|
|
17
|
+
const publicIds = options.ids
|
|
18
|
+
.split(',')
|
|
19
|
+
.map((s) => (0, parse_artifact_id_js_1.parseArtifactId)(s.trim()))
|
|
20
|
+
.filter((s) => s.length > 0);
|
|
21
|
+
if (publicIds.length === 0) {
|
|
22
|
+
throw new errors_js_1.CliError('MISSING_FIELD', 'No artifact identifiers provided in --ids');
|
|
23
|
+
}
|
|
24
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
25
|
+
const body = {
|
|
26
|
+
action: action,
|
|
27
|
+
publicIds,
|
|
28
|
+
};
|
|
29
|
+
if (action === 'move') {
|
|
30
|
+
if (options.unfiled) {
|
|
31
|
+
body.folderId = null;
|
|
32
|
+
}
|
|
33
|
+
else if (options.folder) {
|
|
34
|
+
body.folderId = await (0, folder_js_1.resolveFolderId)(client, options.folder, options.team);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
throw new errors_js_1.CliError('MISSING_FIELD', 'For "move", provide --folder <slug> or --unfiled');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const { data } = await client.post('/v0/artifacts/bulk', body);
|
|
41
|
+
const result = data.data;
|
|
42
|
+
(0, output_js_1.outputSuccess)({
|
|
43
|
+
action,
|
|
44
|
+
requested: publicIds.length,
|
|
45
|
+
succeeded: result.succeeded,
|
|
46
|
+
failed: result.failed,
|
|
47
|
+
failed_count: result.failed.length,
|
|
48
|
+
}, (d) => {
|
|
49
|
+
const lines = [
|
|
50
|
+
`Bulk ${d.action}: ${d.succeeded} succeeded, ${d.failed_count} failed`,
|
|
51
|
+
];
|
|
52
|
+
const failed = d.failed;
|
|
53
|
+
if (failed.length > 0) {
|
|
54
|
+
lines.push('');
|
|
55
|
+
lines.push('Failed:');
|
|
56
|
+
for (const f of failed) {
|
|
57
|
+
lines.push(` ${f.publicId}: ${f.error}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return lines.join('\n');
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=bulk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk.js","sourceRoot":"","sources":["../../../src/commands/bulk.ts"],"names":[],"mappings":";;AASA,oCAiEC;AA1ED,sDAAsD;AACtD,4CAAwC;AACxC,4CAA6C;AAC7C,kEAA0D;AAC1D,2CAA8C;AAE9C,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAGtD,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,OAA4E;IAE5E,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAoB,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,oBAAQ,CAChB,cAAc,EACd,mBAAmB,MAAM,sBAAsB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC1E,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACjB,MAAM,IAAI,oBAAQ,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AAS,EAAE,MAAM,CAAC,SAAS;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;KACnC,EACD,CAAC,CAAC,EAAE,EAAE;QACJ,MAAM,KAAK,GAAG;YACZ,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,SAAmB,eAAe,CAAC,CAAC,YAAsB,SAAS;SAC3F,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,CAAC,MAA+C,CAAC;QACjE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACtB,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;gBACvB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveFolderId = resolveFolderId;
|
|
3
4
|
exports.folderCreate = folderCreate;
|
|
4
5
|
exports.folderList = folderList;
|
|
5
6
|
exports.folderShow = folderShow;
|
|
@@ -9,6 +10,19 @@ exports.artifactMove = artifactMove;
|
|
|
9
10
|
const auth_client_js_1 = require("../auth-client.js");
|
|
10
11
|
const output_js_1 = require("../output.js");
|
|
11
12
|
const teams_js_1 = require("../teams.js");
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a folder slug to its ID. Personal folders by default; pass a team
|
|
15
|
+
* slug to resolve a team folder. Used by `artifact move` and `artifact bulk`.
|
|
16
|
+
*/
|
|
17
|
+
async function resolveFolderId(client, folderSlug, teamSlug) {
|
|
18
|
+
if (teamSlug) {
|
|
19
|
+
const team = (0, teams_js_1.resolveTeam)(teamSlug);
|
|
20
|
+
const { data } = await client.get(`/v0/teams/${encodeURIComponent(team)}/folders/${encodeURIComponent(folderSlug)}`);
|
|
21
|
+
return data.data.id;
|
|
22
|
+
}
|
|
23
|
+
const { data } = await client.get(`/v0/folders/${encodeURIComponent(folderSlug)}`);
|
|
24
|
+
return data.data.id;
|
|
25
|
+
}
|
|
12
26
|
async function folderCreate(slug, options) {
|
|
13
27
|
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
14
28
|
if (options.team) {
|
|
@@ -47,14 +61,15 @@ async function folderShow(slug, options) {
|
|
|
47
61
|
}
|
|
48
62
|
async function folderDelete(slug, options) {
|
|
49
63
|
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
64
|
+
const config = options.deleteContents ? { params: { mode: 'delete' } } : undefined;
|
|
50
65
|
if (options.team) {
|
|
51
66
|
const teamSlug = (0, teams_js_1.resolveTeam)(options.team);
|
|
52
|
-
await client.delete(`/v0/teams/${encodeURIComponent(teamSlug)}/folders/${encodeURIComponent(slug)}
|
|
67
|
+
await client.delete(`/v0/teams/${encodeURIComponent(teamSlug)}/folders/${encodeURIComponent(slug)}`, config);
|
|
53
68
|
}
|
|
54
69
|
else {
|
|
55
|
-
await client.delete(`/v0/folders/${encodeURIComponent(slug)}
|
|
70
|
+
await client.delete(`/v0/folders/${encodeURIComponent(slug)}`, config);
|
|
56
71
|
}
|
|
57
|
-
(0, output_js_1.outputSuccess)({
|
|
72
|
+
(0, output_js_1.outputSuccess)({ deleted: true, slug, contents: options.deleteContents ? 'deleted' : 'archived' });
|
|
58
73
|
}
|
|
59
74
|
async function folderRename(oldSlug, newSlug, options) {
|
|
60
75
|
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
@@ -78,17 +93,7 @@ async function artifactMove(uuid, options) {
|
|
|
78
93
|
if (!options.folder) {
|
|
79
94
|
throw new Error('Provide --folder <slug> or --unfiled');
|
|
80
95
|
}
|
|
81
|
-
|
|
82
|
-
let folderId;
|
|
83
|
-
if (options.team) {
|
|
84
|
-
const teamSlug = (0, teams_js_1.resolveTeam)(options.team);
|
|
85
|
-
const { data } = await client.get(`/v0/teams/${encodeURIComponent(teamSlug)}/folders/${encodeURIComponent(options.folder)}`);
|
|
86
|
-
folderId = data.data.id;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
const { data } = await client.get(`/v0/folders/${encodeURIComponent(options.folder)}`);
|
|
90
|
-
folderId = data.data.id;
|
|
91
|
-
}
|
|
96
|
+
const folderId = await resolveFolderId(client, options.folder, options.team);
|
|
92
97
|
const { data } = await client.patch(`/v0/artifacts/${uuid}`, { folderId });
|
|
93
98
|
(0, output_js_1.outputSuccess)(data.data);
|
|
94
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder.js","sourceRoot":"","sources":["../../../src/commands/folder.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"folder.js","sourceRoot":"","sources":["../../../src/commands/folder.ts"],"names":[],"mappings":";;AASA,0CAcC;AAED,oCAUC;AAED,gCAUC;AAED,gCAUC;AAED,oCAaC;AAED,oCAUC;AAED,oCAiBC;AAxGD,sDAAsD;AACtD,4CAA6C;AAC7C,0CAA0C;AAE1C;;;GAGG;AACI,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,UAAkB,EAClB,QAAiB;IAEjB,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,IAAA,sBAAW,EAAC,QAAQ,CAAC,CAAC;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAC/B,aAAa,kBAAkB,CAAC,IAAI,CAAC,YAAY,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAClF,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACtB,CAAC;IACD,M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AA,kCAAiB,GAAE,CAAC;IAEvC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,CAAC,KAAK,CAAC,iBAAiB,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,IAAA,yBAAa,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,iBAAiB,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC3E,IAAA,yBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mountCollectionList = mountCollectionList;
|
|
4
|
+
exports.mountCollectionRows = mountCollectionRows;
|
|
5
|
+
exports.mountCollectionLatest = mountCollectionLatest;
|
|
6
|
+
exports.mountCollectionByTag = mountCollectionByTag;
|
|
7
|
+
exports.mountCollectionPatch = mountCollectionPatch;
|
|
8
|
+
const auth_client_js_1 = require("../auth-client.js");
|
|
9
|
+
const errors_js_1 = require("../errors.js");
|
|
10
|
+
const output_js_1 = require("../output.js");
|
|
11
|
+
/**
|
|
12
|
+
* `--set key=value` repeats: `[ "status=seen", "owner=alice" ]` → `{ status: 'seen', owner: 'alice' }`.
|
|
13
|
+
* Number-looking values stay strings on this path — agents that need typed
|
|
14
|
+
* values should pass a JSON object via `--data-json` (future). For v1 the
|
|
15
|
+
* schema validator on the backend coerces strings to enums/numbers as
|
|
16
|
+
* declared in the collection schema.
|
|
17
|
+
*/
|
|
18
|
+
function parseSetPairs(pairs) {
|
|
19
|
+
if (!pairs || pairs.length === 0)
|
|
20
|
+
return {};
|
|
21
|
+
const out = {};
|
|
22
|
+
for (const pair of pairs) {
|
|
23
|
+
const idx = pair.indexOf('=');
|
|
24
|
+
if (idx <= 0) {
|
|
25
|
+
throw new errors_js_1.CliError('INVALID_SET', `Bad --set value (expected key=value): ${pair}`);
|
|
26
|
+
}
|
|
27
|
+
out[pair.slice(0, idx).trim()] = pair.slice(idx + 1);
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
/** Convert `--filter key:value` (repeatable) into the query-string `key:val,key:val` shape the controller expects. */
|
|
32
|
+
function joinFilters(filters) {
|
|
33
|
+
if (!filters || filters.length === 0)
|
|
34
|
+
return undefined;
|
|
35
|
+
return filters.join(',');
|
|
36
|
+
}
|
|
37
|
+
async function mountCollectionList(mountId, _options) {
|
|
38
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
39
|
+
const { data } = await client.get(`/v0/operator/mounts/${encodeURIComponent(mountId)}/collections`);
|
|
40
|
+
(0, output_js_1.outputSuccess)(data.data, (rows) => {
|
|
41
|
+
if (!Array.isArray(rows) || rows.length === 0)
|
|
42
|
+
return '(no collections)';
|
|
43
|
+
const lines = ['slug kind tags'];
|
|
44
|
+
for (const r of rows) {
|
|
45
|
+
const slug = String(r.slug ?? '').padEnd(30);
|
|
46
|
+
const kind = String(r.templateKind ?? '').padEnd(18);
|
|
47
|
+
const tags = Array.isArray(r.tags) && r.tags.length > 0 ? r.tags.join(', ') : '—';
|
|
48
|
+
lines.push(`${slug} ${kind} ${tags}`);
|
|
49
|
+
}
|
|
50
|
+
return lines.join('\n');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async function mountCollectionRows(mountId, slug, options) {
|
|
54
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
55
|
+
const params = {};
|
|
56
|
+
const filterStr = joinFilters(options.filter);
|
|
57
|
+
if (filterStr)
|
|
58
|
+
params.filter = filterStr;
|
|
59
|
+
if (options.sort)
|
|
60
|
+
params.sort = options.sort;
|
|
61
|
+
if (options.limit)
|
|
62
|
+
params.limit = options.limit;
|
|
63
|
+
if (options.after)
|
|
64
|
+
params.after = options.after;
|
|
65
|
+
const { data } = await client.get(`/v0/operator/mounts/${encodeURIComponent(mountId)}/collections/${encodeURIComponent(slug)}/rows`, { params });
|
|
66
|
+
(0, output_js_1.outputSuccess)(data, () => JSON.stringify(data, null, 2));
|
|
67
|
+
}
|
|
68
|
+
async function mountCollectionLatest(mountId, slug) {
|
|
69
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
70
|
+
const { data } = await client.get(`/v0/operator/mounts/${encodeURIComponent(mountId)}/collections/${encodeURIComponent(slug)}/rows/latest`);
|
|
71
|
+
(0, output_js_1.outputSuccess)(data.data, () => JSON.stringify(data.data, null, 2));
|
|
72
|
+
}
|
|
73
|
+
async function mountCollectionByTag(mountId, tag, options) {
|
|
74
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
75
|
+
const params = {};
|
|
76
|
+
const filterStr = joinFilters(options.filter);
|
|
77
|
+
if (filterStr)
|
|
78
|
+
params.filter = filterStr;
|
|
79
|
+
if (options.sort)
|
|
80
|
+
params.sort = options.sort;
|
|
81
|
+
if (options.limit)
|
|
82
|
+
params.limit = options.limit;
|
|
83
|
+
const { data } = await client.get(`/v0/operator/mounts/${encodeURIComponent(mountId)}/collections-by-tag/${encodeURIComponent(tag)}/rows`, { params });
|
|
84
|
+
(0, output_js_1.outputSuccess)(data, () => JSON.stringify(data, null, 2));
|
|
85
|
+
}
|
|
86
|
+
async function mountCollectionPatch(mountId, slug, rowId, options) {
|
|
87
|
+
const dataPatch = parseSetPairs(options.set);
|
|
88
|
+
if (Object.keys(dataPatch).length === 0) {
|
|
89
|
+
throw new errors_js_1.CliError('NO_FIELDS', 'At least one --set key=value required');
|
|
90
|
+
}
|
|
91
|
+
const { client } = (0, auth_client_js_1.requireAuthClient)();
|
|
92
|
+
const { data } = await client.patch(`/v0/operator/mounts/${encodeURIComponent(mountId)}/collections/${encodeURIComponent(slug)}/rows/${encodeURIComponent(rowId)}`, { data: dataPatch });
|
|
93
|
+
(0, output_js_1.outputSuccess)(data.data, () => JSON.stringify(data.data, null, 2));
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=mount-collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-collection.js","sourceRoot":"","sources":["../../../src/commands/mount-collection.ts"],"names":[],"mappings":";;AA6CA,kDAcC;AAED,kDAiBC;AAED,sDAMC;AAED,oDAgBC;AAED,oDAgBC;AA1HD,sDAAsD;AACtD,4CAAwC;AACxC,4CAA6C;AAiB7C;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,KAA2B;IAChD,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC5C,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;YACb,MAAM,IAAI,oBAAQ,CAAC,aAAa,EAAE,yCAAyC,IAAI,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,sHAAsH;AACtH,SAA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;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kCAAiB,GAAE,CAAC;IACvC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CACjC,uBAAuB,kBAAkB,CAAC,OAAO,CAAC,gBAAgB,kBAAkB,CAAC,IAAI,CAAC,SAAS,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAC9H,EAAE,IAAI,EAAE,SAAS,EAAE,CACpB,CAAC;IACF,IAAA,yBAAa,EAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
package/dist/cjs/formatters.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatImprintArtifacts = exports.formatAgentScaffold = exports.formatAgentList = exports.formatAgent = exports.formatAgentPublished = exports.formatUnmounted = exports.formatMountList = exports.formatMount = exports.formatAccountList = exports.formatSelfUpdate = exports.formatTeamInvite = exports.formatTeamDetails = exports.formatTeamList = exports.formatTeamCreated = exports.formatSearchResults = exports.formatRowsDeleted = exports.formatRowUpdated = exports.formatRowsAppended = exports.formatCollectionRows = exports.formatProfileUpdated = exports.formatWhoami = exports.formatRefRemoved = exports.formatRefsAdded = exports.formatCollaboratorAdded = exports.formatThreadClosed = exports.formatThreadDetails = exports.formatVersionMetadata = exports.formatVersionList = exports.formatArtifactMetadata = exports.formatArtifactDownloaded = exports.formatThreadCreated = exports.formatShareLink = exports.formatMessages = exports.formatMessageSent = exports.formatConfigShow = exports.formatContactRemoved = exports.formatContactSaved = exports.formatContactResolved = exports.formatContacts = exports.formatThreadList = exports.formatInbox = exports.formatAuthKey = exports.formatConfigSaved = exports.formatVersionDeleted = exports.formatVersionCreated = exports.formatStats = exports.formatArtifactList = exports.formatArtifactDeleted = exports.formatArtifactPatched = exports.formatArtifactCreated = void 0;
|
|
4
|
-
exports.formatPublisher = exports.formatMountContext = exports.formatMountDrillIn = exports.formatMountArtifacts = void 0;
|
|
4
|
+
exports.formatVersionDiff = exports.formatPublisher = exports.formatMountContext = exports.formatMountDrillIn = exports.formatMountArtifacts = void 0;
|
|
5
5
|
const teams_js_1 = require("./teams.js");
|
|
6
6
|
const formatArtifactCreated = (data) => {
|
|
7
7
|
const lines = [`Created: ${data.title || '(untitled)'}`];
|
|
@@ -855,4 +855,34 @@ function formatBytes(bytes) {
|
|
|
855
855
|
const value = bytes / Math.pow(1024, i);
|
|
856
856
|
return `${value.toFixed(i === 0 ? 0 : 1)} ${units[i]}`;
|
|
857
857
|
}
|
|
858
|
+
const ANSI = { green: '\x1b[32m', red: '\x1b[31m', dim: '\x1b[2m', reset: '\x1b[0m' };
|
|
859
|
+
const formatVersionDiff = (data) => {
|
|
860
|
+
const payload = data.payload;
|
|
861
|
+
if (!payload) {
|
|
862
|
+
return 'No diff — earliest version or non-diffable artifact type.';
|
|
863
|
+
}
|
|
864
|
+
const header = `Changes vs v${data.baseVersion} ` +
|
|
865
|
+
`${ANSI.green}+${payload.stats.added}${ANSI.reset} ${ANSI.red}-${payload.stats.removed}${ANSI.reset}\n`;
|
|
866
|
+
if (payload.strategy === 'text') {
|
|
867
|
+
let body = '';
|
|
868
|
+
for (const s of payload.segments) {
|
|
869
|
+
if (s.op === 'insert')
|
|
870
|
+
body += `${ANSI.green}${s.value}${ANSI.reset}`;
|
|
871
|
+
else if (s.op === 'delete')
|
|
872
|
+
body += `${ANSI.red}${s.value}${ANSI.reset}`;
|
|
873
|
+
else
|
|
874
|
+
body += `${ANSI.dim}${s.value}${ANSI.reset}`;
|
|
875
|
+
}
|
|
876
|
+
return header + '\n' + body;
|
|
877
|
+
}
|
|
878
|
+
const lines = payload.rows.map((r) => {
|
|
879
|
+
if (r.op === 'insert')
|
|
880
|
+
return `${ANSI.green}+ ${r.value}${ANSI.reset}`;
|
|
881
|
+
if (r.op === 'delete')
|
|
882
|
+
return `${ANSI.red}- ${r.value}${ANSI.reset}`;
|
|
883
|
+
return ` ${ANSI.dim}${r.value}${ANSI.reset}`;
|
|
884
|
+
});
|
|
885
|
+
return header + '\n' + lines.join('\n');
|
|
886
|
+
};
|
|
887
|
+
exports.formatVersionDiff = formatVersionDiff;
|
|
858
888
|
//# sourceMappingURL=formatters.js.map
|