pi-matt-pocock 0.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.
- package/LICENSE +27 -0
- package/README.md +38 -0
- package/TODO.md +11 -0
- package/index.ts +1 -0
- package/package.json +44 -0
- package/procedures/ADR-FORMAT.md +47 -0
- package/procedures/AGENT-BRIEF.md +207 -0
- package/procedures/CONTEXT-FORMAT.md +60 -0
- package/procedures/DEEPENING.md +37 -0
- package/procedures/DESIGN-IT-TWICE.md +44 -0
- package/procedures/GLOSSARY-FORMAT.md +35 -0
- package/procedures/GLOSSARY.md +201 -0
- package/procedures/HTML-REPORT.md +123 -0
- package/procedures/LEARNING-RECORD-FORMAT.md +46 -0
- package/procedures/LOGIC.md +79 -0
- package/procedures/MISSION-FORMAT.md +31 -0
- package/procedures/OUT-OF-SCOPE.md +105 -0
- package/procedures/RESOURCES-FORMAT.md +32 -0
- package/procedures/SKILL-MECHANICS.md +22 -0
- package/procedures/UI.md +112 -0
- package/procedures/bdd-best-practices.md +68 -0
- package/procedures/bdd.md +98 -0
- package/procedures/code-review.md +111 -0
- package/procedures/codebase-design.md +113 -0
- package/procedures/diagnosing-bugs.md +139 -0
- package/procedures/domain-modeling.md +73 -0
- package/procedures/domain.md +51 -0
- package/procedures/gherkin-guide.md +109 -0
- package/procedures/grill-me.md +5 -0
- package/procedures/grill-with-docs.md +5 -0
- package/procedures/grilling.md +11 -0
- package/procedures/handoff.md +13 -0
- package/procedures/hitl-loop.template.sh +44 -0
- package/procedures/implement.md +13 -0
- package/procedures/improve-codebase-architecture.md +69 -0
- package/procedures/issue-tracker-github.md +45 -0
- package/procedures/issue-tracker-gitlab.md +46 -0
- package/procedures/issue-tracker-local.md +30 -0
- package/procedures/mocking.md +59 -0
- package/procedures/phase-boundaries.md +55 -0
- package/procedures/prototype.md +25 -0
- package/procedures/research.md +11 -0
- package/procedures/resolving-merge-conflicts.md +13 -0
- package/procedures/setup-matt-pocock-skills.md +114 -0
- package/procedures/tdd.md +60 -0
- package/procedures/teach.md +137 -0
- package/procedures/template.sh +204 -0
- package/procedures/testing-anti-patterns.md +37 -0
- package/procedures/tests.md +77 -0
- package/procedures/to-questionnaire.md +47 -0
- package/procedures/to-spec.md +77 -0
- package/procedures/to-tickets.md +97 -0
- package/procedures/triage-labels.md +15 -0
- package/procedures/triage.md +110 -0
- package/procedures/wait-what.md +1 -0
- package/procedures/wayfinder.md +127 -0
- package/procedures/wizard.md +39 -0
- package/procedures/writing-for-agents.md +76 -0
- package/procedures/writing-great-skills.md +81 -0
- package/src/index.ts +485 -0
- package/src/procedures.ts +33 -0
- package/src/workflow.ts +192 -0
package/src/workflow.ts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export interface WorkflowState {
|
|
2
|
+
route: string;
|
|
3
|
+
procedure: string;
|
|
4
|
+
phase: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface WorkflowRoute extends WorkflowState {
|
|
8
|
+
label: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const WORKFLOW_STATE_ENTRY = "matt-pocock-workflow";
|
|
13
|
+
export type WorkflowSessionData = WorkflowState | { active: false };
|
|
14
|
+
|
|
15
|
+
const routes: WorkflowRoute[] = [
|
|
16
|
+
{
|
|
17
|
+
route: "idea-to-ship",
|
|
18
|
+
label: "Start an idea-to-ship flow",
|
|
19
|
+
description: "Shape an idea before planning and implementation.",
|
|
20
|
+
procedure: "grill-with-docs",
|
|
21
|
+
phase: "shaping",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
route: "hard-bug",
|
|
25
|
+
label: "Diagnose a hard bug",
|
|
26
|
+
description: "Build a tight feedback loop before forming a theory.",
|
|
27
|
+
procedure: "diagnosing-bugs",
|
|
28
|
+
phase: "feedback-loop",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
route: "triage",
|
|
32
|
+
label: "Triage incoming work",
|
|
33
|
+
description: "Turn incoming issues into agent-ready briefs.",
|
|
34
|
+
procedure: "triage",
|
|
35
|
+
phase: "triage",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
route: "wayfinding",
|
|
39
|
+
label: "Map a large ambiguous initiative",
|
|
40
|
+
description: "Resolve decision tickets before creating a build plan.",
|
|
41
|
+
procedure: "wayfinder",
|
|
42
|
+
phase: "mapping",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
route: "architecture",
|
|
46
|
+
label: "Improve codebase architecture",
|
|
47
|
+
description: "Find and develop deepening opportunities.",
|
|
48
|
+
procedure: "improve-codebase-architecture",
|
|
49
|
+
phase: "survey",
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const phaseProcedures: Record<string, string[]> = {
|
|
54
|
+
"idea-to-ship": [
|
|
55
|
+
"grill-with-docs",
|
|
56
|
+
"grill-me",
|
|
57
|
+
"grilling",
|
|
58
|
+
"research",
|
|
59
|
+
"prototype",
|
|
60
|
+
"to-spec",
|
|
61
|
+
"to-tickets",
|
|
62
|
+
"implement",
|
|
63
|
+
"code-review",
|
|
64
|
+
"handoff",
|
|
65
|
+
],
|
|
66
|
+
"hard-bug": ["diagnosing-bugs", "implement", "code-review"],
|
|
67
|
+
triage: ["triage", "to-spec", "to-tickets", "implement", "code-review"],
|
|
68
|
+
wayfinding: ["wayfinder", "research", "prototype", "to-spec", "to-tickets", "implement", "code-review"],
|
|
69
|
+
architecture: ["improve-codebase-architecture", "codebase-design", "implement", "code-review"],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export function workflowRoutes(): WorkflowRoute[] {
|
|
73
|
+
return routes;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function findWorkflowRoute(route: string): WorkflowRoute | undefined {
|
|
77
|
+
return routes.find((candidate) => candidate.route === route);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function transitionProcedures(route: string): string[] {
|
|
81
|
+
return phaseProcedures[route] ?? [];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const procedureAliases: Record<string, string> = {
|
|
85
|
+
"tight-red-loop": "diagnosing-bugs",
|
|
86
|
+
"clarify-goal": "wayfinder",
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export function normalizeProcedureName(procedure: string): string {
|
|
90
|
+
const normalized = procedure.trim().replace(/\.md$/i, "");
|
|
91
|
+
return procedureAliases[normalized] ?? normalized;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function transitionProcedureOptions(route: string): string[] {
|
|
95
|
+
const procedures = new Set(transitionProcedures(route));
|
|
96
|
+
for (const [alias, procedure] of Object.entries(procedureAliases)) {
|
|
97
|
+
if (procedures.has(procedure)) procedures.add(alias);
|
|
98
|
+
}
|
|
99
|
+
return [...procedures];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const procedurePhases: Record<string, string> = {
|
|
103
|
+
"grill-with-docs": "shaping",
|
|
104
|
+
"grill-me": "shaping",
|
|
105
|
+
grilling: "shaping",
|
|
106
|
+
"diagnosing-bugs": "feedback-loop",
|
|
107
|
+
wayfinder: "mapping",
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export function phaseForProcedure(procedure: string): string {
|
|
111
|
+
const norm = normalizeProcedureName(procedure);
|
|
112
|
+
return procedurePhases[norm] ?? norm;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const routeTitles: Record<string, string> = {
|
|
116
|
+
"idea-to-ship": "Idea to Ship",
|
|
117
|
+
"hard-bug": "Hard Bug Diagnosis",
|
|
118
|
+
triage: "Task Triage",
|
|
119
|
+
wayfinding: "Architecture Wayfinding",
|
|
120
|
+
architecture: "Codebase Architecture",
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const phaseTitles: Record<string, string> = {
|
|
124
|
+
shaping: "Shaping & Requirements",
|
|
125
|
+
"grill-with-docs": "Shaping & Requirements",
|
|
126
|
+
"grill-me": "Shaping & Requirements",
|
|
127
|
+
grilling: "Shaping & Requirements",
|
|
128
|
+
research: "Research & Feasibility",
|
|
129
|
+
prototype: "Prototyping",
|
|
130
|
+
"to-spec": "Specification Design",
|
|
131
|
+
"to-tickets": "Task Decomposition",
|
|
132
|
+
implement: "Implementation",
|
|
133
|
+
"code-review": "Code Review",
|
|
134
|
+
handoff: "Handoff & Summary",
|
|
135
|
+
"feedback-loop": "Reproducing & Diagnostics",
|
|
136
|
+
"diagnosing-bugs": "Reproducing & Diagnostics",
|
|
137
|
+
mapping: "Initiative Mapping",
|
|
138
|
+
wayfinder: "Initiative Mapping",
|
|
139
|
+
survey: "Architecture Survey",
|
|
140
|
+
"improve-codebase-architecture": "Architecture Survey",
|
|
141
|
+
"codebase-design": "Architecture Design",
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export function readableRouteTitle(route: string): string {
|
|
145
|
+
return routeTitles[route] ?? route.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function readablePhaseTitle(phase: string): string {
|
|
149
|
+
return phaseTitles[phase] ?? phase.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function formatReadableWorkflowSubject(route: string, phase: string): string {
|
|
153
|
+
return `${readableRouteTitle(route)} · ${readablePhaseTitle(phase)}`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function isWorkflowState(value: unknown): value is WorkflowState {
|
|
157
|
+
if (!value || typeof value !== "object") return false;
|
|
158
|
+
const candidate = value as Record<string, unknown>;
|
|
159
|
+
return typeof candidate.route === "string"
|
|
160
|
+
&& typeof candidate.procedure === "string"
|
|
161
|
+
&& typeof candidate.phase === "string";
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function latestWorkflowState(entries: unknown[]): WorkflowState | undefined {
|
|
165
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
166
|
+
const entry = entries[index] as { type?: unknown; customType?: unknown; data?: unknown } | undefined;
|
|
167
|
+
if (entry?.type !== "custom" || entry.customType !== WORKFLOW_STATE_ENTRY) continue;
|
|
168
|
+
if (isWorkflowState(entry.data)) return entry.data;
|
|
169
|
+
if ((entry.data as { active?: unknown } | undefined)?.active === false) return undefined;
|
|
170
|
+
}
|
|
171
|
+
return undefined;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function workflowGuidance(state: WorkflowState): string {
|
|
175
|
+
return `Matt Pocock workflow active: ${state.route} · ${state.phase}.
|
|
176
|
+
Follow the loaded ${state.procedure} procedure. Proceed autonomously from established context: do not stop to recommend, ask whether to continue, or request redundant confirmation. When the procedure's done condition is met and the next applicable procedure is clear, call matt_pocock_workflow to transition immediately, then execute it. Continue through every newly unblocked AFK ticket or task; choose the next frontier ticket yourself when the user did not name one. Ask only for a genuinely user-owned decision, a fact unavailable through exploration, or a required external action. When asking interview or decision questions (e.g. during grilling/shaping), use the matt_pocock_ask tool to present structured options with recommendations, timeout, and custom response support. Do not treat a procedure summary, closed decision ticket, or phase boundary as a reason to wait for the user.`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function availableWorkflowsGuidance(): string {
|
|
180
|
+
return `## Available Engineering Workflows (Matt Pocock)
|
|
181
|
+
|
|
182
|
+
Use matt_pocock_workflow only after you have determined that the current request needs one of these structured, multi-step engineering workflows. Do not activate it for routine work, document creation, research or testing performed through another loaded skill, simple questions, or because a previous session happened to use a workflow.
|
|
183
|
+
|
|
184
|
+
Activate it when relevant:
|
|
185
|
+
- idea-to-ship: Complex features and multi-step implementations (shaping → spec → tickets → implement → review).
|
|
186
|
+
- hard-bug: Difficult, intermittent, or regressed bugs (build tight red loop before forming a theory).
|
|
187
|
+
- triage: Incoming issues and raw requests that need converting into agent-ready briefs.
|
|
188
|
+
- wayfinding: Large, ambiguous engineering efforts requiring decision tickets before a build plan.
|
|
189
|
+
- architecture: Codebase refactoring and deepening opportunities.
|
|
190
|
+
|
|
191
|
+
A workflow remains active only for the deliberate engineering task that started it. When that task is finished or the user changes to unrelated work, call /matt-pocock end before proceeding.`;
|
|
192
|
+
}
|