@wirecat/cli-core 0.719.0 → 0.721.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/attachments/documents.d.ts +5 -0
  3. package/dist/attachments/documents.js +2 -2
  4. package/dist/background/daily-archive-timer.d.ts +1 -1
  5. package/dist/cli/config-command.js +8 -2
  6. package/dist/cli/config-issues.d.ts +3 -1
  7. package/dist/cli/config-issues.js +9 -2
  8. package/dist/cli/documents/file-conflicts.d.ts +25 -0
  9. package/dist/cli/documents/file-conflicts.js +102 -0
  10. package/dist/cli/documents/file-edit.d.ts +29 -0
  11. package/dist/cli/documents/file-edit.js +352 -0
  12. package/dist/cli/documents/file-update.d.ts +43 -0
  13. package/dist/cli/documents/file-update.js +95 -0
  14. package/dist/cli/documents/history.d.ts +34 -0
  15. package/dist/cli/documents/history.js +89 -0
  16. package/dist/cli/documents/index.d.ts +9 -2
  17. package/dist/cli/documents/index.js +9 -2
  18. package/dist/cli/documents/library.js +10 -0
  19. package/dist/cli/permission-keys.d.ts +6 -0
  20. package/dist/cli/permission-keys.js +15 -3
  21. package/dist/cli/service-api.d.ts +1 -1
  22. package/dist/cli/service-api.js +16 -34
  23. package/dist/documents/file-mirror-model.d.ts +32 -1
  24. package/dist/documents/index.d.ts +7 -4
  25. package/dist/documents/index.js +4 -1
  26. package/dist/documents/model.d.ts +16 -1
  27. package/dist/errors/reasons.js +6 -1
  28. package/dist/office/docx.d.ts +43 -0
  29. package/dist/office/docx.js +349 -0
  30. package/dist/office/index.d.ts +2 -0
  31. package/dist/office/index.js +2 -0
  32. package/dist/office/package.d.ts +39 -0
  33. package/dist/office/package.js +98 -0
  34. package/dist/office/xlsx.d.ts +55 -0
  35. package/dist/office/xlsx.js +550 -0
  36. package/dist/office/xml.d.ts +34 -0
  37. package/dist/office/xml.js +186 -0
  38. package/dist/office/zip.d.ts +10 -0
  39. package/dist/office/zip.js +116 -0
  40. package/dist/services/documents/block-diff.d.ts +13 -3
  41. package/dist/services/documents/block-diff.js +13 -7
  42. package/dist/services/documents/ingestion.d.ts +21 -2
  43. package/dist/services/documents/ingestion.js +29 -2
  44. package/dist/services/documents/plan.js +16 -7
  45. package/dist/services/documents/ports.d.ts +2 -0
  46. package/dist/services/documents/sync.d.ts +1 -0
  47. package/dist/services/documents/sync.js +9 -4
  48. package/dist/services/files/conflicts.d.ts +78 -0
  49. package/dist/services/files/conflicts.js +183 -0
  50. package/dist/services/files/guarded-write.d.ts +34 -0
  51. package/dist/services/files/guarded-write.js +42 -0
  52. package/dist/services/files/listing.d.ts +36 -0
  53. package/dist/services/files/listing.js +47 -0
  54. package/dist/services/files/local-files.d.ts +54 -0
  55. package/dist/services/files/local-files.js +143 -0
  56. package/dist/services/files/mirror-state.d.ts +14 -0
  57. package/dist/services/files/mirror-state.js +65 -0
  58. package/dist/services/files/mirror.d.ts +4 -14
  59. package/dist/services/files/mirror.js +177 -204
  60. package/dist/services/files/text-merge.d.ts +27 -0
  61. package/dist/services/files/text-merge.js +134 -0
  62. package/dist/services/files/versions.d.ts +36 -9
  63. package/dist/services/files/versions.js +40 -12
  64. package/dist/store/index.d.ts +2 -0
  65. package/dist/store/index.js +1 -0
  66. package/dist/store/people.d.ts +8 -0
  67. package/dist/store/people.js +2 -0
  68. package/dist/store/sqlite/account-purge.js +3 -0
  69. package/dist/store/sqlite/document-history.d.ts +84 -0
  70. package/dist/store/sqlite/document-history.js +158 -0
  71. package/dist/store/sqlite/manifest.js +2 -0
  72. package/dist/store/sqlite/migrations.generated.js +17 -0
  73. package/dist/store/sqlite/notes.d.ts +9 -10
  74. package/dist/store/sqlite/notes.js +33 -21
  75. package/dist/store/sqlite/person-erase.d.ts +39 -0
  76. package/dist/store/sqlite/person-erase.js +152 -0
  77. package/dist/store/sqlite/schema/document-changes.d.ts +136 -0
  78. package/dist/store/sqlite/schema/document-changes.js +11 -0
  79. package/dist/store/sqlite/schema.d.ts +65 -0
  80. package/dist/store/sqlite/schema.js +5 -0
  81. package/package.json +6 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,75 @@ 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.721.0 — 23.11.2026
9
+
10
+ ### Added
11
+
12
+ - **A file written only at the hash it was read at.** `guardedFileWrite` writes over a provider's file through its
13
+ `FileTarget` only while the file still has the sha256 the caller read: the current content is downloaded into the
14
+ profile's version store and hashed, another hash is `conflict` (`mirror.remote-changed`) with nothing uploaded, and
15
+ the target checks it again just before the upload. What it replaced stays in the version store. The shared builder
16
+ `addFileUpdateCommand` adds `files update <path> (--text | stdin) [--expected-fingerprint <sha256>]` to a CLI's files
17
+ group, a remote write that asks the delete key when it replaces a file
18
+ ([DOCUMENTS.md](docs/dev/DOCUMENTS.md#write-one-file-at-the-hash-read)).
19
+ - **A file mirror merges text files both sides changed, and its conflicts can be resolved.** A `.md`, `.markdown`,
20
+ `.txt`, `.csv` or `.tsv` file up to 1 MB that changed on both sides since the last sync is merged line by line
21
+ (Markdown also by blocks, so a checklist tick and an edit of the same item merge) and written to both sides, in
22
+ every mirror; CRLF, a byte-order mark and other encodings pass through byte for byte. Lines both sides changed
23
+ differently stay a conflict, now recorded in the mirror's state: `listFileConflicts`, `showFileConflict` (the three
24
+ versions, the conflicting lines and the file with conflict markers) and `resolveFileConflict` (keep a side, both,
25
+ or a final file, refused with nothing written when either side changed since), mounted by `fileConflictsCommand`
26
+ as `mirrors conflicts list|show|resolve`. The contents of every merge, conflict and resolution are kept for good,
27
+ and `versions list` names each one's role ([DOCUMENTS.md](docs/dev/DOCUMENTS.md#plain-files-both-ways)).
28
+
29
+ ### Changed — may break callers
30
+
31
+ - **A file mirror writes a merged text file to both sides where it used to report a conflict.** A caller that counted
32
+ on every both-sides change waiting for `keep` now finds the file in the new `FileMirrorResult.merged`, and a plan
33
+ step of the new kind `merge`; `VersionDirection` gains `both` and `VersionEvent.event` gains `merged`, `conflict`
34
+ and `resolved`, so a switch over them needs the new cases. `FileVersions` gains `read(sha256)`, and `prune` takes
35
+ the contents to keep (`pinned`): an implementation of its own adds both. `versions.has` is false for anything but a
36
+ sha256.
37
+ - **An old flat `api` key is refused, not honoured: rename it to the key the refusal names.** A config that still names
38
+ `api.contacts-list` after the generated `api` group put that command under `api contacts list` no longer has the key
39
+ checked beside the new one. Every command refuses to run, `mcp serve` refuses to start, and `config set` refuses the
40
+ key, each with `configuration_error` or `validation_error` saying "its command moved, so rename it to
41
+ permissions.api.contacts.list". A moved path keeps no alias, its key included (WC-CMD-8). Until a CLI regenerates
42
+ with groups, no key moved and nothing changes.
43
+
44
+ ## 0.720.0 — 23.11.2026
45
+
46
+ ### Added
47
+
48
+ - **A file mirror's remote listing goes on across runs**, so a cloud disk too big to list in one run (100,000 files
49
+ at about 30 s a page) syncs fully over several. `FileTarget.list` takes an optional `from` and may return `next`
50
+ for an incomplete listing; the engine keeps the files so far and `next` in the mirror's state (`listing`), merges
51
+ the next run's files by path and by id, and proves deletions only once the listing completes, each still by a
52
+ direct `exists` read. A saved listing over 7 days old, of another root folder, or past 100,000 files starts over;
53
+ a dry run saves none. A target without `next` lists from the start each run, as before
54
+ ([DOCUMENTS.md, point 12](docs/dev/DOCUMENTS.md#sync-plain-files-with-a-provider)).
55
+ - **Edit `.xlsx` cells and `.docx` paragraphs in place** (`@wirecat/cli-core/office`), for a service with no
56
+ document API that downloads and uploads whole files, such as Yandex Disk. `readXlsxCells` and `editXlsxCells` work
57
+ by sheet and A1 address: shared or inline strings, numbers, booleans and empty cells, the cell's format kept, new
58
+ cells and rows in order, formula cells refused unless `overwriteFormulas`, and the workbook marked to calculate
59
+ again on open. `readDocxParagraphs` and `editDocxParagraphs` replace, insert or delete body and table-cell
60
+ paragraphs, keeping each paragraph's properties and its first run's formatting (mixed inline formatting
61
+ collapses, and the result lists where); a paragraph with tracked changes, a field, an image, a comment, a link or
62
+ a footnote is refused with the reason. Only the changed XML is spliced in; every other zip entry is copied byte for
63
+ byte ([Editing Office files](docs/office.md)).
64
+ - **`people.erase` deletes a person and what memo knows of them alone.** Their identities go, with the tags, links,
65
+ aliases, mentions and involvements that name them. A fact, note, task or import record that names them stays and
66
+ loses the name. A message, mail or meeting belongs to its source: the sender stays as an identity with no person,
67
+ and the next sync or people scan gives it one again. `apply: false` answers what would go and changes nothing.
68
+ Owner only; refused for the owner's own person (`person.owner`), and while an invoice, order, subscription or a row
69
+ the person wrote still names them (`person.erase-blocked`).
70
+
71
+ ### Fixed
72
+
73
+ - **Removing an import's account now takes the people only its records made.** Its e-mail and phone identities were
74
+ never referenced by anything, so the purge kept them and the person stayed. A person the owner tagged, linked or
75
+ gave a task to, or one another source or a message also names, still stays.
76
+
8
77
  ## 0.719.0 — 22.11.2026
9
78
 
10
79
  ### Added
@@ -4,6 +4,11 @@ export type DocumentKind = "odt" | "ods" | "odp" | "xlsx" | "pptx" | "epub";
4
4
  export declare const documentKind: (hint: FileHint) => DocumentKind | undefined;
5
5
  /** v2 for spreadsheets: rows under their header instead of one line per cell, so older text is read again. */
6
6
  export declare const documentExtractor: (kind: DocumentKind) => string;
7
+ export declare const relationships: (archive: Map<string, Uint8Array>, owner: string) => Map<string, {
8
+ path: string;
9
+ type: string;
10
+ }>;
11
+ export declare const mainPart: (archive: Map<string, Uint8Array>, contentType: string) => string;
7
12
  /** The cells of an XLSX or ODS workbook, one `Sheet` per worksheet in workbook order, values as displayed. */
8
13
  export declare const readSpreadsheet: (bytes: Uint8Array, kind: "xlsx" | "ods", signal?: AbortSignal) => Promise<Sheet[]>;
9
14
  export declare const readDocument: (bytes: Uint8Array, kind: DocumentKind, signal?: AbortSignal) => Promise<Extraction>;
@@ -83,7 +83,7 @@ const target = (owner, reference) => {
83
83
  throw new Error("external_part");
84
84
  return path;
85
85
  };
86
- const relationships = (archive, owner) => {
86
+ export const relationships = (archive, owner) => {
87
87
  const path = owner ? posix.join(posix.dirname(owner), "_rels", `${posix.basename(owner)}.rels`) : "_rels/.rels";
88
88
  const document = xmlPart(archive, path);
89
89
  rootIs(document, "Relationships", [PACKAGE_REL]);
@@ -102,7 +102,7 @@ const relationships = (archive, owner) => {
102
102
  return result;
103
103
  };
104
104
  const relationId = (element) => required(attribute(element, "id", REL) || attribute(element, "id", STRICT_REL));
105
- const mainPart = (archive, contentType) => {
105
+ export const mainPart = (archive, contentType) => {
106
106
  const types = xmlPart(archive, "[Content_Types].xml");
107
107
  const namespace = "http://schemas.openxmlformats.org/package/2006/content-types";
108
108
  rootIs(types, "Types", [namespace]);
@@ -24,12 +24,12 @@ export interface DailyArchiveTimerInput {
24
24
  }
25
25
  export declare const dailyArchiveTimer: (input: DailyArchiveTimerInput) => DailyArchiveTimer;
26
26
  export declare const manageDailyArchiveTimer: (plan: DailyArchiveTimer, action: "install" | "start" | "stop" | "status" | "uninstall", system: Pick<ServerSystem, "platform" | "run">, env: NodeJS.ProcessEnv, signal?: AbortSignal) => Promise<{
27
+ action?: undefined;
27
28
  name: string;
28
29
  installed: boolean;
29
30
  active: boolean;
30
31
  servicePath: string;
31
32
  timerPath: string;
32
- action?: undefined;
33
33
  } | {
34
34
  active?: undefined;
35
35
  name: string;
@@ -11,7 +11,7 @@ import { fixVerb } from "./config-issues.js";
11
11
  import { baseContext, environmentOf } from "./context.js";
12
12
  import { grantsAuthority, LOCAL_READ, LOCAL_WRITE } from "./effects.js";
13
13
  import { itemOf, renderAnswer } from "./envelope.js";
14
- import { knownBeside, knownPermissionKeys, unknownPermissionIssues, } from "./permission-keys.js";
14
+ import { knownBeside, knownPermissionKeys, renamedPermissionKeys, unknownPermissionIssues, } from "./permission-keys.js";
15
15
  import { profileFree } from "./profile.js";
16
16
  import { fromFile, NONE_NAMED } from "./settings.js";
17
17
  import { nextStep } from "./steps.js";
@@ -232,12 +232,18 @@ export const refuseUnknownKey = (command, setting, value, permissionKey) => {
232
232
  if (keys.length === 0)
233
233
  return;
234
234
  const known = knownPermissionKeys(command, permissionKey);
235
+ const renamed = renamedPermissionKeys(command);
235
236
  for (const key of keys) {
236
237
  if (known.has(key))
237
238
  continue;
238
239
  const beside = knownBeside(key, known);
240
+ const now = renamed.get(key);
239
241
  throw new CliError("validation_error", `permissions.${key} names no command` +
240
- (beside.length > 0 ? ` — the known ones there are ${beside.join(", ")}` : ""));
242
+ (now !== undefined
243
+ ? `: its command moved, so use permissions.${now}`
244
+ : beside.length > 0
245
+ ? ` — the known ones there are ${beside.join(", ")}`
246
+ : ""));
241
247
  }
242
248
  };
243
249
  /**
@@ -43,7 +43,9 @@ export declare const permissionIssues: (saved: readonly {
43
43
  }[], known: ReadonlySet<string>, context: {
44
44
  file: string;
45
45
  tool: string;
46
- }) => LocatedIssue[];
46
+ },
47
+ /** Old key → the key of the command it moved to, so the refusal names what to rename it to. */
48
+ renamed?: ReadonlyMap<string, string>) => LocatedIssue[];
47
49
  /** The file without the settings the issues name: what still loads, and what `config unset` would leave. */
48
50
  export declare const withoutIssues: (raw: unknown, issues: readonly LocatedIssue[]) => unknown;
49
51
  /** The path `config unset <setting>` names: a permission key keeps its dots; a number is a list item. */
@@ -237,9 +237,16 @@ export const savedPermissionKeys = (raw) => scopes(raw).flatMap(([path, scope])
237
237
  ? Object.keys(scope.permissions).map((key) => ({ key, at: [...path, "permissions", key] }))
238
238
  : []);
239
239
  /** A saved key no command checks would do nothing (BUG-137): one issue per key, wherever it is saved. */
240
- export const permissionIssues = (saved, known, context) => saved
240
+ export const permissionIssues = (saved, known, context,
241
+ /** Old key → the key of the command it moved to, so the refusal names what to rename it to. */
242
+ renamed = new Map()) => saved
241
243
  .filter(({ key }) => !known.has(key))
242
- .map(({ at }) => locate("unknown_permission", at, context, (key) => `${key} names no command`));
244
+ .map(({ key: name, at }) => locate("unknown_permission", at, context, (key) => {
245
+ const now = renamed.get(name);
246
+ return now === undefined
247
+ ? `${key} names no command`
248
+ : `${key} names no command: its command moved, so rename it to permissions.${now}`;
249
+ }));
243
250
  const pathId = (path) => path.join("\u0000");
244
251
  /**
245
252
  * The file without the parts at `paths`, through objects and lists alike, and a map from a path in what is left
@@ -0,0 +1,25 @@
1
+ import { Command } from "commander";
2
+ import { type FileConflictResolveOptions, type FileMirrorStatePort, type FileVersions, type Mirror } from "../../documents.js";
3
+ import type { AppIdentity } from "../../ports/app.js";
4
+ import { type Body } from "../envelope.js";
5
+ /** What a file-mirror CLI gives `fileConflictsCommand`: its mirrors, their state and stores, and its remote. */
6
+ export interface FileConflictCommands {
7
+ /** Who the app is: its command names the examples, its folders are never read by `--file`. */
8
+ identity: AppIdentity;
9
+ /** How the app names the remote side, `disk` for Yandex Disk: `--keep`'s other choice and a kept copy's name. */
10
+ remote: string;
11
+ output(command: Command, body: Body): void;
12
+ /** The profile's mirrors, or the one with `id`; unknown ids and a profile without mirrors are refused. */
13
+ mirrors(command: Command, id?: string): Mirror[];
14
+ /** A path as the owner typed it (relative, or absolute inside the mirror), as a path inside the mirror. */
15
+ pathOf(mirror: Mirror, input: string): string;
16
+ stateOf(command: Command, mirror: Mirror): FileMirrorStatePort;
17
+ versionsOf(command: Command, mirror: Mirror): FileVersions;
18
+ /** The remote signed in for the mirror's account, the write guard and the mirrors' sync lock. */
19
+ connect(command: Command, mirror: Mirror): Promise<Pick<FileConflictResolveOptions, "target" | "principal" | "guard" | "operationId" | "lock" | "signal">>;
20
+ }
21
+ /**
22
+ * `mirrors conflicts list|show|resolve` for a file mirror: the conflicts the last sync left, each with its three
23
+ * versions and the line merge that failed, and a resolution that writes one final content to both sides.
24
+ */
25
+ export declare const fileConflictsCommand: (helpers: FileConflictCommands) => Command;
@@ -0,0 +1,102 @@
1
+ import { resolve } from "node:path";
2
+ import { CliError } from "@wirecat/cli-base";
3
+ import { annotate } from "@wirecat/cli-base/commands";
4
+ import { Command, Option } from "commander";
5
+ import { listFileConflicts, resolveFileConflict, showFileConflict, } from "../../documents.js";
6
+ import { refusedPlace } from "../../sends/upload.js";
7
+ import { environmentOf } from "../context.js";
8
+ import { LOCAL_READ, ownerOnlyOption, REMOTE_WRITE } from "../effects.js";
9
+ import { itemOf, listOf, snakeKeys } from "../envelope.js";
10
+ const ID = "mirror id from mirrors list";
11
+ const PATH = "the file's path inside the mirror, like notes/plan.md";
12
+ /**
13
+ * `mirrors conflicts list|show|resolve` for a file mirror: the conflicts the last sync left, each with its three
14
+ * versions and the line merge that failed, and a resolution that writes one final content to both sides.
15
+ */
16
+ export const fileConflictsCommand = (helpers) => {
17
+ const { remote, identity } = helpers;
18
+ const app = identity.command;
19
+ const one = (command, id) => helpers.mirrors(command, id)[0];
20
+ return annotate(new Command("conflicts"), { effects: LOCAL_READ })
21
+ .summary("files changed on both sides that a sync could not merge")
22
+ .description(`files changed on both sides that a sync could not merge: list them, show the three versions and the lines ` +
23
+ `that conflict, and resolve each by keeping a side or giving the final file`)
24
+ .addCommand(annotate(new Command("list"), {
25
+ effects: LOCAL_READ,
26
+ examples: [`${app} personal mirrors conflicts list --json`],
27
+ })
28
+ .summary("list the conflicts the last sync left")
29
+ .description("list the conflicts each mirror's last sync left, with why and when it found them")
30
+ .argument("[id]", `${ID}; every mirror of the profile when omitted`)
31
+ .action(function (id) {
32
+ const items = listFileConflicts(helpers.mirrors(this, id), (mirror) => helpers.stateOf(this, mirror));
33
+ helpers.output(this, listOf("mirrors conflicts list", {
34
+ items: items.map((item) => snakeKeys(item)),
35
+ limit: Math.max(1, items.length),
36
+ has_more: false,
37
+ }));
38
+ }))
39
+ .addCommand(annotate(new Command("show"), {
40
+ effects: LOCAL_READ,
41
+ examples: [`${app} personal mirrors conflicts show 1a2b3c4d notes/plan.md --json`],
42
+ })
43
+ .summary("show a conflict's three versions and the lines that conflict")
44
+ .description("show a conflict's three versions (the last sync's, the local and the remote) and each changed stretch " +
45
+ "of the line merge; merged is the whole file with conflict markers, a start for resolve --file")
46
+ .argument("<id>", ID)
47
+ .argument("<path>", PATH)
48
+ .action(async function (id, input) {
49
+ const mirror = one(this, id);
50
+ const view = await showFileConflict({
51
+ root: mirror.path,
52
+ path: helpers.pathOf(mirror, input),
53
+ state: helpers.stateOf(this, mirror),
54
+ versions: helpers.versionsOf(this, mirror),
55
+ remote,
56
+ });
57
+ helpers.output(this, itemOf(snakeKeys({ id, ...view })));
58
+ }))
59
+ .addCommand(annotate(new Command("resolve"), {
60
+ effects: REMOTE_WRITE,
61
+ offline: false,
62
+ examples: [
63
+ `${app} personal mirrors conflicts resolve 1a2b3c4d notes/plan.md --keep ${remote}`,
64
+ `${app} personal mirrors conflicts resolve 1a2b3c4d notes/plan.md --file ~/plan-final.md`,
65
+ ],
66
+ })
67
+ .summary("settle a conflict on both sides: keep a side, both, or the final file")
68
+ .description(`settle a conflict on both sides at once: keep the local file, the ${remote}'s, or both (the ${remote}'s ` +
69
+ `beside the local one), or give the final file. Refused with nothing written when either side changed ` +
70
+ "since the conflict was found; every replaced version is kept")
71
+ .argument("<id>", ID)
72
+ .argument("<path>", PATH)
73
+ .addOption(new Option("--keep <side>", `keep the local file, the ${remote}'s, or both`).choices([
74
+ "local",
75
+ remote,
76
+ "both",
77
+ ]))
78
+ .addOption(ownerOnlyOption("--file <file>", "the final content, written to both sides"))
79
+ .action(async function (id, input, args) {
80
+ if ((args.keep === undefined) === (args.file === undefined))
81
+ throw new CliError("validation_error", "give either --keep or --file", { param: "--keep" });
82
+ const file = args.file === undefined ? undefined : resolve(args.file);
83
+ if (file && refusedPlace(file, identity, environmentOf(this).env ?? process.env))
84
+ throw new CliError("validation_error", `--file may not read ${file}: it holds sign-ins or state`, {
85
+ param: "--file",
86
+ });
87
+ const mirror = one(this, id);
88
+ const keep = (args.keep === remote ? "remote" : args.keep);
89
+ const resolved = await resolveFileConflict({
90
+ ...(await helpers.connect(this, mirror)),
91
+ root: mirror.path,
92
+ folder: mirror.folder,
93
+ path: helpers.pathOf(mirror, input),
94
+ state: helpers.stateOf(this, mirror),
95
+ versions: helpers.versionsOf(this, mirror),
96
+ remote,
97
+ choice: keep ? { keep } : { file: file },
98
+ });
99
+ const resolution = resolved.resolution === "remote" ? remote : resolved.resolution;
100
+ helpers.output(this, itemOf(snakeKeys({ id, ...resolved, resolution })));
101
+ }));
102
+ };
@@ -0,0 +1,29 @@
1
+ import type { Command } from "commander";
2
+ import { type CellValue, type XlsxEdit } from "../../office/index.js";
3
+ import { type FileUpdateCommands, type FileUpdatePort } from "./file-update.js";
4
+ export interface FileEditCommands extends FileUpdateCommands {
5
+ /**
6
+ * The CLI's read path, signed in: the target and the profile's version store, for a command that changes nothing.
7
+ * `command` is the one running.
8
+ */
9
+ read(act: (port: FileUpdatePort) => Promise<object>, command: Command): Promise<object>;
10
+ /**
11
+ * `restore <path>` with no version: the CLI's own restore from the provider's trash, which answers what it did. A
12
+ * CLI without one leaves it out, and the version is then required.
13
+ */
14
+ restoreFromTrash?(input: string, command: Command): Promise<object>;
15
+ }
16
+ /** `Sheet1!A1:C10`, `'My sheet'!B2`, `Sheet1` or `A1:C10`, as the sheet and the cells. */
17
+ export declare const sheetRangeOf: (input: string | undefined) => {
18
+ sheet?: string;
19
+ range?: string;
20
+ };
21
+ /** The cells `values` fills from the range's top-left cell; a range of more than one cell must have their shape. */
22
+ export declare const cellEditsOf: (sheet: string, range: string, values: CellValue[][]) => XlsxEdit[];
23
+ /**
24
+ * Mounts `<files> update`, `sheets show|update`, `documents show|update`, `history` and `restore` under the CLI's own
25
+ * files group: Office files edited in place and earlier versions put back, every write at the sha256 it was read at
26
+ * and with the replaced content kept (`guardedFileWrite`). The CLI keeps no `restore` of its own; a trash restore
27
+ * goes in as `restoreFromTrash`.
28
+ */
29
+ export declare const addFileEditCommands: (files: Command, helpers: FileEditCommands) => void;