Skip to content

feat: vk create --mode replica|script (+aspect/bgm) for 0.4.2#2

Merged
voidkey merged 14 commits into
mainfrom
feature/video-kinds
May 14, 2026
Merged

feat: vk create --mode replica|script (+aspect/bgm) for 0.4.2#2
voidkey merged 14 commits into
mainfrom
feature/video-kinds

Conversation

@voidkey
Copy link
Copy Markdown
Collaborator

@voidkey voidkey commented May 14, 2026

Summary

Unlocks two go-figlens video modes that the CLI couldn't reach, behind a single vk create --mode flag:

  • --mode replica — PPT/PDF page-by-page reproduction (doc_replica_plan / doc_replica_shoot pipeline).
  • --mode script — verbatim-script narration ("讲稿锁定"). Backend preflight at /v1/tasks/init decides whether the doc is suitable; rejection exits 2 with the backend's localized message (not a generic "business error").
  • Companion --aspect horizontal|vertical (with 16:9 / 9:16 aliases) and --bgm flags wired through the same client structs.
  • Restores SSE progress visibility for replica-mode nodes — the stage map was filtering them out as "unknown" nodes before this PR.

Default invocation (no --mode, no --aspect, no --bgm) produces byte-identical wire bodies to 0.4.1.

Spec: docs/superpowers/specs/2026-05-14-video-kinds-design.md
Plan: docs/superpowers/plans/2026-05-14-video-kinds.md

What's in the diff

  • client/figlens/{optimize,stream,task}.go — thread video_kind (+ aspect, bgm_enabled) through three SSE/HTTP endpoints; StreamEvent gains a typed Code field so callers don't parse error labels out of the message string.
  • cmd/create.go--mode / --aspect / --bgm flag registration, resolver helpers with table tests, kbID/docID promoted to InitTask payload for script mode, exit-2 routing on both the InitTask HTTP path and the SSE task.failed path.
  • internal/stage/stage.go — map doc_replica_planoutline and doc_replica_shootrender so replica-mode SSE events aren't filtered.
  • internal/httpclient/errors.go — extract MapBusinessCode(envCode) shared between SSE and HTTP error paths so new backend business codes only need one edit site.
  • internal/i18n/strings.go — six new keys, both en and zh.
  • tests/integration/create_mode_test.go — end-to-end test asserting wire body + SSE node visibility.
  • CHANGELOG.md, AGENTS.md, README{,.zh}.md — documentation for the new flags.
  • package.json + skills/*/SKILL.md — version bump to 0.5.0.

14 commits, all green.

Test plan

  • go test ./... passes (incl. integration test at ~83s)
  • go build ./... clean
  • vk create --help shows the three new flags
  • vk version prints v0.5.0
  • Default vk create --from <src> wire body unchanged (covered by Omits* unit tests on each client call)
  • --mode replica reaches doc_replica_plan SSE event end-to-end (integration test)
  • Manual smoke against beta cluster with a real PPT + a real document (recommended before tagging the release)

voidkey added 14 commits May 14, 2026 14:09
Apply findings from /simplify review:

- client/figlens/stream.go: add typed Code field to StreamEvent so
  task.failed events carry the SSE envelope code as data, not stuffed
  into Message as a "[code] msg" string prefix. Eliminates the leaky
  cross-package string protocol the cmd package was parsing.
- internal/httpclient/errors.go: extract MapBusinessCode(envCode) as
  the single source of truth for 100xxx → label mappings; SSE and HTTP
  paths now both delegate, so a new business code only needs one edit.
- client/figlens/task.go: embed InitTaskParams in initTaskWire (was
  copy-pasted field-by-field); export VideoKindReplica /
  VideoKindScriptLock constants used by cmd/create.go.
- cmd/create.go: switch on ev.Code instead of string-prefix scanning
  ev.Message; collapse scriptInvalid+taskFailed booleans into a single
  failExitCode int; delete dead helpers (scriptInvalidPrefix,
  isScriptInvalidMessage, extractScriptInvalidUserMessage); trim
  resolver comments and the redundant invariant comment above the
  script_lock kbID/docID setup.
- tests/integration/create_mode_test.go: flush after each SSE event in
  the fastQueryOptimize mock, matching the stream handler pattern.

No behavior changes for users. All existing tests pass; the NDJSON
task.failed envelope now also carries a "code" field alongside
"message" (purely additive).
Re-cut this branch as a patch release. The next minor (0.5.0) is
reserved for engine selection (vk create --engine agent|pipeline),
which is a wider-surface change introducing a new SSE event type
(node.progress) and cross-flag validation. Video-kinds is comparatively
a "thread new flags through existing pipeline" patch and fits 0.4.2.

Source-of-truth flips:
- package.json
- skills/vibeknow-{core,create,doc}/SKILL.md
- CHANGELOG.md heading

Spec files (untracked docs/) reflect the new numbering separately.
@voidkey voidkey changed the title feat: vk create --mode replica|script (+aspect/bgm) for 0.5.0 feat: vk create --mode replica|script (+aspect/bgm) for 0.4.2 May 14, 2026
@voidkey voidkey merged commit e914d68 into main May 14, 2026
3 checks passed
@voidkey voidkey deleted the feature/video-kinds branch May 14, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant