jettypod 4.1.2 → 4.1.4
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/.nvmrc +1 -0
- package/docs/COMPLETE-TESTING-STRATEGY.md +970 -0
- package/docs/DECISIONS.md +10 -12
- package/docs/NODE_VERSION.md +83 -0
- package/docs/TDD-INFRASTRUCTURE-STRATEGY.md +1374 -0
- package/docs/TESTING-FOR-NON-ENGINEERS.md +1588 -0
- package/docs/TESTING-STRATEGY-AUDIT.md +698 -0
- package/hooks/post-checkout +17 -0
- package/hooks/post-merge +17 -0
- package/hooks/pre-commit +30 -0
- package/jettypod.js +259 -120
- package/lib/coverage-tracker.js +218 -0
- package/lib/database.js +2 -0
- package/lib/db-export.js +192 -0
- package/lib/db-import.js +193 -0
- package/lib/external-transition-handler.js +32 -0
- package/lib/git-hook-helpers.js +174 -0
- package/lib/git-root.js +90 -0
- package/lib/infrastructure-chore-generator.js +45 -0
- package/lib/install-hooks.js +52 -0
- package/lib/jettypod-backup.js +238 -0
- package/lib/merge-lock.js +193 -0
- package/lib/migrations/012-add-worktree-path.js +38 -0
- package/lib/migrations/013-worktrees-table.js +86 -0
- package/lib/migrations/014-migrate-worktree-data.js +161 -0
- package/lib/migrations/015-merge-locks-table.js +67 -0
- package/lib/pattern-finder.js +152 -0
- package/lib/process-manager.js +140 -0
- package/lib/production-standards-reader.js +13 -2
- package/lib/production-standards-writer.js +85 -0
- package/lib/skills/feature-planning/dry-run-validator.js +135 -0
- package/lib/skills/feature-planning/validation-formatter.js +160 -0
- package/lib/smart-conflict-detection.js +168 -0
- package/lib/smart-fetch-rebase.js +614 -0
- package/lib/step-definition-parser.js +76 -0
- package/lib/unit-test-generator.js +232 -0
- package/lib/verification-command-generator.js +66 -0
- package/lib/worktree-diagnostics.js +413 -0
- package/lib/worktree-facade.js +174 -0
- package/lib/worktree-manager.js +636 -0
- package/lib/worktree-reconciler.js +429 -0
- package/package.json +30 -3
- package/skills-templates/external-transition/SKILL.md +34 -3
- package/skills-templates/feature-planning/SKILL.md +190 -24
- package/skills-templates/production-mode/SKILL.md +127 -9
- package/skills-templates/speed-mode/SKILL.md +454 -51
- package/skills-templates/stable-mode/SKILL.md +285 -76
- package/.claude/PROTECT_SKILLS.md +0 -28
- package/.claude/settings.json +0 -24
- package/.claude/settings.local.json +0 -16
- package/.claude/skills/epic-planning/SKILL.md +0 -297
- package/.claude/skills/external-transition/SKILL.md +0 -384
- package/.claude/skills/feature-planning/SKILL.md +0 -464
- package/.claude/skills/production-mode/SKILL.md +0 -369
- package/.claude/skills/speed-mode/SKILL.md +0 -481
- package/.claude/skills/stable-mode/SKILL.md +0 -713
- package/.claude/skills.backup-2025-11-10T23-33-09-368Z/epic-planning/SKILL.md +0 -297
- package/.claude/skills.backup-2025-11-10T23-33-09-368Z/feature-planning/SKILL.md +0 -464
- package/.claude/skills.backup-2025-11-10T23-33-09-368Z/speed-mode/SKILL.md +0 -467
- package/.claude/skills.backup-2025-11-10T23-33-09-368Z/stable-mode/SKILL.md +0 -673
- package/.claude/skills.backup-2025-11-11T16-15-10-070Z/epic-discover/SKILL.md +0 -297
- package/.claude/skills.backup-2025-11-11T16-42-43-212Z/epic-planning/SKILL.md +0 -297
- package/.claude/skills.backup-2025-11-11T16-42-43-212Z/feature-planning/SKILL.md +0 -464
- package/.claude/skills.backup-2025-11-11T16-42-43-212Z/speed-mode/SKILL.md +0 -467
- package/.claude/skills.backup-2025-11-11T16-42-43-212Z/stable-mode/SKILL.md +0 -673
- package/.claude/skills.backup-2025-11-11T17-06-09-783Z/epic-planning/SKILL.md +0 -297
- package/.claude/skills.backup-2025-11-11T17-06-09-783Z/feature-planning/SKILL.md +0 -464
- package/.claude/skills.backup-2025-11-11T17-06-09-783Z/speed-mode/SKILL.md +0 -467
- package/.claude/skills.backup-2025-11-11T17-06-09-783Z/stable-mode/SKILL.md +0 -673
- package/.devpod/current-work.json +0 -10
- package/.devpod/work.db +0 -0
- package/.github/workflows/test-safety.yml +0 -85
- package/.jettypod/config.json +0 -5
- package/.jettypod/current-work.json +0 -10
- package/.jettypod/hooks/README.md +0 -77
- package/.jettypod/hooks/protect-claude-md.js +0 -338
- package/.jettypod/test-work.db +0 -0
- package/.jettypod/work.db +0 -0
- package/CLAUDE.md +0 -49
- package/SPEED-STABLE-AUDIT.md +0 -853
- package/SYSTEM-BEHAVIOR.md +0 -2199
- package/TEST_SAFETY_AUDIT.md +0 -314
- package/TEST_SAFETY_IMPLEMENTATION.md +0 -97
- package/cucumber-report.html +0 -45
- package/dist/devpod-linux +0 -0
- package/dist/devpod-macos +0 -0
- package/dist/devpod-win.exe +0 -0
- package/docs/features/jettypod-standards-explained.md +0 -543
- package/docs/features/standards-inventory.md +0 -257
- package/features/auto-generate-production-chores.feature +0 -13
- package/features/backlog-command.feature +0 -26
- package/features/backlog-filtering-production.feature +0 -10
- package/features/claude-md-protection/steps.js +0 -498
- package/features/decisions/index.js +0 -490
- package/features/decisions/index.test.js +0 -208
- package/features/fix-text-wrapping.feature +0 -42
- package/features/git-hooks/git-hooks.feature +0 -30
- package/features/git-hooks/index.js +0 -93
- package/features/git-hooks/index.test.js +0 -137
- package/features/git-hooks/post-commit +0 -56
- package/features/git-hooks/post-merge +0 -47
- package/features/git-hooks/pre-commit +0 -28
- package/features/git-hooks/simple-steps.js +0 -53
- package/features/git-hooks/simple-test.feature +0 -10
- package/features/git-hooks/steps.js +0 -196
- package/features/jettypod-update-command.feature +0 -46
- package/features/mode-prompts/index.js +0 -95
- package/features/mode-prompts/simple-steps.js +0 -44
- package/features/mode-prompts/simple-test.feature +0 -9
- package/features/mode-prompts/validation.test.js +0 -120
- package/features/multiple-claude-instances.feature +0 -121
- package/features/production-mode-skill.feature +0 -121
- package/features/refactor-mode/steps.js +0 -217
- package/features/refactor-mode.feature +0 -49
- package/features/simplify-external-transition.feature +0 -166
- package/features/skills-update/index.test.js +0 -216
- package/features/step_definitions/backlog-command.steps.js +0 -37
- package/features/step_definitions/fix-text-wrapping.steps.js +0 -271
- package/features/step_definitions/multiple-claude-instances.steps.js +0 -621
- package/features/step_definitions/production-mode-skill.steps.js +0 -862
- package/features/step_definitions/simplify-external-transition.steps.js +0 -370
- package/features/step_definitions/terminal-logo.steps.js +0 -145
- package/features/step_definitions/update-command.steps.js +0 -183
- package/features/support/hooks.js +0 -9
- package/features/terminal-logo/index.js +0 -39
- package/features/terminal-logo/terminal-logo.feature +0 -30
- package/features/update-command/index.js +0 -181
- package/features/update-command/index.test.js +0 -225
- package/features/work-commands/bug-workflow-display.feature +0 -22
- package/features/work-commands/index.js +0 -498
- package/features/work-commands/simple-steps.js +0 -69
- package/features/work-commands/stable-tests.feature +0 -57
- package/features/work-commands/steps.js +0 -1174
- package/features/work-commands/validation.test.js +0 -88
- package/features/work-commands/work-commands.feature +0 -13
- package/features/work-tracking/discovery-validation.test.js +0 -228
- package/features/work-tracking/index.js +0 -1921
- package/features/work-tracking/mode-required.feature +0 -112
- package/features/work-tracking/phase-tracking.test.js +0 -482
- package/features/work-tracking/prototype-tracking.test.js +0 -485
- package/features/work-tracking/tree-view.test.js +0 -310
- package/features/work-tracking/work-set-mode.feature +0 -71
- package/features/work-tracking/work-start-mode.feature +0 -88
- package/full-test.txt +0 -0
- package/lib/bug-workflow.test.js +0 -177
- package/lib/claudemd.test.js +0 -195
- package/lib/config.test.js +0 -511
- package/lib/constants.test.js +0 -164
- package/lib/current-work.test.js +0 -146
- package/lib/database-project-config.test.js +0 -111
- package/lib/database.test.js +0 -106
- package/lib/decisions-generator.test.js +0 -457
- package/lib/decisions-helpers.test.js +0 -310
- package/lib/git-coordinator.js +0 -167
- package/lib/git.test.js +0 -145
- package/lib/migrations/002-default-work-item-modes.test.js +0 -351
- package/lib/production-chore-generator.test.js +0 -432
- package/lib/production-context-detector.test.js +0 -277
- package/lib/production-scenario-appender.test.js +0 -235
- package/lib/production-scenario-validator.test.js +0 -246
- package/lib/production-standards-reader.test.js +0 -270
- package/lib/project-state.test.js +0 -92
- package/lib/push-queue.js +0 -417
- package/lib/queue-processor.js +0 -74
- package/lib/test-helpers.js +0 -202
- package/lib/test-helpers.test.js +0 -255
- package/prototypes/2025-01-11-production-mode-autonomous.js +0 -119
- package/prototypes/2025-01-11-production-mode-collaborative.js +0 -166
- package/prototypes/2025-01-11-production-mode-guided.js +0 -217
- package/prototypes/2025-01-11-production-mode-smart-context.js +0 -347
- package/prototypes/2025-01-11-production-standards-example.md +0 -204
- package/prototypes/2025-11-10-backlog-filtering-tree-aware.js +0 -242
- package/prototypes/test/index.html +0 -1
- package/setup-dist-repo.sh +0 -68
- package/test-production-standards-engine.js +0 -130
- package/test-results.json +0 -2195
- package/test-safety-check.sh +0 -80
- package/work-item-tracking-plan.md +0 -199
- /package/{.jettypod/devpod.db → jettypod.db} +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worktree Facade - Graceful Degradation Layer
|
|
3
|
+
*
|
|
4
|
+
* This module provides a high-level API for worktree operations with graceful
|
|
5
|
+
* fallback when worktree operations fail. It wraps the worktree-manager module
|
|
6
|
+
* and provides fallback to working in the main repository.
|
|
7
|
+
*
|
|
8
|
+
* Key principles:
|
|
9
|
+
* - Never fail the entire operation if worktree creation fails
|
|
10
|
+
* - Fall back to main repository when worktrees don't work
|
|
11
|
+
* - Provide clear feedback about what mode we're in (worktree vs main)
|
|
12
|
+
* - Preserve all error information for debugging
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const worktreeManager = require('./worktree-manager');
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Start work on a work item with graceful degradation
|
|
21
|
+
*
|
|
22
|
+
* Attempts to create a worktree. If that fails, falls back to main repository.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} workItem - Work item from database (must have id and title)
|
|
25
|
+
* @param {Object} options - Optional configuration
|
|
26
|
+
* @param {string} options.repoPath - Path to git repository (defaults to process.cwd())
|
|
27
|
+
* @param {Object} options.db - Database connection (defaults to global database)
|
|
28
|
+
* @returns {Promise<Object>} Result object with mode ('worktree' or 'main'), path, worktree record (if applicable), and any errors
|
|
29
|
+
*/
|
|
30
|
+
async function startWork(workItem, options = {}) {
|
|
31
|
+
if (!workItem || !workItem.id) {
|
|
32
|
+
return Promise.reject(new Error('Invalid work item: must have id'));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const repoPath = options.repoPath || process.cwd();
|
|
36
|
+
const result = {
|
|
37
|
+
mode: null, // 'worktree' or 'main'
|
|
38
|
+
path: null, // Working directory path
|
|
39
|
+
worktree: null, // Worktree record (if mode='worktree')
|
|
40
|
+
error: null, // Error that caused fallback (if mode='main')
|
|
41
|
+
warnings: [] // Non-fatal warnings
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Attempt to create worktree
|
|
45
|
+
try {
|
|
46
|
+
const worktree = await worktreeManager.createWorktree(workItem, options);
|
|
47
|
+
|
|
48
|
+
// Verify the worktree path exists and is accessible
|
|
49
|
+
if (!fs.existsSync(worktree.worktree_path)) {
|
|
50
|
+
throw new Error(`Worktree directory was not created: ${worktree.worktree_path}`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Success! Return worktree mode
|
|
54
|
+
result.mode = 'worktree';
|
|
55
|
+
result.path = worktree.worktree_path;
|
|
56
|
+
result.worktree = worktree;
|
|
57
|
+
return result;
|
|
58
|
+
|
|
59
|
+
} catch (err) {
|
|
60
|
+
// Worktree creation failed - fall back to main repository
|
|
61
|
+
result.mode = 'main';
|
|
62
|
+
result.path = repoPath;
|
|
63
|
+
result.error = {
|
|
64
|
+
message: err.message,
|
|
65
|
+
stack: err.stack,
|
|
66
|
+
reason: 'worktree_creation_failed'
|
|
67
|
+
};
|
|
68
|
+
result.warnings.push('Worktree creation failed - using main repository instead');
|
|
69
|
+
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Stop work on a work item with graceful degradation
|
|
76
|
+
*
|
|
77
|
+
* Attempts to cleanup worktree. If that fails, marks as corrupted and continues.
|
|
78
|
+
*
|
|
79
|
+
* @param {number} worktreeId - Worktree ID (can be null if working in main)
|
|
80
|
+
* @param {Object} options - Optional configuration
|
|
81
|
+
* @param {string} options.repoPath - Path to git repository (defaults to process.cwd())
|
|
82
|
+
* @param {Object} options.db - Database connection (defaults to global database)
|
|
83
|
+
* @param {boolean} options.deleteBranch - Whether to delete the branch (defaults to false)
|
|
84
|
+
* @returns {Promise<Object>} Result object with success status, any errors, and warnings
|
|
85
|
+
*/
|
|
86
|
+
async function stopWork(worktreeId, options = {}) {
|
|
87
|
+
// If no worktree ID, we were working in main - nothing to cleanup
|
|
88
|
+
if (!worktreeId) {
|
|
89
|
+
return {
|
|
90
|
+
success: true,
|
|
91
|
+
mode: 'main',
|
|
92
|
+
message: 'No worktree to cleanup (was working in main repository)'
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const result = {
|
|
97
|
+
success: false,
|
|
98
|
+
mode: 'worktree',
|
|
99
|
+
error: null,
|
|
100
|
+
warnings: []
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
await worktreeManager.cleanupWorktree(worktreeId, options);
|
|
105
|
+
result.success = true;
|
|
106
|
+
return result;
|
|
107
|
+
|
|
108
|
+
} catch (err) {
|
|
109
|
+
// Cleanup failed - surface the error to the user
|
|
110
|
+
result.error = {
|
|
111
|
+
message: err.message,
|
|
112
|
+
stack: err.stack,
|
|
113
|
+
reason: 'worktree_cleanup_failed'
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Check if it's a "directory in use" error
|
|
117
|
+
if (err.message.includes('Failed to remove worktree directory')) {
|
|
118
|
+
result.error.userMessage =
|
|
119
|
+
'Cannot cleanup worktree - files may still be in use by running tests or processes.\n' +
|
|
120
|
+
'Please wait for background processes to finish and try again.';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
result.success = false;
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Get the current working mode for a work item
|
|
130
|
+
*
|
|
131
|
+
* Checks if there's an active worktree for the work item.
|
|
132
|
+
*
|
|
133
|
+
* @param {number} workItemId - Work item ID
|
|
134
|
+
* @param {Object} options - Optional configuration
|
|
135
|
+
* @param {Object} options.db - Database connection (defaults to global database)
|
|
136
|
+
* @returns {Promise<Object>} Result object with mode, worktree record (if applicable)
|
|
137
|
+
*/
|
|
138
|
+
async function getWorkingMode(workItemId, options = {}) {
|
|
139
|
+
try {
|
|
140
|
+
const worktree = await worktreeManager.getWorktreeForWorkItem(workItemId, options);
|
|
141
|
+
|
|
142
|
+
if (worktree && worktree.status === 'active') {
|
|
143
|
+
return {
|
|
144
|
+
mode: 'worktree',
|
|
145
|
+
worktree: worktree,
|
|
146
|
+
path: worktree.worktree_path
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
mode: 'main',
|
|
152
|
+
worktree: null,
|
|
153
|
+
path: options.repoPath || process.cwd()
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
} catch (err) {
|
|
157
|
+
// If we can't determine mode, assume main (safer fallback)
|
|
158
|
+
return {
|
|
159
|
+
mode: 'main',
|
|
160
|
+
worktree: null,
|
|
161
|
+
path: options.repoPath || process.cwd(),
|
|
162
|
+
error: {
|
|
163
|
+
message: err.message,
|
|
164
|
+
reason: 'mode_detection_failed'
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
module.exports = {
|
|
171
|
+
startWork,
|
|
172
|
+
stopWork,
|
|
173
|
+
getWorkingMode
|
|
174
|
+
};
|