mirror of
https://github.com/storytold/deckcraft.git
synced 2026-11-27 16:24:09 -06:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
250a6e8ad0 | ||
|
|
058f292553 |
@@ -75,5 +75,6 @@ DeckCraft is a pure-Rust presentation application (PowerPoint parity target) for
|
||||
- Attribution: `ATTRIBUTION.md` (a row per file under `assets/`, `docs/images/`, `docs/brand/`; `cargo xtask assets` checks it) and `NOTICE`. The ArtCraft name and logos in `docs/brand/` are trademarks (`docs/brand/LICENSE-brand.txt`).
|
||||
- Fonts come from craft-fonts: builds embed `fonts/manifest.txt` and `fonts/latin-manifest.txt` from `CRAFT_FONTS_DIR`; `.cargo/config.toml` points it at `../craft-fonts` when that exists. `crates/fonts/build.rs` excludes Adobe's Source Sans/Serif/Han families and Noto CJK.
|
||||
- Run: `cargo run --release -p deckcraft -- --sample --control 7990` starts the app with a sample deck and the control channel (JSON lines on `127.0.0.1:7990`; methods in `crates/ui-egui/src/control.rs`, docs in `docs/control-protocol.md`). Headless: `deckcraft-cli render --sample --all --scale 1 out/` and `deckcraft-cli run --sample --cmd ... --export out.png`. MCP: `deckcraft-cli mcp --automation-read-root DIR --automation-write-root DIR` confines the headless server to those folders; `deckcraft-cli mcp --connect 7990` drives a running app, which the roots do not confine. See `docs/mcp.md`.
|
||||
- Headless column ([RFC-0052](https://github.com/storytold/craft-contrib/blob/main/rfcs/0052-headless-reach.md)): `docs/parity-checklist.md` rows may carry a fifth `Headless` cell, `no (<reach>)` or `partial (<reach>)` with a reach of `window`, `os` or `engine-gap`; without one a row is `unknown`, and `cargo xtask parity` counts them in the summary. The rows name no command ids yet, so the check refuses `yes`: adding the engine command id a row needs comes first (LightCraft's `cmd:<id>` is the model).
|
||||
- Notes and progress: `plan/` is an optional gitignored notebook. Committed: `ROADMAP.md` (progress log), `docs/gaps.md` (work list), `docs/roadmap.md`, `docs/parity-checklist.md` (`cargo xtask parity` regenerates its summary), `docs/target-app-parity.md`, `docs/architecture.md`.
|
||||
- Contributor credits: `docs/contributors.md`.
|
||||
|
||||
@@ -46,10 +46,12 @@ The summary between `<!-- SUMMARY -->
|
||||
|
||||
Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layout, Chart Design), Export to PDF (slides, notes pages, handouts; text layer, links, bookmarks; vector artwork pending), Format Shape pane, Font, size, bold, italic, underline, strikethrough (only Regular/Bold/Italic faces, #69), Edit chart data, Crop (and crop to shape, aspect ratio), Paste image from clipboard (fails on Windows, #1414, re-test after the 2026-11-01 OS-clipboard fix), Audio/video playback in the show (WMA/WMV not decodable yet), Animation pane (reorder, timing), Presenter view (notes, next slide, timer), macOS, Windows, Linux builds.
|
||||
|
||||
**Headless ([RFC-0052](https://github.com/storytold/craft-contrib/blob/main/rfcs/0052-headless-reach.md)): 0 yes, 0 no (window 0, os 0, engine-gap 0), 0 partial, 191 unknown.** The rows name no command ids yet, so none can be `yes`. A row may add a fifth `Headless` cell, `no (<reach>)` or `partial (<reach>)` with a reach of `window`, `os` or `engine-gap`; a row without one is `unknown`.
|
||||
|
||||
## Rows
|
||||
|
||||
| Area | Feature | Priority | Status |
|
||||
|---|---|---|---|
|
||||
| Area | Feature | Priority | Status | Headless |
|
||||
|---|---|---|---|---|
|
||||
| Application shell | Start screen (new, templates/themes, recent) | P0 | D |
|
||||
| Application shell | Ribbon with Home/Insert/Draw/Design/Transitions/Animations/Slide Show/Review/View tabs | P0 | D |
|
||||
| Application shell | Contextual tabs (Shape Format, Picture Format, Table Design/Layout, Chart Design) | P0 | P |
|
||||
|
||||
+71
-4
@@ -6,14 +6,21 @@ use std::path::Path;
|
||||
const START: &str = "<!-- SUMMARY -->";
|
||||
const ROWS: &str = "\n## Rows";
|
||||
|
||||
/// The cells of a table line that is a scored row: `Area | Feature | Priority | Status`, with an
|
||||
/// optional fifth `Headless` cell (RFC-0052).
|
||||
fn row_cells(l: &str) -> Option<Vec<&str>> {
|
||||
let cells: Vec<&str> = l.trim().trim_matches('|').split('|').map(str::trim).collect();
|
||||
let scored = matches!(cells.len(), 4 | 5) && matches!(cells[2], "P0" | "P1" | "P2") && matches!(cells[3], "D" | "P" | "M");
|
||||
scored.then_some(cells)
|
||||
}
|
||||
|
||||
/// (area, feature, priority 0–2, value 0 / 0.5 / 1) for each table row.
|
||||
pub fn rows(text: &str) -> Vec<(String, String, u8, f64)> {
|
||||
let mut out = Vec::new();
|
||||
for l in text.lines() {
|
||||
let cells: Vec<&str> = l.trim().trim_matches('|').split('|').map(str::trim).collect();
|
||||
if cells.len() != 4 {
|
||||
let Some(cells) = row_cells(l) else {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let pri = match cells[2] {
|
||||
"P0" => 0,
|
||||
"P1" => 1,
|
||||
@@ -31,6 +38,53 @@ pub fn rows(text: &str) -> Vec<(String, String, u8, f64)> {
|
||||
out
|
||||
}
|
||||
|
||||
/// A row's RFC-0052 `headless:` cell: empty or `unknown`, `no (<reach>)` or `partial (<reach>)` with
|
||||
/// a reach of `window`, `os` or `engine-gap`. The rows name no command ids, so nothing can check a
|
||||
/// `yes`: it is refused until a row cites the engine command that does the feature.
|
||||
pub fn headless_cell(cell: Option<&str>) -> Result<(&'static str, Option<&'static str>), String> {
|
||||
let c = cell.unwrap_or("").trim();
|
||||
if c.is_empty() || c == "unknown" {
|
||||
return Ok(("unknown", None));
|
||||
}
|
||||
let (value, rest) = c.split_once(' ').unwrap_or((c, ""));
|
||||
let value = match value {
|
||||
"no" => "no",
|
||||
"partial" => "partial",
|
||||
"yes" => return Err(format!("headless `{c}`: a row is `yes` only once it names the engine command id that does it (RFC-0052)")),
|
||||
_ => return Err(format!("headless `{c}` is not unknown, `no (<reach>)` or `partial (<reach>)`")),
|
||||
};
|
||||
let reach = match rest.trim().trim_start_matches('(').trim_end_matches(')') {
|
||||
"window" => "window",
|
||||
"os" => "os",
|
||||
"engine-gap" => "engine-gap",
|
||||
r => return Err(format!("headless `{c}`: reach `{r}` is not window, os or engine-gap")),
|
||||
};
|
||||
Ok((value, Some(reach)))
|
||||
}
|
||||
|
||||
/// Every row's RFC-0052 value, or the first bad cell.
|
||||
pub fn headless(text: &str) -> Result<Vec<(&'static str, Option<&'static str>)>, String> {
|
||||
text.lines().filter_map(row_cells).map(|c| headless_cell(c.get(4).copied()).map_err(|e| format!("{}: {e}", c[1]))).collect()
|
||||
}
|
||||
|
||||
/// The RFC-0052 summary line.
|
||||
pub fn headless_line(values: &[(&str, Option<&str>)]) -> String {
|
||||
let count = |v: &str| values.iter().filter(|h| h.0 == v).count();
|
||||
let no = |r: &str| values.iter().filter(|h| h.0 == "no" && h.1 == Some(r)).count();
|
||||
format!(
|
||||
"**Headless ([RFC-0052](https://github.com/storytold/craft-contrib/blob/main/rfcs/0052-headless-reach.md)): {} yes, {} no (window {}, os {}, engine-gap {}), {} partial, {} unknown.** \
|
||||
The rows name no command ids yet, so none can be `yes`. A row may add a fifth `Headless` cell, `no (<reach>)` or \
|
||||
`partial (<reach>)` with a reach of `window`, `os` or `engine-gap`; a row without one is `unknown`.\n",
|
||||
count("yes"),
|
||||
count("no"),
|
||||
no("window"),
|
||||
no("os"),
|
||||
no("engine-gap"),
|
||||
count("partial"),
|
||||
count("unknown")
|
||||
)
|
||||
}
|
||||
|
||||
fn weight(p: u8) -> f64 {
|
||||
[3.0, 2.0, 1.0][p as usize]
|
||||
}
|
||||
@@ -75,7 +129,7 @@ pub fn run(root: &Path) -> Result<(), String> {
|
||||
return Err("docs/parity-checklist.md needs a `<!-- SUMMARY -->` marker before `## Rows`".into());
|
||||
};
|
||||
let rows = rows(&text[b..]);
|
||||
let s = summary(&rows);
|
||||
let s = format!("{}\n{}", summary(&rows), headless_line(&headless(&text[b..])?));
|
||||
let new = format!("{}{START}\n{s}{}", &text[..a], &text[b..]);
|
||||
std::fs::write(&path, new).map_err(|e| e.to_string())?;
|
||||
print!("{s}");
|
||||
@@ -96,4 +150,17 @@ mod tests {
|
||||
assert!(s.contains("**Weighted breadth parity: 67%**"), "{s}");
|
||||
assert!(s.contains("Open P0 items: ."));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn headless_cells_default_to_unknown_and_refuse_yes() {
|
||||
let t = "| A | x | P0 | D |\n| A | y | P1 | M | no (window) |\n| B | z | P2 | P | partial (engine-gap) |\n| B | w | P2 | D | unknown |\n";
|
||||
let v = headless(t).unwrap_or_default();
|
||||
assert_eq!(v, [("unknown", None), ("no", Some("window")), ("partial", Some("engine-gap")), ("unknown", None)]);
|
||||
assert_eq!(rows(t).len(), 4, "a fifth cell keeps the row scored");
|
||||
let line = headless_line(&v);
|
||||
assert!(line.contains("0 yes, 1 no (window 1, os 0, engine-gap 0), 1 partial, 2 unknown"), "{line}");
|
||||
for bad in ["yes", "yes (cmd:a.b)", "no", "no (desk)", "maybe (os)"] {
|
||||
assert!(headless(&format!("| A | x | P0 | D | {bad} |\n")).is_err(), "{bad}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user