Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(cli): expose extract flags in help (#3864)
Ziyang Guo9f81e1d8b264
diff --git a/docs/architecture/KEY_FILES.md b/docs/architecture/KEY_FILES.mdindex 95a8ebb4cf..0ec0276ac4 100644--- a/docs/architecture/KEY_FILES.md+++ b/docs/architecture/KEY_FILES.md@@ -203,6 +203,7 @@ per-release `**vX.Y.Z:**` narration — CI enforces this- `src/commands/extract-conversation-facts.ts` + `src/core/cycle/conversation-facts-backfill.ts` — bulk fact extraction for long-form conversation pages. Walks conversation/meeting/slack/email/imessage/imessage-daily pages, splits them into time-windowed segments (30-min gap or 30-msg cap), prepends a topical/temporal header, and uses the strict `extractFactsFromTurnWithOutcome()` path so provider and output failures remain retryable instead of becoming successful empty pages. Invariants: **strict per-source core** (`runExtractConversationFactsCore({sourceId, ...})` always takes one sourceId; CLI + cycle phase each do their own multi-source iteration because `PHASE_SCOPE='source'` is taxonomy-only); **bounded two-phase enumeration** (paginated `listPages({type, sourceId, limit:10})`; per-page body cap `MAX_PAGE_BODY_BYTES=25MB`); **page-global `row_num` accumulator** (the facts unique index is `(source_id, source_markdown_slug, row_num)`); **versioned snapshot-bound outcomes** (`cli:extract-conversation-facts:terminal:v2` for complete pages and a separate `non-extractable:v2` source for recognized pages with no eligible segment); **operation checkpoints are scheduling hints only** and never suppress a replay without a matching v2 outcome; **optional `opts.budgetTracker?`** is used as-is, while an absent tracker is created with `maxCostUsd`; **body reads cover compiled truth, timeline, and configured raw-transcript sidecars**; **`facts.extraction_enabled` kill-switch** with `--override-disabled`; **`--types LIST` allowlist** (`conversation,meeting,slack,email,imessage,imessage-daily`); and **`--background` via `maybeBackground`**. The companion `conversation_facts_backfill` cycle phase is default-off, iterates every source, and enforces per-source plus brain-wide cost and wall-time caps. Migration v94 provides the partial facts index used by outcome lookups. `computeConversationFactsBacklogCheck` reports fresh completed, scanned-not-extractable, and unfinished counts separately, warning when more than 10 eligible pages lack a fresh v2 outcome. `sources audit` exposes `facts_backfill_estimate: {pages, est_segments, est_cost_usd, types}`. Pinned by `test/extract-conversation-facts.test.ts` and `test/doctor-conversation-facts-backlog.test.ts`.- `src/core/link-extraction.ts` — shared library for the graph layer. `extractEntityRefs` (canonical) matches `[Name](people/slug)` markdown links and Obsidian `[[people/slug|Name]]` wikilinks; `extractPageLinks`, `inferLinkType` heuristics (attended/works_at/invested_in/founded/advises/source/mentions), `parseTimelineEntries`, `isAutoLinkEnabled`. #2576: markdown links, bare-slug prose refs, and slash-shaped wikilinks match ANY dir-shaped path (`ANY_DIR_SEGMENT`), not a directory whitelist — nonexistent targets are dropped by the persist paths' page-existence checks (`resolveCandidateSources`, put_page's allSlugs filter, `addLinksBatch` INNER JOINs) and counted as `skippedMissingTarget` in the extract summaries; the `DIR_PATTERN` whitelist survives only as the typed fast-path for pass-2b wikilinks (non-whitelisted `[[dir/...]]` get an equivalent direct typed candidate in pass 2c, plus the flag-gated suffix rescue for non-exact matches). Used by extract.ts, operations.ts auto-link post-hook, and backlinks.ts. **Opt-in global-basename wikilink resolution** (issue #972, default off): `WIKILINK_GENERIC_RE` catches bare `[[name]]` wikilinks outside `DIR_PATTERN` (third pass `2c` in `extractEntityRefs`); `EntityRef.needsResolution: true` tags refs from this pass (the ref's `slug` is the wikilink TARGET, `name` the optional display alias). `SlugResolver` gains optional `resolveBasenameMatches(name): Promise<string[]>` (multi-match by design — emits one edge per matching page). The single shared basename matcher is `buildBasenameIndex(slugs)` + `queryBasenameIndex(index, name)` + `normalizeBasename` (keys raw/lower/slugified tail, stable-sorted shorter-first then lexical), used by `makeResolver`, the FS `resolveBasenameMatchesFromSlugs`, AND the doctor check so they cannot drift. `makeResolver(engine, {mode, sourceId})` builds the index lazily via `engine.getAllSlugs({sourceId})` — source-scoped so a bare `[[name]]` never resolves to a same-tail page in a different source. `extractPageLinks` gains `opts.globalBasename` (routes `needsResolution` refs through `resolveBasenameMatches` keyed on `ref.slug`, emits candidates tagged `linkType: 'wikilink_basename'` + `linkSource: 'wikilink-resolved'`, skips self-loops) and `opts.skipFrontmatter` (replaces the old `nullResolver` ternary). All three surfaces (FS extract, DB extract, `put_page` auto-link) tag provenance with `link_source='wikilink-resolved'`; `put_page` includes it in its reconcilable-edge set so stale basename edges are removed when the wikilink or the flag goes away. Exports `WIKILINK_BASENAME_LINK_TYPE` + `isGlobalBasenameEnabled(engine)` (resolution order: env `GBRAIN_LINK_RESOLUTION_GLOBAL_BASENAME` → DB config `link_resolution.global_basename` → default false). `gbrain doctor`'s `link_resolution_opportunity` check surfaces a paste-ready enable hint when ≥5 bare wikilinks would resolve AND ≥20% match. Migration v113 widens `links_link_source_check` to admit `'wikilink-resolved'`; v114 (#1941) then opens it to any kebab-case provenance (`^[a-z][a-z0-9]*(-[a-z0-9]+)*$`, ≤64 chars) so external derivers register their own tag (e.g. `citation-graph`) without a migration. `LINK_EXTRACTOR_VERSION_TS` also lives here (bump like `CHUNKER_VERSION` to invalidate prior extract-stale stamps). Pinned by `test/link-extraction.test.ts`, `test/extract-fs.test.ts`, `test/doctor.test.ts`, `test/e2e/global-basename-pglite.test.ts`.- `src/commands/extract.ts` — `gbrain extract links|timeline|all [--source fs|db] [--source-id <id>]`: batch link/timeline extraction. fs walks markdown files, db walks pages from the engine (mutation-immune snapshot iteration; use for live brains with no local checkout). No in-memory dedup pre-load — candidates buffered 100 at a time and flushed via `addLinksBatch` / `addTimelineEntriesBatch`; `ON CONFLICT DO NOTHING` enforces uniqueness at the DB layer, `created` counter returns real rows inserted. `ExtractOpts.slugs?: string[]` enables incremental extract via `extractForSlugs()` (single combined links+timeline pass); the cycle path threads sync's `pagesAffected` through. `walkMarkdownFiles(brainDir)` still runs to build `allSlugs` for link resolution. `--source-id <id>` scopes extraction to one source on federated brains (resolved via `resolveSourceWithTier()` before any SQL; failures hint `gbrain sources list`). `gbrain extract --stale [--source-id <id>] [--catch-up] [--dry-run] [--json]` branch (`extractStaleFromDB`) — incremental DB-source link+timeline sweep over pages whose `pages.links_extracted_at` watermark is stale. Stale predicate (shared by both engines + the doctor check): `links_extracted_at IS NULL OR links_extracted_at < LINK_EXTRACTOR_VERSION_TS::timestamptz OR updated_at > links_extracted_at` (the `updated_at` arm catches MCP `put_page` / `sync --no-extract` edited-since-extract). Three new `BrainEngine` methods (parity in postgres-engine.ts + pglite-engine.ts + bootstrap probes): `countStalePagesForExtraction(opts?)`, `listStalePagesForExtraction({batchSize, afterPageId?, sourceId?, versionTs?})` (returns page CONTENT to avoid N+1 `getPage`; `rowToStalePage` in utils.ts maps the row, `StalePageRow` in types.ts), `markPagesExtractedBatch(refs, defaultExtractedAt)` (3-array unnest `slug[],source_id[],ts[]`; each ref may carry its own `extractedAt`). `STALE_BATCH_SIZE` default 25 (`GBRAIN_EXTRACT_STALE_BATCH`; small because page bodies are unbounded — the LIMIT is the only fetch-time memory bound); `STALE_TIME_BUDGET_MS` 30min wall-clock (`--catch-up` removes the cap). Non-swallowing flush: link/timeline flush throws propagate and abort the batch; stamp LAST so a crash leaves pages unstamped and they re-extract idempotently (`addLinksBatch` ON CONFLICT DO NOTHING + timeline dedup). Race fix: `extractStaleFromDB` stamps with each row's READ `updated_at` (not `now()`), so a concurrent edit during the sweep keeps the page stale and it re-extracts next run rather than marked fresh-with-old-content. Source-correct stamping at DB-extract sites via `stampExtracted` (best-effort, never throws); `extractLinksFromDB` only stamps the combined watermark when `subcommand === 'all'` (a links-only run must not hide timeline staleness). `LINK_EXTRACTOR_VERSION_TS` lives in `src/core/link-extraction.ts` (bump like `CHUNKER_VERSION` to invalidate all prior stamps). Migration v112 (`pages_links_extracted_at`) adds nullable `TIMESTAMPTZ` + composite `(source_id, links_extracted_at)` index (CONCURRENTLY + invalid-remnant pre-drop on Postgres, plain on PGLite), NO backfill so the real backlog surfaces on first `gbrain doctor`. Schema parity in schema.sql + pglite-schema.ts + schema-embedded.ts + `REQUIRED_BOOTSTRAP_COVERAGE`. `src/commands/doctor.ts:checkLinksExtractionLag` (the `links_extraction_lag` check, also in `doctorReportRemote`) warn-only by default (>`GBRAIN_EXTRACTION_LAG_WARN_PCT`, default 20%; shared `EXTRACTION_LAG_WARN_PCT_DEFAULT` + `EXTRACTION_LAG_MIN_PAGES=100` + exported `_resolveEnvNumber`), hard-fails only when `GBRAIN_EXTRACTION_LAG_FAIL_PCT` is set; vacuous-skips <100 pages (no `--source`); pre-v112 brains graceful-skip via `isUndefinedColumnError`; strictly a SQL COUNT (safe on remote/thin-client). `src/commands/sync.ts` gains `--no-extract` (threaded through single-source + `--all` + `syncOneSource`), stamps `links_extracted_at` for `pagesAffected` at the inline-extract call site, and `maybeExtractionNudge` prints a one-line stderr nudge after a `synced | first_sync | up_to_date` sync that leaves a backlog (`shouldNudgeAfterSync` pure predicate; `GBRAIN_SYNC_NO_EXTRACT_NUDGE` suppresses). `src/core/retry.ts` adds `'extract.stale'` to `BATCH_AUDIT_SITES`; `src/core/doctor-categories.ts` adds `links_extraction_lag` to `BRAIN_CHECK_NAMES`. Pinned by `test/extract-stale.test.ts` (incl. edited-after-stamp regression + crash-contract), `test/sync-inline-extract-stamps.serial.test.ts`, `test/sync-nudge-status-gate.test.ts`, `test/doctor-links-extraction-lag.test.ts`, engine-parity (Postgres↔PGLite) for the 3 methods + v112 round-trip. The stale SELECT in both engines projects a deterministic full-µs UTC string `to_char(updated_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"') AS updated_at_iso` (carried on `StalePageRow.updated_at_iso`, populated by `rowToStalePage` in utils.ts with an ISO-only fallback — never `String(Date)`, which `::timestamptz` misparses); `extractStaleFromDB` stamps that exact-precision value, not a JS `Date` (which truncates to milliseconds), so on Postgres `links_extracted_at` equals the row's `updated_at` to the microsecond and `links_extraction_lag` clears — a ms-truncated stamp stays strictly below the µs `updated_at` and leaves every page perpetually stale, which `extract --stale` could never satisfy. `to_char` (not raw `::text`, which is `DateStyle`-fragile) keeps the projection deterministic. The `markPagesExtractedBatch` SQL is unchanged, so callers passing an explicit (e.g. backdated) `extractedAt` still control the stamp and the edited-since arm is exact. A deterministic PGLite regression in `test/extract-stale.test.ts` injects a µs `updated_at`, runs `--stale`, and asserts the lag is 0 and stays 0.+- Extract CLI help — `EXTRACT_HELP` in `src/commands/extract.ts` is the canonical detailed usage shared by `--help` and invalid-subcommand errors. `src/cli.ts` routes `extract --help` before engine connection so help works on unconfigured installs; the top-level TOOLS block advertises every mode-specific flag. Pinned by `test/cli-help-discoverability.test.ts`.- `src/core/extract/receipt-writer.ts` + `src/core/extract/rollup-writer.ts` + `src/commands/extract-status.ts` + `src/commands/extract-explain.ts` + `src/commands/extract-benchmark.ts` + `src/core/schema-pack/scaffold-extractable.ts` — unified extract operator surface. Every shipped extractor (deterministic `facts.conversation` in `src/commands/extract-conversation-facts.ts` + three LLM-backed cycle phases at `src/core/cycle/{extract-atoms,synthesize-concepts,propose-takes,extract-facts}.ts`) writes ONE receipt page per run (`writeReceipt`) + UPSERTs a row to `extract_rollup_7d` (`upsertExtractRollup`). Receipt slug `extracts/{date}/{kind}/{source_id}/{run_id_short}/round-{N}.md`; frontmatter stamps BOTH `type: extract_receipt` AND `dream_generated: true` (belt+suspenders against extraction-loop guard drift). `extract_receipt` joins `ALL_PAGE_TYPES` in `src/core/types.ts`; `extracts/` prefix gets a 0.3x source-boost demote in `src/core/search/source-boost.ts`. Migration v104 adds `extract_rollup_7d (kind, source_id, day, cost_usd, halt_count, eval_pass_count, eval_fail_count, round_completed_count, rollup_write_failures, updated_at)` with PK `(kind, source_id, day)` + `idx_extract_rollup_7d_day`. Rollup writes best-effort with process-scoped error-dedup so transient DB failures bump `rollup_write_failures` instead of crashing the cycle. `extract_health` doctor check reads last 7 days, warns at halt-rate > 10% AND when rollup_write_failures > 0; pre-v104 brains report `ok`. CLI: `gbrain extract status [--source-id ID] [--kind X] [--verbose] [--json]` (7-day rollup, sorted halt_rate desc + cost desc, top-5 + "more rows" hint, stable `schema_version: 1`); `gbrain extract --explain <kind>` (resolution chain pack-declared vs built-in cycle phase, prompt_template + fixture_corpus paths with `✓`/`(missing)`, last 7d rollup); `gbrain extract benchmark --pack X --kind Y` (loads pack fixture corpus through strict path validation — rejects absolute paths, `..` traversal, null bytes, AND symlinks resolving outside pack root; ships as a stub-reporter). `src/core/schema-pack/manifest-v1.ts` widens `extractable` from `z.boolean()` to `z.union([z.boolean(), ExtractableSpecSchema])` (carries `prompt_template`, `fixture_corpus`, `eval_dimensions`, `benchmark_min_recall`, plus reserved `verifier_path` — parses but refuses at runtime); `extractableSpecsFromPack` + `getExtractableSpec` + `refuseVerifierPathInV042` in `src/core/schema-pack/extractable.ts`; `gbrain schema scaffold-extractable <type> --pack <pack>` declares the type extractable, generates 5 placeholder fixtures + a prompt template stub under `packs/<pack>/{fixtures,prompts}/extract/`, refuses to overwrite without `--force`. Pinned by `test/extractable-spec-widening.test.ts` (22), `test/extract/receipt-writer.test.ts` (12, canonical PGLite block R3+R4), `test/extract/benchmark.test.ts` (17), `test/extract/status.test.ts` (15), `test/schema-pack/scaffold-extractable.test.ts` (15, privacy guards), `test/doctor-extract-health.test.ts` (8).- `src/commands/import.ts` — `gbrain import <path> [--source-id <id>]`: page import with the path-set checkpoint. `--source-id <id>` routes pages to the named source (resolved via `resolveSourceWithTier()` at the boundary; consistent across `import`, `extract`, `graph-query`, `sources current`). Pinned by `test/import-source-id.test.ts`.- `src/commands/graph-query.ts` — `gbrain graph-query <slug> [--type T] [--depth N] [--direction in|out|both] [--include-foreign]`: typed-edge relationship traversal (renders indented tree). Foreign-edge footer always present (`X foreign edges (use --include-foreign to traverse)`) so cross-source edges never disappear silently; `--include-foreign` widens the SQL filter to walk them. Pinned by `test/graph-query.test.ts`.diff --git a/src/cli.ts b/src/cli.tsindex 35786d451f..990a661d19 100755--- a/src/cli.ts+++ b/src/cli.ts@@ -93,6 +93,9 @@ const CLI_ONLY_SELF_HELP = new Set([// short-circuit fired before runSync could print its own usage block.// Adding `sync` here routes `gbrain sync --help` into runSync.'sync',+ // #3834: extract ships detailed help for its mode-specific flags. Keep the+ // generic CLI-only stub from hiding that contract.+ 'extract',// v0.37 fix wave (deferred TODO, shipped): reinit-pglite has its// own --help in runReinitPglite. Routing through SELF_HELP avoids// the generic short-circuit so the destructive-action warning text@@ -1717,6 +1720,14 @@ async function handleCliOnly(command: string, args: string[]) {return;}+ // #3834: extract help is engine-independent and must work on a fresh+ // install before a brain has been configured.+ if (command === 'extract' && (args.includes('--help') || args.includes('-h'))) {+ const { runExtract } = await import('./commands/extract.ts');+ await runExtract(null as never, args);+ return;+ }+// v0.39.3.0 WARN-5: same pattern for `capture --help`. CLI_ONLY_SELF_HELP// now includes 'capture' so the generic short-circuit at :101 stays out// of the way, but the dispatch case at :1229 still needs an engine. The@@ -2653,10 +2664,13 @@ TIMELINETOOLSextract <links|timeline|all> Extract links/timeline (idempotent)- [--source fs|db] fs (default) walks .md files; db iterates engine pages- [--dir <brain>] brain dir for fs source- [--type T] [--since DATE] filters (db source)- [--dry-run] [--json]+ [--source fs|db] [--source-id ID] [--dir <brain>]+ [--type T] [--since DATE] [--include-frontmatter]+ [--workers N|--concurrency N] [--dry-run] [--json]+ extract links --by-mention [--ner] --source db+ extract timeline --from-meetings [--infer-dates] --source db+ extract --stale [--source-id ID] [--catch-up] [--dry-run] [--json]+ extract --explain <kind> [--json] Full details: gbrain extract --helppublish <page.md> [--password] Shareable HTML (strips private data, optional AES-256)check-backlinks <check|fix> [dir] Find/fix missing back-links across brainlint <dir|file> [--fix] Catch LLM artifacts, placeholder dates, bad frontmatterdiff --git a/src/commands/extract.ts b/src/commands/extract.tsindex 47312c4d17..584218a400 100644--- a/src/commands/extract.ts+++ b/src/commands/extract.ts@@ -672,7 +672,43 @@ export async function runExtractCore(engine: BrainEngine, opts: ExtractOpts): Prreturn result;}+const EXTRACT_HELP = `Usage: gbrain extract <subcommand> [flags]++Extraction:+ gbrain extract links [--source fs|db] [--source-id <id>] [--dir <brain-dir>]+ [--type T] [--since DATE] [--include-frontmatter]+ [--workers N|--concurrency N] [--dry-run] [--json]+ gbrain extract timeline [--source fs|db] [--source-id <id>] [--dir <brain-dir>]+ [--type T] [--since DATE] [--include-frontmatter]+ [--infer-dates] [--workers N|--concurrency N]+ [--dry-run] [--json]+ gbrain extract all [--source fs|db] [--source-id <id>] [--dir <brain-dir>]+ [--type T] [--since DATE] [--include-frontmatter]+ [--infer-dates] [--workers N|--concurrency N]+ [--dry-run] [--json]+ gbrain extract <links|timeline> --by-mention --source db+ gbrain extract <links|timeline|all> --ner --source db+ gbrain extract <timeline|all> --from-meetings --source db++Incremental sweep:+ gbrain extract --stale [--source-id <id>] [--include-frontmatter]+ [--catch-up] [--dry-run] [--json]+ Re-extract links + timeline only for stale pages. DB-source; safe to+ cron. --catch-up loops past the 30-minute budget until none remain.++Inspection:+ gbrain extract --explain <kind> [--json]+ gbrain extract benchmark --pack <name> --kind <type> [--json]++Status:+ gbrain extract status [--source-id ID] [--kind X] [--verbose] [--json]`;+export async function runExtract(engine: BrainEngine, args: string[]) {+ if (args.includes('--help') || args.includes('-h')) {+ console.log(EXTRACT_HELP);+ return;+ }+const subcommand = args[0];// v0.42 Wave C+D dispatch — new operator surfaces. These intercept@@ -800,32 +836,7 @@ export async function runExtract(engine: BrainEngine, args: string[]) {}if (!subcommand || !['links', 'timeline', 'all'].includes(subcommand)) {- console.error(`Usage: gbrain extract <subcommand> [flags]--Extraction (existing):- gbrain extract links [--source fs|db] [--source-id <id>] [--dir <brain-dir>] [--dry-run] [--json] [--type T] [--since DATE] [--workers N]- gbrain extract timeline [--source fs|db] [--source-id <id>] [--dir <brain-dir>] [--dry-run] [--json] [--type T] [--since DATE] [--workers N]- gbrain extract all [--source fs|db] [--source-id <id>] [--dir <brain-dir>] [--dry-run] [--json] [--type T] [--since DATE] [--workers N]- gbrain extract <links|timeline> --by-mention --source db- gbrain extract <links|timeline|all> --ner --source db- gbrain extract <timeline|all> --from-meetings--Incremental sweep (v0.42.7):- gbrain extract --stale [--source-id <id>] [--catch-up] [--dry-run] [--json]- Re-extract links + timeline ONLY for pages whose extraction is stale- (never extracted, edited since, or extractor bumped). DB-source; safe to- cron. --catch-up loops past the 30-min wall-clock budget until 0 remain.--Inspection (v0.42):- gbrain extract --explain <kind> [--json]- Print resolution chain for one pack-declared extractable kind.- gbrain extract benchmark --pack <name> --kind <type> [--json]- Run a pack's fixture corpus through the extractor (v0.42 reports- fixture shape; LLM dispatch comes in v0.43+).--Status (v0.42):- gbrain extract status [--source-id ID] [--kind X] [--verbose] [--json]- Per-kind 7-day rollup: cost, halt rate, eval pass/fail counts.`);+ console.error(EXTRACT_HELP);process.exit(1);}diff --git a/test/cli-help-discoverability.test.ts b/test/cli-help-discoverability.test.tsindex 3a00b39d6d..8769642a76 100644--- a/test/cli-help-discoverability.test.ts+++ b/test/cli-help-discoverability.test.ts@@ -140,3 +140,46 @@ describe('#1175 — main `gbrain --help` SOURCES block matches the real subcommaexpect(stdout).toMatch(/^\s*sources --help\s/m);});});++describe('#3834 — extract flags are discoverable from both help surfaces', () => {+ const implementedFlags = [+ '--by-mention',+ '--catch-up',+ '--concurrency',+ '--explain',+ '--from-meetings',+ '--include-frontmatter',+ '--infer-dates',+ '--ner',+ '--source-id',+ '--stale',+ '--workers',+ ];++ test('`gbrain extract --help` reaches detailed command help without a configured brain', () => {+ const { stdout, stderr, status } = runCli(['extract', '--help']);+ expect(status).toBe(0);+ expect(stderr).toBe('');+ expect(stdout).toContain('Usage: gbrain extract');+ expect(stdout).not.toContain('run gbrain --help for the full command list');+ for (const flag of implementedFlags) expect(stdout).toContain(flag);+ });++ test('`gbrain extract -h` reaches the same detailed command help', () => {+ const { stdout, status } = runCli(['extract', '-h']);+ expect(status).toBe(0);+ expect(stdout).toContain('--stale');+ expect(stdout).toContain('--include-frontmatter');+ });++ test('main `gbrain --help` documents every implemented extract flag', () => {+ const { stdout, status } = runCli(['--help']);+ expect(status).toBe(0);+ const extractStart = stdout.indexOf(' extract <links|timeline|all>');+ const publishStart = stdout.indexOf(' publish <page.md>', extractStart);+ expect(extractStart).toBeGreaterThan(-1);+ expect(publishStart).toBeGreaterThan(extractStart);+ const extractHelp = stdout.slice(extractStart, publishStart);+ for (const flag of implementedFlags) expect(extractHelp).toContain(flag);+ });+});