diff --git a/CHANGELOG.md b/CHANGELOG.md index 28a87fd28..58e0e2688 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Published documentation now links to GitHub for repository files and directories outside + the site mirror. CI reports broken relative links with their page and line number (#1755). - The storyboard tool now sends the requested panel count to the model for inline `--tool`, standalone `tools run --panels`, and MCP generation requests. It accepts 1 to 20 panels and defaults to 4 (#1754). diff --git a/KNOWN_ISSUES.md b/KNOWN_ISSUES.md index 8b113e77a..bb59f0117 100644 --- a/KNOWN_ISSUES.md +++ b/KNOWN_ISSUES.md @@ -794,8 +794,7 @@ endpoint, a different surface from the `labs.google` tRPC API. > because it sends cookies but not that token. The `gflow scene` groundwork now > fetches+caches the token and attaches the Bearer to the **`page.request` REST > path** (`_post_json` / `_patch_json`, host-scoped to `aisandbox-pa`) so -> `uploadImage` / `scenes` / `commit` authenticate — see -> [`docs/superpowers/plans/2026-05-31-l0-bearer-pivot.md`](docs/superpowers/plans/2026-05-31-l0-bearer-pivot.md). +> `uploadImage` / `scenes` / `commit` authenticate. > **Live-verified 2026-05-31:** REST `uploadImage` returns 200 > (`tests/e2e/test_aisandbox_auth_live.py`, credit-free). > **Liberating follow-up:** the same Bearer likely unlocks the `evaluate_fetch` diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index af64fe9b6..265b78c97 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -326,7 +326,7 @@ Process-boundary contextvars bind once: `correlation_id` (UUID4 per CLI invocati Format defaults to **human-readable on TTY**, **JSON when piped or `GFLOW_CLI_LOG_FORMAT=json`**. JSON exceptions use `structlog.tracebacks.ExceptionDictTransformer(show_locals=False)` so frame locals (which may contain auth cookies and signed URLs) are never serialized. TEXT exceptions are formatted by `ConsoleRenderer` with `structlog.dev.plain_traceback`, which omits frame locals; its default Rich formatter would print them. -Pipes cleanly into `jq` / Loki / Datadog without configuration. See [`docs/USER_GUIDE.md` § Journey 6](USER_GUIDE.md#journey-6--read-the-structured-logs) for `jq` recipes. +Pipes cleanly into `jq` / Loki / Datadog without configuration. See [`docs/USER_GUIDE.md` § Journey 6](USER_GUIDE.md#journey-6--reading-structured-logs-jq-recipes) for `jq` recipes. ## Incident diagnostics (shipped, v0.43.0) diff --git a/docs/CHARACTER.md b/docs/CHARACTER.md index 35daa65bf..ea35330d2 100644 --- a/docs/CHARACTER.md +++ b/docs/CHARACTER.md @@ -3,7 +3,7 @@ > **Status:** SHIPPED (live-verified 2026-06-02) · **Issue:** [#145](https://github.com/ffroliva/gflow-cli/issues/145) · **Branch:** `feature/character-creation` > **Living document.** Evolve this as the feature and Flow's API evolve. Raw capture provenance lives in > [`CHARACTER_RECON.md`](CHARACTER_RECON.md); the cross-feature decision lens is -> [the REST-path capability matrix](#capability--cost). +> [the REST-path capability matrix](#3-capability--cost). > **Credit:** pattern-references @kittinan's avatar PR #123 (attach-flow idiom + CLI scaffolding shape) — but > built **greenfield off `develop`, NOT stacked on #123** (that branch is CONFLICTING and likeness-specific; > see [Design decisions](#11-design-decisions-post-predict)). diff --git a/docs/DEBUGGING.md b/docs/DEBUGGING.md index 8fbd93ae2..9f9248f8a 100644 --- a/docs/DEBUGGING.md +++ b/docs/DEBUGGING.md @@ -45,7 +45,7 @@ Confirm by checking for `ui_automation.image_mode_entered` in the log; if it is missing, the mode switch did not run. If `image_mode_entered` is present but `batch_response_seen` is still missing, the remaining hypothesis is the historical UI-flake noted in -[`LIVE_VERIFICATION_v0.7.0.md`](LIVE_VERIFICATION_v0.7.0.md#open-follow-ups) +[`LIVE_VERIFICATION_v0.7.0.md`](LIVE_VERIFICATION_v0.7.0.md#open-follow-ups-not-blocking-v070) (transient overlay swallowed the arrow-forward click). **Two extra artifact file names worth searching for in the out dir** when the diff --git a/docs/USAGE.md b/docs/USAGE.md index c9a8867fe..7ea50c30a 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -923,7 +923,7 @@ All prompts in a batch share one Flow project. The editor is opened once and sta - `MAX_BATCH_PROMPTS = 5` (defined in `src/gflow_cli/image_batch.py`). To raise, edit the constant. -### Exit codes +### Batch exit codes - `0` — all rows succeeded. - `1` — invalid manifest (file not found, parse error, unknown aspect/model). @@ -1142,7 +1142,7 @@ gflow video i2v ./hero.png "Slow camera arc, soft golden light" Local frame files follow the [`gflow image upload`](#gflow-image-upload) rules (header check, 20 MB cap), and a UUID must be catalogued in the same `--project` (exit 36 otherwise, see -[exit codes](#exit-codes-1)). Start+end submits were measured with Veo 3.1 Fast and Lite, and with +[exit codes](#exit-codes)). Start+end submits were measured with Veo 3.1 Fast and Lite, and with Omni 1.2 (which accepts at most 10 s with an end frame); Veo 3.1 Quality uses the same key family as Fast but was not run live (#1594). Whether the two frames must share an aspect ratio has not been measured (#1603). diff --git a/scripts/ci/generate_website_docs.py b/scripts/ci/generate_website_docs.py index c50581cb5..a1613c084 100644 --- a/scripts/ci/generate_website_docs.py +++ b/scripts/ci/generate_website_docs.py @@ -13,18 +13,24 @@ Usage: python scripts/ci/generate_website_docs.py # write the mirror - python scripts/ci/generate_website_docs.py --check # CI: fail on any drift + python scripts/ci/generate_website_docs.py --check # CI: check drift, orphans, links """ from __future__ import annotations +import html +import posixpath import re import sys +from collections.abc import Iterator +from dataclasses import dataclass, field from pathlib import Path +from urllib.parse import quote, unquote, urlsplit _REPO = Path(__file__).resolve().parents[2] _DOCS = _REPO / "docs" _WEB = _REPO / "website" / "docs" +_GITHUB_REPO = "https://github.com/ffroliva/gflow-cli" # Pages authored directly for the site (nav landing/onboarding) — NOT mirrors of # canonical, so never regenerated or diffed. `index.md` has a canonical namesake @@ -59,17 +65,6 @@ # maintainer's email in SECURITY's reporting table becomes actionable GitHub # private-reporting steps, not a placeholder address. FILE_OVERRIDES: dict[str, tuple[tuple[str, str], ...]] = { - # The RPC catalog is a contributor reference and is not mirrored; link it on GitHub. - "E2E_TESTING.md": ( - ( - "](FLOW_WIRE_RPCS.md)", - "](https://github.com/ffroliva/gflow-cli/blob/main/docs/FLOW_WIRE_RPCS.md)", - ), - ( - "](superpowers/spikes/", - "](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/", - ), - ), # The privacy notice must name its controller; the site names the public handle, not # the private name the token pass would otherwise mangle into "your.name Oliva". "TELEMETRY.md": ( @@ -114,51 +109,607 @@ def _source_for(dest_name: str) -> Path | None: return None -_GITHUB_DOCS_BLOB = "https://github.com/ffroliva/gflow-cli/blob/main/docs/" +_THEMATIC = re.compile(r"(?:(-[ \t]*){3,}|(\*[ \t]*){3,}|(_[ \t]*){3,})$") +_SETEXT = re.compile(r"(?:=+|-+)[ \t]*$") +_ATX = re.compile(r"#{1,6}(?:[ \t]|$)") +_FENCE_OPEN = re.compile(r"(`{3,}|~{3,})(.*)") +_FENCE_CLOSE = re.compile(r"(`{3,}|~{3,})[ \t]*$") +_LIST_MARKER = re.compile(r"([-*+]|\d{1,9}[.)])(?:([ \t]+)|$)") +_HTML_BLOCK_1 = re.compile(r"<(?:pre|script|style|textarea)(?:[ \t>]|$)", re.IGNORECASE) +_HTML_BLOCK_1_END = re.compile(r"", re.IGNORECASE) +_HTML_COMMENT_OPEN = re.compile(r"") +_HTML_BLOCK_6 = re.compile( + r"]|$)", + re.IGNORECASE, +) +_MD_UNESCAPE = re.compile( + r"\\([!\"#$%&'()*+,\-./:;<=>?@\[\\\]^_`{|}~])" + r"|(&(?:#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[A-Za-z][A-Za-z0-9]{1,31});)" +) +_TITLE = r'(?:"(?:\\.|[^"\\])*"|\'(?:\\.|[^\'\\])*\'|\((?:\\.|[^()\\])*\))' +_DEST_TAIL = re.compile(rf"(?:\s+{_TITLE})?\s*\)") +_REF_DEF = re.compile( + rf"[ \t]{{0,3}}\[(?![ \t]*\])(?:[^\[\]\\]|\\[^\n]){{1,999}}\]:[ \t]*(?:\n[ \t]*)?" + rf"(?:<((?:[^<>\n\\]|\\.)*)>|((?:[^\s\\]|\\.)+))" + rf"(?:(?:[ \t]+|[ \t]*\n[ \t]*){_TITLE})?[ \t]*(?=$|\n)" +) +_AUTOLINK_OR_HTML = re.compile( + r"<(?:[A-Za-z][A-Za-z0-9+.-]{1,31}:[^\s<>]*|!--[\s\S]*?--|" + r"/?[A-Za-z][A-Za-z0-9-]*" + r"(?:\s+[^\s\"'>/=]+(?:\s*=\s*(?:\"[^\"]*\"|'[^']*'|[^\s\"'=<>`]+))?)*\s*/?)>" +) +_LINK_TOK = re.compile(r"\\[^\n]|!\[|\[|\]") + + +def _unescape_md(value: str) -> str: + return _MD_UNESCAPE.sub( + lambda m: m[1] if m[1] is not None else html.unescape(m[2]), + value, + ) + + +@dataclass +class _Container: + kind: str # "bq" or "list" + width: int = 0 + empty: bool = False + + +@dataclass +class _LineCursor: + line: str + idx: int = 0 + col: int = 0 + pad: int = 0 + + def peek_indent(self) -> tuple[int, int]: + """Return (leading whitespace columns, char index of first non-whitespace char).""" + cols = self.pad + i = self.idx + c = self.col + self.pad + n = len(self.line) + while i < n: + ch = self.line[i] + if ch == " ": + cols += 1 + c += 1 + elif ch == "\t": + step = 4 - (c % 4) + cols += step + c += step + else: + break + i += 1 + return cols, i + + def is_blank(self) -> bool: + _, i = self.peek_indent() + return i >= len(self.line) + + def consume_cols(self, count: int) -> None: + """Advance across ``count`` indentation columns, expanding tabs into virtual spaces.""" + rem = count + if self.pad: + take = min(self.pad, rem) + self.pad -= take + self.col += take + rem -= take + n = len(self.line) + while rem > 0 and self.idx < n: + rem -= self._step_col(rem) + + def _step_col(self, rem: int) -> int: + ch = self.line[self.idx] + if ch == " ": + self.idx += 1 + self.col += 1 + return 1 + if ch == "\t": + step = 4 - (self.col % 4) + self.idx += 1 + take = min(step, rem) + self.col += take + self.pad = step - take + return take + return rem + + def consume_chars(self, count: int) -> None: + self.pad = 0 + self.idx += count + self.col += count + + +def _consume_bq(cur: _LineCursor) -> bool: + indent, nonws = cur.peek_indent() + if indent >= 4 or nonws >= len(cur.line) or cur.line[nonws] != ">": + return False + cur.consume_cols(indent) + cur.consume_chars(1) + if cur.peek_indent()[0] > 0: + cur.consume_cols(1) + return True + + +def _match_containers(cur: _LineCursor, containers: list[_Container]) -> int: + matched = 0 + for cont in containers: + if cont.kind == "bq": + if not _consume_bq(cur): + break + matched += 1 + continue + indent, nonws = cur.peek_indent() + if nonws >= len(cur.line): + matched += 1 + continue + if indent < cont.width: + break + cur.consume_cols(cont.width) + matched += 1 + return matched + + +def _list_marker_allowed(marker: str, is_empty: bool, interrupting_para: bool) -> bool: + if not interrupting_para: + return True + if is_empty: + return False + return not marker[0].isdigit() or marker[:-1] == "1" + + +def _try_open_list(cur: _LineCursor, interrupting_para: bool) -> _Container | None: + indent, nonws = cur.peek_indent() + if indent >= 4 or nonws >= len(cur.line): + return None + rest = cur.line[nonws:] + if _THEMATIC.match(rest): + return None + m = _LIST_MARKER.match(rest) + if not m: + return None + marker = m.group(1) + is_empty = nonws + m.end() >= len(cur.line) + if not _list_marker_allowed(marker, is_empty, interrupting_para): + return None + cur.consume_cols(indent) + cur.consume_chars(len(marker)) + if is_empty: + return _Container("list", width=indent + len(marker) + 1, empty=True) + ws_cols, _ = cur.peek_indent() + use_cols = 1 if ws_cols >= 5 else ws_cols + cur.consume_cols(use_cols) + return _Container("list", width=indent + len(marker) + use_cols, empty=False) + + +def _opens_fence(rest: str) -> str: + fm = _FENCE_OPEN.match(rest) + if not fm: + return "" + run, info = fm.groups() + return run if run[0] == "~" or "`" not in info else "" + + +def _html_block_end(rest: str) -> re.Pattern[str] | None: + if _HTML_BLOCK_1.match(rest): + return _HTML_BLOCK_1_END + if _HTML_COMMENT_OPEN.match(rest): + return _HTML_COMMENT_END + return None + + +def _is_block_interrupt(cur: _LineCursor, interrupting_para: bool) -> bool: + indent, nonws = cur.peek_indent() + if indent >= 4 or nonws >= len(cur.line): + return False + rest = cur.line[nonws:] + if rest[0] == ">" or _ATX.match(rest) or _THEMATIC.match(rest) or _opens_fence(rest): + return True + if _html_block_end(rest) is not None or _HTML_BLOCK_6.match(rest): + return True + m = _LIST_MARKER.match(rest) + if not m: + return False + return _list_marker_allowed(m.group(1), nonws + m.end() >= len(cur.line), interrupting_para) + + +def _is_only_ref_defs(text: str, spans: list[tuple[int, int]]) -> bool: + if not spans: + return False + block = "\n".join(text[s:e] for s, e in spans) + pos = 0 + n = len(block) + while pos < n: + m = _REF_DEF.match(block, pos) + if not m: + return False + pos = m.end() + if pos < n and block[pos] == "\n": + pos += 1 + return True + + +@dataclass +class _BlockParser: + text: str + blocks: list[tuple[str, list[tuple[int, int]]]] = field(default_factory=list) + containers: list[_Container] = field(default_factory=list) + fence: tuple[str, int] | None = None + html_end: tuple[re.Pattern[str] | None, int] | None = None + para: list[tuple[int, int]] = field(default_factory=list) + def _flush_para(self) -> None: + if self.para: + self.blocks.append(("para", list(self.para))) + self.para.clear() -def _rewrite_root_doc_links(text: str) -> str: - """Repo-root canonical files (KNOWN_ISSUES.md) link sibling docs as - ``docs/X.md``; mirrored into ``website/docs/`` that resolves to a - nonexistent ``docs/docs/`` path (#507). Targets that are themselves - mirrored become sibling-relative links; everything else (release - evidence, recon specs, plans — deliberately unpublished) becomes an - absolute GitHub link so the published page never 404s.""" + def _handle_blank(self, matched: int) -> None: + del self.containers[matched:] + if self.fence and self.fence[1] > len(self.containers): + self.fence = None + if self.html_end and (self.html_end[0] is None or self.html_end[1] > len(self.containers)): + self.html_end = None + self._flush_para() + while self.containers and self.containers[-1].kind == "list" and self.containers[-1].empty: + self.containers.pop() - def repl(match: re.Match[str]) -> str: - target = match.group(1) - path_part = target.split("#", 1)[0] - if "/" not in path_part and (_WEB / path_part).is_file(): - return f"]({target})" - return f"]({_GITHUB_DOCS_BLOB}{target})" + def _handle_active_html(self, cur: _LineCursor, matched: int) -> bool: + if self.html_end is None: + return False + end_pat, depth = self.html_end + if matched < depth: + del self.containers[matched:] + self.html_end = None + return False + if end_pat is not None and end_pat.search(cur.line[cur.idx :]): + self.html_end = None + return True - return re.sub(r"\]\(docs/([^)]+)\)", repl, text) + def _handle_active_fence(self, cur: _LineCursor, matched: int) -> bool: + if self.fence is None: + return False + marker, depth = self.fence + if matched < depth: + del self.containers[matched:] + self.fence = None + return False + indent, nonws = cur.peek_indent() + if indent < 4: + cm = _FENCE_CLOSE.match(cur.line[nonws:]) + if cm and cm.group(1).startswith(marker): + self.fence = None + return True + + def _open_containers(self, cur: _LineCursor, in_para: bool) -> bool: + opened = False + while True: + if _consume_bq(cur): + new_c: _Container | None = _Container("bq") + else: + new_c = _try_open_list(cur, interrupting_para=in_para) + if new_c is None: + return opened + self._flush_para() + in_para = False + for c in self.containers: + c.empty = False + self.containers.append(new_c) + opened = True + + def _handle_leaf(self, cur: _LineCursor, line_start: int, end_off: int, in_para: bool) -> None: + indent, nonws = cur.peek_indent() + rest = cur.line[nonws:] + if indent < 4 and self._handle_unindented_leaf(rest, line_start + nonws, end_off, in_para): + return + if not in_para and indent >= 4: + self._flush_para() + return + self.para.append((line_start + cur.idx, end_off)) + + def _handle_unindented_leaf( + self, rest: str, abs_nonws: int, end_off: int, in_para: bool + ) -> bool: + if in_para and _SETEXT.match(rest): + self._flush_para() + return True + if run := _opens_fence(rest): + self._flush_para() + self.fence = (run, len(self.containers)) + return True + if (end_pat := _html_block_end(rest)) is not None or _HTML_BLOCK_6.match(rest): + self._flush_para() + if end_pat is None or not end_pat.search(rest): + self.html_end = (end_pat, len(self.containers)) + return True + if _THEMATIC.match(rest): + self._flush_para() + return True + if _ATX.match(rest): + self._flush_para() + self.blocks.append(("heading", [(abs_nonws, end_off)])) + return True + return False + + def feed(self, raw: str, line_start: int) -> None: + stripped = raw.rstrip("\r\n") + end_off = line_start + len(stripped) + cur = _LineCursor(stripped) + matched = _match_containers(cur, self.containers) + if cur.is_blank(): + self._handle_blank(matched) + return + if self._handle_active_html(cur, matched) or self._handle_active_fence(cur, matched): + return + in_para = bool(self.para) and not _is_only_ref_defs(self.text, self.para) + if matched < len(self.containers): + replacing_list = self.containers[matched].kind == "list" + if in_para and not _is_block_interrupt(cur, interrupting_para=not replacing_list): + self.para.append((line_start + cur.idx, end_off)) + return + self._flush_para() + del self.containers[matched:] + in_para = False + if self._open_containers(cur, in_para): + in_para = False + if cur.is_blank(): + return + for c in self.containers: + c.empty = False + self._handle_leaf(cur, line_start, end_off, in_para) + + def extract(self) -> list[tuple[str, list[tuple[int, int]]]]: + offset = 0 + for raw in self.text.splitlines(keepends=True): + self.feed(raw, offset) + offset += len(raw) + self._flush_para() + return self.blocks + + +def _find_code_span_end(block: str, start: int, tick_len: int) -> int: + j = start + n = len(block) + while j < n: + if block[j] == "`": + c_end = j + while c_end < n and block[c_end] == "`": + c_end += 1 + if c_end - j == tick_len: + return c_end + j = c_end + continue + j += 1 + return -1 + + +def _blank_span(out: list[str], start: int, end: int) -> None: + for k in range(start, end): + if out[k] != "\n": + out[k] = " " + + +def _mask_code_span(block: str, out: list[str], start: int) -> int: + n = len(block) + run_end = start + while run_end < n and block[run_end] == "`": + run_end += 1 + close_end = _find_code_span_end(block, run_end, run_end - start) + if close_end > 0: + _blank_span(out, start, close_end) + return close_end + return run_end + + +def _mask_inline_code_and_html(block: str) -> str: + """Replace inline code spans and autolinks/HTML tags with spaces without shifting indices.""" + out = list(block) + i = 0 + n = len(block) + while i < n: + ch = block[i] + if ch == "\\": + i += 2 + elif ch == "`": + i = _mask_code_span(block, out, i) + elif ch == "<" and (m := _AUTOLINK_OR_HTML.match(block, i)): + _blank_span(out, i, m.end()) + i = m.end() + else: + i += 1 + return "".join(out) + + +def _parse_angle_dest(prose: str, i: int) -> tuple[int, int, int] | None: + n = len(prose) + dest_start = i + 1 + j = dest_start + while j < n and prose[j] not in "<>\r\n": + j += 2 if prose[j] == "\\" else 1 + if j >= n or prose[j] != ">": + return None + return dest_start, j, j + 1 + + +def _parse_bare_dest(prose: str, i: int) -> tuple[int, int, int] | None: + n = len(prose) + dest_start = i + depth = 0 + while i < n: + ch = prose[i] + if ch == "\\" and i + 1 < n: + i += 2 + elif ch.isspace() or ord(ch) < 32: + break + elif ch == "(": + depth += 1 + i += 1 + elif ch == ")": + if depth == 0: + break + depth -= 1 + i += 1 + else: + i += 1 + return (dest_start, i, i) if depth == 0 and i > dest_start else None + + +def _parse_inline_destination(prose: str, pos: int) -> tuple[int, int, int] | None: + """Parse ``(dest [title])`` starting right after ``]``, handling nested parens.""" + n = len(prose) + if pos >= n or prose[pos] != "(": + return None + i = pos + 1 + while i < n and prose[i].isspace(): + i += 1 + if i >= n: + return None + parsed = _parse_angle_dest(prose, i) if prose[i] == "<" else _parse_bare_dest(prose, i) + if parsed is None: + return None + dest_start, dest_end, next_i = parsed + tail = _DEST_TAIL.match(prose, next_i) + return (dest_start, dest_end, tail.end()) if tail else None + + +def _is_relative_target(target: str) -> bool: + return bool(target) and not target.startswith("/") and not urlsplit(target).scheme + + +def _consume_ref_defs( + block: str, pos_map: list[int], text: str +) -> tuple[int, list[tuple[int, int, str]]]: + found: list[tuple[int, int, str]] = [] + pos = 0 + n = len(block) + while pos < n: + m = _REF_DEF.match(block, pos) + if not m: + break + ds, de = m.span(1 if m[1] is not None else 2) + if ds < de: + abs_s, abs_e = pos_map[ds], pos_map[de - 1] + 1 + target = text[abs_s:abs_e] + if _is_relative_target(target): + found.append((abs_s, abs_e, target)) + pos = m.end() + if pos < n and block[pos] == "\n": + pos += 1 + return pos, found + + +def _deactivate_outer_links(stack: list[list[bool]]) -> None: + for entry in stack: + if not entry[0]: + entry[1] = False + + +def _extract_inline_target( + ds: int, de: int, base: int, pos_map: list[int], text: str +) -> tuple[int, int, str] | None: + if ds >= de: + return None + abs_s, abs_e = pos_map[base + ds], pos_map[base + de - 1] + 1 + target = text[abs_s:abs_e] + return (abs_s, abs_e, target) if _is_relative_target(target) else None + + +def _scan_inline_links( + prose: str, base: int, pos_map: list[int], text: str +) -> Iterator[tuple[int, int, str]]: + stack: list[list[bool]] = [] # [is_image, active] + cursor = 0 + for m in _LINK_TOK.finditer(prose): + ts, te, tok = m.start(), m.end(), m[0] + if ts < cursor: + continue + if tok in ("![", "["): + stack.append([tok == "![", True]) + elif tok == "]" and stack: + is_img, active = stack.pop() + if active and (parsed := _parse_inline_destination(prose, te)) is not None: + ds, de, tail_end = parsed + if link := _extract_inline_target(ds, de, base, pos_map, text): + yield link + if not is_img: + _deactivate_outer_links(stack) + cursor = tail_end + + +def _relative_links(text: str) -> Iterator[tuple[int, int, str]]: + """Yield (start, end, target) for inline links, linked images, and reference definitions.""" + for kind, spans in _BlockParser(text).extract(): + parts: list[str] = [] + pos_map: list[int] = [] + for idx_s, (s, e) in enumerate(spans): + if idx_s > 0: + parts.append("\n") + pos_map.append(-1) + parts.append(text[s:e]) + pos_map.extend(range(s, e)) + block = "".join(parts) + pos = 0 + if kind == "para": + pos, ref_links = _consume_ref_defs(block, pos_map, text) + yield from ref_links + if pos < len(block): + prose = _mask_inline_code_and_html(block[pos:]) + yield from _scan_inline_links(prose, pos, pos_map, text) + + +def _site_files() -> set[str]: + # URLs are case-sensitive even on Windows (docs/INDEX.md and the bespoke index.md). + return {p.relative_to(_WEB).as_posix() for p in _WEB.rglob("*") if p.is_file()} + + +def _site_link(target: str, source_dir: Path, dest_dir: Path, published: dict[Path, Path]) -> str: + url = urlsplit(target) + site_path = url.path + if site_path: + decoded_path = unquote(_unescape_md(site_path)) + canonical = (source_dir / decoded_path).resolve() + destination = published.get(canonical) + if destination is not None: + site_path = quote(posixpath.relpath(destination.as_posix(), dest_dir.as_posix())) + elif canonical.exists(): + if not canonical.is_relative_to(_REPO): + return target + kind = "tree" if canonical.is_dir() else "blob" + path = quote(canonical.relative_to(_REPO).as_posix()) + suffix = target.removeprefix(url.path) # Keep GitHub's query and fragment verbatim. + return f"{_GITHUB_REPO}/{kind}/main/{path}{suffix}" + elif (dest_dir / decoded_path).resolve() not in published: + return target # Leave the unresolved destination intact for --check. + return url._replace(path=site_path, fragment=re.sub("-{2,}", "-", url.fragment)).geturl() def render(dest_name: str, source_text: str) -> str: - """Apply per-file overrides, root-link rewriting, then the global token map.""" + """Apply per-file overrides, resolve published links, then anonymize.""" text = source_text for old, new in FILE_OVERRIDES.get(dest_name, ()): if old not in text: msg = f"{dest_name}: override target not found (canonical changed?): {old[:60]!r}" raise ValueError(msg) text = text.replace(old, new) - if _source_for(dest_name) == _REPO / dest_name: - text = _rewrite_root_doc_links(text) - else: - # docs/X.md links a mirrored root file as ../NAME.md; on the site it is a sibling. - text = re.sub( - r"\]\(\.\./([^/)#?]+\.md)", - lambda m: f"]({m.group(1)}" if (_WEB / m.group(1)).is_file() else m.group(0), - text, - ) - # MkDocs' toc slug collapses a run of hyphens that GitHub keeps (`Ports & adapters` is - # `ports--adapters` on GitHub, `ports-adapters` on the site). Relative links only. - text = re.sub( - r"\]\((?!https?:)([^)#\s]*)#([^)\s]+)\)", - lambda m: f"]({m.group(1)}#{re.sub('-{2,}', '-', m.group(2))})", - text, - ) + source = _source_for(dest_name) or _DOCS / dest_name + dest_dir = (_WEB / dest_name).parent + published: dict[Path, Path] = {} + for name in _site_files(): + destination = _WEB / name + published[destination] = destination + if canonical := _source_for(name): + published[canonical] = destination + pieces = [] + previous = 0 + for start, end, target in _relative_links(text): + pieces.append(text[previous:start]) + pieces.append(_site_link(target, source.parent, dest_dir, published)) + previous = end + pieces.append(text[previous:]) + text = "".join(pieces) for pattern, repl in TOKEN_SUBS: text = pattern.sub(repl, text) return text @@ -171,7 +722,7 @@ def _mirrored_targets() -> list[Path]: for path in sorted(_WEB.rglob("*")): if not path.is_file() or path.suffix.lower() not in (".md", ".html"): continue - if _source_for(path.name) is not None: + if _source_for(path.relative_to(_WEB).as_posix()) is not None: targets.append(path) return targets @@ -197,14 +748,27 @@ def _nav_orphans() -> list[str]: return sorted(p.name for p in _WEB.glob("*.md") if p.name not in nav and p.name != "index.md") +def _unresolved_relative_links() -> Iterator[str]: + site_files = _site_files() + for page in sorted(_WEB.rglob("*.md")): + text = page.read_text(encoding="utf-8") + for start, _, target in _relative_links(text): + path = unquote(_unescape_md(urlsplit(target).path)) + parent = page.parent.relative_to(_WEB).as_posix() + if path and posixpath.normpath(posixpath.join(parent, path)) not in site_files: + line = text.count("\n", 0, start) + 1 + yield f"UNRESOLVED-LINK: {page.relative_to(_REPO).as_posix()}:{line}: {target}" + + def main(argv: list[str]) -> int: check = "--check" in argv drift: list[str] = [] written = 0 for dest in _mirrored_targets(): - source = _source_for(dest.name) + name = dest.relative_to(_WEB).as_posix() + source = _source_for(name) assert source is not None # _mirrored_targets guarantees it - rendered = render(dest.name, source.read_text(encoding="utf-8")) + rendered = render(name, source.read_text(encoding="utf-8")) current = dest.read_text(encoding="utf-8") if rendered == current: continue @@ -216,7 +780,8 @@ def main(argv: list[str]) -> int: if check: orphans = _nav_orphans() - if drift or orphans: + unresolved = list(_unresolved_relative_links()) + if drift or orphans or unresolved: if drift: print("website/docs mirror is stale — regenerate with:") print(" python scripts/ci/generate_website_docs.py") @@ -224,6 +789,8 @@ def main(argv: list[str]) -> int: print(f" DRIFT: {d}") for o in orphans: print(f" NAV-ORPHAN: {o} is published but absent from website/mkdocs.yml nav") + for problem in unresolved: + print(problem) return 1 print(f"website/docs mirror in sync ({len(_mirrored_targets())} files), nav complete.") return 0 diff --git a/tests/scripts/test_generate_website_docs.py b/tests/scripts/test_generate_website_docs.py index 184a05ef3..61bd8fea6 100644 --- a/tests/scripts/test_generate_website_docs.py +++ b/tests/scripts/test_generate_website_docs.py @@ -102,7 +102,7 @@ def test_a_docs_link_to_a_mirrored_root_file_becomes_a_sibling_link() -> None: so `../` would leave the docs tree (PR #1237 review). Fragment and query survive.""" out = _gen.render("USAGE.md", "see [KI](../KNOWN_ISSUES.md#a-b) and [C](../CHANGELOG.md)") assert "](KNOWN_ISSUES.md#a-b)" in out - assert "](../CHANGELOG.md)" in out # not mirrored: left as it was + assert "](https://github.com/ffroliva/gflow-cli/blob/main/CHANGELOG.md)" in out def test_a_relative_anchor_takes_the_mkdocs_slug() -> None: @@ -113,3 +113,315 @@ def test_a_relative_anchor_takes_the_mkdocs_slug() -> None: assert "](#ports-adapters)" in out assert "](USER_GUIDE.md#a-b)" in out assert "](https://github.com/x#a--b)" in out + + +@pytest.mark.parametrize( + ("source", "target", "expected"), + [ + ("SYNTHETIC.md", "../PLAN.md#phase--7", "blob/main/PLAN.md#phase--7"), + ("USAGE.md", "../src/gflow_cli/cli.py", "blob/main/src/gflow_cli/cli.py"), + ("USAGE.md", "../src/gflow_cli/mcp/", "tree/main/src/gflow_cli/mcp"), + ("USAGE.md", "FLOW_WIRE_RPCS.md", "blob/main/docs/FLOW_WIRE_RPCS.md"), + ( + "USAGE.md", + "superpowers/spikes/2026-11-10-rpc-descriptor-churn.md", + "blob/main/docs/superpowers/spikes/2026-11-10-rpc-descriptor-churn.md", + ), + ("KNOWN_ISSUES.md", "PLAN.md", "blob/main/PLAN.md"), + ( + "KNOWN_ISSUES.md", + "docs/INDEX.md#topic--shortcuts", + "blob/main/docs/INDEX.md#topic--shortcuts", + ), + ], +) +def test_repository_links_use_the_canonical_target(source: str, target: str, expected: str) -> None: + assert _gen.render(source, f"[`ref`]({target})") == ( + f"[`ref`](https://github.com/ffroliva/gflow-cli/{expected})" + ) + + +def test_root_source_links_to_mirrored_page_and_site_asset() -> None: + text = "[Guide](docs/USER_GUIDE.md?q=1#a--b) [CSS](website/docs/stylesheets/extra.css)" + assert _gen.render("KNOWN_ISSUES.md", text) == ( + "[Guide](USER_GUIDE.md?q=1#a-b) [CSS](stylesheets/extra.css)" + ) + + +def test_nested_site_assets_resolve_relative_to_the_published_page( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + docs = tmp_path / "docs" + web = tmp_path / "website" / "docs" + for base in (docs, web): + (base / "images").mkdir(parents=True) + (base / "images" / "diagram.svg").touch() + monkeypatch.setattr(_gen, "_REPO", tmp_path) + monkeypatch.setattr(_gen, "_DOCS", docs) + monkeypatch.setattr(_gen, "_WEB", web) + text = "![diagram](../images/diagram.svg#a--b) and [missing](absent.md#a--b)" + assert _gen.render("guides/example.md", text) == ( + "![diagram](../images/diagram.svg#a-b) and [missing](absent.md#a--b)" + ) + + +def test_link_examples_in_inline_code_and_fences_are_literal() -> None: + example = "[plan](../PLAN.md) [anchor](#a--b)" + literal = ( + f"`{example}` and ``a ` {example}``\n" + f"````md\n```\n{example}\n````\n" + f"> ~~~markdown\n> {example}\n> ~~~~\n" + ) + assert _gen.render("USAGE.md", literal + "[`real`](#a--b)") == literal + "[`real`](#a-b)" + + +@pytest.mark.parametrize( + "scheme", ["http", "https", "mailto", "tel", "data", "gflow", "capabilities"] +) +def test_non_file_schemes_keep_their_fragments(scheme: str) -> None: + text = f"[example]({scheme}:example#a--b)" + assert _gen.render("SYNTHETIC.md", text) == text + + +def test_check_reports_unresolved_links_on_bespoke_pages( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str] +) -> None: + web = tmp_path / "website" / "docs" + web.mkdir(parents=True) + monkeypatch.setattr(_gen, "_REPO", tmp_path) + monkeypatch.setattr(_gen, "_DOCS", tmp_path / "docs") + monkeypatch.setattr(_gen, "_WEB", web) + (web.parent / "private.txt").touch() + (web / "index.md").write_text( + "```md\n[example](missing.md)\n```\n`[example](missing.md)`\n" + "[bad](missing.md#a--b) and [outside](../private.txt)\n[case](INDEX.md)\n", + encoding="utf-8", + ) + assert _gen.main(["--check"]) == 1 + assert capsys.readouterr().out.splitlines() == [ + "UNRESOLVED-LINK: website/docs/index.md:5: missing.md#a--b", + "UNRESOLVED-LINK: website/docs/index.md:5: ../private.txt", + "UNRESOLVED-LINK: website/docs/index.md:6: INDEX.md", + ] + + +def test_escaped_backticks_and_link_titles_do_not_hide_or_invent_links( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + docs = tmp_path / "docs" + web = tmp_path / "website" / "docs" + docs.mkdir(parents=True) + web.mkdir(parents=True) + (tmp_path / "PLAN.md").touch() + (web / "USER_GUIDE.md").touch() + (docs / "USER_GUIDE.md").touch() + monkeypatch.setattr(_gen, "_REPO", tmp_path) + monkeypatch.setattr(_gen, "_DOCS", docs) + monkeypatch.setattr(_gen, "_WEB", web) + + text = ( + r"Escaped \` [Plan](../PLAN.md) \` and " + r'[Guide](USER_GUIDE.md "See [missing](missing.md)").' + ) + rendered = _gen.render("GUIDE.md", text) + assert "](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md)" in rendered + assert "[missing](missing.md)" in rendered + (web / "GUIDE.md").write_text(rendered, encoding="utf-8") + assert _gen.main(["--check"]) == 0 + + +def test_reference_definitions_and_markdown_escaped_destinations( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + docs = tmp_path / "docs" + web = tmp_path / "website" / "docs" + docs.mkdir(parents=True) + web.mkdir(parents=True) + (tmp_path / "PLAN.md").touch() + (docs / "part(1).md").touch() + (web / "part(1).md").touch() + monkeypatch.setattr(_gen, "_REPO", tmp_path) + monkeypatch.setattr(_gen, "_DOCS", docs) + monkeypatch.setattr(_gen, "_WEB", web) + + source = ( + "[Plan][p] [Escaped](part\\(1\\).md#a--b) [Pct](part%281%29.md#a--b)\n\n" + "[p]: ../PLAN.md#s--1\n" + "[e]: part\\(1\\).md#a--b\n" + ) + rendered = _gen.render("SYNTHETIC.md", source) + assert "[p]: https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md#s--1" in rendered + assert "[Escaped](part%281%29.md#a-b)" in rendered + assert "[Pct](part%281%29.md#a-b)" in rendered + assert "[e]: part%281%29.md#a-b" in rendered + (web / "SYNTHETIC.md").write_text( + "[Escaped](part\\(1\\).md#a-b)\n\n[bad]: missing.md\n", + encoding="utf-8", + ) + unresolved = list(_gen._unresolved_relative_links()) + assert unresolved == ["UNRESOLVED-LINK: website/docs/SYNTHETIC.md:3: missing.md"] + + +def test_nested_parens_indented_code_block_boundaries_and_char_refs( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + docs = tmp_path / "docs" + web = tmp_path / "website" / "docs" + docs.mkdir(parents=True) + web.mkdir(parents=True) + (tmp_path / "PLAN.md").touch() + (docs / "plan(v1(draft)).md").touch() + (docs / "café.md").touch() + (web / "café.md").touch() + monkeypatch.setattr(_gen, "_REPO", tmp_path) + monkeypatch.setattr(_gen, "_DOCS", docs) + monkeypatch.setattr(_gen, "_WEB", web) + + source = ( + " [IndentedCode](missing.md)\n\n" + "- `open\n" + "- [Plan](../PLAN.md) close`\n\n" + "[Nested](plan(v1(draft)).md) and [Entity](café.md#a--b)\n" + ) + rendered = _gen.render("SYNTHETIC.md", source) + assert " [IndentedCode](missing.md)" in rendered + assert "](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md)" in rendered + assert ( + "[Nested](https://github.com/ffroliva/gflow-cli/blob/main/docs/plan%28v1%28draft%29%29.md)" + in rendered + ) + assert "[Entity](caf%C3%A9.md#a-b)" in rendered + + (web / "SYNTHETIC.md").write_text( + " [IndentedCode](missing.md)\n[Entity](café.md#a-b)\n", + encoding="utf-8", + ) + assert list(_gen._unresolved_relative_links()) == [] + + +def test_list_item_continuation_paragraph_links_are_rewritten_and_checked( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + docs = tmp_path / "docs" + web = tmp_path / "website" / "docs" + docs.mkdir(parents=True) + web.mkdir(parents=True) + (tmp_path / "PLAN.md").touch() + monkeypatch.setattr(_gen, "_REPO", tmp_path) + monkeypatch.setattr(_gen, "_DOCS", docs) + monkeypatch.setattr(_gen, "_WEB", web) + + ordered = "1. Item\n\n [Plan](../PLAN.md)\n" + assert [t for _, _, t in _gen._relative_links(ordered)] == ["../PLAN.md"] + assert _gen.render("SYNTHETIC.md", ordered) == ( + "1. Item\n\n [Plan](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md)\n" + ) + + bullet = "- Item\n\n [Plan](../PLAN.md)\n" + assert [t for _, _, t in _gen._relative_links(bullet)] == ["../PLAN.md"] + + indented_in_list = "1. Item\n\n [Code](missing.md)\n" + assert list(_gen._relative_links(indented_in_list)) == [] + + after_list_ends = "1. Item\n\nParagraph\n\n [Code](missing.md)\n" + assert list(_gen._relative_links(after_list_ends)) == [] + + (web / "SYNTHETIC.md").write_text("1. Item\n\n [Bad](missing.md)\n", encoding="utf-8") + assert list(_gen._unresolved_relative_links()) == [ + "UNRESOLVED-LINK: website/docs/SYNTHETIC.md:3: missing.md" + ] + + +def test_fenced_code_block_after_indented_code_block_is_masked( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + docs = tmp_path / "docs" + web = tmp_path / "website" / "docs" + docs.mkdir(parents=True) + web.mkdir(parents=True) + (tmp_path / "PLAN.md").touch() + monkeypatch.setattr(_gen, "_REPO", tmp_path) + monkeypatch.setattr(_gen, "_DOCS", docs) + monkeypatch.setattr(_gen, "_WEB", web) + + only_fence = " example\n\n```\n[Example](missing.md)\n```\n" + assert list(_gen._relative_links(only_fence)) == [] + (web / "SYNTHETIC.md").write_text(only_fence, encoding="utf-8") + assert list(_gen._unresolved_relative_links()) == [] + + with_after = f"{only_fence}[After](../PLAN.md)\n" + assert [t for _, _, t in _gen._relative_links(with_after)] == ["../PLAN.md"] + assert _gen.render("SYNTHETIC.md", with_after) == ( + f"{only_fence}[After](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md)\n" + ) + + no_blank = " example\n```\n[Example](missing.md)\n```\n[After](../PLAN.md)\n" + assert [t for _, _, t in _gen._relative_links(no_blank)] == ["../PLAN.md"] + + indented_ticks = " ```\n [Example](missing.md)\n\n[After](../PLAN.md)\n" + assert [t for _, _, t in _gen._relative_links(indented_ticks)] == ["../PLAN.md"] + + inside_list = ( + "1. Item\n\n ```\n [Example](missing.md)\n ```\n\n [Plan](../PLAN.md)\n" + ) + assert [t for _, _, t in _gen._relative_links(inside_list)] == ["../PLAN.md"] + + +@pytest.mark.parametrize( + ("source", "expected"), + [ + ("Paragraph\n2. item\n\n [Example](missing.md)\n", []), + ("Paragraph\n1. item\n\n [Plan](../PLAN.md)\n", ["../PLAN.md"]), + ( + "1. Item\n\n ~~~\n example\n\n[Issues](../KNOWN_ISSUES.md)\n", + ["../KNOWN_ISSUES.md"], + ), + ( + "> ~~~\n> [Example](missing.md)\n\n[Issues](../KNOWN_ISSUES.md)\n", + ["../KNOWN_ISSUES.md"], + ), + ("```\n[Example](missing.md)\n\n[AlsoInside](missing.md)\n", []), + ( + "- ~~~\n [Example](missing.md)\n ~~~\n\n[Issues](../KNOWN_ISSUES.md)\n", + ["../KNOWN_ISSUES.md"], + ), + ( + "- - ~~~\n [Example](missing.md)\n ~~~\n\n[Issues](../KNOWN_ISSUES.md)\n", + ["../KNOWN_ISSUES.md"], + ), + ( + "1. Item\n2. ~~~\n [Example](missing.md)\n ~~~\n\n[Out](../PLAN.md)\n", + ["../PLAN.md"], + ), + ( + "> - ~~~\n> [Example](missing.md)\n> ~~~\n>\n> [Issues](../KNOWN_ISSUES.md)\n", + ["../KNOWN_ISSUES.md"], + ), + ( + "- [Code](missing.md)\n [Code2](missing.md)\n\n [Plan](../PLAN.md)\n", + ["../PLAN.md"], + ), + ("-\n\n [Code](missing.md)\n", []), + ("-\n [Plan](../PLAN.md)\n\n [Plan2](../PLAN.md)\n", ["../PLAN.md", "../PLAN.md"]), + ("-\tItem\n\n\t[Plan](../PLAN.md)\n", ["../PLAN.md"]), + ("-\tItem\n\n\t\t[Code](missing.md)\n", []), + ("# Heading\n [Code](missing.md)\n", []), + ("---\n [Code](missing.md)\n", []), + ("Heading\n===\n [Code](missing.md)\n", []), + ("> [Code](missing.md)\n", []), + ("> quote\n> [Plan](../PLAN.md)\n", ["../PLAN.md"]), + ("\n[Real](../PLAN.md)\n", ["../PLAN.md"]), + ("
\n[Raw](missing.md)\n
\n\n[Real](../PLAN.md)\n", ["../PLAN.md"]), + ("
\n\n[Real](../PLAN.md)\n\n
\n", ["../PLAN.md"]), + ('x [Real](../PLAN.md)\n', ["../PLAN.md"]), + ("[![alt](img.png)](../PLAN.md)\n", ["img.png", "../PLAN.md"]), + ("![alt [inner](../PLAN.md)](img.png)\n", ["../PLAN.md", "img.png"]), + ("[outer [inner](../PLAN.md)](missing.md)\n", ["../PLAN.md"]), + (r"\![alt](../PLAN.md)" + "\n", ["../PLAN.md"]), + ("- Item\n\n [p]: ../PLAN.md\n\n [Plan][p]\n", ["../PLAN.md"]), + ("> [p]: ../PLAN.md\n>\n> [Plan][p]\n", ["../PLAN.md"]), + ("Paragraph\n[p]: missing.md\n", []), + ], +) +def test_commonmark_container_fence_and_inline_edge_cases(source: str, expected: list[str]) -> None: + assert [t for _, _, t in _gen._relative_links(source)] == expected diff --git a/website/docs/ACCOUNT_SAFETY.md b/website/docs/ACCOUNT_SAFETY.md index f13718d31..1ec30f8e3 100644 --- a/website/docs/ACCOUNT_SAFETY.md +++ b/website/docs/ACCOUNT_SAFETY.md @@ -10,7 +10,7 @@ > five files, so a reasonable person could not find it before deciding to install > ([#602](https://github.com/ffroliva/gflow-cli/issues/602)). -Read [DISCLAIMER.md](../DISCLAIMER.md) first — it is the legal statement. This +Read [DISCLAIMER.md](https://github.com/ffroliva/gflow-cli/blob/main/DISCLAIMER.md) first — it is the legal statement. This page is the operational one. ## Two different things people mean by "will I get banned?" @@ -30,7 +30,7 @@ evidence of absence, and Google's terms are Google's to enforce. The cost model matters too: **credits are only spent on Veo video.** Images and composition operations bill against a per-model daily quota rather than credits, so most failure modes cost you nothing but time — see the cost note in the -[README](../README.md#why-gflow-cli). +[README](https://github.com/ffroliva/gflow-cli/blob/main/README.md#why-gflow-cli). ## What gflow-cli does to stay unremarkable @@ -46,7 +46,7 @@ headed, except `video extend` on flow.google.com, the page fallback of `media tr `media restore`, the video download-menu upscales (4K unmeasured), image-to-image from one local `--ref` file in an existing project on an otherwise direct request, a credit-capped text-to-video of an explicit measured key, reference-to-video from one local image, and a `movie run` with no characters and no instruction cards, which run headless under `auto` (`GFLOW_CLI_TRANSPORT=ui_automation` keeps them headed); `GFLOW_CLI_BROWSER_VISIBILITY=headed` shows the window for every command. The per-command list is in [BROWSER_MODES](BROWSER_MODES.md). The headless mint was measured as accepted on two accounts on Windows -([spike](superpowers/spikes/2026-11-27-direct-video-and-headless-mint.md)); macOS, +([spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-27-direct-video-and-headless-mint.md)); macOS, Linux and accounts Flow serves on labs.google are unmeasured. **Except credit reads.** On Windows and Linux, `gflow credits` and `gflow_get_credits` send diff --git a/website/docs/ARCHITECTURE.md b/website/docs/ARCHITECTURE.md index 34c492dbd..cd74f0f0d 100644 --- a/website/docs/ARCHITECTURE.md +++ b/website/docs/ARCHITECTURE.md @@ -1,6 +1,6 @@ # Architecture -This document is the steady-state reference for how `gflow-cli` is organised. The intent and sequencing live in [PLAN.md](../PLAN.md) — this file describes the **shape** that PLAN converges on. +This document is the steady-state reference for how `gflow-cli` is organised. The intent and sequencing live in [PLAN.md](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md) — this file describes the **shape** that PLAN converges on. ## Layers @@ -72,7 +72,7 @@ The hexagonal target above is the steady state. The **current** package — and **Phase 4 does NOT:** - Restructure existing modules beyond minimal dedup (shared CLI helpers were promoted to `gflow_cli._cli_helpers` at the package top level — kept flat to avoid a `cli.py` file / `cli/` package collision). -- Introduce dependency-injection containers, command/query buses, or any DDD/CQRS scaffolding (deferred per [PLAN ADR #2](../PLAN.md#5-decision-log-adrs-in-miniature)). +- Introduce dependency-injection containers, command/query buses, or any DDD/CQRS scaffolding (deferred per [PLAN ADR #2](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md#5-decision-log-adrs-in-miniature)). **v0.6.0a2 module additions — auth strategy package:** @@ -120,8 +120,8 @@ When the project converges on the hexagonal target above, modules graduate to la ## Folder layout > **Note: this document describes the TARGET architecture, not the current -> package layout.** The current shape (per [PLAN.md § 2](../PLAN.md#2-architecture-steady-state) -> and [ADR #2](../PLAN.md#5-decision-log-adrs-in-miniature)) is the simpler +> package layout.** The current shape (per [PLAN.md § 2](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md#2-architecture-steady-state) +> and [ADR #2](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md#5-decision-log-adrs-in-miniature)) is the simpler > `src/gflow_cli/{_errors/, api/, auth/, data/, flow_selectors/, mcp/, services/, tools/, > ui/, worker/}` packages plus flat modules — the `cli*.py` adapters, `_cli_helpers.py`, > `_win_owner_only.py`, `browser_manager.py`, `chain*.py`, `composition.py`, `config.py`, @@ -326,7 +326,7 @@ Process-boundary contextvars bind once: `correlation_id` (UUID4 per CLI invocati Format defaults to **human-readable on TTY**, **JSON when piped or `GFLOW_CLI_LOG_FORMAT=json`**. JSON exceptions use `structlog.tracebacks.ExceptionDictTransformer(show_locals=False)` so frame locals (which may contain auth cookies and signed URLs) are never serialized. TEXT exceptions are formatted by `ConsoleRenderer` with `structlog.dev.plain_traceback`, which omits frame locals; its default Rich formatter would print them. -Pipes cleanly into `jq` / Loki / Datadog without configuration. See [`docs/USER_GUIDE.md` § Journey 6](USER_GUIDE.md#journey-6-read-the-structured-logs) for `jq` recipes. +Pipes cleanly into `jq` / Loki / Datadog without configuration. See [`docs/USER_GUIDE.md` § Journey 6](USER_GUIDE.md#journey-6-reading-structured-logs-jq-recipes) for `jq` recipes. ## Incident diagnostics (shipped, v0.43.0) @@ -421,8 +421,8 @@ The dependency direction is inviolate. Everything else is preference, not religi ## See also -- [PLAN.md](../PLAN.md) — phasing, exit criteria, ADRs -- [CONTRIBUTING.md](../CONTRIBUTING.md) — TDD discipline, test categories +- [PLAN.md](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md) — phasing, exit criteria, ADRs +- [CONTRIBUTING.md](https://github.com/ffroliva/gflow-cli/blob/main/CONTRIBUTING.md) — TDD discipline, test categories - [AUTHENTICATION.md](AUTHENTICATION.md) — full auth flow lifecycle --- @@ -454,7 +454,7 @@ The dependency direction is inviolate. Everything else is preference, not religi aisandbox-pa.googleapis.com (Google's private Flow API) ``` -The `Provider` interface keeps backends interchangeable. v0.1 shipped `FlowProvider`. Google's separately billed Gemini / Vertex AI generation APIs are out of scope ([ROADMAP](../ROADMAP.md#out-of-scope)). +The `Provider` interface keeps backends interchangeable. v0.1 shipped `FlowProvider`. Google's separately billed Gemini / Vertex AI generation APIs are out of scope ([ROADMAP](https://github.com/ffroliva/gflow-cli/blob/main/ROADMAP.md#out-of-scope)). ## Auth strategy @@ -505,7 +505,7 @@ used only where it is strictly necessary. reCAPTCHA Enterprise token, and the request goes to Flow over direct HTTP. A refusal Flow reports as `PUBLIC_ERROR_UNUSUAL_ACTIVITY`, which is not billed, is retried once from a new headless browser process ([KNOWN_ISSUES](KNOWN_ISSUES.md)). The evidence is - [the direct video and headless mint spike](superpowers/spikes/2026-11-27-direct-video-and-headless-mint.md): + [the direct video and headless mint spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-27-direct-video-and-headless-mint.md): 15/15 headless cold mints accepted on two accounts (30/30 counting both visibilities), and headless and headed video submits accepted 6/6 each on fresh browsers. - **Video extend on flow.google.com drives Flow's page headless.** It is a UI surface, but a @@ -561,7 +561,7 @@ shell carries no `at`. Caveats and controls: Until v0.108.0 every generation drove Flow's page in a headed Chrome window: reCAPTCHA Enterprise rejected the earlier headless approaches, and the UI transport was the only path that produced a video. v0.108.0 measured a headless mint as accepted and moved the measured request -shapes to direct HTTP ([spike](superpowers/spikes/2026-11-27-direct-video-and-headless-mint.md), +shapes to direct HTTP ([spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-27-direct-video-and-headless-mint.md), [#1371](https://github.com/ffroliva/gflow-cli/issues/1371)). This section records the earlier design and why it was chosen; it does not describe the current product. diff --git a/website/docs/BROWSER_MODES.md b/website/docs/BROWSER_MODES.md index b8dd87133..b933c05c1 100644 --- a/website/docs/BROWSER_MODES.md +++ b/website/docs/BROWSER_MODES.md @@ -6,7 +6,7 @@ reCAPTCHA token. The request itself goes to Flow over direct HTTP. Surfaces that Flow's own interface open a **headed** (visible) Chrome window. Local commands open no browser. This page is the single source of the per-command list. The wire details of the direct path are -in [DIRECT_TRANSPORT](DIRECT_TRANSPORT.md); the settings are in +in [DIRECT_TRANSPORT](https://github.com/ffroliva/gflow-cli/blob/main/docs/DIRECT_TRANSPORT.md); the settings are in [CONFIGURATION](CONFIGURATION.md#gflow_cli_browser_visibility). All rows below describe the default, `GFLOW_CLI_BROWSER_VISIBILITY=auto`. @@ -44,7 +44,7 @@ browser has been measured, so `auto` runs them headless. | `video upscale --scale 4k` | headless on `flow.google.com` (not measured) | Ultra only, so not measured: it follows the measured video download-menu path by an explicit decision ([#1554](https://github.com/ffroliva/gflow-cli/issues/1554)). It spends credits on the click, and a failure after the click is never retried. `--browser-visibility headed` shows the window | | `video t2v --max-credits` | headless when only the cap needs the UI | A capped text-to-video whose uncapped request is an explicit measured key (for example `--model omni-1.2-flash --duration 4 --resolution 360p`; with no `--model` the key is the account's selection and it stays headed) reads Flow's quote in a headless browser: it reached the submit 2/2 headless matching a headed control with the submit aborted, and billed headless runs of that key on one account completed at the quoted 4 credits (3/3), and the other measured keys follow it by decision; an account that refused it headless refused the headed control too ([#1554](https://github.com/ffroliva/gflow-cli/issues/1554)). A capped video of any other shape and a capped image-to-video stay headed; a capped reference-to-video follows the `video r2v --ref` row. `GFLOW_CLI_TRANSPORT=ui_automation` keeps it headed | | `video r2v --ref` | headless with one local image | A reference-to-video from exactly one local image (no saved asset, character, voice or `@` mention, one output) drives Flow's composer in a headless browser: it reached the submit 2/2 headless matching a headed control with the submit aborted, and a billed headless run (Omni 1.2 Flash, 4 s, 360p) completed at the quoted 4 credits; other models and durations follow it by decision, and a configured proxy is unmeasured ([#1554](https://github.com/ffroliva/gflow-cli/issues/1554)). An MCP reference given as a catalogued asset id resolves to its local file and counts as that file. An explicit `GFLOW_CLI_FLOW_HOST=labs.google` or `GFLOW_CLI_TRANSPORT=ui_automation` keeps it headed | -| `movie run` | headless for a plain movie | A manifest with no characters and no instruction cards drives each scene, on any model, through Flow's composer in a headless browser, and the retry loop's UI fallback keeps that browser: a billed one-scene headless run (Omni 1.2 Flash, 4 s) completed at 4 credits, and the e2e completed headless ([#1554](https://github.com/ffroliva/gflow-cli/issues/1554), [spike](superpowers/spikes/2026-11-30-headless-movie-and-agent-only.md)). Characters or instruction cards keep the whole run headed; an explicit `GFLOW_CLI_FLOW_HOST=labs.google` or `GFLOW_CLI_TRANSPORT=ui_automation` keeps it headed | +| `movie run` | headless for a plain movie | A manifest with no characters and no instruction cards drives each scene, on any model, through Flow's composer in a headless browser, and the retry loop's UI fallback keeps that browser: a billed one-scene headless run (Omni 1.2 Flash, 4 s) completed at 4 credits, and the e2e completed headless ([#1554](https://github.com/ffroliva/gflow-cli/issues/1554), [spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-30-headless-movie-and-agent-only.md)). Characters or instruction cards keep the whole run headed; an explicit `GFLOW_CLI_FLOW_HOST=labs.google` or `GFLOW_CLI_TRANSPORT=ui_automation` keeps it headed | ## Headed (Flow's UI) @@ -54,7 +54,7 @@ browser has been measured, so `auto` runs them headless. | `image batch` | headed | The stay-mounted UI batch drives the composer; on an account served flow.google.com, gflow cannot drive it yet in either mode (exit 36, [#639](https://github.com/ffroliva/gflow-cli/issues/639)), so headless is unmeasured | | `image upscale --scale 2k` | headed | Headless was refused on one of two accounts while headed passed: after a day of runs, `SPrCad` answered `PUBLIC_ERROR_UNUSUAL_ACTIVITY` to three headless 2K upscales and accepted the headed one (unbilled); the other account passed both ([#1554](https://github.com/ffroliva/gflow-cli/issues/1554)). `--scale 4k` (Ultra) follows the same path and stays headed | | `movie run` (with characters or instruction cards) | headed | Characters are created or attached and instruction cards are synced in Flow's UI, which is not measured headless; scene requests carry no resolution, so no scene goes direct | -| agent-only composer | the command's own launch (unmeasured) | gflow recognises the agent-only composer ([#799](https://github.com/ffroliva/gflow-cli/issues/799)) only after the page loads, so it runs in the browser the command launched: headed for most UI commands, headless for a measured headless surface such as a plain `movie run`. No account available was served it, so headless on it is unmeasured ([spike](superpowers/spikes/2026-11-30-headless-movie-and-agent-only.md)). `--browser-visibility headed` shows the window | +| agent-only composer | the command's own launch (unmeasured) | gflow recognises the agent-only composer ([#799](https://github.com/ffroliva/gflow-cli/issues/799)) only after the page loads, so it runs in the browser the command launched: headed for most UI commands, headless for a measured headless surface such as a plain `movie run`. No account available was served it, so headless on it is unmeasured ([spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-30-headless-movie-and-agent-only.md)). `--browser-visibility headed` shows the window | | `video r2v` (other shapes) | headed | Two or more references, a saved asset, a character, an `@` mention, more than one output or `--ui-mode agentic` is not measured headless; reference-to-video is not measured over direct HTTP | | `video edit` | headed | On an account served flow.google.com, editing an existing clip by media id exits 23 in either mode ([#1605](https://github.com/ffroliva/gflow-cli/issues/1605)); a local clip reached the checked `jIps6` request in a $0 e2e with the submit aborted (2026-12-01); headless is unmeasured | | `video i2v --end-frame` | headed | An end frame, or a start frame that is already in the project, is not a measured shape. A billed headless run was refused as unusual activity (unbilled) while the headed control completed ([#1554](https://github.com/ffroliva/gflow-cli/issues/1554)) | @@ -167,5 +167,5 @@ below (the in-flight count, the start history, the armed page) carries from one `GFLOW_CLI_HEADLESS=true`) also runs the other Flow UI shapes headless at the user's choice; this is unsupported, see [#1554](https://github.com/ffroliva/gflow-cli/issues/1554). -Evidence: [the direct video and headless mint spike](superpowers/spikes/2026-11-27-direct-video-and-headless-mint.md) +Evidence: [the direct video and headless mint spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-27-direct-video-and-headless-mint.md) ([#1371](https://github.com/ffroliva/gflow-cli/issues/1371)). diff --git a/website/docs/CHARACTER.md b/website/docs/CHARACTER.md index 91a1526c3..152a7ec78 100644 --- a/website/docs/CHARACTER.md +++ b/website/docs/CHARACTER.md @@ -2,15 +2,15 @@ > **Status:** SHIPPED (live-verified 2026-06-02) · **Issue:** [#145](https://github.com/ffroliva/gflow-cli/issues/145) · **Branch:** `feature/character-creation` > **Living document.** Evolve this as the feature and Flow's API evolve. Raw capture provenance lives in -> [`CHARACTER_RECON.md`](CHARACTER_RECON.md); the cross-feature decision lens is -> [the REST-path capability matrix](#capability-cost). +> [`CHARACTER_RECON.md`](https://github.com/ffroliva/gflow-cli/blob/main/docs/CHARACTER_RECON.md); the cross-feature decision lens is +> [the REST-path capability matrix](#3-capability-cost). > **Credit:** pattern-references @kittinan's avatar PR #123 (attach-flow idiom + CLI scaffolding shape) — but > built **greenfield off `develop`, NOT stacked on #123** (that branch is CONFLICTING and likeness-specific; > see [Design decisions](#11-design-decisions-post-predict)). > **Shipped scope:** `gflow character create` + `list` + `show` + `voices` + `rm`. Name-based reuse via > `@Name` prompt mentions is **shipped** (v0.40.0, [#344](https://github.com/ffroliva/gflow-cli/issues/344)) -> for both `image` and `video` paths — see [REFERENCE_STRATEGIES](REFERENCE_STRATEGIES.md). An explicit +> for both `image` and `video` paths — see [REFERENCE_STRATEGIES](https://github.com/ffroliva/gflow-cli/blob/main/docs/REFERENCE_STRATEGIES.md). An explicit > `--character ` **flag** on `gflow video` (a separate, repeatable-ref delivery mechanism) remains > **not yet implemented** — see [Backlog](#14-backlog-not-yet-implemented). @@ -310,7 +310,7 @@ is **shipped** (see the table below). | `gflow video … --character ` *(repeatable → multi-ref, explicit flag)* | **not yet implemented** (Phase 3) — `referenceEntities` on `video:batchAsyncGenerateVideoReferenceImages` | | `gflow character rm` (`--id`/`--name`) | On `flow.google.com`, moves the character to the project's Trash. Restore it from Trash in Flow. On `labs.google`, deletes the character through `flow:batchDeleteAssets`. Neither action spends credits. | | `gflow image … --character ` *(explicit flag)* | id-based reuse **shipped** as `gflow image t2i/i2i --reference-entity ` (wire captured 2026-06-08, `api/image.py`) | -| `@Name` in a t2i/i2i/video prompt | name-based mention resolution **shipped v0.40.0 (#344)** — resolves to the staged character entity, works on both image and video paths (on flow.google.com, video `@Name` works on `r2v` alongside a `--ref` or `--reference-entity`; other video modes on that host refuse character references before submit, exit 36); see [REFERENCE_STRATEGIES](REFERENCE_STRATEGIES.md) | +| `@Name` in a t2i/i2i/video prompt | name-based mention resolution **shipped v0.40.0 (#344)** — resolves to the staged character entity, works on both image and video paths (on flow.google.com, video `@Name` works on `r2v` alongside a `--ref` or `--reference-entity`; other video modes on that host refuse character references before submit, exit 36); see [REFERENCE_STRATEGIES](https://github.com/ffroliva/gflow-cli/blob/main/docs/REFERENCE_STRATEGIES.md) | All commands take **`--project ` (required)** — every endpoint (`createEntity`, `projectInitialData`, reuse) is project-scoped; mirrors `gflow scene` / `gflow data` ergonomics. Use `--id`/`--name` flags, never a @@ -344,7 +344,7 @@ never hard-code wire names in user-facing help — see [[cli-model-aliases-verif - **Data layer.** Persist `entityId`, `workflowId`s, `primaryMediaId`s, voice, personality so a character is recoverable and reusable across sessions (mirrors the scene persistence + migration pattern). - **Docs are first-class.** This document is the living spec; update it in the same PR as any behavioural - change. Indexed in [`docs/INDEX.md`](INDEX.md). + change. Indexed in [`docs/INDEX.md`](https://github.com/ffroliva/gflow-cli/blob/main/docs/INDEX.md). ## 10. Open items @@ -426,7 +426,7 @@ convenience later. > Two of three generative routes accept a `TokenMinter` token. Treat the wall as a **per-route measurement**, > never an inherited assumption — and re-measure before citing it. The `batchGenerateImages` 403 has not been > re-tested since 2026-06-02 and may itself be stale. -> Evidence: [superpowers/spikes/2026-08-31-veo-extend-route-recon.md](superpowers/spikes/2026-08-31-veo-extend-route-recon.md). +> Evidence: [superpowers/spikes/2026-08-31-veo-extend-route-recon.md](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-08-31-veo-extend-route-recon.md). - **✅ Decision = Option B (UI-driven generation; structural ops stay REST).** Generation (character image create AND video reuse) **must** ride Flow's native UI so Flow's JS issues the WAF-valid request, which gflow passive-captures — identical mechanism to the existing `generate_image`/`generate_video`. Revised @@ -573,7 +573,7 @@ The following are explicitly **out of the shipped scope** and tracked for future (`services/mentions.py`), on both image and video paths for character references. The image-path wire shape (`gflow image t2i/i2i --reference-entity `) shipped earlier (live capture 2026-06-08, `api/image.py`; asserted by `_assert_image_entities_attached`). See - [REFERENCE_STRATEGIES](REFERENCE_STRATEGIES.md) for the decision guide across all three mechanisms. + [REFERENCE_STRATEGIES](https://github.com/ffroliva/gflow-cli/blob/main/docs/REFERENCE_STRATEGIES.md) for the decision guide across all three mechanisms. (`gflow character rm` is now shipped, #150.) - **Set the Flow editor title field** so the editor isn't "Untitled Character" (see [§13.1 Known issues](#131-known-issues)). Investigate either the UI title box (with a Ctrl+A merge-bug workaround) or finding the dedicated title diff --git a/website/docs/CONFIGURATION.md b/website/docs/CONFIGURATION.md index 7b8127ac8..9e0a907a5 100644 --- a/website/docs/CONFIGURATION.md +++ b/website/docs/CONFIGURATION.md @@ -624,7 +624,7 @@ per-command `--proxy` flags (the setting covers one-off runs: ### `GFLOW_CLI_FLOW_HOST` -**What:** Which Flow frontend gflow drives. Google has moved Flow from `labs.google/fx/tools/flow` onto `flow.google.com` ([#639](https://github.com/ffroliva/gflow-cli/issues/639)) — measured 2026-09-14, the old labs URL answers **HTTP 308 Permanent Redirect** on every account we tested. The two are the same product (the new frontend's own root element is `aisandbox-root`) on different widget toolkits and different wire protocols, so each has its own driver. Which host you are served does **not** tell you which capabilities work — see [the survey](../docs/superpowers/spikes/2026-09-14-two-domain-protocol-survey.md). +**What:** Which Flow frontend gflow drives. Google has moved Flow from `labs.google/fx/tools/flow` onto `flow.google.com` ([#639](https://github.com/ffroliva/gflow-cli/issues/639)) — measured 2026-09-14, the old labs URL answers **HTTP 308 Permanent Redirect** on every account we tested. The two are the same product (the new frontend's own root element is `aisandbox-root`) on different widget toolkits and different wire protocols, so each has its own driver. Which host you are served does **not** tell you which capabilities work — see [the survey](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-09-14-two-domain-protocol-survey.md). **Values:** - `auto` (default) — **`flow.google.com` is the default host for every video request it can serve today** (`video t2v`, `video i2v` from local files or same-`--project` catalogued image UUIDs (#1542), and local-file `video r2v`; with no `--project` and no `GFLOW_CLI_PROJECT`, one is created first, #864). Image requests use the migrated composer for `image t2i` and local-file `image i2i` where `flow.google.com` is what Flow serves, and stay on labs where labs is. A request the new host cannot serve keeps the labs driver where labs is what Flow serves; where flow.google.com is, there is no labs fallback and unsupported forms exit 36/11 before submit. - `flow.google.com` — force the migrated composer for everything, including what it cannot serve yet (those requests then exit 36/11 instead of falling back). @@ -754,7 +754,7 @@ Variables already set in the actual environment always beat both `.env` files. A An invalid value stops every command except `gflow config` with exit 11 (`ConfigurationError`), on stderr, naming the key as written, its value (masked for a secret), the file or the environment that holds it, and the command that repairs it; `--json` prints one Problem Details object with `key` and `origin`. `gflow config` still runs so the value can be repaired. See [Troubleshooting](#troubleshooting). -Use [`.env.template`](../.env.template) as your starting point: +Use [`.env.template`](https://github.com/ffroliva/gflow-cli/blob/main/.env.template) as your starting point: ```bash cp .env.template .env diff --git a/website/docs/DATA_LAYER.md b/website/docs/DATA_LAYER.md index 92a6a2750..29a09ca82 100644 --- a/website/docs/DATA_LAYER.md +++ b/website/docs/DATA_LAYER.md @@ -38,7 +38,7 @@ The schema is adapter-shaped so a future Postgres backend can slot in without ch | `operation_assets` | Many-to-many between operations and assets, with role (`input`/`output`/`seed_start`/`seed_end`/`reference`) and ordered position | When the operation links its inputs/outputs | | `local_files` | One row per downloaded asset location — local path or cloud URI, sha256/byte count when local, media type, `superseded_at` once a later copy replaced it | After each download/upload completes | -Schema lives in [`src/gflow_cli/data/migrations/0001_initial.sql`](../src/gflow_cli/data/migrations/0001_initial.sql). +Schema lives in [`src/gflow_cli/data/migrations/0001_initial.sql`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/data/migrations/0001_initial.sql). ### Operation `metadata_json` provenance @@ -277,7 +277,7 @@ The hash is always stored so you can correlate without the plaintext. ### Metadata redaction -[`redact_metadata`](../src/gflow_cli/data/redaction.py) is applied to every dict that lands in `assets.metadata_json`. It strips: +[`redact_metadata`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/data/redaction.py) is applied to every dict that lands in `assets.metadata_json`. It strips: | Key (case-insensitive) | Replacement | |---|---| @@ -304,7 +304,7 @@ sharing the raw SQLite file if failed queue payloads must stay confidential. In the default `store` mode, failure rows persist a scrubbed, readable copy of the exception's Problem Details `detail` through -[`redact_error_detail`](../src/gflow_cli/data/redaction.py). Free-text +[`redact_error_detail`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/data/redaction.py). Free-text `Bearer …` / `SAPISIDHASH …` tokens and auth-cookie pairs become ``, flow.google.com's bare `at` XSRF value and `0cAF…` reCAPTCHA tokens become ``, URLs carrying signed-query markers and @@ -505,7 +505,7 @@ Cloud-only assets have `LocalFileRecord.path is None` and carry their object location in `LocalFileRecord.cloud_uri`; path-based seed-image resolution is local-only. -The public read API is `DataRepository` ([`src/gflow_cli/data/repository.py`](../src/gflow_cli/data/repository.py)), whose methods live in the table-group modules `data/_repo_*.py`; all read methods return typed `SeedImage` / `AssetLookup` dataclasses, not raw SQLite rows. +The public read API is `DataRepository` ([`src/gflow_cli/data/repository.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/data/repository.py)), whose methods live in the table-group modules `data/_repo_*.py`; all read methods return typed `SeedImage` / `AssetLookup` dataclasses, not raw SQLite rows. --- @@ -525,7 +525,7 @@ See [`CONFIGURATION.md`](CONFIGURATION.md) for the full env-var precedence chain ## Migrations -All schema changes are SQL files under [`src/gflow_cli/data/migrations/`](../src/gflow_cli/data/migrations/), named `NNNN_description.sql` with a 4+ digit zero-padded prefix. +All schema changes are SQL files under [`src/gflow_cli/data/migrations/`](https://github.com/ffroliva/gflow-cli/tree/main/src/gflow_cli/data/migrations), named `NNNN_description.sql` with a 4+ digit zero-padded prefix. **How they're applied:** @@ -572,7 +572,7 @@ All three errors map to **exit code 16**: All three are subclasses of `GFlowError` and re-exported through `gflow_cli.exceptions`. They follow the project's RFC 9457 Problem Details pattern. -See [`errors.py::EXIT_CODE_MAP`](../src/gflow_cli/errors.py) for the complete exit-code mapping. +See [`errors.py::EXIT_CODE_MAP`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/errors.py) for the complete exit-code mapping. Distinct from the above (which are errors OF the data layer), the `operations.error_type` column stores the taxonomy of RECORDED generation @@ -588,7 +588,7 @@ the transfer failed — recover it with `gflow data download`). Query them with ### Adding a new operation kind -1. Add the enum value to `OperationKind` in [`data/models.py`](../src/gflow_cli/data/models.py). +1. Add the enum value to `OperationKind` in [`data/models.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/data/models.py). 2. Add a `record_(...)` method to `OperationRecorder` following the existing patterns (upsert profile → project → asset → insert operation → link → asset location rows). 3. Wire it into the CLI call site, mirroring the `_run_t2i` / `record_completed_video` patterns: open recorder BEFORE Flow, close in `finally`, wrap the `record_*` call in `try/except DataStoreError` calling `_warn_persistence_failed_after_success(...)`. @@ -641,7 +641,7 @@ Live tests (`@pytest.mark.live`) and E2E tests (`@pytest.mark.e2e`) are opt-in a - **Postgres / Supabase adapter** — for users running gflow on shared workers or wanting cross-machine sync. The repository surface is already designed for this swap. - **`gflow data export`** (full catalog → JSON / Parquet) — the failed-operation slice shipped as `gflow data errors export` (JSONL, #345); a full-catalog / Parquet dump for downstream analytics is still open. -These are tracked in [`PLAN.md`](../PLAN.md) under the data-layer phase backlog. +These are tracked in [`PLAN.md`](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md) under the data-layer phase backlog. --- diff --git a/website/docs/DEBUGGING.md b/website/docs/DEBUGGING.md index 1553162ac..6f821e8f7 100644 --- a/website/docs/DEBUGGING.md +++ b/website/docs/DEBUGGING.md @@ -2,7 +2,7 @@ > Where to look and which tool to reach for when something breaks. Per-release > evidence (e.g. live verification runs) lives in sibling docs like -> [`LIVE_VERIFICATION_v0.7.0.md`](LIVE_VERIFICATION_v0.7.0.md). This file is +> [`LIVE_VERIFICATION_v0.7.0.md`](https://github.com/ffroliva/gflow-cli/blob/main/docs/LIVE_VERIFICATION_v0.7.0.md). This file is > evergreen. ## Quick reference @@ -45,7 +45,7 @@ Confirm by checking for `ui_automation.image_mode_entered` in the log; if it is missing, the mode switch did not run. If `image_mode_entered` is present but `batch_response_seen` is still missing, the remaining hypothesis is the historical UI-flake noted in -[`LIVE_VERIFICATION_v0.7.0.md`](LIVE_VERIFICATION_v0.7.0.md#open-follow-ups) +[`LIVE_VERIFICATION_v0.7.0.md`](https://github.com/ffroliva/gflow-cli/blob/main/docs/LIVE_VERIFICATION_v0.7.0.md#open-follow-ups-not-blocking-v070) (transient overlay swallowed the arrow-forward click). **Two extra artifact file names worth searching for in the out dir** when the @@ -275,7 +275,7 @@ For health probes from a worker process, use ## Reproducing image gen end-to-end -See [`LIVE_VERIFICATION_v0.7.0.md`](LIVE_VERIFICATION_v0.7.0.md) for the +See [`LIVE_VERIFICATION_v0.7.0.md`](https://github.com/ffroliva/gflow-cli/blob/main/docs/LIVE_VERIFICATION_v0.7.0.md) for the canonical example. Short form: ```bash @@ -372,7 +372,7 @@ remediations. The most-hit categories: - [`AUTHENTICATION.md`](AUTHENTICATION.md) — sign-in flow details - [`DEVELOPMENT.md`](DEVELOPMENT.md) — branching, PRs, quality gates - [`USAGE.md`](USAGE.md) — CLI surface -- [`LIVE_VERIFICATION_v0.7.0.md`](LIVE_VERIFICATION_v0.7.0.md) — +- [`LIVE_VERIFICATION_v0.7.0.md`](https://github.com/ffroliva/gflow-cli/blob/main/docs/LIVE_VERIFICATION_v0.7.0.md) — per-release end-to-end evidence - `/gflow:known-issues` — surface open known issues from the CLI - `/gflow:check` — local quality gate (lint, format, types, tests) diff --git a/website/docs/DEVELOPMENT.md b/website/docs/DEVELOPMENT.md index a50d8e6d8..975122c03 100644 --- a/website/docs/DEVELOPMENT.md +++ b/website/docs/DEVELOPMENT.md @@ -1,9 +1,9 @@ # Development Workflow -> For _contributing_ (TDD, quality gates, commit style, how to add a route) see [CONTRIBUTING.md](../CONTRIBUTING.md). +> For _contributing_ (TDD, quality gates, commit style, how to add a route) see [CONTRIBUTING.md](https://github.com/ffroliva/gflow-cli/blob/main/CONTRIBUTING.md). > This document covers the **internal development process**: branching model, PR protocol, e2e gate, and release pipeline. > For scenario-based GitHub PR triage, external fork handling, and SonarCloud -> decisions, see [docs/GITHUB.md](GITHUB.md). +> decisions, see [docs/GITHUB.md](https://github.com/ffroliva/gflow-cli/blob/main/docs/GITHUB.md). --- @@ -91,7 +91,7 @@ new-code conditions only; overall coverage ≥ 90 % is enforced by CI's `sonar.qualitygate.wait=true`, so a failed gate turns the `SonarCloud analysis` check red rather than reporting silently on the dashboard. Browser-automation and live-auth transports are coverage-excluded (e2e-tested, not unit-tested). -See [docs/GITHUB.md § SonarCloud Quality Gate](GITHUB.md#sonarcloud-quality-gate). +See [docs/GITHUB.md § SonarCloud Quality Gate](https://github.com/ffroliva/gflow-cli/blob/main/docs/GITHUB.md#sonarcloud-quality-gate). ### Mutation testing (mutmut) @@ -156,7 +156,7 @@ export GFLOW_CLI_E2E_PROFILE= uv run pytest -m e2e -v ``` -All `@pytest.mark.e2e` scenarios must pass. See [CONTRIBUTING § E2e tests](../CONTRIBUTING.md#test-categories) for the full marker reference. +All `@pytest.mark.e2e` scenarios must pass. See [CONTRIBUTING § E2e tests](https://github.com/ffroliva/gflow-cli/blob/main/CONTRIBUTING.md#test-categories) for the full marker reference. --- @@ -177,7 +177,7 @@ Version bumps belong in the **`develop → main` release PR**, not in feature PR ## AI-assisted development (Claude Code) -This repo is actively developed with Claude Code (see [CLAUDE.md](../CLAUDE.md)). A few conventions that keep the workflow clean: +This repo is actively developed with Claude Code (see [CLAUDE.md](https://github.com/ffroliva/gflow-cli/blob/main/CLAUDE.md)). A few conventions that keep the workflow clean: - Claude branches are renamed to the appropriate `feature/`, `fix/`, `docs/` prefix before the PR is opened. The `claude/` prefix is internal scaffolding. - Claude never bumps the version or cuts a release without explicit instruction — use `/release`. @@ -190,9 +190,9 @@ This repo is actively developed with Claude Code (see [CLAUDE.md](../CLAUDE.md)) ## See also -- [CONTRIBUTING.md](../CONTRIBUTING.md) — TDD, quality gates, how to add a route, commit style -- [docs/GOVERNANCE_BENCHMARK.md](GOVERNANCE_BENCHMARK.md) — calibrating the advisory materiality gate (false-positive / coverage backtest) -- [docs/GITHUB.md](GITHUB.md) — GitHub PR triage, external fork handling, SonarCloud scenarios -- [RELEASE.md](../RELEASE.md) — release checklist, PyPI/GitHub publishing, tag protocol -- [CHANGELOG.md](../CHANGELOG.md) — version history -- [CLAUDE.md](../CLAUDE.md) — project memory hub for AI agents +- [CONTRIBUTING.md](https://github.com/ffroliva/gflow-cli/blob/main/CONTRIBUTING.md) — TDD, quality gates, how to add a route, commit style +- [docs/GOVERNANCE_BENCHMARK.md](https://github.com/ffroliva/gflow-cli/blob/main/docs/GOVERNANCE_BENCHMARK.md) — calibrating the advisory materiality gate (false-positive / coverage backtest) +- [docs/GITHUB.md](https://github.com/ffroliva/gflow-cli/blob/main/docs/GITHUB.md) — GitHub PR triage, external fork handling, SonarCloud scenarios +- [RELEASE.md](https://github.com/ffroliva/gflow-cli/blob/main/RELEASE.md) — release checklist, PyPI/GitHub publishing, tag protocol +- [CHANGELOG.md](https://github.com/ffroliva/gflow-cli/blob/main/CHANGELOG.md) — version history +- [CLAUDE.md](https://github.com/ffroliva/gflow-cli/blob/main/CLAUDE.md) — project memory hub for AI agents diff --git a/website/docs/E2E_TESTING.md b/website/docs/E2E_TESTING.md index 7d4e21dea..26ca7b1a5 100644 --- a/website/docs/E2E_TESTING.md +++ b/website/docs/E2E_TESTING.md @@ -101,7 +101,7 @@ e2e ─┬─ e2e_auth (auth/session, health check — zero credits) A live test can be written as Gherkin. This is the required form for a bug whose scenario can only happen in a browser — see -[`skills/issue-resolve/SKILL.md`](../skills/issue-resolve/SKILL.md) § The Bug Lane, +[`skills/issue-resolve/SKILL.md`](https://github.com/ffroliva/gflow-cli/blob/main/skills/issue-resolve/SKILL.md) § The Bug Lane, step 5. It needs **no new machinery**: pytest-bdd (already a dependency) converts every Gherkin tag into a pytest marker, so a tagged scenario is filtered by the same `addopts` and selected by the same `-m ` as a hand-written e2e test. @@ -689,7 +689,7 @@ flow.google.com clip lands in that bucket (#1003). ## See also -- [CONTRIBUTING.md § Test categories](../CONTRIBUTING.md#test-categories) +- [CONTRIBUTING.md § Test categories](https://github.com/ffroliva/gflow-cli/blob/main/CONTRIBUTING.md#test-categories) - [DEVELOPMENT.md § E2e gate](DEVELOPMENT.md#e2e-gate-before-merging-develop-main) - [docs/DATA_LAYER.md](DATA_LAYER.md) - [docs/ARCHITECTURE.md § Testing topology](ARCHITECTURE.md#testing-topology) diff --git a/website/docs/ERRORS.md b/website/docs/ERRORS.md index 02933e3a0..a62d01088 100644 --- a/website/docs/ERRORS.md +++ b/website/docs/ERRORS.md @@ -171,7 +171,7 @@ place today: `PUBLIC_ERROR_UNUSUAL_ACTIVITY` is `WafRejectionError` (exit 10), never retryable, and its `charged` / `next_action` depend on the scale. The scales measured to spend no credits (1080p, 720p and the 270p GIF for video, 2K for image; - [spike](superpowers/spikes/2026-11-29-export-billing-720p-270p.md)) read `no` / `wait`; + [spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-29-export-billing-720p-270p.md)) read `no` / `wait`; 4K (a 4K video bills on click; 4K image billing is unmeasured and treated the same), and a refusal on the `jwpduf` status poll, which runs after Flow accepted the export, read `maybe` / `reconcile`. No `retry_after` is given: no diff --git a/website/docs/INSTRUCTIONS.md b/website/docs/INSTRUCTIONS.md index 391cfb535..a5e6d9c87 100644 --- a/website/docs/INSTRUCTIONS.md +++ b/website/docs/INSTRUCTIONS.md @@ -164,6 +164,6 @@ title is ambiguous. - [USAGE.md](USAGE.md) — full command reference. - [MOVIE.md](MOVIE.md) — multi-scene movies (`[[…instructions.card]]` blocks). - [MCP.md](MCP.md) — the six `gflow_instructions_*` MCP tools mirroring this command group. -- [LIVE_VERIFICATION_v0.29.0.md](LIVE_VERIFICATION_v0.29.0.md) — live e2e evidence for the +- [LIVE_VERIFICATION_v0.29.0.md](https://github.com/ffroliva/gflow-cli/blob/main/docs/LIVE_VERIFICATION_v0.29.0.md) — live e2e evidence for the CRUD surface (mechanism, H4 image-reference confirmation). The original plan + spike findings were consolidated and removed when the feature shipped (v0.29.0 release prep). diff --git a/website/docs/KNOWN_ISSUES.md b/website/docs/KNOWN_ISSUES.md index 770fe7088..635dca6a8 100644 --- a/website/docs/KNOWN_ISSUES.md +++ b/website/docs/KNOWN_ISSUES.md @@ -2,7 +2,7 @@ Living list of behaviour that's broken, surprising, or limited by design — alongside workarounds and a pointer to the issue / version where each is tracked or resolved. -> Pair with [CHANGELOG.md](CHANGELOG.md) (what shipped per version) and [DISCLAIMER.md](DISCLAIMER.md) (legal/scope limits). +> Pair with [CHANGELOG.md](https://github.com/ffroliva/gflow-cli/blob/main/CHANGELOG.md) (what shipped per version) and [DISCLAIMER.md](https://github.com/ffroliva/gflow-cli/blob/main/DISCLAIMER.md) (legal/scope limits). ## Conventions @@ -794,8 +794,7 @@ endpoint, a different surface from the `labs.google` tRPC API. > because it sends cookies but not that token. The `gflow scene` groundwork now > fetches+caches the token and attaches the Bearer to the **`page.request` REST > path** (`_post_json` / `_patch_json`, host-scoped to `aisandbox-pa`) so -> `uploadImage` / `scenes` / `commit` authenticate — see -> [`docs/superpowers/plans/2026-05-31-l0-bearer-pivot.md`](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/plans/2026-05-31-l0-bearer-pivot.md). +> `uploadImage` / `scenes` / `commit` authenticate. > **Live-verified 2026-05-31:** REST `uploadImage` returns 200 > (`tests/e2e/test_aisandbox_auth_live.py`, credit-free). > **Liberating follow-up:** the same Bearer likely unlocks the `evaluate_fetch` diff --git a/website/docs/MCP.md b/website/docs/MCP.md index 1d9ee3fa5..8f2599ba2 100644 --- a/website/docs/MCP.md +++ b/website/docs/MCP.md @@ -130,8 +130,8 @@ completed result (blocking and queued alike) carries `route` (`direct` / `ui`), is [BROWSER_MODES](BROWSER_MODES.md). * `gflow_generate_image(prompt, model, aspect, count, reference_images, reference_entities, reference_entity_names, tools, profile, project, project_name, instructions, ui_mode, thinking_level, out_file, wait, browser_visibility)`: Triggers text-to-image / image-to-image (Imagen / Nano Banana). `thinking_level` (`low`/`medium`/`high`, matched case-insensitively, mirroring CLI `--thinking-level`) binds Flow's image thinking-level toggle in the settings pane (omitting leaves Flow's existing setting untouched). `out_file` sets an explicit destination file path (mirrors CLI `--out-file`; legacy `output` removed in #1158). There is no `seed` parameter: Flow picks the seed and the image request cannot carry one (removed in [#1013](https://github.com/ffroliva/gflow-cli/issues/1013), as the CLI's `--seed` was in v0.8.0). A completed result reports the catalogued seed under `seed`: the seed Flow chose on the classic image paths, `0` on the agentic / agent-only arms (which observe none), `null` if none was recorded — the MCP twin of `gflow image t2i --json`'s `images[].seed`. `instructions` is an optional list of ephemeral agent-instruction strings (agentic cohort only). `reference_images` switches to i2i and accepts **either a local file path or a generated image's Flow media UUID**. A UUID reference is attached by **selecting the already-existing asset in Flow's reference picker — no duplicate copy is uploaded** (locating the tile by the media id in its thumbnail URL, and searching the recorded display name to surface it when needed); gflow falls back to uploading the asset's on-disk local file only when it can't be located in place (e.g. it lives in a different project's picker). `project` generates into an existing Flow project id (mirrors CLI `--project`; when omitted, [`GFLOW_CLI_PROJECT`](CONFIGURATION.md#gflow_cli_project) is used unless `project_name` asks for a new project, #1039) — pass the reference's project to keep it selectable in place. `ui_mode` selects the Flow UI arm (`auto`/`classic`/`agentic`, mirroring CLI `--ui-mode`, matched case-insensitively). Since [#595](https://github.com/ffroliva/gflow-cli/issues/595) `auto` means "no arm was asked for" and **resolves to `classic`** — the arm that can satisfy an image request — so an account in Flow's agentic cohort aborts pre-submit (exit-28 equivalent envelope, zero credits) instead of failing mid-run with selector drift or video bytes; the agentic arm is bound only when named. Passing `instructions` forces `agentic` automatically, so `ui_mode="classic"` + `instructions` is a hard conflict rather than a silent drop. An unknown value returns a 400 problem-details envelope. See [CONFIGURATION § GFLOW_CLI_UI_MODE](CONFIGURATION.md#gflow_cli_ui_mode). - `model` is `nano2` (Nano Banana 2.1 on flow.google.com; `nano2.1` also accepted), `nano2-lite` (Nano Banana 2 Lite), `nano-pro` (Nano Banana Pro) or `image4` (Imagen 4, no longer in Flow's menu); other aliases are accepted too. On migrated `flow.google.com` accounts, T2I and local-file I2I are supported with Nano Banana 2.1 (`nano2`, #958) / 2 Lite / Pro, all five aspects (16:9, 4:3, 1:1, 3:4, 9:16) and count 1–4; the measured shapes are sent as a direct `ogiZ0b` request with a token from a headless browser, and the rest are submitted by Flow's own page ([DIRECT_TRANSPORT](DIRECT_TRANSPORT.md)). `@Name` character mentions in the prompt are attached through the composer's `@` picker and verified as character chips before submit (#723). each explicit `reference_entities` id needs its `reference_entity_names` entry or a matching `@Name` in the prompt (otherwise exit 36); a `reference_images` UUID is referenced in place when the catalog records it in the same `project` (#995), and a local `reference_images` file is uploaded into the project once and mentioned in place on later calls with the same file, like the CLI's `--ref` ([#772](https://github.com/ffroliva/gflow-cli/issues/772)); an output path gflow cannot write ends in the exit-11-equivalent envelope, with the image still in the Flow project ([#1091](https://github.com/ffroliva/gflow-cli/issues/1091)); other UUID references, instructions and Imagen 4 remain pre-submit refusals there. An agent-only composer (see below) takes T2I only. When Flow returns fewer images than `count`, the reply is still `completed`, `files` lists the images produced, and the `warnings` list includes the object `{"type": "images_missing", "requested": 4, "returned": 3}` (a `failed` reply carries it too when the images came back short before the failure) ([#1489](https://github.com/ffroliva/gflow-cli/issues/1489)). Each saved image is checked against the request at no cost, and a mismatch adds a `warnings` entry carrying its `media_name`: `aspect_mismatch` (decoded `width`/`height` more than 10 % off the `requested` aspect), `echoed_reference` (byte-identical to a local reference image) or `tiny_file` (under 8 KB, with `bytes` and `min_bytes`); the reply stays `completed` and the file is kept, and `wait=true` and `tasks/get` report the same entries ([#1534](https://github.com/ffroliva/gflow-cli/issues/1534)). A path that reads the images off the page (Agent mode, an agent-only composer, or a lost reply) fails instead when some are missing. The queued (`wait=false`) and blocking (`wait=true`) calls use the same typed payload and worker path. -* `gflow_generate_video(prompt, mode, aspect, initial_frame, end_frame, reference_images, reference_entities, reference_entity_names, model, duration, resolution, count, tools, profile, project, project_name, ui_mode, out_file, max_credits, wait, browser_visibility)`: Triggers vertical or landscape video generation (Veo). `out_file` sets an explicit destination file path (mirrors CLI `--out-file`; legacy `output` removed in #1158). `mode` is `t2v`/`i2v`/`r2v`; `model` (`veo_lite`/`veo_fast`/`veo_quality`/`omni_flash`/`omni_1_2_flash`, aliases accepted), `duration` (seconds — 4/6/8 for Veo 3.1, 4/6/8/10 for omni_flash, every integer 3–15 for omni_1_2_flash, at most 10 with an `end_frame`; with no `model`, 4/6/8/10), `resolution` ('360p' or '720p', supported on the Omni models; on any other model, or on the labs editor, the job fails pre-submit with the exit-11-equivalent envelope and no credits spent). **Whether Flow renders a duration control at all is account/cohort-dependent**: on an account that renders none, the job is accepted here and fails in the worker pre-submit (exit 23 equivalent on the labs driver, exit 11 equivalent on the migrated `flow.google.com` host — now the default t2v route, #650 — no credits spent either way) rather than being rejected up front — see [KNOWN_ISSUES](https://github.com/ffroliva/gflow-cli/blob/main/KNOWN_ISSUES.md) (#451/#288/#630), and `count` mirror the CLI `gflow video` flags — an omitted `model` lets the transport apply its i2v veo-lite default (issue #125), and every model — `omni_flash` included — accepts i2v with a start frame and with an end frame (wire-verified 2026-09-02, issue #626); `i2v` requires `initial_frame`, `r2v` requires `reference_images` **or** `reference_entities`; `project` generates into an existing Flow project id (mirrors CLI `--project`; when omitted, [`GFLOW_CLI_PROJECT`](CONFIGURATION.md#gflow_cli_project) is used unless `project_name` asks for a new project, #1039); on an account Google has moved to `flow.google.com` (`GFLOW_CLI_FLOW_HOST`, read from the server/daemon environment, not per call — see [CONFIGURATION § GFLOW_CLI_FLOW_HOST](CONFIGURATION.md#gflow_cli_flow_host)) omitting `project` creates one there first (#864); there, on the classic migrated composer (an agent-only one takes text-to-video only — see below), the ported modes are text-to-video; image-to-video with a **local** `initial_frame` (at the measured key, 9:16 with the default Veo 3.1 Lite and no `duration` / `resolution` / `end_frame`, the frame is uploaded and the request sent over direct HTTP with a headless browser; see [DIRECT_TRANSPORT](DIRECT_TRANSPORT.md)), optionally with a **local** `end_frame` (start+end interpolation, #639 — on the UI path local files are uploaded under a **run-unique** name like `hero-a1b2c3d4.png`, [#792](https://github.com/ffroliva/gflow-cli/issues/792)), **or** captioned image UUIDs the local catalog records in the same `project` ([#1542](https://github.com/ffroliva/gflow-cli/issues/1542), bound in place on the UI path via `/asb/` — the UUID frame skips upload, including Start+End and mixed local+UUID pairs where only the local frame uploads); and reference-to-video with local `reference_images` (each file is uploaded the same way — run-unique name included — and attached as an `@` mention of *that* name in the prompt; `duration` there accepts every integer from `3` through `15` with explicit `model="omni_1_2_flash"` (set through its duration slider; Google AI plans are required above `10`) and `4/6/8/10` with explicit `omni_flash`; Veo or an unspecified model accepts only `8`, because measured shorter Veo requests dropped the references and billed text-to-video, so any other value returns the exit-11-equivalent envelope. An omitted r2v duration still pins `8` to avoid inheriting the editor's previous setting). A cross-project Flow media UUID (or an un-captioned UUID with a verified local fallback) as `initial_frame`/`end_frame`, a character on `t2v` or `i2v`, and a character id missing its display name return the exit-36-equivalent envelope (an uncatalogued/unusable UUID or a non-path string such as `@Name` returns 400 before dispatch); `r2v` takes named characters with or without local `reference_images`. An explicit id's display name can come from its `reference_entity_names` entry or a matching `@Name` in the prompt ([#723](https://github.com/ffroliva/gflow-cli/issues/723)). `initial_frame`, `end_frame`, and `reference_images` each accept **either a local file path or the Flow image UUID of a generated asset** — pass a generated image's id straight in to chain image→video, and gflow attaches it for you. Since v0.58.0 (#529) the CLI and MCP surfaces are unified for i2v frames: the UUID keeps its identity and is enriched with the catalog's recorded display name plus an integrity-verified local fallback, so both transports prefer **selecting the exact asset in the project's media picker** (no duplicate upload). On `labs.google`, a missing tile falls back to re-uploading the recorded local file only if its byte count/SHA-256 still match; on `flow.google.com` (#1542), there is no local-file upload fallback — a missing or unrendered same-project tile reloads the grid up to ~90 s (plus at most one reload cycle) and fails with the exit-32-equivalent envelope. A UUID that isn't in your local asset catalog is rejected up front with a clear "Reference Not Found" error; a catalogued asset with neither a display name nor a verified local file gives a "Reference Not Usable" error (re-generate it or pass a local path). A video clip, or the media UUID of a catalogued clip, in `reference_images` returns a 400 naming `gflow_edit_video`, which edits a local clip with reference images ([#1540](https://github.com/ffroliva/gflow-cli/issues/1540)). For `r2v`, MCP resolves a catalogued image UUID to a verified local file before queuing the job. The flow.google.com driver receives the file for upload. A UUID without a local copy cannot be used this way. `ui_mode` selects the Flow UI arm (#299 PR-A, mirroring CLI `--ui-mode`) and **applies to every mode of this tool, including `r2v`** — unlike the CLI, where `video r2v`/`chain` have no flag and follow the env-only path. On labs and the classic migrated composer, video generation has **only a classic driver**, so `auto` ≡ `classic`: both verify the classic editor pre-submit and abort before spending credits if it is unreachable. `ui_mode="agentic"` is rejected with a 400 problem-details envelope, because no agentic video driver exists yet. (An agent-only migrated composer is routed before this check: text-to-video runs through its chat agent under `ui_mode` `auto` or `classic` — `"agentic"` is still rejected with the 400 above, before any browser work — and other video forms return the exit-36-equivalent envelope before anything is clicked.) Values are matched case-insensitively. (MCP tools return envelopes, never process exit codes — the CLI equivalents of these aborts are exit 28 and exit 2 respectively.) See [CONFIGURATION § GFLOW_CLI_UI_MODE](CONFIGURATION.md#gflow_cli_ui_mode). On a model Flow is retiring, the reply (the `wait=true` result and the queued task's `tasks/get` result alike) also carries `"warnings": [{"type": "model_retiring", "model": "", "retires_on": ""}]` ([#1375](https://github.com/ffroliva/gflow-cli/issues/1375)); the job still runs, and once Flow's menu stops offering the model it fails before submit, charged nothing. + `model` is `nano2` (Nano Banana 2.1 on flow.google.com; `nano2.1` also accepted), `nano2-lite` (Nano Banana 2 Lite), `nano-pro` (Nano Banana Pro) or `image4` (Imagen 4, no longer in Flow's menu); other aliases are accepted too. On migrated `flow.google.com` accounts, T2I and local-file I2I are supported with Nano Banana 2.1 (`nano2`, #958) / 2 Lite / Pro, all five aspects (16:9, 4:3, 1:1, 3:4, 9:16) and count 1–4; the measured shapes are sent as a direct `ogiZ0b` request with a token from a headless browser, and the rest are submitted by Flow's own page ([DIRECT_TRANSPORT](https://github.com/ffroliva/gflow-cli/blob/main/docs/DIRECT_TRANSPORT.md)). `@Name` character mentions in the prompt are attached through the composer's `@` picker and verified as character chips before submit (#723). each explicit `reference_entities` id needs its `reference_entity_names` entry or a matching `@Name` in the prompt (otherwise exit 36); a `reference_images` UUID is referenced in place when the catalog records it in the same `project` (#995), and a local `reference_images` file is uploaded into the project once and mentioned in place on later calls with the same file, like the CLI's `--ref` ([#772](https://github.com/ffroliva/gflow-cli/issues/772)); an output path gflow cannot write ends in the exit-11-equivalent envelope, with the image still in the Flow project ([#1091](https://github.com/ffroliva/gflow-cli/issues/1091)); other UUID references, instructions and Imagen 4 remain pre-submit refusals there. An agent-only composer (see below) takes T2I only. When Flow returns fewer images than `count`, the reply is still `completed`, `files` lists the images produced, and the `warnings` list includes the object `{"type": "images_missing", "requested": 4, "returned": 3}` (a `failed` reply carries it too when the images came back short before the failure) ([#1489](https://github.com/ffroliva/gflow-cli/issues/1489)). Each saved image is checked against the request at no cost, and a mismatch adds a `warnings` entry carrying its `media_name`: `aspect_mismatch` (decoded `width`/`height` more than 10 % off the `requested` aspect), `echoed_reference` (byte-identical to a local reference image) or `tiny_file` (under 8 KB, with `bytes` and `min_bytes`); the reply stays `completed` and the file is kept, and `wait=true` and `tasks/get` report the same entries ([#1534](https://github.com/ffroliva/gflow-cli/issues/1534)). A path that reads the images off the page (Agent mode, an agent-only composer, or a lost reply) fails instead when some are missing. The queued (`wait=false`) and blocking (`wait=true`) calls use the same typed payload and worker path. +* `gflow_generate_video(prompt, mode, aspect, initial_frame, end_frame, reference_images, reference_entities, reference_entity_names, model, duration, resolution, count, tools, profile, project, project_name, ui_mode, out_file, max_credits, wait, browser_visibility)`: Triggers vertical or landscape video generation (Veo). `out_file` sets an explicit destination file path (mirrors CLI `--out-file`; legacy `output` removed in #1158). `mode` is `t2v`/`i2v`/`r2v`; `model` (`veo_lite`/`veo_fast`/`veo_quality`/`omni_flash`/`omni_1_2_flash`, aliases accepted), `duration` (seconds — 4/6/8 for Veo 3.1, 4/6/8/10 for omni_flash, every integer 3–15 for omni_1_2_flash, at most 10 with an `end_frame`; with no `model`, 4/6/8/10), `resolution` ('360p' or '720p', supported on the Omni models; on any other model, or on the labs editor, the job fails pre-submit with the exit-11-equivalent envelope and no credits spent). **Whether Flow renders a duration control at all is account/cohort-dependent**: on an account that renders none, the job is accepted here and fails in the worker pre-submit (exit 23 equivalent on the labs driver, exit 11 equivalent on the migrated `flow.google.com` host — now the default t2v route, #650 — no credits spent either way) rather than being rejected up front — see [KNOWN_ISSUES](https://github.com/ffroliva/gflow-cli/blob/main/KNOWN_ISSUES.md) (#451/#288/#630), and `count` mirror the CLI `gflow video` flags — an omitted `model` lets the transport apply its i2v veo-lite default (issue #125), and every model — `omni_flash` included — accepts i2v with a start frame and with an end frame (wire-verified 2026-09-02, issue #626); `i2v` requires `initial_frame`, `r2v` requires `reference_images` **or** `reference_entities`; `project` generates into an existing Flow project id (mirrors CLI `--project`; when omitted, [`GFLOW_CLI_PROJECT`](CONFIGURATION.md#gflow_cli_project) is used unless `project_name` asks for a new project, #1039); on an account Google has moved to `flow.google.com` (`GFLOW_CLI_FLOW_HOST`, read from the server/daemon environment, not per call — see [CONFIGURATION § GFLOW_CLI_FLOW_HOST](CONFIGURATION.md#gflow_cli_flow_host)) omitting `project` creates one there first (#864); there, on the classic migrated composer (an agent-only one takes text-to-video only — see below), the ported modes are text-to-video; image-to-video with a **local** `initial_frame` (at the measured key, 9:16 with the default Veo 3.1 Lite and no `duration` / `resolution` / `end_frame`, the frame is uploaded and the request sent over direct HTTP with a headless browser; see [DIRECT_TRANSPORT](https://github.com/ffroliva/gflow-cli/blob/main/docs/DIRECT_TRANSPORT.md)), optionally with a **local** `end_frame` (start+end interpolation, #639 — on the UI path local files are uploaded under a **run-unique** name like `hero-a1b2c3d4.png`, [#792](https://github.com/ffroliva/gflow-cli/issues/792)), **or** captioned image UUIDs the local catalog records in the same `project` ([#1542](https://github.com/ffroliva/gflow-cli/issues/1542), bound in place on the UI path via `/asb/` — the UUID frame skips upload, including Start+End and mixed local+UUID pairs where only the local frame uploads); and reference-to-video with local `reference_images` (each file is uploaded the same way — run-unique name included — and attached as an `@` mention of *that* name in the prompt; `duration` there accepts every integer from `3` through `15` with explicit `model="omni_1_2_flash"` (set through its duration slider; Google AI plans are required above `10`) and `4/6/8/10` with explicit `omni_flash`; Veo or an unspecified model accepts only `8`, because measured shorter Veo requests dropped the references and billed text-to-video, so any other value returns the exit-11-equivalent envelope. An omitted r2v duration still pins `8` to avoid inheriting the editor's previous setting). A cross-project Flow media UUID (or an un-captioned UUID with a verified local fallback) as `initial_frame`/`end_frame`, a character on `t2v` or `i2v`, and a character id missing its display name return the exit-36-equivalent envelope (an uncatalogued/unusable UUID or a non-path string such as `@Name` returns 400 before dispatch); `r2v` takes named characters with or without local `reference_images`. An explicit id's display name can come from its `reference_entity_names` entry or a matching `@Name` in the prompt ([#723](https://github.com/ffroliva/gflow-cli/issues/723)). `initial_frame`, `end_frame`, and `reference_images` each accept **either a local file path or the Flow image UUID of a generated asset** — pass a generated image's id straight in to chain image→video, and gflow attaches it for you. Since v0.58.0 (#529) the CLI and MCP surfaces are unified for i2v frames: the UUID keeps its identity and is enriched with the catalog's recorded display name plus an integrity-verified local fallback, so both transports prefer **selecting the exact asset in the project's media picker** (no duplicate upload). On `labs.google`, a missing tile falls back to re-uploading the recorded local file only if its byte count/SHA-256 still match; on `flow.google.com` (#1542), there is no local-file upload fallback — a missing or unrendered same-project tile reloads the grid up to ~90 s (plus at most one reload cycle) and fails with the exit-32-equivalent envelope. A UUID that isn't in your local asset catalog is rejected up front with a clear "Reference Not Found" error; a catalogued asset with neither a display name nor a verified local file gives a "Reference Not Usable" error (re-generate it or pass a local path). A video clip, or the media UUID of a catalogued clip, in `reference_images` returns a 400 naming `gflow_edit_video`, which edits a local clip with reference images ([#1540](https://github.com/ffroliva/gflow-cli/issues/1540)). For `r2v`, MCP resolves a catalogued image UUID to a verified local file before queuing the job. The flow.google.com driver receives the file for upload. A UUID without a local copy cannot be used this way. `ui_mode` selects the Flow UI arm (#299 PR-A, mirroring CLI `--ui-mode`) and **applies to every mode of this tool, including `r2v`** — unlike the CLI, where `video r2v`/`chain` have no flag and follow the env-only path. On labs and the classic migrated composer, video generation has **only a classic driver**, so `auto` ≡ `classic`: both verify the classic editor pre-submit and abort before spending credits if it is unreachable. `ui_mode="agentic"` is rejected with a 400 problem-details envelope, because no agentic video driver exists yet. (An agent-only migrated composer is routed before this check: text-to-video runs through its chat agent under `ui_mode` `auto` or `classic` — `"agentic"` is still rejected with the 400 above, before any browser work — and other video forms return the exit-36-equivalent envelope before anything is clicked.) Values are matched case-insensitively. (MCP tools return envelopes, never process exit codes — the CLI equivalents of these aborts are exit 28 and exit 2 respectively.) See [CONFIGURATION § GFLOW_CLI_UI_MODE](CONFIGURATION.md#gflow_cli_ui_mode). On a model Flow is retiring, the reply (the `wait=true` result and the queued task's `tasks/get` result alike) also carries `"warnings": [{"type": "model_retiring", "model": "", "retires_on": ""}]` ([#1375](https://github.com/ffroliva/gflow-cli/issues/1375)); the job still runs, and once Flow's menu stops offering the model it fails before submit, charged nothing. * `gflow_edit_video(source, prompt, reference_images, model, aspect, resolution, max_credits, tools, profile, project, project_name, out_file, wait)`: Edits a local video file (`.mp4`/`.m4v`/`.mov`/`.3gp`/`.avi`, up to 1 GB) or an existing Flow clip media UUID on `flow.google.com` (`jIps6`, Omni models only, default `omni-1.2`, single-clip output) with `0–5` optional `reference_images` (local paths or catalog image UUIDs resolved to local files) for a local source file. With a media UUID source, `reference_images` are refused before the queue (exit 11, `charged: no`): references are not ported to editing an existing clip yet; download the clip with `gflow data download MEDIA_ID --out DIR` and pass the file. `max_credits` enforces Flow's pre-submit credit quote (refusing missing or over-cap quotes at zero spend). Local files support optional `aspect` (`16:9`/`9:16`) and `resolution` (`360p`/`720p`); existing Flow media UUIDs need a project (`project`, else the catalog's record, else `GFLOW_CLI_PROJECT`, the CLI's resolution) and keep source aspect at `720p`. The worker refuses a missing or unsupported file (exit 11), `GFLOW_CLI_FLOW_HOST=labs.google` (exit 36) and a mistyped queued payload (`QueueSchemaError`, exit 30) before it creates a project, all `charged: no`. `out_file` must stay inside the configured output directory. Gated by `--no-spend` with the other credit-spending tools. @@ -143,7 +143,7 @@ is [BROWSER_MODES](BROWSER_MODES.md). > different axis entirely: it buys a *look*, not an identity. For `r2v`, supply `reference_images` or `reference_entities` alongside a prompt mention. Use > `gflow_character_list` to discover ids and display names on `flow.google.com`. On that host, > each id needs its display name in `reference_entity_names` or a matching `@Name` in the prompt. -> An id with neither is exit 36. See [REFERENCE_STRATEGIES](REFERENCE_STRATEGIES.md). +> An id with neither is exit 36. See [REFERENCE_STRATEGIES](https://github.com/ffroliva/gflow-cli/blob/main/docs/REFERENCE_STRATEGIES.md). > **`wait` and long generations ([#481](https://github.com/ffroliva/gflow-cli/issues/481), [#1097](https://github.com/ffroliva/gflow-cli/issues/1097)).** > Both generation tools take `wait` (default `true`), and its schema description in @@ -688,7 +688,7 @@ retried by the SDK. These requests are counted in telemetry under the client nam > surface are built as internal foundation but are **not yet wired into** > `gflow serve` — it currently runs the MCP server (Streamable HTTP or SSE) and the > OpenAI-compatible image route above. See the -> [CHANGELOG](../CHANGELOG.md) for the roadmap. +> [CHANGELOG](https://github.com/ffroliva/gflow-cli/blob/main/CHANGELOG.md) for the roadmap. > **Settings reach the server through its environment, not your shell's `.env`.** An MCP > client starts `gflow mcp run` in a directory of its own choosing, so a `.env` beside your diff --git a/website/docs/MEDIA_LIBRARY.md b/website/docs/MEDIA_LIBRARY.md index 21f55b2d9..4c289ca1e 100644 --- a/website/docs/MEDIA_LIBRARY.md +++ b/website/docs/MEDIA_LIBRARY.md @@ -4,7 +4,7 @@ > gflow-cli has hit driving it. All claims here are reverse-engineered from > live recon (2026-08-15/16, evidence in [#529](https://github.com/ffroliva/gflow-cli/issues/529) > / [#543](https://github.com/ffroliva/gflow-cli/issues/543) and the -> [#529 picker spike](superpowers/spikes/2026-08-15-picker-tile-alt-text.md)); +> [#529 picker spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-08-15-picker-tile-alt-text.md)); > Google documents none of it publicly and may change any of it without notice. ## Why this doc exists @@ -106,7 +106,7 @@ Freshness is layered, cheapest-first: budget. This heals the run on every surface (CLI, MCP, `gflow run`); the catalog write still needs the CLI's resolver (`store` mode only). Reach is what the empty picker lists: 15 of 21 assets in the measured project - ([spike](superpowers/spikes/2026-11-12-migrated-listing-captions.md)). + ([spike](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-12-migrated-listing-captions.md)). 3. **Bulk reconciliation** — `gflow data sync --names` ([#543](https://github.com/ffroliva/gflow-cli/issues/543), shipped) for cold catalogs and ghost detection; `gflow doctor` @@ -189,7 +189,7 @@ surfaces that support character entities (the tab set varies by mode), and a - **Reference resolution** (v0.58.0, #529): `catalog UUID → display name → picker search → exact-UUID tile → attach`, falling back to a verified local upload, else a typed error. See - [REFERENCE_STRATEGIES.md](REFERENCE_STRATEGIES.md). + [REFERENCE_STRATEGIES.md](https://github.com/ffroliva/gflow-cli/blob/main/docs/REFERENCE_STRATEGIES.md). - **Shipped**: `gflow doctor` ([#542](https://github.com/ffroliva/gflow-cli/issues/542)) reports nameless/ghost rows; `gflow data sync --names` ([#543](https://github.com/ffroliva/gflow-cli/issues/543)) reconciles the diff --git a/website/docs/MOVIE.md b/website/docs/MOVIE.md index 71ed385de..05ccf6e53 100644 --- a/website/docs/MOVIE.md +++ b/website/docs/MOVIE.md @@ -304,12 +304,12 @@ Scenes then name the costume state, and continuity is a lookup rather than a hop **The full identity resolution ladder** — entity, then the entity's own plate, then a plate cut from a take, then prose canon, with the rule that descending a rung is recorded next to the shot — lives in -[`skills/video-production/SKILL.md`](../skills/video-production/SKILL.md) step 4a. Read it +[`skills/video-production/SKILL.md`](https://github.com/ffroliva/gflow-cli/blob/main/skills/video-production/SKILL.md) step 4a. Read it before planning a multi-shot piece; a manifest that silently lands on the bottom rung produces a different actor in every scene. See [CHARACTER.md](CHARACTER.md) for the underlying entity model and -[CHARACTER_RECON.md](CHARACTER_RECON.md) for the reverse-engineered wire +[CHARACTER_RECON.md](https://github.com/ffroliva/gflow-cli/blob/main/docs/CHARACTER_RECON.md) for the reverse-engineered wire protocol. ## Scene instructions (project brief cards) diff --git a/website/docs/PROMPT_EXPANSION.md b/website/docs/PROMPT_EXPANSION.md index b6ad03d7a..bc4521d30 100644 --- a/website/docs/PROMPT_EXPANSION.md +++ b/website/docs/PROMPT_EXPANSION.md @@ -40,7 +40,7 @@ Without `GFLOW_CLI_LLM_API_KEY` (or `GFLOW_CLI_LLM_BASE_URL`) the tool leaves yo | **Expansion** | `ExpansionResult(original, expanded, was_expanded)` | The result; `expanded == original` when nothing changed. | | **Provenance** | `AppliedTool(name, version, model, config_hash, params)` | Recorded in history when a tool rewrote a prompt. | -The tool itself lives in [`src/gflow_cli/tools/`](../src/gflow_cli/tools/): `spec.py` (schema), +The tool itself lives in [`src/gflow_cli/tools/`](https://github.com/ffroliva/gflow-cli/tree/main/src/gflow_cli/tools): `spec.py` (schema), `runtime.py` (`apply_tool`), `expander.py` (the provider-agnostic `PromptExpander`), `banned.py` (keyword stripping), `invocation.py` (provenance + MCP adapter). @@ -74,7 +74,7 @@ The instruction also carries "Critical Rules": name real cameras/brands, include use prestigious context anchors ("Vanity Fair editorial", "National Geographic cover"), use ALL CAPS for hard constraints, "prominently displayed" for products, and **never** emit banned keywords. The full text is the `system_template` in -[`creative-director.toml`](../src/gflow_cli/tools/builtin/creative-director.toml). +[`creative-director.toml`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/tools/builtin/creative-director.toml). --- @@ -112,7 +112,7 @@ with different vocabularies. | `abstract` | Particle/fluid sims, smoke/ink textures, gradient-shift color, VJ aesthetic. | An **unknown** style is ignored with a `tool_unknown_style` warning — never an error. Full -vocabularies live in [`creative-director.toml`](../src/gflow_cli/tools/builtin/creative-director.toml); +vocabularies live in [`creative-director.toml`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/tools/builtin/creative-director.toml); `gflow tools show creative-director` lists the current set. --- @@ -142,7 +142,7 @@ prompt the tool left unchanged is never altered. ## 6. Never-fatal contract -The `PromptExpander` ([`expander.py`](../src/gflow_cli/tools/expander.py)) is +The `PromptExpander` ([`expander.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/tools/expander.py)) is stdlib-only (`urllib`) and bounded. `expand()` returns the original prompt with `was_expanded=False` in every degraded case. Generation `--tool` calls warn and continue; `gflow tools run` returns a typed error on this result: @@ -193,7 +193,7 @@ reference and worked examples (Google, OpenRouter, a local Docker proxy, keyless ## 8. Provenance — what history records When a tool rewrites a prompt, the generation is recorded with full provenance -([`data/_recorder_core.py`](../src/gflow_cli/data/_recorder_core.py), `_tool_metadata`): +([`data/_recorder_core.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/data/_recorder_core.py), `_tool_metadata`): - **`prompt`** column = the user's **original** prompt. - **`expanded_prompt`** column = the **submitted** (rewritten) prompt. @@ -219,7 +219,7 @@ a recording failure warns and returns exit 0 — never a non-zero exit after a p ## 9. Relationship to the `expand_prompt` MCP prompt The MCP server also exposes an older, now-**deprecated** **prompt template** named `expand_prompt` -([`mcp/prompts.py`](../src/gflow_cli/mcp/prompts.py)). It predates the tools framework and overlaps +([`mcp/prompts.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/mcp/prompts.py)). It predates the tools framework and overlaps functionally with `creative-director`, but they are **different surfaces**: | | `expand_prompt` (MCP prompt) | `creative-director` (tool) | diff --git a/website/docs/SECURITY.md b/website/docs/SECURITY.md index 79a42b900..1155a7a4a 100644 --- a/website/docs/SECURITY.md +++ b/website/docs/SECURITY.md @@ -259,7 +259,7 @@ If a profile dir or `.env` containing real secrets ever lands in a Git repo: ## `.gitignore` rules in this repo -The repository's [`.gitignore`](../.gitignore) excludes: +The repository's [`.gitignore`](https://github.com/ffroliva/gflow-cli/blob/main/.gitignore) excludes: ``` auth/ # any project-local auth dir @@ -343,6 +343,6 @@ None to date. This section will list public CVEs, advisories, and patched versio ## See also -- [DISCLAIMER](../DISCLAIMER.md) — legal scope & takedown policy +- [DISCLAIMER](https://github.com/ffroliva/gflow-cli/blob/main/DISCLAIMER.md) — legal scope & takedown policy - [AUTHENTICATION](AUTHENTICATION.md) — full auth lifecycle - [CONFIGURATION](CONFIGURATION.md) — secret-bearing env vars diff --git a/website/docs/TOOLS.md b/website/docs/TOOLS.md index d3c43c369..98031f53c 100644 --- a/website/docs/TOOLS.md +++ b/website/docs/TOOLS.md @@ -26,7 +26,7 @@ A tool is invoked uniformly in two ways: Tools are **pure prompt transforms** today: they read a prompt and return a (possibly rewritten) prompt. The richer `Tool.apply(ctx) → outcome` dispatch framework (workflow tools beyond prompt rewriting) is a deferred design — see -[the tool-abstraction evaluation](superpowers/research/2026-06-27-tool-abstraction-evaluation.md). +[the tool-abstraction evaluation](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/research/2026-06-27-tool-abstraction-evaluation.md). ### Lineage @@ -195,7 +195,7 @@ without collision — e.g. `creative-director` has both a `product` *image* styl ## 5. The TOML schema A tool is a single TOML file validated into a Pydantic `ToolSpec` -([`src/gflow_cli/tools/spec.py`](../src/gflow_cli/tools/spec.py)). All models are **frozen** +([`src/gflow_cli/tools/spec.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/tools/spec.py)). All models are **frozen** (immutable after load). ### Top-level (`ToolSpec`) @@ -235,7 +235,7 @@ A tool is a single TOML file validated into a Pydantic `ToolSpec` ## 6. How a tool is applied (runtime contract) -[`src/gflow_cli/tools/runtime.py`](../src/gflow_cli/tools/runtime.py): +[`src/gflow_cli/tools/runtime.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/tools/runtime.py): 1. **`build_instruction(config, style, category, *, panels=None)`** — starts from `config.system_template`, appends the bare label `Target medium: image.` or `Target medium: video.` when a category is @@ -264,8 +264,8 @@ generation. `gflow tools run` reports a typed error because expansion is its onl 1. Write `src/gflow_cli/tools/builtin/.toml` following the schema in §5. 2. That's it — the loader auto-discovers every `*.toml` in the `builtin/` package via `importlib.resources` at startup - ([`loader.py`](../src/gflow_cli/tools/loader.py)), validates it into a `ToolSpec`, and the - registry ([`registry.py`](../src/gflow_cli/tools/registry.py)) exposes it under `spec.name`. + ([`loader.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/tools/loader.py)), validates it into a `ToolSpec`, and the + registry ([`registry.py`](https://github.com/ffroliva/gflow-cli/blob/main/src/gflow_cli/tools/registry.py)) exposes it under `spec.name`. Invalid TOML or a schema violation **fails loud** (`ConfigurationError`) the first time any `tools` / `--tool` path runs. 3. Bump the tool's `version` whenever you change behavior; the `config_hash` (a SHA-256 of the @@ -296,7 +296,7 @@ analogue of Flow's Tools menu.) ## 8. MCP exposure Per AGENTS.md §61 (CLI ↔ MCP parity), the tools surface is mirrored on the MCP server -([`src/gflow_cli/mcp/`](../src/gflow_cli/mcp/)): +([`src/gflow_cli/mcp/`](https://github.com/ffroliva/gflow-cli/tree/main/src/gflow_cli/mcp)): - **`gflow_list_tools`** — mirrors `gflow tools list`; returns `[{name, title, description, category}, …]`. @@ -330,5 +330,5 @@ for the full comparison and migration guidance. - [CONFIGURATION.md](CONFIGURATION.md) — `GFLOW_CLI_LLM_BASE_URL` / `_API_KEY` / `_MODEL`. - [DATA_LAYER.md](DATA_LAYER.md) — how `expanded_prompt` and `metadata_json.tool` are recorded. - [MCP.md](MCP.md) — the MCP server. -- [tool-abstraction evaluation](superpowers/research/2026-06-27-tool-abstraction-evaluation.md) — +- [tool-abstraction evaluation](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/research/2026-06-27-tool-abstraction-evaluation.md) — the deferred S3 dispatch-framework design. diff --git a/website/docs/USAGE.md b/website/docs/USAGE.md index e88b408fb..ce9fb105b 100644 --- a/website/docs/USAGE.md +++ b/website/docs/USAGE.md @@ -143,7 +143,7 @@ back. `--search "r2v duration"` narrows that to a handful with the host-specific at the top. Curated answers rank first: the `**"How do I …?"** →` rows in -[INDEX](INDEX.md#topic-shortcuts) were each written to *be* an answer, so they come above +[INDEX](https://github.com/ffroliva/gflow-cli/blob/main/docs/INDEX.md#topic-shortcuts) were each written to *be* an answer, so they come above raw body-text matches for the same term. Piping works — the page is emitted as its own Markdown, not as rendered boxes: @@ -481,7 +481,7 @@ Notes: - **flow.google.com only.** There is no labs.google route; `GFLOW_CLI_FLOW_HOST=labs.google` refuses the command with exit 36. - **Cost:** the 1080p export was measured free (1 observation, 2026-10-07), as were the 720p - export and the 270p GIF ([2026-11-29](superpowers/spikes/2026-11-29-export-billing-720p-270p.md)); the 4K export on Flow Ultra spends credits (measured 50 credits on Omni 1.2 Flash, 2026-11-23). + export and the 270p GIF ([2026-11-29](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-11-29-export-billing-720p-270p.md)); the 4K export on Flow Ultra spends credits (measured 50 credits on Omni 1.2 Flash, 2026-11-23). - Saved as `/videos//_.` (`.mp4` or `.gif`). ## `gflow image generate` / `gflow video generate` @@ -872,7 +872,7 @@ entities (it carries start/end frames instead). `--ref` is different: it attaches an arbitrary **image** (`referenceImages`), not a saved identity, and can be combined with a `@Name` for "this identity, in this look". -See [REFERENCE_STRATEGIES.md](REFERENCE_STRATEGIES.md) for the full decision guide. +See [REFERENCE_STRATEGIES.md](https://github.com/ffroliva/gflow-cli/blob/main/docs/REFERENCE_STRATEGIES.md) for the full decision guide. ## `gflow image batch` @@ -886,7 +886,7 @@ Tab-separated columns. Only `prompt` is required; remaining columns fall back to promptcountaspect_ratiomodel ``` -Lines starting with `#` and blank lines are skipped. Example: [`test_assets/sample_batch.tsv`](../test_assets/sample_batch.tsv). +Lines starting with `#` and blank lines are skipped. Example: [`test_assets/sample_batch.tsv`](https://github.com/ffroliva/gflow-cli/blob/main/test_assets/sample_batch.tsv). ```tsv a small calico kitten sitting on a windowsill @@ -908,7 +908,7 @@ an isometric pixel-art bakery 1 1:1 nano2 ] ``` -Example: [`test_assets/sample_batch.json`](../test_assets/sample_batch.json). +Example: [`test_assets/sample_batch.json`](https://github.com/ffroliva/gflow-cli/blob/main/test_assets/sample_batch.json). ### Session behaviour @@ -923,7 +923,7 @@ All prompts in a batch share one Flow project. The editor is opened once and sta - `MAX_BATCH_PROMPTS = 5` (defined in `src/gflow_cli/image_batch.py`). To raise, edit the constant. -### Exit codes +### Batch exit codes - `0` — all rows succeeded. - `1` — invalid manifest (file not found, parse error, unknown aspect/model). @@ -1049,7 +1049,7 @@ Options: > are not ported to the migrated composer yet; `r2v` takes a character with > `--reference-entity` paired with `--reference-entity-name` (#723). `image t2i` and local-file `image i2i` also run on a moved > account, and on images a character can be tagged with `@Name` or `--reference-entity` -> (see [REFERENCE_STRATEGIES § flow.google.com](REFERENCE_STRATEGIES.md#on-flowgooglecom-images-and-video-r2v-723)). An image `--ref ` is referenced in place, with no upload, when the +> (see [REFERENCE_STRATEGIES § flow.google.com](https://github.com/ffroliva/gflow-cli/blob/main/docs/REFERENCE_STRATEGIES.md#on-flowgooglecom-images-and-video-r2v-723)). An image `--ref ` is referenced in place, with no upload, when the > local catalog records that image in the same `--project` and keeps its Flow caption > ([#995](https://github.com/ffroliva/gflow-cli/issues/995)); any other UUID, and instruction/Imagen-4 > image forms, still exit 36. `flow.google.com` forces the migrated composer, @@ -1085,7 +1085,7 @@ the editor's frame slot via the media dialog, then Flow fires > - **Default shape (direct HTTP, since v0.108.0):** a local `--initial-frame` at 9:16 with > the default Veo 3.1 Lite model and no `--duration`, `--resolution`, `--end-frame`, or > `--max-credits` uploads the frame and submits over direct HTTP with a headless browser -> ([DIRECT_TRANSPORT](DIRECT_TRANSPORT.md)). +> ([DIRECT_TRANSPORT](https://github.com/ffroliva/gflow-cli/blob/main/docs/DIRECT_TRANSPORT.md)). > - **Local files (UI route):** other local start-frame shapes and local `--end-frame` > interpolation upload the file through the editor's own Upload entry (it stays in the > project's library like any upload — a second run uploads it again), find it in the Frames @@ -1142,7 +1142,7 @@ gflow video i2v ./hero.png "Slow camera arc, soft golden light" Local frame files follow the [`gflow image upload`](#gflow-image-upload) rules (header check, 20 MB cap), and a UUID must be catalogued in the same `--project` (exit 36 otherwise, see -[exit codes](#exit-codes-1)). Start+end submits were measured with Veo 3.1 Fast and Lite, and with +[exit codes](#exit-codes)). Start+end submits were measured with Veo 3.1 Fast and Lite, and with Omni 1.2 (which accepts at most 10 s with an end frame); Veo 3.1 Quality uses the same key family as Fast but was not run live (#1594). Whether the two frames must share an aspect ratio has not been measured (#1603). @@ -3167,7 +3167,7 @@ The table below is the default (legacy) set. `GFLOW_CLI_EXIT_CODES=2` opts in to | `28` | `UiModeUnavailableError` | The Flow UI arm this command required (`--ui-mode`/`GFLOW_CLI_UI_MODE`; `-i` forces agentic for images; **labs video always requires classic** — no agentic labs video driver exists; an agent-only `flow.google.com` composer ([#799](https://github.com/ffroliva/gflow-cli/issues/799)) is routed before this policy and never exits 28) couldn't be reached after a switch attempt; aborted before submitting — no credits spent (issue #299) | Retry (the cohort flaps per load); try another `--profile`; for images you can also relax `GFLOW_CLI_UI_MODE` — for video there is nothing to relax | | `29` | `MentionIndexUnavailableError` | An `@mention` was present but the catalog source needed to resolve it (character entities or media assets) failed to load — distinct from an empty index, which is not an error. Also raised on a page served labs for an image character known only by name (#723), since that picker attaches by entity id | Check network connectivity (character source) or `GFLOW_CLI_DB_PATH` / filesystem permissions (media source), then retry. For the by-name character on labs, pass `--reference-entity ` | | `30` | `QueueSchemaError` | A `gflow serve`/MCP worker-queue task payload has an unrecognized `schema_version` or fails validation against the typed request DTOs | Usually means gflow-cli was downgraded after a newer version enqueued the task, or the payload was hand-edited; re-enqueue with a compatible version | -| `31` | `FlowAppError` | Flow did not serve the page gflow asked for. Two shapes: its error-boundary page rendered instead of the editor (a transient client-side crash), or it redirected to `flow.google.com/about` instead of the project ([#756](https://github.com/ffroliva/gflow-cli/issues/756)) | Crash: retry shortly; if it persists, Flow itself is degraded. `/about`: run `gflow auth login --profile ` and finish Google's "Confirm it's you" if it asks; then open the project in a browser on that host and confirm this account can reach it. A retry is **measured** not to help — 5/5 consecutive attempts during a live occurrence landed on `/about` again ([2026-09-11](superpowers/spikes/2026-09-11-about-redirect-is-stable-for-an-account.md); the [2026-09-10 run](superpowers/spikes/2026-09-10-about-redirect-stability.md) got 0/5 only because the redirect had stopped reproducing) — so gflow does not flag it retryable. One cause is measured since: Google wanted the account to "Confirm it's you" while its cookies were healthy ([2026-09-23](https://github.com/ffroliva/gflow-cli/blob/develop/docs/superpowers/spikes/2026-09-23-about-cta-leads-to-google-reauth.md)); `gflow auth login` waits on that check ([#902](https://github.com/ffroliva/gflow-cli/issues/902)) | +| `31` | `FlowAppError` | Flow did not serve the page gflow asked for. Two shapes: its error-boundary page rendered instead of the editor (a transient client-side crash), or it redirected to `flow.google.com/about` instead of the project ([#756](https://github.com/ffroliva/gflow-cli/issues/756)) | Crash: retry shortly; if it persists, Flow itself is degraded. `/about`: run `gflow auth login --profile ` and finish Google's "Confirm it's you" if it asks; then open the project in a browser on that host and confirm this account can reach it. A retry is **measured** not to help — 5/5 consecutive attempts during a live occurrence landed on `/about` again ([2026-09-11](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-09-11-about-redirect-is-stable-for-an-account.md); the [2026-09-10 run](https://github.com/ffroliva/gflow-cli/blob/main/docs/superpowers/spikes/2026-09-10-about-redirect-stability.md) got 0/5 only because the redirect had stopped reproducing) — so gflow does not flag it retryable. One cause is measured since: Google wanted the account to "Confirm it's you" while its cookies were healthy ([2026-09-23](https://github.com/ffroliva/gflow-cli/blob/develop/docs/superpowers/spikes/2026-09-23-about-cta-leads-to-google-reauth.md)); `gflow auth login` waits on that check ([#902](https://github.com/ffroliva/gflow-cli/issues/902)) | | `32` | `ReferenceNotFoundError` | A referenced media NAME is not in this project's picker. Flow indexes a short auto-caption, not the generation prompt, so a prompt used as a reference name never matches. On flow.google.com this includes an unmatched `@Name` when the catalog is available. For an image character (#723) it is also raised when no picker option is titled exactly the name, several are, or the match is media; after up to ~90 s of reloads, for a catalogued same-`--project` UUID ref (`image i2i --ref`, #995, or `video i2v` Start/End frame, #1542) whose image is no longer in the project grid (deleted in Flow); and when an `@` reference attaches out of order, landing before a chip already in the prompt (#997); and when a local `--ref` upload does not become the `@` picker's active row within 8 s, or the new chip is not that upload (`video extend`, `video r2v`, and the `image i2i` fallback, [#1581](https://github.com/ffroliva/gflow-cli/issues/1581)), before anything is submitted | Reference the asset by its media UUID (if Flow deleted it, regenerate it or pass its local file), pass a local file with `--ref`, or check what exists with `gflow data list images`. For a character the picker never offers (#1333), check the name with `gflow character list --project `; when several options or a media asset share the name, rename the colliding asset in Flow, or give the character a unique one-word name. Out of order: re-run; if it repeats, report it with the reference count and window size | | `33` | — (`gflow doctor` verdict) | Doctor found warn/fail findings — a successful diagnosis, not an error class | Review the report; see [`gflow doctor`](#gflow-doctor) | | `34` | `SyncPartialError` | `gflow data sync` failed on some projects but succeeded on others — completed writes stay committed | Retryable: re-run the same command; it resumes with what is still nameless (see [`gflow data sync`](#gflow-data-sync)) | @@ -3320,5 +3320,5 @@ async with FlowApiClient(profile_dir=profile_dir) as client: - [AUTHENTICATION](AUTHENTICATION.md) — auth flow + multi-account - [ARCHITECTURE](ARCHITECTURE.md) — internal structure (for contributors) - [TELEMETRY](TELEMETRY.md) — local weekly usage metrics, telemetry.db, and kill switches -- [PLAN](../PLAN.md) — what ships in which phase +- [PLAN](https://github.com/ffroliva/gflow-cli/blob/main/PLAN.md) — what ships in which phase