Skip to content

feat(ui): add config-generator YAML preview serializer with copy panel - #4717

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
claytonlin1110:feat/config-generator-yaml-preview-2210
Jul 10, 2026
Merged

feat(ui): add config-generator YAML preview serializer with copy panel#4717
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
claytonlin1110:feat/config-generator-yaml-preview-2210

Conversation

@claytonlin1110

Copy link
Copy Markdown
Contributor

Summary

  • Adds formStateToYaml(state), a pure GeneratorFormState -> .gittensory.yml text serializer in apps/gittensory-ui/src/lib/config-generator-yaml.ts — the reviewable-output half of the config generator (feat(dashboard): design self-host review config generator #1683).
  • Key names and nesting (gate.aiReview.{combine, provider, model}) match the real manifest schema (packages/gittensory-engine/src/focus-manifest.ts's gateConfigToJson, the same shape already documented in this repo's own root .gittensory.yml under the commented-out aiReview: example) — no parallel schema.
  • Every field is optional and unset keys are omitted, so a fresh or partial form always serializes to valid YAML (verified down to the empty-state case).
  • Adds ConfigGeneratorYamlPreview, a read-only presentational component that renders the serialized YAML via the existing CodeBlock primitive (primitives.tsx:194), which already has a built-in copy-to-clipboard button — no changes needed to CodeBlock itself.
  • Scope note: this PR intentionally does not touch config-generator-panel.tsx, app.config-generator.tsx, app-shell.tsx, or command-palette.tsx — those are being built in the still-open PR feat(ui): config-generator AI provider mode field group (#2208) #4713 for sibling issue feat(ui): config-generator AI-provider-mode field group #2208, which defines the canonical GeneratorFormState/AiCombineStrategy/AiProvider types (apps/gittensory-ui/src/lib/config-generator-form-state.ts, not yet merged). I mirrored those exact type/field names locally so this PR is structurally compatible and low-conflict-risk regardless of merge order; once feat(ui): config-generator AI provider mode field group (#2208) #4713 lands, wiring <ConfigGeneratorYamlPreview> into ConfigGeneratorPanel is a one-line follow-up.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves — Closes feat(ui): config-generator YAML preview + copy panel #2210.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally (apps/** is Codecov-ignored — UI-only change, no patch-coverage obligation — but shipped 11 new tests anyway: full/partial/empty config, null-vs-unset, empty-string-vs-unset, and YAML-special-character/whitespace quoting for the serializer, plus rendering + empty-state tests for the preview component)
  • npm run test:workers
  • npm run build:mcp
  • npm run ui:openapi:check
  • npm run ui:openapi:settings-parity
  • npm run ui:version-audit
  • npm run docs:drift-check
  • npm run manifest:drift-check
  • npm run command-reference:check
  • npm run db:migrations:check
  • npm run db:schema-drift:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:test (133/133 passed across both UI workspaces)
  • npm run ui:build
  • npm audit --audit-level=moderate (0 vulnerabilities)

If any required check was skipped, explain why:

  • npm run test:mcp-pack and npm run cf-typegen:check fail locally only due to a pre-existing Windows dev-machine spawnSync bare-command resolution gap (ENOENT for npm/wrangler without shell: true), reproduced in isolation and unrelated to this diff — no packages/gittensory-mcp or wrangler.jsonc/Cloudflare-binding changes here.
  • npm run engine-parity:drift-check fails locally only because it falls back to my local (stale) fork origin/main ref absent GITHUB_BASE_SHA, which real CI sets. No src/signals/**/packages/gittensory-engine/** files are touched by this PR.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed — this is a pure client-side text formatter over form input the user themselves typed; no server/API involved.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics. (N/A surface.)
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. (N/A — no such changes.)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (N/A — no API/OpenAPI/MCP change; purely client-side serialization.)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks — this component is a pure, synchronous function of its formState prop (no fetch, no fallback data); the empty-state case is a real, tested branch (header-only output), not a demo placeholder.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs. (No changelog edit in this PR.)

UI Evidence

State / title Screenshot
Loaded state (populated gate.aiReview) Loaded state
combine/provider/model all set
Empty state Empty state
fresh/unset form state — header-only, still valid YAML

Notes

Closes JSONbored#2210

Adds formStateToYaml(state), a pure GeneratorFormState -> .gittensory.yml
text serializer in src/lib/, plus a read-only ConfigGeneratorYamlPreview
using the CodeBlock primitive's built-in copy button. Key names/nesting
match the real manifest schema (gate.aiReview), and unset fields are
omitted so partial/empty state always serializes to valid YAML.

Scoped to the serializer + preview slice only (per JSONbored#2210); it does not
touch the field-group panel/route/nav wiring being built separately in
the still-open PR for JSONbored#2208, to avoid overlapping that work.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@claytonlin1110
claytonlin1110 marked this pull request as draft July 10, 2026 18:51
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 10, 2026
@claytonlin1110
claytonlin1110 marked this pull request as ready for review July 10, 2026 18:52
@loopover-orb

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-10 18:56:00 UTC

4 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a small, self-contained pair of files — a pure formStateToYaml() serializer and a read-only ConfigGeneratorYamlPreview component — that mirror the gate.aiReview shape from focus-manifest.ts's gateConfigToJson without touching any existing generator wiring. The serializer correctly omits unset/null/empty-string fields, quotes special-character and whitespace-padded scalars via JSON.stringify, and the test suite (config-generator-yaml.test.ts, config-generator-yaml-preview.test.tsx) exercises the empty-state, partial-state, null-normalization, and quoting branches directly, so coverage on the changed logic looks solid. The component isn't wired into any page yet (explicitly deferred to sibling PR #4713 for the canonical GeneratorFormState producer), so this ships as unused-but-tested infrastructure rather than a user-visible feature.

Nits — 5 non-blocking
  • config-generator-yaml.ts's yamlScalar() regex doesn't cover every YAML-ambiguous leading character (e.g. a value starting with `- ` or `?`), so an edge-case model name could still serialize to technically-ambiguous YAML — not a real risk given today's field set, but worth a comment or broader check if free-text fields expand.
  • ConfigGeneratorYamlPreview isn't referenced by any route/panel yet (by design, pending feat(ui): config-generator AI provider mode field group (#2208) #4713), so this PR is best reviewed as infra-only; worth confirming the follow-up wiring PR is tracked so it doesn't silently rot as dead code.
  • CodeBlock's `code`/`filename` prop contract isn't visible in the provided diff/context, so its usage here can't be fully verified against the primitive's actual signature — likely fine given green CI, but flagging since it's outside what was shown.
  • Consider extracting the YAML-special-character regex in yamlScalar() into a named constant with a short comment listing which characters are covered, to make future additions (e.g. supporting more gate fields) easier to audit.
  • If feat(ui): config-generator AI provider mode field group (#2208) #4713's GeneratorFormState ends up structurally different from the locally mirrored type here, add a type-compatibility test or JSDoc pointer so the two don't silently diverge before the follow-up merge.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2210
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 461 registered-repo PR(s), 318 merged, 102 issue(s).
Contributor context ✅ Confirmed Gittensor contributor claytonlin1110; Gittensor profile; 461 PR(s), 102 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: claytonlin1110
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, TypeScript, Rust
  • Official Gittensor activity: 461 PR(s), 102 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before / after /
/ mobile before / (mobile) after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 6980891 into JSONbored:main Jul 10, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ui): config-generator YAML preview + copy panel

1 participant