KB-1D2F

IU Core 240x Composer — 04 One-command ops, text-as-code, auto-cut, delivery

3 min read Revision 1
dieu44iu-core-mvp240xone-commandtext-as-codeauto-cutdeliveryv0.62026-05-22

04 — One-command operations, text-as-code, auto-cut bridge, delivery

One-command operations — composer.py

cutter_agent/iu_core/composer.py is the Python contract for the SQL composer layer (pure dataclasses + functions, no IO/DB). Its COMPOSER_COMMANDS registry is the "no operator remembers raw SQL" map: every recurring operation is one named command resolving to one SQL function.

One-command name SQL function
dot_iu_create_piece fn_iu_create
dot_iu_create_collection fn_iu_collection_create
dot_iu_create_file_from_pieces fn_iu_compose
dot_iu_create_workflow_from_steps fn_iu_compose
dot_iu_add_piece fn_iu_collection_add_piece
dot_iu_remove_piece fn_iu_collection_remove_piece
dot_iu_reorder_piece fn_iu_collection_reorder_piece
dot_iu_render_file fn_iu_collection_render
dot_iu_validate_collection fn_iu_collection_validate
dot_iu_rebuild_metadata_axes fn_iu_metadata_refresh
dot_iu_healthcheck fn_iu_collection_healthcheck

All 11 dot_iu_* commands the prompt enumerates are covered; each target is a real SQL function (a test asserts it). composer.py also provides the deterministic offline contract: NewPieceSpec / ComposePiece / ComposeRequest build the exact fn_iu_compose payload; validate_compose_request is a fail-closed pre-flight; manifest_digest reproduces the SQL digest byte-for-byte.

Text-as-code — composition manifests

text_as_code.py gained the composition-manifest surface: CollectionManifest; collection_manifest_path (deterministic, unique iu-tree/_collections/<kind>/<key>.md); serialize_collection_manifest (byte-identical re-serialization → meaningful git diff); validate_collection_manifest (fail-closed: non-empty, unique iu_id, contiguous piece_order, digest match). Import stays non-destructive (IMPORT_IS_DESTRUCTIVE=False). The digest is proven byte-identical across SQL, composer.py, and text_as_code.py.

Auto-cut bridge — auto-cut and the composer share one model

autocut_bridge.map_cut_to_compose_request(cut, key, kind, title) is a pure mapper CutResult → composer.ComposeRequest: a cut unit with a birth_spec maps to a from-scratch NewPieceSpec; a bare unit maps to an iu_id reference. An auto-cut result and a created-from-scratch file converge into the same iu_piece_collection model. The bridge stays pure — no IO, no DB, never executes CUT. No production CUT was run.

Delivery seam — unchanged, safe, internal-only

The migration-013 delivery seam was not touched. delivery_enabled=false, delivery_live_routes='', dead letter 0. The composer emits no events this macro (a pure substrate layer; event wiring is deferred — see doc 07). External delivery remains structurally impossible.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-240x-piece-native-authoring-composer-textcode-autocut-delivery-open-goal/04-one-command-textcode-autocut.md