@wirecat/files-cli 0.2.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 +14 -0
- package/dist/bin/files.js +2 -2
- package/dist/bundle/{chunk-3GCXH3WT.js → chunk-AQW3A7LB.js} +1 -1
- package/dist/bundle/files.js +2 -2
- package/dist/bundle/{program-OBKXQ4VY.js → program-O44TKRRN.js} +31 -11
- package/dist/notes/command.js +30 -3
- package/dist/options.js +6 -0
- package/dist/sources/command.js +1 -8
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Notable changes to `@wirecat/files-cli`. One section per version, newest first.
|
|
4
4
|
|
|
5
|
+
## 0.3.0 — 29.11.2026
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **`notes show --max-chars <n>` reads only the start of a long note.** Without it the whole text comes, as before.
|
|
10
|
+
A cut answer says so in `missing` and `meta.complete: false`, and gets a `show.whole` next step that reads the whole
|
|
11
|
+
note. Over MCP it is `max_chars`.
|
|
12
|
+
|
|
13
|
+
### Changed — may break callers
|
|
14
|
+
|
|
15
|
+
- **cli-core 3.2.0.** `files_tools_search` gives at most 5 matches, with full arguments for the first 2 and no
|
|
16
|
+
`output` schema (`schema: true` with an exact name gives it). A match shows `availability` only when the command is
|
|
17
|
+
refused or asks first. An agent's read of notes over MCP leaves out empty fields.
|
|
18
|
+
|
|
5
19
|
## 0.2.0 — 29.11.2026
|
|
6
20
|
|
|
7
21
|
### Added
|
package/dist/bin/files.js
CHANGED
|
@@ -9,7 +9,7 @@ if (
|
|
|
9
9
|
(words[0] === "--version" || words[0] === "-V") &&
|
|
10
10
|
!Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
|
|
11
11
|
) {
|
|
12
|
-
process.stdout.write("0.
|
|
12
|
+
process.stdout.write("0.3.0\n")
|
|
13
13
|
} else {
|
|
14
14
|
// Before the bundle compiles: the bundle's own call comes after its chunks.
|
|
15
15
|
module.enableCompileCache()
|
|
@@ -26,7 +26,7 @@ if (
|
|
|
26
26
|
: next(specifier, context),
|
|
27
27
|
})
|
|
28
28
|
}
|
|
29
|
-
const chunks = ["../bundle/program-
|
|
29
|
+
const chunks = ["../bundle/program-O44TKRRN.js"]
|
|
30
30
|
const preload = () =>
|
|
31
31
|
Promise.allSettled([
|
|
32
32
|
...chunks.map((chunk) => import(chunk)),
|
package/dist/bundle/files.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
3
3
|
const require = __bundleRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
DESKTOP
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AQW3A7LB.js";
|
|
7
7
|
|
|
8
8
|
// dist/bin/files.js
|
|
9
9
|
import { enableCompileCache } from "node:module";
|
|
@@ -15,7 +15,7 @@ var wcat = await wcatStart(DESKTOP);
|
|
|
15
15
|
if (wcat.code !== void 0) {
|
|
16
16
|
process.exitCode = wcat.code;
|
|
17
17
|
} else {
|
|
18
|
-
const { run } = await import("./program-
|
|
18
|
+
const { run } = await import("./program-O44TKRRN.js");
|
|
19
19
|
process.exitCode = await run(process.argv.slice(2));
|
|
20
20
|
}
|
|
21
21
|
stopCatching();
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
__name,
|
|
9
9
|
__require,
|
|
10
10
|
__toESM
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AQW3A7LB.js";
|
|
12
12
|
|
|
13
13
|
// node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/nodes/identity.js
|
|
14
14
|
var require_identity = __commonJS({
|
|
@@ -9844,6 +9844,7 @@ var isInstalledCopy = /* @__PURE__ */ __name((script) => {
|
|
|
9844
9844
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
9845
9845
|
import { CliError as CliError17 } from "@wirecat/cli-base";
|
|
9846
9846
|
import { annotate as annotate2 } from "@wirecat/cli-base/commands";
|
|
9847
|
+
import { stepOf } from "@wirecat/cli-base/standards";
|
|
9847
9848
|
import { contextEvidenceFingerprint, LOCAL_READ, LOCAL_WRITE as LOCAL_WRITE2, queryTerms, termField, withQuery } from "@wirecat/cli-core";
|
|
9848
9849
|
import { InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
9849
9850
|
|
|
@@ -9856,6 +9857,12 @@ var positive = /* @__PURE__ */ __name((value) => {
|
|
|
9856
9857
|
return number;
|
|
9857
9858
|
}, "positive");
|
|
9858
9859
|
var collect = /* @__PURE__ */ __name((value, previous = []) => [...previous, value], "collect");
|
|
9860
|
+
var between = /* @__PURE__ */ __name((low, high, what) => (value) => {
|
|
9861
|
+
const number = Number(value);
|
|
9862
|
+
if (!Number.isInteger(number) || number < low || number > high)
|
|
9863
|
+
throw new InvalidArgumentError(`${what}: a whole number, ${low} to ${high}`);
|
|
9864
|
+
return number;
|
|
9865
|
+
}, "between");
|
|
9859
9866
|
|
|
9860
9867
|
// dist/people/notes-map.js
|
|
9861
9868
|
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
@@ -10623,6 +10630,18 @@ var noteOf = /* @__PURE__ */ __name(async (store, env, reference) => {
|
|
|
10623
10630
|
});
|
|
10624
10631
|
return found;
|
|
10625
10632
|
}, "noteOf");
|
|
10633
|
+
var MAX_CHARS = 2e5;
|
|
10634
|
+
var SHOW_WHOLE = {
|
|
10635
|
+
id: "show.whole",
|
|
10636
|
+
kind: "command",
|
|
10637
|
+
command: "notes show",
|
|
10638
|
+
args: [{ name: "note", required: true }],
|
|
10639
|
+
why: "the whole text of {note}"
|
|
10640
|
+
};
|
|
10641
|
+
var cutText = /* @__PURE__ */ __name((text2, maxChars) => {
|
|
10642
|
+
const whole = Array.from(text2);
|
|
10643
|
+
return maxChars === void 0 || whole.length <= maxChars ? void 0 : { text: whole.slice(0, maxChars).join(""), length: whole.length };
|
|
10644
|
+
}, "cutText");
|
|
10626
10645
|
var notesCommandDefinition = /* @__PURE__ */ __name((program, streams, env) => {
|
|
10627
10646
|
const { print } = answers(program, streams, env);
|
|
10628
10647
|
const exportedPath = /* @__PURE__ */ __name(({ written: written2, unchanged, edited }) => {
|
|
@@ -10636,8 +10655,8 @@ var notesCommandDefinition = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
10636
10655
|
return work(store);
|
|
10637
10656
|
}), "withNotes");
|
|
10638
10657
|
const notes = program.command("notes").description("notes from your folders, and notes you write here");
|
|
10639
|
-
annotate2(notes.command("show"), { effects: LOCAL_READ, output: { entity: "note" } }).description("one note: its text, tags, what it links and what links it").addHelpText("after", SAVE_HELP).argument("<note>", "note:<id>, document:<id>, or a file in a configured folder").action(async (reference, options) => {
|
|
10640
|
-
const
|
|
10658
|
+
annotate2(notes.command("show"), { effects: LOCAL_READ, output: { entity: "note" } }).description("one note: its text, tags, what it links and what links it").addHelpText("after", SAVE_HELP).argument("<note>", "note:<id>, document:<id>, or a file in a configured folder").option("--max-chars <n>", `characters of the text at most, 1\u2013${MAX_CHARS}; the whole text without it`, between(1, MAX_CHARS, "--max-chars")).action(async (reference, options) => {
|
|
10659
|
+
const whole = await withNotes(async (store) => {
|
|
10641
10660
|
const note = await noteOf(store, env, reference);
|
|
10642
10661
|
const ref = note.ref;
|
|
10643
10662
|
return {
|
|
@@ -10659,11 +10678,19 @@ var notesCommandDefinition = /* @__PURE__ */ __name((program, streams, env) => {
|
|
|
10659
10678
|
fingerprint: await citedFingerprint(store, ref)
|
|
10660
10679
|
};
|
|
10661
10680
|
});
|
|
10662
|
-
|
|
10681
|
+
const cut = cutText(whole.text, options.maxChars);
|
|
10682
|
+
const answer = cut ? { ...whole, text: cut.text } : whole;
|
|
10683
|
+
const shortened = cut && {
|
|
10684
|
+
next: [stepOf(SHOW_WHOLE, { args: { note: answer.ref } })],
|
|
10685
|
+
missing: [{ field: "text", why: `cut at ${options.maxChars} of ${cut.length} characters by --max-chars` }],
|
|
10686
|
+
meta: { complete: false }
|
|
10687
|
+
};
|
|
10688
|
+
print(options.json, itemAnswer(answer, shortened), [
|
|
10663
10689
|
`${answer.ref} ${answer.path ?? answer.title ?? ""}`.trimEnd(),
|
|
10664
10690
|
` updated ${new Date(answer.updatedAt).toISOString().slice(0, 16).replace("T", " ")}${answer.tags.length ? ` tags: ${answer.tags.join(", ")}` : ""}`,
|
|
10665
10691
|
"",
|
|
10666
10692
|
answer.text,
|
|
10693
|
+
...cut ? [` \u2026 ${cut.length} characters in all`] : [],
|
|
10667
10694
|
...answer.links.length ? ["", `links: ${answer.links.map(({ to, targetText }) => to ?? `${targetText} (not found)`).join(", ")}`] : [],
|
|
10668
10695
|
...answer.backlinks.length ? [`linked from: ${answer.backlinks.map(({ from }) => from).join(", ")}`] : []
|
|
10669
10696
|
].join("\n"));
|
|
@@ -11059,7 +11086,6 @@ import { CliError as CliError29 } from "@wirecat/cli-base";
|
|
|
11059
11086
|
import { annotate as annotate7 } from "@wirecat/cli-base/commands";
|
|
11060
11087
|
import { addedSourceKeyOf, environmentOf as environmentOf4, FETCH as FETCH2, LOCAL_READ as LOCAL_READ6, LOCAL_WRITE as LOCAL_WRITE6, REMOTE_READ } from "@wirecat/cli-core";
|
|
11061
11088
|
import { agentPictureReader, aiImageReader, MAX_TEXT_CHARS } from "@wirecat/cli-core/documents";
|
|
11062
|
-
import { InvalidArgumentError as InvalidArgumentError5 } from "commander";
|
|
11063
11089
|
|
|
11064
11090
|
// dist/notes/embed.js
|
|
11065
11091
|
import { existsSync as existsSync6, readdirSync as readdirSync4 } from "node:fs";
|
|
@@ -11997,12 +12023,6 @@ var readerCommands = /* @__PURE__ */ __name((program, sources, streams, env, dep
|
|
|
11997
12023
|
var SUBJECT_HELP = "who or what it is about: person:, organization:, project:, task:, meeting:, or <messenger>:<name or id>; repeat for more";
|
|
11998
12024
|
var TEXT_BYTES = 16384;
|
|
11999
12025
|
var MAX_TEXT_BYTES = 1048576;
|
|
12000
|
-
var between = /* @__PURE__ */ __name((low, high, what) => (value) => {
|
|
12001
|
-
const number = Number(value);
|
|
12002
|
-
if (!Number.isInteger(number) || number < low || number > high)
|
|
12003
|
-
throw new InvalidArgumentError5(`${what}: a whole number, ${low} to ${high}`);
|
|
12004
|
-
return number;
|
|
12005
|
-
}, "between");
|
|
12006
12026
|
var boundedText = /* @__PURE__ */ __name((text2, bytes) => {
|
|
12007
12027
|
const encoded = Buffer.from(text2);
|
|
12008
12028
|
if (encoded.byteLength <= bytes)
|
package/dist/notes/command.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { CliError } from "@wirecat/cli-base";
|
|
3
3
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
4
|
+
import { stepOf } from "@wirecat/cli-base/standards";
|
|
4
5
|
import { contextEvidenceFingerprint, LOCAL_READ, LOCAL_WRITE, queryTerms, termField, withQuery, } from "@wirecat/cli-core";
|
|
5
6
|
import { InvalidArgumentError } from "commander";
|
|
6
7
|
import { answers, itemAnswer, listAnswer, withStore } from "../answer.js";
|
|
7
8
|
import { isMcpRun } from "../author.js";
|
|
8
9
|
import { loadConfig } from "../config.js";
|
|
9
|
-
import { collect, positive } from "../options.js";
|
|
10
|
+
import { between, collect, positive } from "../options.js";
|
|
10
11
|
import { importNotesMap } from "../people/notes-map.js";
|
|
11
12
|
import { subjectOf } from "../people/subject.js";
|
|
12
13
|
import { refuseBareNumber } from "../refs.js";
|
|
@@ -69,6 +70,22 @@ const noteOf = async (store, env, reference) => {
|
|
|
69
70
|
});
|
|
70
71
|
return found;
|
|
71
72
|
};
|
|
73
|
+
/** The top of wcat show --max-chars, so the two read a text alike. */
|
|
74
|
+
const MAX_CHARS = 200_000;
|
|
75
|
+
const SHOW_WHOLE = {
|
|
76
|
+
id: "show.whole",
|
|
77
|
+
kind: "command",
|
|
78
|
+
command: "notes show",
|
|
79
|
+
args: [{ name: "note", required: true }],
|
|
80
|
+
why: "the whole text of {note}",
|
|
81
|
+
};
|
|
82
|
+
/** Counted in code points, so a cut never splits a character. */
|
|
83
|
+
const cutText = (text, maxChars) => {
|
|
84
|
+
const whole = Array.from(text);
|
|
85
|
+
return maxChars === undefined || whole.length <= maxChars
|
|
86
|
+
? undefined
|
|
87
|
+
: { text: whole.slice(0, maxChars).join(""), length: whole.length };
|
|
88
|
+
};
|
|
72
89
|
const notesCommandDefinition = (program, streams, env) => {
|
|
73
90
|
const { print } = answers(program, streams, env);
|
|
74
91
|
// The note's own export_path says where it was written; a file edited since is left as it is, and said so.
|
|
@@ -86,8 +103,9 @@ const notesCommandDefinition = (program, streams, env) => {
|
|
|
86
103
|
.description("one note: its text, tags, what it links and what links it")
|
|
87
104
|
.addHelpText("after", SAVE_HELP)
|
|
88
105
|
.argument("<note>", "note:<id>, document:<id>, or a file in a configured folder")
|
|
106
|
+
.option("--max-chars <n>", `characters of the text at most, 1–${MAX_CHARS}; the whole text without it`, between(1, MAX_CHARS, "--max-chars"))
|
|
89
107
|
.action(async (reference, options) => {
|
|
90
|
-
const
|
|
108
|
+
const whole = await withNotes(async (store) => {
|
|
91
109
|
const note = await noteOf(store, env, reference);
|
|
92
110
|
const ref = note.ref;
|
|
93
111
|
return {
|
|
@@ -109,11 +127,20 @@ const notesCommandDefinition = (program, streams, env) => {
|
|
|
109
127
|
fingerprint: await citedFingerprint(store, ref),
|
|
110
128
|
};
|
|
111
129
|
});
|
|
112
|
-
|
|
130
|
+
const cut = cutText(whole.text, options.maxChars);
|
|
131
|
+
const answer = cut ? { ...whole, text: cut.text } : whole;
|
|
132
|
+
// The note entity has no field for a cut, so the envelope says it: missing text, and a step to the rest.
|
|
133
|
+
const shortened = cut && {
|
|
134
|
+
next: [stepOf(SHOW_WHOLE, { args: { note: answer.ref } })],
|
|
135
|
+
missing: [{ field: "text", why: `cut at ${options.maxChars} of ${cut.length} characters by --max-chars` }],
|
|
136
|
+
meta: { complete: false },
|
|
137
|
+
};
|
|
138
|
+
print(options.json, itemAnswer(answer, shortened), [
|
|
113
139
|
`${answer.ref} ${answer.path ?? answer.title ?? ""}`.trimEnd(),
|
|
114
140
|
` updated ${new Date(answer.updatedAt).toISOString().slice(0, 16).replace("T", " ")}${answer.tags.length ? ` tags: ${answer.tags.join(", ")}` : ""}`,
|
|
115
141
|
"",
|
|
116
142
|
answer.text,
|
|
143
|
+
...(cut ? [` … ${cut.length} characters in all`] : []),
|
|
117
144
|
...(answer.links.length
|
|
118
145
|
? ["", `links: ${answer.links.map(({ to, targetText }) => to ?? `${targetText} (not found)`).join(", ")}`]
|
|
119
146
|
: []),
|
package/dist/options.js
CHANGED
|
@@ -6,4 +6,10 @@ export const positive = (value) => {
|
|
|
6
6
|
return number;
|
|
7
7
|
};
|
|
8
8
|
export const collect = (value, previous = []) => [...previous, value];
|
|
9
|
+
export const between = (low, high, what) => (value) => {
|
|
10
|
+
const number = Number(value);
|
|
11
|
+
if (!Number.isInteger(number) || number < low || number > high)
|
|
12
|
+
throw new InvalidArgumentError(`${what}: a whole number, ${low} to ${high}`);
|
|
13
|
+
return number;
|
|
14
|
+
};
|
|
9
15
|
//# sourceMappingURL=options.js.map
|
package/dist/sources/command.js
CHANGED
|
@@ -3,13 +3,12 @@ import { CliError } from "@wirecat/cli-base";
|
|
|
3
3
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
4
4
|
import { addedSourceKeyOf, environmentOf, FETCH, LOCAL_READ, LOCAL_WRITE, REMOTE_READ, } from "@wirecat/cli-core";
|
|
5
5
|
import { agentPictureReader, aiImageReader, MAX_TEXT_CHARS } from "@wirecat/cli-core/documents";
|
|
6
|
-
import { InvalidArgumentError } from "commander";
|
|
7
6
|
import { answers, itemAnswer, listAnswer, withStore } from "../answer.js";
|
|
8
7
|
import { APP } from "../app.js";
|
|
9
8
|
import { byOption, reasonOption, whoRuns } from "../author.js";
|
|
10
9
|
import { loadConfig } from "../config.js";
|
|
11
10
|
import { searchModelPresent } from "../notes/embed.js";
|
|
12
|
-
import { collect } from "../options.js";
|
|
11
|
+
import { between, collect } from "../options.js";
|
|
13
12
|
import { subjectOf } from "../people/subject.js";
|
|
14
13
|
import { refuseBareNumber } from "../refs.js";
|
|
15
14
|
import { dropCopy, keepCopy } from "./copy.js";
|
|
@@ -19,12 +18,6 @@ import { readerCommands } from "./suggest-command.js";
|
|
|
19
18
|
const SUBJECT_HELP = "who or what it is about: person:, organization:, project:, task:, meeting:, or <messenger>:<name or id>; repeat for more";
|
|
20
19
|
const TEXT_BYTES = 16_384;
|
|
21
20
|
const MAX_TEXT_BYTES = 1_048_576;
|
|
22
|
-
const between = (low, high, what) => (value) => {
|
|
23
|
-
const number = Number(value);
|
|
24
|
-
if (!Number.isInteger(number) || number < low || number > high)
|
|
25
|
-
throw new InvalidArgumentError(`${what}: a whole number, ${low} to ${high}`);
|
|
26
|
-
return number;
|
|
27
|
-
};
|
|
28
21
|
/** The text cut at a character, so its UTF-8 form is at most `bytes`. */
|
|
29
22
|
const boundedText = (text, bytes) => {
|
|
30
23
|
const encoded = Buffer.from(text);
|
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"
|