moveros 4.0.8 → 4.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 (47) hide show
  1. package/install.js +4 -2
  2. package/package.json +1 -1
  3. package/src/hooks/context-staleness.sh +46 -46
  4. package/src/hooks/dirty-tree-guard.sh +33 -33
  5. package/src/hooks/engine-protection.sh +43 -43
  6. package/src/hooks/git-safety.sh +47 -47
  7. package/src/hooks/pre-compact-backup.sh +177 -177
  8. package/src/hooks/session-log-reminder.sh +135 -73
  9. package/src/skills/systematic-debugging/CREATION-LOG.md +119 -119
  10. package/src/skills/systematic-debugging/SKILL.md +296 -296
  11. package/src/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
  12. package/src/skills/systematic-debugging/condition-based-waiting.md +115 -115
  13. package/src/skills/systematic-debugging/defense-in-depth.md +122 -122
  14. package/src/skills/systematic-debugging/find-polluter.sh +63 -63
  15. package/src/skills/systematic-debugging/root-cause-tracing.md +169 -169
  16. package/src/skills/systematic-debugging/test-academic.md +14 -14
  17. package/src/skills/systematic-debugging/test-pressure-1.md +58 -58
  18. package/src/skills/systematic-debugging/test-pressure-2.md +68 -68
  19. package/src/skills/systematic-debugging/test-pressure-3.md +69 -69
  20. package/src/structure/01_Projects/_Template Project/plan.md +55 -55
  21. package/src/structure/01_Projects/_Template Project/project_brief.md +45 -45
  22. package/src/structure/02_Areas/Engine/Active_Context.md +146 -146
  23. package/src/structure/02_Areas/Engine/Auto_Learnings.md +36 -36
  24. package/src/structure/02_Areas/Engine/Daily_Template.md +133 -133
  25. package/src/structure/02_Areas/Engine/Identity_Prime_template.md +86 -86
  26. package/src/structure/02_Areas/Engine/Mover_Dossier.md +120 -120
  27. package/src/structure/02_Areas/Engine/Strategy_template.md +65 -65
  28. package/src/structure/03_Library/SOPs/Tech_Stack.md +55 -55
  29. package/src/structure/03_Library/SOPs/Zone_Operating.md +57 -57
  30. package/src/system/V4_CONTEXT.md +262 -262
  31. package/src/theme/minimal-theme.css +271 -271
  32. package/src/workflows/analyse-day.md +401 -401
  33. package/src/workflows/debug-resistance.md +180 -180
  34. package/src/workflows/harvest.md +239 -239
  35. package/src/workflows/ignite.md +720 -720
  36. package/src/workflows/init-plan.md +16 -16
  37. package/src/workflows/morning.md +222 -222
  38. package/src/workflows/overview.md +203 -203
  39. package/src/workflows/pivot-strategy.md +218 -218
  40. package/src/workflows/plan-tomorrow.md +308 -308
  41. package/src/workflows/primer.md +207 -207
  42. package/src/workflows/reboot.md +201 -201
  43. package/src/workflows/refactor-plan.md +135 -135
  44. package/src/workflows/review-week.md +558 -558
  45. package/src/workflows/setup.md +388 -388
  46. package/src/workflows/update.md +10 -13
  47. package/src/workflows/walkthrough.md +523 -523
@@ -1,122 +1,122 @@
1
- # Defense-in-Depth Validation
2
-
3
- ## Overview
4
-
5
- When you fix a bug caused by invalid data, adding validation at one place feels sufficient. But that single check can be bypassed by different code paths, refactoring, or mocks.
6
-
7
- **Core principle:** Validate at EVERY layer data passes through. Make the bug structurally impossible.
8
-
9
- ## Why Multiple Layers
10
-
11
- Single validation: "We fixed the bug"
12
- Multiple layers: "We made the bug impossible"
13
-
14
- Different layers catch different cases:
15
- - Entry validation catches most bugs
16
- - Business logic catches edge cases
17
- - Environment guards prevent context-specific dangers
18
- - Debug logging helps when other layers fail
19
-
20
- ## The Four Layers
21
-
22
- ### Layer 1: Entry Point Validation
23
- **Purpose:** Reject obviously invalid input at API boundary
24
-
25
- ```typescript
26
- function createProject(name: string, workingDirectory: string) {
27
- if (!workingDirectory || workingDirectory.trim() === '') {
28
- throw new Error('workingDirectory cannot be empty');
29
- }
30
- if (!existsSync(workingDirectory)) {
31
- throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
32
- }
33
- if (!statSync(workingDirectory).isDirectory()) {
34
- throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
35
- }
36
- // ... proceed
37
- }
38
- ```
39
-
40
- ### Layer 2: Business Logic Validation
41
- **Purpose:** Ensure data makes sense for this operation
42
-
43
- ```typescript
44
- function initializeWorkspace(projectDir: string, sessionId: string) {
45
- if (!projectDir) {
46
- throw new Error('projectDir required for workspace initialization');
47
- }
48
- // ... proceed
49
- }
50
- ```
51
-
52
- ### Layer 3: Environment Guards
53
- **Purpose:** Prevent dangerous operations in specific contexts
54
-
55
- ```typescript
56
- async function gitInit(directory: string) {
57
- // In tests, refuse git init outside temp directories
58
- if (process.env.NODE_ENV === 'test') {
59
- const normalized = normalize(resolve(directory));
60
- const tmpDir = normalize(resolve(tmpdir()));
61
-
62
- if (!normalized.startsWith(tmpDir)) {
63
- throw new Error(
64
- `Refusing git init outside temp dir during tests: ${directory}`
65
- );
66
- }
67
- }
68
- // ... proceed
69
- }
70
- ```
71
-
72
- ### Layer 4: Debug Instrumentation
73
- **Purpose:** Capture context for forensics
74
-
75
- ```typescript
76
- async function gitInit(directory: string) {
77
- const stack = new Error().stack;
78
- logger.debug('About to git init', {
79
- directory,
80
- cwd: process.cwd(),
81
- stack,
82
- });
83
- // ... proceed
84
- }
85
- ```
86
-
87
- ## Applying the Pattern
88
-
89
- When you find a bug:
90
-
91
- 1. **Trace the data flow** - Where does bad value originate? Where used?
92
- 2. **Map all checkpoints** - List every point data passes through
93
- 3. **Add validation at each layer** - Entry, business, environment, debug
94
- 4. **Test each layer** - Try to bypass layer 1, verify layer 2 catches it
95
-
96
- ## Example from Session
97
-
98
- Bug: Empty `projectDir` caused `git init` in source code
99
-
100
- **Data flow:**
101
- 1. Test setup → empty string
102
- 2. `Project.create(name, '')`
103
- 3. `WorkspaceManager.createWorkspace('')`
104
- 4. `git init` runs in `process.cwd()`
105
-
106
- **Four layers added:**
107
- - Layer 1: `Project.create()` validates not empty/exists/writable
108
- - Layer 2: `WorkspaceManager` validates projectDir not empty
109
- - Layer 3: `WorktreeManager` refuses git init outside tmpdir in tests
110
- - Layer 4: Stack trace logging before git init
111
-
112
- **Result:** All 1847 tests passed, bug impossible to reproduce
113
-
114
- ## Key Insight
115
-
116
- All four layers were necessary. During testing, each layer caught bugs the others missed:
117
- - Different code paths bypassed entry validation
118
- - Mocks bypassed business logic checks
119
- - Edge cases on different platforms needed environment guards
120
- - Debug logging identified structural misuse
121
-
122
- **Don't stop at one validation point.** Add checks at every layer.
1
+ # Defense-in-Depth Validation
2
+
3
+ ## Overview
4
+
5
+ When you fix a bug caused by invalid data, adding validation at one place feels sufficient. But that single check can be bypassed by different code paths, refactoring, or mocks.
6
+
7
+ **Core principle:** Validate at EVERY layer data passes through. Make the bug structurally impossible.
8
+
9
+ ## Why Multiple Layers
10
+
11
+ Single validation: "We fixed the bug"
12
+ Multiple layers: "We made the bug impossible"
13
+
14
+ Different layers catch different cases:
15
+ - Entry validation catches most bugs
16
+ - Business logic catches edge cases
17
+ - Environment guards prevent context-specific dangers
18
+ - Debug logging helps when other layers fail
19
+
20
+ ## The Four Layers
21
+
22
+ ### Layer 1: Entry Point Validation
23
+ **Purpose:** Reject obviously invalid input at API boundary
24
+
25
+ ```typescript
26
+ function createProject(name: string, workingDirectory: string) {
27
+ if (!workingDirectory || workingDirectory.trim() === '') {
28
+ throw new Error('workingDirectory cannot be empty');
29
+ }
30
+ if (!existsSync(workingDirectory)) {
31
+ throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
32
+ }
33
+ if (!statSync(workingDirectory).isDirectory()) {
34
+ throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
35
+ }
36
+ // ... proceed
37
+ }
38
+ ```
39
+
40
+ ### Layer 2: Business Logic Validation
41
+ **Purpose:** Ensure data makes sense for this operation
42
+
43
+ ```typescript
44
+ function initializeWorkspace(projectDir: string, sessionId: string) {
45
+ if (!projectDir) {
46
+ throw new Error('projectDir required for workspace initialization');
47
+ }
48
+ // ... proceed
49
+ }
50
+ ```
51
+
52
+ ### Layer 3: Environment Guards
53
+ **Purpose:** Prevent dangerous operations in specific contexts
54
+
55
+ ```typescript
56
+ async function gitInit(directory: string) {
57
+ // In tests, refuse git init outside temp directories
58
+ if (process.env.NODE_ENV === 'test') {
59
+ const normalized = normalize(resolve(directory));
60
+ const tmpDir = normalize(resolve(tmpdir()));
61
+
62
+ if (!normalized.startsWith(tmpDir)) {
63
+ throw new Error(
64
+ `Refusing git init outside temp dir during tests: ${directory}`
65
+ );
66
+ }
67
+ }
68
+ // ... proceed
69
+ }
70
+ ```
71
+
72
+ ### Layer 4: Debug Instrumentation
73
+ **Purpose:** Capture context for forensics
74
+
75
+ ```typescript
76
+ async function gitInit(directory: string) {
77
+ const stack = new Error().stack;
78
+ logger.debug('About to git init', {
79
+ directory,
80
+ cwd: process.cwd(),
81
+ stack,
82
+ });
83
+ // ... proceed
84
+ }
85
+ ```
86
+
87
+ ## Applying the Pattern
88
+
89
+ When you find a bug:
90
+
91
+ 1. **Trace the data flow** - Where does bad value originate? Where used?
92
+ 2. **Map all checkpoints** - List every point data passes through
93
+ 3. **Add validation at each layer** - Entry, business, environment, debug
94
+ 4. **Test each layer** - Try to bypass layer 1, verify layer 2 catches it
95
+
96
+ ## Example from Session
97
+
98
+ Bug: Empty `projectDir` caused `git init` in source code
99
+
100
+ **Data flow:**
101
+ 1. Test setup → empty string
102
+ 2. `Project.create(name, '')`
103
+ 3. `WorkspaceManager.createWorkspace('')`
104
+ 4. `git init` runs in `process.cwd()`
105
+
106
+ **Four layers added:**
107
+ - Layer 1: `Project.create()` validates not empty/exists/writable
108
+ - Layer 2: `WorkspaceManager` validates projectDir not empty
109
+ - Layer 3: `WorktreeManager` refuses git init outside tmpdir in tests
110
+ - Layer 4: Stack trace logging before git init
111
+
112
+ **Result:** All 1847 tests passed, bug impossible to reproduce
113
+
114
+ ## Key Insight
115
+
116
+ All four layers were necessary. During testing, each layer caught bugs the others missed:
117
+ - Different code paths bypassed entry validation
118
+ - Mocks bypassed business logic checks
119
+ - Edge cases on different platforms needed environment guards
120
+ - Debug logging identified structural misuse
121
+
122
+ **Don't stop at one validation point.** Add checks at every layer.
@@ -1,63 +1,63 @@
1
- #!/usr/bin/env bash
2
- # Bisection script to find which test creates unwanted files/state
3
- # Usage: ./find-polluter.sh <file_or_dir_to_check> <test_pattern>
4
- # Example: ./find-polluter.sh '.git' 'src/**/*.test.ts'
5
-
6
- set -e
7
-
8
- if [ $# -ne 2 ]; then
9
- echo "Usage: $0 <file_to_check> <test_pattern>"
10
- echo "Example: $0 '.git' 'src/**/*.test.ts'"
11
- exit 1
12
- fi
13
-
14
- POLLUTION_CHECK="$1"
15
- TEST_PATTERN="$2"
16
-
17
- echo "🔍 Searching for test that creates: $POLLUTION_CHECK"
18
- echo "Test pattern: $TEST_PATTERN"
19
- echo ""
20
-
21
- # Get list of test files
22
- TEST_FILES=$(find . -path "$TEST_PATTERN" | sort)
23
- TOTAL=$(echo "$TEST_FILES" | wc -l | tr -d ' ')
24
-
25
- echo "Found $TOTAL test files"
26
- echo ""
27
-
28
- COUNT=0
29
- for TEST_FILE in $TEST_FILES; do
30
- COUNT=$((COUNT + 1))
31
-
32
- # Skip if pollution already exists
33
- if [ -e "$POLLUTION_CHECK" ]; then
34
- echo "⚠️ Pollution already exists before test $COUNT/$TOTAL"
35
- echo " Skipping: $TEST_FILE"
36
- continue
37
- fi
38
-
39
- echo "[$COUNT/$TOTAL] Testing: $TEST_FILE"
40
-
41
- # Run the test
42
- npm test "$TEST_FILE" > /dev/null 2>&1 || true
43
-
44
- # Check if pollution appeared
45
- if [ -e "$POLLUTION_CHECK" ]; then
46
- echo ""
47
- echo "🎯 FOUND POLLUTER!"
48
- echo " Test: $TEST_FILE"
49
- echo " Created: $POLLUTION_CHECK"
50
- echo ""
51
- echo "Pollution details:"
52
- ls -la "$POLLUTION_CHECK"
53
- echo ""
54
- echo "To investigate:"
55
- echo " npm test $TEST_FILE # Run just this test"
56
- echo " cat $TEST_FILE # Review test code"
57
- exit 1
58
- fi
59
- done
60
-
61
- echo ""
62
- echo "✅ No polluter found - all tests clean!"
63
- exit 0
1
+ #!/usr/bin/env bash
2
+ # Bisection script to find which test creates unwanted files/state
3
+ # Usage: ./find-polluter.sh <file_or_dir_to_check> <test_pattern>
4
+ # Example: ./find-polluter.sh '.git' 'src/**/*.test.ts'
5
+
6
+ set -e
7
+
8
+ if [ $# -ne 2 ]; then
9
+ echo "Usage: $0 <file_to_check> <test_pattern>"
10
+ echo "Example: $0 '.git' 'src/**/*.test.ts'"
11
+ exit 1
12
+ fi
13
+
14
+ POLLUTION_CHECK="$1"
15
+ TEST_PATTERN="$2"
16
+
17
+ echo "🔍 Searching for test that creates: $POLLUTION_CHECK"
18
+ echo "Test pattern: $TEST_PATTERN"
19
+ echo ""
20
+
21
+ # Get list of test files
22
+ TEST_FILES=$(find . -path "$TEST_PATTERN" | sort)
23
+ TOTAL=$(echo "$TEST_FILES" | wc -l | tr -d ' ')
24
+
25
+ echo "Found $TOTAL test files"
26
+ echo ""
27
+
28
+ COUNT=0
29
+ for TEST_FILE in $TEST_FILES; do
30
+ COUNT=$((COUNT + 1))
31
+
32
+ # Skip if pollution already exists
33
+ if [ -e "$POLLUTION_CHECK" ]; then
34
+ echo "⚠️ Pollution already exists before test $COUNT/$TOTAL"
35
+ echo " Skipping: $TEST_FILE"
36
+ continue
37
+ fi
38
+
39
+ echo "[$COUNT/$TOTAL] Testing: $TEST_FILE"
40
+
41
+ # Run the test
42
+ npm test "$TEST_FILE" > /dev/null 2>&1 || true
43
+
44
+ # Check if pollution appeared
45
+ if [ -e "$POLLUTION_CHECK" ]; then
46
+ echo ""
47
+ echo "🎯 FOUND POLLUTER!"
48
+ echo " Test: $TEST_FILE"
49
+ echo " Created: $POLLUTION_CHECK"
50
+ echo ""
51
+ echo "Pollution details:"
52
+ ls -la "$POLLUTION_CHECK"
53
+ echo ""
54
+ echo "To investigate:"
55
+ echo " npm test $TEST_FILE # Run just this test"
56
+ echo " cat $TEST_FILE # Review test code"
57
+ exit 1
58
+ fi
59
+ done
60
+
61
+ echo ""
62
+ echo "✅ No polluter found - all tests clean!"
63
+ exit 0