@wirecat/files-cli 0.1.0 → 0.3.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 +43 -0
- package/README.md +2 -2
- package/contracts/wirecat.json +42 -0
- package/dist/bin/files.js +2 -2
- package/dist/bundle/{chunk-GNDPV4HK.js → chunk-AQW3A7LB.js} +1 -1
- package/dist/bundle/files.js +2 -2
- package/dist/bundle/{program-EN7Z757N.js → program-O44TKRRN.js} +528 -320
- package/dist/config.js +10 -1
- package/dist/doctor.js +33 -0
- package/dist/entities.js +1 -0
- package/dist/import/readers.js +10 -3
- package/dist/notes/bound.js +7 -5
- package/dist/notes/command.js +30 -3
- package/dist/notes/files.js +6 -0
- package/dist/notes/folders.js +6 -4
- package/dist/notes/import.js +67 -12
- package/dist/notes/links.js +3 -1
- package/dist/options.js +6 -0
- package/dist/people/command.js +92 -0
- package/dist/program.js +4 -1
- package/dist/sources/command.js +1 -8
- package/dist/sources/read.js +2 -1
- package/dist/sync.js +35 -9
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/skills/files-cli/SKILL.md +1 -1
package/dist/sync.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { errorCodes } from "@wirecat/cli-base";
|
|
2
2
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
3
|
import { environmentOf, FETCH, markStoreDamaged, notLocalPaths, openStore, setExitCode, storePath, } from "@wirecat/cli-core";
|
|
4
|
-
import { attachmentMaxBytes, sizeText } from "@wirecat/cli-core/documents";
|
|
4
|
+
import { attachmentMaxBytes, scanReader, sizeText } from "@wirecat/cli-core/documents";
|
|
5
5
|
import { Option } from "commander";
|
|
6
6
|
import { answers, itemAnswer } from "./answer.js";
|
|
7
7
|
import { APP, STORE_CLIENT } from "./app.js";
|
|
8
|
-
import { decisionPolicy, loadConfig } from "./config.js";
|
|
8
|
+
import { decisionPolicy, loadConfig, readScans } from "./config.js";
|
|
9
9
|
import { errorObject } from "./failure.js";
|
|
10
10
|
import { boundFolders, UNBOUND, unboundReason } from "./notes/bound.js";
|
|
11
11
|
import { embedNoteChunks } from "./notes/embed.js";
|
|
@@ -23,11 +23,13 @@ const NOT_READ = {
|
|
|
23
23
|
"needs-agent": "no text in it, such as a scanned PDF",
|
|
24
24
|
unreadable: "the file is damaged or locked",
|
|
25
25
|
};
|
|
26
|
-
const notReadReason = (status, engine) =>
|
|
27
|
-
?
|
|
28
|
-
: status === "
|
|
29
|
-
? `
|
|
30
|
-
:
|
|
26
|
+
const notReadReason = (status, engine, reason) => reason !== undefined
|
|
27
|
+
? reason
|
|
28
|
+
: status === "engine-missing"
|
|
29
|
+
? `needs the ${engine ?? "missing"} reader`
|
|
30
|
+
: status === "too-large"
|
|
31
|
+
? `larger than ${sizeText(attachmentMaxBytes())}; configure MESSAGING_ATTACHMENT_MAX_MIB`
|
|
32
|
+
: (NOT_READ[status] ?? status);
|
|
31
33
|
const enrichmentLine = (run) => `enrichment: ${run.enriched} of ${run.sent} records sent${run.provider ? ` to ${run.provider} ${run.model}` : ""}` +
|
|
32
34
|
(run.costUsd === null ? "" : `, $${run.costUsd}`) +
|
|
33
35
|
(run.left > 0 ? `, ${run.left} left` : "") +
|
|
@@ -39,11 +41,19 @@ const text = (run) => [
|
|
|
39
41
|
(n.deletionsSkipped === undefined ? "" : ` — deletions skipped: ${n.deletionsSkipped}`),
|
|
40
42
|
...(n.notRead ?? [])
|
|
41
43
|
.slice(0, NOT_READ_SHOWN)
|
|
42
|
-
.map(({ path, status, engine }) => ` not read: ${path} — ${notReadReason(status, engine)}`),
|
|
44
|
+
.map(({ path, status, engine, reason }) => ` not read: ${path} — ${reason !== undefined && reason === n.ocr?.unavailable ? "waits for OCR, below" : notReadReason(status, engine, reason)}`),
|
|
43
45
|
...((n.notRead?.length ?? 0) > NOT_READ_SHOWN
|
|
44
46
|
? [` and ${(n.notRead?.length ?? 0) - NOT_READ_SHOWN} more not read — --json lists them all`]
|
|
45
47
|
: []),
|
|
48
|
+
...(n.ocr === undefined
|
|
49
|
+
? []
|
|
50
|
+
: [
|
|
51
|
+
` OCR${run.scans?.engine ? ` (${run.scans.engine})` : ""}: ${n.ocr.read} read, ${n.ocr.notRead} not read` +
|
|
52
|
+
(n.ocr.picturesWaiting ? `, ${n.ocr.picturesWaiting} pictures waiting` : "") +
|
|
53
|
+
(n.ocr.unavailable ? ` — ${n.ocr.unavailable}` : ""),
|
|
54
|
+
]),
|
|
46
55
|
]),
|
|
56
|
+
...(run.scans?.warning ? [`warning: ${run.scans.warning}`] : []),
|
|
47
57
|
...(run.notesEmbedded === undefined
|
|
48
58
|
? []
|
|
49
59
|
: [
|
|
@@ -122,10 +132,26 @@ export const syncCommand = (program, streams, env, keyring) => {
|
|
|
122
132
|
const ignore = config.notes?.ignore ?? [];
|
|
123
133
|
const skip = options.ignore ?? [];
|
|
124
134
|
const json = command.optsWithGlobals().json !== undefined;
|
|
135
|
+
const choice = readScans(command);
|
|
136
|
+
const scans = folders.length > 0
|
|
137
|
+
? await scanReader(choice, {
|
|
138
|
+
app: APP,
|
|
139
|
+
env,
|
|
140
|
+
command: APP.command,
|
|
141
|
+
...(keyring ? { keyring } : {}),
|
|
142
|
+
...(stop ? { signal: stop } : {}),
|
|
143
|
+
})
|
|
144
|
+
: undefined;
|
|
145
|
+
if (scans)
|
|
146
|
+
run.scans = {
|
|
147
|
+
readScans: choice,
|
|
148
|
+
engine: scans.extractor ?? null,
|
|
149
|
+
...(scans.warning ? { warning: scans.warning } : {}),
|
|
150
|
+
};
|
|
125
151
|
for (const folder of folders)
|
|
126
152
|
await attempt(`notes ${folder.path}`, async () => {
|
|
127
153
|
const onFile = progressLine(streams.diagnostic, json, { step: "notes", unit: "files", label: folder.id });
|
|
128
|
-
run.notes.push(await importNotes(store, folder, { ignore, skip, env, onFile }));
|
|
154
|
+
run.notes.push(await importNotes(store, folder, { ignore, skip, env, onFile, ...(scans ? { scans } : {}) }));
|
|
129
155
|
});
|
|
130
156
|
if (folders.length > 0)
|
|
131
157
|
await attempt("notes by meaning", async () => {
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.3.0";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/files-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Notes folders, Obsidian vaults, PDFs and transcripts for your AI agents, in the local store",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@wirecat/cli-base": "2.1.0",
|
|
63
|
-
"@wirecat/cli-core": "3.
|
|
63
|
+
"@wirecat/cli-core": "3.2.0",
|
|
64
64
|
"commander": "15.0.0",
|
|
65
65
|
"valibot": "1.5.0",
|
|
66
66
|
"yaml": "2.9.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: files-cli
|
|
3
|
-
description: Use files, the WireCat CLI for the files on this computer, from an agent. It brings notes folders, Obsidian vaults, PDF and Word documents, transcripts and recordings into the shared local store, searches the notes, and keeps the owner's own notes. Use when a task needs the owner's notes or local documents, or asks to add, sync or search a notes folder.
|
|
3
|
+
description: Use files, the WireCat CLI for the files on this computer, from an agent. It brings notes folders, Obsidian vaults, PDF and Word documents, spreadsheets, scans and pictures read by OCR, transcripts and recordings into the shared local store, searches the notes, and keeps the owner's own notes. Use when a task needs the owner's notes or local documents, or asks to add, sync or search a notes folder.
|
|
4
4
|
metadata:
|
|
5
5
|
openclaw:
|
|
6
6
|
requires:
|