@wirecat/wirecat 1.1.0 → 3.0.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 (36) hide show
  1. package/README.md +4 -4
  2. package/contracts/wirecat.json +1 -1
  3. package/dist/answer.js +14 -6
  4. package/dist/bin/wcat-wirecat.js +2 -2
  5. package/dist/bundle/{auto-O24ISPOI.js → auto-3FV2LT4H.js} +6 -5
  6. package/dist/bundle/{chunk-SCDNOUUR.js → chunk-5APBHODO.js} +1 -1
  7. package/dist/bundle/{chunk-CKBTMZUX.js → chunk-DJLUI6E6.js} +3 -3
  8. package/dist/bundle/{chunk-T7TG4JKR.js → chunk-GQOQZT23.js} +2 -2
  9. package/dist/bundle/{chunk-XBUCXQKT.js → chunk-KR5QSKQ6.js} +2 -2
  10. package/dist/bundle/{chunk-I5JQBRRC.js → chunk-LTI3MDYQ.js} +12 -1
  11. package/dist/bundle/{chunk-AYHZY24E.js → chunk-O6KHNKUM.js} +2 -2
  12. package/dist/bundle/{chunk-2A3YPENI.js → chunk-ORLHR3ZY.js} +1 -1
  13. package/dist/bundle/{chunk-FGXUH3XL.js → chunk-QCTRIEC4.js} +11 -5
  14. package/dist/bundle/{chunk-RKVAWMZT.js → chunk-TMMASKOU.js} +1 -1
  15. package/dist/bundle/{chunk-6BDIFKF5.js → chunk-ZE2T4EOA.js} +3 -3
  16. package/dist/bundle/{entry-EW5A7FYV.js → entry-AVDRO3VG.js} +6 -6
  17. package/dist/bundle/{failure-HMELJ3K5.js → failure-G76RKGKM.js} +4 -4
  18. package/dist/bundle/{from-memo-F7NTUXAR.js → from-memo-6KTXNOZ4.js} +7 -6
  19. package/dist/bundle/{program-7XWGFN4H.js → program-Z3B5EUUU.js} +129 -50
  20. package/dist/bundle/{server-T7RVBNRW.js → server-7IWWFZ4E.js} +74 -31
  21. package/dist/bundle/{update-JZDS7B6L.js → update-73FDIPRR.js} +4 -4
  22. package/dist/bundle/wcat-wirecat.js +3 -3
  23. package/dist/knowledge/project-gather-command.js +1 -1
  24. package/dist/mcp/catalogue.js +2 -0
  25. package/dist/mcp/server.js +11 -19
  26. package/dist/ref-alias.js +57 -0
  27. package/dist/run/import.js +37 -6
  28. package/dist/search/answers.js +22 -17
  29. package/dist/search/command.js +13 -10
  30. package/dist/show/command.js +63 -5
  31. package/dist/version.js +1 -1
  32. package/package.json +2 -4
  33. package/skills/wcat/SKILL.md +1 -1
  34. package/skills/wcat/topics/search.md +3 -3
  35. package/dist/install/postinstall.js +0 -47
  36. package/install/postinstall.mjs +0 -9
package/README.md CHANGED
@@ -56,9 +56,9 @@ wcat search notes "budget"
56
56
  ```
57
57
 
58
58
  pnpm keeps one copy of each package for all WireCat tools. npm works too:
59
- `npm install -g @wirecat/wirecat @wirecat/files-cli`. A global install does not install the agent skill, and pnpm
60
- does not run wcat's install script, so the second line does both. On Windows, open a new terminal if `wcat` is not
61
- found.
59
+ `npm install -g @wirecat/wirecat @wirecat/files-cli`. wcat has no install script, so a global install adds only
60
+ `wcat-wirecat`: the second line installs the agent skill and adds `wcat`. On Windows, open a new terminal if `wcat`
61
+ is not found.
62
62
 
63
63
  That is all notes need. wcat runs `wcat-files sync` itself when the files CLI is installed. Then add more context:
64
64
 
@@ -179,7 +179,7 @@ More: [technical docs](#technical-docs) · [wcat on wirecat.dev](https://wirecat
179
179
 
180
180
  Notes and documents belong to the [files](https://github.com/WireCatLabs/files-cli) CLI: `files folders add`, `files sync`, `files notes add` and the
181
181
  rest. wcat reads what it stored: `wcat search notes`, `wcat context`, `wcat tags` and `wcat tasks` see those notes,
182
- and `wcat show note:<id>` names the `files notes show` command that opens one. `wcat sync` runs `wcat-files sync`
182
+ and `wcat show note:<id>` gives a note's text, the first 2000 characters unless `--max-chars` asks for more. `wcat sync` runs `wcat-files sync`
183
183
  when the files CLI is on PATH.
184
184
 
185
185
  More: [notes on wirecat.dev](https://wirecat.dev/en/docs/files)
@@ -22,7 +22,7 @@
22
22
  "path": [
23
23
  "show"
24
24
  ],
25
- "summary": "what any reference names, and the command that opens it",
25
+ "summary": "what any reference names, and the command that opens it; a note or document with its text",
26
26
  "effects": {
27
27
  "remote": "none",
28
28
  "local": "read"
package/dist/answer.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { CliError, createRenderer } from "@wirecat/cli-base";
2
2
  import { COMPACT_FLAG } from "@wirecat/cli-base/standards";
3
- import { compactText, currentRun, itemOf, listOf, openStore, renderAnswer, rootOf, sealed, } from "@wirecat/cli-core";
3
+ import { compactText, currentRun, itemOf, listOf, openStore, renderAnswer, resolveOutput, rootOf, sealed, } from "@wirecat/cli-core";
4
4
  import { STORE_CLIENT } from "./app.js";
5
5
  import { decisionPolicy } from "./config.js";
6
6
  import { snakeKeys } from "./output.js";
7
7
  import { rowOf, sectionRowOf } from "./rows.js";
8
8
  import { crmNotes } from "./store/crm-viewer.js";
9
+ import { terminalOf } from "./terminal.js";
9
10
  export const itemAnswer = (value, extra) => itemOf(snakeKeys(value), extra);
10
11
  /**
11
12
  * A list. One that takes neither `--cursor` nor `--page` shows more only by a higher `--limit`, so it names no
@@ -60,6 +61,13 @@ const compactView = (command, full) => (kept) => {
60
61
  ...(full ? { textChars: 0 } : {}),
61
62
  }, sectionRowOf);
62
63
  };
64
+ /**
65
+ * cli-core's rule for every CLI: `--json`, or a pipe, gets JSON; a person at a terminal gets text. wcat's terminal is
66
+ * the one `createProgram` was handed, so a test stands for either.
67
+ */
68
+ export const formatOf = (command, json, streams) => resolveOutput({ json: json === true, tty: terminalOf(command).present, streams }).format;
69
+ /** A person reads this run's answer as text, so notes about the search may go to stderr beside it. */
70
+ export const readsText = (command, json, streams) => command.optsWithGlobals().compact !== true && formatOf(command, json, streams) === "pretty";
63
71
  /** The answer is judged by the command that ran — whether it may be partial — so the root remembers it. */
64
72
  export const trackAnswers = (program) => {
65
73
  currentRun();
@@ -73,20 +81,20 @@ export const trackAnswers = (program) => {
73
81
  });
74
82
  };
75
83
  /**
76
- * Prints answers through cli-core's renderer: the whole envelope for `--json`, one line per item for `--compact`,
77
- * otherwise `text`, or plain lines where a command has no text view.
84
+ * Prints answers through cli-core's renderer: the whole envelope for `--json` or a pipe, one line per item for
85
+ * `--compact`, otherwise `text`, or plain lines where a command has no text view.
78
86
  */
79
87
  export const answers = (program, streams, env) => {
80
88
  const print = (json, body, text, asked) => {
81
- const format = json ? "json" : "pretty";
82
89
  const root = rootOf(program);
83
90
  const leaf = running.get(root) ?? root;
84
91
  const { compact = asked, full } = leaf.optsWithGlobals();
92
+ // In compact form the next steps are # lines on stdout; printing them again on stderr would say them twice.
93
+ const drawn = compact === true && !json;
94
+ const format = drawn ? "pretty" : formatOf(leaf, json, streams);
85
95
  const renderer = createRenderer({ format, color: false, streams });
86
96
  for (const note of noted.get(body) ?? [])
87
97
  renderer.note(note);
88
- // In compact form the next steps are # lines on stdout; printing them again on stderr would say them twice.
89
- const drawn = compact === true && !json;
90
98
  renderAnswer(leaf, { renderer: drawn ? { ...renderer, note: () => undefined } : renderer, format, streams }, body, drawn ? compactView(leaf, full === true) : () => `${text ?? plainText(body, leaf)}\n`);
91
99
  };
92
100
  return {
@@ -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("1.1.0\n")
12
+ process.stdout.write("3.0.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/auto-O24ISPOI.js","../bundle/entry-EW5A7FYV.js","../bundle/failure-HMELJ3K5.js","../bundle/from-memo-F7NTUXAR.js","../bundle/program-7XWGFN4H.js","../bundle/server-T7RVBNRW.js","../bundle/update-JZDS7B6L.js"]
29
+ const chunks = ["../bundle/auto-3FV2LT4H.js","../bundle/entry-AVDRO3VG.js","../bundle/failure-G76RKGKM.js","../bundle/from-memo-6KTXNOZ4.js","../bundle/program-Z3B5EUUU.js","../bundle/server-7IWWFZ4E.js","../bundle/update-73FDIPRR.js"]
30
30
  const preload = () =>
31
31
  Promise.allSettled([
32
32
  ...chunks.map((chunk) => import(chunk)),
@@ -17,12 +17,13 @@ import {
17
17
  serviceUnit,
18
18
  timerUnit,
19
19
  unitDir
20
- } from "./chunk-6BDIFKF5.js";
20
+ } from "./chunk-ZE2T4EOA.js";
21
21
  import "./chunk-7O7XM37N.js";
22
- import "./chunk-FGXUH3XL.js";
23
- import "./chunk-T7TG4JKR.js";
24
- import "./chunk-I5JQBRRC.js";
25
- import "./chunk-SCDNOUUR.js";
22
+ import "./chunk-QCTRIEC4.js";
23
+ import "./chunk-GQOQZT23.js";
24
+ import "./chunk-LTI3MDYQ.js";
25
+ import "./chunk-ORLHR3ZY.js";
26
+ import "./chunk-5APBHODO.js";
26
27
  export {
27
28
  DEFAULT_EVERY,
28
29
  PLACE_VARIABLES,
@@ -372,7 +372,7 @@ var REASONS = defineReasons([
372
372
  ]);
373
373
 
374
374
  // dist/version.js
375
- var VERSION = "1.1.0";
375
+ var VERSION = "3.0.0";
376
376
 
377
377
  // dist/app.js
378
378
  var APP = {
@@ -2,15 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  ValiError
5
- } from "./chunk-I5JQBRRC.js";
5
+ } from "./chunk-LTI3MDYQ.js";
6
6
  import {
7
7
  interactiveOf,
8
8
  optionsOf
9
- } from "./chunk-2A3YPENI.js";
9
+ } from "./chunk-ORLHR3ZY.js";
10
10
  import {
11
11
  APP,
12
12
  __name
13
- } from "./chunk-SCDNOUUR.js";
13
+ } from "./chunk-5APBHODO.js";
14
14
 
15
15
  // dist/failure.js
16
16
  import { CliError, errorObjectOf, errorRecordOf, exitCodeOfError, mcpErrorResult, renderError } from "@wirecat/cli-base";
@@ -19,10 +19,10 @@ import {
19
19
  string,
20
20
  union,
21
21
  unknown
22
- } from "./chunk-I5JQBRRC.js";
22
+ } from "./chunk-LTI3MDYQ.js";
23
23
  import {
24
24
  __name
25
- } from "./chunk-SCDNOUUR.js";
25
+ } from "./chunk-5APBHODO.js";
26
26
 
27
27
  // dist/config.js
28
28
  import { CliError as CliError2, configFilePath, resolvePaths, saveConfigFile } from "@wirecat/cli-base";
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  loadConfig
5
- } from "./chunk-T7TG4JKR.js";
5
+ } from "./chunk-GQOQZT23.js";
6
6
  import {
7
7
  APP,
8
8
  VERSION,
9
9
  __name
10
- } from "./chunk-SCDNOUUR.js";
10
+ } from "./chunk-5APBHODO.js";
11
11
 
12
12
  // dist/update.js
13
13
  import { join } from "node:path";
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  __name
5
- } from "./chunk-SCDNOUUR.js";
5
+ } from "./chunk-5APBHODO.js";
6
6
 
7
7
  // node_modules/.pnpm/valibot@1.5.0_typescript@7.0.2/node_modules/valibot/dist/index.mjs
8
8
  var store$4;
@@ -136,6 +136,16 @@ function check(requirement, message$1) {
136
136
  }
137
137
  __name(check, "check");
138
138
  // @__NO_SIDE_EFFECTS__
139
+ function description(description_) {
140
+ return {
141
+ kind: "metadata",
142
+ type: "description",
143
+ reference: description,
144
+ description: description_
145
+ };
146
+ }
147
+ __name(description, "description");
148
+ // @__NO_SIDE_EFFECTS__
139
149
  function integer(message$1) {
140
150
  return {
141
151
  kind: "validation",
@@ -782,6 +792,7 @@ __name(safeParse, "safeParse");
782
792
  export {
783
793
  ValiError,
784
794
  check,
795
+ description,
785
796
  integer,
786
797
  maxLength,
787
798
  minLength,
@@ -4,11 +4,11 @@ import {
4
4
  inspectConfig,
5
5
  loadConfig,
6
6
  memoPermissionKeys
7
- } from "./chunk-T7TG4JKR.js";
7
+ } from "./chunk-GQOQZT23.js";
8
8
  import {
9
9
  APP,
10
10
  __name
11
- } from "./chunk-SCDNOUUR.js";
11
+ } from "./chunk-5APBHODO.js";
12
12
 
13
13
  // dist/read-only.js
14
14
  import { metaOf } from "@wirecat/cli-base/commands";
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  __name
5
- } from "./chunk-SCDNOUUR.js";
5
+ } from "./chunk-5APBHODO.js";
6
6
 
7
7
  // dist/terminal.js
8
8
  var MACHINE_FLAGS = /* @__PURE__ */ new Set(["--json", "--jsonl"]);
@@ -2,16 +2,19 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  decisionPolicy
5
- } from "./chunk-T7TG4JKR.js";
5
+ } from "./chunk-GQOQZT23.js";
6
+ import {
7
+ terminalOf
8
+ } from "./chunk-ORLHR3ZY.js";
6
9
  import {
7
10
  STORE_CLIENT,
8
11
  __name
9
- } from "./chunk-SCDNOUUR.js";
12
+ } from "./chunk-5APBHODO.js";
10
13
 
11
14
  // dist/answer.js
12
15
  import { CliError as CliError2, createRenderer } from "@wirecat/cli-base";
13
16
  import { COMPACT_FLAG } from "@wirecat/cli-base/standards";
14
- import { compactText, currentRun, itemOf, listOf, openStore, renderAnswer, rootOf, sealed } from "@wirecat/cli-core";
17
+ import { compactText, currentRun, itemOf, listOf, openStore, renderAnswer, resolveOutput as resolveOutput2, rootOf, sealed } from "@wirecat/cli-core";
15
18
 
16
19
  // dist/output.js
17
20
  import { resolveOutput, snakeKeysKeeping } from "@wirecat/cli-core";
@@ -359,6 +362,8 @@ var compactView = /* @__PURE__ */ __name((command, full) => (kept) => {
359
362
  ...full ? { textChars: 0 } : {}
360
363
  }, sectionRowOf);
361
364
  }, "compactView");
365
+ var formatOf = /* @__PURE__ */ __name((command, json, streams) => resolveOutput2({ json: json === true, tty: terminalOf(command).present, streams }).format, "formatOf");
366
+ var readsText = /* @__PURE__ */ __name((command, json, streams) => command.optsWithGlobals().compact !== true && formatOf(command, json, streams) === "pretty", "readsText");
362
367
  var trackAnswers = /* @__PURE__ */ __name((program) => {
363
368
  currentRun();
364
369
  program.option(COMPACT_FLAG, "one line per item for an agent: reference first, text last, paging and next steps as # lines").hook("preAction", (root, leaf) => {
@@ -370,14 +375,14 @@ var trackAnswers = /* @__PURE__ */ __name((program) => {
370
375
  }, "trackAnswers");
371
376
  var answers = /* @__PURE__ */ __name((program, streams, env) => {
372
377
  const print = /* @__PURE__ */ __name((json, body, text, asked) => {
373
- const format = json ? "json" : "pretty";
374
378
  const root = rootOf(program);
375
379
  const leaf = running.get(root) ?? root;
376
380
  const { compact = asked, full } = leaf.optsWithGlobals();
381
+ const drawn = compact === true && !json;
382
+ const format = drawn ? "pretty" : formatOf(leaf, json, streams);
377
383
  const renderer = createRenderer({ format, color: false, streams });
378
384
  for (const note of noted.get(body) ?? [])
379
385
  renderer.note(note);
380
- const drawn = compact === true && !json;
381
386
  renderAnswer(leaf, { renderer: drawn ? { ...renderer, note: /* @__PURE__ */ __name(() => void 0, "note") } : renderer, format, streams }, body, drawn ? compactView(leaf, full === true) : () => `${text ?? plainText(body, leaf)}
382
387
  `);
383
388
  }, "print");
@@ -411,6 +416,7 @@ export {
411
416
  shortenedBy,
412
417
  timezone,
413
418
  plainText,
419
+ readsText,
414
420
  trackAnswers,
415
421
  answers
416
422
  };
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  APP,
5
5
  __name
6
- } from "./chunk-SCDNOUUR.js";
6
+ } from "./chunk-5APBHODO.js";
7
7
 
8
8
  // dist/migrate/skill.js
9
9
  import { readFileSync, rmSync } from "node:fs";
@@ -3,14 +3,14 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  answers,
5
5
  itemAnswer
6
- } from "./chunk-FGXUH3XL.js";
6
+ } from "./chunk-QCTRIEC4.js";
7
7
  import {
8
8
  loadConfig,
9
9
  updateConfig
10
- } from "./chunk-T7TG4JKR.js";
10
+ } from "./chunk-GQOQZT23.js";
11
11
  import {
12
12
  __name
13
- } from "./chunk-SCDNOUUR.js";
13
+ } from "./chunk-5APBHODO.js";
14
14
 
15
15
  // dist/run/auto.js
16
16
  import { execFile } from "node:child_process";
@@ -2,11 +2,11 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  interactiveOf
5
- } from "./chunk-2A3YPENI.js";
5
+ } from "./chunk-ORLHR3ZY.js";
6
6
  import {
7
7
  APP,
8
8
  __name
9
- } from "./chunk-SCDNOUUR.js";
9
+ } from "./chunk-5APBHODO.js";
10
10
 
11
11
  // dist/run/entry.js
12
12
  import { errorObjectOf, exitCodeOfError, processStreams, renderError } from "@wirecat/cli-base";
@@ -20,9 +20,9 @@ var memoEntry = /* @__PURE__ */ __name((io) => {
20
20
  reasons: APP.errors.reasons,
21
21
  ...io === void 0 ? {} : { io },
22
22
  run: /* @__PURE__ */ __name(async (entry) => {
23
- failure = await import("./failure-HMELJ3K5.js");
24
- const { createProgram, liftGroup, refuseJoinedPath } = await import("./program-7XWGFN4H.js");
25
- const { autoNotice, followInstall } = await import("./auto-O24ISPOI.js");
23
+ failure = await import("./failure-G76RKGKM.js");
24
+ const { createProgram, liftGroup, refuseJoinedPath } = await import("./program-Z3B5EUUU.js");
25
+ const { autoNotice, followInstall } = await import("./auto-3FV2LT4H.js");
26
26
  const lifting = createProgram({ signal: entry.signal });
27
27
  programs.set(entry, lifting);
28
28
  const { group, rest: args } = await liftGroup(lifting, entry.args, entry.env);
@@ -33,7 +33,7 @@ var memoEntry = /* @__PURE__ */ __name((io) => {
33
33
  if (notice2)
34
34
  processStreams.diagnostic(notice2);
35
35
  }
36
- const { updateNotice } = await import("./update-JZDS7B6L.js");
36
+ const { updateNotice } = await import("./update-73FDIPRR.js");
37
37
  const notice = updateNotice(args);
38
38
  program.hook("preAction", (_root, command) => entry.atStart(command));
39
39
  failure.throwParseFailures(program);
@@ -6,10 +6,10 @@ import {
6
6
  recognisable,
7
7
  reportFailure,
8
8
  throwParseFailures
9
- } from "./chunk-CKBTMZUX.js";
10
- import "./chunk-I5JQBRRC.js";
11
- import "./chunk-2A3YPENI.js";
12
- import "./chunk-SCDNOUUR.js";
9
+ } from "./chunk-DJLUI6E6.js";
10
+ import "./chunk-LTI3MDYQ.js";
11
+ import "./chunk-ORLHR3ZY.js";
12
+ import "./chunk-5APBHODO.js";
13
13
  export {
14
14
  errorObject,
15
15
  mcpFailure,
@@ -2,20 +2,21 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  replaceMemoSkill
5
- } from "./chunk-RKVAWMZT.js";
5
+ } from "./chunk-TMMASKOU.js";
6
6
  import {
7
7
  applyAuto,
8
8
  autoState,
9
9
  unitDir
10
- } from "./chunk-6BDIFKF5.js";
10
+ } from "./chunk-ZE2T4EOA.js";
11
11
  import "./chunk-7O7XM37N.js";
12
- import "./chunk-FGXUH3XL.js";
13
- import "./chunk-T7TG4JKR.js";
14
- import "./chunk-I5JQBRRC.js";
12
+ import "./chunk-QCTRIEC4.js";
13
+ import "./chunk-GQOQZT23.js";
14
+ import "./chunk-LTI3MDYQ.js";
15
+ import "./chunk-ORLHR3ZY.js";
15
16
  import {
16
17
  APP,
17
18
  __name
18
- } from "./chunk-SCDNOUUR.js";
19
+ } from "./chunk-5APBHODO.js";
19
20
 
20
21
  // dist/migrate/from-memo.js
21
22
  import { closeSync, cpSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, renameSync, rmdirSync, rmSync, statSync, writeFileSync } from "node:fs";