Add safe piece creation and validated LLM generation #95

Merged
eleith merged 3 commits from feat/interactive-generation-core into main 2026-10-03 15:21:21 +00:00
Owner

Summary

Core groundwork for interactive LLM generation, plus CLI preflight validation. Web UI integration follows separately; the CLI remains quiet.

  • Add Piece.write(markdown, { createOnly: true }) using exclusive filesystem creation, so final creation cannot overwrite an existing piece. Ordinary Save still overwrites; asset preparation is not transactional.

  • Add separate Google metadata, field-value, and Markdown-body generation functions under llm/google/, preserving the existing final-metadata wrapper and package exports.

  • Use Gemini 3.8 Flash and SDK 2.24.0. Build small reference-free field response schemas with json-schema-traverse, already used by Ajv.

  • Report best-effort progress, return only completed validated results, bound file/output sizes and processing polling, and attempt cleanup of known provider files.

  • Use ordinary SDK requests and per-request timeouts. No token previews, caller cancellation, overall generation deadline, SQLite generation results, or archive writes during generation. Accepted work finishes despite observer failure.

  • Reject incompatible CLI assistant options before loading a piece or calling the provider. Keep the CLI quiet and preserve its existing output/create/update behavior.

Verification

Node v26.4.0, pnpm 11.2.2; rerun immediately before commit:

  • pnpm lint — pass
  • pnpm check — pass
  • pnpm test — pass
  • Core: 414 passing tests, 100% statements/branches/functions/lines
  • CLI: 88 passing tests, 100% statements/branches/functions/lines
  • pnpm build — pre-existing failure: web prebuild cannot find apps/web/config.yaml. This was recorded before the feature work; it is not a passing build gate. Core builds successfully.

Deferred manual verification

The owner explicitly approved committing the core work and deferring real-provider checks until the UI is connected. Provider completion, abandoned-observer behavior, temporary-file cleanup, and production proxy/ingress behavior remain unverified manually; no passing result is claimed here.

Follow-up / issue #94

Proposed issue direction: interactive generation with live progress, one completed validated result, browser-only review, explicit Create or cursor insertion, and no durable generation jobs or SQLite outputs. Accepted work finishes after disconnect; abandoned results are discarded and cleanup still runs.

This PR does not implement the new web UI/endpoint. CLI progress display was removed from scope; issue #94 itself is unchanged.

## Summary Core groundwork for interactive LLM generation, plus CLI preflight validation. Web UI integration follows separately; the CLI remains quiet. - Add `Piece.write(markdown, { createOnly: true })` using exclusive filesystem creation, so final creation cannot overwrite an existing piece. Ordinary Save still overwrites; asset preparation is not transactional. - Add separate Google metadata, field-value, and Markdown-body generation functions under `llm/google/`, preserving the existing final-metadata wrapper and package exports. - Use Gemini 3.8 Flash and SDK 2.24.0. Build small reference-free field response schemas with `json-schema-traverse`, already used by Ajv. - Report best-effort progress, return only completed validated results, bound file/output sizes and processing polling, and attempt cleanup of known provider files. - Use ordinary SDK requests and per-request timeouts. No token previews, caller cancellation, overall generation deadline, SQLite generation results, or archive writes during generation. Accepted work finishes despite observer failure. - Reject incompatible CLI assistant options before loading a piece or calling the provider. Keep the CLI quiet and preserve its existing output/create/update behavior. ## Verification Node **v26.4.0**, pnpm **11.2.2**; rerun immediately before commit: - `pnpm lint` — pass - `pnpm check` — pass - `pnpm test` — pass - Core: **414 passing tests**, **100%** statements/branches/functions/lines - CLI: **88 passing tests**, **100%** statements/branches/functions/lines - `pnpm build` — **pre-existing failure**: web prebuild cannot find `apps/web/config.yaml`. This was recorded before the feature work; it is not a passing build gate. Core builds successfully. ## Deferred manual verification The owner explicitly approved committing the core work and deferring real-provider checks until the UI is connected. Provider completion, abandoned-observer behavior, temporary-file cleanup, and production proxy/ingress behavior remain unverified manually; no passing result is claimed here. ## Follow-up / issue #94 Proposed issue direction: interactive generation with live progress, one completed validated result, browser-only review, explicit Create or cursor insertion, and no durable generation jobs or SQLite outputs. Accepted work finishes after disconnect; abandoned results are discarded and cleanup still runs. This PR does not implement the new web UI/endpoint. CLI progress display was removed from scope; issue #94 itself is unchanged.
eleith added 2 commits 2026-10-01 15:30:14 +00:00
Add write(markdown, { createOnly: true }) backed by exclusive filesystem creation. Preserve ordinary overwrite behavior and validate and serialize before writing. Update storage mocks, unit tests, and API documentation.

Verified with Node v26.4.0 and pnpm 11.2.2: pnpm lint, pnpm check, and pnpm test pass. Core has 330 passing tests; coverage remains 100% statements/lines/functions and 99.84% branches.

Known baseline failure, also reproduced before changes at b57b93bc: pnpm build fails in @luzzle/web prebuild because apps/web/config.yaml is missing. Core builds successfully; the repository build gate is not passing.

Per owner review, use an optional write argument rather than writeNew and retain mocked unit coverage instead of the proposed real-filesystem integration suite.
[core] add validated generation with progress
ci/woodpecker/pr/cli Pipeline was successful
ci/woodpecker/pr/core Pipeline was successful
ci/woodpecker/pr/web-db Pipeline was successful
ci/woodpecker/pr/web-jobs Pipeline was successful
ci/woodpecker/pr/web-pieces Pipeline was successful
ci/woodpecker/pr/web-worker Pipeline was successful
ci/woodpecker/pr/web Pipeline was successful
8eb6435045
Add Google-specific metadata, field, and body generation entry points with shared SDK request handling. Preserve the final-metadata compatibility wrapper, use Gemini 3.8 Flash with SDK 2.24.0, and build reference-free partial schemas using json-schema-traverse.

Report progress without token previews. Finish accepted work despite observer failure, enforce file/output budgets and bounded processing polling, and attempt cleanup of known provider files using SDK request timeouts. No caller cancellation, overall deadline, or archive writes during generation.

Verified on Node v26.4.0 and pnpm 11.2.2: pnpm lint, pnpm check, and pnpm test pass. Core has 414 passing tests and 100% coverage across statements, branches, functions, and lines.

Known baseline failure, present before this work: pnpm build stops in @luzzle/web prebuild because apps/web/config.yaml is missing. Core builds successfully; the repository build gate is not passing.

Owner explicitly approved deferring real-provider manual verification until the UI is connected. Completion, abandoned-observer behavior, and provider-file cleanup remain pending manual checks; none are claimed passed here.
eleith added 1 commit 2026-10-01 18:02:48 +00:00
[cli] validate assistant options before generation
ci/woodpecker/pr/cli Pipeline was successful
ci/woodpecker/pr/core Pipeline was successful
ci/woodpecker/pr/web-db Pipeline was successful
ci/woodpecker/pr/web-jobs Pipeline was successful
ci/woodpecker/pr/web-pieces Pipeline was successful
ci/woodpecker/pr/web-worker Pipeline was successful
ci/woodpecker/pr/web Pipeline was successful
ci/woodpecker/push/cli Pipeline was successful
ci/woodpecker/push/core Pipeline was successful
ci/woodpecker/push/web-db Pipeline was successful
ci/woodpecker/push/web-jobs Pipeline was successful
ci/woodpecker/push/web-pieces Pipeline was successful
b21cc2a5b5
Reject incompatible update, directory, and title arguments before loading a piece or calling the provider. Keep the CLI quiet and preserve existing generation, output, and write behavior.

Regression tests assert invalid commands do not parse a piece, generate metadata, serialize YAML, or print output.

Verified with Node v26.4.0 and pnpm 11.2.2: pnpm lint, pnpm check, and pnpm test pass. CLI has 88 passing tests and 100% coverage across statements, branches, functions, and lines.

Known baseline failure: pnpm build stops in @luzzle/web prebuild because apps/web/config.yaml is missing; CLI builds successfully. The root build gate is not passing.
eleith merged commit b21cc2a5b5 into main 2026-10-03 15:21:21 +00:00
eleith deleted branch feat/interactive-generation-core 2026-10-03 15:21:22 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eleith/luzzle#95