@wirecat/cli-core 0.730.0 → 0.731.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 CHANGED
@@ -5,6 +5,48 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
5
5
  minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
6
6
  shape of this file.
7
7
 
8
+ ## 0.731.0 — 23.11.2026
9
+
10
+ ### Added
11
+
12
+ - **`DOCUMENT_UNTRUSTED`, `DOCUMENT_CONTEXT_UNTRUSTED` and `marksUntrusted` from `@wirecat/cli-core/documents/cli`**,
13
+ for a CLI with its own `documents`, `catalog` or knowledge commands to mark the same text as the shared ones
14
+ ([DOCUMENTS.md](docs/dev/DOCUMENTS.md#shared-commands)).
15
+ - **`SourceWalk.deleted`**: the ids a stopped walk found deleted, so the call that resumes it removes them as
16
+ deleted. A CLI that validates its walk file with a strict schema must accept the key; one that strips it removes
17
+ them as `unavailable` ([DOCUMENTS.md](docs/dev/DOCUMENTS.md#walks-over-several-syncs)).
18
+
19
+ ### Changed — may break callers
20
+
21
+ - **The tracker writes use the family's words.** `issues comment <issue> --body <text>` is now
22
+ `issues comments create <issue> --text <text>`, and its permission key `issues.comment` is now
23
+ `issues.comments.create` (`TRACKER_WRITE_KEYS`): a saved `issues.comment` is refused and names the new key, and
24
+ `trackerAlsoChecks` finds the write by its path. On `issues create|update`, `--state <state>` is now
25
+ `--status <state>`, the family's flag for the state to put a thing in, and `--parent <issue>` is now `--parent <id>`,
26
+ with the same values. `--priority <n>` takes the family's priority, as `tasks` do: low, medium, high, critical
27
+ (or the tracker's urgent) and none, a score from 0.0 to 1.0, or the old 0 urgent … 4 low, written on the tracker's
28
+ scale (critical 1, high 2, medium 3, low 4, none 0). A bare `2` was the tracker's high and is now the family's
29
+ medium. An issue's answer has `priority_label` beside the tracker's `priority`. No tracker CLI with these commands
30
+ is published yet; linear-cli moves its tests and README with its next bump
31
+ ([TRACKER.md](docs/dev/TRACKER.md#writes), #3237).
32
+
33
+ ### Fixed
34
+
35
+ - **A documents CLI marks other people's text for a scheduled agent.** The shared reads declare the names, titles,
36
+ paths, text, excerpts and link text of a provider's files as untrusted (`DOCUMENT_UNTRUSTED`): `documents
37
+ list|show|history`, `changes`, `search`, `folders list`, `folders browse`, `catalog show|list|search|tree`, the link
38
+ text in `relationships list`, and in `documents context` the document and its links but not the owner's notes,
39
+ memories and facts. `files sheets show` and `files documents show` mark the cells and paragraphs, `mirrors
40
+ conflicts show` the path, the three versions, the merge and its hunks. In a run locked read-only with a mark, that
41
+ text now comes between the run's markers, so an agent's answers there quote it marked; elsewhere no answer changes.
42
+ A CLI with its own copies of these commands declares the same list, exported with `marksUntrusted` from
43
+ `@wirecat/cli-core/documents/cli` ([DOCUMENTS.md](docs/dev/DOCUMENTS.md#shared-commands)).
44
+ - **A full walk removes a row its listing puts in the trash as deleted.** A listed row with `trashed: true` (Linear's
45
+ trash, listed through `includeArchived`; a manifest's `trashed` path) used to stay `unavailable` with its text kept
46
+ for good when a `--rescan` saw it first; it now leaves as `deleted`, as the change feed's trashed row does, and
47
+ `changes` shows it so. A row a finished walk does not list is still `unavailable`. A stopped walk, a round of
48
+ changes' included, keeps the reason in its walk file's new `deleted` list ([DOCUMENTS.md](docs/dev/DOCUMENTS.md#a-trashed-row-in-a-listing)).
49
+
8
50
  ## 0.730.0 — 23.11.2026
9
51
 
10
52
  ### Added
@@ -5,6 +5,7 @@ import { CATALOG_QUERY } from "../../store/index.js";
5
5
  import { honoursDryRun } from "../dry-run-guard.js";
6
6
  import { LOCAL_READ, LOCAL_WRITE } from "../effects.js";
7
7
  import { itemOf, listOf } from "../envelope.js";
8
+ import { DOCUMENT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
8
9
  import { bindQuery, documentQueries, tagRow, termsOf } from "./queries.js";
9
10
  import { allOf, examples, nonnegative, positive, wordsOf } from "./words.js";
10
11
  /** How many entries one `catalog tree` answer holds before it asks for a smaller folder or depth. */
@@ -147,6 +148,8 @@ export const CATALOG_FIELDS = Object.keys({
147
148
  content: true,
148
149
  });
149
150
  const local = (command, mutates = false) => annotate(command, { effects: mutates ? LOCAL_WRITE : LOCAL_READ });
151
+ // Names, descriptions and the people seen on a file are the provider's; the owner's own tags are not in these answers.
152
+ const read = (command) => marksUntrusted(local(command), DOCUMENT_UNTRUSTED);
150
153
  const addDocumentCatalogCommandsDefinition = (program, helpers) => {
151
154
  const { output } = helpers;
152
155
  const wording = wordsOf(helpers.words);
@@ -170,7 +173,7 @@ const addDocumentCatalogCommandsDefinition = (program, helpers) => {
170
173
  return found;
171
174
  };
172
175
  examples(local(catalog.command("import").description("put cached file and folder metadata into the shared database"), true), [`${prefix} catalog import --offline`]).action(async () => output(itemOf(await run((index, principal) => index.catalog.import(principal), true))));
173
- examples(annotate(local(catalog.command("show").description("show stored metadata and the stable file or folder reference")), {
176
+ examples(annotate(read(catalog.command("show").description("show stored metadata and the stable file or folder reference")), {
174
177
  output: { entity: "document", view },
175
178
  }), [`${prefix} catalog show FILE_ID --offline`])
176
179
  .argument("<file>", text.catalogArgument)
@@ -189,7 +192,7 @@ const addDocumentCatalogCommandsDefinition = (program, helpers) => {
189
192
  }));
190
193
  };
191
194
  for (const action of ["list", "search"]) {
192
- const command = examples(local(catalog
195
+ const command = examples(read(catalog
193
196
  .command(action)
194
197
  .description(action === "list"
195
198
  ? "list cached files and folders using metadata queries"
@@ -204,7 +207,7 @@ const addDocumentCatalogCommandsDefinition = (program, helpers) => {
204
207
  .action(async (terms, args) => list(terms, args, action === "search"));
205
208
  annotate(command, { query: CATALOG_QUERY, output: { entity: "document", view } });
206
209
  }
207
- examples(local(catalog.command("tree").description("show the cached hierarchy below a folder or all selected roots")), [`${prefix} catalog tree --offline`, `${prefix} catalog tree FOLDER_ID --depth 3 --offline`])
210
+ examples(read(catalog.command("tree").description("show the cached hierarchy below a folder or all selected roots")), [`${prefix} catalog tree --offline`, `${prefix} catalog tree FOLDER_ID --depth 3 --offline`])
208
211
  .argument("[folder]", text.treeArgument)
209
212
  .option("--depth <n>", "maximum descendant depth, from 0 to 50", nonnegative, 5)
210
213
  .action(async (id, args) => output(await run(async (index, principal) => {
@@ -6,13 +6,14 @@ import { honoursDryRun } from "../dry-run-guard.js";
6
6
  import { LOCAL_READ, LOCAL_WRITE } from "../effects.js";
7
7
  import { itemOf, listOf } from "../envelope.js";
8
8
  import { listQuery, typedQuery, withQuery } from "../list-query.js";
9
+ import { DOCUMENT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
9
10
  import { ageOf, documentsGroup, examples, positive, staleCopy, wordsOf } from "./words.js";
10
11
  const addLocalDocumentCommandsDefinition = (program, helpers) => {
11
12
  const { output, lastSync } = helpers;
12
13
  const wording = wordsOf(helpers.words);
13
14
  const { prefix, provider, text } = wording;
14
15
  const documents = documentsGroup(program, wording);
15
- annotate(withQuery(examples(annotate(documents.command("list"), { effects: LOCAL_READ }).description(text.documentsList), [
16
+ annotate(withQuery(examples(marksUntrusted(annotate(documents.command("list"), { effects: LOCAL_READ }).description(text.documentsList), DOCUMENT_UNTRUSTED), [
16
17
  `${prefix} documents list`,
17
18
  `${prefix} documents list tag:budget`,
18
19
  `${prefix} documents list person:PERSON_UID --limit 10`,
@@ -34,7 +35,7 @@ const addLocalDocumentCommandsDefinition = (program, helpers) => {
34
35
  args: { query: query || undefined },
35
36
  }));
36
37
  });
37
- examples(annotate(documents.command("show"), { effects: LOCAL_READ, partial: true })
38
+ examples(marksUntrusted(annotate(documents.command("show"), { effects: LOCAL_READ, partial: true }), DOCUMENT_UNTRUSTED)
38
39
  .argument("<document>", text.documentArgument)
39
40
  .description("show an imported document's text, tabs and metadata"), [`${prefix} documents show DOC_ID`, `${prefix} documents show document:42 --offline`]).action((input) => {
40
41
  const { metadata, snapshot } = helpers.document(input);
@@ -7,8 +7,19 @@ import { refusedPlace } from "../../sends/upload.js";
7
7
  import { environmentOf } from "../context.js";
8
8
  import { LOCAL_READ, ownerOnlyOption, REMOTE_WRITE } from "../effects.js";
9
9
  import { itemOf, listOf, snakeKeys } from "../envelope.js";
10
+ import { marksUntrusted } from "../untrusted-marks.js";
10
11
  const ID = "mirror id from mirrors list";
11
12
  const PATH = "the file's path inside the mirror, like notes/plan.md";
13
+ const CONFLICT_UNTRUSTED = [
14
+ "path",
15
+ "base.text",
16
+ "local.text",
17
+ "remote.text",
18
+ "merged",
19
+ "hunks.base",
20
+ "hunks.local",
21
+ "hunks.remote",
22
+ ];
12
23
  /**
13
24
  * `mirrors conflicts list|show|resolve` for a file mirror: the conflicts the last sync left, each with its three
14
25
  * versions and the line merge that failed, and a resolution that writes one final content to both sides.
@@ -36,10 +47,12 @@ export const fileConflictsCommand = (helpers) => {
36
47
  has_more: false,
37
48
  }));
38
49
  }))
39
- .addCommand(annotate(new Command("show"), {
50
+ .addCommand(
51
+ // The remote side is someone else's, and the base and the merge hold it too.
52
+ marksUntrusted(annotate(new Command("show"), {
40
53
  effects: LOCAL_READ,
41
54
  examples: [`${app} personal mirrors conflicts show 1a2b3c4d notes/plan.md --json`],
42
- })
55
+ }), CONFLICT_UNTRUSTED)
43
56
  .summary("show a conflict's three versions and the lines that conflict")
44
57
  .description("show a conflict's three versions (the last sync's, the local and the remote) and each changed stretch " +
45
58
  "of the line merge; merged is the whole file with conflict markers, a start for resolve --file")
@@ -10,6 +10,7 @@ import { guardedFileWrite, remoteChanged } from "../../services/files/guarded-wr
10
10
  import { honoursDryRun } from "../dry-run-guard.js";
11
11
  import { REMOTE_READ, REMOTE_WRITE } from "../effects.js";
12
12
  import { itemOf } from "../envelope.js";
13
+ import { marksUntrusted } from "../untrusted-marks.js";
13
14
  import { addFileUpdateCommand, replacedOf, sha256Of, } from "./file-update.js";
14
15
  import { examples, wordsOf } from "./words.js";
15
16
  /** The whole file is held in memory to edit it. */
@@ -158,7 +159,11 @@ const addFileEditCommandsDefinition = (files, helpers) => {
158
159
  helpers.output(itemOf(item), command);
159
160
  };
160
161
  const sheets = annotate(files.command("sheets"), { effects: REMOTE_READ }).description(`the cells of an Excel workbook (.xlsx) on ${place}, read and changed in place`);
161
- examples(annotate(sheets.command("show"), { effects: REMOTE_READ, offline: false })
162
+ examples(marksUntrusted(annotate(sheets.command("show"), { effects: REMOTE_READ, offline: false }), [
163
+ "sheets.name",
164
+ "sheets.cells.value",
165
+ "sheets.cells.formula",
166
+ ])
162
167
  .summary("show a workbook's cells and the sha256 to edit them at")
163
168
  .description("show a workbook's stored cells, each with its value, type, formula and format, and the file's sha256 to pass " +
164
169
  "as --expected-fingerprint to sheets update. Formulas show the value Excel saved last")
@@ -235,7 +240,7 @@ const addFileEditCommandsDefinition = (files, helpers) => {
235
240
  });
236
241
  });
237
242
  const documents = annotate(files.command("documents"), { effects: REMOTE_READ }).description(`the paragraphs of a Word document (.docx) on ${place}, read and changed in place`);
238
- examples(annotate(documents.command("show"), { effects: REMOTE_READ, offline: false })
243
+ examples(marksUntrusted(annotate(documents.command("show"), { effects: REMOTE_READ, offline: false }), ["paragraphs.text"])
239
244
  .summary("show a document's paragraphs and the sha256 to edit them at")
240
245
  .description("show a Word document's paragraphs by index, with their style, whether each can be edited and why not, and " +
241
246
  "the file's sha256 to pass as --expected-fingerprint to documents update")
@@ -2,6 +2,7 @@ import { annotate, sharedCommand } from "@wirecat/cli-base/commands";
2
2
  import { honoursDryRun } from "../dry-run-guard.js";
3
3
  import { FETCH, LOCAL_READ, LOCAL_WRITE } from "../effects.js";
4
4
  import { itemOf } from "../envelope.js";
5
+ import { DOCUMENT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
5
6
  import { bindQuery, documentQueries, folderRow, termsOf } from "./queries.js";
6
7
  import { allOf, examples, wordsOf } from "./words.js";
7
8
  const addDocumentFolderCommandsDefinition = (program, helpers) => {
@@ -16,7 +17,7 @@ const addDocumentFolderCommandsDefinition = (program, helpers) => {
16
17
  const { id, name } = await helpers.add(input);
17
18
  output(itemOf({ id, name, added: true }));
18
19
  });
19
- bindQuery(examples(annotate(folders.command("list"), { effects: LOCAL_READ }).description("list the folder ids sync imports"), [`${prefix} folders list`]), queries.folders, folderRow).action((words) => {
20
+ bindQuery(examples(marksUntrusted(annotate(folders.command("list"), { effects: LOCAL_READ }), DOCUMENT_UNTRUSTED).description("list the folder ids sync imports"), [`${prefix} folders list`]), queries.folders, folderRow).action((words) => {
20
21
  const filter = termsOf(words, queries.folders, "folders list");
21
22
  output(allOf(helpers.list(filter)));
22
23
  });
@@ -9,6 +9,7 @@ import { honoursDryRun } from "../dry-run-guard.js";
9
9
  import { LOCAL_READ } from "../effects.js";
10
10
  import { itemOf, listOf } from "../envelope.js";
11
11
  import { count, fromFile } from "../settings.js";
12
+ import { DOCUMENT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
12
13
  import { documentsGroup, examples, positive, wordsOf } from "./words.js";
13
14
  /** `keep_versions_for_days`: a documents CLI adds it to `settingsFor` and passes `keepVersionsForDays` to its sync. */
14
15
  export const DOCUMENT_HISTORY_SETTINGS = {
@@ -42,7 +43,7 @@ const addDocumentHistoryCommandsDefinition = (program, helpers) => {
42
43
  });
43
44
  return found;
44
45
  };
45
- examples(annotate(documents.command("history"), { effects: LOCAL_READ })
46
+ examples(marksUntrusted(annotate(documents.command("history"), { effects: LOCAL_READ }), DOCUMENT_UNTRUSTED)
46
47
  .argument("<document>", text.documentArgument)
47
48
  .description("list the versions of a document kept in the local copy, or show one with --revision"), [`${prefix} documents history DOC_ID`, `${prefix} documents history DOC_ID --revision 3`])
48
49
  .option("--revision <n>", "show the text of this version", positive)
@@ -54,7 +55,7 @@ const addDocumentHistoryCommandsDefinition = (program, helpers) => {
54
55
  }
55
56
  helpers.output(itemOf(await history.versions(ref)));
56
57
  }));
57
- return examples(annotate(program.command("changes"), { effects: LOCAL_READ }).description("list the documents the sync added, changed, removed or brought back, newest first"), [`${prefix} changes`, `${prefix} changes --since 7d --event deleted,unavailable`])
58
+ return examples(marksUntrusted(annotate(program.command("changes"), { effects: LOCAL_READ }), DOCUMENT_UNTRUSTED).description("list the documents the sync added, changed, removed or brought back, newest first"), [`${prefix} changes`, `${prefix} changes --since 7d --event deleted,unavailable`])
58
59
  .option("--since <time>", "from this time: an ISO 8601 time, today, yesterday, or 30m, 2h, 1d ago", "1d")
59
60
  .option("--until <time>", "up to this time, in the same forms")
60
61
  .option(`--event <events>`, `only these, comma separated: ${DOCUMENT_EVENTS.join(", ")}`, eventList)
@@ -8,6 +8,7 @@ import { type DocumentMirrorCommands } from "./mirrors.js";
8
8
  import { type DocumentSearchCommands } from "./search.js";
9
9
  import { type DocumentSyncCommands } from "./sync.js";
10
10
  import type { DocumentWords } from "./words.js";
11
+ export { DOCUMENT_CONTEXT_UNTRUSTED, DOCUMENT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
11
12
  export { addDocumentCatalogCommands, CATALOG_FIELDS, type CatalogTree, type CatalogTreeSource, catalogId, catalogOutput, catalogSource, catalogTree, type DocumentCatalog, type DocumentCatalogCommands, type DocumentCatalogStores, } from "./catalog.js";
12
13
  export { addLocalDocumentCommands, type ImportedDocument, type LocalDocumentCommands } from "./documents.js";
13
14
  export { type FileConflictCommands, type FileConflictConnection, fileConflictsCommand } from "./file-conflicts.js";
@@ -6,6 +6,7 @@ import { addDocumentKnowledgeCommands } from "./knowledge.js";
6
6
  import { addDocumentMirrorCommands } from "./mirrors.js";
7
7
  import { addDocumentSearchCommand } from "./search.js";
8
8
  import { addDocumentSyncCommands } from "./sync.js";
9
+ export { DOCUMENT_CONTEXT_UNTRUSTED, DOCUMENT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
9
10
  export { addDocumentCatalogCommands, CATALOG_FIELDS, catalogId, catalogOutput, catalogSource, catalogTree, } from "./catalog.js";
10
11
  export { addLocalDocumentCommands } from "./documents.js";
11
12
  export { fileConflictsCommand } from "./file-conflicts.js";
@@ -7,6 +7,7 @@ import { honoursDryRun } from "../dry-run-guard.js";
7
7
  import { LOCAL_READ, LOCAL_WRITE, REMOTE_WRITE } from "../effects.js";
8
8
  import { itemOf, listOf } from "../envelope.js";
9
9
  import { queryHelp, queryTerms, withQuery } from "../list-query.js";
10
+ import { DOCUMENT_CONTEXT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
10
11
  import { bindQuery, documentQueries, FACT_QUERY, factItem, identityRow, linkRow, MEMORY_QUERY, MEMORY_SEARCH_QUERY, memoryItem, memorySearch, tagRow, termsOf, } from "./queries.js";
11
12
  import { allOf, documentsGroup, examples, positive, wordsOf } from "./words.js";
12
13
  const addDocumentKnowledgeCommandsDefinition = (program, helpers) => {
@@ -17,7 +18,7 @@ const addDocumentKnowledgeCommandsDefinition = (program, helpers) => {
17
18
  const documentArgument = text.knowledgeArgument;
18
19
  const scopes = ["personal", "work"];
19
20
  const documents = documentsGroup(program, wording);
20
- examples(annotate(documents.command("context"), { effects: LOCAL_READ })
21
+ examples(marksUntrusted(annotate(documents.command("context"), { effects: LOCAL_READ }), DOCUMENT_CONTEXT_UNTRUSTED)
21
22
  .argument("<document>", documentArgument)
22
23
  .description("show a document with its tags, relationships, notes, memories and editors"), [`${prefix} documents context DOC_ID`]).action(async (doc) => output(itemOf(await run(doc, (k, p, ref) => k.context(p, ref)))));
23
24
  const tags = annotate(program.command("tags"), { effects: LOCAL_READ }).description("label imported documents; labels survive a sync");
@@ -37,7 +38,10 @@ const addDocumentKnowledgeCommandsDefinition = (program, helpers) => {
37
38
  .action(async (doc, values) => output(itemOf({ tags: await run(doc, (k, p, ref) => k.tags(p, ref, action, values)) })));
38
39
  }
39
40
  const relationships = annotate(program.command("relationships"), { effects: LOCAL_READ }).description("connect a document to people, projects, notes and other references");
40
- bindQuery(examples(annotate(relationships.command("list"), { effects: LOCAL_READ }).description("list a document's relationships"), [`${prefix} relationships list DOC_ID`]).argument("<document>", documentArgument), queries.links, linkRow).action(async (doc, words) => {
41
+ bindQuery(examples(marksUntrusted(annotate(relationships.command("list"), { effects: LOCAL_READ }), [
42
+ "targetText",
43
+ "target_text",
44
+ ]).description("list a document's relationships"), [`${prefix} relationships list DOC_ID`]).argument("<document>", documentArgument), queries.links, linkRow).action(async (doc, words) => {
41
45
  const { confirmed, ...filter } = termsOf(words, queries.links, "relationships list");
42
46
  output(allOf(await run(doc, (k, p, ref) => k.links(p, ref, { ...filter, ...(confirmed === undefined ? {} : { confirmed: confirmed === "true" }) }))));
43
47
  });
@@ -19,6 +19,7 @@ import { writesOwnerFiles } from "../effects.js";
19
19
  import { renderAnswer } from "../envelope.js";
20
20
  import { accountFileFor, profilesHere, rememberAccount } from "../messenger/accounts.js";
21
21
  import { ProfileTokenStore } from "../profile-token.js";
22
+ import { DOCUMENT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
22
23
  import { addDocumentCatalogCommands } from "./catalog.js";
23
24
  import { addLocalDocumentCommands } from "./documents.js";
24
25
  import { addDocumentFolderCommands } from "./folders.js";
@@ -542,8 +543,9 @@ const libraryOf = (options, withSync) => {
542
543
  const folders = find(holder, "folders");
543
544
  // Choosing a folder changes what the next sync keeps and removes, so an agent asks for it through the write tool.
544
545
  writesOwnerFiles(find(folders, "add"));
546
+ // The CLI's own listing of the provider's folders: names others chose.
545
547
  if (options.browse)
546
- annotate(find(folders, "browse"), { partial: true });
548
+ marksUntrusted(annotate(find(folders, "browse"), { partial: true }), DOCUMENT_UNTRUSTED);
547
549
  const start = (action, side, account) => {
548
550
  running = action;
549
551
  warnings = [];
@@ -2,6 +2,7 @@ import { annotate, sharedCommand } from "@wirecat/cli-base/commands";
2
2
  import { honoursDryRun } from "../dry-run-guard.js";
3
3
  import { LOCAL_READ } from "../effects.js";
4
4
  import { itemOf } from "../envelope.js";
5
+ import { DOCUMENT_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
5
6
  import { examples, positive, wordsOf } from "./words.js";
6
7
  const notImported = (app, folder, { profile, chosen, documents }) => {
7
8
  if (documents > 0)
@@ -14,7 +15,9 @@ const notImported = (app, folder, { profile, chosen, documents }) => {
14
15
  const addDocumentSearchCommandDefinition = (program, helpers) => {
15
16
  const wording = wordsOf(helpers.words);
16
17
  const { prefix } = wording;
17
- return examples(annotate(program.command("search"), { effects: LOCAL_READ })
18
+ return examples(
19
+ // Every hit is a document the profile copied from the provider, never a note of the owner's.
20
+ marksUntrusted(annotate(program.command("search"), { effects: LOCAL_READ }), DOCUMENT_UNTRUSTED)
18
21
  .argument("<query>", "words to look for, and fields such as tag: and date: that every hit must match")
19
22
  .description("search imported documents by words, and by meaning when indexed"), [`${prefix} search budget`, `${prefix} search "quarterly plan" --exact --limit 5`])
20
23
  .option("--limit <n>", "how many results to return", positive, 20)
@@ -24,6 +24,16 @@ export declare const MESSAGE_UNTRUSTED: readonly ["text", "transcript", "excerpt
24
24
  export declare const CHAT_UNTRUSTED: readonly ["title", "description"];
25
25
  /** Other people's text in a contact: what the person says about themselves and the titles of the chats shared. */
26
26
  export declare const CONTACT_UNTRUSTED: readonly ["description", "chats.title"];
27
+ /**
28
+ * Other people's text in a documents CLI's copy of a provider's files: names, titles and paths others chose, a
29
+ * document's text and tabs, a hit's excerpt and the link text written in it. Anyone who shares a file writes these.
30
+ */
31
+ export declare const DOCUMENT_UNTRUSTED: readonly ["name", "title", "path", "text", "description", "excerpt", "target_text", "targetText"];
32
+ /**
33
+ * `documents context`: the document and the links written in it. The notes, memories, facts and tags beside it are
34
+ * the owner's own, as a note is in `search notes`, so a bare `text` or `title` would mark them too.
35
+ */
36
+ export declare const DOCUMENT_CONTEXT_UNTRUSTED: string[];
27
37
  /** Declares the fields of a read's answer that hold other people's text, at any depth, for a scheduled agent's run. */
28
38
  export declare const marksUntrusted: <T extends Command>(command: T, fields?: readonly string[]) => T;
29
39
  export declare const untrustedFieldsOf: (command: Command) => readonly string[] | undefined;
@@ -90,6 +90,25 @@ export const MESSAGE_UNTRUSTED = [
90
90
  export const CHAT_UNTRUSTED = ["title", "description"];
91
91
  /** Other people's text in a contact: what the person says about themselves and the titles of the chats shared. */
92
92
  export const CONTACT_UNTRUSTED = ["description", "chats.title"];
93
+ /**
94
+ * Other people's text in a documents CLI's copy of a provider's files: names, titles and paths others chose, a
95
+ * document's text and tabs, a hit's excerpt and the link text written in it. Anyone who shares a file writes these.
96
+ */
97
+ export const DOCUMENT_UNTRUSTED = [
98
+ "name",
99
+ "title",
100
+ "path",
101
+ "text",
102
+ "description",
103
+ "excerpt",
104
+ "target_text",
105
+ "targetText",
106
+ ];
107
+ /**
108
+ * `documents context`: the document and the links written in it. The notes, memories, facts and tags beside it are
109
+ * the owner's own, as a note is in `search notes`, so a bare `text` or `title` would mark them too.
110
+ */
111
+ export const DOCUMENT_CONTEXT_UNTRUSTED = ["document.title", "document.text", "document.path", "links.targetText"];
93
112
  const DECLARED = new WeakMap();
94
113
  /** Declares the fields of a read's answer that hold other people's text, at any depth, for a scheduled agent's run. */
95
114
  export const marksUntrusted = (command, fields = MESSAGE_UNTRUSTED) => {
@@ -144,6 +144,8 @@ export interface SourceWalk<M extends SourceFile = SourceFile> {
144
144
  folders: Record<string, M>;
145
145
  files: M[];
146
146
  discovered: number;
147
+ /** Ids of `files` the source itself marked deleted, so a walk resumed in a later call still removes them so. */
148
+ deleted?: string[];
147
149
  }
148
150
  export interface SourceIndex<M extends SourceFile = SourceFile> {
149
151
  catalog?: {
@@ -8,6 +8,8 @@ export type TrackerKind = (typeof TRACKER_KINDS)[number];
8
8
  /** Where an issue in a state stands in its work, whatever the team named the state. */
9
9
  export declare const STATE_TYPES: readonly ["triage", "backlog", "unstarted", "started", "completed", "canceled"];
10
10
  export type StateType = (typeof STATE_TYPES)[number];
11
+ /** A tracker's 0–4 priority as the family's label: 0 is none, the tracker's 1 urgent is critical. */
12
+ export declare const TRACKER_PRIORITY_LABELS: readonly [null, "critical", "high", "medium", "low"];
11
13
  /**
12
14
  * Every record has the tracker's id. A field left out means the tracker did not say, and the store keeps what it
13
15
  * held; `null` means the tracker said there is none. Times are epoch milliseconds.
@@ -6,6 +6,8 @@
6
6
  export const TRACKER_KINDS = ["team", "user", "state", "label", "project", "issue", "comment"];
7
7
  /** Where an issue in a state stands in its work, whatever the team named the state. */
8
8
  export const STATE_TYPES = ["triage", "backlog", "unstarted", "started", "completed", "canceled"];
9
+ /** A tracker's 0–4 priority as the family's label: 0 is none, the tracker's 1 urgent is critical. */
10
+ export const TRACKER_PRIORITY_LABELS = [null, "critical", "high", "medium", "low"];
9
11
  /** The record's title in lists and search: an issue's title, a comment's start, anything else's name. */
10
12
  export const trackerTitleOf = (kind, record) => kind === "issue"
11
13
  ? record.title
@@ -86,8 +86,19 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
86
86
  files.delete(id);
87
87
  removals.set(id, reason);
88
88
  };
89
+ // A listing's own trash is the same signal as the feed's: the row leaves the copy as deleted. A full walk has
90
+ // cleared `files`, so the row goes into the saved walk from here.
91
+ const trash = (file) => {
92
+ files.delete(file.id);
93
+ delta.set(file.id, file);
94
+ removals.set(file.id, "deleted");
95
+ };
89
96
  const container = (file) => {
90
- if (options.isDocument?.(file))
97
+ if (!options.isDocument?.(file))
98
+ return;
99
+ if (file.trashed)
100
+ trash(file);
101
+ else
91
102
  keep(file);
92
103
  };
93
104
  // A folder the last finished pass walked keeps its subtree: a round lists only its direct children, and the
@@ -188,10 +199,13 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
188
199
  let found = [];
189
200
  if (walk) {
190
201
  const visited = new Set(walk.visited);
202
+ const deleted = new Set(walk.deleted);
191
203
  Object.assign(folders, walk.folders);
192
204
  for (const file of walk.files) {
193
- // A walk saved part way keeps no reason; one it cannot prove is a deletion keeps the text.
194
- if (file.trashed)
205
+ // One the saved walk cannot prove is a deletion keeps the text.
206
+ if (file.trashed && deleted.has(file.id))
207
+ trash(file);
208
+ else if (file.trashed)
195
209
  drop(file.id, "unavailable");
196
210
  else
197
211
  keep(file);
@@ -201,7 +215,14 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
201
215
  let savedAt = now();
202
216
  const current = walk;
203
217
  const record = () => {
204
- walks?.save({ ...current, visited: [...visited], folders, files: [...delta.values()] });
218
+ const deleted = [...removals].flatMap(([id, reason]) => (reason === "deleted" && delta.has(id) ? [id] : []));
219
+ walks?.save({
220
+ ...current,
221
+ visited: [...visited],
222
+ folders,
223
+ files: [...delta.values()],
224
+ ...(deleted.length ? { deleted } : {}),
225
+ });
205
226
  savedAt = now();
206
227
  };
207
228
  let spent = 0;
@@ -303,6 +324,8 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
303
324
  else
304
325
  nested.push({ id: file.id, ancestry: [...step.ancestry, folder.id], folder: file });
305
326
  }
327
+ else if (file.trashed)
328
+ trash(file);
306
329
  else
307
330
  keep(file);
308
331
  walk.stack.pop();
@@ -335,11 +358,13 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
335
358
  found = await query.list();
336
359
  const matched = new Set();
337
360
  for (const file of found) {
338
- if ((isFolder(file) && !options.isDocument?.(file)) ||
339
- file.trashed ||
340
- !query?.matches(file) ||
341
- matched.has(file.id))
361
+ if ((isFolder(file) && !options.isDocument?.(file)) || !query?.matches(file) || matched.has(file.id))
342
362
  continue;
363
+ if (file.trashed) {
364
+ files.delete(file.id);
365
+ removals.set(file.id, "deleted");
366
+ continue;
367
+ }
343
368
  // Listed again on every sync, so only a new or changed file is work; a skipped one keeps its skip.
344
369
  const prior = state.documents[file.id]?.metadata ?? state.skipped.find((item) => item.id === file.id)?.file;
345
370
  if (initial || !prior || changedSince(prior, file))
@@ -389,8 +414,9 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
389
414
  // After every real edit, so a run that stops on its deadline spends it on those first.
390
415
  for (const job of again)
391
416
  jobs.push(job);
392
- // Absent from the listing is not a deletion: only the source's own signal is (`drop`). Out of scope is `unsynced`
393
- // only when the owner changed the scope; a folder above that was unshared or vanished leaves its files unavailable.
417
+ // Absent from the listing is not a deletion: only the source's own signal is (`drop`, `trash`). Out of scope is
418
+ // `unsynced` only when the owner changed the scope; a folder above that was unshared or vanished leaves its files
419
+ // unavailable.
394
420
  const narrowed = state.scope !== scope;
395
421
  for (const id of Object.keys(state.documents)) {
396
422
  const file = files.get(id);
@@ -23,7 +23,10 @@ export interface TrackerCommandOptions {
23
23
  open: (command: Command, access: {
24
24
  readOnly: boolean;
25
25
  }) => Promise<TrackerRun>;
26
- /** What the tracker's writer takes (`TrackerWriter.writes`): mounts `issues create`, `update` and `comment`. */
26
+ /**
27
+ * What the tracker's writer takes (`TrackerWriter.writes`): mounts `issues create`, `issues update` and
28
+ * `issues comments create`.
29
+ */
27
30
  writes?: readonly TrackerWrite[];
28
31
  /**
29
32
  * The documents half of `sync`, from `documentLibrary`, for a CLI that mounts the shared documents commands too:
@@ -33,7 +36,7 @@ export interface TrackerCommandOptions {
33
36
  now?: () => number;
34
37
  }
35
38
  /**
36
- * The tracker's commands: `sync`, `issues list|show|search|assign`, `issues create|update|comment` for the writes in
37
- * `writes`, and a `list` of each other kind.
39
+ * The tracker's commands: `sync`, `issues list|show|search|assign`, `issues create|update` and
40
+ * `issues comments create` for the writes in `writes`, and a `list` of each other kind.
38
41
  */
39
42
  export declare const addTrackerCommands: (program: Command, options: TrackerCommandOptions) => void;
@@ -9,7 +9,7 @@ import { FETCH, LOCAL_READ, LOCAL_WRITE, NO_EFFECTS } from "../../cli/effects.js
9
9
  import { itemOf, listOf, renderAnswer } from "../../cli/envelope.js";
10
10
  import { listQuery, nativeTermLists, queryTerms, termField, typedQuery, withQuery } from "../../cli/list-query.js";
11
11
  import { aheadOf } from "../../domain/moment.js";
12
- import { STATE_TYPES, TRACKER_KINDS, } from "../../domain/tracker.js";
12
+ import { STATE_TYPES, TRACKER_KINDS, TRACKER_PRIORITY_LABELS, } from "../../domain/tracker.js";
13
13
  import { count, text } from "../../entities/fields.js";
14
14
  import { embedTracker } from "../../services/tracker-meaning.js";
15
15
  import { syncTracker } from "../sync.js";
@@ -234,8 +234,11 @@ const withNames = async (run, items) => {
234
234
  const assignee = item.record.assignee
235
235
  ? users.get(item.record.assignee)
236
236
  : undefined;
237
+ const { priority } = item.record;
237
238
  return viewOf(item, {
238
239
  ...(state ? { state_name: state.name, state_type: state.type } : {}),
240
+ // Beside the tracker's number, the family's word, which --priority takes back.
241
+ ...(typeof priority === "number" ? { priority_label: TRACKER_PRIORITY_LABELS[priority] ?? null } : {}),
239
242
  ...(assignee ? { assignee_name: assignee.name } : {}),
240
243
  ...(item.record.assignee && people.has(item.record.assignee)
241
244
  ? { assignee_person: people.get(item.record.assignee) }
@@ -514,7 +517,7 @@ const addTrackerCommandsDefinition = (program, options) => {
514
517
  }
515
518
  };
516
519
  /**
517
- * The tracker's commands: `sync`, `issues list|show|search|assign`, `issues create|update|comment` for the writes in
518
- * `writes`, and a `list` of each other kind.
520
+ * The tracker's commands: `sync`, `issues list|show|search|assign`, `issues create|update` and
521
+ * `issues comments create` for the writes in `writes`, and a `list` of each other kind.
519
522
  */
520
523
  export const addTrackerCommands = honoursDryRun(sharedCommand(addTrackerCommandsDefinition));
@@ -2,7 +2,7 @@ import type { Command } from "commander";
2
2
  import type * as v from "valibot";
3
3
  import { type Body } from "../../cli/envelope.js";
4
4
  import type { TrackerItem } from "../../store/sqlite/tracker.js";
5
- import type { TrackerWrite } from "../writer.js";
5
+ import { type TrackerWrite } from "../writer.js";
6
6
  import { type TrackerWriteContext, type TrackerWrites } from "../writes.js";
7
7
  /** What the writes need of the open profile: the shared `TrackerRun` and its writes, built for the command run. */
8
8
  interface WriteRun {
@@ -22,6 +22,6 @@ export interface TrackerWriteCommandOptions<R extends WriteRun> {
22
22
  answer: v.GenericSchema;
23
23
  now: () => number;
24
24
  }
25
- /** `issues create|update|comment` for each write the tracker takes, under the `issues` group. */
25
+ /** `issues create|update` and `issues comments create`, for each write the tracker takes, under the `issues` group. */
26
26
  export declare const addTrackerWriteCommands: <R extends WriteRun>(issues: Command, options: TrackerWriteCommandOptions<R>) => void;
27
27
  export {};
@@ -1,17 +1,20 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { annotate } from "@wirecat/cli-base/commands";
3
3
  import { answerEntity } from "../../cli/answer-entity.js";
4
- import { REMOTE_WRITE } from "../../cli/effects.js";
4
+ import { NO_EFFECTS, REMOTE_WRITE } from "../../cli/effects.js";
5
5
  import { itemOf } from "../../cli/envelope.js";
6
6
  import { terminalAsker } from "../../cli/messenger/ask.js";
7
+ import { markRenamedPermissionKeys } from "../../cli/permission-keys.js";
8
+ import { TRACKER_WRITE_KEYS } from "../writer.js";
7
9
  import { commentTrackerIssue, createTrackerIssue, updateTrackerIssue, } from "../writes.js";
8
10
  const collect = (value, previous = []) => [...previous, value];
9
- const inputOf = ({ label, ...rest }) => ({
11
+ const inputOf = ({ label, status, ...rest }) => ({
10
12
  ...Object.fromEntries(Object.entries(rest).filter(([, value]) => value !== undefined)),
13
+ ...(status === undefined ? {} : { state: status }),
11
14
  // The empty default marks the flag as repeatable; left empty, the labels are not changed.
12
15
  ...(label?.length ? { labels: label } : {}),
13
16
  });
14
- /** `issues create|update|comment` for each write the tracker takes, under the `issues` group. */
17
+ /** `issues create|update` and `issues comments create`, for each write the tracker takes, under the `issues` group. */
15
18
  export const addTrackerWriteCommands = (issues, options) => {
16
19
  const contextOf = (run, command) => {
17
20
  if (!run.writes)
@@ -33,20 +36,20 @@ export const addTrackerWriteCommands = (issues, options) => {
33
36
  untrusted: shown.untrusted.map((field) => `${kind}.${field}`),
34
37
  });
35
38
  };
36
- const write = (name, description) => answerEntity(annotate(issues.command(name), { effects: REMOTE_WRITE, offline: false }), "tracker_write", options.answer).description(description);
39
+ const write = (group, name, description) => answerEntity(annotate(group.command(name), { effects: REMOTE_WRITE, offline: false }), "tracker_write", options.answer).description(description);
37
40
  const fields = (command) => command
38
41
  .option("--description <text>", "the issue's text; an empty value clears it")
39
42
  .option("--team <team>", "the team, by its id, key or name; left out, the copy's only team")
40
- .option("--state <state>", "the workflow state, by its id or a name only one of the team's states has")
41
43
  .option("--assignee <user>", "the user, by id, name or e-mail; empty for none; anyone but you checks issues.assign-others")
42
- .option("--priority <priority>", "0 to 4, or none, urgent, high, medium, low; empty for none")
44
+ .option("--priority <n>", "critical or urgent (1), high (2), medium (3), low (4), none or empty (0), a 0.0–1.0 score or the old 0–4")
45
+ .option("--status <state>", "the workflow state, by its id or a name only one of the team's states has")
43
46
  .option("--label <label>", "a label by its id or name; repeat it for each; replaces the issue's labels, and one empty value clears them", collect, [])
44
47
  .option("--project <project>", "the project, by its id or name; empty for none")
45
- .option("--parent <issue>", "the issue this one is part of, by its key or id; empty for none");
48
+ .option("--parent <id>", "the issue this one is part of, by its key or id; empty for none");
46
49
  const reference = (command) => command.argument("<issue>", "the issue's key (ENG-12) or id");
47
50
  if (options.writes.includes("create"))
48
51
  options
49
- .example(fields(write("create", "make an issue in the tracker, then store the tracker's copy of it").requiredOption("--title <title>", "the issue's title")), 'issues create --title "Example: invoices fail for EUR" --team ENG --label Bug', 'issues create --title "Example: write the guide" --assignee ada@example.com --priority high')
52
+ .example(fields(write(issues, "create", "make an issue in the tracker, then store the tracker's copy of it").requiredOption("--title <title>", "the issue's title")), 'issues create --title "Example: invoices fail for EUR" --team ENG --label Bug', 'issues create --title "Example: write the guide" --assignee ada@example.com --priority high')
50
53
  .action(async (typed, command) => {
51
54
  await options.within(command, false, async (run) => {
52
55
  const done = await createTrackerIssue(contextOf(run, command), inputOf(typed));
@@ -55,20 +58,23 @@ export const addTrackerWriteCommands = (issues, options) => {
55
58
  });
56
59
  if (options.writes.includes("update"))
57
60
  options
58
- .example(fields(reference(write("update", "change an issue in the tracker; what is left out keeps its value; the tracker's copy is stored again")).option("--title <title>", "the issue's title")), 'issues update ENG-12 --state "In Progress"', 'issues update ENG-12 --assignee ""')
61
+ .example(fields(reference(write(issues, "update", "change an issue in the tracker; what is left out keeps its value; the tracker's copy is stored again")).option("--title <title>", "the issue's title")), 'issues update ENG-12 --status "In Progress"', 'issues update ENG-12 --assignee ""')
59
62
  .action(async (issue, typed, command) => {
60
63
  await options.within(command, false, async (run) => {
61
64
  const done = await updateTrackerIssue(contextOf(run, command), issue, inputOf(typed));
62
65
  return answered(run, done.operationId, "issue", done.issue);
63
66
  });
64
67
  });
65
- if (options.writes.includes("comment"))
68
+ if (options.writes.includes("comment")) {
69
+ const comments = annotate(issues.command("comments"), { effects: NO_EFFECTS }).description("comments on the tracker's issues; issues show lists an issue's");
70
+ markRenamedPermissionKeys(comments, new Map([["issues.comment", TRACKER_WRITE_KEYS.comment]]));
66
71
  options
67
- .example(reference(write("comment", "add a comment to an issue in the tracker, then store it")).requiredOption("--body <text>", "the comment, as it is to read"), 'issues comment ENG-12 --body "Example: fixed in the next release"')
72
+ .example(reference(write(comments, "create", "add a comment to an issue in the tracker, then store it")).requiredOption("--text <text>", "the comment, as it is to read"), 'issues comments create ENG-12 --text "Example: fixed in the next release"')
68
73
  .action(async (issue, typed, command) => {
69
74
  await options.within(command, false, async (run) => {
70
- const done = await commentTrackerIssue(contextOf(run, command), issue, typed.body);
75
+ const done = await commentTrackerIssue(contextOf(run, command), issue, typed.text);
71
76
  return answered(run, done.operationId, "comment", done.comment);
72
77
  });
73
78
  });
79
+ }
74
80
  };
@@ -35,7 +35,7 @@ export interface TrackerWriteOptions {
35
35
  */
36
36
  export interface TrackerWriter {
37
37
  readonly provider: string;
38
- /** What this tracker takes: `issues create`, `issues update` and `issues comment` are mounted for these. */
38
+ /** What this tracker takes: `issues create`, `issues update` and `issues comments create` are mounted for these. */
39
39
  readonly writes: readonly TrackerWrite[];
40
40
  createIssue(draft: TrackerIssueDraft, options: TrackerWriteOptions): Promise<TrackerIssue>;
41
41
  updateIssue(externalId: string, patch: TrackerIssueFields, options: TrackerWriteOptions): Promise<TrackerIssue>;
@@ -3,7 +3,7 @@ export const TRACKER_WRITES = ["create", "update", "comment"];
3
3
  export const TRACKER_WRITE_KEYS = {
4
4
  create: "issues.create",
5
5
  update: "issues.update",
6
- comment: "issues.comment",
6
+ comment: "issues.comments.create",
7
7
  };
8
8
  /** Giving an issue to a tracker user other than the one the sign-in acts as, as `crm.assign-others` for a CRM. */
9
9
  export const TRACKER_ASSIGN_OTHERS_KEY = "issues.assign-others";
@@ -16,9 +16,8 @@ export const TRACKER_WRITE_DEFAULTS = { [TRACKER_ASSIGN_OTHERS_KEY]: "deny" };
16
16
  * `--dry-run` names each: `also` adds the CLI's own, such as the `api.*` key of the mutation it sends.
17
17
  */
18
18
  export const trackerAlsoChecks = (also) => (path) => {
19
- const [noun, command] = path;
20
- const write = TRACKER_WRITES.find((one) => one === command);
21
- if (path.length !== 2 || noun !== "issues" || write === undefined)
19
+ const write = TRACKER_WRITES.find((one) => TRACKER_WRITE_KEYS[one] === path.join("."));
20
+ if (write === undefined)
22
21
  return [];
23
22
  const assign = { key: TRACKER_ASSIGN_OTHERS_KEY, when: "--assignee other than the sign-in's user" };
24
23
  return [...(write === "comment" ? [] : [assign]), ...(also?.(write) ?? [])];
@@ -29,7 +29,7 @@ export interface TrackerIssueInput {
29
29
  team?: string;
30
30
  state?: string;
31
31
  assignee?: string;
32
- /** 0 to 4, or none, urgent, high, medium, low. */
32
+ /** The family's priority: a label, none, a 0.0–1.0 score or the old 0–4; urgent is critical. */
33
33
  priority?: string;
34
34
  labels?: readonly string[];
35
35
  project?: string;
@@ -1,12 +1,13 @@
1
1
  import { CliError, isCliError } from "@wirecat/cli-base";
2
+ import { TRACKER_PRIORITY_LABELS } from "../domain/tracker.js";
2
3
  import { foldName } from "../resolve.js";
3
4
  import { guardedWrite } from "../sends/guarded.js";
4
5
  import { askedKeys, profileWriteGuard } from "../sends/profile-writes.js";
5
6
  import { newOperationId } from "../sends/send-id.js";
7
+ import { priorityLabel, priorityOf } from "../tasks/index.js";
6
8
  import { trackerSelfOf } from "./sync.js";
7
9
  import { TRACKER_ASSIGN_OTHERS_KEY, TRACKER_WRITE_DEFAULTS, TRACKER_WRITE_KEYS, } from "./writer.js";
8
10
  const PAGE = 500;
9
- const PRIORITIES = { none: 0, urgent: 1, high: 2, medium: 3, low: 4 };
10
11
  const PLURALS = { team: "teams", user: "users", state: "states", label: "labels", project: "projects" };
11
12
  const invalid = (message, param, details = {}) => new CliError("validation_error", message, { reason: "tracker.field", ...(param ? { param } : {}), ...details });
12
13
  const supported = (writer, write) => {
@@ -88,15 +89,15 @@ export const trackerIssueOf = async (context, reference, param = "<issue>") => {
88
89
  throw new CliError("not_found", `no issue ${reference} in the copy; run sync, then try again`, { param });
89
90
  return found;
90
91
  };
91
- /** An empty value clears it, as for every other field: 0 is the tracker's "no priority". */
92
- const priorityOf = (typed) => {
93
- if (typed.trim() === "")
94
- return 0;
95
- const word = PRIORITIES[typed.trim().toLowerCase()];
96
- const number = word ?? Number(typed);
97
- if (!Number.isInteger(number) || number < 0 || number > 4)
98
- throw invalid("--priority is 0 to 4, or none, urgent, high, medium, low", "--priority");
99
- return number;
92
+ /** The family's priority (`priorityOf`, and the tracker's own `urgent`) on the tracker's 0 none, 1 urgent … 4 low. */
93
+ const trackerPriorityOf = (typed) => {
94
+ const word = typed.trim().toLowerCase() || "none";
95
+ try {
96
+ return TRACKER_PRIORITY_LABELS.indexOf(priorityLabel(priorityOf(word === "urgent" ? "critical" : word)));
97
+ }
98
+ catch (error) {
99
+ throw isCliError(error) ? invalid(error.message, "--priority") : error;
100
+ }
100
101
  };
101
102
  /** Typed fields into the port's, each reference resolved in the copy; `team` is the issue's, for its states. */
102
103
  const fieldsOf = async (context, input, team, self) => {
@@ -113,13 +114,13 @@ const fieldsOf = async (context, input, team, self) => {
113
114
  fields.team = team;
114
115
  if (input.state !== undefined) {
115
116
  if (cleared(input.state))
116
- throw invalid("every issue is in a state; name one", "--state");
117
- fields.state = await referenceOf(context, "state", input.state, "--state", team);
117
+ throw invalid("every issue is in a state; name one", "--status");
118
+ fields.state = await referenceOf(context, "state", input.state, "--status", team);
118
119
  }
119
120
  if (input.assignee !== undefined)
120
121
  fields.assignee = cleared(input.assignee) ? null : await referenceOf(context, "user", input.assignee, "--assignee");
121
122
  if (input.priority !== undefined)
122
- fields.priority = priorityOf(input.priority);
123
+ fields.priority = trackerPriorityOf(input.priority);
123
124
  if (input.labels !== undefined)
124
125
  fields.labels =
125
126
  input.labels.length === 1 && cleared(input.labels[0])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.730.0",
3
+ "version": "0.731.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",
@@ -334,7 +334,7 @@
334
334
  "@types/pngjs": "6.0.5",
335
335
  "@types/ssh2": "1.15.5",
336
336
  "@vitest/coverage-v8": "^5.0.5",
337
- "@wirecat/cli-base": "0.131.0",
337
+ "@wirecat/cli-base": "0.132.0",
338
338
  "@wirecat/cli-core-legacy-tags": "npm:@wirecat/cli-core@0.414.0",
339
339
  "ajv": "8.17.1",
340
340
  "commander": "15.0.0",