@powerhousedao/academy 5.0.3 → 5.0.5

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 (28) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/docs/academy/00-EthereumArgentinaHackathon.md +207 -0
  3. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +1 -1
  4. package/docs/academy/01-GetStarted/05-VetraStudio.md +76 -27
  5. package/docs/academy/01-GetStarted/home.mdx +4 -4
  6. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +24 -8
  7. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +25 -7
  8. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +17 -3
  9. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +5 -2
  10. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +7 -1
  11. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +5 -5
  12. package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +4 -1
  13. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +21 -9
  14. package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +132 -129
  15. package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +50 -44
  16. package/docs/academy/03-ExampleUsecases/Chatroom/image-4.png +0 -0
  17. package/docs/academy/03-ExampleUsecases/Chatroom/image-5.png +0 -0
  18. package/docs/academy/03-ExampleUsecases/Chatroom/images/ChatRoomConnectApp.gif +0 -0
  19. package/docs/academy/03-ExampleUsecases/Chatroom/images/ChatRoomTest.gif +0 -0
  20. package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +39 -5
  21. package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +0 -2
  22. package/package.json +1 -1
  23. package/sidebars.ts +8 -0
  24. package/src/css/custom.css +20 -0
  25. package/static/img/ethereum-logo.jpeg +0 -0
  26. package/docs/academy/09-AIResources +0 -131
  27. package/docs/academy/TUTORIAL_VERIFICATION_ARCHITECTURE +0 -325
  28. /package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/{02-RevisionHistoryTimeline.md → 02-RevisionHistoryTimeline} +0 -0
@@ -1,325 +0,0 @@
1
- # Tutorial Verification System - Technical Architecture
2
-
3
- ## Overview
4
-
5
- This document outlines the technical architecture for an automated tutorial verification system that ensures the Powerhouse Academy tutorials remain accurate and functional as the codebase evolves.
6
-
7
- ## System Architecture
8
-
9
- ### 1. Test Execution Environment
10
-
11
- ```
12
- ┌─────────────────────────────────────────┐
13
- │ GitHub Actions Runner (Ubuntu) │
14
- │ ┌─────────────────────────────────────┐ │
15
- │ │ Isolated Docker Container │ │
16
- │ │ ├── Node.js 22 │ │
17
- │ │ ├── pnpm │ │
18
- │ │ ├── Powerhouse CLI (ph-cli) │ │
19
- │ │ ├── Playwright browsers │ │
20
- │ │ └── Temporary filesystem │ │
21
- │ └─────────────────────────────────────┘ │
22
- └─────────────────────────────────────────┘
23
- ```
24
-
25
- **Execution Environments:**
26
- - **Development**: Local machine (`pnpm test:e2e`)
27
- - **CI/CD**: GitHub Actions runners (automatically on PRs)
28
- - **Scheduled**: Nightly runs to catch regressions
29
-
30
- ### 2. Tutorial Agent Architecture
31
-
32
- The "agent" is a test orchestrator that processes tutorials through a structured workflow:
33
-
34
- ```typescript
35
- // packages/tutorial-verifier/src/tutorial-agent.ts
36
- class TutorialAgent {
37
- async verifyTutorial(tutorialPath: string) {
38
- // 1. Parse tutorial markdown
39
- const steps = await this.parseTutorialSteps(tutorialPath);
40
-
41
- // 2. Create isolated environment
42
- const sandbox = await this.createSandbox();
43
-
44
- // 3. Execute each step sequentially
45
- for (const step of steps) {
46
- await this.executeStep(step, sandbox);
47
- await this.verifyStepOutcome(step, sandbox);
48
- }
49
-
50
- // 4. Generate report
51
- return this.generateReport();
52
- }
53
- }
54
- ```
55
-
56
- ## Component Integration
57
-
58
- ### 3. E2E Test Framework Integration
59
-
60
- **Extends existing Playwright E2E infrastructure:**
61
-
62
- ```typescript
63
- // test/connect-e2e/tests/tutorial-get-started.spec.ts
64
- import { test, expect } from '@playwright/test';
65
-
66
- test('Tutorial: Create new to-do list document', async ({ page }) => {
67
- const agent = new TutorialAgent();
68
-
69
- // Phase 1: CLI Commands (no browser needed)
70
- await agent.executeCliStep('ph init my-todo-project');
71
- await agent.verifyFileExists('my-todo-project/package.json');
72
-
73
- // Phase 2: Browser Automation (uses Playwright)
74
- await agent.startConnect(); // Starts ph connect in background
75
- await page.goto('http://localhost:3000');
76
-
77
- // Phase 3: UI Verification (Playwright E2E)
78
- await page.click('text=Local Drive');
79
- await page.click('button:has-text("DocumentModel")');
80
- await expect(page.locator('text=Document Model Editor')).toBeVisible();
81
-
82
- // Phase 4: Cleanup
83
- await agent.cleanup();
84
- });
85
- ```
86
-
87
- ### 4. Playwright Browser Automation
88
-
89
- **UI automation for Connect Studio interactions:**
90
-
91
- ```typescript
92
- // UI automation for Connect Studio
93
- class ConnectUIAgent {
94
- constructor(private page: Page) {}
95
-
96
- async createDocumentModel(name: string) {
97
- // Navigate to document creation
98
- await this.page.click('button:has-text("DocumentModel")');
99
-
100
- // Fill in model details
101
- await this.page.fill('input[placeholder="Document Name"]', name);
102
- await this.page.fill('input[placeholder="Document Type"]', `powerhouse/${name.toLowerCase()}`);
103
-
104
- // Define schema in code editor
105
- await this.page.click('.monaco-editor');
106
- await this.page.keyboard.type(`
107
- type ${name}State {
108
- items: [TodoItem!]!
109
- }
110
- `);
111
-
112
- // Save and verify
113
- await this.page.click('button:has-text("Save")');
114
- await expect(this.page.locator(`text=${name}.phdm.zip`)).toBeVisible();
115
- }
116
- }
117
- ```
118
-
119
- ## Execution Flow
120
-
121
- ### 5. Tutorial Processing Pipeline
122
-
123
- ```
124
- Tutorial Markdown File
125
-
126
- [Tutorial Parser]
127
-
128
- ┌─────────────────┐
129
- │ Execution Steps │
130
- ├─────────────────┤
131
- │ 1. CLI Commands │ ← Uses child_process.spawn()
132
- │ 2. File Checks │ ← Uses fs.existsSync()
133
- │ 3. UI Actions │ ← Uses Playwright page.click()
134
- │ 4. Verifications│ ← Custom assertion logic
135
- └─────────────────┘
136
-
137
- [Report Generator]
138
-
139
- Test Results + Screenshots
140
- ```
141
-
142
- ### 6. Step-by-Step Processing Example
143
-
144
- **Tutorial Markdown:**
145
- ```markdown
146
- ## Quick start
147
- Create a new Powerhouse project with a single command:
148
- ```bash
149
- ph init
150
- ```
151
-
152
- Then start Connect:
153
- ```bash
154
- ph connect
155
- ```
156
-
157
- Navigate to http://localhost:3000 and click on "Local Drive".
158
- ```
159
-
160
- **Agent Processing:**
161
-
162
- ```typescript
163
- // 1. Tutorial Parser extracts executable steps
164
- const steps = [
165
- { type: 'cli', command: 'ph init', expectedFiles: ['package.json'] },
166
- { type: 'cli', command: 'ph connect', background: true },
167
- { type: 'browser', action: 'navigate', url: 'http://localhost:3000' },
168
- { type: 'browser', action: 'click', selector: 'text=Local Drive' }
169
- ];
170
-
171
- // 2. Agent executes each step
172
- for (const step of steps) {
173
- switch (step.type) {
174
- case 'cli':
175
- const result = execSync(step.command);
176
- if (step.expectedFiles) {
177
- for (const file of step.expectedFiles) {
178
- assert(existsSync(file), `Expected file ${file} not found`);
179
- }
180
- }
181
- break;
182
-
183
- case 'browser':
184
- if (step.action === 'navigate') {
185
- await page.goto(step.url);
186
- } else if (step.action === 'click') {
187
- await page.click(step.selector);
188
- }
189
- break;
190
- }
191
- }
192
- ```
193
-
194
- ## Deployment Architecture
195
-
196
- ### 7. Runtime Environment Distribution
197
-
198
- ```
199
- ┌─────────────────────────────────────────────────────────┐
200
- │ GitHub Actions Runner │
201
- │ │
202
- │ ┌─────────────────┐ ┌─────────────────────────────────┐ │
203
- │ │ Tutorial Agent │ │ Sandbox Environment │ │
204
- │ │ (Node.js) │ │ │ │
205
- │ │ │ │ ┌─────────────┐ │ │
206
- │ │ • Parse MD │ │ │ ph connect │ :3000 │ │
207
- │ │ • Execute CLI │ │ └─────────────┘ │ │
208
- │ │ • Control tests │ │ │ │
209
- │ └─────────────────┘ │ ┌─────────────┐ │ │
210
- │ │ │ Playwright │ │ │
211
- │ ┌─────────────────┐ │ │ Browser │ │ │
212
- │ │ Report Gen │ │ └─────────────┘ │ │
213
- │ │ • Screenshots │ │ │ │
214
- │ │ • Error logs │ │ /tmp/tutorial-test-xyz/ │ │
215
- │ │ • Success rates │ │ ├── my-todo-project/ │ │
216
- │ └─────────────────┘ │ │ ├── package.json │ │
217
- │ │ │ └── ... │ │
218
- │ └─────────────────────────────────┘ │
219
- └─────────────────────────────────────────────────────────┘
220
- ```
221
-
222
- ### 8. Integration with Existing Test Suite
223
-
224
- **File Structure Extension:**
225
-
226
- ```
227
- Your Current E2E Tests:
228
- test/connect-e2e/tests/
229
- ├── todo-document.spec.ts ← Existing
230
- ├── drive.spec.ts ← Existing
231
- └── app.spec.ts ← Existing
232
-
233
- Added Tutorial Tests:
234
- test/connect-e2e/tests/tutorials/
235
- ├── get-started.spec.ts ← New: Tests "Get Started" tutorial
236
- ├── mastery-track.spec.ts ← New: Tests "Mastery Track" tutorials
237
- └── cookbook.spec.ts ← New: Tests "Cookbook" recipes
238
- ```
239
-
240
- **No changes to existing code** - just additional test files that run alongside current tests.
241
-
242
- ## Performance & Timing
243
-
244
- ### 9. Execution Timeline
245
-
246
- ```
247
- 0s │ Start test
248
- 2s │ ├── Parse tutorial markdown
249
- 4s │ ├── Create temp directory
250
- 6s │ ├── Run 'ph init'
251
- 15s │ ├── Verify project structure
252
- 20s │ ├── Start 'ph connect' (background)
253
- 35s │ ├── Wait for Connect to be ready
254
- 40s │ ├── Launch Playwright browser
255
- 45s │ ├── Navigate to localhost:3000
256
- 50s │ ├── Perform UI interactions
257
- 55s │ ├── Verify expected elements
258
- 60s │ ├── Take screenshots
259
- 65s │ ├── Cleanup (kill processes, delete files)
260
- 70s │ └── Generate report
261
- ```
262
-
263
- ## Implementation Phases
264
-
265
- ### Phase 1: Proof of Concept (1-2 days)
266
- - Single tutorial verification (Get Started)
267
- - Basic CLI command execution
268
- - Simple file existence checks
269
- - Integration with existing Playwright setup
270
-
271
- ### Phase 2: Core Features (1-2 weeks)
272
- - Tutorial markdown parser
273
- - Comprehensive step execution engine
274
- - Browser automation for Connect Studio
275
- - Error reporting and screenshots
276
-
277
- ### Phase 3: Advanced Features (2-3 weeks)
278
- - Multiple tutorial support
279
- - Parallel execution
280
- - Detailed reporting dashboard
281
- - Integration with CI/CD pipeline
282
-
283
- ### Phase 4: Intelligence Layer (2-3 weeks)
284
- - Failure pattern analysis
285
- - Automated suggestion generation
286
- - Historical trend tracking
287
- - LLM-powered issue diagnosis
288
-
289
- ## Key Technical Decisions
290
-
291
- ### Technology Stack
292
- - **Test Framework**: Playwright (existing)
293
- - **Runtime**: Node.js 22 + TypeScript
294
- - **CLI Execution**: child_process.spawn()
295
- - **File Operations**: Node.js fs module
296
- - **Browser Automation**: Playwright
297
- - **CI/CD**: GitHub Actions (existing)
298
-
299
- ### Design Principles
300
- - **Isolation**: Each test runs in isolated environment
301
- - **Repeatability**: Tests can run multiple times with same results
302
- - **Extensibility**: Easy to add new tutorials
303
- - **Integration**: Builds on existing infrastructure
304
- - **Cleanup**: Automatic resource cleanup after tests
305
-
306
- ## Success Metrics
307
-
308
- - **Tutorial Success Rate**: % of tutorials that pass verification
309
- - **Time to Detection**: How quickly outdated tutorials are identified
310
- - **False Positive Rate**: % of failures due to test issues vs actual problems
311
- - **Coverage**: Number of tutorial steps automatically verified
312
- - **Developer Confidence**: Reduced manual testing effort
313
-
314
- ## Risk Mitigation
315
-
316
- ### Technical Risks
317
- - **Flaky Tests**: Use retry mechanisms and wait strategies
318
- - **Environment Dependencies**: Containerized execution environments
319
- - **Resource Cleanup**: Comprehensive cleanup in finally blocks
320
- - **Process Management**: Proper process lifecycle management
321
-
322
- ### Operational Risks
323
- - **Maintenance Overhead**: Gradual rollout with proven patterns
324
- - **CI/CD Load**: Efficient test execution and parallel processing
325
- - **Team Adoption**: Clear documentation and training materials