@netnodeag/kraftwerk 0.82.0 → 0.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +175 -0
  2. package/dist/cli/init.js +1 -0
  3. package/dist/cli/kraftwerk.js +3 -0
  4. package/dist/cli/presentations.d.ts +2 -0
  5. package/dist/cli/presentations.js +261 -0
  6. package/dist/client/routes.d.ts +18 -0
  7. package/dist/client/routes.js +18 -0
  8. package/dist/config.d.ts +16 -0
  9. package/dist/config.js +10 -2
  10. package/dist/core/boards.d.ts +14 -1
  11. package/dist/core/boards.js +34 -1
  12. package/dist/core/chat/context.js +11 -2
  13. package/dist/core/git.js +3 -1
  14. package/dist/core/presentations/browser.d.ts +43 -0
  15. package/dist/core/presentations/browser.js +53 -0
  16. package/dist/core/presentations/builtin.d.ts +3 -0
  17. package/dist/core/presentations/builtin.js +142 -0
  18. package/dist/core/presentations/chart.d.ts +34 -0
  19. package/dist/core/presentations/chart.js +159 -0
  20. package/dist/core/presentations/deck.d.ts +63 -0
  21. package/dist/core/presentations/deck.js +198 -0
  22. package/dist/core/presentations/export.d.ts +21 -0
  23. package/dist/core/presentations/export.js +75 -0
  24. package/dist/core/presentations/html.d.ts +135 -0
  25. package/dist/core/presentations/html.js +389 -0
  26. package/dist/core/presentations/index.d.ts +252 -0
  27. package/dist/core/presentations/index.js +753 -0
  28. package/dist/core/presentations/layout.d.ts +47 -0
  29. package/dist/core/presentations/layout.js +147 -0
  30. package/dist/core/presentations/markdown.d.ts +49 -0
  31. package/dist/core/presentations/markdown.js +158 -0
  32. package/dist/core/presentations/merge.d.ts +26 -0
  33. package/dist/core/presentations/merge.js +28 -0
  34. package/dist/core/presentations/presence.d.ts +31 -0
  35. package/dist/core/presentations/presence.js +131 -0
  36. package/dist/core/presentations/render.d.ts +33 -0
  37. package/dist/core/presentations/render.js +318 -0
  38. package/dist/core/presentations/slots.d.ts +33 -0
  39. package/dist/core/presentations/slots.js +114 -0
  40. package/dist/core/presentations/template.d.ts +253 -0
  41. package/dist/core/presentations/template.js +141 -0
  42. package/dist/core/presentations/versions.d.ts +30 -0
  43. package/dist/core/presentations/versions.js +75 -0
  44. package/dist/core/refs.d.ts +1 -1
  45. package/dist/core/refs.js +9 -1
  46. package/dist/core/search.d.ts +10 -0
  47. package/dist/core/search.js +6 -0
  48. package/dist/core/settings.d.ts +2 -0
  49. package/dist/core/settings.js +12 -1
  50. package/dist/core/trash.d.ts +1 -1
  51. package/dist/server/api/index.d.ts +62 -1
  52. package/dist/server/api/index.js +2 -0
  53. package/dist/server/api/presentations.d.ts +66 -0
  54. package/dist/server/api/presentations.js +185 -0
  55. package/dist/server/api/socket.js +24 -1
  56. package/dist/server/api/workspace.d.ts +5 -0
  57. package/dist/server/api/workspace.js +2 -0
  58. package/package.json +6 -2
  59. package/schema/kraftwerk.schema.json +18 -0
  60. package/web/dist/assets/{dist-DvkrCSGL.js → dist-5-ibIscm.js} +1 -1
  61. package/web/dist/assets/{dist-Bie1ebP9.js → dist-5lgY5B-M.js} +1 -1
  62. package/web/dist/assets/{dist-BuwdjX6z.js → dist-BJaPgnhj.js} +1 -1
  63. package/web/dist/assets/{dist-C_rJjRj7.js → dist-Bar1_NBq.js} +1 -1
  64. package/web/dist/assets/{dist-DtUB2Uu2.js → dist-BxCxboU8.js} +1 -1
  65. package/web/dist/assets/dist-CDitSY16.js +1 -0
  66. package/web/dist/assets/{dist-C16bXf8c.js → dist-CRXT8IL6.js} +1 -1
  67. package/web/dist/assets/{dist-CH73jsgO.js → dist-CXRjiHpl.js} +1 -1
  68. package/web/dist/assets/{dist-BBFUIftm.js → dist-CpnB7MfK.js} +1 -1
  69. package/web/dist/assets/{dist-C0ve4Tka.js → dist-D1VK1YdB.js} +1 -1
  70. package/web/dist/assets/{dist-CDUZdAAS.js → dist-D52LvyO8.js} +1 -1
  71. package/web/dist/assets/{editor-3z92i0tV.js → editor-HCNTXWWs.js} +3 -3
  72. package/web/dist/assets/index-Dnlu16AL.css +2 -0
  73. package/web/dist/assets/index-kwWnQOhD.js +473 -0
  74. package/web/dist/index.html +2 -2
  75. package/web/dist/assets/dist-DYICNp09.js +0 -1
  76. package/web/dist/assets/index-DRhNELK_.js +0 -232
  77. package/web/dist/assets/index-unGEux3Y.css +0 -2
package/README.md CHANGED
@@ -260,6 +260,7 @@ kraftwerk devices # paired devices (a phone, another compu
260
260
  kraftwerk remote on|off|pair # reach this machine from anywhere through the relay, end to end encrypted
261
261
  kraftwerk projects # goal-scoped project folders; projects create|show|link|log|remove
262
262
  kraftwerk boards|tasks # task boards per project or workspace; tasks create|show|move|assign|log|pick|remove
263
+ kraftwerk presentations # slide decks (HTML slides, themes, PPTX/PDF/HTML export) per project or workspace; show|create|check|render|remove|templates
263
264
  kraftwerk contacts|places|events # who, where and when, one Markdown file each; … show|create|set|remove, events --from/--to
264
265
  kraftwerk ref <kind:slug> # resolve a reference (contact:anna-meier, project:relaunch, …); --file <md> resolves every one in a file
265
266
  kraftwerk trash # what was deleted; trash restore|purge <id>, trash empty
@@ -686,6 +687,180 @@ workspace never starts the same work twice. Only a human moves a task into a
686
687
  done column; `tasks assign <n> human` clears the assignee and puts the task
687
688
  into Review.
688
689
 
690
+ ## Presentations
691
+
692
+ Turn on `presentations:` in `kraftwerk.yml` (or the checkbox in settings)
693
+ and every project can have slide decks, and the workspace its own:
694
+
695
+ ```yaml
696
+ presentations:
697
+ root: kraftwerk-data/presentations # default; the workspace's decks and templates (a project's decks live in projects/<slug>/presentations/)
698
+ ```
699
+
700
+ ```
701
+ projects/<slug>/presentations/<name>/deck.md # the slides: markdown (and HTML) on a template's layouts
702
+ projects/<slug>/presentations/<name>/assets/ # the pictures the slides show
703
+ projects/<slug>/presentations/<name>/exports/ # what `render` wrote: .pptx, .pdf, .html, slides/NN.png
704
+ kraftwerk-data/presentations/<name>/… # workspace decks, same shape
705
+ kraftwerk-data/presentations/templates/<slug>/ # your own themes: template.yml, theme.css, fonts and pictures beside them
706
+ ```
707
+
708
+ A deck is one markdown file. The headmatter names the title, the template
709
+ and, optionally, CSS of the deck's own; a `---` line starts the next slide,
710
+ and an optional YAML block right after it sets the slide's `layout:` (and
711
+ `background:`, `slots:`). The content before the first `::slot::` marker is
712
+ the slide's title (a leading heading) and body; `::left::`, `::image::`,
713
+ `::chart::`, … fill the layout's named slots, `::notes::` are the speaker
714
+ notes. A slot holds markdown, raw HTML, a picture (`![caption](assets/x.png)`),
715
+ a table, or a fenced `chart` block (YAML: `kind` column | bar | line | pie |
716
+ doughnut | area, `categories`, `series` with `name` and `values`).
717
+
718
+ ```markdown
719
+ ---
720
+ title: Why we move to NodeHive
721
+ template: netnode
722
+ layout: title
723
+ ---
724
+ # Why we move to NodeHive
725
+ ::subtitle::
726
+ Content pipeline review · November 2026
727
+ ::notes::
728
+ Open with the migration timeline.
729
+
730
+ ---
731
+ layout: content
732
+ slots:
733
+ title: { size: 30 }
734
+ figures: { kind: html, x: 0.44, y: 3.2, w: 9.12, h: 1.6 }
735
+ ---
736
+ # One source, every channel
737
+ - Editors write **once**, in markdown
738
+ - Every channel reads the same API
739
+ ::figures::
740
+ <div class="kpis"><div class="kpi"><strong>−60%</strong><span>time per text</span></div></div>
741
+ ```
742
+
743
+ **Slides are HTML.** The editor, the thumbnails, present mode, the HTML
744
+ file, the PDF and the PNGs all show the same live HTML in the template's
745
+ theme; PDF and PNG are printed from it by a headless browser (Playwright's
746
+ Chromium when installed, else the installed Chrome; without either the
747
+ PowerPoint model's raster stands in, with a warning). The PowerPoint file
748
+ is a native model of the same slots — text, lists, pictures, native charts
749
+ and tables stay editable — its HTML pieces placed as pictures of
750
+ themselves. A slide may move or restyle a layout's slot, or add boxes of
751
+ its own, in its `slots:` (positions in inches on a 10 × 5.625 canvas);
752
+ kinds are `text`, `markdown`, `image`, `chart`, `table`, `html` and
753
+ `embed` (a URL, or a whole page with scripts, run sandboxed).
754
+
755
+ **The design** is the template: `template.yml` names the canvas, fonts,
756
+ colors, layouts (slots placed in inches, decorations behind them) and
757
+ snippets — the theme's ready-made pieces (cards, key figures, a flow, a
758
+ timeline …) for the editor's insert menu — and `theme.css` styles the
759
+ slides, scoped to them (`:root` means the slide; `@font-face` fonts sit
760
+ beside the file). `kraftwerk presentations templates init <slug>` copies
761
+ the built-in one to start from; the deck's own `css:` goes on top for one
762
+ deck. What a slot cannot show (an empty required slot, an unknown layout,
763
+ a missing picture, a broken chart block) is a warning with the slide and
764
+ the slot, in the editor, in `show` and in `check`.
765
+
766
+ ```
767
+ kraftwerk presentations [--project <p>] [--all] # the decks; presentations show|create|check|render|remove
768
+ kraftwerk presentations create "<title>" --project relaunch [--template netnode] [--from deck.md]
769
+ kraftwerk presentations show nodehive-pitch --project relaunch # slides, the template's layouts and slots, its pieces, the warnings
770
+ kraftwerk presentations check nodehive-pitch --project relaunch # exit 1 on errors
771
+ kraftwerk presentations render nodehive-pitch --project relaunch --png --pdf --pptx --html [--out <dir>]
772
+ kraftwerk presentations templates [init <slug>]
773
+ ```
774
+
775
+ **The editor** (`#/projects/<slug>/presentations/<name>`) is the slide
776
+ itself, live, and works like ChatGPT's presentation editor:
777
+
778
+ - **Slides.** A numbered strip (drag to reorder; right click to duplicate,
779
+ hide, move or delete), a grid of all slides, a new slide from a picture of
780
+ each layout, zoom from fit to 150 %. Hidden slides stay in the deck and
781
+ out of present mode and the exports.
782
+ - **On the slide.** Every slot is a box: click to select, ⇧-click or drag a
783
+ frame for several, drag to move with guides to the slide's edges and
784
+ middle and to the other boxes, resize from the corners (⇧ keeps the
785
+ proportions), rotate from the handle below, nudge with the arrows,
786
+ ⌘C/⌘V/⌘D, Delete, ⌘Z/⇧⌘Z. A double click types into a box where it
787
+ stands in the slide's own fonts, or opens the source of HTML, charts and
788
+ embeds beside the slide, which follows as you type.
789
+ - **Format.** The bar over a box sets font, size, bold, italic, alignment
790
+ and color; the Format panel adds position, rotation, alignment to the
791
+ slide, underline and strikethrough, text and fill colors (the theme's or
792
+ any), corners, border, shadow, opacity and how a picture fits; several
793
+ boxes align to each other; right click orders the layers. With nothing
794
+ selected it sets the slide's background, a color or a picture.
795
+ - **Insert.** Text, a picture (uploaded into `assets/`, or dropped onto
796
+ the slide), a chart, a table, shapes (rectangle, rounded, circle, line,
797
+ arrow, star), HTML, an embed, and the theme's pieces.
798
+ - **Design.** The design panel switches the theme with a preview of the
799
+ slide in each and takes CSS for this deck; slides carry their number
800
+ (`data-n`, `data-nn`, `data-of`) for the theme to show.
801
+ - **Agent.** "Ask an agent" under the slide opens a chat docked beside the
802
+ deck with the deck and the slide named; the agent edits `deck.md` and the
803
+ slide changes in front of you (the server watches an open deck's folder,
804
+ so an agent's save shows at once). "ask" on a box has one-click
805
+ requests: shorten, rewrite clearer, bullet points, make it a chart,
806
+ translate to English or German, speaker notes, or something else.
807
+ - **From a brief.** A new deck can start from what it is about, typed or
808
+ from notes files (md, txt, csv, json, html, yaml): the agent beside it
809
+ answers with the outline, then writes the slides in the theme while you
810
+ watch.
811
+ - **Review.** Comments on a slide or on one box (right click → Comment…,
812
+ or the comments button): a pin on the box, a count on the slide and in
813
+ the bar, answers, resolve and reopen. They live in `comments.json` beside
814
+ `deck.md`, pointing at the slide's `id:` (given when its first comment
815
+ lands), so they follow the slide when it moves. Agents read and resolve
816
+ them: `kraftwerk presentations comments|comment|resolve`.
817
+ - **Share.** Copy a link to the editor or to present mode (for anyone who
818
+ reaches this workspace: paired devices, members), or download the deck
819
+ as one HTML file that opens anywhere.
820
+ - **Several editors.** A person, an agent and another window can work on
821
+ one deck: every save names the version it was made on, a save over a
822
+ newer file is refused (409) and the editor merges slide by slide — both
823
+ sides' changes stay; a slide changed on both sides keeps theirs and says
824
+ so (⌘Z brings yours back).
825
+ - **Charts.** A chart opens as a data grid beside the slide: kind, title,
826
+ a row per category, a column per series (add, rename, remove); the
827
+ source tab shows the same block as YAML.
828
+ - **Version history.** Earlier versions of the deck are kept in
829
+ `.history/` beside `deck.md`: before saves (once a minute while you edit)
830
+ and whenever an agent or a tool changes the file; the newest 50 stay.
831
+ The history panel shows each version's slides and restores one as an
832
+ ordinary edit (⌘Z takes it back).
833
+ - **Transitions.** Each slide comes in with a fade (the default), a slide,
834
+ a zoom or a cut (`transition:` in its head, or the Format panel with
835
+ nothing selected); present mode and the HTML file play them, the
836
+ PowerPoint file gets fade, push and zoom.
837
+ - **Linked from tasks and chats.** A task's links (its `refs:`) take a
838
+ deck from a list; the chip opens it, and the agent working the task
839
+ gets the deck's folder with the task. In a chat, `presentation:` offers
840
+ the decks and the sent `presentation:<name>` links to the deck. The
841
+ deck's share menu copies that reference and lists the tasks that link
842
+ it.
843
+ - **Slide numbers.** On by default, drawn by the theme bottom right
844
+ (not on title and section slides). The Format panel with nothing
845
+ selected turns them off for the deck (`numbers: false` in the
846
+ headmatter) or for one slide (`number: false` in its head). The
847
+ PowerPoint file carries them as slide-number fields, so they keep
848
+ counting when slides move there.
849
+ - **Who else is here.** Everyone with the deck open (other people, other
850
+ tabs) shows as an avatar in the bar and a dot on the slide they are on;
851
+ the box they have selected is outlined in their color with their name.
852
+ Click an avatar to go to their slide. It lives in memory only and
853
+ follows the live connection: a closed tab is gone at once.
854
+ - **Present.** `…/present[/<n>]` full screen (arrows, space, Escape, N for
855
+ the notes, F for fullscreen, a clock); `…/presenter[/<n>]` is the
856
+ presenter view with the current and the next slide, the notes and the
857
+ clock. PowerPoint, PDF and HTML download from the bar.
858
+
859
+ **Agents and the deck.** A project chat and every agent see the project's
860
+ decks in their context with the format, the theme's pieces and the
861
+ commands; agents write `deck.md` directly, put pictures into `assets/`, and
862
+ look at the slide images `render --png` writes before handing the deck over.
863
+
689
864
  ## Contacts, places and events
690
865
 
691
866
  Who, where and when, kept by the workspace itself so people and agents can
package/dist/cli/init.js CHANGED
@@ -35,6 +35,7 @@ skills: ${DATA_DIR}/skills # workspace skills (shared instruction packag
35
35
  # places: # addresses and points of interest, one Markdown file each under ${DATA_DIR}/places — referenced as place:<slug> (uncomment to enable)
36
36
  # events: # dated one-off entries with place, contacts and project, one Markdown file each under ${DATA_DIR}/events — referenced as event:<slug> (uncomment to enable)
37
37
  # boards: # tasks as folders in columns (Draft, Todo, In progress, Review, Done) per project and under ${DATA_DIR}/boards — agents are woken when a task is assigned to them (uncomment to enable)
38
+ # presentations: # slide decks as folders (deck.md + assets) per project and under ${DATA_DIR}/presentations — rendered from a template into PPTX, PDF and slide images (uncomment to enable)
38
39
  # cloud: # the daemon registers this MACHINE with the kraftwerk cloud and lists this workspace (\`kraftwerk login\` claims the machine)
39
40
  # enabled: false # uncomment both lines to leave this workspace out (\`kraftwerk cloud off\` turns the cloud off for the whole machine)
40
41
  `;
@@ -14,6 +14,7 @@ import { runInit } from "./init.js";
14
14
  import { registerKnowledgeCommands } from "./knowledge.js";
15
15
  import { registerProjectCommands } from "./projects.js";
16
16
  import { registerBoardCommands } from "./boards.js";
17
+ import { registerPresentationCommands } from "./presentations.js";
17
18
  import { registerContactCommands, registerEventCommands, registerPlaceCommands, registerRefCommand } from "./entities.js";
18
19
  import { registerWorkspaceCommands } from "./workspaces.js";
19
20
  import { registerRepoCommands } from "./repos.js";
@@ -46,6 +47,7 @@ import { runUi } from "./ui.js";
46
47
  * kraftwerk workspaces ... known workspaces on this machine (list/start/stop/forget)
47
48
  * kraftwerk projects ... goal-scoped project folders (list/create/show/link/log/remove)
48
49
  * kraftwerk boards|tasks ... task boards per project or workspace: list/show/create; tasks list/show/create/move/assign/log/pick/remove
50
+ * kraftwerk presentations ... slide decks per project or workspace: list/show/create/check/render/remove/templates
49
51
  * kraftwerk contacts|places|events who, where and when: one Markdown file each (list/show/create/set/remove)
50
52
  * kraftwerk ref <kind:slug> resolve a reference (contact:anna-meier) or every one in a file
51
53
  * kraftwerk vibeables ... small apps built live in a chat (list/create/remove)
@@ -307,6 +309,7 @@ registerRoutineCommands(program);
307
309
  registerWorkspaceCommands(program);
308
310
  registerProjectCommands(program);
309
311
  registerBoardCommands(program);
312
+ registerPresentationCommands(program);
310
313
  registerContactCommands(program);
311
314
  registerPlaceCommands(program);
312
315
  registerEventCommands(program);
@@ -0,0 +1,2 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerPresentationCommands(program: Command): void;
@@ -0,0 +1,261 @@
1
+ import chalk from "chalk";
2
+ import Table from "cli-table3";
3
+ import { readFile } from "node:fs/promises";
4
+ import { createDeck, deleteDeck, exportDeck, getDeck, addComment, listComments, updateComment, initTemplate, listAllDecks, listDecks, listTemplates, } from "../core/presentations/index.js";
5
+ import { initContext as prepare } from "./routines.js";
6
+ import { fmtAgo } from "./workspaces.js";
7
+ /**
8
+ * kraftwerk presentations [list] [--project <slug>] [--all] [--json]
9
+ * kraftwerk presentations show <name> [--project <slug>] [--json] the slides, the template's layouts and slots, the warnings
10
+ * kraftwerk presentations create "<title>" [--project <slug>] [--slug <s>] [--template <t>] [--from <deck.md>]
11
+ * kraftwerk presentations check <name> [--project <slug>] warnings; exits 1 on errors
12
+ * kraftwerk presentations render <name> --pptx|--pdf|--png|--html [--out <dir>] [--width <px>] [--project <slug>]
13
+ * kraftwerk presentations comments <name> [--all] | comment <name> <slide> "<text>" [--slot <box>] | resolve <name> <id> [--reply "<text>"]
14
+ * kraftwerk presentations remove <name> [--project <slug>]
15
+ * kraftwerk presentations templates [--json]; templates init <slug> the templates; a copy of the built-in one to edit
16
+ *
17
+ * Agents write deck.md directly (show prints the folder) and look at the
18
+ * PNGs `render --png` writes. The CLI talks to core, not to the server.
19
+ */
20
+ const die = (msg) => {
21
+ console.error(chalk.red(msg));
22
+ process.exit(1);
23
+ };
24
+ const refOf = (name, project) => ({ ...(project?.trim() ? { project: project.trim() } : {}), name: name.trim() });
25
+ const printWarnings = (warnings) => {
26
+ for (const w of warnings) {
27
+ const where = `${w.slide ? `slide ${w.slide}` : "deck"}${w.slot ? ` · ${w.slot}` : ""}`;
28
+ console.log(`${w.level === "error" ? chalk.red("error") : chalk.yellow("warn ")} ${chalk.dim(where)} ${w.message}`);
29
+ }
30
+ };
31
+ function printDeck(d) {
32
+ console.log(`${chalk.bold(d.title)} ${chalk.dim(`(${d.project ? `${d.project}/` : ""}${d.name}, template ${d.template}, ${d.slides} slides)`)}`);
33
+ console.log(chalk.dim(`folder: ${d.path}`));
34
+ if (d.error)
35
+ console.log(chalk.red(`deck.md: ${d.error}`));
36
+ console.log(`\n${chalk.bold("slides")}`);
37
+ d.deck.slides.forEach((s, i) => {
38
+ const first = s.content.split("\n").find((l) => l.trim())?.replace(/^#+\s*/, "") ?? "";
39
+ console.log(` ${chalk.cyan(String(i + 1).padStart(3))} ${chalk.dim(`[${s.layout ?? "default"}]`)} ${first}${s.notes ? chalk.dim(" · notes") : ""}`);
40
+ });
41
+ console.log(`\n${chalk.bold("layouts")} ${chalk.dim(`of template ${d.template}`)}`);
42
+ for (const l of d.layouts)
43
+ console.log(` ${chalk.cyan(l.name.padEnd(12))} ${l.slots.map((s) => `${s.name}${s.required ? "*" : ""}:${s.kind}`).join(" ")}${l.description ? chalk.dim(` ${l.description}`) : ""}`);
44
+ if (d.theme.snippets.length)
45
+ console.log(`\n${chalk.bold("pieces")} ${chalk.dim(`of the theme (HTML for a slot; \`presentations show --json\` has the markup)`)}\n${d.theme.snippets.map((x) => ` ${chalk.cyan(x.name.padEnd(14))} ${chalk.dim(x.description ?? "")}`).join("\n")}`);
46
+ if (d.assets.length)
47
+ console.log(`\n${chalk.bold("assets")}\n${d.assets.map((a) => ` ${a}`).join("\n")}`);
48
+ if (d.exports.length)
49
+ console.log(`\n${chalk.bold("exports")}\n${d.exports.map((a) => ` exports/${a}`).join("\n")}`);
50
+ console.log(`\n${chalk.bold("warnings")}${d.warnings.length ? "" : chalk.dim(" (none)")}`);
51
+ printWarnings(d.warnings);
52
+ }
53
+ export function registerPresentationCommands(program) {
54
+ const cmd = program.command("presentations").alias("decks").description("Slide decks of a project or the workspace: list, show, create, check, render, remove, templates");
55
+ cmd
56
+ .command("list", { isDefault: true })
57
+ .description("List the decks: the workspace's, a project's (--project), or every one (--all)")
58
+ .option("--project <slug>", "A project's decks")
59
+ .option("--all", "Every deck of the workspace and its projects")
60
+ .option("--json", "Machine-readable output")
61
+ .action(async (opts) => {
62
+ await prepare();
63
+ const view = opts.all ? { enabled: true, presentations: await listAllDecks() } : await listDecks(opts.project);
64
+ if (opts.json) {
65
+ console.log(JSON.stringify(view, null, 2));
66
+ return;
67
+ }
68
+ if (!view.enabled)
69
+ die(("error" in view && view.error) || "presentations are off");
70
+ if ("error" in view && view.error)
71
+ die(view.error);
72
+ if (view.presentations.length === 0) {
73
+ console.log(chalk.dim(`No presentations ${opts.project ? `in project ${opts.project}` : opts.all ? "anywhere" : "in the workspace"} yet — \`kraftwerk presentations create "<title>"${opts.project ? ` --project ${opts.project}` : ""}\` starts one.`));
74
+ return;
75
+ }
76
+ const table = new Table({ head: ["deck", "where", "slides", "template", "changed"].map((h) => chalk.bold(h)) });
77
+ for (const p of view.presentations) {
78
+ table.push([`${chalk.cyan(p.title)}\n${chalk.dim(p.name)}`, p.project ? `project ${p.project}` : chalk.dim("workspace"), p.error ? chalk.red(p.error) : String(p.slides), p.template, chalk.dim(fmtAgo(p.updatedAt))]);
79
+ }
80
+ console.log(table.toString());
81
+ });
82
+ cmd
83
+ .command("show")
84
+ .description("One deck: its slides, the template's layouts and slots, the warnings")
85
+ .argument("<name>", "Deck name")
86
+ .option("--project <slug>", "The project the deck belongs to")
87
+ .option("--json", "Machine-readable output")
88
+ .action(async (name, opts) => {
89
+ await prepare();
90
+ const d = await getDeck(refOf(name, opts.project)).catch((err) => die(err.message));
91
+ if (!d)
92
+ return die(`no presentation "${name}"`);
93
+ if (opts.json)
94
+ console.log(JSON.stringify(d, null, 2));
95
+ else
96
+ printDeck(d);
97
+ });
98
+ cmd
99
+ .command("create")
100
+ .description("Create a deck: a starter deck.md, or one from a markdown file (--from)")
101
+ .argument("<title>", "Deck title")
102
+ .option("--project <slug>", "Create it in a project")
103
+ .option("--slug <name>", "Folder name (default: from the title)")
104
+ .option("--template <slug>", "Template (default: default)")
105
+ .option("--from <file>", "A deck.md to start from")
106
+ .option("--json", "Machine-readable output")
107
+ .action(async (title, opts) => {
108
+ await prepare();
109
+ const source = opts.from ? await readFile(opts.from, "utf8").catch(() => die(`cannot read ${opts.from}`)) : undefined;
110
+ const d = await createDeck({ ...(opts.project ? { project: opts.project } : {}), title, ...(opts.slug ? { slug: opts.slug } : {}), ...(opts.template ? { template: opts.template } : {}), ...(source ? { source } : {}) }).catch((err) => die(err.message));
111
+ if (opts.json) {
112
+ console.log(JSON.stringify(d, null, 2));
113
+ return;
114
+ }
115
+ console.log(`${chalk.green("created")} ${chalk.bold(d.title)} ${chalk.dim(`(${d.project ? `${d.project}/` : ""}${d.name})`)}`);
116
+ console.log(chalk.dim(`write ${d.path}/deck.md, pictures into ${d.path}/assets/`));
117
+ printWarnings(d.warnings);
118
+ });
119
+ cmd
120
+ .command("check")
121
+ .description("Check a deck against its template: every warning; exits 1 when there are errors")
122
+ .argument("<name>", "Deck name")
123
+ .option("--project <slug>", "The project the deck belongs to")
124
+ .option("--json", "Machine-readable output")
125
+ .action(async (name, opts) => {
126
+ await prepare();
127
+ const d = await getDeck(refOf(name, opts.project)).catch((err) => die(err.message));
128
+ if (!d)
129
+ return die(`no presentation "${name}"`);
130
+ if (opts.json)
131
+ console.log(JSON.stringify({ name: d.name, project: d.project, slides: d.slides, warnings: d.warnings }, null, 2));
132
+ else if (d.warnings.length === 0)
133
+ console.log(`${chalk.green("ok")} ${d.slides} slides, no warnings`);
134
+ else
135
+ printWarnings(d.warnings);
136
+ if (d.warnings.some((w) => w.level === "error"))
137
+ process.exit(1);
138
+ });
139
+ cmd
140
+ .command("render")
141
+ .description("Write the deck as PPTX, PDF, slide PNGs or one HTML file into its exports/ folder (or --out)")
142
+ .argument("<name>", "Deck name")
143
+ .option("--project <slug>", "The project the deck belongs to")
144
+ .option("--pptx", "PowerPoint file")
145
+ .option("--pdf", "PDF, one page per slide")
146
+ .option("--png", "One PNG per slide (exports/slides/NN.png) — look at them")
147
+ .option("--html", "One self-contained HTML file: present it in any browser, print it to PDF")
148
+ .option("--out <dir>", "Write there instead of exports/")
149
+ .option("--width <px>", "Image width for --png and --pdf (default 1280 / 1600)")
150
+ .option("--json", "Machine-readable output")
151
+ .action(async (name, opts) => {
152
+ await prepare();
153
+ const formats = ["pptx", "pdf", "png", "html"].filter((f) => opts[f]);
154
+ if (formats.length === 0)
155
+ die("say what to write: --pptx, --pdf, --png and/or --html");
156
+ const width = opts.width ? Number(opts.width) : undefined;
157
+ if (width !== undefined && !(width >= 160 && width <= 3840))
158
+ die("--width must be between 160 and 3840");
159
+ const files = [];
160
+ let warnings = [];
161
+ for (const format of formats) {
162
+ const r = await exportDeck(refOf(name, opts.project), format, { ...(opts.out ? { outDir: opts.out } : {}), ...(width ? { width } : {}) }).catch((err) => die(err.message));
163
+ files.push(...r.files);
164
+ warnings = r.warnings;
165
+ }
166
+ if (opts.json) {
167
+ console.log(JSON.stringify({ files, warnings }, null, 2));
168
+ return;
169
+ }
170
+ for (const f of files)
171
+ console.log(`${chalk.green("wrote")} ${f}`);
172
+ printWarnings(warnings);
173
+ });
174
+ /** Who writes: the session's actor (an agent), else human:user. */
175
+ const actor = () => (process.env.KRAFTWERK_ACTOR ?? "").trim() || "human:user";
176
+ cmd
177
+ .command("comments")
178
+ .description("The comments on a deck's slides and boxes: the open ones, or --all")
179
+ .argument("<name>", "Deck name")
180
+ .option("--project <slug>", "The project the deck belongs to")
181
+ .option("--all", "Resolved ones too")
182
+ .option("--json", "Machine-readable output")
183
+ .action(async (name, opts) => {
184
+ await prepare();
185
+ const all = await listComments(refOf(name, opts.project)).catch((err) => die(err.message));
186
+ const shown = opts.all ? all : all.filter((c) => !c.resolved);
187
+ if (opts.json) {
188
+ console.log(JSON.stringify({ comments: shown }, null, 2));
189
+ return;
190
+ }
191
+ if (!shown.length) {
192
+ console.log(chalk.dim(opts.all ? "no comments" : "no open comments"));
193
+ return;
194
+ }
195
+ for (const c of shown) {
196
+ console.log(`${chalk.cyan(c.id)} ${chalk.dim(`slide ${c.n ?? "?"}${c.slot ? ` · ${c.slot}` : ""} · ${c.author} · ${c.at.slice(0, 16).replace("T", " ")}${c.resolved ? " · resolved" : ""}`)}\n ${c.text}`);
197
+ for (const r of c.replies)
198
+ console.log(` ${chalk.dim(`↳ ${r.author}:`)} ${r.text}`);
199
+ }
200
+ });
201
+ cmd
202
+ .command("comment")
203
+ .description("Comment on slide n of a deck, or on one of its boxes (--slot)")
204
+ .argument("<name>", "Deck name")
205
+ .argument("<slide>", "Slide number")
206
+ .argument("<text>", "The comment")
207
+ .option("--project <slug>", "The project the deck belongs to")
208
+ .option("--slot <box>", "The box it is about")
209
+ .action(async (name, slide, text, opts) => {
210
+ await prepare();
211
+ const c = await addComment(refOf(name, opts.project), { slide: Number(slide), text, author: actor(), ...(opts.slot ? { slot: opts.slot } : {}) }).catch((err) => die(err.message));
212
+ console.log(`${chalk.green("commented")} ${c.id} on slide ${c.n}`);
213
+ });
214
+ cmd
215
+ .command("resolve")
216
+ .description("Resolve a comment, answering it with --reply")
217
+ .argument("<name>", "Deck name")
218
+ .argument("<id>", "Comment id (from `presentations comments`)")
219
+ .option("--project <slug>", "The project the deck belongs to")
220
+ .option("--reply <text>", "What was done about it")
221
+ .option("--reopen", "Open it again instead")
222
+ .action(async (name, id, opts) => {
223
+ await prepare();
224
+ await updateComment(refOf(name, opts.project), id, { resolved: !opts.reopen, author: actor(), ...(opts.reply ? { reply: opts.reply } : {}) }).catch((err) => die(err.message));
225
+ console.log(`${chalk.green(opts.reopen ? "reopened" : "resolved")} ${id}`);
226
+ });
227
+ cmd
228
+ .command("remove")
229
+ .description("Move a deck to the trash")
230
+ .argument("<name>", "Deck name")
231
+ .option("--project <slug>", "The project the deck belongs to")
232
+ .action(async (name, opts) => {
233
+ await prepare();
234
+ await deleteDeck(refOf(name, opts.project)).catch((err) => die(err.message));
235
+ console.log(`${chalk.green("removed")} ${name} ${chalk.dim("(in the trash)")}`);
236
+ });
237
+ const templates = cmd.command("templates").description("The templates: the built-in one and the workspace's (templates/<slug>/template.yml under the presentations root)");
238
+ templates
239
+ .command("list", { isDefault: true })
240
+ .description("List the templates with their layouts")
241
+ .option("--json", "Machine-readable output")
242
+ .action(async (opts) => {
243
+ await prepare();
244
+ const list = await listTemplates();
245
+ if (opts.json) {
246
+ console.log(JSON.stringify({ templates: list }, null, 2));
247
+ return;
248
+ }
249
+ for (const t of list)
250
+ console.log(`${chalk.cyan(t.slug.padEnd(14))} ${t.error ? chalk.red(t.error) : `${t.name} ${chalk.dim(`(${t.size}; layouts: ${t.layouts.join(", ")})`)}`}${t.builtin ? chalk.dim(" built-in") : t.path ? chalk.dim(` ${t.path}`) : ""}`);
251
+ });
252
+ templates
253
+ .command("init")
254
+ .description("Write a copy of the built-in template as a workspace template to edit")
255
+ .argument("<slug>", "Template name")
256
+ .action(async (slug) => {
257
+ await prepare();
258
+ const file = await initTemplate(slug).catch((err) => die(err.message));
259
+ console.log(`${chalk.green("wrote")} ${file}`);
260
+ });
261
+ }
@@ -110,6 +110,24 @@ export declare const ROUTES: {
110
110
  readonly "places.get": readonly ["GET", "/api/places/:slug"];
111
111
  readonly "places.list": readonly ["GET", "/api/places"];
112
112
  readonly "places.save": readonly ["PUT", "/api/places/:slug"];
113
+ readonly "presentations.comment": readonly ["POST", "/api/presentations/:name/comments"];
114
+ readonly "presentations.commentDelete": readonly ["DELETE", "/api/presentations/:name/comments/:id"];
115
+ readonly "presentations.commentSave": readonly ["PUT", "/api/presentations/:name/comments/:id"];
116
+ readonly "presentations.create": readonly ["POST", "/api/presentations"];
117
+ readonly "presentations.delete": readonly ["DELETE", "/api/presentations/:name"];
118
+ readonly "presentations.export": readonly ["GET", "/api/presentations/:name/export", "raw"];
119
+ readonly "presentations.file": readonly ["GET", "/api/presentations/:name/file", "raw"];
120
+ readonly "presentations.get": readonly ["GET", "/api/presentations/:name"];
121
+ readonly "presentations.history": readonly ["GET", "/api/presentations/:name/history"];
122
+ readonly "presentations.links": readonly ["GET", "/api/presentations/:name/links"];
123
+ readonly "presentations.list": readonly ["GET", "/api/presentations"];
124
+ readonly "presentations.presence": readonly ["POST", "/api/presentations/:name/presence"];
125
+ readonly "presentations.save": readonly ["PUT", "/api/presentations/:name"];
126
+ readonly "presentations.slide": readonly ["GET", "/api/presentations/:name/slides/:n", "raw"];
127
+ readonly "presentations.templateFile": readonly ["GET", "/api/presentations/templates/:slug/file", "raw"];
128
+ readonly "presentations.templates": readonly ["GET", "/api/presentations/templates"];
129
+ readonly "presentations.upload": readonly ["POST", "/api/presentations/:name/assets", "upload"];
130
+ readonly "presentations.version": readonly ["GET", "/api/presentations/:name/history/:id"];
113
131
  readonly "projects.create": readonly ["POST", "/api/projects"];
114
132
  readonly "projects.delete": readonly ["DELETE", "/api/projects/:slug"];
115
133
  readonly "projects.get": readonly ["GET", "/api/projects/:slug"];
@@ -111,6 +111,24 @@ export const ROUTES = {
111
111
  "places.get": ["GET", "/api/places/:slug"],
112
112
  "places.list": ["GET", "/api/places"],
113
113
  "places.save": ["PUT", "/api/places/:slug"],
114
+ "presentations.comment": ["POST", "/api/presentations/:name/comments"],
115
+ "presentations.commentDelete": ["DELETE", "/api/presentations/:name/comments/:id"],
116
+ "presentations.commentSave": ["PUT", "/api/presentations/:name/comments/:id"],
117
+ "presentations.create": ["POST", "/api/presentations"],
118
+ "presentations.delete": ["DELETE", "/api/presentations/:name"],
119
+ "presentations.export": ["GET", "/api/presentations/:name/export", "raw"],
120
+ "presentations.file": ["GET", "/api/presentations/:name/file", "raw"],
121
+ "presentations.get": ["GET", "/api/presentations/:name"],
122
+ "presentations.history": ["GET", "/api/presentations/:name/history"],
123
+ "presentations.links": ["GET", "/api/presentations/:name/links"],
124
+ "presentations.list": ["GET", "/api/presentations"],
125
+ "presentations.presence": ["POST", "/api/presentations/:name/presence"],
126
+ "presentations.save": ["PUT", "/api/presentations/:name"],
127
+ "presentations.slide": ["GET", "/api/presentations/:name/slides/:n", "raw"],
128
+ "presentations.templateFile": ["GET", "/api/presentations/templates/:slug/file", "raw"],
129
+ "presentations.templates": ["GET", "/api/presentations/templates"],
130
+ "presentations.upload": ["POST", "/api/presentations/:name/assets", "upload"],
131
+ "presentations.version": ["GET", "/api/presentations/:name/history/:id"],
114
132
  "projects.create": ["POST", "/api/projects"],
115
133
  "projects.delete": ["DELETE", "/api/projects/:slug"],
116
134
  "projects.get": ["GET", "/api/projects/:slug"],
package/dist/config.d.ts CHANGED
@@ -153,6 +153,20 @@ export declare const BOARDS_DEFAULT_ROOT = "kraftwerk-data/boards";
153
153
  /** Absolute workspace boards root when the feature is on, undefined otherwise. */
154
154
  export declare function boardsRootFor(project: ResolvedWorkspace): string | undefined;
155
155
  export type EntityKind = (typeof ENTITY_KINDS)[number];
156
+ /**
157
+ * Presentations: slide decks as folders (deck.md, assets/, exports/) under a
158
+ * project (projects/<p>/presentations/) or the workspace root below. Part of
159
+ * the workspace and synced by the workspace git.
160
+ */
161
+ export interface PresentationsConfig {
162
+ /** false keeps the block but turns the feature off. Default: true. */
163
+ enabled?: boolean;
164
+ /** Where the workspace decks (and templates/) live, relative to the project root. Default: kraftwerk-data/presentations */
165
+ root?: string;
166
+ }
167
+ export declare const PRESENTATIONS_DEFAULT_ROOT = "kraftwerk-data/presentations";
168
+ /** Absolute workspace presentations root when the feature is on, undefined otherwise. */
169
+ export declare function presentationsRootFor(project: ResolvedWorkspace): string | undefined;
156
170
  /** Where a kind's files live when its `root` is not set. */
157
171
  export declare const entityDefaultRoot: (kind: EntityKind) => string;
158
172
  /** Absolute root of a kind when its feature is on, undefined otherwise. */
@@ -237,6 +251,8 @@ export interface WorkspaceConfig {
237
251
  events?: EntitiesConfig;
238
252
  /** Boards: tasks as folders in columns, per project and workspace-wide. Absent = off. */
239
253
  boards?: BoardsConfig;
254
+ /** Presentations: slide decks as folders, per project and workspace-wide. Absent = off. */
255
+ presentations?: PresentationsConfig;
240
256
  /** The machine's cloud record lists this workspace. Absent = listed; `enabled: false` leaves it out. */
241
257
  cloud?: CloudConfig;
242
258
  }
package/dist/config.js CHANGED
@@ -105,6 +105,14 @@ export function boardsRootFor(project) {
105
105
  return undefined;
106
106
  return path.resolve(project.root, b.root ?? BOARDS_DEFAULT_ROOT);
107
107
  }
108
+ export const PRESENTATIONS_DEFAULT_ROOT = "kraftwerk-data/presentations";
109
+ /** Absolute workspace presentations root when the feature is on, undefined otherwise. */
110
+ export function presentationsRootFor(project) {
111
+ const b = project.config.presentations;
112
+ if (!b || b.enabled === false)
113
+ return undefined;
114
+ return path.resolve(project.root, b.root ?? PRESENTATIONS_DEFAULT_ROOT);
115
+ }
108
116
  /** Where a kind's files live when its `root` is not set. */
109
117
  export const entityDefaultRoot = (kind) => `kraftwerk-data/${kind}`;
110
118
  /** Absolute root of a kind when its feature is on, undefined otherwise. */
@@ -249,7 +257,7 @@ export async function addWorkspaceId(configPath) {
249
257
  await writeFile(configPath, out);
250
258
  return id;
251
259
  }
252
- const KNOWN_KEYS = ["id", "name", "slug", "icon", "color", "port", "workflows", "output", "knowledge", "agents", "skills", "switcher", "git", "repos", "vibeables", "projects", "contacts", "places", "events", "boards", "cloud"];
260
+ const KNOWN_KEYS = ["id", "name", "slug", "icon", "color", "port", "workflows", "output", "knowledge", "agents", "skills", "switcher", "git", "repos", "vibeables", "projects", "contacts", "places", "events", "boards", "presentations", "cloud"];
253
261
  /**
254
262
  * Keys an older kraftwerk understood and this one ignores, so the files
255
263
  * that still carry them keep loading: `public:` and `tunnel:` (the
@@ -316,7 +324,7 @@ async function loadConfig(configPath) {
316
324
  config[key] = {};
317
325
  validateRootBlock(configPath, "vibeables", config[key]);
318
326
  }
319
- else if (key === "projects" || key === "contacts" || key === "places" || key === "events") {
327
+ else if (key === "projects" || key === "contacts" || key === "places" || key === "events" || key === "presentations") {
320
328
  if (config[key] === null)
321
329
  config[key] = {};
322
330
  validateRootBlock(configPath, key, config[key]);
@@ -252,5 +252,18 @@ export declare function noteTaskFile(reference: string, what: "added" | "removed
252
252
  * and the unassigned ones in the pick column.
253
253
  */
254
254
  export declare function boardsContext(project: string | undefined, actor: string, agent?: string): Promise<string>;
255
- /** The block a session gets when it was opened for one task: the task, its files and its whole log. */
255
+ /** A task that links something, as the linked thing's page lists it. */
256
+ export interface LinkingTask {
257
+ ref: string;
258
+ number: number;
259
+ title: string;
260
+ status: string;
261
+ assignee?: string;
262
+ board: string;
263
+ project?: string;
264
+ /** The task's page (a hash route). */
265
+ href: string;
266
+ }
267
+ /** Every task whose refs name the token (presentation:town-hall), across the workspace's boards. */
268
+ export declare function tasksReferencing(token: string): Promise<LinkingTask[]>;
256
269
  export declare function taskContext(reference: string): Promise<string>;