@powerhousedao/academy 5.1.0-staging.0 → 5.1.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 (76) hide show
  1. package/CHANGELOG.md +46 -1148
  2. package/blog/BeyondCommunication-ABlueprintForDevelopment.md +1 -2
  3. package/blog/TheChallengeOfChange.md +0 -1
  4. package/docs/academy/00-EthereumArgentinaHackathon.md +207 -0
  5. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +27 -24
  6. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +10 -155
  7. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +35 -122
  8. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +155 -178
  9. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +218 -0
  10. package/docs/academy/{02-MasteryTrack/01-BuilderEnvironment → 01-GetStarted}/05-VetraStudio.md +22 -62
  11. package/docs/academy/01-GetStarted/06-ReactorMCP.md +58 -0
  12. package/docs/academy/01-GetStarted/_04-BuildToDoListEditor +1 -1
  13. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +2 -2
  14. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +44 -75
  15. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +22 -28
  16. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +31 -28
  17. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +206 -211
  18. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +62 -176
  19. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +0 -21
  20. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +319 -309
  21. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +0 -4
  22. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +0 -4
  23. package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -1
  24. package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +35 -111
  25. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +79 -195
  26. package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +241 -435
  27. package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +27 -388
  28. package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +7 -95
  29. package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
  30. package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +2 -6
  31. package/docs/academy/04-APIReferences/01-ReactHooks.md +501 -291
  32. package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +39 -7
  33. package/docs/academy/05-Architecture/02-ReferencingMonorepoPackages +65 -0
  34. package/docs/academy/05-Architecture/04-MovingBeyondCRUD +61 -0
  35. package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +24 -72
  36. package/docs/academy/08-Glossary.md +0 -7
  37. package/docusaurus.config.ts +3 -28
  38. package/package.json +1 -1
  39. package/sidebars.ts +13 -49
  40. package/src/css/custom.css +18 -26
  41. package/docs/academy/01-GetStarted/04-WriteDocumentModelTests.md +0 -425
  42. package/docs/academy/01-GetStarted/05-BuildToDoListEditor.md +0 -557
  43. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/images/Modules.png +0 -0
  44. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/images/VetraStudioDrive.png +0 -0
  45. package/docs/academy/02-MasteryTrack/05-Launch/05-DockerDeployment.md +0 -384
  46. package/docs/academy/03-ExampleUsecases/TodoList/00-GetTheStarterCode.md +0 -24
  47. package/docs/academy/03-ExampleUsecases/TodoList/01-GenerateTodoListDocumentModel.md +0 -211
  48. package/docs/academy/03-ExampleUsecases/TodoList/02-ImplementTodoListDocumentModelReducerOperationHandlers.md +0 -171
  49. package/docs/academy/03-ExampleUsecases/TodoList/03-AddTestsForTodoListActions.md +0 -462
  50. package/docs/academy/03-ExampleUsecases/TodoList/04-GenerateTodoListDocumentEditor.md +0 -45
  51. package/docs/academy/03-ExampleUsecases/TodoList/05-ImplementTodoListDocumentEditorUIComponents.md +0 -422
  52. package/docs/academy/03-ExampleUsecases/TodoList/06-GenerateTodoDriveExplorer.md +0 -61
  53. package/docs/academy/03-ExampleUsecases/TodoList/07-AddSharedComponentForShowingTodoListStats.md +0 -384
  54. package/docs/academy/03-ExampleUsecases/TodoList/_category_.json +0 -8
  55. package/docs/academy/03-ExampleUsecases/VetraPackageLibrary/VetraPackageLibrary.md +0 -7
  56. package/docs/academy/03-ExampleUsecases/VetraPackageLibrary/_category_.json +0 -9
  57. package/docs/academy/04-APIReferences/06-VetraRemoteDrive.md +0 -160
  58. package/docs/academy/04-APIReferences/renown-sdk/00-Overview.md +0 -316
  59. package/docs/academy/04-APIReferences/renown-sdk/01-Authentication.md +0 -672
  60. package/docs/academy/04-APIReferences/renown-sdk/02-APIReference.md +0 -957
  61. package/docs/academy/04-APIReferences/renown-sdk/_category_.json +0 -8
  62. package/docs/academy/10-TodoListTutorial/02-ImplementTodoListDocumentModelReducerOperationHandlers.md +0 -171
  63. package/docs/academy/10-TodoListTutorial/03-AddTestsForTodoListActions.md +0 -462
  64. package/docs/academy/10-TodoListTutorial/05-ImplementTodoListDocumentEditorUIComponents.md +0 -422
  65. package/docs/academy/10-TodoListTutorial/07-AddSharedComponentForShowingTodoListStats.md +0 -370
  66. package/static/img/Vetra-logo-dark.svg +0 -11
  67. package/static/img/vetra-logo-light.svg +0 -11
  68. /package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/{02-RevisionHistoryTimeline/360/237/232/247" → 02-RevisionHistoryTimeline} +0 -0
  69. /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /01-WhatIsADocumentModel" → 01-WhatIsADocumentModel} +0 -0
  70. /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /02-DAOandDocumentsModelsQ+A" → 02-DAOandDocumentsModelsQ+A} +0 -0
  71. /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /02-domain-modeling" → 02-domain-modeling} +0 -0
  72. /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /03-BenefitsOfDocumentModels" → 03-BenefitsOfDocumentModels} +0 -0
  73. /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /04-UtilitiesAndTips" → 04-UtilitiesAndTips} +0 -0
  74. /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /05-best-practices" → 05-best-practices} +0 -0
  75. /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /_category_.json" → _category_.json} +0 -0
  76. /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /three-data-layers.png" → three-data-layers.png} +0 -0
@@ -0,0 +1,218 @@
1
+ # Build a to-do list editor
2
+
3
+ In this chapter we will continue with the interface or editor implementation of the **To-do List** document model. This means you will create a simple user interface for the **To-do List** document model which will be used inside the Connect app to create, update and delete your ToDoList items.
4
+
5
+ ## Generate the editor template
6
+
7
+ Run the command below to generate the editor template for the **To-do List** document model.
8
+ This command reads the **To-do List** document model definition from the `document-models` folder and generates the editor template in the `editors/to-do-list` folder as `editor.tsx`.
9
+
10
+ Notice the `--editor` flag which specifies the **To-do List** document model, and the `--document-types` flag defines the document type `powerhouse/todolist`.
11
+
12
+ ```bash
13
+ ph generate --editor ToDoList --document-types powerhouse/todolist
14
+ ```
15
+
16
+ Once complete, navigate to the `editors/to-do-list/editor.tsx` file and open it in your editor.
17
+
18
+ ### Editor implementation options
19
+
20
+ When building your editor component within the Powerhouse ecosystem, you have several options for styling, allowing you to leverage your preferred methods:
21
+
22
+ 1. **Default HTML Styling:** Standard HTML tags (`<h1>`, `<p>`, `<button>`, etc.) will render with default styles offered through the boilerplate.
23
+ 2. **Tailwind CSS:** Connect Studio comes with Tailwind CSS integrated. You can directly use Tailwind utility classes for rapid, consistent styling without writing separate CSS files.
24
+ 3. **Custom CSS Files:** You can import traditional CSS files (`.css`) to apply custom styles or integrate existing style libraries.
25
+
26
+ Connect Studio provides a dynamic local environment, by running `ph connect` to visualize your components instantly as you build them, regardless of the styling method you choose.
27
+ Manual build steps are typically only needed when publishing packages.
28
+
29
+ ## To-do List editor
30
+
31
+ Below is the complete code for the To-Do List editor. Paste this code in `editors/to-do-list/editor.tsx`.
32
+
33
+ <details>
34
+ <summary>Complete ToDoList Editor Example (using Tailwind CSS)</summary>
35
+
36
+ ```typescript
37
+ import { EditorProps } from 'document-model';
38
+ import {
39
+ ToDoListState,
40
+ ToDoListAction,
41
+ ToDoListLocalState,
42
+ ToDoItem,
43
+ actions,
44
+ ToDoListDocument,
45
+ } from '../../document-models/to-do-list/index.js';
46
+ import { useState } from 'react';
47
+
48
+ // EditorProps is a generic type that provides the document and a dispatch function.
49
+ // The dispatch function is used to send actions to the document's reducer to update the state.
50
+ export type IProps = EditorProps<ToDoListDocument>;
51
+
52
+ export default function Editor(props: IProps) {
53
+ // Destructure document and dispatch from props.
54
+ const { document, dispatch } = props;
55
+ // Get the global state from the document. This state is shared across all editors of this document.
56
+ const {
57
+ state: { global: state },
58
+ } = document;
59
+
60
+ // React's useState hook is used for local component state.
61
+ // This state is not shared with other components.
62
+ // `todoItem` stores the text of the new to-do item being added.
63
+ const [todoItem, setTodoItem] = useState('');
64
+ // `editingItemId` stores the ID of the item currently being edited.
65
+ const [editingItemId, setEditingItemId] = useState<string | null>(null);
66
+ // `editedText` stores the text of the item while it's being edited.
67
+ const [editedText, setEditedText] = useState('');
68
+
69
+ return (
70
+ <div className="p-4 font-sans max-w-lg mx-auto">
71
+ <h1 className="text-2xl font-bold mb-4 text-center">To-do List</h1>
72
+ <div className="w-96 mx-auto">
73
+ <div className="flex mb-4">
74
+ <input
75
+ className="border border-gray-300 p-2 rounded-l-md flex-grow"
76
+ placeholder="Insert task here..."
77
+ value={todoItem}
78
+ onChange={e => setTodoItem(e.target.value)}
79
+ onKeyDown={e => {
80
+ if (e.key === 'Enter') {
81
+ // Dispatch an action to add a new to-do item.
82
+ // `actions.addTodoItem` is an action creator from our document model.
83
+ dispatch(
84
+ actions.addTodoItem({
85
+ id: Math.random().toString(), // In a real app, use a more robust ID generation.
86
+ text: todoItem,
87
+ })
88
+ );
89
+ setTodoItem('');
90
+ }
91
+ }}
92
+ />
93
+ <button
94
+ className="bg-blue-500 hover:bg-blue-600 text-white p-2 rounded-r-md"
95
+ onClick={() => {
96
+ // Also add item on button click.
97
+ dispatch(
98
+ actions.addTodoItem({
99
+ id: Math.random().toString(),
100
+ text: todoItem,
101
+ })
102
+ );
103
+ setTodoItem('');
104
+ }}
105
+ >
106
+ Add
107
+ </button>
108
+ </div>
109
+ <ul className="list-none p-0">
110
+ {/* Map over the items in the global state to render each to-do item. */}
111
+ {state.items.map((item: ToDoItem) => (
112
+ <li
113
+ key={item.id}
114
+ className="flex items-center p-2 relative border-b border-gray-200"
115
+ >
116
+ <input
117
+ type="checkbox"
118
+ checked={item.checked}
119
+ className="mr-3"
120
+ onChange={() => {
121
+ // Dispatch an action to update the checked status of an item.
122
+ dispatch(
123
+ actions.updateTodoItem({
124
+ id: item.id,
125
+ checked: !item.checked,
126
+ })
127
+ );
128
+ }}
129
+ />
130
+ {/* Conditional rendering: show an input field if the item is being edited, otherwise show the text. */}
131
+ {editingItemId === item.id ? (
132
+ <input
133
+ value={editedText}
134
+ onChange={e =>
135
+ setEditedText(e.target.value)
136
+ }
137
+ onKeyDown={e => {
138
+ if (e.key === 'Enter') {
139
+ // Dispatch an action to update the item's text.
140
+ dispatch(
141
+ actions.updateTodoItem({
142
+ id: item.id,
143
+ text: editedText,
144
+ })
145
+ );
146
+ // Exit editing mode.
147
+ setEditingItemId(null);
148
+ }
149
+ }}
150
+ className="flex-grow"
151
+ autoFocus // Automatically focus the input when it appears.
152
+ />
153
+ ) : (
154
+ <div className="flex items-center flex-grow gap-1">
155
+ <span
156
+ onClick={() => {
157
+ // Enter editing mode when the text is clicked.
158
+ setEditingItemId(item.id);
159
+ setEditedText(item.text);
160
+ }}
161
+ className={`cursor-pointer ${
162
+ item.checked
163
+ ? 'line-through text-gray-500'
164
+ : ''
165
+ }`}
166
+ >
167
+ {item.text}
168
+ </span>
169
+ <span
170
+ onClick={() =>
171
+ dispatch(
172
+ actions.deleteTodoItem({
173
+ id: item.id,
174
+ })
175
+ )
176
+ }
177
+ className="text-gray-400 cursor-pointer opacity-40 transition-all duration-200 text-base font-bold inline-flex items-center pl-1 hover:opacity-100 hover:text-red-500"
178
+ >
179
+ ×
180
+ </span>
181
+ </div>
182
+ )}
183
+ </li>
184
+ ))}
185
+ </ul>
186
+ </div>
187
+ </div>
188
+ );
189
+ }
190
+ ```
191
+
192
+ </details>
193
+
194
+ Now you can run the Connect app and see the **To-do List** editor in action.
195
+
196
+ ```bash
197
+ ph connect
198
+ ```
199
+
200
+ In Connect, in the bottom right corner you'll find a new Document Model that you can create: **To-do List**.
201
+ Click on it to create a new To-do List document.
202
+
203
+ :::info
204
+ The editor will update dynamically, so you can play around with your editor styling while seeing your results appear in Connect Studio.
205
+ :::
206
+
207
+ Congratulations!
208
+ If you managed to follow this tutorial until this point, you have successfully implemented the **To-do List** document model with its reducer operations and editor.
209
+
210
+ ### Up next: Mastery Track
211
+
212
+ In the [Mastery Track chapther: Document Model Creation](/academy/MasteryTrack/DocumentModelCreation/WhatIsADocumentModel) we guide you through the theoretics of the previous steps while created a more advanced version of the To-do List.
213
+
214
+ You will learn:
215
+
216
+ - The in's & out's of a document model.
217
+ - How to use UI & Scalar components from the Document Engineering system.
218
+ - How to build Custom Drive Apps or Drive Explorers.
@@ -1,13 +1,26 @@
1
- # Vetra Studio
1
+ # Tool: Vetra Studio
2
+
3
+ :::tip Important
4
+
5
+ ## Vision: Specification Driven AI
6
+
7
+ In the **'Get Started'** chapter we've been making use of strict schema definition principles to communicate the intended use case of our reactive documents.
8
+ The **schema definition language**, is a not only a shared language that bridges the gap between developer, designer and analyst but also the gap between builder and AI-agent through **specification driven AI control**.
9
+
10
+ - Communicate your solution and intent through a structured specification framework designed for AI collaboration.
11
+ - Specifications enable precise, iterative edits, since all our specification documents are machine-readable and executable.
12
+ :::
2
13
 
3
14
  ## Introducing Vetra Studio
4
15
 
5
- - **Vetra Studio Drive**: Serves as a hub for developers to access, manage & share specification through a remote Vetra drive. It functions as the orchestration hub where you as a builder assemble all the necessary specifications for your intended use-case, software solution or package. For each of the different **modules** that together form a package a
6
- - **Vetra Package Library**: Store, publish and fork git repositories of packages in the Vetra Package Library.
7
- Visit the [Vetra Package Library here](https://vetra.io/packages)
16
+ **Vetra Studio Drive**: Serves as a hub for developers to access, manage & share specification through a remote Vetra drive.
17
+ **Vetra Package Library**: Store, publish and fork git repositories of packages in the Vetra Package Library.
18
+ Visit the [Vetra Package Library here](https://vetra.io/packages)
19
+
20
+ **Vetra Studio Drive** functions as the orchestration hub where you as a builder assemble all the necessary specifications for your intended use-case, software solution or package. For each of the different **modules** that together form a package a **specification document** can be created in Vetra Studio Drive.
8
21
 
9
22
  As Vetra Studio matures each of these specification documents will offer an interface by which you as a builder get more control over the modules that make up your package.
10
- For now the specification documents offer you a template for code generation.
23
+ For now they offer you a template for code generation.
11
24
 
12
25
  <figure className="image-container">
13
26
  <img
@@ -64,28 +77,6 @@ You could then add the specific remote Vetra drive to your powerhouse configurat
64
77
 
65
78
  An example of a builder team building on the Powerhouse Vetra Ecosystem and it's complementary Vetra Studio Drive specifications for the different packages be found [here](https://vetra.io/builders/bai)
66
79
 
67
- <details>
68
- <summary>📦 Vetra Remote Drive Commands</summary>
69
-
70
- Remote drives enable collaborative development by syncing specifications across team members.
71
-
72
- **Key Commands:**
73
- - `ph init --remote-drive <url>` - Create a NEW project connected to a remote drive
74
- - `ph checkout --remote-drive <url>` - Clone an EXISTING project from a remote drive
75
- - `ph vetra --watch` - Start development with a preview drive for testing local changes
76
-
77
- **Workflows:**
78
- - **Project Owner**: `ph init --remote-drive` → Create GitHub repo → Push → `ph vetra` to configure
79
- - **Collaborator**: `ph checkout --remote-drive` → `ph vetra` to start developing
80
-
81
- **Preview Drive (`--watch` mode):**
82
- - Main "Vetra" drive syncs with remote and contains stable package configuration
83
- - "Vetra Preview" drive is created locally for testing document models before syncing
84
-
85
- → [Full Vetra Remote Drive Reference](/academy/APIReferences/VetraRemoteDrive)
86
-
87
- </details>
88
-
89
80
  ## Vetra Studio Workflow
90
81
 
91
82
  ### 1. Launch Vetra Studio
@@ -129,17 +120,6 @@ In standard mode:
129
120
 
130
121
  Vetra Studio integrates deeply with Claude through MCP (Model Control Protocol). This is where AI comes into the mix and you get the chance to have greater control and direction over what your llm is coding for you.
131
122
 
132
- <details>
133
- <summary>**Specification Driven AI**</summary>
134
-
135
- In the **'Get Started'** chapter we've been making use of strict schema definition principles to communicate the intended use case of our reactive documents.
136
- The **schema definition language**, is a not only a shared language that bridges the gap between developer, designer and analyst but also the gap between builder and AI-agent through **specification driven AI control**.
137
-
138
- - Communicate your solution and intent through a structured specification framework designed for AI collaboration.
139
- - Specifications enable precise, iterative edits, since all our specification documents are machine-readable and executable.
140
-
141
- </details>
142
-
143
123
  #### 1. Start the Reactor MCP:
144
124
 
145
125
  Make sure you are in the same directory as your project.
@@ -166,35 +146,16 @@ Connected to MCP successfully! I can see there's a
166
146
  running and ready for document model operations.
167
147
  ```
168
148
 
169
- <details>
170
- <summary>🤖 Reactor MCP Overview</summary>
149
+ - To learn what is a [Reactor](apps/academy/docs/academy/Architecture/WorkingWithTheReactor) read the reactor article
150
+ - To learn more about the [Reactor MCP](apps/academy/docs/academy/GetStarted/ReactorMCP) read the reactor MCP article
171
151
 
172
152
  ### Key Reactor MCP Features
173
153
 
174
- **Reactor-mcp** is a Model Context Protocol (MCP) server that bridges AI agents with Powerhouse document operations.
175
-
176
154
  - It supports automatic document model creation from natural language descriptions
177
155
  - It implements a smart editor based on the underlying document models
178
156
  - It automatically triggers code generation when documents reach valid state
179
- - The MCP server enables the agent to work with both existing and newly created document models
180
- - Vetra supports integration with custom remote drives, allowing users to create, share and manage documents within these drives
181
-
182
- **Document Operations:**
183
- - `createDocument` / `getDocument` / `deleteDocument` - Manage documents
184
- - `addActions` - Modify document state through operations
185
-
186
- **Drive Operations:**
187
- - `getDrives` / `addDrive` / `getDrive` - Manage document drives
188
- - `addRemoteDrive` - Connect to remote drives
189
-
190
- **Document Model Operations:**
191
- - `getDocumentModels` - List available document model types
192
- - `getDocumentModelSchema` - Get schema for specific models
193
-
194
- **Document Model Agent:**
195
- A specialized AI agent that guides users through document model creation with requirements gathering, design confirmation, and implementation including state schema definition, operation creation, and code generation.
196
-
197
- </details>
157
+ - The MCP server enables the agent to work with both existing and newly created document models.
158
+ - Vetra supports integration with custom remote drives, allowing users to create, share and manage documents within these drives.
198
159
 
199
160
 
200
161
  ### 3. Vetra Studio Package Creation Workflow
@@ -250,4 +211,3 @@ Support for:
250
211
  - Verify implementation details in generated code before continuing.
251
212
  - Always double-check proposed next actions
252
213
 
253
-
@@ -0,0 +1,58 @@
1
+ # Tool: Reactor MCP
2
+
3
+ **Reactor-mcp** is a Model Context Protocol (MCP) server for the Powerhouse ecosystem that provides AI agents and tools with structured access to document model operations.
4
+ It serves as a bridge between AI systems and the Powerhouse document management infrastructure.
5
+
6
+ ## Main Functions of the Reactor-mcp
7
+
8
+ **Document Operations**:
9
+ - createDocument - Create new documents
10
+ - getDocument - Retrieve documents by ID
11
+ - addActions - Add actions to modify document state
12
+ - deleteDocument - Remove documents
13
+
14
+ **Drive Operations**:
15
+ - getDrives - List all document drives
16
+ - addDrive - Create new drives
17
+ - getDrive - Retrieve specific drives
18
+ - addRemoteDrive - Connect to remote drives
19
+
20
+ **Document Model Operations**:
21
+ - getDocumentModels - List available document model types
22
+ - getDocumentModelSchema - Get schema for specific document models
23
+
24
+ <details>
25
+ <summary>Architecture Context</summary>
26
+
27
+ Within the broader Powerhouse ecosystem:
28
+
29
+ - Document Model: Defines structure and operations for document types
30
+ - Document Drive: Manages collections of documents with sync capabilities
31
+ - Reactor-MCP: Provides AI/tool access to document operations
32
+ - Connect/Switchboard: User interfaces and synchronization servers
33
+
34
+ The reactor-mcp essentially makes the sophisticated document model system accessible to AI agents and external tools through a standardized protocol, enabling programmatic document creation, modification, and management within the Powerhouse ecosystem.
35
+
36
+ </details>
37
+
38
+ ### Document Model Agent
39
+
40
+ Alongside the MCP is a **specialized AI agent** for document model creation:
41
+
42
+ - Purpose: Guide users through creating document models
43
+ - Workflow: Requirements gathering → Design confirmation → Implementation
44
+ - Tools: Comprehensive set of MCP tools for model management
45
+ - Capabilities:
46
+ - State schema definition
47
+ - Operation creation
48
+ - Module organization
49
+ - Code generation
50
+
51
+ :::tip Supports with:
52
+
53
+ 1. **AI-Assisted Document Model Creation**: AI agents can use the MCP tools to help users create and modify document models
54
+ 2. **Automated Document Management**: Programmatic creation and management of documents and drives
55
+ 3. **Integration with AI Tools**: Claude, GPT, or other AI systems can use this as an MCP server to interact with Powerhouse
56
+ 4. **Development Tooling**: CLI and development server for working with document models locally
57
+ :::
58
+
@@ -10,7 +10,7 @@ This command reads the **To-do List** document model definition from the `docume
10
10
  Notice the `--editor` flag which specifies the **To-do List** document model, and the `--document-types` flag defines the document type `powerhouse/todolist`.
11
11
 
12
12
  ```bash
13
- pnpm generate --editor Todo-List-editor --document-types powerhouse/todolist
13
+ ph generate --editor ToDoList --document-types powerhouse/todolist
14
14
  ```
15
15
 
16
16
  Once complete, navigate to the `editors/to-do-list/editor.tsx` file and open it in your editor.
@@ -1,6 +1,6 @@
1
- # Vetra builder tooling
1
+ # Powerhouse builder tooling
2
2
 
3
- This page provides an overview of all the builder tooling offered in the Vetra ecosystem by Powerhouse.
3
+ This page provides an overview of all the builder tooling offered by the Powerhouse ecosystem.
4
4
  This list will be maintained and updated as our toolkit grows.
5
5
 
6
6
  ## Powerhouse command line interface
@@ -1,19 +1,19 @@
1
1
  # Specify the state schema
2
2
 
3
- The state schema is the backbone of your document model. It defines the structure, data types, and relationships of the information your document will hold. In Powerhouse, we use the **GraphQL Schema Definition Language (SDL)** to define this schema. A well-defined state schema is crucial for ensuring data integrity, consistency, and for enabling powerful querying and manipulation capabilities.
3
+ The state schema is the backbone of your document model. It defines the structure, data types, and relationships of the information your document will hold. In Powerhouse, we use the GraphQL Schema Definition Language (SDL) to define this schema. A well-defined state schema is crucial for ensuring data integrity, consistency, and for enabling powerful querying and manipulation capabilities.
4
4
 
5
5
  ## Core concepts
6
6
 
7
7
  ### Types
8
8
 
9
- At the heart of GraphQL SDL are **types**. Types define the shape of your data. You can define custom object types that represent the entities in your document. For example, in a `TodoList` document, you might have a `TodoListState` type and a `TodoItem` type.
9
+ At the heart of GraphQL SDL are **types**. Types define the shape of your data. You can define custom object types that represent the entities in your document. For example, in a `ToDoList` document, you might have a `ToDoListState` type and a `ToDoItem` type.
10
10
 
11
- - **`TodoListState`**: This could be the root type representing the overall state of the to-do list. It might contain a list of `TodoItem` objects.
12
- - **`TodoItem`**: This type would represent an individual to-do item, with properties like an `id`, `text` (the task description), and `checked` (a boolean indicating if the task is completed).
11
+ - **`ToDoListState`**: This could be the root type representing the overall state of the to-do list. It might contain a list of `ToDoItem` objects.
12
+ - **`ToDoItem`**: This type would represent an individual to-do item, with properties like an `id`, `text` (the task description), and `checked` (a boolean indicating if the task is completed).
13
13
 
14
14
  ### Fields
15
15
 
16
- Each type has **fields**, which represent the properties of that type. Each field has a name and a type. For instance, the `TodoItem` type would have an `id` field of type `OID!`, a `text` field of type `String!`, and a `checked` field of type `Boolean!`.
16
+ Each type has **fields**, which represent the properties of that type. Each field has a name and a type. For instance, the `ToDoItem` type would have an `id` field of type `ID!`, a `text` field of type `String!`, and a `checked` field of type `Boolean!`.
17
17
 
18
18
  ### Scalars
19
19
 
@@ -27,61 +27,32 @@ GraphQL has a set of built-in **scalar types**:
27
27
 
28
28
  In addition to these standard types, the Powerhouse Document-Engineering system introduces custom scalars that are linked to reusable front-end components. These scalars are tailored for the web3 ecosystem and will be explored in the Component Library section of the documentation.
29
29
 
30
- :::tip Custom Scalar: OID
31
- Powerhouse provides the `OID` (Object ID) scalar type, which is a custom scalar specifically designed for unique identifiers in document models. It provides automatic ID generation capabilities when used with the `generateId()` function from the document-model core library.
32
- :::
33
-
34
30
  ### Lists and non-null
35
31
 
36
32
  You can modify types using lists and non-null indicators:
37
33
 
38
- - **Lists**: To indicate that a field will return a list of a certain type, you wrap the type in square brackets, e.g., `[TodoItem!]!`. This means the field `items` in `TodoListState` will be a list of `TodoItem` objects.
39
- - **Non-Null**: To indicate that a field cannot be null, you add an exclamation mark `!` after the type name, e.g., `String!`. This means that the `text` field of a `TodoItem` must always have a value. The outer `!` in `[TodoItem!]!` means the list itself cannot be null (it must be at least an empty list), and the inner `!` on `TodoItem!` means that every item within that list must also be non-null.
40
-
41
- ## Example: TodoList state schema
34
+ - **Lists**: To indicate that a field will return a list of a certain type, you wrap the type in square brackets, e.g., `[ToDoItem!]!`. This means the field `items` in `ToDoListState` will be a list of `ToDoItem` objects.
35
+ - **Non-Null**: To indicate that a field cannot be null, you add an exclamation mark `!` after the type name, e.g., `String!`. This means that the `text` field of a `ToDoItem` must always have a value. The outer `!` in `[ToDoItem!]!` means the list itself cannot be null (it must be at least an empty list), and the inner `!` on `ToDoItem!` means that every item within that list must also be non-null.
42
36
 
43
- Let's revisit the `TodoList` example from the "Define the TodoList document specification" tutorial in Get Started.
37
+ ## Example: ToDoList state schema
44
38
 
45
- ### Basic schema (matching Get Started tutorial)
46
-
47
- This is the same schema you built in the Get Started tutorial:
39
+ Let's revisit the `ToDoList` example from the "Define the ToDoList document specification" tutorial.
40
+ Only this time, we'll also add a 'Stats' type. Since we want to keep track of the number of completed To-Do's.
48
41
 
49
42
  ```graphql
50
- # The state of our TodoList
51
- type TodoListState {
52
- items: [TodoItem!]!
43
+ # The state of our ToDoList
44
+ type ToDoListState {
45
+ items: [ToDoItem!]!
53
46
  }
54
47
 
55
48
  # A single to-do item
56
- type TodoItem {
57
- id: OID!
49
+ type ToDoItem {
50
+ id: ID!
58
51
  text: String!
59
52
  checked: Boolean!
60
53
  }
61
- ```
62
-
63
- ### Advanced schema (with statistics tracking)
64
-
65
- :::info Advanced Feature
66
- In this Mastery Track, we'll extend the basic schema with a `stats` field to demonstrate how you can add computed statistics to your document model. This is an **optional enhancement** that builds on the foundation from Get Started.
67
- :::
68
-
69
- ```graphql
70
- # The state of our TodoList (advanced version with stats)
71
- type TodoListState {
72
- items: [TodoItem!]!
73
- stats: TodoListStats!
74
- }
75
-
76
- # A single to-do item
77
- type TodoItem {
78
- id: OID!
79
- text: String!
80
- checked: Boolean!
81
- }
82
-
83
- # The statistics on our to-do's (advanced feature)
84
- type TodoListStats {
54
+ # The statistics on our to-do's
55
+ type ToDoListStats {
85
56
  total: Int!
86
57
  checked: Int!
87
58
  unchecked: Int!
@@ -90,19 +61,18 @@ type TodoListStats {
90
61
 
91
62
  ### Breakdown:
92
63
 
93
- - **`TodoListState` type**:
94
- - `items: [TodoItem!]!`: This field defines that our `TodoListState` contains a list called `items`.
95
- - `[TodoItem!]`: This signifies that `items` is a list of `TodoItem` objects.
96
- - `TodoItem!`: The `!` after `TodoItem` means that no item in the list can be null. Each entry must be a valid `TodoItem`.
97
- - The final `!` after `[TodoItem!]` means that the `items` list itself cannot be null. It can be an empty list `[]`, but it cannot be absent.
98
- - `stats: TodoListStats!` *(advanced)*: Holds aggregated statistics about the to-do items.
64
+ - **`ToDoListState` type**:
65
+ - `items: [ToDoItem!]!`: This field defines that our `ToDoListState` contains a list called `items`.
66
+ - `[ToDoItem!]`: This signifies that `items` is a list of `ToDoItem` objects.
67
+ - `ToDoItem!`: The `!` after `ToDoItem` means that no item in the list can be null. Each entry must be a valid `ToDoItem`.
68
+ - The final `!` after `[ToDoItem!]` means that the `items` list itself cannot be null. It can be an empty list `[]`, but it cannot be absent.
99
69
 
100
- - **`TodoItem` type**:
101
- - `id: OID!`: Each `TodoItem` has a unique identifier using Powerhouse's custom `OID` scalar. This is crucial for referencing specific items, for example, when updating or deleting them.
70
+ - **`ToDoItem` type**:
71
+ - `id: ID!`: Each `ToDoItem` has a unique identifier that cannot be null. This is crucial for referencing specific items, for example, when updating or deleting them.
102
72
  - `text: String!`: The textual description of the to-do item. It cannot be null, ensuring every to-do has a description.
103
73
  - `checked: Boolean!`: Indicates whether the to-do item is completed. It defaults to a boolean value (true or false) and cannot be null.
104
74
 
105
- - **`TodoListStats` type** *(advanced)*: This type holds the summary statistics for the to-do list.
75
+ - **`ToDoListStats` type**: This type holds the summary statistics for the to-do list.
106
76
  - `total: Int!`: The total count of all to-do items. This field must be an integer and cannot be null.
107
77
  - `checked: Int!`: The number of to-do items that are marked as completed. This must be an integer and cannot be null.
108
78
  - `unchecked: Int!`: The number of to-do items that are still pending. This also must be an integer and cannot be null.
@@ -113,17 +83,17 @@ type TodoListStats {
113
83
  2. **Clarity and Explicitness**: Name your types and fields clearly and descriptively. This makes the schema easier to understand and maintain.
114
84
  3. **Use Non-Null Wisely**: Enforce data integrity by using non-null (`!`) for fields that must always have a value. However, be mindful not to over-constrain if a field can genuinely be optional.
115
85
  4. **Normalize vs. Denormalize**:
116
- - **Normalization**: Similar to relational databases, you can normalize your data by having distinct types and linking them via IDs. This can reduce data redundancy. For example, if you had `User` and `TodoItem` and wanted to assign tasks, you might have an `assigneeId` field in `TodoItem` that links to a `User`'s `id`.
117
- - **Denormalization**: Sometimes, for performance or simplicity, you might embed data directly. For instance, if user information associated with a to-do item was very simple and only used in that context, you might embed user fields directly in `TodoItem`.
86
+ - **Normalization**: Similar to relational databases, you can normalize your data by having distinct types and linking them via IDs. This can reduce data redundancy. For example, if you had `User` and `ToDoItem` and wanted to assign tasks, you might have an `assigneeId` field in `ToDoItem` that links to a `User`'s `id`.
87
+ - **Denormalization**: Sometimes, for performance or simplicity, you might embed data directly. For instance, if user information associated with a to-do item was very simple and only used in that context, you might embed user fields directly in `ToDoItem`.
118
88
  - The choice depends on your specific use case, query patterns, and how data is updated.
119
- 5. **Consider Future Needs**: While you shouldn't over-engineer, think a little about potential future enhancements. For example, adding a `createdAt: String` or `dueDate: String` field to `TodoItem` might be useful later.
120
- 6. **Root State Type**: It's a common pattern to have a single root type for your document state (e.g., `TodoListState`). This provides a clear entry point for accessing all document data.
89
+ 5. **Consider Future Needs**: While you shouldn't over-engineer, think a little about potential future enhancements. For example, adding a `createdAt: String` or `dueDate: String` field to `ToDoItem` might be useful later.
90
+ 6. **Root State Type**: It's a common pattern to have a single root type for your document state (e.g., `ToDoListState`). This provides a clear entry point for accessing all document data.
121
91
 
122
92
  By carefully defining your state schema, you lay a solid foundation for your Powerhouse document model, making it robust, maintainable, and easy to work with. The schema dictates not only how data is stored but also how it can be queried and mutated through operations, which will be covered in the next section.
123
93
 
124
94
  ## Practical implementation: defining the state schema in Connect
125
95
 
126
- Now that you understand the concepts behind the state schema, let's put it into practice. This section will guide you through creating a document model specification for the TodoList example discussed above.
96
+ Now that you understand the concepts behind the state schema, let's put it into practice. This section will guide you through creating a document model specification for the advanced ToDoList example discussed above.
127
97
 
128
98
  <details>
129
99
  <summary>Tutorial: The state schema specification</summary>
@@ -140,29 +110,28 @@ Now that you understand the concepts behind the state schema, let's put it into
140
110
  - At the bottom of the page in the 'New Document' section, click the `DocumentModel` button to create a new document model specification.
141
111
 
142
112
  2. **Define Document Metadata**:
143
- - **Name**: Give your document model a descriptive name: `TodoList`. **Pay close attention to capitalization, as it influences our code generation.**
144
- - **Document Type**: In the 'Document Type' field, enter a unique identifier for this document type: `powerhouse/todo-list`.
113
+ - **Name**: Give your document model a descriptive name, for example, `ToDoList`. **Pay close attention to capitalization, as it influences our code.**
114
+ - **Document Type**: In the 'Document Type' field, enter a unique identifier for this document type: `powerhouse/todolist`.
145
115
 
146
116
  3. **Specify the State Schema**:
147
117
  - In the code editor provided, you'll see a template for a GraphQL schema.
148
- - Replace the entire content of the editor with the advanced `TodoList` schema we've designed in this chapter:
118
+ - Replace the entire content of the editor with the advanced `ToDoList` schema we've designed in this chapter:
149
119
 
150
120
  ```graphql
151
- # The state of our TodoList (advanced version with stats)
152
- type TodoListState {
153
- items: [TodoItem!]!
154
- stats: TodoListStats!
121
+ # The state of our ToDoList
122
+ type ToDoListState {
123
+ items: [ToDoItem!]!
124
+ stats: ToDoListStats!
155
125
  }
156
126
 
157
127
  # A single to-do item
158
- type TodoItem {
159
- id: OID!
128
+ type ToDoItem {
129
+ id: ID!
160
130
  text: String!
161
131
  checked: Boolean!
162
132
  }
163
-
164
- # The statistics on our to-do's (advanced feature)
165
- type TodoListStats {
133
+ # The statistics on our to-do's
134
+ type ToDoListStats {
166
135
  total: Int!
167
136
  checked: Int!
168
137
  unchecked: Int!
@@ -171,12 +140,12 @@ Now that you understand the concepts behind the state schema, let's put it into
171
140
 
172
141
  4. **Sync Schema and View Initial State**:
173
142
  - After pasting the schema, click the **'Sync with schema'** button.
174
- - This action processes your schema and generates an initial JSON state for your document model based on the `TodoListState` type. You can view this initial state, which helps you verify that your schema is structured correctly.
143
+ - This action processes your schema and generates an initial JSON state for your document model based on the `ToDoListState` type. You can view this initial state, which helps you verify that your schema is structured correctly.
175
144
 
176
145
  For now, you can ignore the "Modules & Operations" section. We will define and implement the operations that modify this state in the upcoming sections of this Mastery Track.
177
146
 
178
- By completing these steps, you have successfully specified the data structure for the advanced TodoList document model. The next step is to define the operations that will allow users to interact with and change this state.
147
+ By completing these steps, you have successfully specified the data structure for the advanced ToDoList document model. The next step is to define the operations that will allow users to interact with and change this state.
179
148
 
180
149
  </details>
181
150
 
182
- For a complete, working example, you can always have a look at the [Example TodoList Repository](/academy/MasteryTrack/DocumentModelCreation/ExampleToDoListRepository) which contains the full implementation of the concepts discussed in this Mastery Track.
151
+ For a complete, working example, you can always have a look at the [Example ToDoList Repository](/academy/MasteryTrack/DocumentModelCreation/ExampleToDoListRepository) which contains the full implementation of the concepts discussed in this Mastery Track.