listspace 0.6.0 → 0.8.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/CHANGELOG.md +13 -0
- package/README.md +11 -2
- package/dist/listspace.mjs +155 -25
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
One version runs through the CLI, the skill and the Claude Code plugin, so each entry covers all three.
|
|
4
4
|
|
|
5
|
+
## 0.8.0
|
|
6
|
+
|
|
7
|
+
- `listspace attach <item> <file> --new-version`: the file becomes the newest version of the current file on the item with the same name, and the old one is kept as an older version (the same as **Upload a new version** in the app). With no current file of that name the file is added as a new file and the output says so; with more than one the command stops before sending anything and lists their ids. `--version-of <attachment id>` picks the file to replace (one file per command). The output says `as version 2`. Large files carry it too. Nothing changed on the server: it already took `replaces_attachment_id`, so this works against the current deploy.
|
|
8
|
+
- The skill's CLI and file pages describe both flags.
|
|
9
|
+
|
|
10
|
+
## 0.7.0
|
|
11
|
+
|
|
12
|
+
- Upload links for several files in one call: `get_upload_link` takes `files`, up to 25 entries each with `item_id`, `filename` and `size_bytes`, and the REST API has `POST /v1/upload-links` for the same. `listspace attach` uses it when it sends two or more files over 8 MB: it asks for the links of a few files at a time, right before sending them: a file joins a chunk only while the bytes queued ahead of it stay under about 500 MB, since a link for a large file holds room in storage and its upload must start within 15 minutes. A link that has run out or runs out within a minute is replaced by a fresh one before its upload. The CLI sends the files that got a link, names the ones that did not, and goes back to one link a file on a server that does not have the route yet. Publish this CLI after the server (the functions) is deployed.
|
|
13
|
+
- The upload limit counts files and bytes, not calls: 200 upload links or 10 GB an hour per account. A refusal says when to come back (`Try again after 14:32 UTC (in 12 minutes)`), with `retry_after_seconds` and `retry_at` in the error, and the CLI passes it on.
|
|
14
|
+
- The answer to an upload says in `attachment.is_cover` whether the file became the item's cover.
|
|
15
|
+
- The skill's file pages tell agents to send a batch in one call and to wait for the time the error names.
|
|
16
|
+
- The skill's file pages and tool table cover `copy_attachment` (a file of another item of the same board, copied on the server, no upload) and pictures inside an item's text (`` in `update_item`, read back as ``). Publish this after the server is deployed.
|
|
17
|
+
|
|
5
18
|
## 0.6.0
|
|
6
19
|
|
|
7
20
|
- `listspace attach` takes files up to the plan's size of one file (Free 25 MB, Pro 2 GB, a team's boards 5 GB), at most 4 GB from the CLI. Up to 8 MB a file goes in the request as before; a larger one goes straight to Listspace's file storage: the CLI asks for an upload link with the file's size, sends the file from disk (it is never read into memory) and then finishes the upload. A file over the plan's size is refused before any byte is sent.
|
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Write (the board's agent access level decides what is made and what waits in the
|
|
|
60
60
|
comment <item> <text> Add a comment (markdown) to an item.
|
|
61
61
|
move <item> <list>
|
|
62
62
|
done <item> Move to the board's done list.
|
|
63
|
-
list add <board> <title> [--kind info|capture|backlog|todo|doing|done]
|
|
63
|
+
list add <board> <title> [--kind info|capture|backlog|todo|doing|review|done]
|
|
64
64
|
list rename <list> <title> Here <list> is a list id.
|
|
65
65
|
undo <request_id> Take back one of your own calls.
|
|
66
66
|
Writes take --inbox --reason "<why>" to suggest instead of change.
|
|
@@ -71,7 +71,8 @@ Every MCP tool (the same tools, levels and results as the MCP server)
|
|
|
71
71
|
call <tool> ['<json>'] Run a tool with its arguments as one JSON object.
|
|
72
72
|
|
|
73
73
|
Files from this computer (needs level 4, Act)
|
|
74
|
-
attach <item> <file> [<file>...]
|
|
74
|
+
attach <item> <file> [<file>...] [--new-version | --version-of <attachment id>]
|
|
75
|
+
Up to the plan's size of one file, at most 4 GB.
|
|
75
76
|
|
|
76
77
|
Work on your own (needs level 4, Act)
|
|
77
78
|
next <board> [--kinds todo,backlog] [--label <id>] [--no-move] [--ttl <minutes>]
|
|
@@ -117,6 +118,14 @@ npx listspace attach 2b6f0c1e-... ./contract.pdf ./screenshots/footer.png
|
|
|
117
118
|
|
|
118
119
|
The type comes from the extension: images (jpg, png, gif, webp, svg), PDF, Word, Excel and PowerPoint files, text, Markdown, CSV, JSON, archives (zip, rar, 7z), audio and video. Each file can be as large as the plan of the board's owner allows (Free 25 MB, Pro 2 GB, a team's boards 5 GB), at most 4 GB from the CLI. A file over 8 MB goes straight to Listspace's file storage, sent from disk, and is put on the item when it has arrived. Every file is checked before the first one is sent. Attaching needs level 4 (Act) on the board: a file cannot wait in the Inbox.
|
|
119
120
|
|
|
121
|
+
Uploading a file again adds a second file by default. To make it the next version of the file already on the item, add `--new-version`:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx listspace attach 2b6f0c1e-... ./contract.pdf --new-version
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The current file with the same name becomes version 2 and the old one is kept as an older version, with its comments. If the item has no current file with that name, the file is added as a new file and the output says so. If two current files share the name, nothing is sent: the command lists them, and `--version-of <attachment id>` picks one (one file per command; the ids are in `npx listspace call list_attachments --json '{"item_id": "..."}'`). It follows the same rules as **Upload a new version** in the app, including storage, the virus check and the bin.
|
|
128
|
+
|
|
120
129
|
## Output for agents and scripts
|
|
121
130
|
|
|
122
131
|
Every command takes `--json` and then prints the API's JSON instead of text:
|
package/dist/listspace.mjs
CHANGED
|
@@ -73,7 +73,8 @@ function union(pick, a, b) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// src/schema.ts
|
|
76
|
-
var LIST_KINDS = ["info", "capture", "backlog", "todo", "doing", "done"];
|
|
76
|
+
var LIST_KINDS = ["info", "capture", "backlog", "todo", "doing", "review", "done"];
|
|
77
|
+
var NEXT_KINDS = LIST_KINDS.filter((kind) => kind !== "review");
|
|
77
78
|
var listKind = nullable(literal(...LIST_KINDS));
|
|
78
79
|
var level = object({
|
|
79
80
|
effective: literal(1, 2, 3, 4, 5),
|
|
@@ -216,7 +217,7 @@ var nextResult = union(
|
|
|
216
217
|
function page(entry) {
|
|
217
218
|
return object({ data: array(entry), next_cursor: nullable(string) });
|
|
218
219
|
}
|
|
219
|
-
var errorBody = object({ error: object({ code: string, message: string }) });
|
|
220
|
+
var errorBody = object({ error: object({ code: string, message: string, retry_after_seconds: withDefault(nullable(number), null) }) });
|
|
220
221
|
var attached = object({
|
|
221
222
|
outcome: literal("applied"),
|
|
222
223
|
level,
|
|
@@ -226,16 +227,27 @@ var attached = object({
|
|
|
226
227
|
filename: string,
|
|
227
228
|
mime_type: nullable(string),
|
|
228
229
|
size_bytes: nullable(number),
|
|
229
|
-
url: string
|
|
230
|
+
url: string,
|
|
231
|
+
/** 1 for a file never replaced, 2 and up for a newer version; null from a server that does not say. */
|
|
232
|
+
version: withDefault(nullable(number), null)
|
|
230
233
|
})
|
|
231
234
|
});
|
|
232
235
|
var largeUploadLink = object({
|
|
233
236
|
upload_url: string,
|
|
234
|
-
finish_url: nullable(string)
|
|
237
|
+
finish_url: nullable(string),
|
|
238
|
+
/** When upload_url stops working to start a PUT (15 minutes after the answer); null from a server that does not say. */
|
|
239
|
+
expires_at: withDefault(nullable(string), null)
|
|
240
|
+
});
|
|
241
|
+
var largeUploadLinks = object({
|
|
242
|
+
links: array(object({ index: number, upload_url: string, finish_url: nullable(string), expires_at: withDefault(nullable(string), null) })),
|
|
243
|
+
refused: array(object({ index: number, filename: string, message: string }))
|
|
244
|
+
});
|
|
245
|
+
var currentFiles = object({
|
|
246
|
+
attachments: array(object({ id: string, filename: string, version: withDefault(number, 1) }))
|
|
235
247
|
});
|
|
236
248
|
|
|
237
249
|
// src/version.ts
|
|
238
|
-
var VERSION = "0.
|
|
250
|
+
var VERSION = "0.8.0";
|
|
239
251
|
|
|
240
252
|
// src/api.ts
|
|
241
253
|
var DEFAULT_API_URL = "https://api.listspace.app/v1";
|
|
@@ -442,16 +454,19 @@ function decodeOrFail(decoder, value, path2) {
|
|
|
442
454
|
function errorFor(response, json) {
|
|
443
455
|
let code2 = "unknown";
|
|
444
456
|
let message = `Listspace answered ${response.status}.`;
|
|
457
|
+
let retryAfter = null;
|
|
445
458
|
try {
|
|
446
459
|
const parsed = errorBody(json, "body");
|
|
447
460
|
code2 = parsed.error.code;
|
|
448
461
|
message = parsed.error.message;
|
|
462
|
+
retryAfter = parsed.error.retry_after_seconds;
|
|
449
463
|
} catch {
|
|
450
464
|
}
|
|
451
465
|
if (response.status === 401) return { kind: "auth", message: `${message} ${LOGIN_HINT}` };
|
|
452
466
|
if (response.status === 429) {
|
|
453
467
|
const header = response.headers.get("Retry-After");
|
|
454
|
-
const seconds = header !== null && /^\d+$/.test(header) ? Number(header) : null;
|
|
468
|
+
const seconds = retryAfter ?? (header !== null && /^\d+$/.test(header) ? Number(header) : null);
|
|
469
|
+
if (/try again after/i.test(message)) return { kind: "rate_limited", message, retryAfterSeconds: seconds };
|
|
455
470
|
const wait = seconds === null ? "Wait a minute" : `Wait ${seconds} seconds`;
|
|
456
471
|
return { kind: "rate_limited", message: `${message} ${wait} before trying again.`, retryAfterSeconds: seconds };
|
|
457
472
|
}
|
|
@@ -705,7 +720,8 @@ function formatRelease(result) {
|
|
|
705
720
|
function formatAttached(results) {
|
|
706
721
|
return results.map(({ attachment, level: level2 }) => {
|
|
707
722
|
const size = attachment.size_bytes === null ? "" : ` (${formatSize(attachment.size_bytes)})`;
|
|
708
|
-
|
|
723
|
+
const version = attachment.version !== null && attachment.version > 1 ? ` as version ${attachment.version}` : "";
|
|
724
|
+
return `Attached "${attachment.filename}"${size}${version} to ${attachment.item_id} ${attachment.id} (${levelText(level2)}).`;
|
|
709
725
|
}).join("\n");
|
|
710
726
|
}
|
|
711
727
|
|
|
@@ -867,6 +883,45 @@ async function releaseCommand(client, input) {
|
|
|
867
883
|
const answer = await client.data("DELETE", `/items/${path(input.item)}/claim`, releaseResult);
|
|
868
884
|
return { raw: answer.raw, text: formatRelease(answer.value) };
|
|
869
885
|
}
|
|
886
|
+
var replacesField = (file) => file.replaces === void 0 ? {} : { replaces_attachment_id: file.replaces };
|
|
887
|
+
async function resolveVersions(client, item2, files, version) {
|
|
888
|
+
switch (version.kind) {
|
|
889
|
+
case "new_file":
|
|
890
|
+
return { files: [...files], notes: [] };
|
|
891
|
+
case "of": {
|
|
892
|
+
if (!UUID.test(version.attachmentId)) return fail({ kind: "usage", message: `"${version.attachmentId}" is not an attachment id. Attachment ids come from \`listspace call list_attachments --json '{"item_id": "${item2}"}'\`.` });
|
|
893
|
+
if (files.length !== 1) return fail({ kind: "usage", message: "--version-of replaces one file, so give it exactly one file." });
|
|
894
|
+
return { files: files.map((file) => ({ ...file, replaces: version.attachmentId })), notes: [] };
|
|
895
|
+
}
|
|
896
|
+
case "same_name": {
|
|
897
|
+
const names = files.map((file) => file.fileName);
|
|
898
|
+
const twice = names.find((name, index) => names.indexOf(name) !== index);
|
|
899
|
+
if (twice !== void 0) return fail({ kind: "usage", message: `${twice} is given twice, and --new-version would make the second one replace the first. Send one at a time.` });
|
|
900
|
+
const current = (await client.data("GET", `/items/${path(item2)}/attachments`, currentFiles)).value.attachments;
|
|
901
|
+
const out = [];
|
|
902
|
+
const notes = [];
|
|
903
|
+
for (const file of files) {
|
|
904
|
+
const same = current.filter((entry) => entry.filename === file.fileName);
|
|
905
|
+
const [only, ...others] = same;
|
|
906
|
+
if (only === void 0) {
|
|
907
|
+
out.push(file);
|
|
908
|
+
notes.push(`No current file named "${file.fileName}" on this item, so it was added as a new file.`);
|
|
909
|
+
} else if (others.length > 0) {
|
|
910
|
+
const lines = same.map((entry) => ` ${entry.id} ${entry.filename} (version ${entry.version})`).join("\n");
|
|
911
|
+
return fail({ kind: "usage", message: `${same.length} current files on this item are named "${file.fileName}". Nothing was sent. Pick one with --version-of <attachment id>:
|
|
912
|
+
${lines}` });
|
|
913
|
+
} else {
|
|
914
|
+
out.push({ ...file, replaces: only.id });
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
return { files: out, notes };
|
|
918
|
+
}
|
|
919
|
+
default: {
|
|
920
|
+
const exhaustive = version;
|
|
921
|
+
return exhaustive;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
870
925
|
async function prepareFiles(paths, read) {
|
|
871
926
|
const out = [];
|
|
872
927
|
for (const filePath of paths) {
|
|
@@ -901,34 +956,90 @@ async function prepareFiles(paths, read) {
|
|
|
901
956
|
}
|
|
902
957
|
return out;
|
|
903
958
|
}
|
|
959
|
+
var CHUNK_BYTES = 500 * 1024 * 1024;
|
|
960
|
+
var CHUNK_FILES = 10;
|
|
961
|
+
var STALE_MS = 6e4;
|
|
904
962
|
async function attachCommand(client, input) {
|
|
905
963
|
if (!UUID.test(input.item)) return fail({ kind: "usage", message: `"${input.item}" is not an item id. Item ids come from \`listspace board <board>\`.` });
|
|
964
|
+
const resolved = await resolveVersions(client, input.item, input.files, input.version ?? { kind: "new_file" });
|
|
965
|
+
const files = resolved.files;
|
|
906
966
|
const results = [];
|
|
907
967
|
const raw = [];
|
|
908
|
-
|
|
968
|
+
const skipped = [];
|
|
969
|
+
const links = /* @__PURE__ */ new Map();
|
|
970
|
+
let batches = true;
|
|
971
|
+
for (const [position, file] of files.entries()) {
|
|
909
972
|
try {
|
|
910
|
-
|
|
973
|
+
let made;
|
|
974
|
+
if (file.content.kind === "blob") {
|
|
975
|
+
if (batches && !links.has(file)) batches = await askForLinks(client, input.item, files.slice(position), links);
|
|
976
|
+
const got = links.get(file);
|
|
977
|
+
if (got !== void 0 && "refused" in got) {
|
|
978
|
+
skipped.push({ name: file.fileName, reason: got.refused });
|
|
979
|
+
continue;
|
|
980
|
+
}
|
|
981
|
+
made = got;
|
|
982
|
+
}
|
|
983
|
+
const answer = await attachOne(client, input.item, file, made);
|
|
911
984
|
results.push(answer.value);
|
|
912
985
|
raw.push(answer.raw);
|
|
913
986
|
} catch (error) {
|
|
914
|
-
if (!(error instanceof CliFailure) || results.length === 0) throw error;
|
|
987
|
+
if (!(error instanceof CliFailure) || results.length === 0 && skipped.length === 0) throw error;
|
|
915
988
|
const done = results.map((result) => result.attachment.filename).join(", ");
|
|
916
|
-
throw new CliFailure({ ...error.error, message: `Attached ${done}; ${file.fileName} and the rest were not: ${error.error.message}` });
|
|
989
|
+
throw new CliFailure({ ...error.error, message: `Attached ${done === "" ? "nothing" : done}; ${file.fileName} and the rest were not: ${error.error.message}` });
|
|
917
990
|
}
|
|
918
991
|
}
|
|
919
|
-
|
|
992
|
+
if (skipped.length > 0) {
|
|
993
|
+
const done = results.map((result) => result.attachment.filename).join(", ");
|
|
994
|
+
return fail({
|
|
995
|
+
kind: "api",
|
|
996
|
+
status: 400,
|
|
997
|
+
code: "invalid_request",
|
|
998
|
+
message: `Attached ${done === "" ? "nothing" : done}; not attached: ${skipped.map((s) => `${s.name} (${s.reason})`).join("; ")}`
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
return { raw: { data: raw }, text: [formatAttached(results), ...resolved.notes].join("\n") };
|
|
1002
|
+
}
|
|
1003
|
+
async function askForLinks(client, item2, rest, links) {
|
|
1004
|
+
const next = rest.filter((file) => file.content.kind === "blob" && !links.has(file));
|
|
1005
|
+
if (next.length < 2) return true;
|
|
1006
|
+
const chunk = [];
|
|
1007
|
+
let queued = 0;
|
|
1008
|
+
for (const file of next) {
|
|
1009
|
+
if (chunk.length >= CHUNK_FILES || chunk.length > 0 && queued >= CHUNK_BYTES) break;
|
|
1010
|
+
chunk.push(file);
|
|
1011
|
+
queued += file.content.kind === "blob" ? file.content.sizeBytes : 0;
|
|
1012
|
+
}
|
|
1013
|
+
const body = { files: chunk.map((file) => ({ item_id: item2, filename: file.fileName, size_bytes: file.content.kind === "blob" ? file.content.sizeBytes : 0, ...replacesField(file) })) };
|
|
1014
|
+
let answer;
|
|
1015
|
+
try {
|
|
1016
|
+
answer = (await client.data("POST", "/upload-links", largeUploadLinks, { body })).value;
|
|
1017
|
+
} catch (error) {
|
|
1018
|
+
if (error instanceof CliFailure && error.error.kind === "api" && error.error.status === 404 && error.error.code === "not_found" && error.error.message.startsWith("No such endpoint")) return false;
|
|
1019
|
+
throw error;
|
|
1020
|
+
}
|
|
1021
|
+
for (const link of answer.links) {
|
|
1022
|
+
const file = chunk[link.index];
|
|
1023
|
+
if (file !== void 0) links.set(file, link);
|
|
1024
|
+
}
|
|
1025
|
+
for (const entry of answer.refused) {
|
|
1026
|
+
const file = chunk[entry.index];
|
|
1027
|
+
if (file !== void 0) links.set(file, { refused: entry.message });
|
|
1028
|
+
}
|
|
1029
|
+
return true;
|
|
920
1030
|
}
|
|
921
|
-
async function attachOne(client, item2, file) {
|
|
1031
|
+
async function attachOne(client, item2, file, made) {
|
|
922
1032
|
switch (file.content.kind) {
|
|
923
1033
|
case "bytes": {
|
|
924
|
-
const body = { filename: file.fileName, mime_type: file.mimeType, content_base64: Buffer.from(file.content.bytes).toString("base64") };
|
|
1034
|
+
const body = { filename: file.fileName, mime_type: file.mimeType, content_base64: Buffer.from(file.content.bytes).toString("base64"), ...replacesField(file) };
|
|
925
1035
|
return client.data("POST", `/items/${path(item2)}/attachments`, attached, { body });
|
|
926
1036
|
}
|
|
927
1037
|
case "blob": {
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1038
|
+
const stale = made !== void 0 && made.expires_at !== null && Date.parse(made.expires_at) - Date.now() < STALE_MS;
|
|
1039
|
+
const link = made === void 0 || stale ? (await client.data("POST", `/items/${path(item2)}/upload-links`, largeUploadLink, { body: { filename: file.fileName, size_bytes: file.content.sizeBytes, ...replacesField(file) } })).value : made;
|
|
1040
|
+
if (link.finish_url === null) return fail({ kind: "unexpected", message: "Listspace answered without a link to finish a large upload. Update the CLI, or the server is older than it." });
|
|
1041
|
+
await client.putToStorage(link.upload_url, file.content.blob);
|
|
1042
|
+
return client.finishUpload(link.finish_url, attached);
|
|
932
1043
|
}
|
|
933
1044
|
default: {
|
|
934
1045
|
const exhaustive = file.content;
|
|
@@ -1133,7 +1244,7 @@ Write (the board's agent access level decides what is made and what waits in the
|
|
|
1133
1244
|
comment <item> <text> Add a comment (markdown) to an item.
|
|
1134
1245
|
move <item> <list>
|
|
1135
1246
|
done <item> Move to the board's done list.
|
|
1136
|
-
list add <board> <title> [--kind info|capture|backlog|todo|doing|done]
|
|
1247
|
+
list add <board> <title> [--kind info|capture|backlog|todo|doing|review|done]
|
|
1137
1248
|
list rename <list> <title> Here <list> is a list id.
|
|
1138
1249
|
undo <request_id> Take back one of your own calls.
|
|
1139
1250
|
Writes take --inbox --reason "<why>" to suggest instead of change.
|
|
@@ -1147,13 +1258,22 @@ Every MCP tool (the same tools, levels and results as the MCP server)
|
|
|
1147
1258
|
idempotency_key, so a retry never makes it twice.
|
|
1148
1259
|
|
|
1149
1260
|
Files from this computer (needs level 4, Act; a file cannot wait in the Inbox)
|
|
1150
|
-
attach <item> <file> [<file>...]
|
|
1261
|
+
attach <item> <file> [<file>...] [--new-version | --version-of <attachment id>]
|
|
1151
1262
|
Upload files to an item: images, PDF, Office
|
|
1152
1263
|
files, text, Markdown, CSV, JSON, archives, audio
|
|
1153
1264
|
and video. Up to the plan's size of one file
|
|
1154
1265
|
(Free 25 MB, Pro 2 GB, a team's boards 5 GB), at
|
|
1155
1266
|
most 4 GB from here; over 8 MB the file goes
|
|
1156
1267
|
straight to file storage.
|
|
1268
|
+
--new-version: a file with the name of a current
|
|
1269
|
+
file on the item becomes its newest version (the
|
|
1270
|
+
old one is kept as an older version). No file of
|
|
1271
|
+
that name: it is added as a new file, and the
|
|
1272
|
+
output says so. Several files of that name: it
|
|
1273
|
+
stops and lists them.
|
|
1274
|
+
--version-of: the attachment id of the current
|
|
1275
|
+
file to replace (one file; ids come from
|
|
1276
|
+
call list_attachments).
|
|
1157
1277
|
|
|
1158
1278
|
Work on your own (needs level 4, Act; other agents leave a claimed item alone)
|
|
1159
1279
|
next <board> [--kinds todo,backlog] [--label <id>] [--no-move] [--ttl <minutes>]
|
|
@@ -1168,7 +1288,7 @@ Work on your own (needs level 4, Act; other agents leave a claimed item alone)
|
|
|
1168
1288
|
the item renews it.
|
|
1169
1289
|
|
|
1170
1290
|
<board> is an id or a title, <list> an id, a title or a kind (todo, doing, done,
|
|
1171
|
-
info, capture, backlog), <item> an item id.
|
|
1291
|
+
info, capture, backlog, review), <item> an item id.
|
|
1172
1292
|
|
|
1173
1293
|
Options
|
|
1174
1294
|
--json Print the server's JSON (for agents and scripts).
|
|
@@ -1207,7 +1327,9 @@ var OPTIONS = {
|
|
|
1207
1327
|
kinds: { type: "string" },
|
|
1208
1328
|
label: { type: "string", multiple: true },
|
|
1209
1329
|
"no-move": { type: "boolean" },
|
|
1210
|
-
ttl: { type: "string" }
|
|
1330
|
+
ttl: { type: "string" },
|
|
1331
|
+
"new-version": { type: "boolean" },
|
|
1332
|
+
"version-of": { type: "string" }
|
|
1211
1333
|
};
|
|
1212
1334
|
var usage = (message) => fail({ kind: "usage", message: `${message} Run \`listspace --help\`.` });
|
|
1213
1335
|
function positionals(command, given, names) {
|
|
@@ -1232,13 +1354,20 @@ function ttlFrom(flags) {
|
|
|
1232
1354
|
if (minutes === null) return usage("--ttl is a whole number of minutes from 5 to 1440.");
|
|
1233
1355
|
return minutes;
|
|
1234
1356
|
}
|
|
1357
|
+
function versionFrom(flags) {
|
|
1358
|
+
const sameName = flags["new-version"] === true;
|
|
1359
|
+
const picked = flags["version-of"];
|
|
1360
|
+
if (sameName && picked !== void 0) return usage("Give --new-version or --version-of <attachment id>, not both.");
|
|
1361
|
+
if (picked !== void 0) return { kind: "of", attachmentId: picked.trim() };
|
|
1362
|
+
return sameName ? { kind: "same_name" } : { kind: "new_file" };
|
|
1363
|
+
}
|
|
1235
1364
|
function kindsFrom(flags) {
|
|
1236
1365
|
if (flags.kinds === void 0) return [];
|
|
1237
1366
|
const kinds = [];
|
|
1238
1367
|
for (const part of flags.kinds.split(",")) {
|
|
1239
1368
|
const wanted = part.trim().toLowerCase();
|
|
1240
|
-
const kind =
|
|
1241
|
-
if (kind === void 0) return usage(`--kinds takes a comma list of ${
|
|
1369
|
+
const kind = NEXT_KINDS.find((candidate) => candidate === wanted);
|
|
1370
|
+
if (kind === void 0) return usage(`--kinds takes a comma list of ${NEXT_KINDS.join(", ")}; "${part.trim()}" is not one.`);
|
|
1242
1371
|
if (!kinds.includes(kind)) kinds.push(kind);
|
|
1243
1372
|
}
|
|
1244
1373
|
return kinds;
|
|
@@ -1404,8 +1533,9 @@ async function dispatch(command, args, flags, io, dir) {
|
|
|
1404
1533
|
const [item2, ...paths] = args;
|
|
1405
1534
|
if (item2 === void 0 || paths.length === 0) return usage("`attach` takes <item> and one or more files.");
|
|
1406
1535
|
if (flags.inbox === true) return usage("A file cannot wait in the Inbox: attaching needs level 4 (Act) on the board.");
|
|
1536
|
+
const version = versionFrom(flags);
|
|
1407
1537
|
const files = await prepareFiles(paths, io.readFile);
|
|
1408
|
-
return attachCommand(await clientFor(io, dir), { item: item2, files });
|
|
1538
|
+
return attachCommand(await clientFor(io, dir), { item: item2, files, version });
|
|
1409
1539
|
}
|
|
1410
1540
|
case "undo": {
|
|
1411
1541
|
const [requestId] = positionals(command, args, ["request_id"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "listspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Listspace from the command line: the agentic project memory, for people and coding agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"listspace",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "esbuild src/main.ts --bundle --platform=node --format=esm --target=node20 --outfile=dist/listspace.mjs --banner:js=\"#!/usr/bin/env node\"",
|
|
43
43
|
"typecheck": "tsc --noEmit",
|
|
44
|
-
"test": "tsc -p tsconfig.test.json && node --test build/test/api.test.js build/test/cli.test.js build/test/config.test.js build/test/commands.test.js build/test/attach.test.js build/test/tools.test.js",
|
|
44
|
+
"test": "tsc -p tsconfig.test.json && node --test build/test/api.test.js build/test/cli.test.js build/test/config.test.js build/test/commands.test.js build/test/attach.test.js build/test/attachVersion.test.js build/test/tools.test.js",
|
|
45
45
|
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|