@rmrdeveloper/sideroom-pi 8.13.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.
- package/README.md +19 -9
- package/assets/artifacts/GUIDELINES_TEMPLATE.md +33 -2
- package/assets/visual-context/browser/INSTALL.md +11 -2
- package/assets/visual-context/browser/background.js +72 -60
- package/assets/visual-context/browser/content.js +45 -7
- package/assets/visual-context/browser/destinations.js +40 -0
- package/assets/visual-context/browser/manifest.json +1 -1
- package/extensions/guidelines/catalog.ts +9 -0
- package/extensions/guidelines/execute.ts +26 -0
- package/extensions/guidelines/guard.ts +46 -14
- package/extensions/guidelines/index.ts +31 -0
- package/extensions/guidelines/prompt.ts +2 -2
- package/extensions/guidelines/review.ts +1 -1
- package/extensions/jev/model.ts +13 -0
- package/extensions/visual-context/broker.ts +14 -6
- package/extensions/visual-context/compiler-config.ts +103 -0
- package/extensions/visual-context/configure.ts +421 -0
- package/extensions/visual-context/dialogs.ts +95 -0
- package/extensions/visual-context/files.ts +139 -0
- package/extensions/visual-context/index.ts +48 -56
- package/extensions/visual-context/match.ts +48 -16
- package/extensions/visual-context/model.ts +29 -3
- package/extensions/visual-context/projects.ts +226 -0
- package/extensions/visual-context/session.ts +150 -17
- package/extensions/visual-context/setup.ts +146 -0
- package/extensions/visual-context/source.ts +203 -100
- package/extensions/visual-context/ui.ts +5 -1
- package/package.json +5 -5
- package/skills/sideroom-codebase-design/SKILL.md +28 -1
- package/skills/sideroom-guidelines/SKILL.md +8 -5
- package/skills/sideroom-guidelines/references/languages/go.md +35 -1
- package/skills/sideroom-guidelines/references/languages/java.md +34 -1
- package/skills/sideroom-guidelines/references/languages/javascript.md +34 -1
- package/skills/sideroom-guidelines/references/languages/php-laravel.md +34 -1
- package/skills/sideroom-guidelines/references/languages/python.md +30 -1
- package/skills/sideroom-guidelines/references/languages/rust.md +34 -1
- package/skills/sideroom-guidelines/references/languages/typescript.md +38 -1
- package/skills/sideroom-visual-setup/SKILL.md +49 -0
|
@@ -25,6 +25,7 @@ Rules every JavaScript 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
|
|
|
@@ -377,11 +378,43 @@ counter++;
|
|
|
377
378
|
setInterval(checkPaymentStatus, 5_000);
|
|
378
379
|
```
|
|
379
380
|
|
|
381
|
+
### 20. Decomposition by intent
|
|
382
|
+
|
|
383
|
+
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.
|
|
384
|
+
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.
|
|
385
|
+
|
|
386
|
+
```js
|
|
387
|
+
// bad
|
|
388
|
+
function createPackingSlip(items, destination) {
|
|
389
|
+
let unitCount = 0;
|
|
390
|
+
let weightGrams = 0;
|
|
391
|
+
for (const item of items) {
|
|
392
|
+
unitCount += item.quantity;
|
|
393
|
+
weightGrams += item.quantity * item.unitWeightGrams;
|
|
394
|
+
}
|
|
395
|
+
return { destination, totals: { unitCount, weightGrams } };
|
|
396
|
+
}
|
|
397
|
+
// good
|
|
398
|
+
function createPackingSlip(items, destination) {
|
|
399
|
+
return { destination, totals: calculatePackingTotals(items) };
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function calculatePackingTotals(items) {
|
|
403
|
+
let unitCount = 0;
|
|
404
|
+
let weightGrams = 0;
|
|
405
|
+
for (const item of items) {
|
|
406
|
+
unitCount += item.quantity;
|
|
407
|
+
weightGrams += item.quantity * item.unitWeightGrams;
|
|
408
|
+
}
|
|
409
|
+
return { unitCount, weightGrams };
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
380
413
|
---
|
|
381
414
|
|
|
382
415
|
**When in doubt:** fail fast, keep it flat, keep it small.
|
|
383
416
|
|
|
384
|
-
**Enforcement note:** rules 1–2 are mechanical and should be backed by a JavaScript formatter/linter. Rules 3–10 are structural
|
|
417
|
+
**Enforcement note:** rules 1–2 are mechanical and should be backed by a JavaScript formatter/linter. 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.
|
|
385
418
|
|
|
386
419
|
## Language-specific conventions
|
|
387
420
|
|
|
@@ -25,6 +25,7 @@ Rules every PHP or Laravel 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
|
|
|
@@ -241,8 +242,40 @@ RULE: Comment only non-obvious intent — a trade-off, a constraint, a hazard na
|
|
|
241
242
|
Schedule::call($checkPaymentStatus)->everyFiveSeconds();
|
|
242
243
|
```
|
|
243
244
|
|
|
245
|
+
### 20. Decomposition by intent
|
|
246
|
+
|
|
247
|
+
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.
|
|
248
|
+
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.
|
|
249
|
+
|
|
250
|
+
```php
|
|
251
|
+
// bad
|
|
252
|
+
function createPackingSlip(array $items, string $destination): PackingSlip {
|
|
253
|
+
$unitCount = 0;
|
|
254
|
+
$weightGrams = 0;
|
|
255
|
+
foreach ($items as $item) {
|
|
256
|
+
$unitCount += $item->quantity;
|
|
257
|
+
$weightGrams += $item->quantity * $item->unitWeightGrams;
|
|
258
|
+
}
|
|
259
|
+
return new PackingSlip($destination, new PackingTotals($unitCount, $weightGrams));
|
|
260
|
+
}
|
|
261
|
+
// good
|
|
262
|
+
function createPackingSlip(array $items, string $destination): PackingSlip {
|
|
263
|
+
return new PackingSlip($destination, calculatePackingTotals($items));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function calculatePackingTotals(array $items): PackingTotals {
|
|
267
|
+
$unitCount = 0;
|
|
268
|
+
$weightGrams = 0;
|
|
269
|
+
foreach ($items as $item) {
|
|
270
|
+
$unitCount += $item->quantity;
|
|
271
|
+
$weightGrams += $item->quantity * $item->unitWeightGrams;
|
|
272
|
+
}
|
|
273
|
+
return new PackingTotals($unitCount, $weightGrams);
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
244
277
|
---
|
|
245
278
|
|
|
246
279
|
**When in doubt:** fail fast, keep it flat, keep it small.
|
|
247
280
|
|
|
248
|
-
**Enforcement note:** rules 1–2 are mechanical and should be backed by PHP/Laravel formatting or linting. Rules 3–10 are structural
|
|
281
|
+
**Enforcement note:** rules 1–2 are mechanical and should be backed by PHP/Laravel 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 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
|
|
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
|
|
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
|
|
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.
|