@rmrdeveloper/sideroom-pi 8.14.0 → 9.0.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 (37) hide show
  1. package/README.md +19 -9
  2. package/assets/artifacts/GUIDELINES_TEMPLATE.md +33 -2
  3. package/assets/visual-context/browser/INSTALL.md +11 -2
  4. package/assets/visual-context/browser/background.js +72 -60
  5. package/assets/visual-context/browser/content.js +45 -7
  6. package/assets/visual-context/browser/destinations.js +40 -0
  7. package/assets/visual-context/browser/manifest.json +1 -1
  8. package/extensions/guidelines/catalog.ts +9 -0
  9. package/extensions/guidelines/execute.ts +26 -0
  10. package/extensions/guidelines/guard.ts +46 -14
  11. package/extensions/guidelines/index.ts +31 -0
  12. package/extensions/guidelines/prompt.ts +2 -2
  13. package/extensions/guidelines/review.ts +1 -1
  14. package/extensions/jev/model.ts +13 -0
  15. package/extensions/visual-context/broker.ts +14 -6
  16. package/extensions/visual-context/compiler-config.ts +103 -0
  17. package/extensions/visual-context/configure.ts +421 -0
  18. package/extensions/visual-context/dialogs.ts +95 -0
  19. package/extensions/visual-context/files.ts +139 -0
  20. package/extensions/visual-context/index.ts +48 -56
  21. package/extensions/visual-context/match.ts +48 -16
  22. package/extensions/visual-context/model.ts +29 -3
  23. package/extensions/visual-context/projects.ts +226 -0
  24. package/extensions/visual-context/session.ts +150 -17
  25. package/extensions/visual-context/setup.ts +146 -0
  26. package/extensions/visual-context/source.ts +203 -100
  27. package/extensions/visual-context/ui.ts +5 -1
  28. package/package.json +5 -5
  29. package/skills/sideroom-guidelines/SKILL.md +8 -5
  30. package/skills/sideroom-guidelines/references/languages/go.md +35 -1
  31. package/skills/sideroom-guidelines/references/languages/java.md +34 -1
  32. package/skills/sideroom-guidelines/references/languages/javascript.md +34 -1
  33. package/skills/sideroom-guidelines/references/languages/php-laravel.md +34 -1
  34. package/skills/sideroom-guidelines/references/languages/python.md +30 -1
  35. package/skills/sideroom-guidelines/references/languages/rust.md +34 -1
  36. package/skills/sideroom-guidelines/references/languages/typescript.md +38 -1
  37. package/skills/sideroom-visual-setup/SKILL.md +49 -0
@@ -25,6 +25,7 @@ Rules every Python change must follow.
25
25
  | 17 | [Dependency direction](#17-dependency-direction) | architectural |
26
26
  | 18 | [Testability](#18-testability-as-a-design-constraint) | architectural |
27
27
  | 19 | [Comments](#19-comments) | architectural |
28
+ | 20 | [Decomposition by intent](#20-decomposition-by-intent) | structural |
28
29
 
29
30
  ---
30
31
 
@@ -314,8 +315,36 @@ counter += 1
314
315
  scheduler.every(5).seconds.do(check_payment_status)
315
316
  ```
316
317
 
318
+ ### 20. Decomposition by intent
319
+
320
+ RULE: Extract a block into a named function when it represents a coherent operation and its name and contract let the caller understand the flow without reading its implementation. Keep orchestration separate from implementation details. Do not split solely to reduce line count; keep tightly coupled steps together when separating them would introduce shared mutable state, excessive parameters, or require reading both functions to understand either.
321
+ WHY: Good decomposition reduces how much a reader must understand at once. Function length is a review signal; extraction must improve comprehension rather than merely move code elsewhere.
322
+
323
+ ```python
324
+ # bad
325
+ def create_packing_slip(items, destination):
326
+ unit_count = 0
327
+ weight_grams = 0
328
+ for item in items:
329
+ unit_count += item.quantity
330
+ weight_grams += item.quantity * item.unit_weight_grams
331
+ return PackingSlip(destination, PackingTotals(unit_count, weight_grams))
332
+
333
+ # good
334
+ def create_packing_slip(items, destination):
335
+ return PackingSlip(destination, calculate_packing_totals(items))
336
+
337
+ def calculate_packing_totals(items) -> PackingTotals:
338
+ unit_count = 0
339
+ weight_grams = 0
340
+ for item in items:
341
+ unit_count += item.quantity
342
+ weight_grams += item.quantity * item.unit_weight_grams
343
+ return PackingTotals(unit_count, weight_grams)
344
+ ```
345
+
317
346
  ---
318
347
 
319
348
  **When in doubt:** fail fast, keep it flat, keep it small.
320
349
 
321
- **Enforcement note:** rules 1–2 are mechanical and should be backed by Python formatting or linting. Rules 3–10 are structural checks. Rules 11–19 require review judgment.
350
+ **Enforcement note:** rules 1–2 are mechanical and should be backed by Python formatting or linting. Rules 3–10 and 20 are structural; rules 11–19 are architectural. Rule 20 requires semantic review, not a line-count limit or mechanical length detector. Rules 11–20 require review judgment.
@@ -25,6 +25,7 @@ Rules every Rust change must follow.
25
25
  | 17 | [Dependency direction](#17-dependency-direction) | architectural |
26
26
  | 18 | [Testability](#18-testability-as-a-design-constraint) | architectural |
27
27
  | 19 | [Comments](#19-comments) | architectural |
28
+ | 20 | [Decomposition by intent](#20-decomposition-by-intent) | structural |
28
29
 
29
30
  ---
30
31
 
@@ -244,8 +245,40 @@ counter += 1;
244
245
  schedule_poll(Duration::from_secs(5));
245
246
  ```
246
247
 
248
+ ### 20. Decomposition by intent
249
+
250
+ RULE: Extract a block into a named function when it represents a coherent operation and its name and contract let the caller understand the flow without reading its implementation. Keep orchestration separate from implementation details. Do not split solely to reduce line count; keep tightly coupled steps together when separating them would introduce shared mutable state, excessive parameters, or require reading both functions to understand either.
251
+ WHY: Good decomposition reduces how much a reader must understand at once. Function length is a review signal; extraction must improve comprehension rather than merely move code elsewhere.
252
+
253
+ ```rust
254
+ // bad
255
+ fn create_packing_slip(items: &[PackingItem], destination: String) -> PackingSlip {
256
+ let mut unit_count = 0;
257
+ let mut weight_grams = 0;
258
+ for item in items {
259
+ unit_count += item.quantity;
260
+ weight_grams += item.quantity * item.unit_weight_grams;
261
+ }
262
+ PackingSlip { destination, totals: PackingTotals { unit_count, weight_grams } }
263
+ }
264
+ // good
265
+ fn create_packing_slip(items: &[PackingItem], destination: String) -> PackingSlip {
266
+ PackingSlip { destination, totals: calculate_packing_totals(items) }
267
+ }
268
+
269
+ fn calculate_packing_totals(items: &[PackingItem]) -> PackingTotals {
270
+ let mut unit_count = 0;
271
+ let mut weight_grams = 0;
272
+ for item in items {
273
+ unit_count += item.quantity;
274
+ weight_grams += item.quantity * item.unit_weight_grams;
275
+ }
276
+ PackingTotals { unit_count, weight_grams }
277
+ }
278
+ ```
279
+
247
280
  ---
248
281
 
249
282
  **When in doubt:** fail fast, keep it flat, keep it small.
250
283
 
251
- **Enforcement note:** rules 1–2 are mechanical and should be backed by Rust formatting or linting. Rules 3–10 are structural checks. Rules 11–19 require review judgment.
284
+ **Enforcement note:** rules 1–2 are mechanical and should be backed by Rust formatting or linting. Rules 3–10 and 20 are structural; rules 11–19 are architectural. Rule 20 requires semantic review, not a line-count limit or mechanical length detector. Rules 11–20 require review judgment.
@@ -25,6 +25,7 @@ Rules every TypeScript change must follow.
25
25
  | 17 | [Dependency direction](#17-dependency-direction) | architectural |
26
26
  | 18 | [Testability](#18-testability-as-a-design-constraint) | architectural |
27
27
  | 19 | [Comments](#19-comments) | architectural |
28
+ | 20 | [Decomposition by intent](#20-decomposition-by-intent) | structural |
28
29
 
29
30
  ---
30
31
 
@@ -242,11 +243,47 @@ counter++;
242
243
  setInterval(checkPaymentStatus, 5_000);
243
244
  ```
244
245
 
246
+ ### 20. Decomposition by intent
247
+
248
+ RULE: Extract a block into a named function when it represents a coherent operation and its name and contract let the caller understand the flow without reading its implementation. Keep orchestration separate from implementation details. Do not split solely to reduce line count; keep tightly coupled steps together when separating them would introduce shared mutable state, excessive parameters, or require reading both functions to understand either.
249
+ WHY: Good decomposition reduces how much a reader must understand at once. Function length is a review signal; extraction must improve comprehension rather than merely move code elsewhere.
250
+
251
+ ```ts
252
+ type PackingItem = { quantity: number; unitWeightGrams: number };
253
+ type PackingTotals = { unitCount: number; weightGrams: number };
254
+ type PackingSlip = { destination: string; totals: PackingTotals };
255
+
256
+ // bad
257
+ function createPackingSlip(items: readonly PackingItem[], destination: string): PackingSlip {
258
+ let unitCount = 0;
259
+ let weightGrams = 0;
260
+ for (const item of items) {
261
+ unitCount += item.quantity;
262
+ weightGrams += item.quantity * item.unitWeightGrams;
263
+ }
264
+ return { destination, totals: { unitCount, weightGrams } };
265
+ }
266
+ // good
267
+ function createPackingSlip(items: readonly PackingItem[], destination: string): PackingSlip {
268
+ return { destination, totals: calculatePackingTotals(items) };
269
+ }
270
+
271
+ function calculatePackingTotals(items: readonly PackingItem[]): PackingTotals {
272
+ let unitCount = 0;
273
+ let weightGrams = 0;
274
+ for (const item of items) {
275
+ unitCount += item.quantity;
276
+ weightGrams += item.quantity * item.unitWeightGrams;
277
+ }
278
+ return { unitCount, weightGrams };
279
+ }
280
+ ```
281
+
245
282
  ---
246
283
 
247
284
  **When in doubt:** fail fast, keep it flat, keep it small.
248
285
 
249
- **Enforcement note:** rules 1–2 are mechanical and should be backed by TypeScript formatting or linting. Rules 3–10 are structural checks. Rules 11–19 require review judgment.
286
+ **Enforcement note:** rules 1–2 are mechanical and should be backed by TypeScript formatting or linting. Rules 3–10 and 20 are structural; rules 11–19 are architectural. Rule 20 requires semantic review, not a line-count limit or mechanical length detector. Rules 11–20 require review judgment.
250
287
 
251
288
  ## Language-specific conventions
252
289
 
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: sideroom-visual-setup
3
+ description: "Enable, review, or troubleshoot precise Sideroom visual context in a web project, including child projects and development servers in Docker. Use for requests such as 'Activa el contexto visual preciso'; not for ordinary UI changes or browser automation."
4
+ license: MIT
5
+ metadata:
6
+ author: RMRdeveloper
7
+ version: "1.0"
8
+ ---
9
+
10
+ # Visual context setup
11
+
12
+ Configure one requested project so a browser selection carries a compiler location
13
+ that Pi can validate against local source. Requires `sideroom_visual_setup`; if
14
+ it is unavailable, load the Sideroom installation that provides it before proceeding.
15
+
16
+ ## Workflow
17
+
18
+ 1. Resolve the requested project relative to Pi's working directory; use `discover`
19
+ when the target is unknown. Reuse an explicit choice; ask only if it is ambiguous. Read its
20
+ build config, manifest, lockfile ownership and actual development launch command.
21
+ Inspect Docker configuration only when it runs the development server.
22
+ 2. For a new integration, use `prepare` and apply its edit and installation command
23
+ through normal Pi tools. The plan owns compiler code, dependency versions and
24
+ check scripts: do not duplicate that template here or in a helper file. For an
25
+ existing/custom integration, preserve it and change only what inspection shows
26
+ is missing. Keep metadata before framework transforms, development-only, with
27
+ no second browser UI or editor-launch service. Install in the selected workspace
28
+ and ensure the dependency is also present in the runtime that serves the app.
29
+ 3. Check path portability before starting the server:
30
+ - When runtime and Pi share paths, retain the plan's absolute paths.
31
+ - When Docker or another runtime has different paths, emit paths relative to the
32
+ app root and `bind` the actual page origin to that local project, or associate
33
+ it through F7. Do not bind it to the parent folder merely because Pi runs there.
34
+ With Code Inspector 2.0.9, `transformCode` checks that `filePath` exists before
35
+ transforming: a relative input must resolve from the runtime's working
36
+ directory. Romax's pattern works because its Docker working directory equals
37
+ Vite's app root. Verify this condition instead of copying it to every project.
38
+ Reject out-of-project references; do not relax Sideroom's path guards.
39
+ 4. Run the project's existing checks, restart the selected development service
40
+ through its established workflow, and refresh the page. Reload Pi and the
41
+ companion together if their visual protocols differ; preserve pairing.
42
+ Select a native element and verify its marker resolves to the intended local
43
+ file, line and column with **compiler location checked** in F7. If practical,
44
+ confirm a production build omits markers. A successful install or build alone
45
+ does not verify browser-to-source resolution.
46
+
47
+ Report the project, changed files, checks and browser verification status. When
48
+ browser/runtime access is unavailable, finish the configuration and identify the
49
+ remaining verification step; do not label inferred or untested locations exact.