@wirecat/cli-core 0.650.0 → 0.652.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 +65 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/cli/account-remove.js +11 -6
- package/dist/cli/compact.d.ts +5 -0
- package/dist/cli/compact.js +7 -3
- package/dist/cli/doctor-reports-command.d.ts +11 -0
- package/dist/cli/doctor-reports-command.js +57 -5
- package/dist/cli/help/first-screen.js +5 -0
- package/dist/cli/program.js +3 -1
- package/dist/cli/schedule/schedule-command.js +9 -3
- package/dist/cli/unknown-profile.d.ts +4 -3
- package/dist/cli/unknown-profile.js +13 -6
- package/dist/constants/index.d.ts +4 -3
- package/dist/constants/index.js +7 -5
- package/dist/documents/catalog.d.ts +2 -1
- package/dist/documents/catalog.js +4 -3
- package/dist/documents/index.d.ts +1 -1
- package/dist/documents/index.js +1 -1
- package/dist/documents/model.d.ts +3 -0
- package/dist/documents/scope.d.ts +13 -0
- package/dist/documents/scope.js +7 -0
- package/dist/entities/index.d.ts +10 -10
- package/dist/entities/task-results.d.ts +10 -10
- package/dist/errors/reasons.js +6 -1
- package/dist/kit/own-catalogue.d.ts +1 -1
- package/dist/kit/own-catalogue.js +3 -3
- package/dist/meetings/index.d.ts +1 -1
- package/dist/meetings/pull.js +19 -0
- package/dist/meetings/store.d.ts +7 -0
- package/dist/meetings/transcript-store.d.ts +4 -0
- package/dist/models/endpoint.d.ts +2 -2
- package/dist/models/endpoint.js +37 -3
- package/dist/services/documents/plan.d.ts +2 -1
- package/dist/services/documents/plan.js +35 -10
- package/dist/services/documents/ports.d.ts +2 -0
- package/dist/services/documents/sync.js +17 -7
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/search-all.js +20 -1
- package/dist/store/path.d.ts +2 -0
- package/dist/store/path.js +1 -1
- package/dist/store/sqlite/link-kinds.d.ts +2 -2
- package/dist/store/sqlite/link-kinds.js +2 -2
- package/dist/store/sqlite/meeting-projects.js +3 -3
- package/dist/store/sqlite/meeting-transcript-documents.d.ts +10 -0
- package/dist/store/sqlite/meeting-transcript-documents.js +52 -0
- package/dist/store/sqlite/meetings.d.ts +2 -2
- package/dist/store/sqlite/meetings.js +16 -2
- package/dist/store/sqlite/person-match-scan.d.ts +5 -0
- package/dist/store/sqlite/person-match-scan.js +21 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,71 @@ 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.652.0 — 13.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **A document sync takes a saved query beside its selected folders** (`SyncOptions.query`, `SourceQuery`). `include`
|
|
13
|
+
imports every file the query lists wherever it sits, read again on each sync, and drops one that stops matching;
|
|
14
|
+
`exclude` keeps matching files out even inside a selected folder. A profile without a query keeps its checkpoint.
|
|
15
|
+
drive uses it for Google Meet transcripts and Gemini notes that live in organizers' Drives.
|
|
16
|
+
- **A meeting transcript can name the Drive file it was saved as** (`TranscriptInput.driveFileId`). The store links the
|
|
17
|
+
meeting to that file's document whichever arrives first, and `search all` then shows the meeting once instead of the
|
|
18
|
+
meeting and the same Google Doc. A document whose meeting is not among the hits still shows. A newer transcript
|
|
19
|
+
that names another file replaces the link.
|
|
20
|
+
|
|
21
|
+
## 0.651.0 — 13.11.2026
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **The first screen and first run list `pbx`**, the Asterisk tool (`@wirecat/asterisk-cli`), under "Works with" and
|
|
26
|
+
among the tools first run offers to install.
|
|
27
|
+
- **`doctor reports create` gives a pre-filled issue link** in `issue_url` and in its note, when the CLI's app
|
|
28
|
+
definition names `issues`. The title and body hold only the version, the platform and the failed run's error code
|
|
29
|
+
and provider key; the report file stays on the computer until the person attaches it.
|
|
30
|
+
- **`RowShape.oneLine` draws one thing as one line under `--compact`.** An item answer then prints as the row a list
|
|
31
|
+
of it prints, and its `sections` still follow as rows, so a decision result can list one line per decision. Opt-in:
|
|
32
|
+
a row without it prints `key: value` lines as before.
|
|
33
|
+
- **`doctor reports show` and `create` find the issue page in the CLI's package.json** when its app definition names
|
|
34
|
+
no `issues`: the GitHub repository in `bugs` or `repository`, as `<repository>/issues/new`. A repository elsewhere
|
|
35
|
+
gives no link, since the link fills the issue through GitHub's own parameters.
|
|
36
|
+
- **A meetings sync links the callers it saved to their people by number**, without memo's `people scan`. It runs the
|
|
37
|
+
scan's phone rule alone, for those callers only, and moves no scan cursor
|
|
38
|
+
([MEETINGS.md](docs/dev/MEETINGS.md#calls-and-the-people-they-link-to)). `MeetingStore.linkCallers` is optional;
|
|
39
|
+
the shared store has it.
|
|
40
|
+
|
|
41
|
+
### Changed — may break callers
|
|
42
|
+
|
|
43
|
+
- **A stale meeting project fingerprint is `conflict`, not `configuration_error`** (reason `meeting-project.stale`).
|
|
44
|
+
A caller that checks the code moves to `conflict`.
|
|
45
|
+
- **`CORE_HOSTS` is cli-base's `SHARED_HOSTS` and the two default model providers.** It gains `*.huggingface.co` and
|
|
46
|
+
`*.githubusercontent.com` (in place of `release-assets.githubusercontent.com`), and a test keeps it equal to cli-base's
|
|
47
|
+
list. No published CLI reads it. cli-core's own tests and checks move to `@wirecat/cli-base` 0.99.0.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- **A mistyped profile in `<PREFIX>_PROFILE` gets the profiles here too** (`profile.unknown`), as a mistyped first
|
|
52
|
+
word does, and a CLI's own "no profile named …" is no longer said twice in the message.
|
|
53
|
+
- **`ownCatalogue` keeps a generated Bot API command as the CLI's own**, as `commands --json` marks it, so a
|
|
54
|
+
bot's contract test pins its generated commands.
|
|
55
|
+
- **`session start` and `setup` keep a provider's refusal.** A sign-in that failed for a new profile was reported as
|
|
56
|
+
`profile.unknown` ("no profile named …"), hiding why the provider refused it.
|
|
57
|
+
- **`schedule command` saves PATH without its relative folders.** Under pnpm, PATH holds `./node_modules/.bin`, and
|
|
58
|
+
`schedule exec` refused the saved schedule; a schedule saved this way runs again once it is saved again.
|
|
59
|
+
- **Confirming a proposed meeting project keeps the owner's reason.** `linkMeetingProject` with
|
|
60
|
+
`expectedFingerprint` and `provenance` now stores the owner's reason; before, the agent's stayed.
|
|
61
|
+
- **An IPv6 model address such as `https://[fd00::1]` is reached again.** It was refused as "not a host", because
|
|
62
|
+
`hostFetch` takes no IPv6 literal. It now goes only to that host, with the same deadline and no redirect followed.
|
|
63
|
+
As for IPv4, plain http is allowed only to this computer (`[::1]`).
|
|
64
|
+
|
|
65
|
+
### Security
|
|
66
|
+
|
|
67
|
+
- **`account remove` in a run with only the config folder moved no longer runs the tool's own sign-out.** With
|
|
68
|
+
`<PREFIX>_CONFIG_DIR` (or the cache folder) moved, the state folder is the owner's, and the tool's `signOut` hook
|
|
69
|
+
deleted the session there: the owner's own (WC-SECR-24). The sign-in is now listed under `kept` with the moved-run
|
|
70
|
+
reason. The check of the owner's folders also follows links, so a moved config folder that is a link to the owner's
|
|
71
|
+
own no longer rewrites the owner's `config.json`. A tool's own guard, such as wa's `device.owners`, can stay.
|
|
72
|
+
|
|
8
73
|
## 0.650.0 — 13.11.2026
|
|
9
74
|
|
|
10
75
|
### Added
|
|
@@ -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 { thisMachine } from "../background/system.js";
|
|
|
11
11
|
import { locationVariables, platformFor } from "../background/units.js";
|
|
12
12
|
import { httpLockFile } from "../mcp/http/state.js";
|
|
13
13
|
import { sendsPathFor } from "../sends/journal.js";
|
|
14
|
-
import { accountHome, inOwnerFolder, storePath } from "../store/path.js";
|
|
14
|
+
import { accountHome, inOwnerFolder, settled, storePath } from "../store/path.js";
|
|
15
15
|
import { openStore } from "../store/store.js";
|
|
16
16
|
import { readConfigFile, withoutPath } from "./config-issues.js";
|
|
17
17
|
import { baseContext, environmentOf } from "./context.js";
|
|
@@ -46,7 +46,8 @@ const insideOwnFolders = (app, env, extra) => {
|
|
|
46
46
|
return full;
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
const
|
|
49
|
+
const under = (path, root) => path === root || path.startsWith(`${root}${sep}`);
|
|
50
|
+
const within = (path, root) => under(path, root) || under(settled(path), settled(root));
|
|
50
51
|
/**
|
|
51
52
|
* WC-SECR-24: the tool's folders as the owner's own run has them. A run with moved folders shares the rest with the
|
|
52
53
|
* owner (only the config folder moved leaves the state folder the owner's), so it removes nothing inside these.
|
|
@@ -203,8 +204,11 @@ export const accountRemoveCommand = (app, removal, options = {}) => logsInOrOut(
|
|
|
203
204
|
const unit = ownerHomeHere ? undefined : serveUnit(app, system, profile, env);
|
|
204
205
|
if (unit && (await platformFor(app, system, env).state(unit)).active)
|
|
205
206
|
throw new CliError("conflict", `${unit.name} is running for ${profile} — stop it first (\`${app.command} ${profile} server stop\`), then remove the account`, { reason: "account-remove.busy" });
|
|
206
|
-
const
|
|
207
|
-
|
|
207
|
+
const signIn = { kind: "sign_in", target: `${app.command} sign-in of ${profile}` };
|
|
208
|
+
// The tool's own sign-out deletes its session where the run's state folder says; here that folder is the owner's.
|
|
209
|
+
const signsOut = !(movedFolders && inOwners(state));
|
|
210
|
+
const removed = signsOut ? [signIn] : [];
|
|
211
|
+
const kept = [...ownersKept, ...(signsOut ? [] : [{ ...signIn, reason: ownersReason }])];
|
|
208
212
|
// An entry the environment supplies is not this tool's to remove.
|
|
209
213
|
const saved = (store, name) => (store.read(name)?.source ?? "environment") !== "environment";
|
|
210
214
|
for (const { store, accounts } of secrets)
|
|
@@ -276,8 +280,9 @@ export const accountRemoveCommand = (app, removal, options = {}) => logsInOrOut(
|
|
|
276
280
|
throw new CliError("cancelled", `cancelled — ${profile} is unchanged`);
|
|
277
281
|
}
|
|
278
282
|
await context.run(async () => {
|
|
279
|
-
const signedOut = await removal.signOut(profile, hooks);
|
|
280
|
-
|
|
283
|
+
const signedOut = signsOut ? await removal.signOut(profile, hooks) : undefined;
|
|
284
|
+
if (signedOut)
|
|
285
|
+
removed.splice(0, 1, ...signedOut.removed.map((target) => ({ kind: "sign_in", target })));
|
|
281
286
|
const keyringEntries = removed.filter((one) => one.kind === "keyring");
|
|
282
287
|
const gone = new Set();
|
|
283
288
|
for (const { store, accounts } of secrets)
|
package/dist/cli/compact.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface RowShape {
|
|
|
22
22
|
whole?: readonly string[];
|
|
23
23
|
/** An item answer's fields left out: bookkeeping an agent reads in `--json` if it ever needs it. */
|
|
24
24
|
hidden?: readonly string[];
|
|
25
|
+
/**
|
|
26
|
+
* An item answer drawn as the one row a list of it draws, not as `key: value` lines; its `sections` still follow
|
|
27
|
+
* as rows. Opt-in: a `show` whose help promises one line under `--compact`.
|
|
28
|
+
*/
|
|
29
|
+
oneLine?: boolean;
|
|
25
30
|
}
|
|
26
31
|
export interface CompactOptions {
|
|
27
32
|
/** IANA zone for times; the answer's `meta.timezone` wins. */
|
package/dist/cli/compact.js
CHANGED
|
@@ -390,8 +390,9 @@ export const compactText = (body, shape, options, rowsOf = rowsOfEntity()) => {
|
|
|
390
390
|
else if (isFields(body.item)) {
|
|
391
391
|
const sections = shape.sections ?? {};
|
|
392
392
|
const rest = Object.fromEntries(Object.entries(body.item).filter(([name]) => !Object.hasOwn(sections, name) && !shape.hidden?.includes(name)));
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
const own = shape.oneLine ? rowsOfItems([rest], shape, clock, chars) : undefined;
|
|
394
|
+
lines = own ? own.lines.filter((line) => line !== "") : blockOf(rest, chars, "", shape.whole).map(guarded);
|
|
395
|
+
let dates = own?.dates ?? [];
|
|
395
396
|
let drawn = [];
|
|
396
397
|
for (const [name, entity] of Object.entries(sections)) {
|
|
397
398
|
const list = body.item[name];
|
|
@@ -402,7 +403,10 @@ export const compactText = (body, shape, options, rowsOf = rowsOfEntity()) => {
|
|
|
402
403
|
drawn = drawn.concat([`# ${[`${clean(name)}: ${list.length}`, ...header].join(" · ")}`], rows);
|
|
403
404
|
}
|
|
404
405
|
const when = spanOf(dates, clock);
|
|
405
|
-
|
|
406
|
+
const head = [...(own?.header ?? []), ...when];
|
|
407
|
+
lines = own
|
|
408
|
+
? (head.length ? [`# ${head.join(" · ")}`] : []).concat(lines, drawn)
|
|
409
|
+
: lines.concat(when.length ? [`# ${when.join(" · ")}`] : [], drawn);
|
|
406
410
|
}
|
|
407
411
|
else if (present(body.item))
|
|
408
412
|
lines = [guarded(cut(clean(String(body.item)), chars))];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import type { AppIdentity } from "../ports/app.js";
|
|
3
|
+
import type { RunMetadata } from "../runs/run.js";
|
|
3
4
|
import type { SendEntry } from "../sends/journal.js";
|
|
4
5
|
import { type BaseContext } from "./context.js";
|
|
5
6
|
export interface DoctorReportsSource {
|
|
@@ -18,5 +19,15 @@ export interface DoctorReportsSource {
|
|
|
18
19
|
renderer?: BaseContext["renderer"];
|
|
19
20
|
}>;
|
|
20
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* The new-issue page: the app definition's `issues`, else the GitHub repository its installed package names in
|
|
24
|
+
* `bugs` or `repository`. Only GitHub's: the link fills the issue through GitHub's own parameters.
|
|
25
|
+
*/
|
|
26
|
+
export declare const issuesPage: (app: AppIdentity, script?: string | undefined) => string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* A new issue with its title and body filled in through GitHub's `title` and `body` parameters. An issue is public, so
|
|
29
|
+
* the body holds only the version, the platform and the failed run's codes; the person attaches the file.
|
|
30
|
+
*/
|
|
31
|
+
export declare const issueUrlFor: (app: AppIdentity, run: RunMetadata | undefined, platform?: NodeJS.Platform, arch?: NodeJS.Architecture) => string;
|
|
21
32
|
/** `doctor reports show|create`: one file for the author, the same for every CLI; `collect` says what it holds. */
|
|
22
33
|
export declare const doctorReportsCommand: (source: DoctorReportsSource) => Command;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { dirname, resolve } from "node:path";
|
|
1
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { CliError } from "@wirecat/cli-base";
|
|
4
4
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
5
5
|
import { Command } from "commander";
|
|
@@ -8,6 +8,7 @@ import { environmentOf, outputFor } from "./context.js";
|
|
|
8
8
|
import { destroysNothing, LOCAL_WRITE, NO_EFFECTS } from "./effects.js";
|
|
9
9
|
import { itemOf, renderAnswer } from "./envelope.js";
|
|
10
10
|
import { buildReport, reportFileName } from "./messenger/report.js";
|
|
11
|
+
import { ownPackageRoot } from "./messenger/serve-outdated.js";
|
|
11
12
|
import { lineOf, nextStep, rootOf } from "./steps.js";
|
|
12
13
|
const writeNew = (path, text) => {
|
|
13
14
|
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
@@ -22,6 +23,50 @@ const writeNew = (path, text) => {
|
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
};
|
|
26
|
+
const urlOf = (field) => {
|
|
27
|
+
const url = typeof field === "string" ? field : field?.url;
|
|
28
|
+
return typeof url === "string" ? url : undefined;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The new-issue page: the app definition's `issues`, else the GitHub repository its installed package names in
|
|
32
|
+
* `bugs` or `repository`. Only GitHub's: the link fills the issue through GitHub's own parameters.
|
|
33
|
+
*/
|
|
34
|
+
export const issuesPage = (app, script = process.argv[1]) => {
|
|
35
|
+
if (app.issues)
|
|
36
|
+
return app.issues;
|
|
37
|
+
const root = ownPackageRoot(app.version, script);
|
|
38
|
+
if (!root)
|
|
39
|
+
return undefined;
|
|
40
|
+
try {
|
|
41
|
+
const manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
42
|
+
const repository = /github\.com[/:]([\w.-]+)\/([\w.-]+?)(?:\.git)?(?:\/issues)?\/?$/.exec(urlOf(manifest.bugs) ?? urlOf(manifest.repository) ?? "");
|
|
43
|
+
return repository ? `https://github.com/${repository[1]}/${repository[2]}/issues/new` : undefined;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* A new issue with its title and body filled in through GitHub's `title` and `body` parameters. An issue is public, so
|
|
51
|
+
* the body holds only the version, the platform and the failed run's codes; the person attaches the file.
|
|
52
|
+
*/
|
|
53
|
+
export const issueUrlFor = (app, run, platform = process.platform, arch = process.arch) => {
|
|
54
|
+
const code = run ? (run.errorCode ?? "failed") : undefined;
|
|
55
|
+
const body = [
|
|
56
|
+
"What I did:",
|
|
57
|
+
"",
|
|
58
|
+
"What I expected:",
|
|
59
|
+
"",
|
|
60
|
+
"What happened:",
|
|
61
|
+
"",
|
|
62
|
+
"---",
|
|
63
|
+
`${app.command} ${app.version}, ${platform} ${arch}`,
|
|
64
|
+
...(code ? [`error: ${code}${run?.providerError ? ` (${run.providerError})` : ""}`] : []),
|
|
65
|
+
"The problem report file is attached.",
|
|
66
|
+
].join("\n");
|
|
67
|
+
const title = `${app.command} ${app.version}: ${code ?? "problem report"}`;
|
|
68
|
+
return `${app.issues}?title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}`;
|
|
69
|
+
};
|
|
25
70
|
/** `doctor reports show|create`: one file for the author, the same for every CLI; `collect` says what it holds. */
|
|
26
71
|
export const doctorReportsCommand = (source) => {
|
|
27
72
|
const { app, includes, excludes } = source;
|
|
@@ -34,7 +79,8 @@ export const doctorReportsCommand = (source) => {
|
|
|
34
79
|
.summary("what a report holds and never holds, and where to send it; writes nothing")
|
|
35
80
|
.action(function () {
|
|
36
81
|
const create = lineOf(this, "doctor reports create");
|
|
37
|
-
|
|
82
|
+
const page = issuesPage(app);
|
|
83
|
+
renderAnswer(this, outputFor(this), itemOf({ includes, excludes, ...(page ? { send_to: page } : {}) }, { next: [nextStep("doctor.report-create", { args: {} })] }), () => [
|
|
38
84
|
`A problem report is one file for the author of ${app.command}.`,
|
|
39
85
|
"",
|
|
40
86
|
"It holds:",
|
|
@@ -73,10 +119,16 @@ export const doctorReportsCommand = (source) => {
|
|
|
73
119
|
writeNew(path, `${JSON.stringify(built, null, 2)}\n`);
|
|
74
120
|
const output = outputFor(this);
|
|
75
121
|
const out = renderer ?? output.renderer;
|
|
76
|
-
|
|
122
|
+
const page = issuesPage(app);
|
|
123
|
+
const issue = page ? issueUrlFor({ ...app, issues: page }, built.run?.metadata) : undefined;
|
|
124
|
+
renderAnswer(this, { ...output, renderer: out }, itemOf({
|
|
125
|
+
path,
|
|
126
|
+
run: built.run?.metadata.runId ?? null,
|
|
127
|
+
...(issue ? { send_to: page, issue_url: issue } : {}),
|
|
128
|
+
}));
|
|
77
129
|
if (!built.run)
|
|
78
130
|
out.note("no failed run is recorded — run the failing command again, and the failure is kept by itself");
|
|
79
|
-
out.note(`read it before sending: ${source.check}${
|
|
131
|
+
out.note(`read it before sending: ${source.check}${issue ? ` — then open ${issue} and attach the file; the issue is public` : ""}`);
|
|
80
132
|
});
|
|
81
133
|
return reports;
|
|
82
134
|
};
|
|
@@ -53,6 +53,11 @@ export const WIRECAT_TOOLS = [
|
|
|
53
53
|
package: "@wirecat/bitrix24-cli",
|
|
54
54
|
does: "Bitrix24 CRM: deals, leads and pipelines, searchable with your other WireCat data",
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
command: "pbx",
|
|
58
|
+
package: "@wirecat/asterisk-cli",
|
|
59
|
+
does: "Asterisk PBX calls and recordings, searchable with your other WireCat data",
|
|
60
|
+
},
|
|
56
61
|
];
|
|
57
62
|
const WIDTH = 100;
|
|
58
63
|
const widest = (texts) => texts.reduce((most, text) => Math.max(most, text.length), 0);
|
package/dist/cli/program.js
CHANGED
|
@@ -42,7 +42,7 @@ import { assertSharedContracts } from "./shared-contracts.js";
|
|
|
42
42
|
import { skillSourceOf } from "./skill-command.js";
|
|
43
43
|
import { refreshSkills, skipsSkillRefresh } from "./skill-refresh.js";
|
|
44
44
|
import { commandAt, failureSteps, lineOf, withLines } from "./steps.js";
|
|
45
|
-
import { unknownProfile } from "./unknown-profile.js";
|
|
45
|
+
import { isSignIn, unknownProfile } from "./unknown-profile.js";
|
|
46
46
|
const OUTPUT_OPTIONS = [
|
|
47
47
|
["output", "--output"],
|
|
48
48
|
["outputDir", "--output-dir"],
|
|
@@ -699,6 +699,8 @@ const settleFailure = async (failure, state) => {
|
|
|
699
699
|
/** The settings a failed run had, read again without asking for a profile; `undefined` when they do not load. */
|
|
700
700
|
const failureSettings = (definition, program, rest, profile, options) => {
|
|
701
701
|
const path = commandPath(program, program.args.length > 0 ? program.args : rest);
|
|
702
|
+
if (isSignIn(path))
|
|
703
|
+
return undefined;
|
|
702
704
|
const { resolveSettings } = definition.configuration ?? settingsFor(definition.app);
|
|
703
705
|
try {
|
|
704
706
|
return resolveSettings({ ...program.opts(), ...(profile === undefined ? {} : { profile }) }, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, rmSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
2
|
+
import { delimiter, dirname, isAbsolute, join } from "node:path";
|
|
3
3
|
import { CliError, resolvePaths, writeSecurely } from "@wirecat/cli-base";
|
|
4
4
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
5
5
|
import { Argument, Command, Option } from "commander";
|
|
@@ -220,15 +220,21 @@ export const backfillScheduleRun = (command, app, env, file, { at, input, agentR
|
|
|
220
220
|
};
|
|
221
221
|
/** The tool's state folder, which holds its schedules. */
|
|
222
222
|
export const scheduleState = ({ app, env }) => resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state;
|
|
223
|
+
const absolutePath = (path) => (path ?? "")
|
|
224
|
+
.split(delimiter)
|
|
225
|
+
.filter((folder) => folder !== "" && isAbsolute(folder))
|
|
226
|
+
.join(delimiter);
|
|
223
227
|
/** The variables a run gets on top of the timer's: the profile, where the files are, PATH. Never a credential. */
|
|
224
228
|
const scheduleEnvironment = ({ app, env, profile }) => {
|
|
225
229
|
// The command line refuses a schedule under the lock; a caller that gets here still passes the lock on.
|
|
226
230
|
const readOnly = readOnlyLockOf(app, env);
|
|
231
|
+
const path = absolutePath(env.PATH);
|
|
227
232
|
return {
|
|
228
233
|
[`${app.envPrefix}_PROFILE`]: profile,
|
|
229
234
|
...locationVariables(app, env),
|
|
230
|
-
// The timer starts with almost no PATH; an agent runs the CLI and its own tools by name.
|
|
231
|
-
|
|
235
|
+
// The timer starts with almost no PATH; an agent runs the CLI and its own tools by name. A relative folder (pnpm's
|
|
236
|
+
// ./node_modules/.bin) means another folder from the timer's, and `schedule exec` refuses it.
|
|
237
|
+
...(path ? { PATH: path } : {}),
|
|
232
238
|
...(readOnly ? { [readOnly]: "1" } : {}),
|
|
233
239
|
};
|
|
234
240
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Settings } from "./settings.js";
|
|
2
|
+
/** A sign-in names a new profile on purpose: a refusal there is the provider's, never an unknown profile. */
|
|
3
|
+
export declare const isSignIn: (path: string) => boolean;
|
|
2
4
|
/**
|
|
3
5
|
* A "not signed in" failure for a first word this computer has never seen as a profile is most likely a typo: it
|
|
4
6
|
* answers `not_found` with the profiles here (FIND-2583), and keeps the sign-in hint for a profile that is new on
|
|
5
|
-
* purpose. Only after a command failed,
|
|
6
|
-
*
|
|
7
|
-
* gets its token with `bot auth set` under any new name.
|
|
7
|
+
* purpose. Only after a command failed, and never for `setup` or `session start`, which make a new one. The first word and `<PREFIX>_PROFILE` are checked, since a typo in either is as likely; a bot gets
|
|
8
|
+
* its token with `bot auth set` under any new name.
|
|
8
9
|
*/
|
|
9
10
|
export declare const unknownProfile: (error: unknown, settingsOf: () => (Pick<Settings, "profile"> & Partial<Pick<Settings, "sources" | "profilesHere" | "kind">>) | undefined) => unknown;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { CliError, isCliError } from "@wirecat/cli-base";
|
|
2
2
|
// gcal-cli raised its own oauth.missing before cli-core merged it into session.missing (FIND-2583).
|
|
3
3
|
const NOT_SIGNED_IN = new Set([undefined, "session.missing", "oauth.missing"]);
|
|
4
|
+
const FROM_ENV = /^[A-Z0-9_]+_PROFILE$/;
|
|
5
|
+
const SIGN_INS = new Set(["session start", "setup"]);
|
|
6
|
+
/** A sign-in names a new profile on purpose: a refusal there is the provider's, never an unknown profile. */
|
|
7
|
+
export const isSignIn = (path) => SIGN_INS.has(path);
|
|
8
|
+
// A script's `<PREFIX>_PROFILE` on a computer with no profile yet names a new one, not a mistyped one.
|
|
9
|
+
const typo = (source, here) => source === "first word" || (source !== undefined && FROM_ENV.test(source) && here.length > 0);
|
|
4
10
|
/**
|
|
5
11
|
* A "not signed in" failure for a first word this computer has never seen as a profile is most likely a typo: it
|
|
6
12
|
* answers `not_found` with the profiles here (FIND-2583), and keeps the sign-in hint for a profile that is new on
|
|
7
|
-
* purpose. Only after a command failed,
|
|
8
|
-
*
|
|
9
|
-
* gets its token with `bot auth set` under any new name.
|
|
13
|
+
* purpose. Only after a command failed, and never for `setup` or `session start`, which make a new one. The first word and `<PREFIX>_PROFILE` are checked, since a typo in either is as likely; a bot gets
|
|
14
|
+
* its token with `bot auth set` under any new name.
|
|
10
15
|
*/
|
|
11
16
|
export const unknownProfile = (error, settingsOf) => {
|
|
12
17
|
if (!isCliError(error) || error.code !== "authentication_error")
|
|
@@ -15,10 +20,12 @@ export const unknownProfile = (error, settingsOf) => {
|
|
|
15
20
|
return error;
|
|
16
21
|
const settings = settingsOf();
|
|
17
22
|
const here = settings?.profilesHere;
|
|
18
|
-
if (!settings || !here || settings.kind === "bot" || settings.sources?.profile
|
|
23
|
+
if (!settings || !here || settings.kind === "bot" || !typo(settings.sources?.profile, here))
|
|
19
24
|
return error;
|
|
20
25
|
if (here.includes(settings.profile))
|
|
21
26
|
return error;
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
// A CLI that checks its own profiles already says "no profile named …".
|
|
28
|
+
const sayTheRefusal = !/no profile named/i.test(error.message);
|
|
29
|
+
return new CliError("not_found", `no profile named ${settings.profile} on this computer — profiles here: ${here.join(", ") || "none"}` +
|
|
30
|
+
(sayTheRefusal ? `; if ${settings.profile} is a new one: ${error.message}` : ""), { reason: "profile.unknown", profiles: here });
|
|
24
31
|
};
|
|
@@ -82,8 +82,9 @@ export declare const oauthClientReport: (app: {
|
|
|
82
82
|
} | undefined, reason?: string) => OAuthClientReport;
|
|
83
83
|
export type { AppSource };
|
|
84
84
|
/**
|
|
85
|
-
* The hosts cli-core itself reaches in any tool:
|
|
86
|
-
* downloads
|
|
87
|
-
*
|
|
85
|
+
* The hosts cli-core itself reaches in any tool: the default model providers, then cli-base's `SHARED_HOSTS` (npm for
|
|
86
|
+
* `upgrade`, the model downloads and the hosts they redirect to), which `cli-dev manifest` adds to every CLI's hosts.
|
|
87
|
+
* Typed out, not imported, so a CLI on an older cli-base still loads this module; a test keeps the two equal. A model
|
|
88
|
+
* endpoint or calendar feed the person configures belongs in `userHosts`.
|
|
88
89
|
*/
|
|
89
90
|
export declare const CORE_HOSTS: readonly string[];
|
package/dist/constants/index.js
CHANGED
|
@@ -76,16 +76,18 @@ export const oauthClientReport = (app, reason) => app?.source
|
|
|
76
76
|
? { client: app.source === "constants" ? "wirecat" : "own", source: app.source }
|
|
77
77
|
: { client: null, source: null, ...(reason ? { reason } : {}) };
|
|
78
78
|
/**
|
|
79
|
-
* The hosts cli-core itself reaches in any tool:
|
|
80
|
-
* downloads
|
|
81
|
-
*
|
|
79
|
+
* The hosts cli-core itself reaches in any tool: the default model providers, then cli-base's `SHARED_HOSTS` (npm for
|
|
80
|
+
* `upgrade`, the model downloads and the hosts they redirect to), which `cli-dev manifest` adds to every CLI's hosts.
|
|
81
|
+
* Typed out, not imported, so a CLI on an older cli-base still loads this module; a test keeps the two equal. A model
|
|
82
|
+
* endpoint or calendar feed the person configures belongs in `userHosts`.
|
|
82
83
|
*/
|
|
83
84
|
export const CORE_HOSTS = [
|
|
84
|
-
"registry.npmjs.org",
|
|
85
85
|
"api.openai.com",
|
|
86
86
|
"api.anthropic.com",
|
|
87
|
+
"registry.npmjs.org",
|
|
87
88
|
"huggingface.co",
|
|
89
|
+
"*.huggingface.co",
|
|
88
90
|
"*.hf.co",
|
|
89
91
|
"github.com",
|
|
90
|
-
"
|
|
92
|
+
"*.githubusercontent.com",
|
|
91
93
|
];
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { SourceFile, SourceState } from "./model.js";
|
|
2
|
-
|
|
2
|
+
import { type SourceQuery } from "./scope.js";
|
|
3
|
+
export declare const catalogFiles: <M extends SourceFile>(state: SourceState<M>, roots: string[], query?: SourceQuery<M>) => M[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const catalogFiles = (state, roots) => {
|
|
1
|
+
import { inScope } from "./scope.js";
|
|
2
|
+
export const catalogFiles = (state, roots, query) => {
|
|
3
3
|
const folders = state.pending?.folders ?? state.folders;
|
|
4
|
+
const matched = new Set(state.pending?.matched ?? state.matched ?? []);
|
|
4
5
|
const files = new Map(Object.values(state.documents).map((doc) => [doc.metadata.id, doc.metadata]));
|
|
5
6
|
for (const skip of state.skipped)
|
|
6
7
|
if (skip.file)
|
|
@@ -13,5 +14,5 @@ export const catalogFiles = (state, roots) => {
|
|
|
13
14
|
else if (job.file)
|
|
14
15
|
files.set(job.id, job.file);
|
|
15
16
|
}
|
|
16
|
-
return [...files.values()].filter((file) =>
|
|
17
|
+
return [...files.values()].filter((file) => inScope(file, roots, folders, matched, query));
|
|
17
18
|
};
|
|
@@ -14,4 +14,4 @@ export { catalogFiles } from "./catalog.js";
|
|
|
14
14
|
export { markdownBlocks, type PlacedBlock, placedMarkdownBlocks } from "./markdown-blocks.js";
|
|
15
15
|
export type { DocumentSource, IndexedSource, PictureWriter, SourceChange, SourceContent, SourceFile, SourceIndex, SourceSkip, SourceState, SourceStatePort, SourceWalk, SourceWork, TabText, } from "./model.js";
|
|
16
16
|
export type { ConflictPart, DocumentTarget, Keep, LocalDocument, Prepared, PushEntry, Pushed, PushPlan, PushState, PushStatePort, RemoteChange, } from "./push-model.js";
|
|
17
|
-
export { within } from "./scope.js";
|
|
17
|
+
export { inScope, type SourceQuery, within } from "./scope.js";
|
package/dist/documents/index.js
CHANGED
|
@@ -11,4 +11,4 @@ export { syncDocuments } from "../services/documents/sync.js";
|
|
|
11
11
|
export { blockKey, blockShape, normalizeInlines } from "./blocks.js";
|
|
12
12
|
export { catalogFiles } from "./catalog.js";
|
|
13
13
|
export { markdownBlocks, placedMarkdownBlocks } from "./markdown-blocks.js";
|
|
14
|
-
export { within } from "./scope.js";
|
|
14
|
+
export { inScope, within } from "./scope.js";
|
|
@@ -77,7 +77,10 @@ export interface SourceState<M extends SourceFile = SourceFile> {
|
|
|
77
77
|
folders: Record<string, M>;
|
|
78
78
|
jobs: SourceWork<M>[];
|
|
79
79
|
skipped: SourceSkip<M>[];
|
|
80
|
+
/** Files a saved query found, in scope wherever they sit. */
|
|
81
|
+
matched?: string[];
|
|
80
82
|
};
|
|
83
|
+
matched?: string[];
|
|
81
84
|
lastSync?: string;
|
|
82
85
|
}
|
|
83
86
|
export interface PictureWriter {
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import type { SourceFile } from "./model.js";
|
|
2
2
|
export declare const within: (file: SourceFile, roots: string[], folders: Record<string, SourceFile>, seen?: Set<string>) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* A saved query beside the selected folders: `include` adds the files it finds wherever they sit, `exclude` keeps the
|
|
5
|
+
* files it matches out even inside a selected folder.
|
|
6
|
+
*/
|
|
7
|
+
export interface SourceQuery<M extends SourceFile = SourceFile> {
|
|
8
|
+
/** Part of the sync's scope: a changed query or mode plans the sync again from the start. */
|
|
9
|
+
key: string;
|
|
10
|
+
mode: "include" | "exclude";
|
|
11
|
+
matches(file: M): boolean;
|
|
12
|
+
/** Every file the query finds, read on each sync: a file shared by another owner may never reach the change feed. */
|
|
13
|
+
list?(): Promise<M[]>;
|
|
14
|
+
}
|
|
15
|
+
export declare const inScope: <M extends SourceFile>(file: M, roots: string[], folders: Record<string, SourceFile>, matched?: ReadonlySet<string>, query?: SourceQuery<M>) => boolean;
|
package/dist/documents/scope.js
CHANGED
|
@@ -12,3 +12,10 @@ export const within = (file, roots, folders, seen = new Set()) => {
|
|
|
12
12
|
return folder ? within(folder, roots, folders, next) : roots.includes(id);
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
+
export const inScope = (file, roots, folders, matched = new Set(), query) => {
|
|
16
|
+
if (file.trashed)
|
|
17
|
+
return false;
|
|
18
|
+
if (query?.mode === "exclude" && query.matches(file))
|
|
19
|
+
return false;
|
|
20
|
+
return matched.has(file.id) || within(file, roots, folders);
|
|
21
|
+
};
|