@hraness/wordcell 0.25.1 → 0.26.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/README.md +37 -35
- package/dist/capture.js +6 -6
- package/dist/cli-bin.js +14 -0
- package/dist/cli-release-c74c5m3k.js +799 -0
- package/dist/cli.js +26 -23
- package/dist/clip/acquire.js +3 -3
- package/dist/clip/cli.js +6 -6
- package/dist/clip/doctor.js +4 -4
- package/dist/evaluation-builder-bin.js +14 -0
- package/dist/evaluation-builder.js +12 -17
- package/dist/evaluation-kb.js +6 -6
- package/dist/graph-percolation.js +2 -2
- package/dist/index-3t0v457d.js +18 -0
- package/dist/{index-47893rgw.js → index-5h5awwh4.js} +4 -4
- package/dist/index-8pabwzqg.js +909 -0
- package/dist/{index-1wccy765.js → index-8w1zsgcm.js} +63 -930
- package/dist/{index-7drercgk.js → index-9fywek7g.js} +1 -1
- package/dist/{index-hz2wyggk.js → index-9paxge84.js} +1 -1
- package/dist/{index-mcpppwbq.js → index-9zkba8hr.js} +6 -6
- package/dist/{index-59bcxqee.js → index-j2jt49gr.js} +1 -1
- package/dist/index-ncgdaja4.js +64 -0
- package/dist/{index-nwrehke7.js → index-nd8v7r0z.js} +1 -1
- package/dist/{index-t3abkwk4.js → index-zbv70qmk.js} +15 -15
- package/dist/index.js +40 -40
- package/dist/pdf.js +2 -2
- package/dist/portfolio.js +5 -5
- package/dist/sdk.js +4 -4
- package/dist/{support-adj7bbge.js → support-ym4mpf7w.js} +19 -18
- package/dist/url-intelligence.js +3 -3
- package/dist/workflows/decision-context.js +5 -5
- package/dist/workflows/index.js +5 -5
- package/package.json +13 -6
- package/skills/wordcell/SKILL.md +10 -1
- package/src/cli-bin.ts +5 -0
- package/src/cli-help.ts +12 -0
- package/src/cli-program.ts +3 -57
- package/src/cli-release.ts +732 -0
- package/src/cli-startup.ts +76 -0
- package/src/cli-update.ts +53 -0
- package/src/cli.ts +5 -4
- package/src/evaluation-builder-bin.ts +5 -0
- package/src/evaluation-builder-cli-args.ts +30 -0
- package/src/evaluation-builder.ts +3 -27
- package/src/import-supermemory.ts +3 -1
- package/dist/{index-hxyjer3x.js → index-hacpnaew.js} +3 -3
- package/dist/{index-qfqjfxaa.js → index-m9p2a4mj.js} +4 -4
- package/dist/{index-xwxy71ew.js → index-ncwzmsge.js} +5 -5
- package/dist/{index-e26mdwxz.js → index-wqx1x32f.js} +3 -3
package/src/cli-program.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
import { parseCliStartupCommand } from "./cli-startup.js";
|
|
1
2
|
import { terminalIntro } from "./cli-intro.js";
|
|
2
3
|
import {
|
|
3
4
|
advancedHelp,
|
|
4
5
|
closestMatch,
|
|
5
6
|
commandHelpText,
|
|
6
|
-
commandWordCount,
|
|
7
7
|
knownCommandWords,
|
|
8
8
|
optionNames,
|
|
9
9
|
resolveCommandId,
|
|
10
10
|
rootHelp,
|
|
11
11
|
startHelp,
|
|
12
|
-
valueOptions,
|
|
13
12
|
} from "./cli-help.js";
|
|
14
13
|
import { detectAudience, renderFailure, sentence, symbol, terminalOutput, terminalStyle, type TerminalEnvironment } from "./cli-style.js";
|
|
15
14
|
import { open, realpath, stat } from "node:fs/promises";
|
|
@@ -2280,10 +2279,6 @@ function parsePortfolioCommand(arguments_: readonly string[]): ParseResult {
|
|
|
2280
2279
|
};
|
|
2281
2280
|
}
|
|
2282
2281
|
|
|
2283
|
-
function isHelpFlag(argument: string | undefined): boolean {
|
|
2284
|
-
return argument === "--help" || argument === "-h";
|
|
2285
|
-
}
|
|
2286
|
-
|
|
2287
2282
|
/** True for the help request a delegated parser answers itself. */
|
|
2288
2283
|
function isDelegatedHelp(command: ParsedCommand): boolean {
|
|
2289
2284
|
if (command.kind === "clip") return command.arguments.length === 1 && command.arguments[0] === "help";
|
|
@@ -2293,59 +2288,10 @@ function isDelegatedHelp(command: ParsedCommand): boolean {
|
|
|
2293
2288
|
return false;
|
|
2294
2289
|
}
|
|
2295
2290
|
|
|
2296
|
-
/** Help for delegated commands comes from their own parsers. */
|
|
2297
|
-
function delegatedHelp(first: string): ParsedCommand | undefined {
|
|
2298
|
-
if (first === "clip" || first === "inspect") return { kind: "clip", arguments: ["help"] };
|
|
2299
|
-
if (first === "pdf") return { kind: "pdf", arguments: ["--help"] };
|
|
2300
|
-
if (first === "url-metadata") return { kind: "url-metadata", arguments: ["--help"] };
|
|
2301
|
-
return undefined;
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
/** `help`, `help advanced`, and `help <command...>`. */
|
|
2305
|
-
function parseHelpTopic(words: readonly string[]): ParseResult {
|
|
2306
|
-
const topic = words.filter((word) => !isHelpFlag(word) && word !== "--json");
|
|
2307
|
-
if (topic.length === 0) return { ok: true, value: { kind: "help" } };
|
|
2308
|
-
if (topic.length === 1 && topic[0] === "advanced") return { ok: true, value: { kind: "help", topic: "advanced" } };
|
|
2309
|
-
const delegated = delegatedHelp(topic[0] ?? "");
|
|
2310
|
-
if (delegated !== undefined) return { ok: true, value: delegated };
|
|
2311
|
-
const id = resolveCommandId(topic);
|
|
2312
|
-
if (id === undefined) return { ok: false, message: "unknown help topic" };
|
|
2313
|
-
return { ok: true, value: { kind: "help", topic: id } };
|
|
2314
|
-
}
|
|
2315
|
-
|
|
2316
|
-
/**
|
|
2317
|
-
* `<command> --help` anywhere a person would type it: right after the command
|
|
2318
|
-
* words, or as the last argument when it is not the value of an option.
|
|
2319
|
-
*/
|
|
2320
|
-
function embeddedHelp(arguments_: readonly string[]): ParseResult | undefined {
|
|
2321
|
-
const separator = arguments_.indexOf("--");
|
|
2322
|
-
const end = separator === -1 ? arguments_.length : separator;
|
|
2323
|
-
const index = arguments_.slice(0, end).findIndex(isHelpFlag);
|
|
2324
|
-
if (index <= 0) return undefined;
|
|
2325
|
-
const delegated = delegatedHelp(arguments_[0] ?? "");
|
|
2326
|
-
if (delegated !== undefined) {
|
|
2327
|
-
return index === 1 || index === end - 1 ? { ok: true, value: delegated } : undefined;
|
|
2328
|
-
}
|
|
2329
|
-
const id = resolveCommandId(arguments_.slice(0, index).filter((word) => !word.startsWith("-")));
|
|
2330
|
-
if (id === undefined) return undefined;
|
|
2331
|
-
const words = commandWordCount(id);
|
|
2332
|
-
const previous = arguments_[index - 1] ?? "";
|
|
2333
|
-
// `--help` is never an option value; `-h` could be one, as in `--body -h`.
|
|
2334
|
-
const flag = arguments_[index];
|
|
2335
|
-
const lastArgument = index === end - 1 && (flag === "--help" || !valueOptions(id).has(previous));
|
|
2336
|
-
if (index !== words && !lastArgument) return undefined;
|
|
2337
|
-
return { ok: true, value: { kind: "help", topic: id } };
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
2291
|
export function parseArguments(arguments_: readonly string[]): ParseResult {
|
|
2292
|
+
const startup = parseCliStartupCommand(arguments_);
|
|
2293
|
+
if (startup !== undefined) return startup;
|
|
2341
2294
|
const command = arguments_[0];
|
|
2342
|
-
if (command === undefined) return { ok: true, value: { kind: "help", topic: "start" } };
|
|
2343
|
-
if (command === "help" || isHelpFlag(command)) return parseHelpTopic(arguments_.slice(1));
|
|
2344
|
-
if (command === "--version" || command === "-V" || command === "-v" || command === "version") {
|
|
2345
|
-
return { ok: true, value: { kind: "version", json: arguments_.includes("--json") } };
|
|
2346
|
-
}
|
|
2347
|
-
const help = embeddedHelp(arguments_);
|
|
2348
|
-
if (help !== undefined) return help;
|
|
2349
2295
|
if (command === "capture" && arguments_[1] === "diff") {
|
|
2350
2296
|
return parseCaptureDiffCommand(arguments_.slice(2));
|
|
2351
2297
|
}
|