pmp-gywd 3.3.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 (126) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +567 -0
  3. package/bin/install.js +348 -0
  4. package/commands/gywd/add-phase.md +207 -0
  5. package/commands/gywd/anticipate.md +271 -0
  6. package/commands/gywd/bootstrap.md +336 -0
  7. package/commands/gywd/challenge.md +344 -0
  8. package/commands/gywd/check-drift.md +144 -0
  9. package/commands/gywd/complete-milestone.md +106 -0
  10. package/commands/gywd/consider-issues.md +202 -0
  11. package/commands/gywd/context.md +93 -0
  12. package/commands/gywd/create-roadmap.md +115 -0
  13. package/commands/gywd/deps.md +169 -0
  14. package/commands/gywd/digest.md +138 -0
  15. package/commands/gywd/discuss-milestone.md +47 -0
  16. package/commands/gywd/discuss-phase.md +60 -0
  17. package/commands/gywd/execute-plan.md +161 -0
  18. package/commands/gywd/extract-decisions.md +325 -0
  19. package/commands/gywd/health.md +150 -0
  20. package/commands/gywd/help.md +556 -0
  21. package/commands/gywd/history.md +278 -0
  22. package/commands/gywd/impact.md +317 -0
  23. package/commands/gywd/init.md +95 -0
  24. package/commands/gywd/insert-phase.md +227 -0
  25. package/commands/gywd/list-phase-assumptions.md +50 -0
  26. package/commands/gywd/map-codebase.md +84 -0
  27. package/commands/gywd/memory.md +159 -0
  28. package/commands/gywd/new-milestone.md +59 -0
  29. package/commands/gywd/new-project.md +315 -0
  30. package/commands/gywd/pause-work.md +123 -0
  31. package/commands/gywd/plan-fix.md +205 -0
  32. package/commands/gywd/plan-phase.md +93 -0
  33. package/commands/gywd/preview-plan.md +139 -0
  34. package/commands/gywd/profile.md +363 -0
  35. package/commands/gywd/progress.md +317 -0
  36. package/commands/gywd/remove-phase.md +338 -0
  37. package/commands/gywd/research-phase.md +91 -0
  38. package/commands/gywd/resume-work.md +40 -0
  39. package/commands/gywd/rollback.md +179 -0
  40. package/commands/gywd/status.md +42 -0
  41. package/commands/gywd/sync-github.md +234 -0
  42. package/commands/gywd/verify-work.md +71 -0
  43. package/commands/gywd/why.md +251 -0
  44. package/docs/COMMANDS.md +722 -0
  45. package/docs/CONTRIBUTING.md +342 -0
  46. package/docs/EXAMPLES.md +535 -0
  47. package/docs/GETTING-STARTED.md +262 -0
  48. package/docs/README.md +55 -0
  49. package/docs/RELEASING.md +159 -0
  50. package/get-your-work-done/core/agent-patterns.md +331 -0
  51. package/get-your-work-done/core/architecture.md +334 -0
  52. package/get-your-work-done/core/context-model-schema.json +154 -0
  53. package/get-your-work-done/core/decisions-schema.json +193 -0
  54. package/get-your-work-done/core/learning-state-schema.json +133 -0
  55. package/get-your-work-done/core/profile-schema.json +257 -0
  56. package/get-your-work-done/references/adaptive-decomposition.md +175 -0
  57. package/get-your-work-done/references/checkpoints.md +287 -0
  58. package/get-your-work-done/references/confidence-scoring.md +169 -0
  59. package/get-your-work-done/references/continuation-format.md +255 -0
  60. package/get-your-work-done/references/git-integration.md +254 -0
  61. package/get-your-work-done/references/plan-format.md +428 -0
  62. package/get-your-work-done/references/principles.md +157 -0
  63. package/get-your-work-done/references/questioning.md +162 -0
  64. package/get-your-work-done/references/research-pitfalls.md +215 -0
  65. package/get-your-work-done/references/scope-estimation.md +172 -0
  66. package/get-your-work-done/references/tdd.md +263 -0
  67. package/get-your-work-done/templates/codebase/architecture.md +255 -0
  68. package/get-your-work-done/templates/codebase/concerns.md +310 -0
  69. package/get-your-work-done/templates/codebase/conventions.md +307 -0
  70. package/get-your-work-done/templates/codebase/integrations.md +280 -0
  71. package/get-your-work-done/templates/codebase/stack.md +186 -0
  72. package/get-your-work-done/templates/codebase/structure.md +285 -0
  73. package/get-your-work-done/templates/codebase/testing.md +480 -0
  74. package/get-your-work-done/templates/config.json +18 -0
  75. package/get-your-work-done/templates/context.md +161 -0
  76. package/get-your-work-done/templates/continue-here.md +78 -0
  77. package/get-your-work-done/templates/discovery.md +146 -0
  78. package/get-your-work-done/templates/issues.md +32 -0
  79. package/get-your-work-done/templates/milestone-archive.md +123 -0
  80. package/get-your-work-done/templates/milestone-context.md +93 -0
  81. package/get-your-work-done/templates/milestone.md +115 -0
  82. package/get-your-work-done/templates/phase-prompt.md +303 -0
  83. package/get-your-work-done/templates/project.md +184 -0
  84. package/get-your-work-done/templates/research.md +529 -0
  85. package/get-your-work-done/templates/roadmap.md +196 -0
  86. package/get-your-work-done/templates/state.md +210 -0
  87. package/get-your-work-done/templates/summary.md +273 -0
  88. package/get-your-work-done/templates/uat-issues.md +143 -0
  89. package/get-your-work-done/workflows/complete-milestone.md +643 -0
  90. package/get-your-work-done/workflows/create-milestone.md +416 -0
  91. package/get-your-work-done/workflows/create-roadmap.md +481 -0
  92. package/get-your-work-done/workflows/discovery-phase.md +293 -0
  93. package/get-your-work-done/workflows/discuss-milestone.md +236 -0
  94. package/get-your-work-done/workflows/discuss-phase.md +247 -0
  95. package/get-your-work-done/workflows/execute-phase.md +1625 -0
  96. package/get-your-work-done/workflows/list-phase-assumptions.md +178 -0
  97. package/get-your-work-done/workflows/map-codebase.md +434 -0
  98. package/get-your-work-done/workflows/plan-phase.md +488 -0
  99. package/get-your-work-done/workflows/research-phase.md +436 -0
  100. package/get-your-work-done/workflows/resume-project.md +287 -0
  101. package/get-your-work-done/workflows/transition.md +580 -0
  102. package/get-your-work-done/workflows/verify-work.md +202 -0
  103. package/lib/automation/dependency-analyzer.js +635 -0
  104. package/lib/automation/doc-generator.js +643 -0
  105. package/lib/automation/index.js +42 -0
  106. package/lib/automation/test-generator.js +628 -0
  107. package/lib/context/context-analyzer.js +554 -0
  108. package/lib/context/context-cache.js +426 -0
  109. package/lib/context/context-predictor.js +622 -0
  110. package/lib/context/index.js +44 -0
  111. package/lib/memory/confidence-calibrator.js +484 -0
  112. package/lib/memory/feedback-collector.js +551 -0
  113. package/lib/memory/global-memory.js +465 -0
  114. package/lib/memory/index.js +75 -0
  115. package/lib/memory/pattern-aggregator.js +487 -0
  116. package/lib/memory/team-sync.js +501 -0
  117. package/lib/profile/index.js +24 -0
  118. package/lib/profile/pattern-learner.js +303 -0
  119. package/lib/profile/profile-manager.js +445 -0
  120. package/lib/questioning/index.js +49 -0
  121. package/lib/questioning/question-engine.js +311 -0
  122. package/lib/questioning/question-templates.js +315 -0
  123. package/lib/validators/command-validator.js +188 -0
  124. package/lib/validators/index.js +29 -0
  125. package/lib/validators/schema-validator.js +183 -0
  126. package/package.json +61 -0
@@ -0,0 +1,445 @@
1
+ /**
2
+ * Profile Manager
3
+ *
4
+ * Manages developer profile persistence and loading.
5
+ * The Developer Digital Twin - models patterns, preferences, and expertise.
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { GlobalMemory } = require('../memory');
11
+
12
+ /**
13
+ * Default profile structure
14
+ */
15
+ const DEFAULT_PROFILE = {
16
+ version: '3.0.0',
17
+ created: null,
18
+ lastUpdated: null,
19
+ cognitive: {
20
+ problemApproach: 'unknown', // 'top-down', 'bottom-up', 'hybrid'
21
+ abstractionPreference: 'unknown', // 'concrete', 'abstract', 'balanced'
22
+ debuggingStyle: 'unknown', // 'systematic', 'intuitive', 'mixed'
23
+ learningMode: 'unknown', // 'documentation', 'examples', 'experimentation'
24
+ },
25
+ communication: {
26
+ verbosity: 'medium', // 'minimal', 'medium', 'detailed'
27
+ formality: 'professional', // 'casual', 'professional', 'formal'
28
+ documentationStyle: 'inline', // 'inline', 'jsdoc', 'readme', 'minimal'
29
+ explanationDepth: 'moderate', // 'brief', 'moderate', 'thorough'
30
+ },
31
+ tooling: {
32
+ primaryLanguages: [],
33
+ testingFrameworks: [],
34
+ buildTools: [],
35
+ preferredPatterns: [],
36
+ avoidedPatterns: [],
37
+ },
38
+ domain: {
39
+ primaryDomains: [],
40
+ expertiseAreas: [],
41
+ industryContext: null, // 'healthcare', 'fintech', 'gaming', etc.
42
+ },
43
+ quality: {
44
+ testCoverage: 'standard', // 'minimal', 'standard', 'comprehensive'
45
+ codeStyle: 'standard', // 'compact', 'standard', 'verbose'
46
+ errorHandling: 'defensive', // 'minimal', 'defensive', 'paranoid'
47
+ documentationLevel: 'moderate', // 'minimal', 'moderate', 'extensive'
48
+ },
49
+ interactions: {
50
+ totalSessions: 0,
51
+ questionsAsked: 0,
52
+ decisionsRecorded: 0,
53
+ patternsLearned: 0,
54
+ },
55
+ patterns: [],
56
+ preferences: {},
57
+ };
58
+
59
+ /**
60
+ * Profile Manager class
61
+ */
62
+ class ProfileManager {
63
+ /**
64
+ * @param {string} profileDir - Directory to store profile data
65
+ * @param {object} [options] - Configuration options
66
+ * @param {boolean} [options.enableGlobalSync=false] - Enable global memory sync
67
+ * @param {boolean} [options.autoSync=false] - Auto-sync on save
68
+ */
69
+ constructor(profileDir, options = {}) {
70
+ this.profileDir = profileDir;
71
+ this.profilePath = path.join(profileDir, 'developer-profile.json');
72
+ this.profile = null;
73
+
74
+ // Global memory options
75
+ this.enableGlobalSync = options.enableGlobalSync || false;
76
+ this.autoSync = options.autoSync || false;
77
+ this.globalMemory = null;
78
+
79
+ if (this.enableGlobalSync) {
80
+ this.globalMemory = new GlobalMemory();
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Initialize or load the profile
86
+ * @returns {object} The profile object
87
+ */
88
+ init() {
89
+ if (!fs.existsSync(this.profileDir)) {
90
+ fs.mkdirSync(this.profileDir, { recursive: true });
91
+ }
92
+
93
+ if (fs.existsSync(this.profilePath)) {
94
+ return this.load();
95
+ }
96
+
97
+ return this.create();
98
+ }
99
+
100
+ /**
101
+ * Create a new profile
102
+ * @returns {object} The new profile
103
+ */
104
+ create() {
105
+ const now = new Date().toISOString();
106
+ this.profile = {
107
+ ...JSON.parse(JSON.stringify(DEFAULT_PROFILE)),
108
+ created: now,
109
+ lastUpdated: now,
110
+ };
111
+ this.save();
112
+ return this.profile;
113
+ }
114
+
115
+ /**
116
+ * Load existing profile
117
+ * @returns {object} The loaded profile
118
+ */
119
+ load() {
120
+ try {
121
+ const content = fs.readFileSync(this.profilePath, 'utf8');
122
+ this.profile = JSON.parse(content);
123
+
124
+ // Merge with defaults for any missing fields
125
+ this.profile = this.mergeWithDefaults(this.profile);
126
+ return this.profile;
127
+ } catch (error) {
128
+ // If load fails, create new profile
129
+ return this.create();
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Merge loaded profile with defaults
135
+ * @param {object} loaded - The loaded profile
136
+ * @returns {object} Merged profile
137
+ */
138
+ mergeWithDefaults(loaded) {
139
+ const merged = JSON.parse(JSON.stringify(DEFAULT_PROFILE));
140
+
141
+ const deepMerge = (target, source) => {
142
+ for (const key of Object.keys(source)) {
143
+ if (source[key] !== null && typeof source[key] === 'object' && !Array.isArray(source[key])) {
144
+ if (!target[key]) target[key] = {};
145
+ deepMerge(target[key], source[key]);
146
+ } else if (source[key] !== null && source[key] !== undefined) {
147
+ target[key] = source[key];
148
+ }
149
+ }
150
+ };
151
+
152
+ deepMerge(merged, loaded);
153
+ return merged;
154
+ }
155
+
156
+ /**
157
+ * Save the current profile
158
+ */
159
+ save() {
160
+ if (!this.profile) return;
161
+
162
+ this.profile.lastUpdated = new Date().toISOString();
163
+ fs.writeFileSync(
164
+ this.profilePath,
165
+ JSON.stringify(this.profile, null, 2),
166
+ );
167
+ }
168
+
169
+ /**
170
+ * Get the current profile
171
+ * @returns {object|null} The profile or null
172
+ */
173
+ getProfile() {
174
+ return this.profile;
175
+ }
176
+
177
+ /**
178
+ * Update a specific section of the profile
179
+ * @param {string} section - Section name (e.g., 'cognitive', 'tooling')
180
+ * @param {object} updates - Updates to apply
181
+ */
182
+ updateSection(section, updates) {
183
+ if (!this.profile) this.init();
184
+
185
+ if (this.profile[section]) {
186
+ this.profile[section] = {
187
+ ...this.profile[section],
188
+ ...updates,
189
+ };
190
+ this.save();
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Record a preference
196
+ * @param {string} key - Preference key
197
+ * @param {any} value - Preference value
198
+ * @param {number} confidence - Confidence level (0-1)
199
+ */
200
+ recordPreference(key, value, confidence = 0.5) {
201
+ if (!this.profile) this.init();
202
+
203
+ this.profile.preferences[key] = {
204
+ value,
205
+ confidence,
206
+ recordedAt: new Date().toISOString(),
207
+ };
208
+ this.save();
209
+ }
210
+
211
+ /**
212
+ * Record a learned pattern
213
+ * @param {object} pattern - Pattern object with type, description, examples
214
+ */
215
+ recordPattern(pattern) {
216
+ if (!this.profile) this.init();
217
+
218
+ const patternEntry = {
219
+ ...pattern,
220
+ id: `pattern-${Date.now()}`,
221
+ learnedAt: new Date().toISOString(),
222
+ };
223
+
224
+ this.profile.patterns.push(patternEntry);
225
+ this.profile.interactions.patternsLearned++;
226
+ this.save();
227
+ }
228
+
229
+ /**
230
+ * Increment interaction counters
231
+ * @param {string} type - Type of interaction ('session', 'question', 'decision')
232
+ */
233
+ recordInteraction(type) {
234
+ if (!this.profile) this.init();
235
+
236
+ switch (type) {
237
+ case 'session':
238
+ this.profile.interactions.totalSessions++;
239
+ break;
240
+ case 'question':
241
+ this.profile.interactions.questionsAsked++;
242
+ break;
243
+ case 'decision':
244
+ this.profile.interactions.decisionsRecorded++;
245
+ break;
246
+ default:
247
+ // Unknown interaction type, ignore
248
+ break;
249
+ }
250
+ this.save();
251
+ }
252
+
253
+ /**
254
+ * Add a language to primary languages
255
+ * @param {string} language - Language name
256
+ */
257
+ addLanguage(language) {
258
+ if (!this.profile) this.init();
259
+
260
+ const langs = this.profile.tooling.primaryLanguages;
261
+ if (!langs.includes(language)) {
262
+ langs.push(language);
263
+ this.save();
264
+ }
265
+ }
266
+
267
+ /**
268
+ * Add a domain expertise area
269
+ * @param {string} area - Expertise area
270
+ */
271
+ addExpertise(area) {
272
+ if (!this.profile) this.init();
273
+
274
+ const areas = this.profile.domain.expertiseAreas;
275
+ if (!areas.includes(area)) {
276
+ areas.push(area);
277
+ this.save();
278
+ }
279
+ }
280
+
281
+ /**
282
+ * Get a summary of the profile for context
283
+ * @returns {object} Profile summary
284
+ */
285
+ getSummary() {
286
+ if (!this.profile) return null;
287
+
288
+ return {
289
+ cognitive: this.profile.cognitive,
290
+ communication: this.profile.communication,
291
+ languages: this.profile.tooling.primaryLanguages,
292
+ domains: this.profile.domain.primaryDomains,
293
+ expertise: this.profile.domain.expertiseAreas,
294
+ industry: this.profile.domain.industryContext,
295
+ quality: this.profile.quality,
296
+ sessionsCount: this.profile.interactions.totalSessions,
297
+ patternsCount: this.profile.patterns.length,
298
+ };
299
+ }
300
+
301
+ // ==================== GLOBAL MEMORY SYNC ====================
302
+
303
+ /**
304
+ * Enable global memory sync
305
+ * @param {boolean} [autoSync=false] - Auto-sync on save
306
+ */
307
+ enableGlobal(autoSync = false) {
308
+ this.enableGlobalSync = true;
309
+ this.autoSync = autoSync;
310
+ if (!this.globalMemory) {
311
+ this.globalMemory = new GlobalMemory();
312
+ }
313
+ }
314
+
315
+ /**
316
+ * Disable global memory sync
317
+ */
318
+ disableGlobal() {
319
+ this.enableGlobalSync = false;
320
+ this.autoSync = false;
321
+ }
322
+
323
+ /**
324
+ * Sync local profile to global memory
325
+ * Pushes patterns, expertise, and preferences to global storage
326
+ */
327
+ syncToGlobal() {
328
+ if (!this.enableGlobalSync || !this.globalMemory) {
329
+ return;
330
+ }
331
+
332
+ if (!this.profile) this.init();
333
+
334
+ this.globalMemory.init();
335
+
336
+ // Sync patterns
337
+ for (const pattern of this.profile.patterns) {
338
+ this.globalMemory.recordPattern({
339
+ type: pattern.type,
340
+ pattern: pattern.description || pattern.pattern || pattern.type,
341
+ confidence: 0.6,
342
+ source: path.basename(this.profileDir),
343
+ });
344
+ }
345
+
346
+ // Sync expertise
347
+ for (const area of this.profile.domain.expertiseAreas) {
348
+ this.globalMemory.addExpertise(area, 0.7);
349
+ }
350
+
351
+ // Sync languages as expertise
352
+ for (const lang of this.profile.tooling.primaryLanguages) {
353
+ this.globalMemory.addExpertise(lang, 0.7);
354
+ }
355
+
356
+ // Sync communication preferences
357
+ if (this.profile.communication) {
358
+ this.globalMemory.setPreference('verbosity', this.profile.communication.verbosity);
359
+ this.globalMemory.setPreference('formality', this.profile.communication.formality);
360
+ }
361
+
362
+ // Register project
363
+ this.globalMemory.registerProject(this.profileDir, {
364
+ name: path.basename(path.dirname(this.profileDir)),
365
+ languages: this.profile.tooling.primaryLanguages,
366
+ domains: this.profile.domain.primaryDomains,
367
+ });
368
+ }
369
+
370
+ /**
371
+ * Sync from global memory to local profile
372
+ * Pulls high-confidence patterns and expertise hints
373
+ * @returns {object} The enhanced profile
374
+ */
375
+ syncFromGlobal() {
376
+ if (!this.enableGlobalSync || !this.globalMemory) {
377
+ return this.profile;
378
+ }
379
+
380
+ if (!this.profile) this.init();
381
+
382
+ this.globalMemory.init();
383
+
384
+ // Pull global patterns as hints
385
+ const enhanced = this.globalMemory.exportToProfile(this.profile);
386
+
387
+ // Add global expertise to local if not present
388
+ const topExpertise = this.globalMemory.getTopExpertise(5);
389
+ for (const exp of topExpertise) {
390
+ if (!this.profile.domain.expertiseAreas.includes(exp.domain)) {
391
+ // Add as a hint, not a definite expertise
392
+ if (!this.profile.globalHints) {
393
+ this.profile.globalHints = { suggestedExpertise: [] };
394
+ }
395
+ this.profile.globalHints.suggestedExpertise.push({
396
+ domain: exp.domain,
397
+ confidence: exp.level,
398
+ });
399
+ }
400
+ }
401
+
402
+ // Add global pattern hints
403
+ const confidentPatterns = this.globalMemory.getConfidentPatterns(0.7);
404
+ if (!this.profile.globalHints) {
405
+ this.profile.globalHints = {};
406
+ }
407
+ this.profile.globalHints.suggestedPatterns = confidentPatterns.map(p => ({
408
+ type: p.type,
409
+ pattern: p.pattern,
410
+ confidence: p.confidence,
411
+ fromProjects: p.sources.length,
412
+ }));
413
+
414
+ // Get global preferences as defaults
415
+ const globalPrefs = this.globalMemory.getAllPreferences();
416
+ this.profile.globalHints.preferences = globalPrefs;
417
+
418
+ return enhanced;
419
+ }
420
+
421
+ /**
422
+ * Get global memory instance
423
+ * @returns {GlobalMemory|null} The global memory instance or null
424
+ */
425
+ getGlobalMemory() {
426
+ return this.globalMemory;
427
+ }
428
+
429
+ /**
430
+ * Get statistics about global memory
431
+ * @returns {object|null} Stats or null if global sync disabled
432
+ */
433
+ getGlobalStats() {
434
+ if (!this.enableGlobalSync || !this.globalMemory) {
435
+ return null;
436
+ }
437
+ this.globalMemory.init();
438
+ return this.globalMemory.getStats();
439
+ }
440
+ }
441
+
442
+ module.exports = {
443
+ ProfileManager,
444
+ DEFAULT_PROFILE,
445
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Questioning Module
3
+ *
4
+ * Adaptive questioning engine for intelligent context gathering.
5
+ * Central export for all questioning-related functionality.
6
+ */
7
+
8
+ const {
9
+ QuestionEngine,
10
+ QUESTION_TYPES,
11
+ PRIORITY,
12
+ createQuestion,
13
+ } = require('./question-engine');
14
+
15
+ const {
16
+ PROJECT_QUESTIONS,
17
+ TECHNICAL_QUESTIONS,
18
+ PREFERENCE_QUESTIONS,
19
+ CONSTRAINT_QUESTIONS,
20
+ PHASE_QUESTIONS,
21
+ getAllTemplates,
22
+ getByTags,
23
+ getByType,
24
+ } = require('./question-templates');
25
+
26
+ module.exports = {
27
+ // Classes
28
+ QuestionEngine,
29
+
30
+ // Constants
31
+ QUESTION_TYPES,
32
+ PRIORITY,
33
+
34
+ // Factory functions
35
+ createQuestion,
36
+ createQuestionEngine: () => new QuestionEngine(),
37
+
38
+ // Templates
39
+ templates: {
40
+ project: PROJECT_QUESTIONS,
41
+ technical: TECHNICAL_QUESTIONS,
42
+ preference: PREFERENCE_QUESTIONS,
43
+ constraint: CONSTRAINT_QUESTIONS,
44
+ phase: PHASE_QUESTIONS,
45
+ getAll: getAllTemplates,
46
+ getByTags,
47
+ getByType,
48
+ },
49
+ };