@dialecte/cli 0.8.3 → 0.9.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/dist/lookups.js CHANGED
@@ -536,6 +536,8 @@ import { basename as basename2, dirname as dirname3, isAbsolute as isAbsolute2,
536
536
 
537
537
  // src/lib/git.constants.ts
538
538
  var GIT_READ_ENVIRONMENT = { GIT_OPTIONAL_LOCKS: "0" };
539
+ var GIT_FLOOR = [2, 38];
540
+ var GIT_VERSION_PATTERN = /^git version (?<version>(?<major>\d+)\.(?<minor>\d+)\S*)/;
539
541
 
540
542
  // src/lib/worktree/worktree.constants.ts
541
543
  var MINUTE_MS = 60 * 1e3;
@@ -575,6 +577,20 @@ function gitFolderOf(root) {
575
577
  function isInWorkTree(root) {
576
578
  return tryReadGit({ root, args: ["rev-parse", "--is-inside-work-tree"] })?.trim() === "true";
577
579
  }
580
+ function gitVersionOf(params) {
581
+ const line = params.text.trim();
582
+ const groups = GIT_VERSION_PATTERN.exec(line)?.groups;
583
+ if (groups?.version === void 0) return void 0;
584
+ return { major: Number(groups.major), minor: Number(groups.minor), version: groups.version, line };
585
+ }
586
+ function belowGitFloor(params) {
587
+ const [floorMajor, floorMinor] = GIT_FLOOR;
588
+ const { major, minor } = params.version;
589
+ return major < floorMajor || major === floorMajor && minor < floorMinor;
590
+ }
591
+ function readGitVersion(params) {
592
+ return readGit({ root: params.root, args: ["--version"] });
593
+ }
578
594
 
579
595
  // src/lib/gate/step-source.ts
580
596
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
@@ -731,6 +747,7 @@ var TEMPORARY_FILE_SUFFIX_PATTERN = /^\.tmp-(\d+)-\d+$/;
731
747
  var WRITABLE_MODE = 420;
732
748
  var PERMISSION_BITS = 511;
733
749
  var REPLACED_LINK_REFUSAL = "refused to replace a symbolic link";
750
+ var GIT_ENTRY = ".git";
734
751
 
735
752
  // src/lib/store/publish.ts
736
753
  import {
@@ -815,6 +832,7 @@ var DECISION_STATES = [
815
832
  "accepted <reason>",
816
833
  "logged <where>"
817
834
  ];
835
+ var LOT_COMMAND = "lot";
818
836
  var CHOICE_OPTIONS = ["by"];
819
837
  var DECIDE_USAGE = `lot decide: expected <id|folder> <finding> <state...>; states: ${DECISION_STATES.join(", ")}`;
820
838
  var SNAPSHOT_OPTIONS = ["round", "by", "reason"];
@@ -1356,7 +1374,7 @@ function importsOf(source) {
1356
1374
  });
1357
1375
  }
1358
1376
  function typesOf(source) {
1359
- return source.statements.flatMap(function typeOf(statement) {
1377
+ return source.statements.flatMap(function typeOf2(statement) {
1360
1378
  if (!ts5.isTypeAliasDeclaration(statement) && !ts5.isInterfaceDeclaration(statement)) return [];
1361
1379
  return [
1362
1380
  { name: statement.name.text, hash: tokenHashOf({ texts: [statement.getText(source)] }).hash }
@@ -2155,12 +2173,692 @@ function packagesText(indexes) {
2155
2173
  return indexes.length ? [...new Set(indexes.map((index) => index.package))].join(", ") : "no installed package (none ships skills/<name>/references/api.json)";
2156
2174
  }
2157
2175
 
2176
+ // src/lib/command-map/renamed.constants.ts
2177
+ var RENAMED_FORMS = [
2178
+ { command: "record", verb: "review", lotVerb: "finding" },
2179
+ { command: "record", verb: "decision", lotVerb: "decide" },
2180
+ { command: "record", verb: "snapshot", lotVerb: "snapshot" },
2181
+ { command: "record", verb: "choice", lotVerb: "choice" },
2182
+ { command: "record", verb: "standard", lotVerb: "standard" },
2183
+ { command: "review", verb: "delta", lotVerb: "delta" },
2184
+ { command: "recap", lotVerb: "recap" }
2185
+ ];
2186
+
2187
+ // src/lib/review-rounds/review-round-verbs.ts
2188
+ function lotFormsOf(command) {
2189
+ return RENAMED_FORMS.filter((form) => form.command === command).map((form) => `${LOT_COMMAND} ${form.lotVerb}`).join(" | ");
2190
+ }
2191
+ function renamedEntriesOf() {
2192
+ return {
2193
+ record: { renamedTo: lotFormsOf("record") },
2194
+ review: { renamedTo: lotFormsOf("review") },
2195
+ recap: { renamedTo: lotFormsOf("recap") }
2196
+ };
2197
+ }
2198
+
2199
+ // src/lib/command-map/command-map.constants.ts
2200
+ var ZERO_CONFIG_FLAGS = {
2201
+ overrides: [
2202
+ "--namespace <Name>",
2203
+ "--entry <import>",
2204
+ "--constants-dir <dir>",
2205
+ "--out <dir>",
2206
+ "--version <v>",
2207
+ "--tsconfig <f>"
2208
+ ],
2209
+ formatting: ["--format-config <path>", "--no-format"]
2210
+ };
2211
+ var GLOBAL_HELP_NOTES = [
2212
+ "Exit codes: 0 an answer or green, 1 nothing found or a failed check, 2 usage or refused;",
2213
+ "a command says when it differs. --help or -h before -- prints that command only, runs nothing.",
2214
+ "",
2215
+ "Zero-config (coverage, bench, narrowing, audit): namespace = capitalized package name, versions",
2216
+ "from src/<version>/definition/; core is benched through a built-in test dialect. Override in the",
2217
+ 'package.json "dialecte" field or with flags:',
2218
+ ` ${ZERO_CONFIG_FLAGS.overrides.join(" ")}`,
2219
+ `Generated files are formatted with the package's oxfmt: ${ZERO_CONFIG_FLAGS.formatting.join(" | ")}.`,
2220
+ "Env: RUNS=5 dialecte bench (repetitions for the min); COVERAGE_CHILD_CAP=N (cap child edges)."
2221
+ ];
2222
+ var COMMAND_MAP = {
2223
+ api: {
2224
+ family: "Discover",
2225
+ summary: "Find a method by what you need (find), read its contract (show)",
2226
+ usage: [
2227
+ 'dialecte api find "<need>" [--source] [--package <name>] [--limit 5] [--json]',
2228
+ "dialecte api show <path> [--package <name>] [--json]",
2229
+ "dialecte api show <file>#<name> [--json]"
2230
+ ],
2231
+ notes: [
2232
+ "find - the methods whose intents, summary or name match the need, best first",
2233
+ "show - signature, summary, intents, routes, declaration, example (info.of, tx.addChild)",
2234
+ "--source - also the exported functions of the own package src/ (show src/lib/git.ts#readGit), cached in the git folder"
2235
+ ],
2236
+ exitCodes: [],
2237
+ example: 'dialecte api find "add a child element"'
2238
+ },
2239
+ members: {
2240
+ family: "Discover",
2241
+ summary: "The members of an expression of the live types (doc.query, tx.lifecycle)",
2242
+ usage: ["dialecte members <expression> [--package <name>] [--version <v>] [--json]"],
2243
+ notes: [
2244
+ "one line per member of doc.query, doc.query.reference, tx.lifecycle.extract...; in an app, of the installed dialecte (--package / --version when several)"
2245
+ ],
2246
+ exitCodes: [],
2247
+ example: "dialecte members doc.query"
2248
+ },
2249
+ schema: {
2250
+ family: "Discover",
2251
+ summary: "What an element may hold and where: parents, children, attributes",
2252
+ usage: ["dialecte schema <Tag> [--under <Parent>] [--package <name>] [--json]"],
2253
+ notes: [
2254
+ "parents, children with how often, attributes, type, documentation; an unknown tag answers the closest",
2255
+ "a tag declared several ways is printed per declaration, with the parents holding each; --under <Parent> picks the one that parent holds"
2256
+ ],
2257
+ exitCodes: [],
2258
+ example: "dialecte schema Bay"
2259
+ },
2260
+ explain: {
2261
+ family: "Discover",
2262
+ summary: "What an error or diagnostic code means, when it is raised, the usual fix",
2263
+ usage: ["dialecte explain <code | key> [--package <name>] [--json]"],
2264
+ notes: [],
2265
+ exitCodes: [],
2266
+ example: "dialecte explain CONCURRENT_TRANSACTION"
2267
+ },
2268
+ standard: {
2269
+ family: "Discover",
2270
+ summary: "Index and search the standards kept on this machine (DIALECTE_STANDARD: one folder per standard); the index lives in the cache",
2271
+ usage: [
2272
+ "dialecte standard index [--standard <id>] [--package <name>] [--rebuild] [--json]",
2273
+ 'dialecte standard find "<terms>" [--standard <id>] [--package <name>] [--about <Tag>] [--limit <n>] [--json]',
2274
+ "dialecte standard show <file id>:<from>-<to> [--json]",
2275
+ "dialecte standard eval <gold.jsonl> [--standard <id>] [--package <name>] [--angles] [--packs [--effort low|medium|high]] [--reports <asks folder>] [--json]"
2276
+ ],
2277
+ notes: [
2278
+ "the vocabulary - the tags, attributes and enumeration values of the installed dialectes (--package <name>: that one only); index, find and eval print it first",
2279
+ "index - builds (or reuses) the index of each standard folder, prints its quality per file",
2280
+ "find - the ranked slices of whole lines that hold the terms, then the clauses they refer to [linked]; --about <Tag> adds a tag of the installed dialectes",
2281
+ "show - the normalised text of a range of original lines; a file id is <standard id>/<file name without .md>",
2282
+ "eval - recall at 5 and 10 of find over a local gold file of { question, about?, expected: [{ file, quote }] } lines; the expected quotes are alternatives; --angles runs each question through the ask ladder (no fact read or written, no ask kept) and scores its merged slices; each gold line may also hold kind (fact | polarity | exception | not-in-text), answer and status",
2283
+ "eval --packs - the recall at 5 and 10 of the slices the round-1 readers are given (the ask ladder, no fact read or written, no ask kept, nothing written): reader A in its order, and the A and B slices together (A1, B1, A2, B2, a slice met twice kept once); --effort low|medium|high sets the readers (default medium)",
2284
+ "eval --reports - the agreed-wrong rate of recorded asks: the asks of an asks folder whose question equals a gold question are judged by their last answered round (a not-in-text item the readers did not agree not-in-text, an item with an answer they agreed not-in-text, a gold answer starting yes or no and the other verdict, a value its gold answer does not hold: wrong; no rule decides the rest: unjudged); rate = wrong over agreed and wrong, null (printed -) when nothing is judged; runs outside a package, writes nothing",
2285
+ "eval --json - schema 1; packs: { readerA: { recallAt5, recallAt10 }, union: { ... } } only with --packs, reports: { agreed, wrong, unjudged, rate } only with --reports",
2286
+ "the standard is never copied into a repository: its index is in $XDG_CACHE_HOME/dialecte (else ~/.cache/dialecte)",
2287
+ "the card's standard line - a lot's standard.json in state outside (its asks answered outside the documents) warns, and fails at effort high unless the record's confirmed flag is true (a person confirmed every outside answer; lot standard ... outside writes it false): the flag decides, never the note text"
2288
+ ],
2289
+ exitCodes: [
2290
+ "1 index: no indexable file \xB7 find: nothing matched \xB7 show: only blank or dropped lines \xB7 eval: no item with an expected quote \xB7 a file changed during the build",
2291
+ "2 usage \xB7 no standard configured \xB7 a root or cache inside a git work tree \xB7 colliding ids \xB7 an unknown standard, file, --package or --about tag \xB7 eval: a gold line that is not an item (kind not one of the four), --effort not low, medium or high or without --packs, --packs outside a package with a dialecte installed, a --reports folder that does not exist"
2292
+ ],
2293
+ example: 'dialecte standard find "data object" --limit 5'
2294
+ },
2295
+ facts: {
2296
+ family: "Discover",
2297
+ summary: "List, show and forget the facts the agents recorded, kept in the data folder (one ledger per person, never in a repository)",
2298
+ usage: [
2299
+ "dialecte facts list [--about <Tag>] [--state <state>|all] [--json]",
2300
+ "dialecte facts show <id> [--json]",
2301
+ "dialecte facts forget <id> --reason <text> [--json]"
2302
+ ],
2303
+ notes: [
2304
+ "the ledger is $XDG_DATA_HOME/dialecte/facts (else ~/.local/share/dialecte/facts): one file per fact (F-<n>.json) and its history (F-<n>.history.jsonl); nothing is ever deleted",
2305
+ "list - every question's current fact, whatever its state; --state valid | stale | unverifiable | unchecked | forgotten: the current facts in that state now; orphan: the fact files no question points to; all: every fact file, superseded and unreadable ones included; --about <Tag>: the facts about that tag",
2306
+ "states - valid; stale (a source moved since: a standard's files, a dialecte's definition); unverifiable (a source cannot be compared now); unchecked (from outside the documents, or a person's answer given without them); forgotten",
2307
+ "show - the question, the answer, its source and effort, its state now, its sources, how many pieces of evidence, and its history in order",
2308
+ "forget - marks the fact forgotten, its reason in the history (cut at 200 characters); the file is kept; forgetting it again writes nothing"
2309
+ ],
2310
+ exitCodes: [
2311
+ "1 show, forget: no fact of that id (the closest ids named) or a fact file that is not readable JSON",
2312
+ "2 usage \xB7 the ledger inside a git work tree (set XDG_DATA_HOME to a folder outside the repository)"
2313
+ ],
2314
+ example: "dialecte facts list --state stale"
2315
+ },
2316
+ ask: {
2317
+ family: "Discover",
2318
+ summary: "Answer a question about a dialecte: a fact recorded before, the definition, the catalogues and api indexes, else the slices of the standard for readers",
2319
+ usage: [
2320
+ 'dialecte ask "<question>" [--about [<Parent>/]<Tag>[@<attr>] | --code <code> | --method <path>] [--kind <kind>] [--decision] [--package <name>] [--effort low|medium|high] [--lot <id|folder>] [--limit <n>] [--no-facts] [--no-standard] [--person-only] [--json]',
2321
+ "dialecte ask pack <ask-id> [--out <dir>] [--outside] [--web] [--lot <id|folder>] [--json]",
2322
+ "dialecte ask verdict <ask-id> [<report.json>...] [--missing <letter>]... [--adjudicator] [--lot <id|folder>] [--json]",
2323
+ 'dialecte ask answer <ask-id> "<answer>" --by <who> [--verdict yes|no|depends|value] [--cite <file id>:<from>-<to> --quote "<quote>"] [--lot <id|folder>] [--json]'
2324
+ ],
2325
+ notes: [
2326
+ "the ladder - rung 0 a fact of the same question (reused at its effort or above), rung 1 the definition (a structural question: children, parents, required, values, default, fixed, type, variants, documentation), rung 2 the catalogues (a code) and the api indexes (a method), rung 3 the slices of the standard found from the angles of the question",
2327
+ "--about [<Parent>/]<Tag>[@<attr>], --code, --method name the subject; --kind forces the kind; --decision skips rung 1 (a choice the definition does not make)",
2328
+ "--decision reads the definition as the boundary of what is valid (boundary: <answer> (definition), never the answer): a stored schema fact is a candidate only; a standard or person fact answers inside it; one naming what the XSD rejects is cut to the boundary (a list) or takes its answer, and a ! conflict: line flags it (standard-vs-xsd, exit 0): the XSD wins, fix it and ask again",
2329
+ "an answer from rung 1 or 2 is recorded as a fact in $XDG_DATA_HOME/dialecte/facts at the ask effort; --no-facts reads and records none",
2330
+ "an ask is a folder A-<n> holding ask.json (the --json object, schema: 1, with boundary and conflict): with --lot <id|folder> in <lot folder>/asks/ (a store lot by index, name or folder, or a hand-over folder outside every repository), inside a lot worktree in its lot, else in $XDG_STATE_HOME/dialecte/asks/",
2331
+ "the events (ask.parsed, ask.rung, ask.fact, ask.state, ask.pack, ask.answer) go to the lot events.jsonl, else $XDG_STATE_HOME/dialecte/asks/events.jsonl; they hold the question length and key hash, never its text; ask.state says conflict: true|false, never what conflicts; ask.pack the round, the readers and skipped; ask.answer rung 6, the reader miss and citeRefused, never the answer or a quote",
2332
+ "the documents - the DIALECTE_STANDARD folder whose id matches the dialecte standard name; without one the ask goes to outside readers (--no-standard is refused while documents are readable)",
2333
+ "--effort - a lot ask takes the lot effort; elsewhere --effort, else medium",
2334
+ "pack - the next round of readers of an ask (the ask folder keeps request.json beside ask.json: what the ask read): rounds/round-<r>/ gets reader-<A|B|C>.md and .json (the slices with their line numbers, the report schema, a nonce each) and pack.json; A reads by rank, B by angle family, C (high) as B without the top slice, each up to 1,500 non-noise lines; a later round gives no slice a reader of the same letter had; pack again on an open round prints the same briefs; --out copies them; --outside [--web] for an ask without documents",
2335
+ "verdict - checks the reports of the open round, one report file per reader the round gave (refused ones too; else exit 2, nothing recorded) (each cite inside a slice given to its reader, each quote in its lines, each nonce used once: rounds/round-<r>/used/<nonce>) and writes rounds/round-<r>/verdict.json; reports agree on the verdict, the value and a shared line or clause: low 2 readers 1 round, medium 2 readers 2 rounds, high 3 readers 3 rounds (a verified dissent is another round); nothing verified searches again while something is left, up to 5 rounds; an agreed answer is recorded as a fact (the union of the verified cites, the shortest answer; a --decision ask held inside the boundary); outside readers answer in one round, all agreeing, recorded unchecked by source (model, web) unless the definition says otherwise",
2336
+ "the adjudicator - at high, readers that never agree or a polarity conflict go to the adjudicator: ask pack writes rounds/round-<r>/adjudicator.md and .json (the reports with their checks, the union of their cited ranges, a nonce); its report goes through the same checks with ask verdict <id> <report.json> --adjudicator: verified, the fact (rung 5); else a person",
2337
+ "answer - the person answers an ask that is not answered, or confirms one the outside readers answered (a person fact superseding the outside one, unchecked while the ask read no documents; <ask>/confirm.json marks it confirmed; a second confirmation refused) (rung 6); --verdict yes|no|depends|value keeps that verdict on the person fact (value: the answer as the value), else it says person; a person fact by <who> (unchecked: true when the ask read no documents, or under --person-only), answer.json in the ask folder; --cite (with --quote) is checked as a reader cite and recorded as a reader miss (given or not to a reader, and the round), a refused cite named (citeRefused) while the answer is still recorded; an ask of a store lot that reaches the person raises one question on the lot (its text <ask-id>: <question>, at most 500 characters, the full text in its details), and lot answer on it records the same person fact; in a hand-over folder or outside a lot the ask answer command is printed",
2338
+ "the lot note - after ask, verdict and answer, a lot's standard.json is recomputed from every ask's latest state (consulted; outside when any ask past rung 2 went outside, every ask listed, with confirmed: true and ending (all confirmed) when a person answered or confirmed each outside ask, else (all unchecked)), under <lot folder>/standard.json.lock; a lot whose asks all stopped at rungs 0-2 records nothing; a verdict run holds rounds/round-<r>/verdict.claim while it runs, a second run on that round is refused; ask verdict and ask answer hold <ask>/ask.claim, so one of them records the ask's fact, the other is refused (in progress); a retry after a crash closes the ask on the fact already recorded"
2339
+ ],
2340
+ exitCodes: [
2341
+ "1 no rung answers and a person answers next (--person-only) \xB7 pack: nothing new to give (the round skipped, the adjudicator or the person next) \xB7 verdict: the person next (no agreement, nothing found, the adjudicator refused)",
2342
+ "2 usage \xB7 an unknown --about tag or attribute (the closest named) \xB7 several dialectes without --package \xB7 two standard folders of one key \xB7 --no-standard with documents \xB7 --effort other than the lot effort \xB7 a --lot folder inside a repository \xB7 pack: an unknown or answered ask, no request.json, a file changed since the ask, --outside on a documents ask or the reverse \xB7 verdict: an answered ask, no round open, a closed round, every report of another ask or round or unreadable, --adjudicator on an ask not waiting for it, a round another verdict run holds (nothing recorded) \xB7 answer: an unknown or answered ask, no --by, --cite without --quote (nothing recorded)",
2343
+ "3 readers answer next: dialecte ask pack <id> (the slices of the documents, or --outside without them) \xB7 verdict: another round, or the adjudicator (dialecte ask pack <id> writes its brief)"
2344
+ ],
2345
+ example: 'dialecte ask "children of Bay"'
2346
+ },
2347
+ run: {
2348
+ family: "Use",
2349
+ summary: "Run a script against an in-memory project of the installed dialecte; one structured outcome",
2350
+ usage: [
2351
+ "dialecte run <script.ts> [--in <file>] [--out <file>] [--prepare] [--expect <file>]",
2352
+ "dialecte run <script.ts> [--seed <n>] [--now <iso>] [--package <name>] [--timeout <ms>] [--json]"
2353
+ ],
2354
+ notes: [
2355
+ "the script's default export gets { project, doc, documentId, dialecte, helpers, utils }; ids seeded",
2356
+ "--prepare - stages the first transaction and commits nothing",
2357
+ "--expect - checks a JSON array of { tag, where?, under?, count? }",
2358
+ "Node 22.18+: .ts scripts run through Node's built-in type stripping"
2359
+ ],
2360
+ exitCodes: ["1 the script failed or an expectation was not met"],
2361
+ example: "dialecte run add-part.ts --in assembly.xml --expect expected.json"
2362
+ },
2363
+ fixture: {
2364
+ family: "Use",
2365
+ summary: "The smallest valid XML document holding an element, built by the installed dialecte's engine",
2366
+ usage: ["dialecte fixture <Tag> [--under A/B] [--package <name>] [--out <file>] [--json]"],
2367
+ notes: [
2368
+ "the chain from the root (or --under), required children and attributes, hooks applied; the same bytes every time; an unknown tag answers the closest"
2369
+ ],
2370
+ exitCodes: [],
2371
+ example: "dialecte fixture AAA_1 --package @dialecte/core/test"
2372
+ },
2373
+ new: {
2374
+ family: "Use",
2375
+ summary: "Scaffold in the house style",
2376
+ usage: ["dialecte new verb <namespace> <query|transaction> <name> [--version <v>]"],
2377
+ notes: ["verb, types, red test (only: true), barrel export, namespace registration"],
2378
+ exitCodes: [],
2379
+ example: "dialecte new verb parts query findPart"
2380
+ },
2381
+ lot: {
2382
+ family: "Grow",
2383
+ summary: "A lot: started from a brief into the lot store, its declaration .dialecte/lot.json, and its review rounds in its lot or hand-over folder",
2384
+ usage: [
2385
+ "dialecte lot start <brief.json> [--effort low|medium|high] [--overlap-ok] [--by <who> --reason <text>] [--dry-run] [--simulate <scenario>] [--json]",
2386
+ "dialecte lot start <brief.json> --on <lot> [the options above]",
2387
+ "dialecte lot status <id> [--json]",
2388
+ "dialecte lot forecast [<id>] [--json] [--against <lot>]",
2389
+ "dialecte lot risk <id|folder> [--json]",
2390
+ "dialecte lot risk <id|folder> --effort low|medium|high [--class high|medium|light] --by <who> [--reason <text>]",
2391
+ "dialecte lot wait <id> [--timeout <seconds>] [--json]",
2392
+ 'dialecte lot answer <id> <question> "<answer>" [--by <who>] [--json]',
2393
+ "dialecte lot result <id> [--json]",
2394
+ "dialecte lot stop <id> --reason <text> [--by <who>] [--json]",
2395
+ "dialecte lot scope <id> [--drop <path>]... [--add <path>]... [--overlap-ok] --by <who> --reason <text>",
2396
+ "dialecte lot station <id> start <station> [--step <n>] [--round <n>] [--attempt <n>] [--agent <name>] [--executor host|command] [--vendor <name>] [--model <name>] [--tier <name>] [--effort <word>] [--session <id>] [--skill <name|path>]... [--skill-asked <name|path>]... [--event <id>] [--json]",
2397
+ "dialecte lot station <id> end <station> [--run <run>] [--step <n>] [--round <n>] [--attempt <n>] [--agent <name>] [--vendor <name>] [--model <name>] [--tier <name>] [--effort <word>] [--session <id>] [--skill <name|path>]... [--skill-asked <name|path>]... [--event <id>] [--tokens-in <n>] [--tokens-out <n>] [--tokens-cache-read <n>] [--tokens-cache-write <n>] [--tokens-total <n>] [--money <amount> <currency>] [--duration <seconds>] [--exit <n>] [--verdict <word>] [--suite <name>=<runs>]... [--json]",
2398
+ "dialecte lot station <id> --from <file.json> [--json]",
2399
+ "dialecte lot exempt <reason>",
2400
+ "dialecte lot accept <case> <reason> | lot accept --remove <case>",
2401
+ "dialecte lot revised <case|file|glob> <reason> | lot revised --remove <case|file|glob>",
2402
+ "dialecte lot gone <file|glob> <reason> | lot gone --remove <file|glob>",
2403
+ "dialecte lot moved <case> <case> <reason> | lot moved <file> <file|glob> <reason> | lot moved --remove <from> <to>",
2404
+ "dialecte lot mutation <off|changed|audit|gate>",
2405
+ "dialecte lot finding <id|folder> --round <n> --severity <blocking|should-fix|nit> --at <file:line> <finding>",
2406
+ "dialecte lot decide <id|folder> <finding> <open | fix-to-verify | fixed <round> [note] | accepted <reason> | logged <where>>",
2407
+ "dialecte lot snapshot <id|folder> --round <n> [--beyond-cap --by <who> --reason <text>]",
2408
+ "dialecte lot choice <id|folder> --by <who> <decision>",
2409
+ "dialecte lot standard <id|folder> consulted <note> | not-consulted <reason> | outside <note>",
2410
+ "dialecte lot delta <id|folder> --round <n> [--worktree] [--json]",
2411
+ "dialecte lot recap <id|folder>",
2412
+ "dialecte lot verify <id|folder> --by <who> --note <text>",
2413
+ "dialecte lot report <id> [--json]",
2414
+ "dialecte lot report --feature <name> [--simulated] [--json]",
2415
+ "dialecte lot export <id> <dir> [--json]",
2416
+ "dialecte lot brief <id> --from <brief.json> --by <who> --reason <text>",
2417
+ "dialecte lot pr <id> [--print] [--json]",
2418
+ "dialecte lot review <id> [--no-open] | lot review <id> --pull --round <n>",
2419
+ "dialecte lot approve <id> --by <who> [--reason <text>]",
2420
+ "dialecte lot design <id> [--from <file> | --from-plan | --approve --by <who> [--reason <text>] | --waive --by <who> --reason <text>] [--json]",
2421
+ "dialecte lot land <id>",
2422
+ "dialecte lot close <hand-over name|lot id|index>... [--json]",
2423
+ "dialecte lot prune [<id>...] [--feature <name>] [--all] [--yes] [--json]"
2424
+ ],
2425
+ notes: [
2426
+ "start - checks the brief (every refusal at once, exit 2), claims the next index, publishes the lot folder in <git common folder>/dialecte-lots/, makes the numbered worktree at the base commit with its .dialecte/lot link; --dry-run checks (the store list included), names the lot and the start to run next, writing nothing; exit 1 when the worktree cannot be made (the lot failed, nothing removed, next: lot stop); a link that cannot be made leaves the lot working with a note; every --json exit is JSON, a usage error { error, usage, next: null } included",
2427
+ "start - --on <lot> starts the lot on another open lot of the same repository (a stack): its branch is cut at that lot's branch tip, its stack.json records the parent only (where it forks is read from git when it lands), and the parent's scope is its base, never an overlap, at the start and at lot scope --add (every other open lot's still is); a parent that is unknown, damaged, not working or ready, of another repository or without its branch is refused before anything is written, before any other fault of the brief; lot status shows a stack line, on <parent> (#<pull request>, <state>), the parent read through the one lot reader: merged once its landing is proven (its landed fact, git or the host), else its pull request as the host holds it (open, draft, queued, closed, or the host cannot say: <why>), the hand-over card on <parent> (#<pull request>) from files only; on <parent> (no pull request yet) without one",
2428
+ "start - a scope meeting another open lot goes ahead when that lot's work reads (its forecast against main, run and never written: a new lot has no work, so no conflict can exist), printed shares <met> with <lot> (forecast clean); still refused: a damaged lot or one whose scope cannot be read, a met lock file (exclusive: a lock file is never shared), a forecast that cannot run (forecast unknown: <reason>); after the start the new lot's own forecast is recorded (trigger start); the re-check after the start refuses only what still refuses (a lot that published meanwhile but has no worktree on disk yet has no work: the start goes on)",
2429
+ "start - --overlap-ok accepts an overlap the start refuses, for an overlap that names its paths (a lot whose scope cannot be read stays refused; a damaged other lot whose scope reads is accepted, its damage recorded beside the go-ahead); it takes --by <who> --reason <text>, the same go-ahead as an effort below the class; each accepted overlap is a line of the lot folder's overlaps.jsonl (the other lot, the met pairs, who and why), printed by the start and its dry run (! overlaps <lot>: ...) and shown on the card's scope line as a warning; on an overlap the forecast cleared it is recorded all the same, printed --overlap-ok not needed: the forecast cleared <lot>; the re-check after the start refuses a held lot the go-ahead did not name",
2430
+ "start - the effort: the risk class of the brief's scope (high when an entry reaches the package's dialecte.risk.high list) sets the default (high, medium or low); on a terminal, without --json or --dry-run, the effort is asked with that default; an effort below the class (from --effort, the brief or the answer) is refused (exit 2, nothing written) without --by <who> --reason <text>, which are recorded on an effort line in risk.jsonl with the class's derived line, the start printing ! effort <e> below risk class <c> (by <who>: <reason>)",
2431
+ "--simulate - start a simulated lot that plays one of the scenarios (ready, question, person, two-questions, limit, failure, slow) under wait: no worktree, no branch, no registry entry; it never blocks a real lot",
2432
+ "brief - a working or ready real lot takes a new brief whose only changes are its public text (the summary, the issue, step titles and behaviours); any other change is refused naming the field, nothing written; the new brief passes the start's field and public-text checks; it replaces the stored brief and a brief transition records the sha256 of the old and new brief, --by and --reason, the state and position kept; the same brief again answers already, nothing written; a simulated lot is refused; brief.json edited any other way reads as damage",
2433
+ "pr - renders the lot's pull request from its records through the repository's .github/pull_request_template.md: the title is the brief's first commit message, the body its summary and other commit messages, step titles and behaviours, the changelog fragments the lot adds, tests.json (a part of another tree reads stale), review.jsonl (findings and how each closed, the verdicts by reviewer kind, never a name; a row value its writer never writes refused), the risk class and effort, the overlaps it accepted (the other lot by its index, and why), the issue it closes, and the author's checklist ticked from the records; a missing record reads not recorded; the record text is checked first (a reference, a forbidden word, a plan entry id, a link or a path outside the tree refused, naming the word and the record); the open pull request (landing.json's, else the branch's newest) is edited only when its title or body reads otherwise, a person's part after the kept marker kept (a body without that heading holding a person's text refused, never dropped); a damaged lot refused; --print prints and sends nothing; no pull request yet prints the text and names lot land; --json { title, body, pullRequest, head, sent }",
2434
+ "review - the private half of the lot's review, read-only (nothing written): the lot's state and branch, its pull request (landing.json's) with the head it is at, the head the lot landed and the worktree's HEAD, its checks, the brief's goal and steps (title, spec, behaviours), tests.json's tdd counts and gate run, decisions.md, every finding of the ledger with its text and state, the standard line, and what lot approve would refuse (or the approve command when it would approve); then opens the pull request's changed files in the browser (--no-open names the page only; an opener that fails is named, never an exit); a lot without a landing prints its private half and names lot land <id>, the host never asked",
2435
+ "review --pull - the pull request's line comments come back as findings of round <n> in the lot's findings ledger: a thread's first comment only (replies discuss it), each once (pulled-comments.jsonl records the comment and its finding; a second pull answers already), its severity from a leading blocking:, should-fix: or nit: (dropped from the text, kept when it is all the comment says), else should-fix, at its path:line (the path alone for a comment on the file), its lines joined into one; review.jsonl written again; private points stay off the pull request: lot finding records them",
2436
+ "approve - a person's approval of the lot's pull request: refused (exit 1, nothing recorded, nothing queued) unless the lot is at work, the pull request landing.json names is open at the head the lot landed and the worktree is at that head too (an unpushed commit refuses), its checks ran on that head and are green (a check run again counts by its newest run; a failing or pending check, or none yet, refuses) and no finding but a nit is open (open, or a fix still to verify), and its text renders over the live body; then appends { schema, at, by, reason?, number, head } to the lot folder's approvals.jsonl, which review.jsonl shows as a person's approve verdict with that head (a pull request text rendered on another head, after a later commit or a rebase, leaves it out; the body names it by kind only, never the name; the orchestrator in any casing is recorded as orchestrator), renders the pull request's text again from the records, makes a draft ready and queues it (gh pr merge --auto; a lot started with --on whose pull request still merges into its parent's branch queues as a stack up to it, gh stack merge, and only on a host with stacks once the parent's pull request, read by the parent's branch, is queued (auto-merge on or in the merge queue), refused otherwise before anything is recorded: approve the parent first, or land it again once the parent merged); the only verb that queues, lot land never does; a queue the host refuses keeps the approval (exit 1) and the same approval run again answers already approved, writing nothing, and queues; --by orchestrator (in any case) approves the cli's own lots only (the package named @dialecte/cli), every other package waits for a person (exit 2); a forbidden word in --by or --reason, or a --by holding what a public record never holds, refused (exit 2) before the host is asked; a lot without a landing names lot land <id>",
2437
+ "design - a lot's design (design before code): --from <file> records it by the sha256 of its bytes, appending { schema, at, kind: recorded, file, hash, from } to the lot folder's design.jsonl and keeping its copy as design/<hash>.md (the copy rules once the source is gone); a file missing, empty, not UTF-8 or under a scratch root, the system's temporary folder, /tmp or /private/tmp (wiped there) is refused (exit 2), nothing written, and a file outside every git work tree is recorded (plans live there); without a worktree the lot is read at the base recorded at its start, a ! line saying so; --from-plan records the spec of the plan entry the lot carries out, refused when another lot or fix entry of its block names the same spec (write this lot's own design) or the lot carries out no entry with a spec; --approve --by <who> [--reason <text>] appends an approval of the last recorded hash with the need it was given against, refused when nothing is recorded or the source exists with other bytes (record it again); --waive --by <who> --reason <text> appends a waiver with the current need, refused on a lot that needs no design; both refused from the lot's own worktree or its review throwaway (approve from the main checkout), and on a --by or --reason holding a forbidden word or a --by holding what a public record never holds (exit 2); the orchestrator in any casing is recorded as orchestrator; a lot no longer at work is refused (exit 1); without an option it prints design <state>[ by <kind>][ \xB7 <reasons>] and the next command, --json { required, reasons, state, by, uncovered } (by the kind, never a name)",
2438
+ "design - the need, computed by every reader and never stored: required when a scope entry (or a path) lies in a dialecte.risk.high area or is broader than one, or the lot carries out a plan entry of kind lot; an approval or a waiver holds only for the need it was given against (a reason of a new kind or glob reads unapproved or missing again); a recorded design gates the lot whatever its need; states approved, waived, unapproved (shown not approved), stale (shown stale since its approval: the source edited after its approval), missing, not-required (shown not required); lot start and its dry run print design required (<reasons>) or design not required, lot forecast and lot status the state line, the hand-over card a design line (passed or a warning, never failed), review.jsonl a design row and the pull request body Design: <state> by <kind>",
2439
+ "design - the gate: while a lot's required design is missing, unapproved or stale, tdd red in its own worktree refuses (exit 2, nothing run), gate --hook's design step fails a commit of the lot's branch, from any worktree, holding a production path (first, whatever dialecte.gate.hook declares; a refused design recorded in the lot's events; a commit of tests or docs only passes; a first or merge commit and a review throwaway on <lot branch>-round-<n> skip it; a branch no lot names gives no line), lot land refuses after its rebase (nothing pushed), handover write refuses a store lot (nothing written), lot approve names design <state> among its reasons and the card's design line, read at the card's worktree, fails (handover run refuses); each reads the shared areas of the lot base its run resolved, through git, over the scope, the change's paths since that base and the staged or landed ones; a refusing path without the lot's worktree refuses; lot land records the base's shared areas again after its rebase",
2440
+ "land - a lot started with --on lands as a stack: its pull request is based on the parent's branch, its body's depends-on part names the parent's pull request (a parent without one is refused: land it first); the host's stacks are probed once (gh stack): with them, the pull request is linked on the parent's (gh stack link); without, a note says why; it is never queued (lot approve queues it); before each landing it is rebased onto the parent branch's newest tip (the local branch or origin's) when it does not hold it, from its fork point (git merge-base --fork-point: only its own commits move, whatever the parent's amend or rebase); once the parent merged (its landing state: a merge, a squash read offline, or its pull request merged; never the registry's committed alone, which a hand-over run writes before anything reaches the base), the parent's landed fact is recorded and the child is rebased with git rebase --onto origin/<base> <fork point>, only its own commits moved, and its pull request retargeted to the base when the host did not; when the host already rewrote its branch on origin (a native stack), it follows that rewrite (local commits beyond its last push rebased onto it, that head the lease); a conflict names its files, the rebase undone, nothing pushed, exit 2",
2441
+ "land - the lot lands through its pull request: its committed HEAD (uncommitted files stay in the worktree, named), rebased onto origin/<base> when behind (a conflict undone and named, nothing pushed; with uncommitted tracked changes it is pushed as committed, the rebase left for a clean worktree), pushed with a lease, its title and body rendered from the lot's records through the repository's .github/pull_request_template.md on the rebased head before the push (as lot pr renders them; records that do not render, or a base branch origin does not hold, push nothing), its pull request opened with them as a draft or reused (edited when its title or body reads otherwise, a person's part after the kept marker kept), never queued: CI runs on every push and lot approve, a person's step, queues it; a reused pull request queued or ready whose head to push no person approved (approvals.jsonl) is taken back out of the queue before the push (auto-merge off, gh pr merge --disable-auto; a draft again, gh pr ready --undo), since an approval is for one head: a rebase that only moves the sha takes it out too, and every landing checks, so one stopped after its push heals on the next (a refusal there pushes nothing); --draft, from when lot land queued, is refused (exit 2) naming the change; the landing (number, url, branch, pushed tip) recorded in <lot folder>/landing.json; a lot already merged (its pull request merged, or its tip or its work in origin/<base>: a squash read offline) is committed: its landed fact written in <lot folder>/landed.json, its hand-over entry committed, the commits made since named (they land in a new lot), the close line printed, nothing pushed; a branch with no commit beyond origin's base is refused before any push; the committed HEAD is forecast against origin/<base> just fetched (git merge-tree, before any entry, rebase or push): a conflict refuses naming its files and ranges, a forecast that cannot run refuses (fails closed), a lot on an open parent is not compared; the lot's forecast against every other open lot is recorded (trigger land) and each pair it does not clear printed (! <lot>: <why>), for information only; the pushed head is kept in landing.json at once, so a pull request the host refused to open does not make the next push one outside lot land; the host is GitHub through gh, which never prompts",
2442
+ "status - the state derived from the lot records (working, input-required, ready, committed, canceled, failed), the worktree and link checks, and the exact next command (and an also: line); a working real lot adds a station line (station <what> \xB7 round <r>/<cap> \xB7 effort <level>), the next station walked from its station events and checks (step events, else the worktree's tdd ledger and gate records), its next is that station's command and also keeps the manual line, which lot start prints as its next too; the manual line depends on the repository's landing flow: lot land <name> in a CI-first repository, handover write in any other; --json adds station and rounds (review, cap, beyondCap, independent) and effort { level, source, riskClass, below } (source risk-line for an effort recorded by lot risk; an effort below its risk class adds a ! effort <e> below risk class <c> line, ending (by <who>: <reason>) or (no go-ahead recorded)); --json adds forecast { main, pairs }: the newest main line of forecast.jsonl and, per other open lot, the newer of its own line against that lot and that lot's line against it (files only); a lot whose records do not hold reads damaged with its reason and next: lot stop (exit 6); a lot git reads merged (its tip or its work in origin/<base>, a squash included) shows committed, nothing written; writes nothing; exit 2 for an unknown or ambiguous id",
2443
+ "forecast - the conflict forecast of a lot's work (its worktree's HEAD plus its uncommitted work, as one snapshot commit made on a copy of its index with a fixed identity and date; the worktree's index, refs and files never written, ignored files left out) against main (origin/<base> as last fetched, never fetched here) and against every other open lot of its store, each by git merge-tree --write-tree, without a checkout: clean, conflict (each path with its kind, content with the line ranges between the markers), exclusive (every conflicted path a lock file) or unknown with its reason (git older than 2.38, a damaged lot, worktree of <lot> missing, <ref> does not resolve, snapshot of <lot> failed, merge-tree failed, forecast of <lot> over 20 s: each git step is limited to 20 seconds); each line also lists the files both sides changed (shares); a path that conflicts against main for either lot is shown once, on the main line; the verdict is the worst line (unknown > conflict > exclusive > clean); default lot: the one whose worktree holds the current folder; --against <lot> compares with main and that lot only; appends the run to the lot folder's forecast.jsonl (one line per comparison, one write, each line at most 4,096 bytes: 10 shared paths, 10 conflict paths, 3 ranges per path, the rest counted in moreShared and more) and a forecast event (its trigger: start, scope, gate, forecast or land, the verbs that record a run); a pair whose lots both change a lock file reads exclusive even when it merges clean; a gate --fast or --full run in a lot's worktree forecasts the lot as its last step and prints forecast: <verdict> with one ! <against>: <why> line per comparison it does not clear (a warning only: the gate's verdict and exit never change); the card shows a conflicts line on a conflict or an unknown, a pair seen from either lot (the newer line wins), and its scope line names each open lot it shares entries with (forecast <verdict>, <age>); --json { lot, verdict, lines }; exit 0 clean, 1 a conflict or an exclusive path (or the run could not be written), 3 unknown, 2 usage, an unknown id, a damaged, closed or simulated lot, or --against the lot itself or a lot of another store; a clean forecast does not promise a semantic merge, three lots landing together, or work not written yet",
2444
+ "risk - reads the lot folder's (or hand-over folder's) risk.jsonl and the worktree's diff against the lot's base, writing nothing: the risk class derived now with its reasons (high: a changed file in the package's dialecte.risk.high list, the base's and the worktree's together, an added destructive call or git argument on a line that is not a comment alone, a runtime package (one with an exports map) whose API index changed or whose export source changed against the base without its index; light: docs, a version bump, or at most 40 changed lines in at most 3 files; medium otherwise; a declared reason reads <file>: declared [<glob>]), the effort recorded, the cap of review rounds, a ! line when the effort is below the class, ending (by <who>: <reason>) or (no go-ahead recorded); a derivation that cannot run (no commit to compare to) falls back to the last derived line, else class unknown, and ends with ! risk class not derived: <reason>, exit 0; --json the same as one object, under a versioned JSON schema (lot-risk.schema.json, version 1); exit 2 for usage, an unknown id or a damaged store lot (lot risk: <name> damaged: <reason>)",
2445
+ "risk --effort - appends one effort line { schema, kind: effort, at, effort, class?, by, reason? } to risk.jsonl (the last line wins); the same effort, class and reason as the last line answers already, nothing written; an effort below the class needs --reason; a derivation that cannot run compares against the last derived line, or nothing, and records; --by is required; --json is refused here; refused (exit 2, nothing written) for usage, below without --reason, a forbidden word, a damaged store lot, or a lot that is committed, canceled or failed; exit 1 when the line cannot be written",
2446
+ "wait - returns the status as soon as the lot needs someone (exit 0 ready or committed, 1 failed or canceled, 3 input-required, 4 a limit) or --timeout is reached (5); a damaged lot at once (6); a real lot is read every second and nothing written, a simulated lot is played to its next blocking point, and answered at once when nothing is left to play (5 while it works)",
2447
+ "answer - records the answer to an open question once (the same answer again: already); a person question needs --by <who>; a damaged lot takes none (exit 2); runs the onAnswered hooks; next: lot wait",
2448
+ "result - never blocks, writes nothing: a ready or committed lot gives its hand-over (card, show and run lines), worktree, branch and answered questions; failed or canceled the last reason (exit 1); input-required the open questions (3); working exit 5; damaged exit 6",
2449
+ "stop - ends the lot: refused once committed; a pending hand-over is abandoned first (refused while its run is in progress), then a canceled transition with the reason and --by (caller without it); already canceled exits 0 writing nothing; moves no worktree and deletes nothing; a damaged lot has its folder moved to <git common folder>/dialecte-lots-aside/ with a stopped.json (refused while a live run marker holds it), its index kept claimed",
2450
+ "scope - changes a started lot's scope on the record, its brief left as published; --by and --reason are required on every call; --drop removes scope entries (an entry, or a folder and the entries inside it), --add widens the scope (a path inside a held entry is recorded as its own entry; only an equal entry answers already holds, nothing written, exit 0); --drop and --add may come in one call to narrow a folder to files: one append, the drop line first; a drop is refused for a path that is no entry or lies inside a wider one, a worktree that cannot be read, a drop leaving the lot no scope, or a file the lot's worktree changed inside a dropped entry that no entry left covers (an equal entry, a literal folder holding it, or a glob matching it; the call's adds count); an add is refused when a path is no valid scope entry, or when it meets another open lot's scope and that lot still holds it: the lot's work is forecast against it (trigger scope, recorded only once the add stands) and a clean pair adds with no overlap record; a forecast conflict (its files and ranges), a met lock file, a forecast that cannot run, or a damaged or unreadable lot refuse, unless --overlap-ok accepts an overlap that names its paths (a damaged lot whose scope reads too, its damage recorded) (recorded in overlaps.jsonl before the add with the other lot, the met pairs, --by and --reason, undone with a taken-back add; a lot whose scope cannot be read stays refused; --overlap-ok without --add is refused); a call whose lines would pass the line limit is refused; an add a lot started or widened meanwhile meets is taken back by an undo line, the entries a drop of the same call removed put back (exit 2), a take-back that would pass the line limit refusing the call first (exit 2), a take-back that cannot be written exiting 1 naming the paths and that lot; each change is one line of scope-changes.jsonl ({ schema, at, op, paths, by?, reason? }) and a scope.changed event; the effective scope (the brief's with the changes) is what the overlap guard, lot status and the card read; a damaged, simulated, committed, canceled or failed lot, a forbidden word and a change line that does not read are refused (exit 2), nothing written; a line that cannot be written exits 1",
2451
+ "station - appends one station event (by: host) to the lot's events.jsonl, never rewriting a line: start answers its run and the end command; end pairs with --run, else with the one open start of its station, step, round and attempt (several: refused), else repeats the last such end carrying a cost field with the same fields (already, nothing written), else is recorded alone (started: null); --event <id> again answers the first event (already) or is refused when its fields differ; start is refused on a committed, canceled or failed lot, end is accepted in every state; a simulated lot writes simulated: true; text fields refuse control, line-break and direction characters, vendor, model, tier, effort and session at most 80 characters, step, round and attempt 1-999, tokens, runs and duration non-negative, at most 50 skills (hash: sha256 of the path or of the synced <folder>/<name>/SKILL.md, else null), a verdict of approve, back, fix-then-repass, fixed, disagreed, answered, failed, limit; a line over 4,096 bytes is refused; --from takes the same fields plus phase (start|end) as one JSON object, unknown keys refused, every fault at once; --json { recorded: new|already, run, next }",
2452
+ "--by - one line, not empty, checked before the lot is read (answer and stop)",
2453
+ "<id> - an index (171 = 0171), a full name, a lot folder or .dialecte/lot; a write verb needs an index unique across every store of the store list, a word naming an existing folder is that folder",
2454
+ "exempt|accept|revised|gone|moved|mutation - write .dialecte/lot.json at the package root (tab JSON), keeping the rest",
2455
+ "moved - a case of the lot moved by a split or a rename of its file or describe after its red (its own title is part of its test call): two cases, or a file (never a glob) and the file or glob its cases moved to under the same names, several files into one each with its entry; tdd red carries the red (flag moved) when the test call and the test code it reads are as that red froze them and it does not pass on the base production, else refuses",
2456
+ "accept - a case is <file>::<name>",
2457
+ "revised - a file or a glob covers every case of its files",
2458
+ "--remove - drops the accept, revised, gone or moved entry written exactly so (a list left empty leaves the file); an entry its list does not hold is refused, naming the closest ones, nothing written",
2459
+ "mutation - absent: changed when the diff touches the declared scope, off otherwise; gate = changed that the hand-over waits for",
2460
+ "finding - appends R<n>-<k> open to <folder>/findings-ledger.md (made when absent)",
2461
+ "decide - rewrites that finding's state cell, every other byte kept",
2462
+ "snapshot - copies what git status lists to round-<n>/, the deletions to round-<n>.deleted, HEAD to round-<n>.base, { schema, at, stateHash } to round-<n>.state; the folder is a lot folder or stays outside every repository; -- ends the options; the risk class is derived again from the diff first and appended to risk.jsonl as a derived line only when the snapshot goes ahead, a refused snapshot writing nothing (a derivation that cannot run prints ! risk class not derived: <reason> and appends nothing); the cap of review rounds is the rounds of the higher of the effort's class and the class derived now (else the last derived line's) (low or light 1, medium 2, high 3; the effort is the last line of lot risk --effort, else the lot's; a class above the effort prints ! risk class now <class> (<reason>): cap <cap>); with no effort recorded the cap is 1 and a later round is refused (exit 2) naming dialecte lot risk <folder> --effort low|medium|high --by <who>; a round above the cap of an effort is refused (exit 2), naming what set the cap ((effort <e>), or (effort <e>, risk class <c>) when a class raised it), unless --beyond-cap --by <who> --reason <text> gives the go-ahead, written to decisions.md as round <n> beyond the cap of <cap>: <reason> before the snapshot (once: a retry finds it); --beyond-cap within the cap, --by or --reason without it, and --by or --reason holding a forbidden word are refused (exit 2), nothing written",
2463
+ "choice - appends | decision | who | yyyy-mm-dd | to <folder>/decisions.md (made when absent)",
2464
+ "standard - writes <folder>/standard.json (state, note, time), read by the card's standard line; outside (the lot's asks answered outside the documents, written by ask itself) warns, and fails at effort high unless the record's confirmed flag is true (written by ask once a person confirmed every outside answer; by hand false): the flag decides, never the note text",
2465
+ "delta - per file, the diff from round-<n-1>/ to the worktree now; --worktree adds a throwaway worktree holding round n-1 and prints its removal command",
2466
+ "recap - the <details> part of a pull request from the hand-over's records only; writes nothing",
2467
+ "verify - run inside the lot's worktree: appends { schema, at, by, note, state } to <folder>/verify.jsonl in one write, state the worktree's state hash; a change of the tree after the last round-<n>/ snapshot is a late fix: the card warns and handover run refuses it (exit 2) until a verify covers the current state (one later change needs a new verify); a snapshot with no round-<n>.state (an older cli) is not checked; no snapshot yet (nothing is late), --by or --note missing, blank or not one line, or holding a forbidden word are refused (exit 2), nothing written",
2468
+ "report - reads files only (no git, no process, nothing written): the lot's stations, tokens, money, time, suites per station by time, heavy steps, folders and review rounds from its events.jsonl, transitions, ledger and cards.log; a number nobody reported is unknown, never 0, and a step family whose runs may be unrecorded reads unknown with the reason; --feature lists every lot of that feature in every store (simulated ones counted apart, listed by --simulated; a lot whose folder is gone is read from its cards.log line); next: the lot's own next command",
2469
+ "export - copies a lot folder to <dir>/<full name>/ without asks/ (links kept as links, those pointing outside it named), adding the lot's cards.log lines and registry entry; refused for a <dir> inside a git work tree and for an existing <dir>/<full name>; every copied file compared by size and sha256 (events.jsonl as a prefix) before the rename, one more copy on a difference; the source is never written",
2470
+ "prune - removes what a committed or canceled lot leaves behind, each item on its own proof: the lots named by id, else the lots of --feature in every store of the list, else every lot of every store (--all), else every lot of the store of the folder it runs from; base branches fetched first; per lot its line (state, landing) and one line per item - its worktree (the same proof as lot close: kept with why), its review throwaways (recorded by a step's throwaway-add, or cut by hand at a commit of the lot with no commit of their own: they go when every changed path is held by a commit, else kept naming the path held nowhere), its branch and its throwaways' branches; an open lot's items are kept, reason lot <name> <state>; a branch is kept while it is the base, the branch the main checkout is on, an open lot's branch, the stack parent of an open lot, a pending hand-over's or a stash's, while deleting it would lose a commit (a canceled lot's names its commits and the command to delete it anyway), and goes after its worktree when one checks it out; a lot whose worktree is gone and whose landing is not proven is listed stale with the command to stop it; without --yes the plan only; --yes acts in order (worktrees, throwaways, branches), each proof read again at the move: a throwaway proved again after its move, a branch deleted at its proved tip only (git update-ref -d), a branch still parked in the trash listed waiting for the trash; a throwaway's --force removal starts only after its second proof, so a file written into it in that moment goes with it; a deleted branch is restorable with git branch <branch> <tip> (its removing line in cards.log holds the tip) until git's garbage collection, its upstream config is not restored; worktrees git refused to delete from the trash for more than ten minutes are listed with their git status and the forced removal, a throwaway its second proof left in the trash with why and the command that moves it back; a git read an item's decision rests on that fails keeps the item (could not read <what>: <git's error>), never reads as empty; ids, --feature and --all exclude each other; exit 1 when an item meant to go was kept (one another run removed since the plan is no failure), 2 for a usage error or an id that names no lot or more than one",
2471
+ "close - closes a lot or a hand-over: a hand-over of the registry (by name or index), or a lot (its id, name or index), with no registry entry needed; first the landing of every lot the arguments reach (the lot named, the lot an entry registers, the open lots naming an entry's worktree and branch) is read, with the host asked for every lot it reads (one never pushed by lot land, its branch deleted on origin after the merge, included): merged (its tip on the base, its pull request merged - the one landing.json names, else the newest of its branch whose head the branch reached, a pull request opened by hand included - or its work contained in origin/<base>, a squash read offline) writes its landed fact in <lot folder>/landed.json, commits its pending entry (a lot with none is closed as the lot itself: no registry entry is made) and every outcome reaching it carries the line landed on <base> at <commit>: <how>, landed in --json; a lot named by its id that is open is kept with lot <name> <state>: why (its work not in the base, its pull request closed, the commits it holds since part of it landed, or the host's silence); a lot whose branch and worktree are gone reads its landing from the latest card line of its own or of a hand-over on its branch whose entry names its worktree, written since the lot was made; a canceled lot closes, its landing never read; then for each committed or abandoned hand-over, and each committed or canceled lot named by its id: its final record first, the card line in the repository's cards.log (a catch-up one when none exists, for every hand-over of the worktree, read back), then a removing line, then its worktree moved to .worktrees/_trash/ and removed in the background by git worktree remove without --force (git refuses one written into since the check: it stays in .worktrees/_trash/), its node_modules parked in .worktrees/_pool-<repository>-<n>, its caches to their own _trash/ entries, then a removed line (trashed or kept); a commit dropped from its branch (reset or rebased away), held by the branch reflog alone, is named under the closed line: git expires it with that reflog (gc.reflogExpireUnreachable), as it would have with the worktree's; a landed or canceled lot's own .dialecte/lot.json (its .dialecte/lot link naming the lot's folder) archived in that folder first, as lot.json, or lot.landed.json beside a lot.json holding other bytes, never over one, kept when both hold other bytes; kept first when an open lot names it (reason lot <name> <state>), then with why when it is the main checkout, on another branch than the hand-over's, locked, another hand-over of the same worktree is neither committed nor abandoned, a link from outside it points into it, dirty, a landed lot holds commits made since its landing (<n> commit(s) made since its landing: <commits>), its removal would lose a commit (<n> commit(s) its removal would lose: <commits>: a commit only its HEAD or HEAD reflog reaches, that no surviving branch, branch reflog, tag, landed tip or remote-tracking ref holds, nor the same change at the same place (a commit of theirs with the same diff, its hunk line numbers included) - a commit made on a detached HEAD), it holds ignored files its removal would delete that nothing else holds (rebuilt folders, dialecte.rebuiltIgnored folders, the .dialecte/lot link, an empty or archived .dialecte/lot.json and copies byte-equal to the main checkout's go), a process or a mutation run works there, lot close itself runs from inside it, or the processes are not known, or the final record cannot be kept or the lot's commit is not known; the branch never touched; a hand-over already closed, or a lot whose worktree a recorded removal moved, answers already closed, exit 0, nothing moved (a lot whose worktree is gone with no such removal: nothing to close), its lot's landed fact still recorded when the host proves the merge (its landed line beside already closed); exit 1 when one is kept, 2 when a name or index is neither a hand-over nor a lot (the others are still closed)"
2472
+ ],
2473
+ exitCodes: [
2474
+ "1 risk --effort: the line could not be written",
2475
+ "2 risk: usage; unknown id; a damaged store lot; --effort below the class without --reason, no --by, a forbidden word, a lot that is committed, canceled or failed",
2476
+ "2 start: an effort below the risk class without --by and --reason",
2477
+ "1 station: the event could not be written",
2478
+ "2 station: usage; refused (a field, the lot state, open starts, --event with other fields, over 4,096 bytes); --run naming no start",
2479
+ "1 report: --feature names no lot",
2480
+ "2 report: usage; unknown or ambiguous id",
2481
+ "1 export: the check failed twice, nothing left",
2482
+ "2 export: usage; refused",
2483
+ "3 wait, result: input-required",
2484
+ "4 wait: an agent failed or hit a limit, run again",
2485
+ "5 wait --timeout, result: still working",
2486
+ "6 status, wait, result: the lot is damaged: a person must look"
2487
+ ],
2488
+ example: 'dialecte lot finding ../handover --round 1 --severity nit --at src/a.ts:3 "a finding"'
2489
+ },
2490
+ inbox: {
2491
+ family: "Grow",
2492
+ summary: "What waits on someone across every lot store: health findings, questions for a person, questions for a caller, ready hand-overs, failed lots",
2493
+ usage: ["dialecte inbox [--repository <name>] [--simulated] [--json]"],
2494
+ notes: [
2495
+ "reads every store of the store list and the store of the current folder, and the cli scratch folders of the temporary folder, files only: first one line per health finding, red first (duplicate work, landing time and slow worktree adds of the last 24 hours; stalled runs, idle worktrees and leaked scratch folders as they are now), <\u2717|!> health <repository>[ <lot>] <rule>: <finding> next: <command>; a red finding waits, an amber one is listed only",
2496
+ "then one line per waiting lot (one per open question), grouped person, caller, ready, failed and by index, each with its exact next command; then working <n> \xB7 simulated <m>; a lot whose records do not read is a damaged line",
2497
+ "--repository - the lots and the health findings of the repository folder of that name only (the basename, exactly), the counts too; the health of no other repository and no scratch folder is read",
2498
+ "--simulated - the simulated lots that wait are listed in their groups (they are only counted without it)",
2499
+ "--json - { waiting: the status of each waiting lot, working, simulated, damaged, skipped: the stores not read (only when one is), health: the findings (empty when none) }"
2500
+ ],
2501
+ exitCodes: ["1 no lot waits, no lot is damaged and no health finding is red"],
2502
+ example: "dialecte inbox --repository scl"
2503
+ },
2504
+ health: {
2505
+ family: "Grow",
2506
+ summary: "What went wrong lately across every lot store: duplicate work, slow landings, stalled runs, idle worktrees and leaked scratch folders",
2507
+ usage: ["dialecte health [--since <date|duration>] [--repository <name>] [--json]"],
2508
+ notes: [
2509
+ "reads every store of the store list and the store of the current folder (each once), and the cli scratch folders of the temporary folder, files only: a header with the red and amber counts, then one block per finding (red first, newest first, idle worktrees and leaked scratch after the runs) with its detail lines and its next command; with no finding, one ok line naming the rules",
2510
+ "--since - the window of the duplicate work, landing time and worktree add rules: <n>h, <n>d, a date (its midnight UTC) or a date and time with its zone; default 7d",
2511
+ "--repository - the findings of the repository folder of that name only (the basename, exactly); the scratch folders, which belong to no repository, are left out",
2512
+ "--json - { since, findings, counts: { red, amber } }"
2513
+ ],
2514
+ exitCodes: ["1 a red finding"],
2515
+ example: "dialecte health --since 24h"
2516
+ },
2517
+ plan: {
2518
+ family: "Plan",
2519
+ summary: "What can start now in a plan's lot block, whether the block is valid, a mark on an entry",
2520
+ usage: [
2521
+ "dialecte plan next <plan.md> [--json] [--all]",
2522
+ "dialecte plan check <plan.md> [--json]",
2523
+ "dialecte plan mark <plan.md> <id> done --by <who> [--reason <text>]",
2524
+ "dialecte plan mark <plan.md> <id> done --landed <sha> --by <who> --reason <text>",
2525
+ "dialecte plan mark <plan.md> <id> superseded --by <who> --reason <text> [--replaced-by <id>]..."
2526
+ ],
2527
+ notes: [
2528
+ "the block - one fenced ```json dialecte-lots block in the plan, or the file <plan without .md>.lots.json beside it (both or neither: refused); each entry's id, kind (lot, fix, spec, person), dependsOn, scope per repository, heavy steps, brief and match (branch, handover, feature); unknown keys refused, every fault at once",
2529
+ "next - proposes only, starts and writes nothing: the state of each entry read from the stores, the hand-over registries and the worktrees of its repositories (files only, no git process: a lot reads committed by its registry entry or its landed fact, landed.json, which lot land, lot close and worktree prune write once its landing is merged), the open lots, the lots that can start in critical-path order (shares:, merge:, unverified, stacks, next command), the held ones with each scope pair met (a ready lot meeting an open lot is proposed with shares: <pair> (<lot>, forecast clean) when the last forecast that lot recorded is known and shows no conflict inside the met entries; it stays held on a met lock file, a conflict inside the met entries, or an open lot with no known forecast; two ready lots that meet are both proposed), the landed lots (lot <name> committed: hand-over committed in <folder>, branch on <target>; until lot close closes that hand-over), person entries without a mark, the spec work, what each entry waits for, the parked ones, the live heavy steps with the load against twice the cores and the available memory against 2 GB (advice only); --all lists the done entries; --json { plan, repositories, counts, entries, proposals, held, landed, specWork, heavy, unknown }",
2530
+ "check - the block parses and every repository is a git main checkout (two names for one common folder refused); one line when valid; --json { plan, valid, faults }",
2531
+ "mark - a person entry only: appends { plan, id, state: done, by, reason, at } to <state>/dialecte/plans/<sha256 of the plan's real path, 16 hex>.jsonl, once (again: already); per machine; --landed <sha> for a lot or fix entry landed outside the lot store (a lot landed by hand, or stopped after its work landed in another lot): one --landed per repository of the entry (<repository>:<sha>; a bare <sha> for an entry of one repository); origin fetched, each commit must be on origin's base branch of its repository and change a path of the entry's scope there; the mark records { landed: [{ commit, repository }] } and the entry reads done by them (realizedBy kind landed); an entry its records already say done takes none (answered, nothing recorded); a lot or fix entry takes no plain mark, a person entry no --landed",
2532
+ "mark superseded - an entry of any kind other entries replaced: appends { plan, id, state: superseded, by, reason, at, replacedBy } (each --replaced-by an id of the block, never the entry itself; replacedBy [] when none is given), once (again: already); --reason required, --landed refused; the entry reads done (realizedBy kind superseded, name the --by), so nothing waits on it; the replacing entries do not take over its dependents (a dependent that needs their work names them in its dependsOn); --all lists it as <id> (superseded by <ids>); an entry its records already say done takes none (answered, nothing recorded)"
2533
+ ],
2534
+ exitCodes: [
2535
+ "1 next: no lot or fix can start now (spec work may still be listed)",
2536
+ "2 usage; no block or an invalid one (every fault listed); a repository that is not a git checkout; mark: a lot or fix entry without --landed (or without --reason), a person entry with it, a commit not on the base branch of origin, an unknown id; superseded without --reason, with --landed, or a --replaced-by not in the block or the entry itself; --replaced-by with done"
2537
+ ],
2538
+ example: "dialecte plan next 33-LOT-ENGINE.md"
2539
+ },
2540
+ gate: {
2541
+ family: "Check",
2542
+ summary: "The package's Definition of Done with the real counts",
2543
+ usage: [
2544
+ "dialecte gate [--fast | --full] [--base <ref>] [--no-reuse] [--declare <path>]... [--json]",
2545
+ "dialecte gate --hook [--no-reuse]",
2546
+ "dialecte gate --release [--base <ref>] [--no-reuse] [--json]"
2547
+ ],
2548
+ notes: [
2549
+ 'steps from package.json "dialecte": { "gate", "generatedDocs" } or the defaults; --full then runs npm run type-narrowing when the package has that script and no step runs it (a skip line when it lacks it); refuses while a hand-over script holds the repository',
2550
+ "--fast - the default; starts with the worktree's hygiene (nothing staged, no stash on its branch, new files declared)",
2551
+ "in a lot's own worktree, --fast and --full end with the lot's conflict forecast against main and every open lot (as lot forecast, recorded with trigger gate): forecast: <verdict>, then one ! <against>: <why> line per comparison it does not clear, said before the notes and the verdict; --json adds forecast { verdict, lines }; a warning only, the gate's verdict and exit never change; none in a review throwaway, none for --release",
2552
+ "a failing vitest test step is rerun once, serially, on its failing files: passing there it is flagged flaky in parallel",
2553
+ "the default lists end with a scoped rules step (dialecte rules); a step whose run starts with the word dialecte runs as the gate's own cli (its node and entry file, never node_modules/.bin), its line ending (dialecte <version>); a missing dialecte bin fails that step, never the gate",
2554
+ "a green record of the same tree, install and steps answers the steps after a fresh tdd step; --no-reuse runs them",
2555
+ "--full and --release hold the machine awake while they run (macOS: caffeinate -i -w <pid>; DIALECTE_KEEP_AWAKE=0 turns it off); a run that spanned a sleep keeps sleptMs on its record and the card says it",
2556
+ '--hook - in a commit hook, no test suite (CI runs it on every push): with "dialecte.gate.hook" declared, the tdd receipts of the lot first (every new or changed case since the lot base proven red then green, unchanged, accepted or revised, its newest green at the production as committed; a stale green names dialecte tdd green (measured from the lot base); a first or merge commit skips it), then the declared steps (the cli: check, then rules on the touched files); without one, every step of --full, a scoped one against the hook base; each step answered by a green record (any mode) of the committed tree and install that ran it as it is now, else run; the running line names the steps it runs',
2557
+ '--release - alone: "dialecte.gate.release" (default: the --full steps), every scoped step against the empty tree (--base feeds only the tdd step); records dialecte-gate-release.json; each of its steps answers a hook step of the same step hash (a scoped one at any base: it checked everything); its green record answers a rehearsal, contrib and the card when the list covers full (same name, run, counts and changedOnly for every full step)',
2558
+ `scoped steps ("scoped": true) get DIALECTE_GATE_BASE, _TREE, _CHANGED (the changed paths byte for byte, NUL-separated, relative to the repository top as git diff --name-only names them; a declared failing path is relative to the package root) and _SELECTION, where they write { schema: 1, base, tree, changed, selected: [{ id, reasons }], skipped: [{ id, reason }] } (both lists required, reasons non-empty); the base is --base <ref>, else the merge-base with the base branch (the first found: "dialecte.baseBranch", origin/HEAD, main, master; each local, else on origin), else the empty tree; a local base branch holding commits origin's lacks: a note naming the count, the base read from origin's; select from the working files; without the gate (no DIALECTE_GATE_SELECTION): select everything`,
2559
+ 'a step whose run is npm run <script> the package lacks is not wired: a default step fails a --full or --release run (a --fast one says it and goes on), a declared step fails in every mode; then no step runs, the others read not run: a step of the list is not wired; "dialecte": { "gate": { "skip": { "<default step>": "<reason>" } } } (dialecte.gate.skip) opts a default step out, a warning with its reason',
2560
+ `a scoped step: an empty selection exits 0 without starting vitest (nothing selected since <base> (<n> paths changed)); a non-empty one on a counts: "tests" step that runs no test fails; a failed scoped step counting tests is rerun once serially on a test failure (a failed test, a FAIL line, vitest's error markers), whatever runs it: the failing files (after -- through npm run), then --no-file-parallelism, and it must select the same ids (one vitest invocation, or --passWithNoTests on each); the selection may declare "failing": [paths relative to the package] the record keeps with the ones the output names; "heavy": true marks a heavy suite, outside the command hash`
2561
+ ],
2562
+ exitCodes: [
2563
+ "2 an option the usage lines do not name, or --base / --declare given last without its value: the usage printed (--json: { error, usage, next: null }); no step run"
2564
+ ],
2565
+ example: "dialecte gate --full"
2566
+ },
2567
+ tdd: {
2568
+ family: "Check",
2569
+ summary: "Receipts that each new test failed on an assertion before the code, then passed untouched",
2570
+ usage: [
2571
+ "dialecte tdd red [<test file>]... [--base <ref>] [--json]",
2572
+ "dialecte tdd green [<test file> | <test file>::<case name>]... [--base <ref>]",
2573
+ "dialecte tdd status [--base <ref>] [--json] [--flags] | tdd status --legend"
2574
+ ],
2575
+ notes: [
2576
+ "red - every case of the changed test files must fail on an assertion (or a stub's 'not implemented' inside an asserting expect); a passing new case, a missing export, a type or syntax error, a timeout, a .only is refused; the files without a refusal are frozen",
2577
+ "green - each case with a red receipt, its test code as frozen, production changed since its red, passes; records a green receipt",
2578
+ "status - per case red, green, unchanged, missing receipt, test edited after red, flags",
2579
+ "base - the change is measured from the lot base: HEAD's fork point from the base branch (the newer of the local branch and origin's), or from an open stack parent's line; HEAD only when no base branch is found; a green taken before a rebase still counts after it",
2580
+ "--base - measure from where HEAD left the ref given instead of the lot base",
2581
+ "declarations - a gone or moved entry of the lot file naming a path the change leaves unchanged, or one known nowhere (not at the base, not now, not in the receipts), is refused before any run, naming its lot gone --remove or lot moved --remove; a test file deleted on disk is a deleted file, never read",
2582
+ "--legend - the tdd terms of the hand-over card"
2583
+ ],
2584
+ exitCodes: [],
2585
+ example: "dialecte tdd green"
2586
+ },
2587
+ rules: {
2588
+ family: "Check",
2589
+ summary: "Code-rules self-check of the changed files (syntax tree, not greps)",
2590
+ usage: ["dialecte rules [<files...>] [--json]", "dialecte rules --base <ref> [--json]"],
2591
+ notes: [
2592
+ "types / constants in their files, named functions, no await in an argument, object parameters, full words, no standard citation (nor, in a contributor profile, a plan tag, acceptance criterion or ticket number); temporary-root-shared; raw-git-repository on test and test support files (a git clone / git init argument list in a git call, init --bare aside: make the repository through a test helper that gives it an identity; allowable); bare-tmpdir on production files (every temporary folder under one scratch root; allowable); their messages name the cli helpers only in the cli",
2593
+ "a contributor: no consumer name nor forbidden word (git config dialecte.forbiddenWords and $XDG_CONFIG_HOME/dialecte/forbidden-words, else ~/.config/dialecte/forbidden-words; whole words, any case); no list: one line, and the check is not run",
2594
+ "without files: the changed list a scoped gate step hands (DIALECTE_GATE_CHANGED), else the files changed against HEAD and the new ones; a file it cannot read or parse is an error",
2595
+ "quality rules: argument-mutation, query-in-loop, long-function on implementation files; table-branch, without-export-xml, export-without-queries, fixture-builder, plan-tag on test-shaped files; on test-shaped Dialecte changes: xml-splice, xml-replace, transaction-spy, act-repeats-call, act-snapshot, act-format-check, inline-document-long, expected-fixture, fixture-case-comment (warning), test-file-long, fixture-file-long, fixtures-module, fixture-builder an error; in an app only Dialecte-change script files are judged, the others counted in one line (a contributor package is never an app); with the gate base, an error on a line the change did not add is a warning; without a gate base, or with an empty-tree one (as gate --release hands), the order every caller shares: in the worktree of a store lot its lot base read from git (its fork point from the base branch, or from the line of the lot it was started on while that lot is open; never the base recorded at its start, which a rebase leaves behind; with no base branch found, the newest of the commit it recorded at its start, when HEAD holds it, and a release tag descending from that commit, else no base), else the merge-base with the base branch (skipped, for an empty-tree base and for a run without a gate base, when it is the commit of HEAD), else the last release tag <name>@v<version>, else no base and every error kept; a lot base that cannot be read (its stack parent unreadable) is no base, never the merge-base, said in a rules: no base (<why>) line by every run that reads the order: without a gate base, with an empty-tree one, and on the contrib rules row; a run without a gate base prints one line naming it (rules: base <sha> (the lot <name> | the merge-base with <branch> | the merge-base with the base branch | the release tag <tag>), or rules: no base (<why>) when the lot base cannot be read)",
2596
+ "changelog-edit (an error), in a package keeping a changes/ folder: CHANGELOG.md edited without the package version bumped; write the entry in changes/<lot>.md (dialecte changelog)",
2597
+ "released-changelog (an error, no opt-out), on CHANGELOG.md in every package: a released ## [<version>] section the change altered - lines added, removed or reordered, the section removed, or its heading repeated - judged against the base branch and where the change left it (a section main corrected after the branch point, or a release the branch predates, is no finding); the release base a rehearsal hands its hooks (DIALECTE_RELEASE_BASE, to the scoped rules step alone) replaces the base branch; no base branch: one line, not judged (--json: releasedChangelogNotJudged)",
2598
+ "--base <ref>: the files changed from the merge-base of <ref> and HEAD to the worktree are judged (deletions left out; uncommitted ones in), that merge-base the base of the softening as a gate base would be; files given with it, or a ref naming no commit, exit 2",
2599
+ "base-aware rules (warnings, against the base the run judges the change from: --base, else the lot base, else, in a run that is no scoped gate step, the base branch merge-base; never a release tag, an empty tree nor the gate base): duplicate-read, an added function reading the same element and three or more attributes as an existing one (a named set counts three), or whose name shares two words with an existing function it does not call (generic words such as read, list, file, path or name left out); shared-export-changed, an export imported by a file of another folder (a sub-folder included) newly shared, re-signed (its parameters, return type, or a sibling .types.ts type they name), its body changed, or removed; docs-not-updated, in a contributor library (no bin), a public api.json entry added, re-signed or removed whose doc page (doc/ Markdown or README naming its last two route segments, or its whole route in a code span) the change did not touch; one line names where they stand: quality: since <short> (lot | base-branch | flag), quality: not run (no lot) in a scoped gate step outside any lot, no line when there is no base or no package.json; notes under it: public API: <route> removed: still named by <pages>, ! public API unknown (<why>), aliases changed, when a tsconfig or Vite config changed (the base edges read with the aliases of the tree); a run that judged the whole change writes dialecte-quality.json in the worktree git folder; contrib never runs them",
2600
+ "--json: dialecteChanges (the verdict of each file), notJudged, baseLine, qualityLine, quality (the base, the examined files, duplicates, sharedExports, publicApi, docs); described by rules.schema.json (schema 1)",
2601
+ "opt-out: // dialecte-allow <rule>[, <rule>]: <reason> (15 characters at least) on the line or the line before (for argument-mutation, long-function also in the comments before the function, its doc comment included; for act-repeats-call, act-snapshot, act-format-check inside an act also the line before the act); fixture-file-long: <!-- dialecte-allow fixture-file-long: <reason> --> on the first line of the fixture; invalid-allow, unused-allow; --json counts the findings silenced per rule in allowed",
2602
+ "an API index that cannot be read: query-in-loop does not run, one line names the file and why",
2603
+ "not judged: an alias of a parameter or of a query (aliases are not followed); query-in-loop is syntactic and one level (a read in a function the loop calls is not seen); a table imported from a sibling file; plan-tag flags round, step or station followed by a number in a title (reword it, or opt out); fixture-builder reads a <word> placeholder in a template string as XML (opt out); act-repeats-call counts a call after an early-return arm that makes the same call as two; a *Query-named binding that is no query, or a run with no readable API index (no core groups), can make a unit of a call chain"
2604
+ ],
2605
+ exitCodes: [],
2606
+ example: "dialecte rules src/commands/lot.ts"
2607
+ },
2608
+ contrib: {
2609
+ family: "Check",
2610
+ summary: "The contributor checks of a dialecte package (profile contributor)",
2611
+ usage: ["dialecte contrib [--no-reuse] [--json]"],
2612
+ notes: [
2613
+ 'after gate --full and before handover: rules on the changed files (against the base of the lot, the order the rules step of the gate shares: the lot base of the store lot read from git (its fork point, never the base recorded at its start), else the merge-base with the base branch, as the rules step of the gate takes it, else the last release tag <name>@v<version>, every error kept without any; a rehearsal against the tip its last merge lot merges, else the gate base of the repository at the HEAD of the lots file: an error on a line the base holds is a warning), the "dialecte": { "contrib": { "steps" } } (default: npm run doc:build with the generatedDocs restored, npm run type-bench:check), npm run type-narrowing when the package has that script and no step runs it (a skip line when it lacks it), no dependency named by a local folder, the mutation line when a scope is declared',
2614
+ "the changelog row (after rules): first the released CHANGELOG.md sections, on every run, changed by the lot or not (a merge brings them): a section altered against the base branch and where the change left it fails the row, naming it (rules: released-changelog); the record is keyed on the base's and the merge-base's CHANGELOG.md, so a release on main runs the row again; then in a package keeping changes/, a change that edits README.md, a page under doc/ or a file the package lists in dialecte.changelog.asking (a folder ends in /; the cli lists its command map) adds a changelog fragment changes/<lot>.md, or a no-entry note changes/<lot>.none.md saying why; else it fails naming the file",
2615
+ "a step a green gate --full of this tree and install passed with the same command is not run again; --no-reuse runs every row",
2616
+ 'a step whose run is npm run <script> the package lacks is not wired: it fails, default or declared; then no row runs, the others read not run: a step of the list is not wired; "dialecte": { "contrib": { "skip": { "<default step>": "<reason>" } } } (dialecte.contrib.skip) opts a default step out, a warning with its reason'
2617
+ ],
2618
+ exitCodes: ["2 refused in a consumer (nothing written)"],
2619
+ example: "dialecte contrib"
2620
+ },
2621
+ changelog: {
2622
+ family: "Check",
2623
+ summary: "Changelog fragments (changes/<lot>.md): check them, or fold them into CHANGELOG.md for a release",
2624
+ usage: [
2625
+ "dialecte changelog check [--base <revision>]",
2626
+ "dialecte changelog release <x.y.z> [--date YYYY-MM-DD]"
2627
+ ],
2628
+ notes: [
2629
+ "a fragment: one changes/<name>.md per lot (a no-entry note changes/<name>.none.md holds why a visible change has none), its entries under the changelog headings ### Added, Changed, Deprecated, Removed, Fixed, Security; a package keeping a changes/ folder edits CHANGELOG.md only in a release (rules: changelog-edit)",
2630
+ "check - every fragment readable (a known heading, no loose text, no empty or repeated section), the Unreleased part of CHANGELOG.md, then its released sections: none altered against the base branch and where the change left it (rules: released-changelog); --base <revision> judges against that commit alone, the one the change goes onto (the CI check step hands the merge queue's base, or a pull request merge ref's first parent)",
2631
+ "release - writes ## [<x.y.z>] - <date> (default today, local) under an emptied ## [Unreleased] (written above the first version when missing): the Unreleased summary and entries first, then each fragment in file name order, section by section, one entry per line; deletes the fragments and the no-entry notes; nothing written when a fragment or the Unreleased part cannot be read"
2632
+ ],
2633
+ exitCodes: [
2634
+ "1 a fragment or the Unreleased part cannot be read, a released section is altered (check), the release is refused (no CHANGELOG.md, version already there, nothing to release), or a fragment could not be deleted",
2635
+ "2 usage: no verb, a version that is no x.y.z, a date that is no YYYY-MM-DD; --base names no commit of the repository"
2636
+ ],
2637
+ example: "dialecte changelog release 0.8.0"
2638
+ },
2639
+ ci: {
2640
+ family: "Check",
2641
+ summary: "The CI files shipped as a template: write them into the package, report drift, run the publish guard",
2642
+ usage: ["dialecte ci sync [--dry-run]", "dialecte ci check", "dialecte ci publish-decision"],
2643
+ notes: [
2644
+ "the template: the workflows (ci.yml, publish.yml and their reusables), .github/pull_request_template.md, .nvmrc and changes/.gitkeep; ci.yml selects its jobs from package.json: type-perf with a type-bench:check script, docs with a doc:build script, the Playwright install with a playwright dependency, the npm run skills:check step of the check job with a skills:check script; the check job always runs rules --base of the cli over the change (the base sha of the merge queue, else HEAD^1, skipped on a dispatch), where --no-verify cannot skip it; a build script is required (publish.yml builds the package)",
2645
+ "the repository owns .github/workflows/_test.yml (ci.yml calls it: a workflow_call trigger; a mode input of type string gets pr on a pull request, full in the merge queue) and every other workflow file the template does not name; they are listed, never written",
2646
+ "sync - writes what differs from the template, deletes the retired files (pr.yml, _lint.yml) and the reusables no job of the package calls; an update prints its diff; a second run is in step; --dry-run writes nothing",
2647
+ "check - the same comparison, read-only: each drifted file with its diff, then the fix; the template's _check.yml runs it on every pull request",
2648
+ "publish-decision - the publish guard of the push to main (BEFORE, GITHUB_OUTPUT): publish above npm's latest, a pre-release under next, a missing release tag pushed alone, a failed npm query refused",
2649
+ "publish.yml keeps its name and its push trigger: npm trusted publishing names the file"
2650
+ ],
2651
+ exitCodes: [
2652
+ "1 sync: the own _test.yml is missing or breaks the contract (the managed files are written); check: drift or a broken contract; publish-decision: refused, or BEFORE, GITHUB_OUTPUT, package.json or git failed",
2653
+ "2 usage, no package.json, a package.json with no name or no build script"
2654
+ ],
2655
+ example: "dialecte ci sync --dry-run"
2656
+ },
2657
+ mutants: {
2658
+ family: "Check",
2659
+ summary: "Mutation testing of the declared scope; survivors tracked until handled",
2660
+ usage: [
2661
+ "dialecte mutants run [--mode changed|audit] [--base <ref>]",
2662
+ "dialecte mutants status [--json]",
2663
+ "dialecte mutants schedule <follow-up> <key>... | schedule <follow-up> --all-new [--json]",
2664
+ "dialecte mutants abandon <run id> [--json]",
2665
+ "dialecte mutants migrate [--json]",
2666
+ "dialecte mutants judge [--file <file>] [--json]",
2667
+ "dialecte mutants record (--key <key>... | --file <file>) --family <family> --reason <text> [--removable] [--json]",
2668
+ "dialecte mutants drop <run id> [--json]"
2669
+ ],
2670
+ notes: [
2671
+ `run - Stryker on package.json "dialecte": { "mutation" }; changed = the scope lines changed since the merge base, audit = the whole scope; without --mode the lot's switch decides`,
2672
+ "status - running runs with their age, died runs, new survivors by lot, scheduled by follow-up",
2673
+ "judge - per file, the new survivors with the code around each, its covering tests, a family guess",
2674
+ "record - writes .dialecte/mutation-records.json, then moves the survivors to recorded"
2675
+ ],
2676
+ exitCodes: ["1 run: only when Stryker fails, never on survivors"],
2677
+ example: "dialecte mutants run --mode changed"
2678
+ },
2679
+ handover: {
2680
+ family: "Hand over",
2681
+ summary: "The guarded commit-by-lots hand-over a human runs, from a lots file",
2682
+ usage: [
2683
+ "dialecte handover write <lots.json> [--release] [--target <branch>] [--out <id|folder>] [--rehash] [--json]",
2684
+ "dialecte handover show [<name|folder>] [--json]",
2685
+ "dialecte handover review <name|index|folder> [--json] [--print]",
2686
+ "dialecte handover run [<name|folder>] [--rehearse [--keep] [--full]] [--resume-merge] [--not-a-lot --by <who> --reason <text>]",
2687
+ "dialecte handover abandon [<name|folder>]",
2688
+ "dialecte handover list [--root <dir>] [--json]",
2689
+ "dialecte handover --legend"
2690
+ ],
2691
+ notes: [
2692
+ "write - the hand-over folder (lots.json, snapshot, one-line commit.sh) and its card, registered in <git common dir>/dialecte-handover/<name>.json under the real path of the folder; handover <lots.json> is the same; --out <id> writes into the lot folder, refused (exit 2, nothing written) for a simulated, canceled or failed lot, an open question, a lots file of another worktree or branch; any folder whose hand-over is committed is refused",
2693
+ "write --target <branch> - the branch the lots land on, recorded as target in lots.json (default: the base branch resolved at write time); a branch with neither a local nor an origin ref is refused (exit 2, nothing written)",
2694
+ "show - the card again, recomputed, nothing written; without an argument the newest of the branch; BLOCKED with a ! line when the target branch moved past the hand-over (merge it first); BLOCKED with a \u2717 processes line naming the processes left running in the worktree (no terminal, not under an editor, not named in git config dialecte.personProcesses); BLOCKED with a \u2717 merges line when a merge lot not committed yet has no recorded tree, worded as run refuses it",
2695
+ "review - opens the hand-over's worktree in a new editor window, started detached (a hand-over holding a merge lot first writes review/lot.diff, the lot's change against head, and opens it too); the editor: git config dialecte.editor in the worktree (its words, no flag added), else the first known editor found on PATH, else code; never $EDITOR; --print prints the command line and starts nothing, --json answers { editor, command, opened }; refused (exit 2) for an unknown hand-over, a worktree that is gone, an editor not found",
2696
+ "run - what commit.sh runs: each guard with its time, each lot announced, the hook live, the card; without a folder the one registered hand-over still to run; --rehearse commits in a scratch clone; refuses a canceled lot (exit 2); the lot guard refuses a hand-over folder that is not a lot of the store (exit 2) unless --not-a-lot --by <who> --reason <text> gives the go-ahead, recorded first as a not a store lot: row of its decisions.md (an existing row counts), and always a simulated or damaged lot; a rehearsal prints ! and goes on; holds the machine awake while it runs, and a run that spanned a sleep says so on the DONE card; a run that committed lots archives every non-empty lot file of the worktree (the root's and each tracked package's) in the folder, lots/<package path>/ for a package, lot.landed.json beside a lot.json holding other bytes, and empties it; a run that committed none leaves them as they are",
2697
+ "abandon - marks a hand-over that will not run (abandoned.json) and releases its lock; refuses a lot folder (exit 2): rewrite it with write --rehash --out <full name>, end the lot with lot stop",
2698
+ "list - every hand-over folder: repository, worktree, branch, lots, age, state",
2699
+ "--legend - every term of the card, what it means, whether to look"
2700
+ ],
2701
+ exitCodes: [
2702
+ "2 every verb: an option its usage lines do not name, or a value option given last without its value: the usage printed (--json: { error, usage, next: null } where the verb takes --json); nothing read or written",
2703
+ "2 run: the target branch moved past the hand-over (merge it first) or has no ref, a process left running in the worktree or a process list not known, a gate config the cli cannot run, a canceled lot, a hand-over that is not a lot of the store (without --not-a-lot), a simulated or damaged lot, --not-a-lot without --by and --reason (or --by/--reason without it), a forbidden word in --by or --reason; nothing committed",
2704
+ "2 write: a --target branch with neither a local nor an origin ref, no base branch found without --target, an --out the lot folder refuses; nothing written"
2705
+ ],
2706
+ example: "dialecte handover write ../handover/lots.json"
2707
+ },
2708
+ worktree: {
2709
+ family: "Workspace",
2710
+ summary: "A worktree ready to work in; prune what a merge left",
2711
+ usage: [
2712
+ "dialecte worktree add <repository> <branch> [--from <ref>] [--json]",
2713
+ "dialecte worktree prune [--root <workspace>] [--yes] [--json]",
2714
+ "dialecte worktree prune [--root <workspace>] --reclaim [--dry-run] [--older-than <days>]"
2715
+ ],
2716
+ notes: [
2717
+ "add - under the workspace's .worktrees/: hooks folder, the links its file: and link: dependencies need to sibling checkouts, node_modules taken from the pool when an entry matches package-lock.json's lock key, else a near entry (at most 5 packages off) completed by npm install --prefer-offline --no-save, else npm ci, a copy-on-write copy only when npm ci fails (the reason on the card), read against package-lock.json (the npm ci to run when it differs), hygiene baseline",
2718
+ "prune - merged worktrees and branches, committed hand-overs, rehearsal clones: the commands with their cd; a worktree whose folder is gone is kept while its HEAD reflog holds work nothing else does (git worktree prune would delete that reflog), and git worktree prune waits while one is kept; a store lot's items (its worktree, its review throwaways <lot worktree>-round-<n> and -verify, its branch and theirs) are never removed here and no landing is read: an open lot's are kept, reason lot <name> <state>, a committed or canceled lot's are listed lot <name> <state>: its own item, removed by dialecte lot prune <name>; a worktree whose branch's work is not in the base is kept (not landed: its work is not in <base>); a worktree or a branch whose removal would lose a commit is kept with its commits (<n> commit(s) its removal would lose: <commits>; a surviving branch, branch reflog, tag, landed tip or remote-tracking ref holds a commit, or the same change at the same place (a commit with the same diff, its hunk line numbers included); deleting a branch takes its reflog); a worktree a process works in is kept (a process works in it: pid <pid>; processes not known: kept with why); ignored entries are read as lot close reads them: rebuilt folders, .dialecte/ views and copies of the main checkout's files go, anything else keeps the worktree (ignored files git worktree remove would delete: <paths>); a rehearsal clone is kept while its marker is missing or unparsable, or its pid runs; --yes runs them after a confirmation on a terminal; committed hand-over folders and finished rehearsal clones go to the trash like the other items: the plan shows the move (mkdir -p <trash> && mv <folder> <trash>/), --yes makes it; a move that cannot be made is a \u2717 line, nothing deleted; the pool (.worktrees/_pool-<repository>-<n>) and the trash (.worktrees/_trash/) are counted, never touched",
2719
+ "prune --reclaim - every worktree idle for --older-than days (default 2: no write to its index, HEAD or reflog since), not the main checkout, not locked, named by no open lot (a failed lot keeps) nor open hand-over, worked in by no process, reached by no link: its node_modules parked in the pool when its lock key is the main checkout's and it installs that lock, else sent to .worktrees/_trash/, its code never touched, a -round-<n> review throwaway's too; a node_modules that is a link is never moved; every rule checked again just before each move; one line per worktree, the total (worktrees, files, size) last; --dry-run moves nothing; --dry-run or --older-than without --reclaim, or an --older-than that is no positive whole number, exit 2"
2720
+ ],
2721
+ exitCodes: [
2722
+ "0 add: the worktree exists, whatever the links and the lockfile say",
2723
+ "1 add: a new branch without --from, and the base branch refused (a dialecte.baseBranch set to a branch that exists nowhere, local or on origin, or no base branch found); no worktree made"
2724
+ ],
2725
+ example: "dialecte worktree add cli feat/my-change"
2726
+ },
2727
+ doctor: {
2728
+ family: "Workspace",
2729
+ summary: "Installed versions, core API generation, skills in sync, local checkouts",
2730
+ usage: [
2731
+ "dialecte doctor [--json]",
2732
+ "dialecte doctor --brief",
2733
+ "dialecte doctor --host [--vendor <name>]"
2734
+ ],
2735
+ notes: [
2736
+ "what to fix before trusting what you read",
2737
+ "--brief - the session-start form, nothing when in sync, one line per problem",
2738
+ "--host - runs every read of the repository's host once, for real, through the cli's own code (the newest merged pull request, its checks and queued state, a reference pull request's line comments, the stack extension), then the tool versions against the recorded ones and git against its floor; only those lines; network by name; --vendor <name> probes that vendor whatever the origin"
2739
+ ],
2740
+ exitCodes: [
2741
+ "1 a warning",
2742
+ "0 --brief, always",
2743
+ "1 --host: an error (a read refused, a changed answer, git below its floor, no vendor); a warning (nothing to probe, a part not installed, an older tool) never fails",
2744
+ "2 --host: usage (--vendor given without a vendor name)"
2745
+ ],
2746
+ example: "dialecte doctor --brief"
2747
+ },
2748
+ models: {
2749
+ family: "Workspace",
2750
+ summary: "Which model each tier (fast, standard, strong, frontier) means for the project's vendor",
2751
+ usage: ["dialecte models [--vendor <anthropic|openai|google>] [--json]"],
2752
+ notes: [],
2753
+ exitCodes: ["1 an unknown vendor", "2 no vendor known"],
2754
+ example: "dialecte models --vendor openai"
2755
+ },
2756
+ skills: {
2757
+ family: "Workspace",
2758
+ summary: "Agent skills shipped in skills/<name>/: sync | generate | check | changed",
2759
+ usage: [
2760
+ "dialecte skills sync [--agent claude,copilot,agents] [--copy] [--from <workspace>] [--contributing | --no-contributing] [--vendor <id>] [--no-session-check] [--agents-file | --no-agents-file]",
2761
+ "dialecte skills generate [zero-config flags]",
2762
+ "dialecte skills check [--workspace <dir>] [zero-config flags]",
2763
+ "dialecte skills changed [--base <ref>]"
2764
+ ],
2765
+ notes: [
2766
+ "sync - install the consumer skills of your dependencies (or of local checkouts) for your agents; --contributing adds the contributor skills, remembered until --no-contributing; remembers the model vendor; with the contributor skills, a doctor --brief session-start check in AGENTS.md and the station agents (--no-session-check leaves the check out); a missing AGENTS.md is created only on a yes or with --agents-file, the section is never removed, and --no-agents-file leaves AGENTS.md alone",
2767
+ "generate - rewrite the generated blocks (verb map, method index, hook files) from the source",
2768
+ "check - fail on a cited API / path / npm script / cli invocation that does not exist, or a stale block",
2769
+ "changed - per skill, hand-written change (evals due) or generated blocks only"
2770
+ ],
2771
+ exitCodes: [],
2772
+ example: "dialecte skills sync --agent claude"
2773
+ },
2774
+ corpus: {
2775
+ family: "Workspace",
2776
+ summary: "The open-licence corpora fetched into a cache, and the licensed ones of config.yml",
2777
+ usage: [
2778
+ "dialecte corpus fetch [<id>...] [--json]",
2779
+ "dialecte corpus list [--json]",
2780
+ "dialecte corpus check [--json]",
2781
+ "dialecte corpus add <name> --xsd <path> [--instances <folder>]"
2782
+ ],
2783
+ notes: [
2784
+ "fetch - the sources of the shipped manifest (every one, or the ids named): each refused without its licence, terms and a known verdict, with an id that names an entry of the cache itself, or with a download not pinned by a sha256; each download (no redirect followed, at most 512 MiB, aborted after 120 s without data) checked against its pin (a kept one in _downloads/ first, so a run without network rebuilds), its archive members kept and stripped (at most 1 GiB inflated), a member outside its folder refusing the source, then exclude, marker, substitute and wrappers; written to <cache>/<id>/ and named in manifest.lock.json once in place; a refused source changes nothing of what it had; one fetch writes a cache at a time (fetch.lock: another running fetch refuses the run); the cache: $DIALECTE_CORPORA_DIR, else corpora/ in the cli cache folder ($XDG_CACHE_HOME/dialecte, else ~/.cache/dialecte); never committed",
2785
+ "list - every open source (fetched; stale: from another manifest entry, without a lock entry the cli reads, or a locked file gone; or missing) and every licensed entry of config.yml corpora: (present or missing), with its verdict, entry schemas, instances (a folder and its globs) and instance count; exit 0 whatever is missing; --json (version 1) is the reader for a validation tier",
2786
+ "check - a fetched source whose files no longer match its fetch (edited, missing, added) or its manifest entry, and a licensed entry whose files are missing, one line each",
2787
+ "add - writes corpora.<name> of the personal config.yml with absolute paths, its comments kept; refused for a name holding a dot or a path that does not exist"
2788
+ ],
2789
+ exitCodes: [
2790
+ "0 list: whatever is missing",
2791
+ "1 fetch: a source refused; check: a problem named",
2792
+ "2 fetch: an unknown source id; add: no --xsd, a name holding a dot, a path that does not exist; a refused config.yml"
2793
+ ],
2794
+ example: "dialecte corpus list --json"
2795
+ },
2796
+ bench: {
2797
+ family: "Maintain",
2798
+ summary: "Measure type-instantiation cost (tsc --extendedDiagnostics); --check to gate CI",
2799
+ usage: ["dialecte bench [--check] [zero-config flags]"],
2800
+ notes: [
2801
+ "writes benchmarks/types/baseline.json; --check fails on a >5% instantiation regression",
2802
+ "tsgo (TypeScript 7+) runs with one checker (--checkers 1), so a file set always gives the same count; the baseline records the compiler and its exact version",
2803
+ "--check gives no verdict against a baseline from another compiler or version, or one that records none: re-baseline in its own commit"
2804
+ ],
2805
+ exitCodes: [
2806
+ "1 --check: an instantiation regression past 5%",
2807
+ "2 --check: no baseline.json to compare with (run dialecte bench to write it)",
2808
+ "3 --check: a baseline from another compiler or version, or one that records no compiler"
2809
+ ],
2810
+ example: "dialecte bench --check"
2811
+ },
2812
+ coverage: {
2813
+ family: "Maintain",
2814
+ summary: "Generate type-coverage probes (surface, valid calls, deep, full method surface with extensions)",
2815
+ usage: ["dialecte coverage [zero-config flags] [--format-config <path> | --no-format]"],
2816
+ notes: [],
2817
+ exitCodes: [],
2818
+ example: "dialecte coverage"
2819
+ },
2820
+ narrowing: {
2821
+ family: "Maintain",
2822
+ summary: "Gate: assert schema-derived type narrowing still holds (IntelliSense safety net)",
2823
+ usage: ["dialecte narrowing [zero-config flags]"],
2824
+ notes: [],
2825
+ exitCodes: [],
2826
+ example: "dialecte narrowing"
2827
+ },
2828
+ audit: {
2829
+ family: "Maintain",
2830
+ summary: "Render the public type surface and flag readability issues (C1-C6)",
2831
+ usage: ["dialecte audit [zero-config flags] [--format-config <path> | --no-format]"],
2832
+ notes: ["writes benchmarks/types/readability-audit.md"],
2833
+ exitCodes: [],
2834
+ example: "dialecte audit"
2835
+ },
2836
+ text: {
2837
+ family: "Maintain",
2838
+ summary: "The human part of a GitHub text, before it is posted",
2839
+ usage: ["dialecte text check <file> [--kind pr|issue|comment|commit]"],
2840
+ notes: [
2841
+ "the lines before <details: headings What changes, Why, How to check it (then Watch out) for pr and issue, none for comment and commit; word cap 150 | 200 | 80 | 100, headings and code blocks not counted; a commit subject of 72 at most"
2842
+ ],
2843
+ exitCodes: [],
2844
+ example: "dialecte text check pr.md --kind pr"
2845
+ },
2846
+ // the renamed commands: one key per command of the renamed forms, derived from that table
2847
+ ...renamedEntriesOf()
2848
+ };
2849
+
2158
2850
  // src/lib/doctor/answer-doctor.ts
2159
2851
  function answerDoctor(params) {
2160
2852
  const exitCode = params.lines.some((line) => line.status !== "ok") ? 1 : 0;
2161
2853
  if (params.json) return { output: endedOf(jsonOf({ lines: params.lines }, " ")), exitCode };
2162
2854
  return { output: endedTextOf2(params.lines.map(renderLine)), exitCode };
2163
2855
  }
2856
+ function answerHostDoctor(params) {
2857
+ const exitCode = params.lines.some(function isError(line) {
2858
+ return line.status === "error";
2859
+ }) ? 1 : 0;
2860
+ return { output: endedTextOf2(params.lines.map(renderLine)), exitCode };
2861
+ }
2164
2862
  function answerDoctorBrief(lines) {
2165
2863
  return {
2166
2864
  output: endedTextOf2(lines.filter((line) => line.status !== "ok").map(renderLine)),
@@ -2218,6 +2916,21 @@ var PROFILE_SUBJECT = "profile";
2218
2916
  var CONSUMER_ALLOWS_REFERENCES = "allowReferences is the consumer default: remove it";
2219
2917
  var CONTRIBUTOR_GATE_STEPS = "dialecte.gate.full holds {steps}: dialecte contrib runs them, move them to dialecte.contrib.steps (or drop them for the defaults)";
2220
2918
  var CONTRIBUTOR_SKILLS_NOT_SYNCED = "{folder} lacks the contributor skills: dialecte skills sync installs them in a contributor";
2919
+ var GIT_SUBJECT = "git";
2920
+ var HOST_VERSION_TEXTS = {
2921
+ asRecorded: "{version}, as recorded",
2922
+ newer: "{version}, newer than the recorded {recorded}",
2923
+ older: "{version}, older than the recorded {recorded}: a read may differ from the record",
2924
+ absent: "{absent} is not installed (recorded {recorded})",
2925
+ gitFloor: "git {floor} or later needed, found {line}"
2926
+ };
2927
+ var UPGRADE_TOOL_FIX = "upgrade {tool} to {recorded} or later";
2928
+ var HOST_SUBJECT = "host";
2929
+ var HOST_USAGE_START = "dialecte doctor --host";
2930
+ var VENDOR_NEEDS_NAME = "doctor: --vendor needs a vendor name";
2931
+ var VENDOR_EQUALS_FORM = "doctor: --vendor takes its name as the next word, not after =";
2932
+ var VENDOR_EQUALS_PREFIX = "--vendor=";
2933
+ var LEADING_DIGITS = /^\d+/;
2221
2934
 
2222
2935
  // src/lib/doctor/profile-lines.ts
2223
2936
  import { existsSync as existsSync16 } from "fs";
@@ -2549,164 +3262,1792 @@ function diagnose(context) {
2549
3262
  ...context.brief ? [] : localCheckouts(context)
2550
3263
  ];
2551
3264
  }
2552
- function installedPackages(cwd) {
2553
- const declared = declaredVersions(cwd);
2554
- return Object.keys(declared).filter((name) => name.startsWith(DIALECTE_SCOPE)).sort(TEXT_COLLATOR.compare).map(function packageLine(name) {
2555
- const version = installedVersion({ cwd, name });
2556
- if (version === void 0)
2557
- return { status: "warning", subject: name, detail: "not installed", fix: INSTALL_COMMAND };
2558
- const pinned = declared[name];
2559
- if (/^\d/.test(pinned) && pinned !== version)
2560
- return {
2561
- status: "warning",
2562
- subject: name,
2563
- detail: `${version} installed, ${pinned} declared`,
2564
- fix: INSTALL_COMMAND
2565
- };
2566
- return { status: "ok", subject: name, detail: version };
3265
+ function installedPackages(cwd) {
3266
+ const declared = declaredVersions(cwd);
3267
+ return Object.keys(declared).filter((name) => name.startsWith(DIALECTE_SCOPE)).sort(TEXT_COLLATOR.compare).map(function packageLine(name) {
3268
+ const version = installedVersion({ cwd, name });
3269
+ if (version === void 0)
3270
+ return { status: "warning", subject: name, detail: "not installed", fix: INSTALL_COMMAND };
3271
+ const pinned = declared[name];
3272
+ if (/^\d/.test(pinned) && pinned !== version)
3273
+ return {
3274
+ status: "warning",
3275
+ subject: name,
3276
+ detail: `${version} installed, ${pinned} declared`,
3277
+ fix: INSTALL_COMMAND
3278
+ };
3279
+ return { status: "ok", subject: name, detail: version };
3280
+ });
3281
+ }
3282
+ function coreGenerations(cwd) {
3283
+ const dialectes = dependencyNames(cwd).sort(TEXT_COLLATOR.compare).flatMap(function dialecteOnCore(name) {
3284
+ const folder = findInstalledPackage({ cwd, name });
3285
+ return folder && dependsOnCore(folder) ? [{ name, folder }] : [];
3286
+ });
3287
+ const appCore = installedVersion({ cwd, name: CORE_PACKAGE2 });
3288
+ const owners = dialectes.length ? dialectes : [{ name: void 0, folder: cwd }];
3289
+ return owners.flatMap(function generationLine({ name, folder }) {
3290
+ const version = installedVersion({ cwd: folder, name: CORE_PACKAGE2 });
3291
+ if (version === void 0) return [];
3292
+ const [major = 0, minor = 0] = version.split(".").map(Number);
3293
+ const generation = CORE_API_GENERATIONS.find(
3294
+ ({ from }) => major > from[0] || major === from[0] && minor >= from[1]
3295
+ );
3296
+ if (!generation) return [];
3297
+ const says = `${generation.name}: ${generation.says}`;
3298
+ if (name && appCore !== void 0 && appCore !== version)
3299
+ return [
3300
+ {
3301
+ status: "warning",
3302
+ subject: "core API",
3303
+ detail: `${name} on core ${version}, your app on core ${appCore}: two cores side by side (${says})`,
3304
+ fix: ALIGN_CORE_FIX
3305
+ }
3306
+ ];
3307
+ const owner = name ? `${name} on core ${version}` : `core ${version}`;
3308
+ return [{ status: "ok", subject: "core API", detail: `${owner} - ${says}` }];
3309
+ });
3310
+ }
3311
+ function skills(cwd) {
3312
+ const { sources } = discoverSkillSources({ cwd });
3313
+ if (sources.length === 0)
3314
+ return [{ status: "ok", subject: "skills", detail: "no dependency ships skills" }];
3315
+ const synced = Object.values(AGENT_SKILL_FOLDERS).filter(
3316
+ (folder) => existsSync19(join24(cwd, folder, MANIFEST_FILE))
3317
+ );
3318
+ if (synced.length === 0)
3319
+ return [
3320
+ {
3321
+ status: "warning",
3322
+ subject: "skills",
3323
+ detail: `not installed for your agents (${sources.map((source) => source.name).join(", ")} shipped)`,
3324
+ fix: SYNC_COMMAND
3325
+ }
3326
+ ];
3327
+ const contributor = isContributor(cwd);
3328
+ return synced.map(function syncLine(folder) {
3329
+ const manifest = readSyncManifest(join24(cwd, folder));
3330
+ const expected = selectAudience({
3331
+ sources,
3332
+ contributing: contributor || manifest.contributing === true
3333
+ }).selected;
3334
+ const missing = expected.map((source) => source.name).filter((name) => !manifest.installed.includes(name));
3335
+ if (missing.length)
3336
+ return {
3337
+ status: "warning",
3338
+ subject: "skills",
3339
+ detail: `${folder} lacks ${missing.join(", ")}`,
3340
+ fix: SYNC_COMMAND
3341
+ };
3342
+ const stale = expected.flatMap(function staleCopy(source) {
3343
+ const recorded = manifest.versions[source.name];
3344
+ if (isLink(join24(cwd, folder, source.name)) || source.version === void 0) return [];
3345
+ if (recorded?.version === source.version) return [];
3346
+ return [
3347
+ `${source.name} of ${source.origin} ${recorded?.version ?? "an unknown version"}, ${source.version} installed`
3348
+ ];
3349
+ });
3350
+ if (stale.length)
3351
+ return {
3352
+ status: "warning",
3353
+ subject: "skills",
3354
+ detail: `${folder} holds ${stale.join("; ")}`,
3355
+ fix: SYNC_COMMAND
3356
+ };
3357
+ return { status: "ok", subject: "skills", detail: `${folder} in sync with node_modules` };
3358
+ });
3359
+ }
3360
+ function isContributor(cwd) {
3361
+ try {
3362
+ return readProfile(cwd) === "contributor";
3363
+ } catch {
3364
+ return false;
3365
+ }
3366
+ }
3367
+ function isLink(path) {
3368
+ try {
3369
+ return lstatSync5(path).isSymbolicLink();
3370
+ } catch {
3371
+ return false;
3372
+ }
3373
+ }
3374
+ function dependsOnCore(folder) {
3375
+ const manifest = JSON.parse(readFileSync13(join24(folder, "package.json"), "utf8"));
3376
+ return manifest.name !== CORE_PACKAGE2 && (manifest.dependencies?.[CORE_PACKAGE2] !== void 0 || manifest.peerDependencies?.[CORE_PACKAGE2] !== void 0);
3377
+ }
3378
+ function localCheckouts(context) {
3379
+ const roots = [
3380
+ ...new Set([context.dialecteRoot, dirname11(resolve5(context.cwd))].filter(isDefined2))
3381
+ ];
3382
+ return roots.map(function checkoutLine(root) {
3383
+ const names = existsSync19(root) ? readdirSync10(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && join24(root, entry.name) !== resolve5(context.cwd)).filter((entry) => packageName(join24(root, entry.name))?.startsWith(DIALECTE_SCOPE)).map((entry) => entry.name).sort(TEXT_COLLATOR.compare) : [];
3384
+ return {
3385
+ status: "ok",
3386
+ subject: "checkouts",
3387
+ detail: names.length ? `${root}: ${names.slice(0, CHECKOUT_LIST_LIMIT).join(", ")}${names.length > CHECKOUT_LIST_LIMIT ? ` and ${names.length - CHECKOUT_LIST_LIMIT} more` : ""}` : `none in ${root} (the installed packages are the source)`
3388
+ };
3389
+ });
3390
+ }
3391
+ function declaredVersions(cwd) {
3392
+ const manifest = JSON.parse(readFileSync13(join24(cwd, "package.json"), "utf8"));
3393
+ const names = dependencyNames(cwd);
3394
+ return Object.fromEntries(
3395
+ names.map((name) => [
3396
+ name,
3397
+ String(
3398
+ manifest.dependencies?.[name] ?? manifest.devDependencies?.[name] ?? manifest.peerDependencies?.[name]
3399
+ )
3400
+ ])
3401
+ );
3402
+ }
3403
+ function installedVersion(params) {
3404
+ const folder = findInstalledPackage(params);
3405
+ if (!folder || !existsSync19(join24(folder, "package.json"))) return void 0;
3406
+ const version = JSON.parse(readFileSync13(join24(folder, "package.json"), "utf8")).version;
3407
+ return typeof version === "string" ? version : void 0;
3408
+ }
3409
+ function packageName(folder) {
3410
+ const path = join24(folder, "package.json");
3411
+ if (!existsSync19(path)) return void 0;
3412
+ const name = JSON.parse(readFileSync13(path, "utf8")).name;
3413
+ return typeof name === "string" ? name : void 0;
3414
+ }
3415
+ function isDefined2(value) {
3416
+ return value !== void 0;
3417
+ }
3418
+
3419
+ // src/lib/host/host.constants.ts
3420
+ var HOST_VENDOR_NAMES = ["github"];
3421
+ var HOST_READ_TIMEOUT_MS = 1e4;
3422
+ var HOST_WRITE_TIMEOUT_MS = 6e4;
3423
+ var BROWSER_OPENERS = {
3424
+ darwin: ["open"],
3425
+ win32: ["rundll32", "url.dll,FileProtocolHandler"],
3426
+ default: ["xdg-open"]
3427
+ };
3428
+ var OPEN_TIMEOUT_MS = 1e4;
3429
+ var HOST_READ_METHODS = [
3430
+ "readPullRequest",
3431
+ "readChecks",
3432
+ "readQueued",
3433
+ "probeStacks"
3434
+ ];
3435
+
3436
+ // src/lib/knowledge/standard/fill-message.constants.ts
3437
+ var PLACEHOLDER_PATTERN = /\{([^{}]+)\}/g;
3438
+
3439
+ // src/lib/knowledge/standard/fill-message.ts
3440
+ function fillMessage(params) {
3441
+ const { template, values } = params;
3442
+ return template.replace(
3443
+ PLACEHOLDER_PATTERN,
3444
+ function valueOf2(placeholder, name) {
3445
+ return Object.hasOwn(values, name) ? values[name] : placeholder;
3446
+ }
3447
+ );
3448
+ }
3449
+
3450
+ // src/lib/doctor/host-lines.ts
3451
+ function hostLines(params) {
3452
+ const { root, vendor, run } = params;
3453
+ const host = readAdapterOf({ host: params.host });
3454
+ const found = vendor.subject.find({ root, host, run, subject: vendor.subject.call });
3455
+ const reads = Object.entries(vendor.probes).map(function probeRead([subject, probe]) {
3456
+ return probe({
3457
+ root,
3458
+ host,
3459
+ run,
3460
+ subject,
3461
+ ...found.pullRequest !== void 0 && { pullRequest: found.pullRequest }
3462
+ });
3463
+ });
3464
+ return [
3465
+ found.line,
3466
+ ...reads,
3467
+ ...versionLines({ root, vendor, describe: params.describe }),
3468
+ gitLine({ root, readGitVersion: params.readGitVersion })
3469
+ ];
3470
+ }
3471
+ function readAdapterOf(params) {
3472
+ return Object.fromEntries(
3473
+ HOST_READ_METHODS.map(function readMethod(name) {
3474
+ return [name, params.host[name]];
3475
+ })
3476
+ );
3477
+ }
3478
+ function versionLines(params) {
3479
+ const { root, vendor } = params;
3480
+ return Object.entries(vendor.recordedVersions).map(function versionLine([part, recorded]) {
3481
+ const subject = `${vendor.tool} ${part}`;
3482
+ const answer = params.describe.versionOf({ root, selector: part });
3483
+ if ("absent" in answer)
3484
+ return {
3485
+ status: "warning",
3486
+ subject,
3487
+ detail: fillMessage({
3488
+ template: HOST_VERSION_TEXTS.absent,
3489
+ values: { absent: answer.absent, recorded }
3490
+ })
3491
+ };
3492
+ if ("refusal" in answer) return { status: "error", subject, detail: answer.refusal };
3493
+ const values = { version: answer.version, recorded };
3494
+ const order = compareVersions({ left: answer.version, right: recorded });
3495
+ if (order < 0)
3496
+ return {
3497
+ status: "warning",
3498
+ subject,
3499
+ detail: fillMessage({ template: HOST_VERSION_TEXTS.older, values }),
3500
+ fix: fillMessage({ template: UPGRADE_TOOL_FIX, values: { tool: subject, recorded } })
3501
+ };
3502
+ return {
3503
+ status: "ok",
3504
+ subject,
3505
+ detail: fillMessage({
3506
+ template: order > 0 ? HOST_VERSION_TEXTS.newer : HOST_VERSION_TEXTS.asRecorded,
3507
+ values
3508
+ })
3509
+ };
3510
+ });
3511
+ }
3512
+ function compareVersions(params) {
3513
+ const left = numbersOfVersion({ version: params.left });
3514
+ const right = numbersOfVersion({ version: params.right });
3515
+ for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
3516
+ const difference = (left[index] ?? 0) - (right[index] ?? 0);
3517
+ if (difference !== 0) return Math.sign(difference);
3518
+ }
3519
+ return 0;
3520
+ }
3521
+ function numbersOfVersion(params) {
3522
+ return params.version.split(".").map(function leadingNumber(part) {
3523
+ const digits = LEADING_DIGITS.exec(part)?.[0];
3524
+ return digits === void 0 ? 0 : Number(digits);
3525
+ });
3526
+ }
3527
+ function gitLine(params) {
3528
+ let text;
3529
+ try {
3530
+ text = params.readGitVersion({ root: params.root });
3531
+ } catch (error) {
3532
+ return {
3533
+ status: "error",
3534
+ subject: GIT_SUBJECT,
3535
+ detail: error instanceof Error ? error.message : String(error)
3536
+ };
3537
+ }
3538
+ const version = gitVersionOf({ text });
3539
+ if (version !== void 0 && !belowGitFloor({ version }))
3540
+ return { status: "ok", subject: GIT_SUBJECT, detail: version.line };
3541
+ return {
3542
+ status: "error",
3543
+ subject: GIT_SUBJECT,
3544
+ detail: fillMessage({
3545
+ template: HOST_VERSION_TEXTS.gitFloor,
3546
+ values: { floor: GIT_FLOOR.join("."), line: version?.line ?? (text.trim() || "nothing") }
3547
+ })
3548
+ };
3549
+ }
3550
+
3551
+ // src/lib/host/select-host.ts
3552
+ import { spawnSync as spawnSync6 } from "child_process";
3553
+ import { existsSync as existsSync22 } from "fs";
3554
+ import { homedir } from "os";
3555
+
3556
+ // src/lib/config/config-checks.ts
3557
+ function isMapping(value) {
3558
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3559
+ }
3560
+ function stringProblem(value) {
3561
+ return typeof value === "string" ? void 0 : "must be a text";
3562
+ }
3563
+ function hostVendorProblem(value) {
3564
+ const names = HOST_VENDOR_NAMES;
3565
+ return stringProblem(value) ?? (names.includes(String(value)) ? void 0 : `must be one of the known vendors: ${names.join(", ")}`);
3566
+ }
3567
+ function stringListProblem(value) {
3568
+ return Array.isArray(value) && value.every((item) => typeof item === "string") ? void 0 : "must be a list of texts";
3569
+ }
3570
+ function mappingProblem(value) {
3571
+ return isMapping(value) ? void 0 : "must be a mapping";
3572
+ }
3573
+ function unknownFieldProblem(params) {
3574
+ const unknown = Object.keys(params.value).find((field) => !params.allowed.includes(field));
3575
+ return unknown === void 0 ? void 0 : `has an unknown field '${unknown}' (allowed: ${params.allowed.join(", ")})`;
3576
+ }
3577
+ function referencesProblem(value) {
3578
+ if (!isMapping(value)) return "must be a mapping of allow and patterns";
3579
+ const unknown = unknownFieldProblem({ value, allowed: ["allow", "patterns"] });
3580
+ if (unknown !== void 0) return unknown;
3581
+ for (const field of ["allow", "patterns"]) {
3582
+ if (value[field] === void 0) continue;
3583
+ const problem = stringListProblem(value[field]);
3584
+ if (problem !== void 0) return `${field} ${problem}`;
3585
+ }
3586
+ return void 0;
3587
+ }
3588
+ function loadProblem(value) {
3589
+ if (!isMapping(value)) return "must be a mapping of budget";
3590
+ const unknown = unknownFieldProblem({ value, allowed: ["budget"] });
3591
+ if (unknown !== void 0) return unknown;
3592
+ const budget = value.budget;
3593
+ if (budget === void 0) return void 0;
3594
+ return typeof budget === "number" && Number.isInteger(budget) && budget >= 1 ? void 0 : "budget must be a whole number of 1 or more";
3595
+ }
3596
+ function corpusProblem(value) {
3597
+ if (!isMapping(value)) return "must be a mapping of xsd and instances";
3598
+ const unknown = unknownFieldProblem({ value, allowed: ["xsd", "instances"] });
3599
+ if (unknown !== void 0) return unknown;
3600
+ if (typeof value.xsd !== "string") return "needs xsd, the path of its XSD";
3601
+ if (value.instances !== void 0 && typeof value.instances !== "string")
3602
+ return "instances must be a text (a folder)";
3603
+ return void 0;
3604
+ }
3605
+ function corporaProblem(value) {
3606
+ if (!isMapping(value)) return "must be a mapping of corpus names";
3607
+ for (const [name, corpus] of Object.entries(value)) {
3608
+ const problem = corpusProblem(corpus);
3609
+ if (problem !== void 0) return `corpus '${name}' ${problem}`;
3610
+ }
3611
+ return void 0;
3612
+ }
3613
+
3614
+ // src/lib/config/config-keys.constants.ts
3615
+ var CONFIG_KEY_ENTRIES = [
3616
+ {
3617
+ key: "profile",
3618
+ layer: "project",
3619
+ repoOverride: false,
3620
+ description: "`contributor` (a package of the Dialecte family) or `consumer` (an app; the default).",
3621
+ problemOf: stringProblem
3622
+ },
3623
+ {
3624
+ key: "baseBranch",
3625
+ layer: "project",
3626
+ repoOverride: false,
3627
+ description: "The branch work is merged into (`main` when not said).",
3628
+ problemOf: stringProblem
3629
+ },
3630
+ {
3631
+ key: "gate",
3632
+ layer: "project",
3633
+ repoOverride: false,
3634
+ description: "Steps replacing the default ones of `dialecte gate` (fast, full, release, skip).",
3635
+ problemOf: mappingProblem
3636
+ },
3637
+ {
3638
+ key: "contrib",
3639
+ layer: "project",
3640
+ repoOverride: false,
3641
+ description: "The package steps of `dialecte contrib` (steps, skip).",
3642
+ problemOf: mappingProblem
3643
+ },
3644
+ {
3645
+ key: "tdd",
3646
+ layer: "project",
3647
+ repoOverride: false,
3648
+ description: "`dialecte tdd` settings (production: folders whose files are production code).",
3649
+ problemOf: mappingProblem
3650
+ },
3651
+ {
3652
+ key: "references",
3653
+ layer: "project",
3654
+ repoOverride: false,
3655
+ description: "allow: labels of generic patterns committed on purpose; patterns: regular expressions never committed.",
3656
+ problemOf: referencesProblem
3657
+ },
3658
+ {
3659
+ key: "mutation",
3660
+ layer: "project",
3661
+ repoOverride: false,
3662
+ description: "Mutation testing settings.",
3663
+ problemOf: mappingProblem
3664
+ },
3665
+ {
3666
+ key: "generatedDocs",
3667
+ layer: "project",
3668
+ repoOverride: false,
3669
+ description: "Files a docs build rewrites, restored byte for byte after `gate --full`.",
3670
+ problemOf: stringListProblem
3671
+ },
3672
+ {
3673
+ key: "risk",
3674
+ layer: "project",
3675
+ repoOverride: false,
3676
+ description: "Lot risk settings (high: globs of the shared concepts: a change there makes a lot high risk and needs an approved design).",
3677
+ problemOf: mappingProblem
3678
+ },
3679
+ {
3680
+ key: "rebuiltIgnored",
3681
+ layer: "project",
3682
+ repoOverride: false,
3683
+ description: "Ignored folders a build or a run rebuilds (`coverage/`): a worktree removal may delete them.",
3684
+ problemOf: stringListProblem
3685
+ },
3686
+ {
3687
+ key: "tsconfig",
3688
+ layer: "project",
3689
+ repoOverride: false,
3690
+ description: "The tsconfig of the type benchmarks.",
3691
+ problemOf: stringProblem
3692
+ },
3693
+ {
3694
+ key: "namespace",
3695
+ layer: "project",
3696
+ repoOverride: false,
3697
+ description: "The hydrated namespace of the dialect (the capitalized package name when not said).",
3698
+ problemOf: stringProblem
3699
+ },
3700
+ {
3701
+ key: "entry",
3702
+ layer: "project",
3703
+ repoOverride: false,
3704
+ description: "The import the type benchmarks read the dialect from.",
3705
+ problemOf: stringProblem
3706
+ },
3707
+ {
3708
+ key: "constantsDir",
3709
+ layer: "project",
3710
+ repoOverride: false,
3711
+ description: "The folder holding the generated constants of the dialect.",
3712
+ problemOf: stringProblem
3713
+ },
3714
+ {
3715
+ key: "out",
3716
+ layer: "project",
3717
+ repoOverride: false,
3718
+ description: "The folder the type benchmarks are written to.",
3719
+ problemOf: stringProblem
3720
+ },
3721
+ {
3722
+ key: "editor",
3723
+ layer: "personal",
3724
+ repoOverride: true,
3725
+ description: "The command opening a file in your editor.",
3726
+ problemOf: stringProblem
3727
+ },
3728
+ {
3729
+ key: "host",
3730
+ layer: "personal",
3731
+ repoOverride: true,
3732
+ description: "The host vendor of a repository whose origin names none (a self-hosted host), one of the known vendors.",
3733
+ problemOf: hostVendorProblem
3734
+ },
3735
+ {
3736
+ key: "load",
3737
+ layer: "personal",
3738
+ repoOverride: true,
3739
+ description: "Machine load settings (budget: a whole number of 1 or more).",
3740
+ problemOf: loadProblem
3741
+ },
3742
+ {
3743
+ key: "personProcesses",
3744
+ layer: "personal",
3745
+ repoOverride: true,
3746
+ description: "Your own tools' process names (a terminal, an editor), never counted as left behind in a worktree.",
3747
+ problemOf: stringListProblem
3748
+ },
3749
+ {
3750
+ key: "forbiddenWords",
3751
+ layer: "personal",
3752
+ repoOverride: true,
3753
+ description: "Words never committed, checked by `dialecte rules`.",
3754
+ problemOf: stringListProblem
3755
+ },
3756
+ {
3757
+ key: "consumerNames",
3758
+ layer: "personal",
3759
+ repoOverride: true,
3760
+ description: "The tools that consume a contributor package, which its committed text never names.",
3761
+ problemOf: stringListProblem
3762
+ },
3763
+ {
3764
+ key: "corpora",
3765
+ layer: "personal",
3766
+ repoOverride: false,
3767
+ description: "Licensed corpora by name: { xsd: path, instances?: folder }, never committed.",
3768
+ problemOf: corporaProblem
3769
+ }
3770
+ ];
3771
+ var CONFIG_KEYS = CONFIG_KEY_ENTRIES;
3772
+
3773
+ // src/lib/config/repo-key-of.ts
3774
+ import { existsSync as existsSync20, realpathSync as realpathSync4 } from "fs";
3775
+ import { dirname as dirname12, join as join25, posix, win32 } from "path";
3776
+
3777
+ // src/lib/config/find-old-homes.constants.ts
3778
+ var FORBIDDEN_WORDS_CONFIG_KEY = "forbiddenWords";
3779
+ var OLD_HOMES_LAST_READER = "cli 0.7";
3780
+ var GIT_KEY_NOTE = `git config {gitKey}: config.yml already holds it; run git config --unset {gitKey} once every repository is past ${OLD_HOMES_LAST_READER}`;
3781
+ var FORBIDDEN_WORDS_FILE_PROBLEM = `this file is no longer read and {file} ${FORBIDDEN_WORDS_CONFIG_KEY} lacks '{word}': add every word of this file there`;
3782
+ var FORBIDDEN_WORDS_FILE_NOTE = `{file}: config.yml ${FORBIDDEN_WORDS_CONFIG_KEY} already holds its words; delete it once every repository is past ${OLD_HOMES_LAST_READER}`;
3783
+ var GIT_KEY_EMPTY_NOTE = `git config {gitKey}: empty, nothing to migrate; run git config --unset {gitKey} once every repository is past ${OLD_HOMES_LAST_READER}`;
3784
+
3785
+ // src/lib/config/config.constants.ts
3786
+ var PROJECT_CONFIG_FILE_NAME = ".dialecterc";
3787
+ var PERSONAL_CONFIG_FOLDER_NAME = "dialecte";
3788
+ var PERSONAL_CONFIG_FILE_NAME = "config.yml";
3789
+ var CONFIG_SCHEMA_VERSION = 1;
3790
+ var CONFIG_SCHEMA_KEY = "schema";
3791
+ var CONFIG_REPOS_KEY = "repos";
3792
+ var REMOTE_SCHEME = /^[a-z][a-z0-9+.-]*:\/\//i;
3793
+ var FILE_URL_SCHEME = /^file:\/\//i;
3794
+ var FILE_URL_DRIVE = /^\/([a-zA-Z]:)/;
3795
+ var REMOTE_SCP_FORM = /^(?:[^@/]+@)?([^:/]+):(.*)$/;
3796
+ var REMOTE_FORMS_BY_SCHEME = {
3797
+ https: "https",
3798
+ http: "https",
3799
+ "git+https": "https",
3800
+ ssh: "ssh",
3801
+ "git+ssh": "ssh",
3802
+ "ssh+git": "ssh"
3803
+ };
3804
+ var CASE_FOLDING_PLATFORMS = ["win32", "darwin"];
3805
+ var CONFIG_LAYER_FILE_LABELS = {
3806
+ project: ".dialecterc",
3807
+ personal: "the personal config.yml"
3808
+ };
3809
+ var CONFIG_SOURCE_RANKS = [
3810
+ "repo",
3811
+ "personal",
3812
+ "project"
3813
+ ];
3814
+ var CONFIG_LAYERS = ["project", "personal"];
3815
+ var DUPLICATE_REPOS_ENTRY_PROBLEM = "repos entry '{repo}' names the same repository as an earlier entry: only the first is used";
3816
+
3817
+ // src/lib/config/normalize-remote.ts
3818
+ function hostAndPathOf(url) {
3819
+ const withoutScheme = url.replace(REMOTE_SCHEME, "");
3820
+ const scp = url === withoutScheme ? REMOTE_SCP_FORM.exec(url) : null;
3821
+ if (scp !== null) return { host: scp[1], path: scp[2], form: "scp" };
3822
+ const scheme = url.slice(0, url.length - withoutScheme.length).replace("://", "");
3823
+ const form = REMOTE_FORMS_BY_SCHEME[scheme.toLowerCase()];
3824
+ const slash = withoutScheme.indexOf("/");
3825
+ const authority = slash === -1 ? withoutScheme : withoutScheme.slice(0, slash);
3826
+ const path = slash === -1 ? "" : withoutScheme.slice(slash + 1);
3827
+ const host = authority.slice(authority.lastIndexOf("@") + 1).replace(/:\d*$/, "");
3828
+ return { host, path, ...form !== void 0 && { form } };
3829
+ }
3830
+ function normalizeRemote(url) {
3831
+ const { host, path } = hostAndPathOf(url.trim());
3832
+ const trimmedPath = path.replace(/^\/+|\/+$/g, "").replace(/\.git$/, "").replace(/\/+$/, "");
3833
+ return `${host.toLowerCase()}/${trimmedPath}`;
3834
+ }
3835
+
3836
+ // src/lib/config/repo-key-of.ts
3837
+ function comparablePathOf(params) {
3838
+ return CASE_FOLDING_PLATFORMS.includes(params.platform) ? params.path.toLowerCase() : params.path;
3839
+ }
3840
+ function comparableWrittenPathOf(params) {
3841
+ const flavour = params.platform === "win32" ? win32 : posix;
3842
+ const normalized = flavour.normalize(params.path);
3843
+ const isRoot = normalized === flavour.parse(normalized).root;
3844
+ const trimmed = !isRoot && normalized.endsWith(flavour.sep) ? normalized.slice(0, -flavour.sep.length) : normalized;
3845
+ return comparablePathOf({ path: trimmed, platform: params.platform });
3846
+ }
3847
+ function repositoryTopOf(folder) {
3848
+ let current = folder;
3849
+ while (!existsSync20(join25(current, GIT_ENTRY))) {
3850
+ const parent = dirname12(current);
3851
+ if (parent === current) return folder;
3852
+ current = parent;
3853
+ }
3854
+ return current;
3855
+ }
3856
+ function pathOfFileUrl(params) {
3857
+ const path = decodeURIComponent(new URL(params.url).pathname);
3858
+ if (params.platform !== "win32") return path;
3859
+ return win32.normalize(path.replace(FILE_URL_DRIVE, "$1"));
3860
+ }
3861
+ function normalizeRepoKey(params) {
3862
+ const { key, platform } = params;
3863
+ if (FILE_URL_SCHEME.test(key))
3864
+ return comparableWrittenPathOf({ path: pathOfFileUrl({ url: key, platform }), platform });
3865
+ return isPathKey(key) ? comparableWrittenPathOf({ path: key, platform }) : normalizeRemote(key);
3866
+ }
3867
+ function isPathKey(key) {
3868
+ return posix.isAbsolute(key) || win32.isAbsolute(key);
3869
+ }
3870
+ function remoteOf(origin) {
3871
+ if (FILE_URL_SCHEME.test(origin) || isPathKey(origin)) return void 0;
3872
+ const { host, form } = hostAndPathOf(origin);
3873
+ return form === void 0 || host === "" ? void 0 : { host: host.toLowerCase(), form };
3874
+ }
3875
+ function repoKeyOf(params) {
3876
+ const origin = tryReadGit({ root: params.root, args: ["remote", "get-url", "origin"] })?.trim();
3877
+ if (origin) {
3878
+ const key = normalizeRepoKey({ key: origin, platform: params.platform });
3879
+ const remote = remoteOf(origin);
3880
+ return { key, from: "remote", ...remote !== void 0 && { remote } };
3881
+ }
3882
+ const path = repositoryTopOf(realpathSync4(params.root));
3883
+ return { key: comparablePathOf({ path, platform: params.platform }), from: "path" };
3884
+ }
3885
+
3886
+ // src/lib/config/resolve-config.ts
3887
+ import { join as join26 } from "path";
3888
+
3889
+ // src/lib/config/check-config-entry.ts
3890
+ function refusalOf(params) {
3891
+ const { entry, spec } = params;
3892
+ if (spec.layer !== params.layer)
3893
+ return `'${entry.key}' is a ${spec.layer} setting: it belongs in ${CONFIG_LAYER_FILE_LABELS[spec.layer]}, not in ${CONFIG_LAYER_FILE_LABELS[params.layer]}`;
3894
+ if (params.inRepos && !spec.repoOverride)
3895
+ return `'${entry.key}' cannot be set per repository: set it at the top level of ${CONFIG_LAYER_FILE_LABELS.personal}`;
3896
+ const problem = spec.problemOf(entry.value);
3897
+ return problem === void 0 ? void 0 : `'${entry.key}' ${problem}`;
3898
+ }
3899
+ function checkConfigEntry(params) {
3900
+ const { entry, layer } = params;
3901
+ const spec = params.keys.find((candidate) => candidate.key === entry.key);
3902
+ if (spec !== void 0) {
3903
+ const problem = refusalOf({ entry, spec, layer, inRepos: params.inRepos });
3904
+ return problem === void 0 ? { verdict: "accepted" } : { verdict: "refused", problem };
3905
+ }
3906
+ if (layer === "project" && entry.key === CONFIG_REPOS_KEY)
3907
+ return {
3908
+ verdict: "refused",
3909
+ problem: `'repos' holds personal overrides: it belongs in ${CONFIG_LAYER_FILE_LABELS.personal}, never in a committed file`
3910
+ };
3911
+ return { verdict: "unknown", problem: `'${entry.key}' is not a ${layer} setting (unknown key)` };
3912
+ }
3913
+
3914
+ // src/lib/config/personal-config-file-of.ts
3915
+ import { posix as posix3, win32 as win323 } from "path";
3916
+
3917
+ // src/lib/config/personal-config-folder-of.ts
3918
+ import { posix as posix2, win32 as win322 } from "path";
3919
+ function personalConfigFolderOf(params) {
3920
+ const xdg = params.environment.XDG_CONFIG_HOME;
3921
+ if (params.platform === "win32") {
3922
+ const appData = params.environment.APPDATA;
3923
+ const base = xdg || appData || win322.join(params.home, "AppData", "Roaming");
3924
+ return win322.join(base, PERSONAL_CONFIG_FOLDER_NAME);
3925
+ }
3926
+ return posix2.join(xdg || posix2.join(params.home, ".config"), PERSONAL_CONFIG_FOLDER_NAME);
3927
+ }
3928
+
3929
+ // src/lib/config/personal-config-file-of.ts
3930
+ function personalConfigFileOf(params) {
3931
+ const join34 = params.platform === "win32" ? win323.join : posix3.join;
3932
+ return join34(personalConfigFolderOf(params), PERSONAL_CONFIG_FILE_NAME);
3933
+ }
3934
+
3935
+ // src/lib/config/read-config-file.ts
3936
+ import { existsSync as existsSync21, readFileSync as readFileSync14 } from "fs";
3937
+
3938
+ // src/lib/error-reason.ts
3939
+ function errorReasonOf(error) {
3940
+ if (error instanceof Error && "code" in error && typeof error.code === "string") return error.code;
3941
+ return error instanceof Error ? error.message : String(error);
3942
+ }
3943
+
3944
+ // src/lib/config/read-config-file.ts
3945
+ import { isMap, isNode, isScalar, LineCounter, parseDocument, YAMLMap } from "yaml";
3946
+ function lineOfPair(params) {
3947
+ const start = isNode(params.pair.key) ? params.pair.key.range?.[0] : void 0;
3948
+ return start === void 0 ? 1 : params.parsed.lineCounter.linePos(start).line;
3949
+ }
3950
+ function keyOfPair(pair) {
3951
+ return String(isScalar(pair.key) ? pair.key.value : pair.key);
3952
+ }
3953
+ function valueOfPair(params) {
3954
+ const value = params.pair.value;
3955
+ return isNode(value) ? value.toJS(params.parsed.document) : value;
3956
+ }
3957
+ function entriesOf(params) {
3958
+ return params.map.items.filter((pair) => !(params.skipSchema && keyOfPair(pair) === CONFIG_SCHEMA_KEY)).map((pair) => ({
3959
+ key: keyOfPair(pair),
3960
+ value: valueOfPair({ parsed: params.parsed, pair }),
3961
+ line: lineOfPair({ parsed: params.parsed, pair })
3962
+ }));
3963
+ }
3964
+ function reposOf(params) {
3965
+ const { parsed, pair } = params;
3966
+ const file = parsed.file;
3967
+ if (!isMap(pair.value)) {
3968
+ const line = lineOfPair({ parsed, pair });
3969
+ return {
3970
+ repos: [],
3971
+ findings: [
3972
+ { file, line, key: CONFIG_REPOS_KEY, problem: "repos must be a mapping of repositories" }
3973
+ ]
3974
+ };
3975
+ }
3976
+ const repos = [];
3977
+ const findings = [];
3978
+ for (const repoPair of pair.value.items) {
3979
+ const repo = keyOfPair(repoPair);
3980
+ const line = lineOfPair({ parsed, pair: repoPair });
3981
+ if (isMap(repoPair.value))
3982
+ repos.push({
3983
+ repo,
3984
+ line,
3985
+ entries: entriesOf({ parsed, map: repoPair.value, skipSchema: false })
3986
+ });
3987
+ else
3988
+ findings.push({
3989
+ file,
3990
+ line,
3991
+ key: CONFIG_REPOS_KEY,
3992
+ problem: `repos entry '${repo}' must be a mapping of settings`
3993
+ });
3994
+ }
3995
+ return { repos, findings };
3996
+ }
3997
+ function schemaFindings(params) {
3998
+ const pair = params.map.items.find((item) => keyOfPair(item) === CONFIG_SCHEMA_KEY);
3999
+ const file = params.parsed.file;
4000
+ const key = CONFIG_SCHEMA_KEY;
4001
+ if (pair === void 0)
4002
+ return [
4003
+ {
4004
+ file,
4005
+ line: 1,
4006
+ key,
4007
+ problem: `schema is missing: write schema: ${CONFIG_SCHEMA_VERSION} first`
4008
+ }
4009
+ ];
4010
+ const value = valueOfPair({ parsed: params.parsed, pair });
4011
+ if (value === CONFIG_SCHEMA_VERSION) return [];
4012
+ const line = lineOfPair({ parsed: params.parsed, pair });
4013
+ return [
4014
+ {
4015
+ file,
4016
+ line,
4017
+ key,
4018
+ problem: `schema ${JSON.stringify(value) ?? String(value)} is not the version this cli reads (${CONFIG_SCHEMA_VERSION})`
4019
+ }
4020
+ ];
4021
+ }
4022
+ function readMapping(params) {
4023
+ const { parsed, map } = params;
4024
+ const reposPair = params.layer === "personal" ? map.items.find((pair) => keyOfPair(pair) === CONFIG_REPOS_KEY) : void 0;
4025
+ const entries = entriesOf({ parsed, map, skipSchema: true }).filter(
4026
+ (entry) => reposPair === void 0 || entry.key !== CONFIG_REPOS_KEY
4027
+ );
4028
+ const reposRead = reposPair === void 0 ? { repos: [], findings: [] } : reposOf({ parsed, pair: reposPair });
4029
+ const findings = [...schemaFindings({ parsed, map }), ...reposRead.findings];
4030
+ return { missing: false, file: parsed.file, entries, repos: reposRead.repos, findings };
4031
+ }
4032
+ function refusedRead(params) {
4033
+ return { missing: false, file: params.file, entries: [], repos: [], findings: [params] };
4034
+ }
4035
+ function textOrReason(file) {
4036
+ try {
4037
+ return { text: readFileSync14(file, "utf8") };
4038
+ } catch (error) {
4039
+ return { reason: errorReasonOf(error) };
4040
+ }
4041
+ }
4042
+ function readConfigFile(params) {
4043
+ const file = params.file;
4044
+ if (!existsSync21(file)) return { missing: true, file };
4045
+ const read = textOrReason(file);
4046
+ if ("reason" in read)
4047
+ return refusedRead({ file, line: 0, problem: `cannot be read: ${read.reason}` });
4048
+ const lineCounter = new LineCounter();
4049
+ const document = parseDocument(read.text, { lineCounter, prettyErrors: false });
4050
+ const error = document.errors[0];
4051
+ if (error !== void 0) {
4052
+ const line = lineCounter.linePos(error.pos[0]).line;
4053
+ return refusedRead({ file, line, problem: `not valid YAML: ${error.message.split("\n")[0]}` });
4054
+ }
4055
+ const contents = document.contents;
4056
+ if (contents !== null && !isMap(contents))
4057
+ return refusedRead({ file, line: 1, problem: "not a mapping of settings at top level" });
4058
+ const parsed = { file, document, lineCounter };
4059
+ return readMapping({ parsed, map: contents ?? new YAMLMap(), layer: params.layer });
4060
+ }
4061
+
4062
+ // src/lib/config/resolve-config.ts
4063
+ function readEntries(params) {
4064
+ const checks = [];
4065
+ const candidates = [];
4066
+ for (const entry of params.entries) {
4067
+ const result = checkConfigEntry({ ...params, entry });
4068
+ const source = params.sourceOf(entry);
4069
+ if (result.verdict === "accepted") {
4070
+ if (source !== void 0) candidates.push({ key: entry.key, value: entry.value, source });
4071
+ continue;
4072
+ }
4073
+ const finding = { file: params.file, line: entry.line, key: entry.key, problem: result.problem };
4074
+ checks.push({ finding, refused: result.verdict === "refused" });
4075
+ }
4076
+ return { checks, candidates };
4077
+ }
4078
+ function readRepos(params) {
4079
+ const { file } = params;
4080
+ const seen = /* @__PURE__ */ new Set();
4081
+ return params.repos.map((repoEntry) => {
4082
+ const repo = normalizeRepoKey({ key: repoEntry.repo, platform: params.platform });
4083
+ const duplicate = seen.has(repo);
4084
+ seen.add(repo);
4085
+ const matches = !duplicate && repo === params.repoKey;
4086
+ const read = readEntries({
4087
+ entries: repoEntry.entries,
4088
+ file,
4089
+ layer: params.layer,
4090
+ inRepos: true,
4091
+ keys: params.keys,
4092
+ sourceOf: (entry) => matches ? { kind: "repo", file, line: entry.line, repo } : void 0
4093
+ });
4094
+ if (!duplicate) return read;
4095
+ const finding = {
4096
+ file,
4097
+ line: repoEntry.line,
4098
+ key: CONFIG_REPOS_KEY,
4099
+ problem: DUPLICATE_REPOS_ENTRY_PROBLEM.replace("{repo}", repoEntry.repo)
4100
+ };
4101
+ return { ...read, checks: [{ finding, refused: false }, ...read.checks] };
4102
+ });
4103
+ }
4104
+ function readLayer(params) {
4105
+ const { file, layer, keys } = params;
4106
+ const read = readConfigFile({ file, layer });
4107
+ if (read.missing) return { checks: [], candidates: [] };
4108
+ const fileChecks = read.findings.map((finding) => ({ finding, refused: true }));
4109
+ const top = readEntries({
4110
+ entries: read.entries,
4111
+ file,
4112
+ layer,
4113
+ inRepos: false,
4114
+ keys,
4115
+ sourceOf: (entry) => ({ kind: layer, file, line: entry.line })
4116
+ });
4117
+ const repos = readRepos({ ...params, repos: read.repos });
4118
+ const parts = [top, ...repos];
4119
+ const candidates = fileChecks.length > 0 ? [] : parts.flatMap((part) => part.candidates);
4120
+ const checks = [...fileChecks, ...parts.flatMap((part) => part.checks)].sort(
4121
+ (left, right) => left.finding.line - right.finding.line
4122
+ );
4123
+ return { checks, candidates };
4124
+ }
4125
+ function valueOf(params) {
4126
+ const { spec } = params;
4127
+ const variableText = spec.environment === void 0 ? void 0 : params.environment[spec.environment];
4128
+ if (spec.environment !== void 0 && variableText !== void 0 && variableText !== "")
4129
+ return {
4130
+ key: spec.key,
4131
+ value: variableText,
4132
+ source: { kind: "environment", variable: spec.environment }
4133
+ };
4134
+ const ofKey = params.candidates.filter((candidate) => candidate.key === spec.key);
4135
+ for (const kind of CONFIG_SOURCE_RANKS) {
4136
+ const found = ofKey.find((candidate) => candidate.source.kind === kind);
4137
+ if (found !== void 0) return found;
4138
+ }
4139
+ return void 0;
4140
+ }
4141
+ function resolveConfig(context) {
4142
+ const keys = context.keys ?? CONFIG_KEYS;
4143
+ const layers = context.layers ?? CONFIG_LAYERS;
4144
+ const projectFile = join26(context.root, PROJECT_CONFIG_FILE_NAME);
4145
+ const personalFile = personalConfigFileOf(context);
4146
+ const repoKey = layers.includes("personal") ? repoKeyOf({ root: context.root, platform: context.platform }) : void 0;
4147
+ const repo = repoKey && { key: repoKey.key, from: repoKey.from };
4148
+ const layerOf = { keys, repoKey: repo?.key, platform: context.platform };
4149
+ const files = { project: projectFile, personal: personalFile };
4150
+ const reads = CONFIG_LAYERS.filter((layer) => layers.includes(layer)).map(
4151
+ (layer) => readLayer({ ...layerOf, file: files[layer], layer })
4152
+ );
4153
+ const checks = reads.flatMap((read) => read.checks);
4154
+ const candidates = reads.flatMap((read) => read.candidates);
4155
+ const values = keys.filter((spec) => layers.includes(spec.layer)).map((spec) => valueOf({ spec, environment: context.environment, candidates })).filter((value) => value !== void 0);
4156
+ return {
4157
+ projectFile,
4158
+ personalFile,
4159
+ repo,
4160
+ values,
4161
+ refusals: checks.filter((check) => check.refused).map((check) => check.finding),
4162
+ findings: checks.map((check) => check.finding)
4163
+ };
4164
+ }
4165
+
4166
+ // src/lib/host/github/github.constants.ts
4167
+ var GITHUB_VENDOR_NAME = "github";
4168
+ var GITHUB_REMOTE_HOSTS = ["github.com", "ssh.github.com"];
4169
+ var GH_COMMAND = "gh";
4170
+ var QUEUED_QUERY = "query($owner:String!,$repo:String!,$number:Int!){repository(owner:$owner,name:$repo){pullRequest(number:$number){isInMergeQueue autoMergeRequest{enabledAt}}}}";
4171
+ var HOST_ENVIRONMENT = {
4172
+ GH_PROMPT_DISABLED: "1",
4173
+ GIT_TERMINAL_PROMPT: "0",
4174
+ // what gh writes is parsed: never coloured, whatever the caller's terminal asks
4175
+ NO_COLOR: "1",
4176
+ CLICOLOR_FORCE: "0",
4177
+ GH_FORCE_TTY: ""
4178
+ };
4179
+ var NO_PULL_REQUEST_PATTERN = /no (open )?pull requests? found/i;
4180
+ var REVIEW_COMMENTS_ENDPOINT = "repos/{owner}/{repo}/pulls/{number}/comments";
4181
+ var REVIEW_COMMENTS_JQ = ".[] | {id, path, line: (.line // .original_line), body, replyTo: .in_reply_to_id}";
4182
+ var PASSING_CONCLUSIONS = ["SUCCESS", "NEUTRAL", "SKIPPED"];
4183
+ var COMPLETED_STATUS = "COMPLETED";
4184
+ var PASSING_STATUS_STATE = "SUCCESS";
4185
+ var PENDING_STATUS_STATES = ["PENDING", "EXPECTED"];
4186
+ var STATUS_CONTEXT_TYPE = "StatusContext";
4187
+ var GH_STACK = "stack";
4188
+ var NO_STACKS_REASON = "gh stack is not installed";
4189
+ var FILES_TAB_SUFFIX = "/files";
4190
+ var REVIEW_PROBE = { owner: "cli", repo: "cli", number: "15071" };
4191
+ var NO_SUCH_BRANCH = "zz-dialecte-no-such-branch-probe";
4192
+ var GITHUB_SUBJECT_CALL = "listMergedPullRequests";
4193
+ var MERGED_STATE = "merged";
4194
+ var ONE_PULL_REQUEST = "1";
4195
+ var GH_STACK_INSTALL = "gh extension install github/gh-stack";
4196
+ var GITHUB_PROBE_TEXTS = {
4197
+ nothingToProbe: "gh pr list: no merged pull request, nothing to probe",
4198
+ notTheJson: "gh pr list: not the JSON it writes: {text}",
4199
+ newestMerged: "pull request #{number}, the newest merged",
4200
+ needsPullRequest: "no merged pull request to read: nothing to probe",
4201
+ pullRequestRead: "#{number} read; a branch with none reads as no pull request",
4202
+ pullRequestNone: "#{number} reads as no pull request",
4203
+ noPullRequestTextChanged: "the text gh prints for no pull request changed: {refusal}",
4204
+ checksRead: "#{number}: checks {state}",
4205
+ queuedRead: "#{number}: queued {queued}",
4206
+ commentsRead: "{reference}: {count} comments, {lines} on a line, {replies} replies",
4207
+ commentKeysChanged: "review-comment keys changed: {reference} reads {lines} comments on a line and {replies} replies, at least one of each expected",
4208
+ stacksOn: "gh stack answers",
4209
+ stacksOff: "{why}: stacks off"
4210
+ };
4211
+
4212
+ // src/lib/host/github/github-calls.constants.ts
4213
+ var GITHUB_CALLS = {
4214
+ viewPullRequest: {
4215
+ words: ["pr", "view"],
4216
+ flags: [],
4217
+ kind: "read",
4218
+ fields: [
4219
+ "number",
4220
+ "url",
4221
+ "title",
4222
+ "body",
4223
+ "state",
4224
+ "isDraft",
4225
+ "autoMergeRequest",
4226
+ "headRefOid",
4227
+ "baseRefName"
4228
+ ]
4229
+ },
4230
+ viewChecks: {
4231
+ words: ["pr", "view"],
4232
+ flags: [],
4233
+ kind: "read",
4234
+ fields: ["headRefOid", "statusCheckRollup"]
4235
+ },
4236
+ listMergedPullRequests: {
4237
+ words: ["pr", "list"],
4238
+ flags: ["--state", "--limit"],
4239
+ kind: "read",
4240
+ fields: ["number"]
4241
+ },
4242
+ createPullRequest: {
4243
+ words: ["pr", "create"],
4244
+ flags: ["--base", "--head", "--title", "--body", "--draft"],
4245
+ kind: "write"
4246
+ },
4247
+ readyPullRequest: { words: ["pr", "ready"], flags: ["--undo"], kind: "write" },
4248
+ mergePullRequest: { words: ["pr", "merge"], flags: ["--auto", "--disable-auto"], kind: "write" },
4249
+ editPullRequest: {
4250
+ words: ["pr", "edit"],
4251
+ flags: ["--base", "--title", "--body-file"],
4252
+ kind: "write"
4253
+ },
4254
+ closePullRequest: { words: ["pr", "close"], flags: [], kind: "write" },
4255
+ reviewComments: {
4256
+ words: ["api"],
4257
+ flags: ["--paginate"],
4258
+ kind: "read",
4259
+ endpoint: REVIEW_COMMENTS_ENDPOINT,
4260
+ filter: REVIEW_COMMENTS_JQ
4261
+ },
4262
+ queuedState: {
4263
+ words: ["api"],
4264
+ flags: ["-F"],
4265
+ kind: "read",
4266
+ endpoint: "graphql",
4267
+ graphql: QUEUED_QUERY,
4268
+ filter: ".data.repository.pullRequest"
4269
+ },
4270
+ stackHelp: { words: [GH_STACK], flags: ["--help"], kind: "read" },
4271
+ stackLink: { words: [GH_STACK, "link"], flags: [], kind: "write" },
4272
+ stackMerge: { words: [GH_STACK, "merge"], flags: ["--yes", "--squash"], kind: "write" }
4273
+ };
4274
+
4275
+ // src/lib/host/github/github-contract.constants.ts
4276
+ var GITHUB_RECORDED_VERSIONS = { cli: "2.104.0", stack: "0.3.0" };
4277
+
4278
+ // src/lib/host/github/github-host.ts
4279
+ import { spawnSync as spawnSync5 } from "child_process";
4280
+
4281
+ // src/lib/host/github/github-reads.ts
4282
+ function checksOf(params) {
4283
+ const parsed = objectOf(params.text);
4284
+ if (parsed === void 0 || typeof parsed.headRefOid !== "string")
4285
+ return { refusal: `gh pr view: no head in ${params.text.slice(0, 80)}` };
4286
+ const rollup = newestRuns(Array.isArray(parsed.statusCheckRollup) ? parsed.statusCheckRollup : []);
4287
+ const failing = [];
4288
+ const pending = [];
4289
+ for (const check of rollup) {
4290
+ const outcome = outcomeOf(check);
4291
+ const name = String(check.name ?? check.context ?? "");
4292
+ if (outcome === "failing") failing.push(name);
4293
+ else if (outcome === "pending") pending.push(name);
4294
+ }
4295
+ const state = failing.length > 0 ? "failing" : pending.length > 0 ? "pending" : rollup.length === 0 ? "none" : "green";
4296
+ return { head: parsed.headRefOid, state, failing, pending };
4297
+ }
4298
+ function reviewCommentsOf(params) {
4299
+ const comments = [];
4300
+ for (const line of params.text.split("\n")) {
4301
+ if (line.trim() === "") continue;
4302
+ const parsed = objectOf(line);
4303
+ if (parsed === void 0 || typeof parsed.id !== "number" || typeof parsed.path !== "string" || typeof parsed.body !== "string")
4304
+ return { refusal: `gh api: not a review comment: ${line.slice(0, 80)}` };
4305
+ comments.push({
4306
+ id: parsed.id,
4307
+ path: parsed.path,
4308
+ ...typeof parsed.line === "number" && { line: parsed.line },
4309
+ body: parsed.body,
4310
+ ...typeof parsed.replyTo === "number" && { replyTo: parsed.replyTo }
4311
+ });
4312
+ }
4313
+ return comments;
4314
+ }
4315
+ function newestRuns(rollup) {
4316
+ const newest = /* @__PURE__ */ new Map();
4317
+ for (const entry of rollup) {
4318
+ const check = typeof entry === "object" && entry !== null ? entry : {};
4319
+ const key = check.__typename === STATUS_CONTEXT_TYPE ? `${STATUS_CONTEXT_TYPE}:${String(check.context ?? "")}` : `${String(check.workflowName ?? "")}:${String(check.name ?? "")}`;
4320
+ const kept = newest.get(key);
4321
+ if (kept === void 0 || isNewer({ check, than: kept })) newest.set(key, check);
4322
+ }
4323
+ return [...newest.values()];
4324
+ }
4325
+ function isNewer(params) {
4326
+ const running = isRunning(params.check);
4327
+ if (running !== isRunning(params.than)) return running;
4328
+ return timeOf(params.check) >= timeOf(params.than);
4329
+ }
4330
+ function isRunning(check) {
4331
+ return check.__typename !== STATUS_CONTEXT_TYPE && check.status !== COMPLETED_STATUS;
4332
+ }
4333
+ function timeOf(check) {
4334
+ return String(check.startedAt ?? check.completedAt ?? "");
4335
+ }
4336
+ function outcomeOf(check) {
4337
+ if (check.__typename === STATUS_CONTEXT_TYPE) {
4338
+ const state = String(check.state ?? "");
4339
+ if (state === PASSING_STATUS_STATE) return "passed";
4340
+ return PENDING_STATUS_STATES.includes(state) ? "pending" : "failing";
4341
+ }
4342
+ if (check.status !== COMPLETED_STATUS) return "pending";
4343
+ return PASSING_CONCLUSIONS.includes(String(check.conclusion)) ? "passed" : "failing";
4344
+ }
4345
+ function objectOf(text) {
4346
+ try {
4347
+ const parsed = JSON.parse(text);
4348
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
4349
+ } catch {
4350
+ return void 0;
4351
+ }
4352
+ }
4353
+
4354
+ // src/lib/host/github/run-gh.ts
4355
+ import { spawnSync as spawnSync4 } from "child_process";
4356
+
4357
+ // src/lib/host/github/github-describe.constants.ts
4358
+ var HELP_FLAG_SECTIONS = ["FLAGS", "INHERITED FLAGS", "Flags:"];
4359
+ var HELP_FLAG_LINE = /^\s+(?:(-[A-Za-z0-9]),\s+)?(--[A-Za-z0-9][\w-]*)/;
4360
+ var JSON_FIELD_LINE = /^\s+(\w+)\s*$/;
4361
+ var INTROSPECTED_TYPE_SELECTION = "{name fields(includeDeprecated:true){name args{name} type{name ofType{name ofType{name ofType{name}}}}}}";
4362
+ var VERSION_PATTERN = /\bversion\s+v?(\d+\.\d+\.\d+)/;
4363
+ var UNKNOWN_COMMAND_PATTERN = /unknown command "([^"]+)" for "/;
4364
+ var VERSION_FLAG = "--version";
4365
+ var HELP_FLAG = "--help";
4366
+ var JSON_FLAG = "--json";
4367
+ var QUERY_FIELD_FLAG = "-f";
4368
+ var TOOL_SELECTOR = "cli";
4369
+ var FILTER_FLAG = "--jq";
4370
+
4371
+ // src/lib/host/github/github-describe.ts
4372
+ function flagsOfHelp(params) {
4373
+ const lines = params.text.split(/\r?\n/);
4374
+ const flags = [];
4375
+ const aliases = [];
4376
+ let inSection = false;
4377
+ for (const line of lines) {
4378
+ if (isFlagSection({ line })) {
4379
+ inSection = true;
4380
+ continue;
4381
+ }
4382
+ if (line.trim() === "" || !/^\s/.test(line)) {
4383
+ inSection = false;
4384
+ continue;
4385
+ }
4386
+ const match = inSection ? HELP_FLAG_LINE.exec(line) : null;
4387
+ if (!match) continue;
4388
+ const [, short, long] = match;
4389
+ if (short) {
4390
+ flags.push(short);
4391
+ aliases.push({ short, long });
4392
+ }
4393
+ flags.push(long);
4394
+ }
4395
+ return { flags, aliases };
4396
+ }
4397
+ function isFlagSection(params) {
4398
+ const heading = params.line.trimEnd();
4399
+ return HELP_FLAG_SECTIONS.some(function isHeading(section) {
4400
+ return section === heading;
4401
+ });
4402
+ }
4403
+ function fieldsOfJsonList(params) {
4404
+ return params.text.split(/\r?\n/).flatMap(function fieldOfLine(line) {
4405
+ const match = JSON_FIELD_LINE.exec(line);
4406
+ return match?.[1] === void 0 ? [] : [match[1]];
4407
+ });
4408
+ }
4409
+ function introspectionQueryOf(params) {
4410
+ return `{__type(name:${JSON.stringify(params.name)})${INTROSPECTED_TYPE_SELECTION}}`;
4411
+ }
4412
+ function fieldsOfIntrospection(params) {
4413
+ const answer = parsedIntrospection({ text: params.text });
4414
+ const fields = answer?.data?.__type?.fields;
4415
+ if (!fields) return void 0;
4416
+ return Object.fromEntries(
4417
+ fields.map(function entryOfField(field) {
4418
+ return [
4419
+ field.name,
4420
+ {
4421
+ type: namedTypeOf({ ref: field.type }),
4422
+ args: field.args.map(function nameOfArg(arg) {
4423
+ return arg.name;
4424
+ })
4425
+ }
4426
+ ];
4427
+ })
4428
+ );
4429
+ }
4430
+ function parsedIntrospection(params) {
4431
+ try {
4432
+ const parsed = JSON.parse(params.text);
4433
+ return typeof parsed === "object" && parsed !== null ? parsed : void 0;
4434
+ } catch {
4435
+ return void 0;
4436
+ }
4437
+ }
4438
+ function namedTypeOf(params) {
4439
+ const { ref } = params;
4440
+ if (ref.name !== null) return ref.name;
4441
+ return ref.ofType ? namedTypeOf({ ref: ref.ofType }) : "";
4442
+ }
4443
+ function versionOfText(params) {
4444
+ return VERSION_PATTERN.exec(params.text)?.[1];
4445
+ }
4446
+
4447
+ // src/lib/host/github/run-gh.ts
4448
+ function impliedFlagsOf(spec) {
4449
+ return [
4450
+ ...spec.fields === void 0 ? [] : [JSON_FLAG, spec.fields.join(",")],
4451
+ ...spec.graphql === void 0 ? [] : [QUERY_FIELD_FLAG, `query=${spec.graphql}`],
4452
+ ...spec.filter === void 0 ? [] : [FILTER_FLAG, spec.filter]
4453
+ ];
4454
+ }
4455
+ function runGh(params) {
4456
+ const spec = GITHUB_CALLS[params.call];
4457
+ const args = [
4458
+ ...spec.words,
4459
+ ...spec.endpoint === void 0 ? [] : [endpointOf({ endpoint: spec.endpoint, values: params.values ?? {} })],
4460
+ ...params.positional ?? [],
4461
+ ...optionArgsOf(params.options ?? {}),
4462
+ ...impliedFlagsOf(spec)
4463
+ ];
4464
+ const run = spawnGh({
4465
+ root: params.root,
4466
+ args,
4467
+ timeout: spec.kind === "read" ? HOST_READ_TIMEOUT_MS : HOST_WRITE_TIMEOUT_MS,
4468
+ input: params.input
4469
+ });
4470
+ if (run.status === 0) return { output: run.stdout };
4471
+ return refusalOf2({ run, args });
4472
+ }
4473
+ function endpointOf(params) {
4474
+ return params.endpoint.replaceAll(/\{(\w+)\}/g, function fill(placeholder, name) {
4475
+ return params.values[name] ?? placeholder;
4476
+ });
4477
+ }
4478
+ function optionArgsOf(options) {
4479
+ return Object.entries(options).flatMap(function argsOfOption([flag, value]) {
4480
+ if (value === void 0) return [];
4481
+ if (value === true) return [flag];
4482
+ if (typeof value === "string") return [flag, value];
4483
+ return value.flatMap(function repeat(each) {
4484
+ return [flag, each];
4485
+ });
4486
+ });
4487
+ }
4488
+ function helpOf(params) {
4489
+ const args = [...params.words, HELP_FLAG];
4490
+ const run = spawnGh({ root: params.root, args, timeout: HOST_READ_TIMEOUT_MS });
4491
+ if (run.status !== 0) return refusalOf2({ run, args });
4492
+ return { raw: run.stdout, ...flagsOfHelp({ text: run.stdout }) };
4493
+ }
4494
+ function fieldsOf(params) {
4495
+ const args = [...params.words, JSON_FLAG];
4496
+ const run = spawnGh({ root: params.root, args, timeout: HOST_READ_TIMEOUT_MS });
4497
+ const fields = run.error ? [] : fieldsOfJsonList({ text: run.stderr });
4498
+ if (!fields.length) return refusalOf2({ run, args });
4499
+ return { raw: run.stderr, fields };
4500
+ }
4501
+ function typeOf(params) {
4502
+ const args = [
4503
+ ...GITHUB_CALLS.queuedState.words,
4504
+ GITHUB_CALLS.queuedState.endpoint,
4505
+ QUERY_FIELD_FLAG,
4506
+ `query=${introspectionQueryOf({ name: params.name })}`
4507
+ ];
4508
+ const run = spawnGh({ root: params.root, args, timeout: HOST_READ_TIMEOUT_MS });
4509
+ if (run.status !== 0) return refusalOf2({ run, args });
4510
+ const fields = fieldsOfIntrospection({ text: run.stdout });
4511
+ if (!fields)
4512
+ return { refusal: `${GH_COMMAND} ${args.slice(0, 2).join(" ")}: no type ${params.name}` };
4513
+ return { raw: run.stdout, fields };
4514
+ }
4515
+ function versionOf(params) {
4516
+ const args = [...params.selector === TOOL_SELECTOR ? [] : [params.selector], VERSION_FLAG];
4517
+ const run = spawnGh({ root: params.root, args, timeout: HOST_READ_TIMEOUT_MS });
4518
+ if (run.status !== 0) {
4519
+ const refusal = refusalOf2({ run, args });
4520
+ return run.error === void 0 && UNKNOWN_COMMAND_PATTERN.test(run.stderr) ? { ...refusal, absent: `${GH_COMMAND}-${params.selector}` } : refusal;
4521
+ }
4522
+ const version = versionOfText({ text: run.stdout });
4523
+ if (version === void 0)
4524
+ return { refusal: `${GH_COMMAND} ${args.join(" ")}: no version printed` };
4525
+ return { raw: run.stdout, version };
4526
+ }
4527
+ function spawnGh(params) {
4528
+ return spawnSync4(GH_COMMAND, params.args, {
4529
+ cwd: params.root,
4530
+ encoding: "utf8",
4531
+ timeout: params.timeout,
4532
+ ...params.input === void 0 ? { stdio: ["ignore", "pipe", "pipe"] } : { input: params.input },
4533
+ env: { ...process.env, ...HOST_ENVIRONMENT }
4534
+ });
4535
+ }
4536
+ function refusalOf2(params) {
4537
+ const { run, args } = params;
4538
+ const reason = run.error?.message ?? (run.stderr?.trim().split("\n")[0] || `exit ${run.status}`);
4539
+ return { refusal: `${GH_COMMAND} ${args.slice(0, 2).join(" ")}: ${reason}` };
4540
+ }
4541
+
4542
+ // src/lib/host/github/github-host.ts
4543
+ function createGithubHost() {
4544
+ const host = {
4545
+ readPullRequest: function readPullRequest(params) {
4546
+ const run = runGh({
4547
+ root: params.root,
4548
+ call: "viewPullRequest",
4549
+ positional: [params.ref]
4550
+ });
4551
+ if ("refusal" in run) return NO_PULL_REQUEST_PATTERN.test(run.refusal) ? void 0 : run;
4552
+ return pullRequestOf({ text: run.output });
4553
+ },
4554
+ openPullRequest: function openPullRequest(params) {
4555
+ const created = runGh({
4556
+ root: params.root,
4557
+ call: "createPullRequest",
4558
+ options: {
4559
+ "--base": params.base,
4560
+ "--head": params.branch,
4561
+ "--title": params.title,
4562
+ "--body": params.body,
4563
+ "--draft": params.draft || void 0
4564
+ }
4565
+ });
4566
+ if ("refusal" in created) return created;
4567
+ const read = host.readPullRequest({ root: params.root, ref: params.branch });
4568
+ return read ?? { refusal: `the pull request of ${params.branch} was opened but cannot be read` };
4569
+ },
4570
+ editPullRequest: editOnGithub,
4571
+ closePullRequest: closeOnGithub,
4572
+ readChecks: readChecksOnGithub,
4573
+ readReviewComments: readCommentsOnGithub,
4574
+ openFiles: openFilesTab,
4575
+ probeStacks: probeStacksOnGithub,
4576
+ linkStack: linkStackOnGithub,
4577
+ queueStack: queueStackOnGithub,
4578
+ retargetPullRequest: retargetOnGithub,
4579
+ draftPullRequest: draftOnGithub,
4580
+ readQueued: readQueuedOnGithub,
4581
+ queuePullRequest: function queuePullRequest(params) {
4582
+ const number = String(params.number);
4583
+ if (params.draft) {
4584
+ const ready = runGh({
4585
+ root: params.root,
4586
+ call: "readyPullRequest",
4587
+ positional: [number]
4588
+ });
4589
+ if ("refusal" in ready) return ready;
4590
+ }
4591
+ const queued = runGh({
4592
+ root: params.root,
4593
+ call: "mergePullRequest",
4594
+ positional: [number],
4595
+ options: { "--auto": true }
4596
+ });
4597
+ return "refusal" in queued ? queued : void 0;
4598
+ }
4599
+ };
4600
+ return host;
4601
+ }
4602
+ function draftOnGithub(params) {
4603
+ const number = String(params.number);
4604
+ if (params.queued) {
4605
+ const unqueued = runGh({
4606
+ root: params.root,
4607
+ call: "mergePullRequest",
4608
+ positional: [number],
4609
+ options: { "--disable-auto": true }
4610
+ });
4611
+ if ("refusal" in unqueued) return unqueued;
4612
+ }
4613
+ if (params.draft) return void 0;
4614
+ const drafted = runGh({
4615
+ root: params.root,
4616
+ call: "readyPullRequest",
4617
+ positional: [number],
4618
+ options: { "--undo": true }
4619
+ });
4620
+ return "refusal" in drafted ? drafted : void 0;
4621
+ }
4622
+ function probeStacksOnGithub(params) {
4623
+ const run = runGh({
4624
+ root: params.root,
4625
+ call: "stackHelp",
4626
+ options: { "--help": true }
4627
+ });
4628
+ return "refusal" in run ? { stacks: false, why: NO_STACKS_REASON } : { stacks: true };
4629
+ }
4630
+ function linkStackOnGithub(params) {
4631
+ const linked = runGh({
4632
+ root: params.root,
4633
+ call: "stackLink",
4634
+ positional: [params.parent, params.child]
4635
+ });
4636
+ return "refusal" in linked ? linked : void 0;
4637
+ }
4638
+ function queueStackOnGithub(params) {
4639
+ if (params.draft) {
4640
+ const ready = runGh({
4641
+ root: params.root,
4642
+ call: "readyPullRequest",
4643
+ positional: [String(params.number)]
4644
+ });
4645
+ if ("refusal" in ready) return ready;
4646
+ }
4647
+ const queued = runGh({
4648
+ root: params.root,
4649
+ call: "stackMerge",
4650
+ positional: [String(params.number)],
4651
+ options: { "--yes": true, "--squash": true }
4652
+ });
4653
+ return "refusal" in queued ? queued : void 0;
4654
+ }
4655
+ function retargetOnGithub(params) {
4656
+ const edited = runGh({
4657
+ root: params.root,
4658
+ call: "editPullRequest",
4659
+ positional: [String(params.number)],
4660
+ options: { "--base": params.base }
2567
4661
  });
4662
+ return "refusal" in edited ? edited : void 0;
2568
4663
  }
2569
- function coreGenerations(cwd) {
2570
- const dialectes = dependencyNames(cwd).sort(TEXT_COLLATOR.compare).flatMap(function dialecteOnCore(name) {
2571
- const folder = findInstalledPackage({ cwd, name });
2572
- return folder && dependsOnCore(folder) ? [{ name, folder }] : [];
4664
+ function readChecksOnGithub(params) {
4665
+ const run = runGh({
4666
+ root: params.root,
4667
+ call: "viewChecks",
4668
+ positional: [String(params.number)]
2573
4669
  });
2574
- const appCore = installedVersion({ cwd, name: CORE_PACKAGE2 });
2575
- const owners = dialectes.length ? dialectes : [{ name: void 0, folder: cwd }];
2576
- return owners.flatMap(function generationLine({ name, folder }) {
2577
- const version = installedVersion({ cwd: folder, name: CORE_PACKAGE2 });
2578
- if (version === void 0) return [];
2579
- const [major = 0, minor = 0] = version.split(".").map(Number);
2580
- const generation = CORE_API_GENERATIONS.find(
2581
- ({ from }) => major > from[0] || major === from[0] && minor >= from[1]
2582
- );
2583
- if (!generation) return [];
2584
- const says = `${generation.name}: ${generation.says}`;
2585
- if (name && appCore !== void 0 && appCore !== version)
2586
- return [
2587
- {
2588
- status: "warning",
2589
- subject: "core API",
2590
- detail: `${name} on core ${version}, your app on core ${appCore}: two cores side by side (${says})`,
2591
- fix: ALIGN_CORE_FIX
2592
- }
2593
- ];
2594
- const owner = name ? `${name} on core ${version}` : `core ${version}`;
2595
- return [{ status: "ok", subject: "core API", detail: `${owner} - ${says}` }];
4670
+ return "refusal" in run ? run : checksOf({ text: run.output });
4671
+ }
4672
+ function readReviewCommentsWith(params) {
4673
+ const run = params.run({
4674
+ root: params.root,
4675
+ call: "reviewComments",
4676
+ values: params.values,
4677
+ options: { "--paginate": true }
2596
4678
  });
4679
+ return "refusal" in run ? run : reviewCommentsOf({ text: run.output });
2597
4680
  }
2598
- function skills(cwd) {
2599
- const { sources } = discoverSkillSources({ cwd });
2600
- if (sources.length === 0)
2601
- return [{ status: "ok", subject: "skills", detail: "no dependency ships skills" }];
2602
- const synced = Object.values(AGENT_SKILL_FOLDERS).filter(
2603
- (folder) => existsSync19(join24(cwd, folder, MANIFEST_FILE))
2604
- );
2605
- if (synced.length === 0)
2606
- return [
2607
- {
2608
- status: "warning",
2609
- subject: "skills",
2610
- detail: `not installed for your agents (${sources.map((source) => source.name).join(", ")} shipped)`,
2611
- fix: SYNC_COMMAND
2612
- }
2613
- ];
2614
- const contributor = isContributor(cwd);
2615
- return synced.map(function syncLine(folder) {
2616
- const manifest = readSyncManifest(join24(cwd, folder));
2617
- const expected = selectAudience({
2618
- sources,
2619
- contributing: contributor || manifest.contributing === true
2620
- }).selected;
2621
- const missing = expected.map((source) => source.name).filter((name) => !manifest.installed.includes(name));
2622
- if (missing.length)
2623
- return {
2624
- status: "warning",
2625
- subject: "skills",
2626
- detail: `${folder} lacks ${missing.join(", ")}`,
2627
- fix: SYNC_COMMAND
2628
- };
2629
- const stale = expected.flatMap(function staleCopy(source) {
2630
- const recorded = manifest.versions[source.name];
2631
- if (isLink(join24(cwd, folder, source.name)) || source.version === void 0) return [];
2632
- if (recorded?.version === source.version) return [];
2633
- return [
2634
- `${source.name} of ${source.origin} ${recorded?.version ?? "an unknown version"}, ${source.version} installed`
2635
- ];
2636
- });
2637
- if (stale.length)
2638
- return {
2639
- status: "warning",
2640
- subject: "skills",
2641
- detail: `${folder} holds ${stale.join("; ")}`,
2642
- fix: SYNC_COMMAND
2643
- };
2644
- return { status: "ok", subject: "skills", detail: `${folder} in sync with node_modules` };
4681
+ function readCommentsOnGithub(params) {
4682
+ return readReviewCommentsWith({
4683
+ run: runGh,
4684
+ root: params.root,
4685
+ values: { number: String(params.number) }
2645
4686
  });
2646
4687
  }
2647
- function isContributor(cwd) {
4688
+ function openFilesTab(params) {
4689
+ const [command, ...words] = BROWSER_OPENERS[process.platform] ?? BROWSER_OPENERS.default;
4690
+ const run = spawnSync5(command, [...words, `${params.url}${FILES_TAB_SUFFIX}`], {
4691
+ cwd: params.root,
4692
+ encoding: "utf8",
4693
+ timeout: OPEN_TIMEOUT_MS,
4694
+ stdio: ["ignore", "ignore", "pipe"]
4695
+ });
4696
+ if (run.status === 0) return void 0;
4697
+ const reason = run.error?.message ?? (run.stderr.trim().split("\n")[0] || `exit ${run.status}`);
4698
+ return { refusal: `${command}: ${reason}` };
4699
+ }
4700
+ function editOnGithub(params) {
4701
+ const edited = runGh({
4702
+ root: params.root,
4703
+ call: "editPullRequest",
4704
+ positional: [String(params.number)],
4705
+ options: { "--title": params.title, "--body-file": "-" },
4706
+ input: params.body
4707
+ });
4708
+ return "refusal" in edited ? edited : void 0;
4709
+ }
4710
+ function closeOnGithub(params) {
4711
+ const closed = runGh({
4712
+ root: params.root,
4713
+ call: "closePullRequest",
4714
+ positional: [String(params.number)]
4715
+ });
4716
+ return "refusal" in closed ? closed : void 0;
4717
+ }
4718
+ function readQueuedOnGithub(params) {
4719
+ const run = runGh({
4720
+ root: params.root,
4721
+ call: "queuedState",
4722
+ options: { "-F": ["owner={owner}", "repo={repo}", `number=${params.number}`] }
4723
+ });
4724
+ if ("refusal" in run) return run;
2648
4725
  try {
2649
- return readProfile(cwd) === "contributor";
4726
+ const parsed = JSON.parse(run.output);
4727
+ return {
4728
+ queued: parsed.isInMergeQueue === true || parsed.autoMergeRequest !== null && parsed.autoMergeRequest !== void 0
4729
+ };
2650
4730
  } catch {
2651
- return false;
4731
+ return { refusal: `gh api graphql: not the JSON it writes: ${run.output.slice(0, 80)}` };
2652
4732
  }
2653
4733
  }
2654
- function isLink(path) {
4734
+ function pullRequestOf(params) {
2655
4735
  try {
2656
- return lstatSync5(path).isSymbolicLink();
4736
+ const parsed = JSON.parse(params.text);
4737
+ if (typeof parsed.number !== "number" || typeof parsed.state !== "string" || typeof parsed.url !== "string" || parsed.url === "")
4738
+ return { refusal: `gh pr view: no number, state or url in ${params.text.slice(0, 80)}` };
4739
+ const state = parsed.state.toLowerCase();
4740
+ const url = parsed.url;
4741
+ return {
4742
+ number: parsed.number,
4743
+ url,
4744
+ title: String(parsed.title ?? ""),
4745
+ body: String(parsed.body ?? ""),
4746
+ state: state === "merged" ? "merged" : state === "closed" ? "closed" : "open",
4747
+ draft: parsed.isDraft === true,
4748
+ // auto-merge on; the merge queue itself is read where it decides (readQueued): gh pr view cannot say
4749
+ queued: parsed.autoMergeRequest !== null && parsed.autoMergeRequest !== void 0,
4750
+ head: String(parsed.headRefOid ?? ""),
4751
+ ...typeof parsed.baseRefName === "string" && { base: parsed.baseRefName },
4752
+ filesUrl: `${url}${FILES_TAB_SUFFIX}`
4753
+ };
2657
4754
  } catch {
2658
- return false;
4755
+ return { refusal: `gh pr view: not the JSON it writes: ${params.text.slice(0, 80)}` };
2659
4756
  }
2660
4757
  }
2661
- function dependsOnCore(folder) {
2662
- const manifest = JSON.parse(readFileSync13(join24(folder, "package.json"), "utf8"));
2663
- return manifest.name !== CORE_PACKAGE2 && (manifest.dependencies?.[CORE_PACKAGE2] !== void 0 || manifest.peerDependencies?.[CORE_PACKAGE2] !== void 0);
4758
+
4759
+ // src/lib/host/github/github-probes.ts
4760
+ function newestMergedPullRequest(params) {
4761
+ const answer = params.run({
4762
+ root: params.root,
4763
+ call: GITHUB_SUBJECT_CALL,
4764
+ options: { "--state": MERGED_STATE, "--limit": ONE_PULL_REQUEST }
4765
+ });
4766
+ if ("refusal" in answer) return answer;
4767
+ const listed = listOf({ text: answer.output });
4768
+ if (listed === void 0)
4769
+ return {
4770
+ refusal: fillMessage({
4771
+ template: GITHUB_PROBE_TEXTS.notTheJson,
4772
+ values: { text: answer.output.slice(0, 80) }
4773
+ })
4774
+ };
4775
+ const [first] = listed;
4776
+ if (first === void 0) return { refusal: GITHUB_PROBE_TEXTS.nothingToProbe };
4777
+ return { number: first };
2664
4778
  }
2665
- function localCheckouts(context) {
2666
- const roots = [
2667
- ...new Set([context.dialecteRoot, dirname11(resolve5(context.cwd))].filter(isDefined2))
2668
- ];
2669
- return roots.map(function checkoutLine(root) {
2670
- const names = existsSync19(root) ? readdirSync10(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && join24(root, entry.name) !== resolve5(context.cwd)).filter((entry) => packageName(join24(root, entry.name))?.startsWith(DIALECTE_SCOPE)).map((entry) => entry.name).sort(TEXT_COLLATOR.compare) : [];
4779
+ function listOf(params) {
4780
+ try {
4781
+ const parsed = JSON.parse(params.text);
4782
+ if (!Array.isArray(parsed)) return void 0;
4783
+ const numbers = parsed.map(function numberOf(entry) {
4784
+ return typeof entry === "object" && entry !== null && "number" in entry ? entry.number : void 0;
4785
+ });
4786
+ return numbers.every(function isNumber(each) {
4787
+ return typeof each === "number";
4788
+ }) ? numbers : void 0;
4789
+ } catch {
4790
+ return void 0;
4791
+ }
4792
+ }
4793
+ function findMergedPullRequest(params) {
4794
+ const found = newestMergedPullRequest({ run: params.run, root: params.root });
4795
+ if ("refusal" in found)
2671
4796
  return {
4797
+ line: {
4798
+ status: found.refusal === GITHUB_PROBE_TEXTS.nothingToProbe ? "warning" : "error",
4799
+ subject: params.subject,
4800
+ detail: found.refusal
4801
+ }
4802
+ };
4803
+ return {
4804
+ line: {
2672
4805
  status: "ok",
2673
- subject: "checkouts",
2674
- detail: names.length ? `${root}: ${names.slice(0, CHECKOUT_LIST_LIMIT).join(", ")}${names.length > CHECKOUT_LIST_LIMIT ? ` and ${names.length - CHECKOUT_LIST_LIMIT} more` : ""}` : `none in ${root} (the installed packages are the source)`
4806
+ subject: params.subject,
4807
+ detail: fillMessage({
4808
+ template: GITHUB_PROBE_TEXTS.newestMerged,
4809
+ values: { number: String(found.number) }
4810
+ })
4811
+ },
4812
+ pullRequest: found.number
4813
+ };
4814
+ }
4815
+ var GITHUB_SUBJECT = {
4816
+ call: GITHUB_SUBJECT_CALL,
4817
+ find: findMergedPullRequest
4818
+ };
4819
+ function needsPullRequest(params) {
4820
+ return { status: "warning", subject: params.subject, detail: GITHUB_PROBE_TEXTS.needsPullRequest };
4821
+ }
4822
+ function probeViewPullRequest(params) {
4823
+ if (params.pullRequest === void 0) return needsPullRequest(params);
4824
+ const number = String(params.pullRequest);
4825
+ const read = params.host.readPullRequest({ root: params.root, ref: number });
4826
+ if (read !== void 0 && "refusal" in read)
4827
+ return { status: "error", subject: params.subject, detail: read.refusal };
4828
+ if (read === void 0)
4829
+ return {
4830
+ status: "error",
4831
+ subject: params.subject,
4832
+ detail: fillMessage({ template: GITHUB_PROBE_TEXTS.pullRequestNone, values: { number } })
4833
+ };
4834
+ const none = params.host.readPullRequest({ root: params.root, ref: NO_SUCH_BRANCH });
4835
+ if (none !== void 0)
4836
+ return {
4837
+ status: "error",
4838
+ subject: params.subject,
4839
+ detail: fillMessage({
4840
+ template: GITHUB_PROBE_TEXTS.noPullRequestTextChanged,
4841
+ values: { refusal: "refusal" in none ? none.refusal : `#${none.number}` }
4842
+ })
2675
4843
  };
4844
+ return {
4845
+ status: "ok",
4846
+ subject: params.subject,
4847
+ detail: fillMessage({ template: GITHUB_PROBE_TEXTS.pullRequestRead, values: { number } })
4848
+ };
4849
+ }
4850
+ function probeViewChecks(params) {
4851
+ if (params.pullRequest === void 0) return needsPullRequest(params);
4852
+ const checks = params.host.readChecks({ root: params.root, number: params.pullRequest });
4853
+ if ("refusal" in checks)
4854
+ return { status: "error", subject: params.subject, detail: checks.refusal };
4855
+ return {
4856
+ status: "ok",
4857
+ subject: params.subject,
4858
+ detail: fillMessage({
4859
+ template: GITHUB_PROBE_TEXTS.checksRead,
4860
+ values: { number: String(params.pullRequest), state: checks.state }
4861
+ })
4862
+ };
4863
+ }
4864
+ function probeQueuedState(params) {
4865
+ if (params.pullRequest === void 0) return needsPullRequest(params);
4866
+ const queued = params.host.readQueued({ root: params.root, number: params.pullRequest });
4867
+ if ("refusal" in queued)
4868
+ return { status: "error", subject: params.subject, detail: queued.refusal };
4869
+ return {
4870
+ status: "ok",
4871
+ subject: params.subject,
4872
+ detail: fillMessage({
4873
+ template: GITHUB_PROBE_TEXTS.queuedRead,
4874
+ values: { number: String(params.pullRequest), queued: String(queued.queued) }
4875
+ })
4876
+ };
4877
+ }
4878
+ function probeReviewComments(params) {
4879
+ const comments = readReviewCommentsWith({
4880
+ run: params.run,
4881
+ root: params.root,
4882
+ values: REVIEW_PROBE
2676
4883
  });
4884
+ if ("refusal" in comments)
4885
+ return { status: "error", subject: params.subject, detail: comments.refusal };
4886
+ const values = {
4887
+ reference: `${REVIEW_PROBE.owner}/${REVIEW_PROBE.repo}#${REVIEW_PROBE.number}`,
4888
+ count: String(comments.length),
4889
+ lines: String(
4890
+ comments.filter(function onALine(comment) {
4891
+ return comment.line !== void 0;
4892
+ }).length
4893
+ ),
4894
+ replies: String(
4895
+ comments.filter(function isReply(comment) {
4896
+ return comment.replyTo !== void 0;
4897
+ }).length
4898
+ )
4899
+ };
4900
+ if (values.lines === "0" || values.replies === "0")
4901
+ return {
4902
+ status: "error",
4903
+ subject: params.subject,
4904
+ detail: fillMessage({ template: GITHUB_PROBE_TEXTS.commentKeysChanged, values })
4905
+ };
4906
+ return {
4907
+ status: "ok",
4908
+ subject: params.subject,
4909
+ detail: fillMessage({ template: GITHUB_PROBE_TEXTS.commentsRead, values })
4910
+ };
2677
4911
  }
2678
- function declaredVersions(cwd) {
2679
- const manifest = JSON.parse(readFileSync13(join24(cwd, "package.json"), "utf8"));
2680
- const names = dependencyNames(cwd);
2681
- return Object.fromEntries(
2682
- names.map((name) => [
2683
- name,
2684
- String(
2685
- manifest.dependencies?.[name] ?? manifest.devDependencies?.[name] ?? manifest.peerDependencies?.[name]
2686
- )
2687
- ])
2688
- );
4912
+ function probeStackHelp(params) {
4913
+ const support = params.host.probeStacks({ root: params.root });
4914
+ if (support.stacks)
4915
+ return { status: "ok", subject: params.subject, detail: GITHUB_PROBE_TEXTS.stacksOn };
4916
+ return {
4917
+ status: "warning",
4918
+ subject: params.subject,
4919
+ detail: fillMessage({ template: GITHUB_PROBE_TEXTS.stacksOff, values: { why: support.why } }),
4920
+ fix: GH_STACK_INSTALL
4921
+ };
2689
4922
  }
2690
- function installedVersion(params) {
2691
- const folder = findInstalledPackage(params);
2692
- if (!folder || !existsSync19(join24(folder, "package.json"))) return void 0;
2693
- const version = JSON.parse(readFileSync13(join24(folder, "package.json"), "utf8")).version;
2694
- return typeof version === "string" ? version : void 0;
4923
+ var GITHUB_PROBES = {
4924
+ viewPullRequest: probeViewPullRequest,
4925
+ viewChecks: probeViewChecks,
4926
+ queuedState: probeQueuedState,
4927
+ reviewComments: probeReviewComments,
4928
+ stackHelp: probeStackHelp
4929
+ };
4930
+
4931
+ // src/lib/host/github/github-vendor.ts
4932
+ var GITHUB_DESCRIBE = { helpOf, fieldsOf, typeOf, versionOf };
4933
+ var GITHUB_VENDOR = {
4934
+ name: GITHUB_VENDOR_NAME,
4935
+ tool: GH_COMMAND,
4936
+ remoteHosts: GITHUB_REMOTE_HOSTS,
4937
+ calls: GITHUB_CALLS,
4938
+ recordedVersions: GITHUB_RECORDED_VERSIONS,
4939
+ subject: GITHUB_SUBJECT,
4940
+ probes: GITHUB_PROBES,
4941
+ run: runGh,
4942
+ describe: GITHUB_DESCRIBE,
4943
+ createAdapter: createGithubHost
4944
+ };
4945
+
4946
+ // src/lib/host/host-vendors.constants.ts
4947
+ var HOST_VENDORS = [GITHUB_VENDOR];
4948
+
4949
+ // src/lib/host/select-host.constants.ts
4950
+ var SSH_COMMAND = "ssh";
4951
+ var SSH_CONFIG_FLAG = "-G";
4952
+ var SSH_END_OF_OPTIONS = "--";
4953
+ var SSH_CONFIG_TIMEOUT_MS = 5e3;
4954
+ var SSH_HOSTNAME_KEY = "hostname";
4955
+ var HOST_CONFIG_KEY = "host";
4956
+ var NO_VENDOR_REFUSAL = "no host vendor for {origin}: it is none of the known vendors ({vendors}); set the key `host` to one of them in the personal config.yml";
4957
+ var UNKNOWN_VENDOR_REFUSAL = "no host vendor named {name}: the known vendors are {vendors}";
4958
+ var NO_REMOTE_ORIGIN = "a repository with no remote origin";
4959
+
4960
+ // src/lib/host/select-host.ts
4961
+ function hostnameOfSshConfig(params) {
4962
+ for (const line of params.text.split("\n")) {
4963
+ const [key, value] = line.trim().split(/\s+/, 2);
4964
+ if (key === SSH_HOSTNAME_KEY && value !== void 0) return value;
4965
+ }
4966
+ return void 0;
2695
4967
  }
2696
- function packageName(folder) {
2697
- const path = join24(folder, "package.json");
2698
- if (!existsSync19(path)) return void 0;
2699
- const name = JSON.parse(readFileSync13(path, "utf8")).name;
2700
- return typeof name === "string" ? name : void 0;
4968
+ function sshHostnameOf(params) {
4969
+ const run = spawnSync6(SSH_COMMAND, [SSH_CONFIG_FLAG, SSH_END_OF_OPTIONS, params.alias], {
4970
+ encoding: "utf8",
4971
+ timeout: SSH_CONFIG_TIMEOUT_MS,
4972
+ stdio: ["ignore", "pipe", "pipe"]
4973
+ });
4974
+ return run.status === 0 ? hostnameOfSshConfig({ text: run.stdout }) : void 0;
2701
4975
  }
2702
- function isDefined2(value) {
2703
- return value !== void 0;
4976
+ function hostKeyOf(params) {
4977
+ const resolved = resolveConfig({
4978
+ root: params.root,
4979
+ environment: process.env,
4980
+ platform: process.platform,
4981
+ home: homedir(),
4982
+ keys: CONFIG_KEYS.filter(function isHostKey(spec) {
4983
+ return spec.key === HOST_CONFIG_KEY;
4984
+ }),
4985
+ layers: ["personal"]
4986
+ });
4987
+ const value = resolved.values.find(function isHostValue(each) {
4988
+ return each.key === HOST_CONFIG_KEY;
4989
+ })?.value;
4990
+ return typeof value === "string" ? value : void 0;
4991
+ }
4992
+ function vendorOfRemoteHost(params) {
4993
+ if (params.host === void 0) return void 0;
4994
+ const lowered = params.host.toLowerCase();
4995
+ return HOST_VENDORS.find(function servesHost(vendor) {
4996
+ return vendor.remoteHosts.includes(lowered);
4997
+ });
4998
+ }
4999
+ function selectionOf(params) {
5000
+ const { remote } = repoKeyOf({ root: params.root, platform: process.platform });
5001
+ const host = remote?.host;
5002
+ const byOrigin = vendorOfRemoteHost({ host });
5003
+ if (byOrigin !== void 0) return { vendor: byOrigin, host };
5004
+ if (remote !== void 0 && remote.form !== "https") {
5005
+ const sshHostname = params.sshHostname ?? sshHostnameOf;
5006
+ const byAlias = vendorOfRemoteHost({ host: sshHostname({ alias: remote.host }) });
5007
+ if (byAlias !== void 0) return { vendor: byAlias, host };
5008
+ }
5009
+ const readHostKey = params.readHostKey ?? hostKeyOf;
5010
+ const name = readHostKey({ root: params.root });
5011
+ const named = name === void 0 ? void 0 : vendorNamed({ name });
5012
+ return { vendor: named !== void 0 && "vendor" in named ? named.vendor : void 0, host };
5013
+ }
5014
+ function knownVendorNames() {
5015
+ return HOST_VENDORS.map(function nameOf(vendor) {
5016
+ return vendor.name;
5017
+ }).join(", ");
5018
+ }
5019
+ function vendorNamed(params) {
5020
+ const vendor = HOST_VENDORS.find(function isNamed(each) {
5021
+ return each.name === params.name;
5022
+ });
5023
+ if (vendor !== void 0) return { vendor };
5024
+ return {
5025
+ refusal: fillMessage({
5026
+ template: UNKNOWN_VENDOR_REFUSAL,
5027
+ values: { name: params.name, vendors: knownVendorNames() }
5028
+ })
5029
+ };
5030
+ }
5031
+ function vendorOrRefusalOf(params) {
5032
+ const { vendor, host } = selectionOf(params);
5033
+ return vendor === void 0 ? { refusal: noVendorReason({ host }) } : { vendor };
5034
+ }
5035
+ function noVendorReason(params) {
5036
+ return fillMessage({
5037
+ template: NO_VENDOR_REFUSAL,
5038
+ values: {
5039
+ origin: params.host ?? NO_REMOTE_ORIGIN,
5040
+ vendors: knownVendorNames()
5041
+ }
5042
+ });
2704
5043
  }
2705
5044
 
2706
5045
  // src/commands/doctor.ts
2707
5046
  function runDoctor(params) {
2708
- const { argv, cliVersion, ...rest } = params;
5047
+ const { argv, cliVersion, hostLines: hostLines2, ...rest } = params;
2709
5048
  if (hasFlag([...argv], "brief")) return runBrief({ ...rest, cliVersion });
5049
+ if (hasFlag([...argv], "host"))
5050
+ return runHost({ argv, cwd: params.cwd, hostLines: hostLines2 ?? realHostLines });
2710
5051
  const missing = missingPackage({ cwd: params.cwd });
2711
5052
  if (missing) return missing;
2712
5053
  return answerDoctor({
@@ -2714,6 +5055,48 @@ function runDoctor(params) {
2714
5055
  json: hasFlag([...argv], "json")
2715
5056
  });
2716
5057
  }
5058
+ function runHost(params) {
5059
+ const argv = [...params.argv];
5060
+ if (argv.some(isVendorEqualsForm)) return vendorUsageError({ why: VENDOR_EQUALS_FORM });
5061
+ if (hasFlag(argv, "vendor") && !vendorNameGiven({ argv }))
5062
+ return vendorUsageError({ why: VENDOR_NEEDS_NAME });
5063
+ const selected = selectedVendorOf({ argv: params.argv, cwd: params.cwd });
5064
+ if ("refusal" in selected)
5065
+ return answerHostDoctor({
5066
+ lines: [{ status: "error", subject: HOST_SUBJECT, detail: selected.refusal }]
5067
+ });
5068
+ return answerHostDoctor({
5069
+ lines: params.hostLines({ root: params.cwd, vendor: selected.vendor })
5070
+ });
5071
+ }
5072
+ function selectedVendorOf(params) {
5073
+ const name = getArg([...params.argv], "vendor");
5074
+ return name === void 0 ? vendorOrRefusalOf({ root: params.cwd }) : vendorNamed({ name });
5075
+ }
5076
+ function vendorNameGiven(params) {
5077
+ const name = getArg(params.argv, "vendor");
5078
+ return name !== void 0 && !name.startsWith("-");
5079
+ }
5080
+ function vendorUsageError(params) {
5081
+ const usage = COMMAND_MAP.doctor.usage.filter(function isHostUsage(line) {
5082
+ return line.startsWith(HOST_USAGE_START);
5083
+ });
5084
+ return { output: textOf([params.why, ...usage, ""]), exitCode: 2 };
5085
+ }
5086
+ function isVendorEqualsForm(word) {
5087
+ return word.startsWith(VENDOR_EQUALS_PREFIX);
5088
+ }
5089
+ function realHostLines(params) {
5090
+ const { root, vendor } = params;
5091
+ return hostLines({
5092
+ root,
5093
+ vendor,
5094
+ host: vendor.createAdapter(),
5095
+ run: vendor.run,
5096
+ describe: vendor.describe,
5097
+ readGitVersion
5098
+ });
5099
+ }
2717
5100
  function runBrief(context) {
2718
5101
  try {
2719
5102
  return answerDoctorBrief(
@@ -2799,9 +5182,9 @@ function namespaceOf(packageName2) {
2799
5182
  }
2800
5183
 
2801
5184
  // src/lib/schema/load-dialectes.ts
2802
- import { existsSync as existsSync20, readFileSync as readFileSync14 } from "fs";
5185
+ import { existsSync as existsSync23, readFileSync as readFileSync15 } from "fs";
2803
5186
  import { createRequire } from "module";
2804
- import { join as join25 } from "path";
5187
+ import { join as join27 } from "path";
2805
5188
  import { pathToFileURL } from "url";
2806
5189
 
2807
5190
  // src/lib/schema/schema.constants.ts
@@ -2852,7 +5235,7 @@ async function loadDialecte(params) {
2852
5235
  if (config) break;
2853
5236
  }
2854
5237
  if (!config) return void 0;
2855
- const readersFile = createRequire(join25(params.folder, "package.json")).resolve(CORE_READERS_ENTRY);
5238
+ const readersFile = createRequire(join27(params.folder, "package.json")).resolve(CORE_READERS_ENTRY);
2856
5239
  const readers = await import(pathToFileURL(readersFile).href);
2857
5240
  if (!isCoreReaders(readers))
2858
5241
  throw new Error(
@@ -2871,8 +5254,8 @@ function readStandard(manifest) {
2871
5254
  return standard;
2872
5255
  }
2873
5256
  function readManifest(folder) {
2874
- const path = join25(folder, "package.json");
2875
- return existsSync20(path) ? JSON.parse(readFileSync14(path, "utf8")) : void 0;
5257
+ const path = join27(folder, "package.json");
5258
+ return existsSync23(path) ? JSON.parse(readFileSync15(path, "utf8")) : void 0;
2876
5259
  }
2877
5260
  function isBuiltOnCore(manifest) {
2878
5261
  return manifest.name !== CORE_PACKAGE3 && (manifest.dependencies?.[CORE_PACKAGE3] !== void 0 || manifest.peerDependencies?.[CORE_PACKAGE3] !== void 0);
@@ -2882,9 +5265,9 @@ function entryFiles(params) {
2882
5265
  const targets = exports === void 0 ? main ? [[".", main]] : [] : typeof exports === "string" ? [[".", exports]] : Object.entries(exports);
2883
5266
  return targets.filter(([subpath]) => !subpath.split("/").includes("test") && !subpath.includes("*")).flatMap(([, target]) => {
2884
5267
  const file = fileOf(target);
2885
- return file && file.endsWith("js") ? [join25(params.folder, file)] : [];
5268
+ return file && file.endsWith("js") ? [join27(params.folder, file)] : [];
2886
5269
  }).map(function existingFile(file) {
2887
- if (!existsSync20(file))
5270
+ if (!existsSync23(file))
2888
5271
  throw new Error(`entry file not found: ${file} (is the package built?)`);
2889
5272
  return file;
2890
5273
  });
@@ -3320,7 +5703,7 @@ function renderAnswer(answer) {
3320
5703
  `${element.tag} under ${under}: declaration ${element.declaration}, one of ${element.declarations} ways`,
3321
5704
  ...renderElement(element)
3322
5705
  ];
3323
- const heading = under === void 0 ? `${element.tag} is declared ${element.declarations} ways - pick one with --under <Parent>` : `${element.tag} under ${under}: declarations ${listOf(answer.ways.map((way) => way.id))} of ${element.declarations}, the parent does not decide`;
5706
+ const heading = under === void 0 ? `${element.tag} is declared ${element.declarations} ways - pick one with --under <Parent>` : `${element.tag} under ${under}: declarations ${listOf2(answer.ways.map((way) => way.id))} of ${element.declarations}, the parent does not decide`;
3324
5707
  return [
3325
5708
  heading,
3326
5709
  ...answer.ways.flatMap((way, index) => [...index === 0 ? [] : [""], ...renderWay(way)])
@@ -3329,7 +5712,7 @@ function renderAnswer(answer) {
3329
5712
  function renderWay(way) {
3330
5713
  return [`declaration ${way.id}${way.global ? " global" : ""}`, ...renderElement(way.element)];
3331
5714
  }
3332
- function listOf(words) {
5715
+ function listOf2(words) {
3333
5716
  if (words.length < 2) return words.join("");
3334
5717
  return `${words.slice(0, -1).join(", ")} and ${words[words.length - 1]}`;
3335
5718
  }
@@ -3414,12 +5797,12 @@ async function readSchemaDialectes(params) {
3414
5797
 
3415
5798
  // src/lib/knowledge/ask/load-standard-indexes.ts
3416
5799
  import { createHash as createHash6 } from "crypto";
3417
- import { readFileSync as readFileSync18 } from "fs";
5800
+ import { readFileSync as readFileSync19 } from "fs";
3418
5801
 
3419
5802
  // src/lib/knowledge/standard/ensure-standard-index.ts
3420
5803
  import { createHash as createHash3 } from "crypto";
3421
- import { existsSync as existsSync22, readdirSync as readdirSync11, readFileSync as readFileSync16, renameSync as renameSync5, rmSync as rmSync5 } from "fs";
3422
- import { join as join27 } from "path";
5804
+ import { existsSync as existsSync25, readdirSync as readdirSync11, readFileSync as readFileSync17, renameSync as renameSync5, rmSync as rmSync5 } from "fs";
5805
+ import { join as join29 } from "path";
3423
5806
 
3424
5807
  // src/lib/progress/format-duration.ts
3425
5808
  function formatDuration(milliseconds) {
@@ -3431,20 +5814,6 @@ function formatDuration(milliseconds) {
3431
5814
  return `${Math.floor(minutes / 60)} h ${minutes % 60} m`;
3432
5815
  }
3433
5816
 
3434
- // src/lib/knowledge/standard/fill-message.constants.ts
3435
- var PLACEHOLDER_PATTERN = /\{([^{}]+)\}/g;
3436
-
3437
- // src/lib/knowledge/standard/fill-message.ts
3438
- function fillMessage(params) {
3439
- const { template, values } = params;
3440
- return template.replace(
3441
- PLACEHOLDER_PATTERN,
3442
- function valueOf(placeholder, name) {
3443
- return Object.hasOwn(values, name) ? values[name] : placeholder;
3444
- }
3445
- );
3446
- }
3447
-
3448
5817
  // src/lib/knowledge/standard/standard-index.constants.ts
3449
5818
  var CAPTION_WORDS = {
3450
5819
  table: ["Ta", "ble"].join(""),
@@ -4562,11 +6931,11 @@ var FILE_CHANGED_MESSAGE = "{name} ({id}) changed while the index was built: not
4562
6931
  var BUILD_STEP_NAME = "standard index";
4563
6932
 
4564
6933
  // src/lib/knowledge/standard/standard-index-folder.ts
4565
- import { existsSync as existsSync21, mkdirSync as mkdirSync6, readFileSync as readFileSync15, renameSync as renameSync4, writeFileSync as writeFileSync5 } from "fs";
4566
- import { join as join26 } from "path";
6934
+ import { existsSync as existsSync24, mkdirSync as mkdirSync6, readFileSync as readFileSync16, renameSync as renameSync4, writeFileSync as writeFileSync5 } from "fs";
6935
+ import { join as join28 } from "path";
4567
6936
  function writeIndexFolder(params) {
4568
6937
  const { folder, manifest, search } = params;
4569
- mkdirSync6(join26(folder, LINES_FOLDER), { recursive: true });
6938
+ mkdirSync6(join28(folder, LINES_FOLDER), { recursive: true });
4570
6939
  for (const file of search.files)
4571
6940
  writeFileSync5(
4572
6941
  linesPathOf({ folder, fileId: file.fileId }),
@@ -4584,27 +6953,27 @@ function writeIndexFolder(params) {
4584
6953
  crossReferences: perFile({ files: search.files, value: (file) => file.crossReferences })
4585
6954
  };
4586
6955
  for (const part of PER_FILE_PARTS)
4587
- writeJson({ path: join26(folder, INDEX_FILES[part]), content: parts[part] });
6956
+ writeJson({ path: join28(folder, INDEX_FILES[part]), content: parts[part] });
4588
6957
  const words = {
4589
6958
  words: search.words,
4590
6959
  units: search.units,
4591
6960
  lineUnits: search.lineUnits
4592
6961
  };
4593
- writeJson({ path: join26(folder, INDEX_FILES.words), content: words });
4594
- writeJson({ path: join26(folder, INDEX_FILES.manifest), content: manifest });
6962
+ writeJson({ path: join28(folder, INDEX_FILES.words), content: words });
6963
+ writeJson({ path: join28(folder, INDEX_FILES.manifest), content: manifest });
4595
6964
  }
4596
6965
  function isCompleteIndexFolder(params) {
4597
- return existsSync21(join26(params.folder, INDEX_FILES.manifest));
6966
+ return existsSync24(join28(params.folder, INDEX_FILES.manifest));
4598
6967
  }
4599
6968
  function readIndexFolder(params) {
4600
6969
  const { folder } = params;
4601
- const manifest = readJson({ path: join26(folder, INDEX_FILES.manifest) });
6970
+ const manifest = readJson({ path: join28(folder, INDEX_FILES.manifest) });
4602
6971
  const parts = {
4603
- quality: readJson({ path: join26(folder, INDEX_FILES.quality) }),
4604
- headings: readJson({ path: join26(folder, INDEX_FILES.headings) }),
4605
- definitions: readJson({ path: join26(folder, INDEX_FILES.definitions) }),
4606
- tables: readJson({ path: join26(folder, INDEX_FILES.tables) }),
4607
- crossReferences: readJson({ path: join26(folder, INDEX_FILES.crossReferences) })
6972
+ quality: readJson({ path: join28(folder, INDEX_FILES.quality) }),
6973
+ headings: readJson({ path: join28(folder, INDEX_FILES.headings) }),
6974
+ definitions: readJson({ path: join28(folder, INDEX_FILES.definitions) }),
6975
+ tables: readJson({ path: join28(folder, INDEX_FILES.tables) }),
6976
+ crossReferences: readJson({ path: join28(folder, INDEX_FILES.crossReferences) })
4608
6977
  };
4609
6978
  const files = manifest.files.map((entry) => {
4610
6979
  const { noiseRanges, ...quality } = parts.quality[entry.id];
@@ -4620,10 +6989,10 @@ function readIndexFolder(params) {
4620
6989
  quality
4621
6990
  };
4622
6991
  });
4623
- return { manifest, files, words: readJson({ path: join26(folder, INDEX_FILES.words) }) };
6992
+ return { manifest, files, words: readJson({ path: join28(folder, INDEX_FILES.words) }) };
4624
6993
  }
4625
6994
  function tagsPathOf(params) {
4626
- return join26(params.folder, `${TAGS_FILE_PREFIX}${params.installedHash}${JSON_EXTENSION}`);
6995
+ return join28(params.folder, `${TAGS_FILE_PREFIX}${params.installedHash}${JSON_EXTENSION}`);
4627
6996
  }
4628
6997
  function writeTagsFile(params) {
4629
6998
  const temporary = `${params.path}${TEMPORARY_INFIX2}${process.pid}`;
@@ -4635,10 +7004,10 @@ function readTagsFile(params) {
4635
7004
  }
4636
7005
  function linesPathOf(params) {
4637
7006
  const name = params.fileId.slice(params.fileId.indexOf(FILE_ID_SEPARATOR) + 1);
4638
- return join26(params.folder, LINES_FOLDER, `${name}${LINES_EXTENSION}`);
7007
+ return join28(params.folder, LINES_FOLDER, `${name}${LINES_EXTENSION}`);
4639
7008
  }
4640
7009
  function readLines(params) {
4641
- return readFileSync15(linesPathOf(params), "utf8").split("\n").filter((line) => line !== "").map((line) => JSON.parse(line));
7010
+ return readFileSync16(linesPathOf(params), "utf8").split("\n").filter((line) => line !== "").map((line) => JSON.parse(line));
4642
7011
  }
4643
7012
  function perFile(params) {
4644
7013
  return Object.fromEntries(params.files.map((file) => [file.fileId, params.value(file)]));
@@ -4648,17 +7017,17 @@ function writeJson(params) {
4648
7017
  `);
4649
7018
  }
4650
7019
  function readJson(params) {
4651
- return JSON.parse(readFileSync15(params.path, "utf8"));
7020
+ return JSON.parse(readFileSync16(params.path, "utf8"));
4652
7021
  }
4653
7022
 
4654
7023
  // src/lib/knowledge/standard/ensure-standard-index.ts
4655
7024
  async function ensureStandardIndex(params) {
4656
7025
  const startedAt = Date.now();
4657
7026
  const { standard, installed } = params;
4658
- const folder = join27(params.cacheRoot, CACHE_LOCATION.standardFolder, standard.id);
7027
+ const folder = join29(params.cacheRoot, CACHE_LOCATION.standardFolder, standard.id);
4659
7028
  const hashed = standard.files.map(hashedFileOf);
4660
7029
  const manifestHash = manifestHashOf({ hashed });
4661
- const target = join27(folder, manifestHash);
7030
+ const target = join29(folder, manifestHash);
4662
7031
  const ready = { standardId: standard.id, manifestHash, startedAt, target, installed };
4663
7032
  if (!params.rebuild && isCompleteIndexFolder({ folder: target }))
4664
7033
  return readyAnswer({ ...ready, state: "reused" });
@@ -4705,7 +7074,7 @@ function readyAnswer(params) {
4705
7074
  };
4706
7075
  }
4707
7076
  function hashedFileOf(file) {
4708
- const bytes = readFileSync16(file.path);
7077
+ const bytes = readFileSync17(file.path);
4709
7078
  return {
4710
7079
  id: file.id,
4711
7080
  name: file.name,
@@ -4723,7 +7092,7 @@ async function buildInto(params) {
4723
7092
  const files = [];
4724
7093
  for (const file of hashed) {
4725
7094
  await nextTurn();
4726
- const bytes = readFileSync16(file.path);
7095
+ const bytes = readFileSync17(file.path);
4727
7096
  params.afterFileRead?.({ path: file.path });
4728
7097
  if (sha256Of(bytes) !== file.sha256) return abortedBy(file);
4729
7098
  files.push(indexStandardText({ fileId: file.id, text: bytes.toString("utf8") }));
@@ -4747,7 +7116,7 @@ async function buildInto(params) {
4747
7116
  path: tagsPathOf({ folder: params.folder, installedHash: installed.installedHash }),
4748
7117
  content: { vocabulary: installed.vocabulary, tagLinks: search.tagLinks }
4749
7118
  });
4750
- const moved = hashed.find((file) => sha256Of(readFileSync16(file.path)) !== file.sha256);
7119
+ const moved = hashed.find((file) => sha256Of(readFileSync17(file.path)) !== file.sha256);
4751
7120
  return moved ? abortedBy(moved) : { kind: "built", search };
4752
7121
  }
4753
7122
  function placeFolder(params) {
@@ -4810,7 +7179,7 @@ function readSearchIndex(params) {
4810
7179
  };
4811
7180
  if (installed.installedHash === void 0) return search;
4812
7181
  const path = tagsPathOf({ folder, installedHash: installed.installedHash });
4813
- if (existsSync22(path)) return { ...search, tagLinks: readTagsFile({ path }).tagLinks };
7182
+ if (existsSync25(path)) return { ...search, tagLinks: readTagsFile({ path }).tagLinks };
4814
7183
  const tagLinks = tagLinksOf({
4815
7184
  files,
4816
7185
  units: words.units,
@@ -4821,11 +7190,11 @@ function readSearchIndex(params) {
4821
7190
  return { ...search, tagLinks };
4822
7191
  }
4823
7192
  function removeStaleTemporaryFolders(params) {
4824
- if (!existsSync22(params.folder)) return;
7193
+ if (!existsSync25(params.folder)) return;
4825
7194
  for (const name of readdirSync11(params.folder)) {
4826
7195
  const pid = LEFT_FOLDER_PATTERN.exec(name)?.[1];
4827
7196
  if (pid !== void 0 && !isProcessAlive(Number(pid)))
4828
- rmSync5(join27(params.folder, name), { recursive: true, force: true });
7197
+ rmSync5(join29(params.folder, name), { recursive: true, force: true });
4829
7198
  }
4830
7199
  }
4831
7200
  function abortedBy(file) {
@@ -4848,11 +7217,11 @@ function sha256Of(content) {
4848
7217
 
4849
7218
  // src/lib/knowledge/standard/read-installed-vocabulary.ts
4850
7219
  import { createHash as createHash4 } from "crypto";
4851
- import { existsSync as existsSync23 } from "fs";
4852
- import { join as join28 } from "path";
7220
+ import { existsSync as existsSync26 } from "fs";
7221
+ import { join as join30 } from "path";
4853
7222
  async function readInstalledVocabulary(params) {
4854
7223
  const { cwd, packageName: packageName2 } = params;
4855
- const installed = existsSync23(join28(cwd, PACKAGE_MANIFEST)) ? (await loadDialectes({ cwd })).dialectes : [];
7224
+ const installed = existsSync26(join30(cwd, PACKAGE_MANIFEST)) ? (await loadDialectes({ cwd })).dialectes : [];
4856
7225
  const selected = packageName2 === void 0 ? installed : installed.filter((dialecte) => dialecte.packageName === packageName2);
4857
7226
  if (packageName2 !== void 0 && selected.length === 0)
4858
7227
  return {
@@ -4877,7 +7246,7 @@ function vocabularyOf(params) {
4877
7246
  for (const value of readers.enumeratedValues(datatype)) values.add(value);
4878
7247
  }
4879
7248
  }
4880
- const packages = dialectes.map((dialecte) => `${dialecte.packageName}@${versionOf({ cwd, dialecte })}`).sort();
7249
+ const packages = dialectes.map((dialecte) => `${dialecte.packageName}@${versionOf2({ cwd, dialecte })}`).sort();
4881
7250
  return {
4882
7251
  vocabulary: {
4883
7252
  tags: [...tags].sort(),
@@ -4888,7 +7257,7 @@ function vocabularyOf(params) {
4888
7257
  installedHash: createHash4("sha256").update(packages.join(INSTALLED_LIST_SEPARATOR)).digest("hex").slice(0, INSTALLED_HASH_LENGTH)
4889
7258
  };
4890
7259
  }
4891
- function versionOf(params) {
7260
+ function versionOf2(params) {
4892
7261
  const own = readManifest(params.cwd);
4893
7262
  const folder = own?.name === params.dialecte.packageName ? params.cwd : findInstalledPackage({ cwd: params.cwd, name: params.dialecte.packageName });
4894
7263
  return (folder === void 0 ? void 0 : readManifest(folder)?.version) ?? "";
@@ -4902,8 +7271,8 @@ function emptyInstalledVocabulary() {
4902
7271
  }
4903
7272
 
4904
7273
  // src/lib/knowledge/standard/read-standard-input.ts
4905
- import { existsSync as existsSync25, readdirSync as readdirSync12, realpathSync as realpathSync5, statSync as statSync7 } from "fs";
4906
- import { join as join30 } from "path";
7274
+ import { existsSync as existsSync28, readdirSync as readdirSync12, realpathSync as realpathSync6, statSync as statSync7 } from "fs";
7275
+ import { join as join32 } from "path";
4907
7276
 
4908
7277
  // src/lib/standard/read-standard-root.ts
4909
7278
  import { resolve as resolve6 } from "path";
@@ -4976,20 +7345,20 @@ function standardFoldersOf(params) {
4976
7345
  }
4977
7346
 
4978
7347
  // src/lib/knowledge/standard/work-tree-holding.ts
4979
- import { existsSync as existsSync24, realpathSync as realpathSync4 } from "fs";
4980
- import { dirname as dirname12, join as join29 } from "path";
7348
+ import { existsSync as existsSync27, realpathSync as realpathSync5 } from "fs";
7349
+ import { dirname as dirname13, join as join31 } from "path";
4981
7350
  function workTreeHolding(params) {
4982
- let folder = realpathSync4(nearestExisting(params.path));
7351
+ let folder = realpathSync5(nearestExisting(params.path));
4983
7352
  for (; ; ) {
4984
- if (existsSync24(join29(folder, GIT_ENTRY2))) return folder;
4985
- const parent = dirname12(folder);
7353
+ if (existsSync27(join31(folder, GIT_ENTRY2))) return folder;
7354
+ const parent = dirname13(folder);
4986
7355
  if (parent === folder) return void 0;
4987
7356
  folder = parent;
4988
7357
  }
4989
7358
  }
4990
7359
  function nearestExisting(path) {
4991
7360
  let existing = path;
4992
- while (!existsSync24(existing)) existing = dirname12(existing);
7361
+ while (!existsSync27(existing)) existing = dirname13(existing);
4993
7362
  return existing;
4994
7363
  }
4995
7364
 
@@ -5001,7 +7370,7 @@ function readStandardInput(params) {
5001
7370
  return refused(rootRefusal ?? INPUT_MESSAGES.notSet, STANDARD_LAYOUT);
5002
7371
  const workTree = workTreeRefusal({ path: root });
5003
7372
  if (workTree) return refused(workTree);
5004
- const entries = entriesOf({ folder: root });
7373
+ const entries = entriesOf2({ folder: root });
5005
7374
  const topLevelFiles = entries.filter((entry) => entry.kind === "file" && entry.name.endsWith(STANDARD_FILE_EXTENSION)).filter((entry) => !entry.name.startsWith(HIDDEN_NAME_START)).map((entry) => entry.name).sort();
5006
7375
  if (topLevelFiles.length > 0)
5007
7376
  return refused(
@@ -5036,10 +7405,10 @@ function readStandardInput(params) {
5036
7405
  );
5037
7406
  const selected = [];
5038
7407
  for (const named of chosen) {
5039
- const folder = join30(root, named.name);
7408
+ const folder = join32(root, named.name);
5040
7409
  const folderRefusal = workTreeRefusal({ path: folder });
5041
7410
  if (folderRefusal) return refused(folderRefusal);
5042
- const files = standardFilesOf({ standardId: named.id, entries: entriesOf({ folder }) });
7411
+ const files = standardFilesOf({ standardId: named.id, entries: entriesOf2({ folder }) });
5043
7412
  if (files.kind === "collision")
5044
7413
  return refused(
5045
7414
  fillMessage({
@@ -5050,7 +7419,7 @@ function readStandardInput(params) {
5050
7419
  selected.push({
5051
7420
  ...named,
5052
7421
  folder,
5053
- files: files.kept.map((file) => ({ ...file, path: join30(folder, file.name) }))
7422
+ files: files.kept.map((file) => ({ ...file, path: join32(folder, file.name) }))
5054
7423
  });
5055
7424
  }
5056
7425
  return { kind: "input", input: { root, known, selected } };
@@ -5062,17 +7431,17 @@ function workTreeRefusal(params) {
5062
7431
  function refusalOfRoot(params) {
5063
7432
  const { root } = params;
5064
7433
  if (root === void 0) return INPUT_MESSAGES.notSet;
5065
- if (!existsSync25(root))
7434
+ if (!existsSync28(root))
5066
7435
  return fillMessage({ template: INPUT_MESSAGES.missing, values: { path: root } });
5067
7436
  if (!statSync7(root).isDirectory())
5068
7437
  return fillMessage({ template: INPUT_MESSAGES.notFolder, values: { path: root } });
5069
7438
  return void 0;
5070
7439
  }
5071
- function entriesOf(params) {
7440
+ function entriesOf2(params) {
5072
7441
  return readdirSync12(params.folder).flatMap((name) => {
5073
- const path = join30(params.folder, name);
5074
- if (!existsSync25(path)) return [];
5075
- const stats = statSync7(realpathSync5(path));
7442
+ const path = join32(params.folder, name);
7443
+ if (!existsSync28(path)) return [];
7444
+ const stats = statSync7(realpathSync6(path));
5076
7445
  if (stats.isDirectory()) return [{ name, kind: "folder" }];
5077
7446
  return stats.isFile() ? [{ name, kind: "file" }] : [];
5078
7447
  });
@@ -5082,18 +7451,18 @@ function refused(message, layout) {
5082
7451
  }
5083
7452
 
5084
7453
  // src/lib/knowledge/standard/standard-cache-root.ts
5085
- import { homedir } from "os";
5086
- import { join as join31 } from "path";
7454
+ import { homedir as homedir2 } from "os";
7455
+ import { join as join33 } from "path";
5087
7456
  function standardCacheRoot(params) {
5088
7457
  const { environment } = params;
5089
7458
  const cacheHome = environment[CACHE_LOCATION.environmentVariable];
5090
- const base = cacheHome ? cacheHome : join31(environment[CACHE_LOCATION.homeVariable] || homedir(), CACHE_LOCATION.homeFolder);
5091
- return join31(base, CACHE_LOCATION.toolFolder);
7459
+ const base = cacheHome ? cacheHome : join33(environment[CACHE_LOCATION.homeVariable] || homedir2(), CACHE_LOCATION.homeFolder);
7460
+ return join33(base, CACHE_LOCATION.toolFolder);
5092
7461
  }
5093
7462
 
5094
7463
  // src/lib/knowledge/standard/standard-files-key.ts
5095
7464
  import { createHash as createHash5 } from "crypto";
5096
- import { readFileSync as readFileSync17 } from "fs";
7465
+ import { readFileSync as readFileSync18 } from "fs";
5097
7466
 
5098
7467
  // src/lib/stable-json.ts
5099
7468
  function stableJson(value) {
@@ -5243,7 +7612,7 @@ async function loadStandardIndexes(params) {
5243
7612
  }
5244
7613
  function filesReadOf(params) {
5245
7614
  return params.standard.files.map(function fileReadOf(file) {
5246
- const bytes = readFileSync18(file.path);
7615
+ const bytes = readFileSync19(file.path);
5247
7616
  return {
5248
7617
  manifest: {
5249
7618
  id: file.id,