mirror of
https://github.com/storytold/deckcraft.git
synced 2026-11-20 09:04:51 +00:00
* #239: open PowerPoint 97-2003 .ppt/.pot/.pps files
New crate deckcraft-ppt (L3), written from the public [MS-CFB], [MS-PPT]
and [MS-ODRAW] Open Specifications: a compound-file reader (ported from
FilmCraft's clean-room reader), the edit chain and persist directory, and
the OfficeArt drawings. Main masters become masters (colours, fonts, text
styles, background, decorations), title masters become layouts; slides
keep their shapes (presets, freeforms, groups, rotation, flips), fills,
lines, shadows, pictures (PNG, JPEG, DIB, TIFF, EMF, WMF), text with the
master styles resolved into it, fields, notes and hidden flags.
Import only: an opened .ppt has no save path, so Save asks for a new
name. A .pps from the system starts the slide show. File dialogs, drag
and drop, the web shell and the macOS, Windows and Linux file
associations offer the three extensions. Tests build .ppt files from
records and sweep hostile input.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #239: address review: budget picture decoding, read each persist directory once, macOS .pot/.pps types
- Pictures decode lazily, when a shape first uses them, each at most once and all
within a shared 4 GiB budget: many store entries pointing at one deflated blob
can no longer ask for unbounded memory.
- A persist directory named by many edits is read once.
- Info.plist declares com.microsoft.powerpoint.pot and .pps alongside .ppt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #239: address review: check the picture budget before copying bitmap data
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* #239: build against current main
- convert.rs: set `flip: None` on imported gradients. `Gradient` gained the field in
ad97533a; None is what an unflipped gradient was before.
- tests.rs: split `imports_a_presentation` into one check per section (title, picture,
group, text box, master) for the workspace `cognitive_complexity` lint (6ddd2fb8).
The assertions are unchanged.
- Cargo.lock: deckcraft-ppt takes the workspace version, 0.15.0.
* #239: keep the picture budget on 32-bit targets
`MAX_TOTAL` was `4 << 30` as a `usize`. On wasm32 that is 2^32, which wraps to 0
without any error, so the web build's picture budget was zero and every .ppt
picture was dropped. Use the address space as the limit there. A compile-time
assertion that the budget holds at least one picture keeps it from happening
again on any target: the CI wasm step (`cargo check`) now fails if it does.
* #239: read past the character fields PowerPoint 2002 and later add
A TextCFException can end with pp10runid (mask bit 20), newEAFontRef (24),
csFontRef (25) and pp11ext (26), after `position`. read_cf stopped at
`position`, so in a StyleTextPropAtom the next run's count and mask were read
from the leftover bytes, and every later run got garbage formatting or the
walk ended. Master text styles go through the same reader. The fields are
read past and not used. The test has a run carrying all four followed by a
bold 18 pt run, which now reads as written.
* #239: convert each listed object once and index notes pages
Nothing stopped a slide list from naming one persist object many times, and
each listing converted its whole drawing again: a 100k-shape slide listed
180k times fits in about 10 MB and makes 1.8e10 shapes. An object is now
listed once across the slide, master and notes lists (PowerPoint never lists
one twice), and a repeat is logged and skipped. Notes pages are looked up
through a map built once, instead of a scan per slide (slides x notes). The
first matching page still wins.
* #239: find formatting runs by binary search
paragraphs() found the run at a position (rposition) and the next run start
(find) by scanning the run starts for every run, break and field, so text
cost grew with chars x runs. The starts are a running sum and never
decrease, so both lookups are now partition_point. Measured in a debug
build, 640k one-character runs (about 6 MB of file): 75 s before, about 2 s
after. The test uses a 20 s bound, like render's pathgrad budget test.
* #239: cap decoded pictures at the .pptx package total
The picture budget was 4 GiB, so a few MB of small deflated metafiles, each
inflating to 64 MiB, could make the import hold 4 GiB. A .pptx package may
inflate to 2 GiB in total (deckcraft-pptx opc MAX_TOTAL), and pictures are
the only part of a .ppt this crate inflates, so use the same 2 GiB. That also
fits a 32-bit usize, which replaces the wasm32 special case. This is a limit
change, so there is no new test: the budget test
(the_store_decodes_lazily_within_a_budget) and the compile-time check that
the budget holds a picture still cover it.
* #239: fall back to the first main master the same way every time
A slide naming a master that doesn't exist fell back to the lowest index in
the masters HashMap. A title master is stored with its main master's index,
so the two tied and the HashMap's random order picked one: the same file got
the "Title Master" layout on some opens and the main master's on others. The
fallback now considers main masters only. The test opens such a deck 30
times; before the fix it took the title master's layout within those opens.
* #239: try the edit scan before calling a file too old
Any Current User token other than the plain or encrypted one, including none
at all from a truncated record, returned TooOld at once. A PowerPoint 97 file
with a damaged Current User stream was reported as "made by PowerPoint 95 or
earlier", and the UserEditAtom scan meant for a missing stream never ran.
[MS-PPT] allows only those two tokens, so an unknown one can't tell a damaged
file from an older format. The scan now runs, and TooOld is returned only when
it finds no edit record behind an unknown token.
* #239: read persist directories within one stream's worth of words
dirs_seen only skips a directory named at the same offset again. Directories
nested inside one another, each named by its own UserEditAtom, were each read
to the end of the stream: MAX_EDITS x the stream. In a debug build, 4095 such
edits over a 64 MiB stream took about 48 s. All directories now share a budget
of stream.len() / 4 words. Real directories are separate records inside the
stream, so they always fit. The hostile case stops in milliseconds and is
reported as damaged.
* #239: check two additions on input-derived sizes
- cfb.rs: the mini sector end `at + MINI_SECTOR_SIZE` was unchecked. On a
32-bit target (wasm32), a sector number near 0x03FF_FFFF puts `at` at the
top of usize, so the add panics in a debug build and wraps in release.
- text.rs: the style-run total `chars.len() as u32 + 1` truncated and could
overflow past u32::MAX characters. It now saturates.
Neither case can be reached in a native test (one needs a 32-bit target, the
other more than 4 GiB of text), so there is no new test. The `+ 1`s in
convert.rs paragraphs() that the review also named are bounded by the text
length and can't overflow, so they are unchanged.
* #239: gaps: name every loss in the .ppt Impact line
The Impact line said old decks "open and read correctly" and named only
motion and links, while the Evidence above it also lists sounds and video,
degraded tables, OLE objects, charts and WordArt, and missing PICT pictures.
(CodeRabbit's open note on docs/gaps.md.)
* #239: ppt: a sector chain that revisits a sector is an error
read_chain stopped at the stream's size, so a FAT loop shorter than the stream returned the
looped sectors again as the stream's bytes. It now tracks visited sectors and fails on a revisit,
and reserves the stream's size (capped at the file length) up front.
a_looping_chain_stops expected the repeated bytes; it now expects the error (eliets2's review).
* #239: ppt: slide shapes inherit from their own master's shapes
Master shape properties were remembered by shape id alone, so a later master (a title master,
or a second main master) that reused a shape id replaced the first master's entry, and slides
inherited fill and line from the wrong master. They are now keyed by master slide id and shape id,
and a shape's hspMaster is looked up in its slide's master, then a title master's main master.
Notes pages have no imported master, so they inherit nothing.
PowerPoint gives shapes file-unique ids, so this takes a damaged or generated file (eliets2's
review).
* #239: ppt: drop the unused fBackground field
RawShape.background was set from the FSP flag but never read: the background shape is the
drawing container's own shape (OfficeArtDgContainer.shape, [MS-ODRAW] 2.2.13), which drawing()
already takes. The comment there now says so (eliets2's review).
* #239: ppt: shadowed text keeps its shadow
TextCFException's shadow bit was read and merged but never reached the run. A shadowed run now
gets a shadow in the colour scheme's shadow colour, at the distance and direction of the app's own
Text Shadow command, with no blur (the record has none). Emboss has no counterpart in the model,
so its field is gone and the loss is listed in the docs (eliets2's review).
* #239: the .pps show-on-open test opens a real 97-2003 file
a_ppsx_from_the_system_starts_the_show saved a .pptx under the name "Old talk.pps", so it went
through the PPTX path and never reached the legacy importer. crates/ppt/tests/fixtures/old-talk.pps
is a one-slide .pps built from records by the ppt tests (rebuilt with DECKCRAFT_WRITE_PPT_FIXTURE=1,
checked on every run), attributed CC0 like the other generated fixtures, and the UI test opens it
(eliets2's review).
* #239: docs: one date, the full list of losses, .pot in the README
From eliets2's review:
- README names .ppt/.pot/.pps and says the import has no writer (Save asks for a new name).
- The parity-checklist row lists the same losses as docs/gaps.md, now with text emboss, and the
checklist gets a status line for the change.
- The ROADMAP progress row, the architecture and file-format change rows and every header carry
one date (2026-11-09), so the progress row sits at the top in order; the ROADMAP gets its
status line.
- docs/gaps.md says why there is no real-deck corpus in the repo (no PowerPoint-made files) and
where one would live.
* #239: ppt: test mini streams, 4096-byte sectors and the DIFAT chain
The compound-file test builder only made version-3 files with 512-byte sectors, no mini stream
and every FAT sector in the header, so read_mini_chain, 4096-byte sectors and the DIFAT chain never
ran. build_with takes the sector shift and the mini stream cutoff, and lists FAT sectors past the
header's 109 in DIFAT sectors; build is build_with(streams, 9, 0), so existing tests see the same
layout. Three tests read streams back through each path (eliets2's review).
* #239: ppt: test every picture kind, two-UID blips and blips inside the FBSE
The blip tests covered PNG, deflated WMF and DIB only. New tests decode JPEG (RGB and CMYK), TIFF
and PNG with one and two UIDs, an uncompressed EMF with each UID count, a metafile over the budget
(compressed or not), and a blip held inside its FBSE rather than in the Pictures stream. All
passed as written (eliets2's review).
* #239: ppt: placeholder text held only in the slide list is imported
A shape's client text box may hold just an OutlineTextRefAtom, with no TextHeaderAtom ([MS-PPT]
OfficeArtClientTextbox): the text lives in the slide list, and that is the usual form for slide
placeholders. read_block returned None without a header, so text_block never reached its
outline fallback and the placeholder came in empty. A block with a reference and no header is
now returned for the caller to follow.
placeholder_text_can_come_from_the_slide_list covers the reference alone (it failed before this
change) and a header with a reference; the test document builder can put outline blocks in the
slide list (streams_with_outline). Found writing the test eliets2's review asked for.
* #239: ppt: test newer edits and the two other encryption signs
doc::read had tests for one edit and the Current User token only. a_later_edit_replaces_a_slide
adds an edit whose persist directory gives the slide a new object; the newer slide is imported and
the master from the older directory is kept. encryption_is_found_in_the_edit_and_the_persist_directory
covers an edit record long enough for encryptSessionPersistIdRef and a CryptSession object named
by a later edit. Both passed as written (eliets2's review).
* #239: ppt: test title masters and slides that follow nothing
No test made a slide of a title master or a slide with the follow-master flags off. The new test
checks that a title master becomes a "Title Master" layout with its own background and shapes
and without the master's shapes, that its slide uses that layout and follows its background, and
that a slide with all three flags off keeps its own background and colour scheme and hides the
master's shapes. It passed as written (eliets2's review).
* #239: ppt: merge boolean properties flag by flag
A boolean property word holds sixteen flags, each with its own fUse bit.
Props::inherit and add_table kept the whole word from the most specific
set, so a placeholder or text box that set only fNoFillHitTest lost the
inherited "not filled" and "no line" and was drawn with a fill and an
outline. Merge those words per flag instead (#1137 review, issue 1).
* #239: ppt: recover a broken edit chain and report lost slides
An edit whose previous-edit offset points back at itself (or anywhere
that isn't an edit) cut the older edits off, and with them the persist
directories holding the slides: such a file opened as an empty deck
with no warning. When the chain doesn't end at offset 0, read every
edit's persist directory in the stream, newest first, filling only what
the chain left unset.
Slides the slide list names but whose objects are still missing are now
returned by deckcraft_ppt::import_checked and reported like a damaged
.pptx: lostSlides, a "(Repaired)" copy and the CLI warning
(#1137 review, issue 3).
* #239: ppt: picture frames, inline picture fills, gradients, footers, numbering
The remaining differences from LibreOffice in the #1137 stress test:
- Picture frames (and OLE frames) that say nothing about fill or line
start with neither, as placeholders and text boxes do, instead of the
drawing defaults' fill.
- A pib or fillBlip held in the property's own complex bytes (fBid) is
decoded within the picture budget: table cells with a picture fill
showed a plain colour.
- Shaded fills put the back colour at fillFocus ([MS-ODRAW]), and the
linear angle follows how LibreOffice writes and reads it (0 degrees
from the top): the linear gradient was reversed, the radial inside out.
- HeadersFooters (the slide's, else the document's) add the date,
footer and slide number placeholders; the master's footer placement,
alignment, size and colour reach every layout.
- Numbering from the document's ___PPT9 tag (OutlineTextProps9, pp9rt
in the runs' fontStyle) turns bulleted paragraphs into numbered ones.
- Wingdings diamonds draw as a diamond, not a dot.
* #239: ppt: read CString records up to their first NUL
Header/footer text and the ___PPT9 tag name were decoded from the whole
CString body. A writer that ends the string with a NUL would put the NUL
into the footer text and make the tag name fail to match, losing the
numbering. Stop at the first NUL, as the font names already do.
---------
Co-authored-by: kiwi4boy <kiwi4boy@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: keithcsqueensu <92232107+keithcsqueensu@users.noreply.github.com>
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
246 lines
18 KiB
Markdown
246 lines
18 KiB
Markdown
<!-- craft-house-rules:start core source=dde09ea31e2e457f5b4653a6e76f7cdf55944bdf sha256=540e6cea75d12d0710c3dca89658328e81e508ecef102446ca5bb95b7c0b92bb -->
|
||
## House rules
|
||
|
||
These apply in every Craft repository. A later rule may be stricter, not weaker. The source is `standards/house-rules-core.md` in `storytold/craft-contrib`. Propose changes there, not in a copy.
|
||
|
||
1. **A person is accountable.** Whoever runs an agent answers for what it opens and for its review comments.
|
||
2. **Check, then claim.** Before writing code, read the issue comments, search pull requests for `#N` and the keywords, and check recent commits on `main`. Comment on the issue first. Release a claim you will not finish.
|
||
3. **Verify, don't guess.** Open a definition before using it. Confirm the cause in the code, even when someone names a location.
|
||
4. **Keep fixes narrow and tested.** Fix what the issue describes, where the bug is. Add a test that fails without the fix.
|
||
5. **Review the diff before opening a pull request.** Identifiers exist as used, the test fails without the fix, nothing unrelated changed, and the description is true.
|
||
6. **Look for a better pull request.** If another fixes the same thing, close yours when it is better or equal, and say why.
|
||
7. **Report only what ran.** Say what you tested and what you could not run. Without a local build or test, say so and rely on CI before marking ready.
|
||
8. **`main` changes through a pull request.** Do not push to it. Branch protection enforces this. There is no exception.
|
||
9. **Stop and ask only about** licensing outside the allowlist, publishing, releases, a new remote, secrets, spending money, destructive git, and anything else hard to undo. Otherwise keep working. `plan/` is a gitignored notebook, not rules. Without it, do not ask for it and do not stop.
|
||
10. **Keep secrets and personal details out** of the repository, logs and requests.
|
||
11. **CI stays shared.** Workflows call `storytold/craft-common-actions`. Do not change CI in a feature or fix pull request. If CI cannot cover a change, open an issue there.
|
||
12. **Guards say why.** A check that looks removable says what it prevents. Read that before changing it.
|
||
13. **Instructions must be readable by everyone.** No notes about one machine, and no links to files a reader cannot open. `craftrules` is retired. Do not link to it.
|
||
14. **Keep pull requests moving.** Concurrent pull requests are fine; unanswered actionable feedback is not. Respond in 7 days, a reminder at 14, closure eligible at 30, from when an actionable request waits on the author. Suggestions and unconfirmed bot findings do not start the clock. A fix, explanation or agreed plan resets it; unrelated activity does not. Waiting on a reviewer or maintainer pauses it and does not count against the author. A maintainer decides closure; it is never automatic. Reuse search results, do not poll, and stop at a rate limit.
|
||
15. **No agent attribution.** A pull request does not say an agent wrote it. A repository rule may not require that.
|
||
<!-- craft-house-rules:end -->
|
||
<!-- craft-house-rules:start rust source=dde09ea31e2e457f5b4653a6e76f7cdf55944bdf sha256=387e0ccb4b49e567f60951d7d6fff7305054c89f43ad812b9993dc7c38528013 -->
|
||
## Rust Craft repositories
|
||
|
||
These apply to native Craft apps and to shared Rust libraries. Select them by repository type. A repository that merely contains some Rust does not take this block. Rules later in a repository's file may be stricter, but not weaker. The source is `standards/house-rules-rust.md` in [storytold/craft-contrib](https://github.com/storytold/craft-contrib).
|
||
|
||
1. **Never crash.** Non-test code does not panic and has no `unsafe`, except where the repository file names an exception. Return errors, treat input as hostile, and bound recursion and allocations. New production crate roots copy the `deny` attribute from an existing crate: `clippy::unwrap_used`, `clippy::expect_used`, `clippy::panic`, `clippy::unimplemented`, `clippy::todo`, `clippy::unreachable`. Every crash fix comes with a test that panicked before the fix.
|
||
2. **Clean room.** Learn from observed behaviour and public specifications. Do not copy another product's code, assets, strings or artwork. Check a dependency's licence before adding it.
|
||
3. **Assets and fonts.** Every asset is original or suitably licensed, and is recorded in `ATTRIBUTION.md` in the same change. Font files live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts), not in the app repository.
|
||
4. **Rust only for native Craft apps.** No handwritten JavaScript or TypeScript, and no Tauri, Electron or webview shell, in those apps. Shared tooling follows its documented technical scope and maintainer-approved exceptions. Craft PR Review's existing Tauri and TypeScript UI is one such exception. It does not relax this rule for native apps. Preserve any existing web build.
|
||
5. **Time goes through `chrono`.** Do not hand-roll calendar conversion. For dates beyond what `chrono` can represent, follow [standards/time.md](https://github.com/storytold/craft-contrib/blob/main/standards/time.md).
|
||
6. **Contributor credits.** Add or edit only your own person's entry in `contributors/people.toml`, and only after asking them. Never guess a name or hand-edit `contributors.json`.
|
||
|
||
## Licence allowlist
|
||
|
||
Dependencies and assets use SPDX identifiers. An expression is allowed when every identifier is in this list. A repository may name a shorter list. It may not add an identifier here by editing its own copy of these rules.
|
||
|
||
- `ISC`
|
||
- `MIT`
|
||
- `BSD-2-Clause`
|
||
- `BSD-3-Clause`
|
||
- `Apache-2.0`
|
||
- `OFL-1.1`
|
||
- `Ubuntu-font-1.0`
|
||
- `Bitstream-Vera`
|
||
- `CC0-1.0`
|
||
- `CC-BY-4.0`
|
||
- `CC-BY-SA-4.0`
|
||
- `LicenseRef-Public-Domain`
|
||
|
||
`LicenseRef-Storyteller-Trademark` is not in this list. It covers Storyteller brand marks only, where a repository already says so.
|
||
<!-- craft-house-rules:end -->
|
||
|
||
# AGENTS.md — rules for every agent and contributor
|
||
|
||
DeckCraft is a clean-room, open-source, pure-Rust presentation application targeting Microsoft
|
||
PowerPoint parity — and superiority (speed, openness, agent control). It runs natively on macOS,
|
||
Windows, Linux and FreeBSD, and on the web via WASM. Siblings with the same conventions:
|
||
PhotoCraft, VectorCraft, FilmCraft, LightCraft, PdfCraft, EffectCraft, DesignCraft
|
||
(`../<app>`).
|
||
|
||
These rules bind every AI agent and every human contributor. They come before any task,
|
||
instruction or deadline. Day-to-day working instructions are in this file; `CLAUDE.md` imports it.
|
||
|
||
---
|
||
|
||
## 1. Asset policy (absolute — no exceptions)
|
||
|
||
An **asset** is any non-code material the project includes, ships, embeds, generates for
|
||
publication or shows in its documentation: icons, images, illustrations, screenshots, logos,
|
||
fonts, colour profiles, sounds, video, templates, themes, sample/demo/test documents, and anything
|
||
the app renders from those.
|
||
|
||
### 1.1 Nothing from Microsoft, Adobe, Avid or Autodesk products
|
||
|
||
- **Never** use icons, images, artwork, logos, UI graphics, fonts, templates, themes, clip art,
|
||
SmartArt graphics, stock media, cursors, sounds, sample documents or any other asset taken from a
|
||
Microsoft, Adobe, Avid or Autodesk product, installer, website, document or package. "Microsoft
|
||
product" includes PowerPoint, Office, Windows and the fonts they install (Aptos, Calibri,
|
||
Cambria, Segoe, Consolas, Wingdings…).
|
||
- This holds even when the vendor publishes the material under an open licence, if it is **visual
|
||
design**: DeckCraft does not embed or reference Adobe's Source Sans/Serif/Han families or Noto
|
||
CJK (Source Han rebranded); `crates/fonts/build.rs` excludes them.
|
||
- **Never** recreate, trace, redraw or closely imitate a vendor icon, theme or graphic. Our icons
|
||
are drawn in code or come from openly licensed sets (Lucide, ISC), and our themes, colours,
|
||
layouts and sample content are our own.
|
||
- Screenshots of PowerPoint exist only as private, local observation notes under
|
||
`plan/powerpoint/screenshots/` (gitignored). They must **never** be committed, published,
|
||
linked, shown in docs, or traced.
|
||
- Never commit files produced by PowerPoint. Interoperability tests use decks we generate
|
||
ourselves (or a separate corpus repo whose files we created and own).
|
||
|
||
### 1.2 Only open, provable licences
|
||
|
||
Every asset must be one of: open source (ISC, MIT, BSD-2/3-Clause, Apache-2.0, OFL-1.1,
|
||
Ubuntu-Font-1.0, Bitstream-Vera); Creative Commons (CC0-1.0, CC-BY-4.0, CC-BY-SA-4.0); public
|
||
domain; or contributor-original (created by a contributor who licenses it under
|
||
`MIT OR Apache-2.0`).
|
||
|
||
One narrow exception: the ArtCraft name, wordmark and logos in `docs/brand/` are trademarks of the
|
||
ArtCraft Team (not open source, terms in `docs/brand/LICENSE-brand.txt`), used only unmodified to
|
||
identify the project.
|
||
|
||
Forbidden: system fonts that are not openly licensed, vendor emoji artwork, stock photos, "free
|
||
for personal use" material, screenshots of other people's software, anything whose licence you
|
||
cannot prove from its original source.
|
||
|
||
**Screenshots of DeckCraft** are contributor-original. Everything visible in them must itself be
|
||
allowed: our UI, our/Lucide icons, OFL fonts, and decks built only from allowed assets.
|
||
|
||
### 1.3 Every asset is attributed
|
||
|
||
- **`ATTRIBUTION.md`** (repo root) lists every asset file — committed, fetched at build time
|
||
(craft-fonts) or bundled through a Cargo dependency — with author, source (URL + version or
|
||
commit), licence and use. `cargo xtask assets` fails if a file under `assets/`, `docs/images/`
|
||
or `docs/brand/` has no row.
|
||
- **`NOTICE`** keeps the notices the licences require.
|
||
- Fonts live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts), never in this
|
||
repo. DeckCraft embeds its `fonts/latin-manifest.txt` and
|
||
`fonts/manifest.txt` when built with `CRAFT_FONTS_DIR` (local dev: `.cargo/config.toml` points at
|
||
`../craft-fonts`).
|
||
|
||
### 1.4 Adding or changing an asset
|
||
|
||
1. Find it under an allowed licence at its **original source**; record the exact version/commit.
|
||
2. Confirm the author is not Microsoft, Adobe, Avid or Autodesk (§1.1). Keep the licence text.
|
||
3. Add the file, its licence file and an `ATTRIBUTION.md` row; run `cargo xtask assets`.
|
||
4. If origin or licence is unclear, **do not add it**.
|
||
|
||
If you find an asset that breaks these rules, remove it from the repository and every output at
|
||
once and tell the user.
|
||
|
||
---
|
||
|
||
## 2. Clean-room rules
|
||
|
||
- PowerPoint is installed on the dev machine and may be **observed** black-box: run it, use its UI
|
||
on synthetic decks, screenshot windows by id into `plan/powerpoint/screenshots/` (never
|
||
committed). Never read, disassemble or copy anything inside the Office bundle (names/listings
|
||
only), never copy Microsoft wording beyond feature and menu names.
|
||
- File formats come from public standards: ECMA-376 / ISO/IEC 29500 (Office Open XML), ISO 32000
|
||
(PDF). Preset shape geometry is re-derived by us in `crates/geom/src/preset.rs`.
|
||
- Never copy GPL/AGPL/LGPL/MPL code (LibreOffice, Calligra…). Permissive crates are fine as
|
||
dependencies. Code may be copied (not depended on) from sibling Craft apps.
|
||
|
||
## 3. Never crash
|
||
|
||
People trust DeckCraft with their talks; a crash loses work. **This outranks feature work.**
|
||
- No `unwrap()`, `expect()`, `panic!`, `unreachable!`, `todo!`, `unimplemented!` in non-test
|
||
code; no `unsafe` (`unsafe_code = "forbid"`). Every production crate root carries
|
||
`#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]`.
|
||
- Errors are `Result<T, E>` + `?`. Input-derived numbers (files, commands, MCP/control params) are
|
||
hostile: `get()` not `[i]`, checked arithmetic, no NaN casts, capped allocations, bounded
|
||
recursion.
|
||
- `Session::execute` runs every command inside a panic guard (`crates/engine/src/guard.rs`) that
|
||
keeps the presentation as it was. It is a safety net, not a licence.
|
||
- Every crash fix lands with a regression test.
|
||
|
||
## 4. Architecture
|
||
|
||
| Layer | Crates |
|
||
|---|---|
|
||
| L0 | `geom` (units, transforms, preset shapes), `color` |
|
||
| L1 | `model` (presentation, masters, layouts, slides, shapes, text, themes, inheritance, text edit ops) |
|
||
| L2 | `fonts`, `text` (layout), |
|
||
| L3 | `render` (vello_cpu) |
|
||
| L4 | `format` (.deckcraft), `pptx`, `ppt` (97–2003 import) |
|
||
| L5 | `engine` (session, history, commands, tools, keys, sample) |
|
||
| L6 | `mcp` |
|
||
| L7 | `ui-egui` (swappable; nothing below depends on egui/eframe/winit/rfd) |
|
||
| apps | `deckcraft` (desktop), `deckcraft-cli`, `deckcraft-web` |
|
||
|
||
- **Everything is a command** (`crates/engine/src/cmd/*`): id, label, ribbon/menu place,
|
||
shortcut, params doc, `enabled`, `run`, plus tests. Ids follow PowerPoint's ribbon and menus
|
||
(`slide.new`, `format.bold`, `arrange.group`, `transition.set`…). Programmatic calls never open
|
||
dialogs. Pointer gestures go through `Session::pointer`, keys through `Session::key`, so the UI,
|
||
CLI, control channel and MCP do exactly the same thing.
|
||
- **The UI is thin**: panels read engine state and act through commands. Colours come from theme
|
||
tokens. **Never use Tauri**; egui only.
|
||
- **Never break wasm** (`cargo xtask wasm`).
|
||
|
||
## 5. Quality gates (before every commit)
|
||
|
||
`cargo xtask ci` = fmt check, clippy `-D warnings`, tests (nextest when installed) and doctests, layering check, asset check, wasm
|
||
check. Commit after each landed arc with a task id in the message (`M1.2: smart guides`).
|
||
New workspace crates include `workspace = true` under `[lints]` in `Cargo.toml`. Production crate roots
|
||
declare the crate-level lint attributes before modules; crate-level `//!` documentation may precede them.
|
||
|
||
## 6. Running and looking at the app
|
||
|
||
- `cargo run --release -p deckcraft -- --sample --control 7990` (sample deck + control channel).
|
||
- Drive it: JSON lines on `127.0.0.1:7990`, e.g.
|
||
`{"id":1,"method":"engine.execute","params":{"command":"shape.insert","params":{"preset":"star5","rect":[100,100,200,200]}}}`
|
||
then `{"id":2,"method":"ui.screenshot","params":{"path":"/tmp/shot.png"}}`. Methods:
|
||
`crates/ui-egui/src/control.rs`, docs: `docs/control-protocol.md`.
|
||
- **For UI work, look at the result** (screenshot, read the PNG). If available, compare with the observations
|
||
in `plan/powerpoint/01-observed-ui.md`. Otherwise verify the intended behaviour against the task and
|
||
committed documentation; the optional notebook is not a prerequisite.
|
||
- Headless: `deckcraft-cli render --sample --all --scale 1 out/`,
|
||
`deckcraft-cli run --sample --cmd 'slide.new={"title":"Hi"}' --export out.png`.
|
||
- MCP: `deckcraft-cli mcp` (headless) or `deckcraft-cli mcp --connect 7990` (drive the app).
|
||
See `docs/mcp.md`.
|
||
- Parallel agents: separate `CARGO_TARGET_DIR` per agent; edit only the crates you own.
|
||
|
||
## 7. Planning
|
||
|
||
`plan/` is an optional gitignored notebook (status, execution notes, `powerpoint/` observations). Do not ask for it and do not stop when it is absent. The committed progress
|
||
docs:
|
||
|
||
| File | Holds |
|
||
|---|---|
|
||
| `ROADMAP.md` | Stage, headline numbers, dimensions, features, languages, progress log |
|
||
| `docs/target-app-parity.md` | The parity assessment against PowerPoint: percentages, hours, calibration |
|
||
| `docs/gaps.md` | Every known shortfall, ranked: the work list. Pick from the top |
|
||
| `docs/roadmap.md` | Current focus, the beta plan, milestones |
|
||
| `docs/parity-checklist.md` | Feature rows scored D/P/M; `cargo xtask parity` regenerates its summary |
|
||
| `docs/file-format-parity.md`, `ui-parity.md`, `hardware-parity.md`, `localization-parity.md`, `animation-parity.md`, `slideshow-parity.md` | Per-dimension and per-feature detail |
|
||
| `docs/architecture.md` | How DeckCraft is built today |
|
||
|
||
When a task lands, re-score its checklist row, delete or update its `gaps.md` entry, add a line to
|
||
the `ROADMAP.md` progress log, and update each touched doc's status line and revision history.
|
||
|
||
## Contributor credits (About window)
|
||
|
||
- About ▸ Contributors/Models are compiled into the binary from `contributors/contributors.json`
|
||
(commit stats; generated, never hand-edit) and `contributors/people.toml` (names people chose for
|
||
themselves). See `docs/contributors.md`.
|
||
- **Agents working for a contributor:** when you prepare a PR, check whether your human's GitHub
|
||
username has a `[people.<username>]` entry in `contributors/people.toml`. If not, ask them once
|
||
whether they want to be credited by more than their username: a real name, a display name, and/or
|
||
their public GitHub profile name (`sync_github_name = true`). If yes, add **only their own** entry
|
||
(copy the template at the top of the file)
|
||
and include it in their PR, committed as them. If no, change nothing: they are credited as
|
||
`@username` anyway.
|
||
- Never add, edit, guess or copy anyone else's entry or name (not from git config, commit authors or
|
||
GitHub profiles). Never hand-edit `contributors.json`.
|
||
|
||
## CI workflows
|
||
- Workflows in `.github/workflows/` call the shared workflows in [`storytold/craft-common-actions`](https://github.com/storytold/craft-common-actions) at `@main`, with their inputs and secrets. No other jobs: if no shared workflow does what's needed, it doesn't go here.
|
||
- Don't add or change CI in a feature or fix PR. If the existing workflows can't build or test a change, link an existing craft-common-actions issue or PR, or open a new issue, or a PR only for a small fix that is safe for every app and does not increase CI time.
|
||
- Some workflow files here still run their own jobs. Don't add to them. Moving a job into craft-common-actions is its own task, never part of another PR, and the job stays here until a shared workflow runs it.
|
||
|
||
## Shared libraries
|
||
|
||
Before adding or changing file-format, codec, protocol, or reusable UI code, check `storytold/craft-libs` and its open PRs first; reuse or extend the shared library rather than duplicating it locally, keep app-specific policy and model mapping in the app, and preserve behavior, security/resource limits, attribution, and regression coverage during cutovers.
|