@wirecat/cli-base 0.132.0 → 1.0.0-rc.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 +78 -0
- package/README.md +7 -1
- package/dist/batch.d.ts +1 -0
- package/dist/batch.js +1 -0
- package/dist/codegen/graphql-fake.d.ts +1 -1
- package/dist/codegen/graphql-fake.js +1 -1
- package/dist/codegen/graphql.d.ts +1 -12
- package/dist/codegen/graphql.js +0 -44
- package/dist/codegen/index.d.ts +4 -3
- package/dist/codegen/index.js +2 -1
- package/dist/codegen/model.d.ts +4 -1
- package/dist/codegen/pipeline.d.ts +5 -5
- package/dist/codegen/runtime.d.ts +9 -2
- package/dist/codegen/runtime.js +7 -1
- package/dist/codegen/selection.d.ts +13 -0
- package/dist/codegen/selection.js +44 -0
- package/dist/codegen/wp-json.d.ts +2 -2
- package/dist/commands/document.d.ts +3 -0
- package/dist/commands/document.js +3 -0
- package/dist/commands/page.d.ts +14 -2
- package/dist/commands/page.js +3 -0
- package/dist/completion/index.d.ts +5 -1
- package/dist/completion/index.js +5 -1
- package/dist/credentials.d.ts +2 -0
- package/dist/credentials.js +2 -0
- package/dist/dev/api-report.d.ts +24 -0
- package/dist/dev/api-report.js +345 -0
- package/dist/dev/main.js +9 -19
- package/dist/dev/next-version.d.ts +5 -1
- package/dist/dev/next-version.js +30 -2
- package/dist/dev/result-shape.d.ts +4 -0
- package/dist/dev/result-shape.js +4 -4
- package/dist/dev/wcat-lint.d.ts +4 -1
- package/dist/dev/wcat-lint.js +9 -2
- package/dist/executable.d.ts +2 -0
- package/dist/executable.js +2 -0
- package/dist/http/fetch.d.ts +1 -0
- package/dist/http/fetch.js +1 -0
- package/dist/http/hosts.d.ts +11 -2
- package/dist/http/hosts.js +11 -2
- package/dist/http/index.d.ts +10 -2
- package/dist/http/index.js +10 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/logging.d.ts +3 -0
- package/dist/logging.js +3 -0
- package/dist/mcp/index.d.ts +17 -3
- package/dist/mcp/index.js +12 -2
- package/dist/output-buffer.d.ts +3 -0
- package/dist/output-buffer.js +1 -0
- package/dist/query/dates.d.ts +6 -1
- package/dist/query/dates.js +6 -1
- package/dist/query/help.d.ts +1 -0
- package/dist/query/help.js +1 -0
- package/dist/query/registry.d.ts +6 -1
- package/dist/query/registry.js +6 -1
- package/dist/query/types.d.ts +1 -0
- package/dist/query/types.js +1 -0
- package/dist/release/fold.d.ts +5 -0
- package/dist/release/fold.js +10 -1
- package/dist/release/fragments.d.ts +5 -2
- package/dist/release/fragments.js +18 -15
- package/dist/release/level.js +17 -11
- package/dist/skill/index.d.ts +34 -5
- package/dist/skill/index.js +21 -3
- package/dist/standards/audit.d.ts +15 -1
- package/dist/standards/audit.js +12 -1
- package/dist/standards/effects.d.ts +2 -0
- package/dist/standards/effects.js +1 -0
- package/dist/standards/errors.d.ts +2 -0
- package/dist/standards/errors.js +2 -0
- package/dist/standards/fields.d.ts +3 -0
- package/dist/standards/fields.js +2 -0
- package/dist/standards/identifiers.d.ts +7 -1
- package/dist/standards/identifiers.js +6 -1
- package/dist/standards/lint.d.ts +48 -8
- package/dist/standards/lint.js +45 -8
- package/dist/standards/log.d.ts +15 -3
- package/dist/standards/log.js +15 -3
- package/dist/standards/monthly.d.ts +2 -0
- package/dist/standards/monthly.js +2 -0
- package/dist/standards/output.d.ts +8 -1
- package/dist/standards/output.js +7 -1
- package/dist/standards/registry.d.ts +6 -1
- package/dist/standards/registry.js +6 -1
- package/dist/standards/steps.d.ts +5 -1
- package/dist/standards/steps.js +5 -1
- package/dist/standards/vocabulary.d.ts +5 -1
- package/dist/standards/vocabulary.js +5 -1
- package/dist/testing/index.d.ts +1 -2
- package/dist/testing/index.js +1 -2
- package/dist/update/index.d.ts +25 -4
- package/dist/update/index.js +24 -4
- package/dist/wcat/manifest.d.ts +11 -1
- package/dist/wcat/manifest.js +10 -1
- package/docs/standards/commands.md +5 -4
- package/docs/standards/docs.md +5 -2
- package/docs/standards/releases.md +37 -9
- package/docs/standards/toolchain.md +1 -1
- package/package.json +23 -5
package/dist/http/index.d.ts
CHANGED
|
@@ -10,9 +10,17 @@ import { type RetryConfig } from "../retry.js";
|
|
|
10
10
|
import { type SleepLike, type WallClock } from "../time.js";
|
|
11
11
|
/** The one function an HTTP client needs from its environment. A Worker, a browser, a test and Node all satisfy it. */
|
|
12
12
|
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* `Retry-After` is either a number of seconds or an HTTP date. Both forms occur in the wild.
|
|
15
|
+
*
|
|
16
|
+
* @experimental
|
|
17
|
+
*/
|
|
14
18
|
export declare const parseRetryAfter: (header: string | null | undefined, now: WallClock) => number | undefined;
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* A Unix timestamp in seconds, the shape several providers use for `X-RateLimit-Reset`.
|
|
21
|
+
*
|
|
22
|
+
* @experimental
|
|
23
|
+
*/
|
|
16
24
|
export declare const parseRateLimitReset: (header: string | null | undefined, now: WallClock) => number | undefined;
|
|
17
25
|
/** What the provider asked us to wait, if it asked at all. Its timing beats our own backoff. */
|
|
18
26
|
export declare const providerWaitMs: (headers: Headers, now: WallClock) => number | undefined;
|
package/dist/http/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
import { CliError, isCliError } from "../errors.js";
|
|
9
9
|
import { backoffMs, DEFAULT_RETRY } from "../retry.js";
|
|
10
10
|
import { realSleep, wallClock } from "../time.js";
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* `Retry-After` is either a number of seconds or an HTTP date. Both forms occur in the wild.
|
|
13
|
+
*
|
|
14
|
+
* @experimental
|
|
15
|
+
*/
|
|
12
16
|
export const parseRetryAfter = (header, now) => {
|
|
13
17
|
if (!header)
|
|
14
18
|
return undefined;
|
|
@@ -23,7 +27,11 @@ export const parseRetryAfter = (header, now) => {
|
|
|
23
27
|
// limit is a hot loop.
|
|
24
28
|
return delta > 0 ? delta : undefined;
|
|
25
29
|
};
|
|
26
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* A Unix timestamp in seconds, the shape several providers use for `X-RateLimit-Reset`.
|
|
32
|
+
*
|
|
33
|
+
* @experimental
|
|
34
|
+
*/
|
|
27
35
|
export const parseRateLimitReset = (header, now) => {
|
|
28
36
|
if (!header)
|
|
29
37
|
return undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { CREDENTIAL_STORAGE, Credentials, keyringService, movedRunService } from
|
|
|
6
6
|
export { createDeadline, type Deadline, type DeadlineOptions } from "./deadline.js";
|
|
7
7
|
export { CliError, type CliErrorDetails, type ErrorCode, errorCodes, isCliError } from "./errors.js";
|
|
8
8
|
export { EXIT_CODES, exitCodeFor, GENERIC_FAILURE } from "./exit-codes.js";
|
|
9
|
-
export { type CatchCrashesOptions, catchCrashes, type ErrorRecord, type ErrorRecordOptions, errorObjectOf, errorRecordOf, exitCodeOfAnswer, exitCodeOfError, type FailureContext, mcpErrorResult, type RenderErrorOptions, renderError,
|
|
9
|
+
export { type CatchCrashesOptions, catchCrashes, type ErrorRecord, type ErrorRecordOptions, errorObjectOf, errorRecordOf, exitCodeOfAnswer, exitCodeOfError, type FailureContext, mcpErrorResult, type RenderErrorOptions, renderError, } from "./failure.js";
|
|
10
10
|
export { brokenKeyring, type KeyringStore, memoryKeyring, systemKeyring } from "./keyring.js";
|
|
11
11
|
export type { Logger } from "./logger.js";
|
|
12
12
|
export { createRecordLog, logRecordOf, NOT_ALLOWED, REDACTED_FIELDS, type RecordInput, type RecordLogOptions, } from "./logging.js";
|
|
@@ -18,4 +18,4 @@ export { fieldsOf, projectFields } from "./result-fields.js";
|
|
|
18
18
|
export { backoffMs, DEFAULT_RETRY, type RetryConfig } from "./retry.js";
|
|
19
19
|
export { singleLine, visibleControls } from "./sanitize.js";
|
|
20
20
|
export { captureStreams, processStreams, type Streams } from "./streams.js";
|
|
21
|
-
export {
|
|
21
|
+
export { type MonotonicClock, monotonic, realSleep, type SleepLike, type SleepReason, type WallClock, wallClock, } from "./time.js";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { CREDENTIAL_STORAGE, Credentials, keyringService, movedRunService } from
|
|
|
5
5
|
export { createDeadline } from "./deadline.js";
|
|
6
6
|
export { CliError, errorCodes, isCliError } from "./errors.js";
|
|
7
7
|
export { EXIT_CODES, exitCodeFor, GENERIC_FAILURE } from "./exit-codes.js";
|
|
8
|
-
export { catchCrashes, errorObjectOf, errorRecordOf, exitCodeOfAnswer, exitCodeOfError, mcpErrorResult, renderError,
|
|
8
|
+
export { catchCrashes, errorObjectOf, errorRecordOf, exitCodeOfAnswer, exitCodeOfError, mcpErrorResult, renderError, } from "./failure.js";
|
|
9
9
|
export { brokenKeyring, memoryKeyring, systemKeyring } from "./keyring.js";
|
|
10
10
|
export { createRecordLog, logRecordOf, NOT_ALLOWED, REDACTED_FIELDS, } from "./logging.js";
|
|
11
11
|
export { createOutputBuffer } from "./output-buffer.js";
|
|
@@ -16,4 +16,4 @@ export { fieldsOf, projectFields } from "./result-fields.js";
|
|
|
16
16
|
export { backoffMs, DEFAULT_RETRY } from "./retry.js";
|
|
17
17
|
export { singleLine, visibleControls } from "./sanitize.js";
|
|
18
18
|
export { captureStreams, processStreams } from "./streams.js";
|
|
19
|
-
export {
|
|
19
|
+
export { monotonic, realSleep, wallClock, } from "./time.js";
|
package/dist/logging.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { type LogRecord, type LogSeverity } from "./standards/log.js";
|
|
|
4
4
|
* Field names whose value must never reach a log file. This is the **second** line of defence, not
|
|
5
5
|
* the first: a secret should not be handed to a logger at all. Redaction catches the one that
|
|
6
6
|
* slipped into a nested object nobody thought about.
|
|
7
|
+
*
|
|
8
|
+
* @experimental
|
|
7
9
|
*/
|
|
8
10
|
export declare const REDACTED_FIELDS: string[];
|
|
9
11
|
export interface RecordLogOptions {
|
|
@@ -24,6 +26,7 @@ export interface RecordLogOptions {
|
|
|
24
26
|
onError?: (error: Error) => void;
|
|
25
27
|
now?: () => Date;
|
|
26
28
|
}
|
|
29
|
+
/** @experimental */
|
|
27
30
|
export declare const NOT_ALLOWED = "[not allowed]";
|
|
28
31
|
export interface RecordInput {
|
|
29
32
|
severity: LogSeverity;
|
package/dist/logging.js
CHANGED
|
@@ -4,6 +4,8 @@ import { isContentKey, LOG_ATTRIBUTE_KEYS } from "./standards/log.js";
|
|
|
4
4
|
* Field names whose value must never reach a log file. This is the **second** line of defence, not
|
|
5
5
|
* the first: a secret should not be handed to a logger at all. Redaction catches the one that
|
|
6
6
|
* slipped into a nested object nobody thought about.
|
|
7
|
+
*
|
|
8
|
+
* @experimental
|
|
7
9
|
*/
|
|
8
10
|
export const REDACTED_FIELDS = [
|
|
9
11
|
"authorization",
|
|
@@ -21,6 +23,7 @@ export const REDACTED_FIELDS = [
|
|
|
21
23
|
"verify_code",
|
|
22
24
|
"phone",
|
|
23
25
|
];
|
|
26
|
+
/** @experimental */
|
|
24
27
|
export const NOT_ALLOWED = "[not allowed]";
|
|
25
28
|
/**
|
|
26
29
|
* The one place a record is built, for `createRecordLog` and for a writer that appends its own lines.
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -13,10 +13,19 @@ export interface CommandResult {
|
|
|
13
13
|
stderr: string;
|
|
14
14
|
}
|
|
15
15
|
export type RunCommand = (file: string, args: string[]) => CommandResult;
|
|
16
|
+
/** @experimental */
|
|
16
17
|
export declare const setupArguments: (client: McpClient, name: string, entry: StdioEntry) => string[];
|
|
17
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* `unavailable`: the client is not installed here, or could not be started.
|
|
20
|
+
*
|
|
21
|
+
* @experimental
|
|
22
|
+
*/
|
|
18
23
|
export type StdioEntryState = "registered" | "missing" | "unavailable";
|
|
19
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Whether the client has a server by this name; reads only, through the client's own `mcp get`.
|
|
26
|
+
*
|
|
27
|
+
* @experimental
|
|
28
|
+
*/
|
|
20
29
|
export declare const stdioEntryStatus: (client: McpClient, name: string, { run }?: {
|
|
21
30
|
run?: RunCommand;
|
|
22
31
|
}) => {
|
|
@@ -24,8 +33,13 @@ export declare const stdioEntryStatus: (client: McpClient, name: string, { run }
|
|
|
24
33
|
name: string;
|
|
25
34
|
state: StdioEntryState;
|
|
26
35
|
};
|
|
36
|
+
/** @experimental */
|
|
27
37
|
export declare const removeArguments: (client: McpClient, name: string) => string[];
|
|
28
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Takes out what `installStdioEntry` added; a name the client does not have is left alone and reported.
|
|
40
|
+
*
|
|
41
|
+
* @experimental
|
|
42
|
+
*/
|
|
29
43
|
export declare const removeStdioEntry: (client: McpClient, name: string, { run }?: {
|
|
30
44
|
run?: RunCommand;
|
|
31
45
|
}) => {
|
package/dist/mcp/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const presentIn = (client, name, run) => {
|
|
|
16
16
|
throw new Error(`${executable(client)} is not installed or could not be started`);
|
|
17
17
|
return state === "registered";
|
|
18
18
|
};
|
|
19
|
+
/** @experimental */
|
|
19
20
|
export const setupArguments = (client, name, entry) => {
|
|
20
21
|
const variables = Object.entries(entry.env ?? {}).flatMap(([key, value]) => ["--env", `${key}=${value}`]);
|
|
21
22
|
if (client === "codex")
|
|
@@ -38,15 +39,24 @@ const lookUp = (client, name, run) => {
|
|
|
38
39
|
}
|
|
39
40
|
return "missing";
|
|
40
41
|
};
|
|
41
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Whether the client has a server by this name; reads only, through the client's own `mcp get`.
|
|
44
|
+
*
|
|
45
|
+
* @experimental
|
|
46
|
+
*/
|
|
42
47
|
export const stdioEntryStatus = (client, name, { run = realRun } = {}) => {
|
|
43
48
|
checkName(name);
|
|
44
49
|
return { client, name, state: lookUp(client, name, run) };
|
|
45
50
|
};
|
|
51
|
+
/** @experimental */
|
|
46
52
|
export const removeArguments = (client, name) =>
|
|
47
53
|
// Claude Code without a scope removes from whichever scope holds the name, which may be a project's own entry.
|
|
48
54
|
client === "codex" ? ["mcp", "remove", name] : ["mcp", "remove", "--scope", "user", name];
|
|
49
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Takes out what `installStdioEntry` added; a name the client does not have is left alone and reported.
|
|
57
|
+
*
|
|
58
|
+
* @experimental
|
|
59
|
+
*/
|
|
50
60
|
export const removeStdioEntry = (client, name, { run = realRun } = {}) => {
|
|
51
61
|
checkName(name);
|
|
52
62
|
if (!presentIn(client, name, run))
|
package/dist/output-buffer.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { RenderFormat } from "./renderer.js";
|
|
2
|
+
/** @experimental */
|
|
2
3
|
export interface OutputBufferOptions {
|
|
3
4
|
maxOutputBytes?: number;
|
|
4
5
|
fields?: string;
|
|
5
6
|
format?: RenderFormat;
|
|
6
7
|
}
|
|
8
|
+
/** @experimental */
|
|
7
9
|
export interface OutputBuffer {
|
|
8
10
|
readonly bytes: number;
|
|
9
11
|
/** Raw output chunks, including any delimiters. Projection requires complete JSON values/JSONL lines. */
|
|
@@ -12,4 +14,5 @@ export interface OutputBuffer {
|
|
|
12
14
|
flush(write: (text: string) => void): void;
|
|
13
15
|
discard(): void;
|
|
14
16
|
}
|
|
17
|
+
/** @experimental */
|
|
15
18
|
export declare const createOutputBuffer: ({ maxOutputBytes, fields, format, }?: OutputBufferOptions) => OutputBuffer;
|
package/dist/output-buffer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CliError, isCliError } from "./errors.js";
|
|
2
2
|
import { fieldsOf, projectFields } from "./result-fields.js";
|
|
3
|
+
/** @experimental */
|
|
3
4
|
export const createOutputBuffer = ({ maxOutputBytes = 4 * 1024 * 1024, fields, format, } = {}) => {
|
|
4
5
|
if (!Number.isSafeInteger(maxOutputBytes) || maxOutputBytes < 0)
|
|
5
6
|
throw new CliError("validation_error", "maxOutputBytes must be a nonnegative whole byte count");
|
package/dist/query/dates.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type Span } from "./types.js";
|
|
2
2
|
export declare const timezoneOf: (given?: string) => string;
|
|
3
3
|
export declare const dayBoundary: (value: string, zone: string, next: boolean, span: Span) => number;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* A time with no zone, read in `zone`. A local time that daylight saving skips or repeats is refused.
|
|
6
|
+
*
|
|
7
|
+
* @experimental
|
|
8
|
+
*/
|
|
5
9
|
export declare const wallTime: (value: string, zone: string, span: Span) => number;
|
|
6
10
|
/**
|
|
7
11
|
* A typed date or time as epoch ms. A zone the value names wins; else it is read in `zone`. A date alone is the
|
|
@@ -16,6 +20,7 @@ export interface DateRange {
|
|
|
16
20
|
lower_inclusive: boolean;
|
|
17
21
|
upper_inclusive: boolean;
|
|
18
22
|
}
|
|
23
|
+
/** @experimental */
|
|
19
24
|
export declare const dateEndpoint: (value: string, zone: string, side: "lower" | "upper", inclusive: boolean, span: Span, now?: number) => {
|
|
20
25
|
time?: number;
|
|
21
26
|
inclusive: boolean;
|
package/dist/query/dates.js
CHANGED
|
@@ -51,7 +51,11 @@ export const dayBoundary = (value, zone, next, span) => {
|
|
|
51
51
|
return lo;
|
|
52
52
|
};
|
|
53
53
|
const WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* A time with no zone, read in `zone`. A local time that daylight saving skips or repeats is refused.
|
|
56
|
+
*
|
|
57
|
+
* @experimental
|
|
58
|
+
*/
|
|
55
59
|
export const wallTime = (value, zone, span) => {
|
|
56
60
|
const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
|
|
57
61
|
if (year === undefined)
|
|
@@ -120,6 +124,7 @@ const dayOf = (word, zone, now, span) => {
|
|
|
120
124
|
date.setUTCDate(date.getUTCDate() - 1);
|
|
121
125
|
return date.toISOString().slice(0, 10);
|
|
122
126
|
};
|
|
127
|
+
/** @experimental */
|
|
123
128
|
export const dateEndpoint = (value, zone, side, inclusive, span, now = Date.now()) => {
|
|
124
129
|
if (value === "*")
|
|
125
130
|
return { inclusive };
|
package/dist/query/help.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { QueryRegistry } from "./fields.js";
|
|
2
|
+
/** @experimental */
|
|
2
3
|
export declare const QUERY_SYNTAX = "field:value \u00B7 \"a phrase\" \u00B7 word* \u00B7 AND OR NOT \u00B7 ( ) \u00B7 [a TO b] \u00B7 > >= < <=";
|
|
3
4
|
/** The Fields section of a list's help: one line per field it filters by, its defaults, the syntax and the guide. */
|
|
4
5
|
export declare const fieldsHelp: (registry: Pick<QueryRegistry, "fields" | "defaults"> & Partial<Pick<QueryRegistry, "backend">>, guide?: string) => string;
|
package/dist/query/help.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @experimental */
|
|
1
2
|
export const QUERY_SYNTAX = 'field:value · "a phrase" · word* · AND OR NOT · ( ) · [a TO b] · > >= < <=';
|
|
2
3
|
const shownOf = (registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields;
|
|
3
4
|
const leftOut = (fields) => fields.filter((field) => field.negatable).map((field) => field.name);
|
package/dist/query/registry.d.ts
CHANGED
|
@@ -4,8 +4,13 @@ export type FieldInfo = Omit<FieldSpec, "validate">;
|
|
|
4
4
|
export interface QueryInfo extends Omit<QueryRegistry, "fields"> {
|
|
5
5
|
fields: FieldInfo[];
|
|
6
6
|
}
|
|
7
|
+
/** @experimental */
|
|
7
8
|
export declare const describeQuery: (registry: QueryRegistry) => QueryInfo;
|
|
8
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Why an example or default term would not run against these fields, per field name; empty when every one runs.
|
|
11
|
+
*
|
|
12
|
+
* @experimental
|
|
13
|
+
*/
|
|
9
14
|
export declare const exampleProblems: (registry: QueryRegistry) => {
|
|
10
15
|
field: string;
|
|
11
16
|
problem: string;
|
package/dist/query/registry.js
CHANGED
|
@@ -4,13 +4,18 @@ import { duplicates, RegistryError, SNAKE_CASE } from "../standards/registry.js"
|
|
|
4
4
|
import { parseLucene } from "./parser.js";
|
|
5
5
|
import { walkQuery } from "./types.js";
|
|
6
6
|
import { validateQuery } from "./validate.js";
|
|
7
|
+
/** @experimental */
|
|
7
8
|
export const describeQuery = (registry) => ({
|
|
8
9
|
entity: registry.entity,
|
|
9
10
|
backend: registry.backend,
|
|
10
11
|
fields: registry.fields.map(({ validate: _, ...field }) => field),
|
|
11
12
|
...(registry.defaults && registry.defaults.length > 0 ? { defaults: [...registry.defaults] } : {}),
|
|
12
13
|
});
|
|
13
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Why an example or default term would not run against these fields, per field name; empty when every one runs.
|
|
16
|
+
*
|
|
17
|
+
* @experimental
|
|
18
|
+
*/
|
|
14
19
|
export const exampleProblems = (registry) => {
|
|
15
20
|
// An example proves syntax and type; whether a provider filters the field is the list's answer at run time.
|
|
16
21
|
const syntaxOnly = { ...registry, backend: "sql" };
|
package/dist/query/types.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface QueryAst {
|
|
|
37
37
|
language: "lucene-v1";
|
|
38
38
|
root: QueryNode;
|
|
39
39
|
}
|
|
40
|
+
/** @experimental */
|
|
40
41
|
export declare const queryNodeSchema: v.GenericSchema<QueryNode>;
|
|
41
42
|
/** The parsed tree as JSON: what an MCP `ast` argument and a saved search carry. */
|
|
42
43
|
export declare const queryAstSchema: v.ObjectSchema<{
|
package/dist/query/types.js
CHANGED
|
@@ -18,6 +18,7 @@ const predicateSchema = v.object({
|
|
|
18
18
|
implicit: v.optional(v.literal(true)),
|
|
19
19
|
slop: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0))),
|
|
20
20
|
});
|
|
21
|
+
/** @experimental */
|
|
21
22
|
export const queryNodeSchema = v.variant("kind", [
|
|
22
23
|
predicateSchema,
|
|
23
24
|
v.object({
|
package/dist/release/fold.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entries under one `###` heading, from each place it appears: one list, a blank line only inside an entry.
|
|
3
|
+
* A blank line before `- ` would split it into a loose list, as ydisk 0.3.0's Fixed shows.
|
|
4
|
+
*/
|
|
5
|
+
export declare const joinBodies: (bodies: string[][]) => string[];
|
|
1
6
|
/**
|
|
2
7
|
* Folds the unreleased section into the one below it when that one is `## <version> — `: one session
|
|
3
8
|
* dates the version, another adds the unreleased section above it before anyone publishes. Same-named
|
package/dist/release/fold.js
CHANGED
|
@@ -7,6 +7,15 @@ const trimBlank = (lines) => {
|
|
|
7
7
|
end--;
|
|
8
8
|
return lines.slice(start, end);
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* The entries under one `###` heading, from each place it appears: one list, a blank line only inside an entry.
|
|
12
|
+
* A blank line before `- ` would split it into a loose list, as ydisk 0.3.0's Fixed shows.
|
|
13
|
+
*/
|
|
14
|
+
export const joinBodies = (bodies) => bodies.flatMap(trimBlank).filter((line, index, lines) => line.trim() ||
|
|
15
|
+
!lines
|
|
16
|
+
.slice(index + 1)
|
|
17
|
+
.find((next) => next.trim())
|
|
18
|
+
?.startsWith("- "));
|
|
10
19
|
const parseSection = (block) => {
|
|
11
20
|
const [title = "", ...lines] = block.split("\n");
|
|
12
21
|
const chunks = new Map();
|
|
@@ -22,7 +31,7 @@ const parseSection = (block) => {
|
|
|
22
31
|
else if (line.trim())
|
|
23
32
|
throw new Error(`"${title}" has text before its first ### heading: "${line}"`);
|
|
24
33
|
}
|
|
25
|
-
const headings = new Map([...chunks].map(([heading, bodies]) => [heading, bodies
|
|
34
|
+
const headings = new Map([...chunks].map(([heading, bodies]) => [heading, joinBodies(bodies)]));
|
|
26
35
|
return { title, headings, repeated: [...chunks.values()].some((bodies) => bodies.length > 1) };
|
|
27
36
|
};
|
|
28
37
|
const render = (title, sections) => {
|
|
@@ -2,8 +2,11 @@ export type Fragment = {
|
|
|
2
2
|
name: string;
|
|
3
3
|
text: string;
|
|
4
4
|
};
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The changelog's `###` headings in the WireCat CLIs, in their order. `Changed — experimental` and `Deprecated` are a
|
|
7
|
+
* library's: a change to what it marks experimental, and a stable API that a later major removes; both need a minor.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CHANGELOG_HEADINGS: readonly ["Added", "Changed — may break callers", "Changed — experimental", "Deprecated", "Fixed", "Security", "Removed"];
|
|
7
10
|
export type FragmentRules = {
|
|
8
11
|
headings: readonly string[];
|
|
9
12
|
ids: readonly string[];
|
|
@@ -5,9 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
|
+
import { joinBodies } from "./fold.js";
|
|
8
9
|
import { idPattern } from "./markdown.js";
|
|
9
|
-
/**
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The changelog's `###` headings in the WireCat CLIs, in their order. `Changed — experimental` and `Deprecated` are a
|
|
12
|
+
* library's: a change to what it marks experimental, and a stable API that a later major removes; both need a minor.
|
|
13
|
+
*/
|
|
14
|
+
export const CHANGELOG_HEADINGS = [
|
|
15
|
+
"Added",
|
|
16
|
+
"Changed — may break callers",
|
|
17
|
+
"Changed — experimental",
|
|
18
|
+
"Deprecated",
|
|
19
|
+
"Fixed",
|
|
20
|
+
"Security",
|
|
21
|
+
"Removed",
|
|
22
|
+
];
|
|
11
23
|
const NAME = /^[a-z0-9][a-z0-9._-]*\.md$/;
|
|
12
24
|
export const readFragments = (root) => {
|
|
13
25
|
const directory = join(root, "changes");
|
|
@@ -55,30 +67,21 @@ export const fragmentProblems = ({ name, text }, { headings, ids }) => {
|
|
|
55
67
|
problems.push(`${file}: "${found}" has no entry`);
|
|
56
68
|
return problems;
|
|
57
69
|
};
|
|
58
|
-
const trimBlank = (lines) => {
|
|
59
|
-
let start = 0;
|
|
60
|
-
let end = lines.length;
|
|
61
|
-
while (start < end && !lines[start]?.trim())
|
|
62
|
-
start++;
|
|
63
|
-
while (end > start && !lines[end - 1]?.trim())
|
|
64
|
-
end--;
|
|
65
|
-
return lines.slice(start, end);
|
|
66
|
-
};
|
|
67
70
|
const byHeading = (lines, where) => {
|
|
68
71
|
const found = new Map();
|
|
69
72
|
let current;
|
|
70
73
|
for (const line of lines) {
|
|
71
74
|
if (line.startsWith("### ")) {
|
|
72
75
|
const heading = line.slice(4).trim();
|
|
73
|
-
current =
|
|
74
|
-
found.set(heading, current);
|
|
76
|
+
current = [];
|
|
77
|
+
found.set(heading, [...(found.get(heading) ?? []), current]);
|
|
75
78
|
}
|
|
76
79
|
else if (current)
|
|
77
80
|
current.push(line);
|
|
78
81
|
else if (line.trim())
|
|
79
82
|
throw new Error(`${where} has text before its first ### heading: "${line}"`);
|
|
80
83
|
}
|
|
81
|
-
return new Map([...found].map(([heading,
|
|
84
|
+
return new Map([...found].map(([heading, bodies]) => [heading, joinBodies(bodies)]));
|
|
82
85
|
};
|
|
83
86
|
/**
|
|
84
87
|
* Adds every fragment's entries under the same-named heading of `## <version> — `, after the entries already there,
|
|
@@ -95,7 +98,7 @@ export const collectFragments = (changelog, version, fragments, { headings }) =>
|
|
|
95
98
|
for (const fragment of fragments) {
|
|
96
99
|
const text = fragment.text.replace(/\]\(\.\.\//g, "](");
|
|
97
100
|
for (const [heading, body] of byHeading(text.split("\n"), `changes/${fragment.name}`))
|
|
98
|
-
merged.set(heading, [
|
|
101
|
+
merged.set(heading, joinBodies([merged.get(heading) ?? [], body]));
|
|
99
102
|
}
|
|
100
103
|
const rank = (heading) => (headings.includes(heading) ? headings.indexOf(heading) : headings.length);
|
|
101
104
|
const body = [...merged]
|
package/dist/release/level.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The version level a changelog section needs. `Added`, `Deprecated` and `Changed — experimental` need a minor; a
|
|
3
|
+
* break of the stable API (`Changed — may break callers`, `Removed`) a major from 1.0.0 on, a minor before it.
|
|
4
|
+
*/
|
|
2
5
|
const LEVELS = ["patch", "minor", "major"];
|
|
3
|
-
const
|
|
6
|
+
const PLAIN = /^\d+\.\d+\.\d+$/;
|
|
7
|
+
// `1.0.0-rc.1` counts as 1.0.0: the pre-release tail never makes a number of its own.
|
|
8
|
+
const parse = (version) => (version.split("-")[0] ?? "").split(".").map(Number);
|
|
4
9
|
const raised = (from, to) => {
|
|
5
10
|
const [a = 0, b = 0] = parse(from);
|
|
6
11
|
const [x = 0, y = 0] = parse(to);
|
|
@@ -8,12 +13,10 @@ const raised = (from, to) => {
|
|
|
8
13
|
return "major";
|
|
9
14
|
return y !== b ? "minor" : "patch";
|
|
10
15
|
};
|
|
11
|
-
// Before 1.0.0 the minor carries what a major would; a fix-only release is the only patch.
|
|
12
16
|
const needed = (version, section) => {
|
|
13
|
-
|
|
14
|
-
if (breaks)
|
|
17
|
+
if (/^### (Changed — may break callers|Removed)$/m.test(section))
|
|
15
18
|
return (parse(version)[0] ?? 0) >= 1 ? "major" : "minor";
|
|
16
|
-
return /^### Added$/m.test(section) ? "minor" : "patch";
|
|
19
|
+
return /^### (Added|Deprecated|Changed — experimental)$/m.test(section) ? "minor" : "patch";
|
|
17
20
|
};
|
|
18
21
|
const raise = (from, level) => {
|
|
19
22
|
const [a = 0, b = 0, c = 0] = parse(from);
|
|
@@ -26,22 +29,25 @@ const later = (x, y) => {
|
|
|
26
29
|
const i = a.findIndex((n, k) => n !== b[k]);
|
|
27
30
|
return i === -1 || (a[i] ?? 0) > (b[i] ?? 0) ? x : y;
|
|
28
31
|
};
|
|
32
|
+
/** The top section and the last plain release below it: a release candidate in between is not a release. */
|
|
29
33
|
const sections = (changelog) => {
|
|
30
|
-
const [top, below] = [...changelog.matchAll(/^## (\S+).*$/gm)];
|
|
31
|
-
|
|
34
|
+
const [top, ...below] = [...changelog.matchAll(/^## (\S+).*$/gm)];
|
|
35
|
+
const previous = below.find((one) => PLAIN.test(one[1] ?? ""));
|
|
36
|
+
const next = below[0];
|
|
37
|
+
if (!top || !previous?.[1] || !next)
|
|
32
38
|
return undefined;
|
|
33
|
-
return { version: top[1], previous:
|
|
39
|
+
return { version: top[1], previous: previous[1], section: changelog.slice(top.index, next.index) };
|
|
34
40
|
};
|
|
35
41
|
// The next free number on npm is a patch; the top section may need a minor or major over the version below it.
|
|
36
42
|
export const levelledVersion = (changelog, next) => {
|
|
37
43
|
const parts = sections(changelog);
|
|
38
|
-
if (!parts)
|
|
44
|
+
if (!parts || !PLAIN.test(next))
|
|
39
45
|
return next;
|
|
40
46
|
return later(next, raise(parts.previous, needed(next, parts.section)));
|
|
41
47
|
};
|
|
42
48
|
export const versionLevelProblem = (changelog) => {
|
|
43
49
|
const parts = sections(changelog);
|
|
44
|
-
if (!parts?.version ||
|
|
50
|
+
if (!parts?.version || !PLAIN.test(parts.version))
|
|
45
51
|
return undefined;
|
|
46
52
|
const { version, previous, section } = parts;
|
|
47
53
|
const want = needed(version, section);
|
package/dist/skill/index.d.ts
CHANGED
|
@@ -11,19 +11,29 @@ export interface SkillApp {
|
|
|
11
11
|
}
|
|
12
12
|
export declare const SKILL_TARGETS: readonly ["claude", "agents"];
|
|
13
13
|
export type SkillTarget = (typeof SKILL_TARGETS)[number];
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* `~/.claude/skills` is Claude Code's; `~/.agents/skills` is read by Codex, Gemini CLI and OpenClaw.
|
|
16
|
+
*
|
|
17
|
+
* @experimental
|
|
18
|
+
*/
|
|
15
19
|
export declare const skillPath: (target: SkillTarget, appName: string, env: Env) => string;
|
|
16
20
|
/**
|
|
17
21
|
* `metadata.version` from the frontmatter — where the Agent Skills specification keeps fields of its
|
|
18
22
|
* own — or a top-level `version:`, which pre-release builds of this package wrote.
|
|
19
23
|
*/
|
|
20
24
|
export declare const skillVersion: (content: string) => string | undefined;
|
|
21
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Adds or replaces `metadata.version` as a string; every other byte stays as it was.
|
|
27
|
+
*
|
|
28
|
+
* @experimental
|
|
29
|
+
*/
|
|
22
30
|
export declare const withVersion: (content: string, version: string) => string;
|
|
23
31
|
/**
|
|
24
32
|
* The files beside SKILL.md that it links to or names (`references/tasks.md`), as `/`-separated paths relative to its
|
|
25
33
|
* folder. A long skill keeps its core in SKILL.md and the rest in these, so an agent loads only what its task needs.
|
|
26
34
|
* Dotfiles and symbolic links are left out: a link could point anywhere on the machine.
|
|
35
|
+
*
|
|
36
|
+
* @experimental
|
|
27
37
|
*/
|
|
28
38
|
export declare const skillFiles: (skill: URL) => string[];
|
|
29
39
|
/**
|
|
@@ -46,18 +56,32 @@ export interface SkillTargetStatus {
|
|
|
46
56
|
}
|
|
47
57
|
/** Each target's installed copy against this CLI's version; reads only, and an unreadable file is missing. */
|
|
48
58
|
export declare const skillStatus: (app: SkillApp, env?: Env) => SkillTargetStatus[];
|
|
59
|
+
/** @experimental */
|
|
49
60
|
export interface ProgramResult {
|
|
50
61
|
status: number | null;
|
|
51
62
|
error?: Error;
|
|
52
63
|
stdout: string;
|
|
53
64
|
}
|
|
54
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Runs a program with no shell, found and started with the `env` given, never `process.env`.
|
|
67
|
+
*
|
|
68
|
+
* @experimental
|
|
69
|
+
*/
|
|
55
70
|
export type RunProgram = (file: string, args: readonly string[], env: Env) => ProgramResult;
|
|
56
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* How Hermes reads the skill: the `~/.agents/skills` folder listed in its `skills.external_dirs`, or a copy of its own.
|
|
73
|
+
*
|
|
74
|
+
* @experimental
|
|
75
|
+
*/
|
|
57
76
|
export type HermesRoute = "external_dirs" | "copy";
|
|
58
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* `HERMES_HOME`, else the folder Hermes itself defaults to.
|
|
79
|
+
*
|
|
80
|
+
* @experimental
|
|
81
|
+
*/
|
|
59
82
|
export declare const hermesHome: (env: Env, platform?: NodeJS.Platform) => string;
|
|
60
83
|
export declare const hermesCopyPath: (appName: string, env: Env) => string;
|
|
84
|
+
/** @experimental */
|
|
61
85
|
export interface HermesInstall {
|
|
62
86
|
via: HermesRoute;
|
|
63
87
|
/** The file Hermes reads. */
|
|
@@ -72,6 +96,8 @@ export interface HermesInstall {
|
|
|
72
96
|
* with Hermes's own `config set`, keeping every folder already listed. When Hermes is not on PATH, cannot be asked,
|
|
73
97
|
* or does not keep the folder, the skill is copied into `$HERMES_HOME/skills` instead — but only when that home exists:
|
|
74
98
|
* with neither the program nor its home, Hermes is not installed, and nothing is written.
|
|
99
|
+
*
|
|
100
|
+
* @experimental
|
|
75
101
|
*/
|
|
76
102
|
export declare const installHermesSkill: (app: SkillApp, skill: URL, { env, run }?: {
|
|
77
103
|
env?: Env;
|
|
@@ -80,6 +106,7 @@ export declare const installHermesSkill: (app: SkillApp, skill: URL, { env, run
|
|
|
80
106
|
written: string[];
|
|
81
107
|
hermes: HermesInstall;
|
|
82
108
|
};
|
|
109
|
+
/** @experimental */
|
|
83
110
|
export interface HermesSkillStatus extends Omit<SkillTargetStatus, "target"> {
|
|
84
111
|
/** How Hermes reads the copy reported; `null` when it reads none. */
|
|
85
112
|
via: HermesRoute | null;
|
|
@@ -88,6 +115,8 @@ export interface HermesSkillStatus extends Omit<SkillTargetStatus, "target"> {
|
|
|
88
115
|
* The copy Hermes reads: its own `skills/<app>` first, as Hermes scans it first, else the `~/.agents/skills` one when
|
|
89
116
|
* `skills.external_dirs` lists that folder. Asks Hermes through `config get` when its home exists, so a host calls it
|
|
90
117
|
* only when asked.
|
|
118
|
+
*
|
|
119
|
+
* @experimental
|
|
91
120
|
*/
|
|
92
121
|
export declare const hermesSkillStatus: (app: SkillApp, { env, run }?: {
|
|
93
122
|
env?: Env;
|