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.
- package/LICENSE +27 -0
- package/README.md +567 -0
- package/bin/install.js +348 -0
- package/commands/gywd/add-phase.md +207 -0
- package/commands/gywd/anticipate.md +271 -0
- package/commands/gywd/bootstrap.md +336 -0
- package/commands/gywd/challenge.md +344 -0
- package/commands/gywd/check-drift.md +144 -0
- package/commands/gywd/complete-milestone.md +106 -0
- package/commands/gywd/consider-issues.md +202 -0
- package/commands/gywd/context.md +93 -0
- package/commands/gywd/create-roadmap.md +115 -0
- package/commands/gywd/deps.md +169 -0
- package/commands/gywd/digest.md +138 -0
- package/commands/gywd/discuss-milestone.md +47 -0
- package/commands/gywd/discuss-phase.md +60 -0
- package/commands/gywd/execute-plan.md +161 -0
- package/commands/gywd/extract-decisions.md +325 -0
- package/commands/gywd/health.md +150 -0
- package/commands/gywd/help.md +556 -0
- package/commands/gywd/history.md +278 -0
- package/commands/gywd/impact.md +317 -0
- package/commands/gywd/init.md +95 -0
- package/commands/gywd/insert-phase.md +227 -0
- package/commands/gywd/list-phase-assumptions.md +50 -0
- package/commands/gywd/map-codebase.md +84 -0
- package/commands/gywd/memory.md +159 -0
- package/commands/gywd/new-milestone.md +59 -0
- package/commands/gywd/new-project.md +315 -0
- package/commands/gywd/pause-work.md +123 -0
- package/commands/gywd/plan-fix.md +205 -0
- package/commands/gywd/plan-phase.md +93 -0
- package/commands/gywd/preview-plan.md +139 -0
- package/commands/gywd/profile.md +363 -0
- package/commands/gywd/progress.md +317 -0
- package/commands/gywd/remove-phase.md +338 -0
- package/commands/gywd/research-phase.md +91 -0
- package/commands/gywd/resume-work.md +40 -0
- package/commands/gywd/rollback.md +179 -0
- package/commands/gywd/status.md +42 -0
- package/commands/gywd/sync-github.md +234 -0
- package/commands/gywd/verify-work.md +71 -0
- package/commands/gywd/why.md +251 -0
- package/docs/COMMANDS.md +722 -0
- package/docs/CONTRIBUTING.md +342 -0
- package/docs/EXAMPLES.md +535 -0
- package/docs/GETTING-STARTED.md +262 -0
- package/docs/README.md +55 -0
- package/docs/RELEASING.md +159 -0
- package/get-your-work-done/core/agent-patterns.md +331 -0
- package/get-your-work-done/core/architecture.md +334 -0
- package/get-your-work-done/core/context-model-schema.json +154 -0
- package/get-your-work-done/core/decisions-schema.json +193 -0
- package/get-your-work-done/core/learning-state-schema.json +133 -0
- package/get-your-work-done/core/profile-schema.json +257 -0
- package/get-your-work-done/references/adaptive-decomposition.md +175 -0
- package/get-your-work-done/references/checkpoints.md +287 -0
- package/get-your-work-done/references/confidence-scoring.md +169 -0
- package/get-your-work-done/references/continuation-format.md +255 -0
- package/get-your-work-done/references/git-integration.md +254 -0
- package/get-your-work-done/references/plan-format.md +428 -0
- package/get-your-work-done/references/principles.md +157 -0
- package/get-your-work-done/references/questioning.md +162 -0
- package/get-your-work-done/references/research-pitfalls.md +215 -0
- package/get-your-work-done/references/scope-estimation.md +172 -0
- package/get-your-work-done/references/tdd.md +263 -0
- package/get-your-work-done/templates/codebase/architecture.md +255 -0
- package/get-your-work-done/templates/codebase/concerns.md +310 -0
- package/get-your-work-done/templates/codebase/conventions.md +307 -0
- package/get-your-work-done/templates/codebase/integrations.md +280 -0
- package/get-your-work-done/templates/codebase/stack.md +186 -0
- package/get-your-work-done/templates/codebase/structure.md +285 -0
- package/get-your-work-done/templates/codebase/testing.md +480 -0
- package/get-your-work-done/templates/config.json +18 -0
- package/get-your-work-done/templates/context.md +161 -0
- package/get-your-work-done/templates/continue-here.md +78 -0
- package/get-your-work-done/templates/discovery.md +146 -0
- package/get-your-work-done/templates/issues.md +32 -0
- package/get-your-work-done/templates/milestone-archive.md +123 -0
- package/get-your-work-done/templates/milestone-context.md +93 -0
- package/get-your-work-done/templates/milestone.md +115 -0
- package/get-your-work-done/templates/phase-prompt.md +303 -0
- package/get-your-work-done/templates/project.md +184 -0
- package/get-your-work-done/templates/research.md +529 -0
- package/get-your-work-done/templates/roadmap.md +196 -0
- package/get-your-work-done/templates/state.md +210 -0
- package/get-your-work-done/templates/summary.md +273 -0
- package/get-your-work-done/templates/uat-issues.md +143 -0
- package/get-your-work-done/workflows/complete-milestone.md +643 -0
- package/get-your-work-done/workflows/create-milestone.md +416 -0
- package/get-your-work-done/workflows/create-roadmap.md +481 -0
- package/get-your-work-done/workflows/discovery-phase.md +293 -0
- package/get-your-work-done/workflows/discuss-milestone.md +236 -0
- package/get-your-work-done/workflows/discuss-phase.md +247 -0
- package/get-your-work-done/workflows/execute-phase.md +1625 -0
- package/get-your-work-done/workflows/list-phase-assumptions.md +178 -0
- package/get-your-work-done/workflows/map-codebase.md +434 -0
- package/get-your-work-done/workflows/plan-phase.md +488 -0
- package/get-your-work-done/workflows/research-phase.md +436 -0
- package/get-your-work-done/workflows/resume-project.md +287 -0
- package/get-your-work-done/workflows/transition.md +580 -0
- package/get-your-work-done/workflows/verify-work.md +202 -0
- package/lib/automation/dependency-analyzer.js +635 -0
- package/lib/automation/doc-generator.js +643 -0
- package/lib/automation/index.js +42 -0
- package/lib/automation/test-generator.js +628 -0
- package/lib/context/context-analyzer.js +554 -0
- package/lib/context/context-cache.js +426 -0
- package/lib/context/context-predictor.js +622 -0
- package/lib/context/index.js +44 -0
- package/lib/memory/confidence-calibrator.js +484 -0
- package/lib/memory/feedback-collector.js +551 -0
- package/lib/memory/global-memory.js +465 -0
- package/lib/memory/index.js +75 -0
- package/lib/memory/pattern-aggregator.js +487 -0
- package/lib/memory/team-sync.js +501 -0
- package/lib/profile/index.js +24 -0
- package/lib/profile/pattern-learner.js +303 -0
- package/lib/profile/profile-manager.js +445 -0
- package/lib/questioning/index.js +49 -0
- package/lib/questioning/question-engine.js +311 -0
- package/lib/questioning/question-templates.js +315 -0
- package/lib/validators/command-validator.js +188 -0
- package/lib/validators/index.js +29 -0
- package/lib/validators/schema-validator.js +183 -0
- package/package.json +61 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Learner
|
|
3
|
+
*
|
|
4
|
+
* Analyzes developer interactions to learn patterns and preferences.
|
|
5
|
+
* Part of the Developer Digital Twin system.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Pattern types that can be learned
|
|
10
|
+
*/
|
|
11
|
+
const PATTERN_TYPES = {
|
|
12
|
+
NAMING: 'naming',
|
|
13
|
+
STRUCTURE: 'structure',
|
|
14
|
+
ERROR_HANDLING: 'error-handling',
|
|
15
|
+
TESTING: 'testing',
|
|
16
|
+
DOCUMENTATION: 'documentation',
|
|
17
|
+
WORKFLOW: 'workflow',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Signals that indicate patterns
|
|
22
|
+
*/
|
|
23
|
+
const PATTERN_SIGNALS = {
|
|
24
|
+
// Naming patterns
|
|
25
|
+
camelCase: /^[a-z][a-zA-Z0-9]*$/,
|
|
26
|
+
snake_case: /^[a-z][a-z0-9_]*$/,
|
|
27
|
+
PascalCase: /^[A-Z][a-zA-Z0-9]*$/,
|
|
28
|
+
SCREAMING_SNAKE: /^[A-Z][A-Z0-9_]*$/,
|
|
29
|
+
|
|
30
|
+
// Testing patterns
|
|
31
|
+
testPrefix: /^test[A-Z]/,
|
|
32
|
+
shouldPrefix: /^should[A-Z]/,
|
|
33
|
+
itPrefix: /^it[A-Z]/,
|
|
34
|
+
describePattern: /describe\s*\(/,
|
|
35
|
+
|
|
36
|
+
// Documentation patterns
|
|
37
|
+
jsdoc: /\/\*\*[\s\S]*?\*\//,
|
|
38
|
+
inlineComments: /\/\/.*$/m,
|
|
39
|
+
markdownDocs: /^#+\s+/m,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Pattern Learner class
|
|
44
|
+
*/
|
|
45
|
+
class PatternLearner {
|
|
46
|
+
constructor() {
|
|
47
|
+
this.observations = [];
|
|
48
|
+
this.learnedPatterns = new Map();
|
|
49
|
+
this.confidenceThreshold = 0.7;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Observe a code sample
|
|
54
|
+
* @param {string} code - Code to analyze
|
|
55
|
+
* @param {string} context - Context (e.g., 'function', 'class', 'test')
|
|
56
|
+
*/
|
|
57
|
+
observeCode(code, context = 'general') {
|
|
58
|
+
const observation = {
|
|
59
|
+
timestamp: Date.now(),
|
|
60
|
+
context,
|
|
61
|
+
patterns: this.extractPatterns(code),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
this.observations.push(observation);
|
|
65
|
+
this.updateLearnedPatterns();
|
|
66
|
+
|
|
67
|
+
return observation.patterns;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Extract patterns from code
|
|
72
|
+
* @param {string} code - Code to analyze
|
|
73
|
+
* @returns {object} Detected patterns
|
|
74
|
+
*/
|
|
75
|
+
extractPatterns(code) {
|
|
76
|
+
const patterns = {
|
|
77
|
+
naming: this.detectNamingPatterns(code),
|
|
78
|
+
documentation: this.detectDocPatterns(code),
|
|
79
|
+
testing: this.detectTestingPatterns(code),
|
|
80
|
+
structure: this.detectStructurePatterns(code),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return patterns;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Detect naming conventions
|
|
88
|
+
* @param {string} code - Code to analyze
|
|
89
|
+
* @returns {object} Naming patterns
|
|
90
|
+
*/
|
|
91
|
+
detectNamingPatterns(code) {
|
|
92
|
+
// Extract identifiers (simplified)
|
|
93
|
+
const functionNames = code.match(/function\s+(\w+)/g) || [];
|
|
94
|
+
const varNames = code.match(/(?:const|let|var)\s+(\w+)/g) || [];
|
|
95
|
+
|
|
96
|
+
let camelCount = 0;
|
|
97
|
+
let snakeCount = 0;
|
|
98
|
+
let pascalCount = 0;
|
|
99
|
+
|
|
100
|
+
const allNames = [...functionNames, ...varNames].map(m => {
|
|
101
|
+
const parts = m.split(/\s+/);
|
|
102
|
+
return parts[parts.length - 1];
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
for (const name of allNames) {
|
|
106
|
+
if (PATTERN_SIGNALS.camelCase.test(name)) camelCount++;
|
|
107
|
+
if (PATTERN_SIGNALS.snake_case.test(name)) snakeCount++;
|
|
108
|
+
if (PATTERN_SIGNALS.PascalCase.test(name)) pascalCount++;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const total = allNames.length || 1;
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
camelCase: camelCount / total,
|
|
115
|
+
snake_case: snakeCount / total,
|
|
116
|
+
PascalCase: pascalCount / total,
|
|
117
|
+
dominant: this.getDominant({ camelCount, snakeCount, pascalCount }),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Detect documentation patterns
|
|
123
|
+
* @param {string} code - Code to analyze
|
|
124
|
+
* @returns {object} Documentation patterns
|
|
125
|
+
*/
|
|
126
|
+
detectDocPatterns(code) {
|
|
127
|
+
const hasJsdoc = PATTERN_SIGNALS.jsdoc.test(code);
|
|
128
|
+
const hasInline = PATTERN_SIGNALS.inlineComments.test(code);
|
|
129
|
+
const hasMarkdown = PATTERN_SIGNALS.markdownDocs.test(code);
|
|
130
|
+
|
|
131
|
+
const codeLines = code.split('\n').length;
|
|
132
|
+
const commentLines = (code.match(/\/\/.*$/gm) || []).length +
|
|
133
|
+
(code.match(/\/\*[\s\S]*?\*\//g) || []).reduce((acc, m) => acc + m.split('\n').length, 0);
|
|
134
|
+
|
|
135
|
+
const commentRatio = commentLines / (codeLines || 1);
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
jsdoc: hasJsdoc,
|
|
139
|
+
inlineComments: hasInline,
|
|
140
|
+
markdown: hasMarkdown,
|
|
141
|
+
commentRatio,
|
|
142
|
+
style: hasJsdoc ? 'jsdoc' : hasInline ? 'inline' : 'minimal',
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Detect testing patterns
|
|
148
|
+
* @param {string} code - Code to analyze
|
|
149
|
+
* @returns {object} Testing patterns
|
|
150
|
+
*/
|
|
151
|
+
detectTestingPatterns(code) {
|
|
152
|
+
const hasDescribe = PATTERN_SIGNALS.describePattern.test(code);
|
|
153
|
+
const hasTest = /\btest\s*\(/.test(code);
|
|
154
|
+
const hasIt = /\bit\s*\(/.test(code);
|
|
155
|
+
const hasExpect = /\bexpect\s*\(/.test(code);
|
|
156
|
+
const hasAssert = /\bassert\./.test(code);
|
|
157
|
+
|
|
158
|
+
let framework = 'unknown';
|
|
159
|
+
if (hasDescribe && hasIt && hasExpect) framework = 'jest';
|
|
160
|
+
else if (hasDescribe && hasIt) framework = 'mocha';
|
|
161
|
+
else if (hasAssert) framework = 'node-assert';
|
|
162
|
+
else if (hasTest && hasExpect) framework = 'jest';
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
framework,
|
|
166
|
+
usesDescribe: hasDescribe,
|
|
167
|
+
usesIt: hasIt,
|
|
168
|
+
usesTest: hasTest,
|
|
169
|
+
usesExpect: hasExpect,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Detect structure patterns
|
|
175
|
+
* @param {string} code - Code to analyze
|
|
176
|
+
* @returns {object} Structure patterns
|
|
177
|
+
*/
|
|
178
|
+
detectStructurePatterns(code) {
|
|
179
|
+
const hasClasses = /\bclass\s+\w+/.test(code);
|
|
180
|
+
const hasFunctions = /\bfunction\s+\w+/.test(code);
|
|
181
|
+
const hasArrowFunctions = /=>\s*[{(]/.test(code);
|
|
182
|
+
const hasAsync = /\basync\s+/.test(code);
|
|
183
|
+
const hasModuleExports = /module\.exports\s*=/.test(code);
|
|
184
|
+
const hasEsModules = /\bexport\s+(default\s+)?/.test(code);
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
paradigm: hasClasses ? 'oop' : hasFunctions ? 'functional' : 'mixed',
|
|
188
|
+
usesClasses: hasClasses,
|
|
189
|
+
usesFunctions: hasFunctions,
|
|
190
|
+
usesArrowFunctions: hasArrowFunctions,
|
|
191
|
+
usesAsync: hasAsync,
|
|
192
|
+
moduleStyle: hasEsModules ? 'esm' : hasModuleExports ? 'commonjs' : 'unknown',
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get dominant pattern from counts
|
|
198
|
+
* @param {object} counts - Pattern counts
|
|
199
|
+
* @returns {string} Dominant pattern name
|
|
200
|
+
*/
|
|
201
|
+
getDominant(counts) {
|
|
202
|
+
let max = 0;
|
|
203
|
+
let dominant = 'mixed';
|
|
204
|
+
|
|
205
|
+
for (const [name, count] of Object.entries(counts)) {
|
|
206
|
+
if (count > max) {
|
|
207
|
+
max = count;
|
|
208
|
+
dominant = name.replace('Count', '');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return dominant;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Update learned patterns based on observations
|
|
217
|
+
*/
|
|
218
|
+
updateLearnedPatterns() {
|
|
219
|
+
if (this.observations.length < 3) return;
|
|
220
|
+
|
|
221
|
+
// Aggregate patterns from recent observations
|
|
222
|
+
const recent = this.observations.slice(-10);
|
|
223
|
+
const aggregated = this.aggregatePatterns(recent);
|
|
224
|
+
|
|
225
|
+
// Update learned patterns with high confidence
|
|
226
|
+
for (const [category, patterns] of Object.entries(aggregated)) {
|
|
227
|
+
for (const [pattern, confidence] of Object.entries(patterns)) {
|
|
228
|
+
if (confidence >= this.confidenceThreshold) {
|
|
229
|
+
this.learnedPatterns.set(`${category}.${pattern}`, {
|
|
230
|
+
value: true,
|
|
231
|
+
confidence,
|
|
232
|
+
observationCount: recent.length,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Aggregate patterns from multiple observations
|
|
241
|
+
* @param {Array} observations - Observations to aggregate
|
|
242
|
+
* @returns {object} Aggregated patterns
|
|
243
|
+
*/
|
|
244
|
+
aggregatePatterns(observations) {
|
|
245
|
+
const aggregated = {};
|
|
246
|
+
|
|
247
|
+
for (const obs of observations) {
|
|
248
|
+
for (const [category, patterns] of Object.entries(obs.patterns)) {
|
|
249
|
+
if (!aggregated[category]) aggregated[category] = {};
|
|
250
|
+
|
|
251
|
+
for (const [key, value] of Object.entries(patterns)) {
|
|
252
|
+
if (typeof value === 'boolean') {
|
|
253
|
+
aggregated[category][key] = (aggregated[category][key] || 0) + (value ? 1 : 0);
|
|
254
|
+
} else if (typeof value === 'number') {
|
|
255
|
+
aggregated[category][key] = (aggregated[category][key] || 0) + value;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Convert to confidence scores
|
|
262
|
+
const count = observations.length;
|
|
263
|
+
for (const category of Object.keys(aggregated)) {
|
|
264
|
+
for (const key of Object.keys(aggregated[category])) {
|
|
265
|
+
aggregated[category][key] /= count;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return aggregated;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Get all learned patterns
|
|
274
|
+
* @returns {object} Learned patterns
|
|
275
|
+
*/
|
|
276
|
+
getLearnedPatterns() {
|
|
277
|
+
return Object.fromEntries(this.learnedPatterns);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Get pattern confidence
|
|
282
|
+
* @param {string} patternKey - Pattern key (e.g., 'naming.camelCase')
|
|
283
|
+
* @returns {number} Confidence level (0-1)
|
|
284
|
+
*/
|
|
285
|
+
getConfidence(patternKey) {
|
|
286
|
+
const pattern = this.learnedPatterns.get(patternKey);
|
|
287
|
+
return pattern ? pattern.confidence : 0;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Clear observations (for testing)
|
|
292
|
+
*/
|
|
293
|
+
clear() {
|
|
294
|
+
this.observations = [];
|
|
295
|
+
this.learnedPatterns.clear();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
module.exports = {
|
|
300
|
+
PatternLearner,
|
|
301
|
+
PATTERN_TYPES,
|
|
302
|
+
PATTERN_SIGNALS,
|
|
303
|
+
};
|