opencastle 1.6.3 → 1.7.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/README.md +9 -9
- package/bin/cli.mjs +6 -4
- package/dist/cli/adapters/adapter-contract.test.js +1 -1
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +2 -12
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +32 -10
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/bootstrap.test.js +10 -0
- package/dist/cli/bootstrap.test.js.map +1 -1
- package/dist/cli/command-namespace.test.js +4 -21
- package/dist/cli/command-namespace.test.js.map +1 -1
- package/dist/cli/convoy/engine.js +2 -2
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/read-model.d.ts +8 -15
- package/dist/cli/convoy/read-model.d.ts.map +1 -1
- package/dist/cli/convoy/read-model.js +9 -68
- package/dist/cli/convoy/read-model.js.map +1 -1
- package/dist/cli/convoy/read-model.test.js +6 -25
- package/dist/cli/convoy/read-model.test.js.map +1 -1
- package/dist/cli/convoy/spec-builder.d.ts +2 -2
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +1 -1
- package/dist/cli/dashboard.js +1 -1
- package/dist/cli/dashboard.test.js +10 -2
- package/dist/cli/dashboard.test.js.map +1 -1
- package/dist/cli/detect.d.ts.map +1 -1
- package/dist/cli/detect.js +32 -0
- package/dist/cli/detect.js.map +1 -1
- package/dist/cli/detect.test.js +23 -0
- package/dist/cli/detect.test.js.map +1 -1
- package/dist/cli/dispatcher.test.js +5 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +5 -1
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +0 -25
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init.js +3 -3
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/layers.d.ts.map +1 -1
- package/dist/cli/layers.js +3 -1
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/pipeline.d.ts +1 -1
- package/dist/cli/pipeline.flow.test.js +77 -77
- package/dist/cli/pipeline.flow.test.js.map +1 -1
- package/dist/cli/pipeline.js +24 -24
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +8 -2
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +18 -12
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.js +17 -19
- package/dist/cli/plan.test.js.map +1 -1
- package/dist/cli/project-facts-lang.d.ts +36 -0
- package/dist/cli/project-facts-lang.d.ts.map +1 -0
- package/dist/cli/project-facts-lang.js +323 -0
- package/dist/cli/project-facts-lang.js.map +1 -0
- package/dist/cli/project-facts.d.ts +5 -0
- package/dist/cli/project-facts.d.ts.map +1 -1
- package/dist/cli/project-facts.js +28 -11
- package/dist/cli/project-facts.js.map +1 -1
- package/dist/cli/project-facts.test.js +70 -0
- package/dist/cli/project-facts.test.js.map +1 -1
- package/dist/cli/stack-config-update.test.js +21 -1
- package/dist/cli/stack-config-update.test.js.map +1 -1
- package/dist/cli/stack-config.d.ts +20 -0
- package/dist/cli/stack-config.d.ts.map +1 -1
- package/dist/cli/stack-config.js +36 -0
- package/dist/cli/stack-config.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +4 -61
- package/dist/cli/update.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/adapters/adapter-contract.test.ts +1 -1
- package/src/cli/adapters/single-file-base.ts +2 -11
- package/src/cli/bootstrap.test.ts +11 -0
- package/src/cli/bootstrap.ts +32 -10
- package/src/cli/command-namespace.test.ts +5 -22
- package/src/cli/convoy/engine.ts +2 -2
- package/src/{orchestrator/prompts/assess-complexity.prompt.md → cli/convoy/prompts/convoy-assess.prompt.md} +0 -3
- package/src/{orchestrator/prompts/fix-convoy.prompt.md → cli/convoy/prompts/convoy-plan-fix.prompt.md} +0 -3
- package/src/{orchestrator/prompts/validate-convoy.prompt.md → cli/convoy/prompts/convoy-plan-review.prompt.md} +0 -3
- package/src/{orchestrator/prompts/generate-convoy.prompt.md → cli/convoy/prompts/convoy-plan.prompt.md} +0 -2
- package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md} +0 -3
- package/src/{orchestrator/prompts/validate-prd.prompt.md → cli/convoy/prompts/convoy-prd-review.prompt.md} +0 -3
- package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md} +0 -3
- package/src/cli/convoy/read-model.test.ts +5 -29
- package/src/cli/convoy/read-model.ts +11 -71
- package/src/cli/convoy/spec-builder.ts +2 -2
- package/src/cli/dashboard/dashboard.js +2 -4
- package/src/cli/dashboard.test.ts +10 -2
- package/src/cli/dashboard.ts +1 -1
- package/src/cli/detect.test.ts +27 -0
- package/src/cli/detect.ts +29 -0
- package/src/cli/dispatcher.test.ts +6 -2
- package/src/cli/docs-accuracy.test.ts +5 -1
- package/src/cli/doctor.ts +0 -26
- package/src/cli/init.ts +3 -3
- package/src/cli/layers.ts +2 -1
- package/src/cli/pipeline.flow.test.ts +78 -78
- package/src/cli/pipeline.ts +25 -25
- package/src/cli/plan.test.ts +18 -20
- package/src/cli/plan.ts +18 -12
- package/src/cli/project-facts-lang.ts +338 -0
- package/src/cli/project-facts.test.ts +75 -0
- package/src/cli/project-facts.ts +31 -11
- package/src/cli/stack-config-update.test.ts +25 -1
- package/src/cli/stack-config.ts +36 -0
- package/src/cli/update.ts +4 -70
- package/src/orchestrator/agent-workflows/README.md +10 -18
- package/src/orchestrator/agent-workflows/data-pipeline.md +7 -140
- package/src/orchestrator/agent-workflows/database-migration.md +7 -153
- package/src/orchestrator/agent-workflows/performance-optimization.md +6 -119
- package/src/orchestrator/agent-workflows/refactoring.md +8 -137
- package/src/orchestrator/agent-workflows/schema-changes.md +8 -159
- package/src/orchestrator/agent-workflows/security-audit.md +7 -142
- package/src/orchestrator/agent-workflows/shared-delivery-phase.md +8 -25
- package/src/orchestrator/agents/architect.agent.md +2 -14
- package/src/orchestrator/agents/content-engineer.agent.md +8 -10
- package/src/orchestrator/agents/data-engineer.agent.md +8 -8
- package/src/orchestrator/agents/developer.agent.md +3 -10
- package/src/orchestrator/agents/devops-expert.agent.md +0 -3
- package/src/orchestrator/agents/performance-expert.agent.md +2 -3
- package/src/orchestrator/agents/security-expert.agent.md +10 -12
- package/src/orchestrator/agents/team-lead.agent.md +31 -75
- package/src/orchestrator/agents/testing-expert.agent.md +3 -6
- package/src/orchestrator/agents/ui-ux-expert.agent.md +1 -4
- package/src/orchestrator/agents/writer.agent.md +0 -3
- package/src/orchestrator/customizations/README.md +3 -4
- package/src/orchestrator/customizations/agents/agent-registry.md +3 -3
- package/src/orchestrator/customizations/agents/skill-matrix.json +6 -42
- package/src/orchestrator/instructions/general.instructions.md +10 -37
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +4 -6
- package/src/orchestrator/prompts/brainstorm.prompt.md +7 -12
- package/src/orchestrator/prompts/bug-fix.prompt.md +19 -100
- package/src/orchestrator/prompts/convoy.prompt.md +20 -0
- package/src/orchestrator/prompts/create-skill.prompt.md +1 -5
- package/src/orchestrator/prompts/implement-feature.prompt.md +22 -93
- package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +1 -5
- package/src/orchestrator/skills/api-patterns/SKILL.md +21 -18
- package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +28 -65
- package/src/orchestrator/skills/frontend-design/REFERENCE.md +0 -1
- package/src/orchestrator/skills/frontend-design/SKILL.md +3 -1
- package/src/orchestrator/skills/git-workflow/SKILL.md +18 -34
- package/src/orchestrator/skills/panel-majority-vote/SKILL.md +16 -46
- package/src/orchestrator/skills/security-hardening/SKILL.md +20 -19
- package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +2 -2
- package/src/orchestrator/skills/self-improvement/SKILL.md +21 -46
- package/src/orchestrator/skills/technical-writing/SKILL.md +3 -1
- package/src/orchestrator/skills/technical-writing/TEMPLATES.md +23 -0
- package/src/orchestrator/skills/testing-workflow/SKILL.md +21 -23
- package/src/orchestrator/skills/validation-gates/REFERENCE.md +2 -14
- package/src/orchestrator/skills/validation-gates/SKILL.md +10 -88
- package/dist/cli/log.d.ts +0 -44
- package/dist/cli/log.d.ts.map +0 -1
- package/dist/cli/log.js +0 -336
- package/dist/cli/log.js.map +0 -1
- package/dist/cli/log.test.d.ts +0 -2
- package/dist/cli/log.test.d.ts.map +0 -1
- package/dist/cli/log.test.js +0 -208
- package/dist/cli/log.test.js.map +0 -1
- package/src/cli/log.test.ts +0 -228
- package/src/cli/log.ts +0 -374
- package/src/orchestrator/agent-workflows/bug-fix.md +0 -130
- package/src/orchestrator/agent-workflows/feature-implementation.md +0 -232
- package/src/orchestrator/instructions/ai-optimization.instructions.md +0 -17
- package/src/orchestrator/prompts/quick-refinement.prompt.md +0 -110
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +0 -44
- package/src/orchestrator/skills/agent-hooks/SKILL.md +0 -80
- package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +0 -49
- package/src/orchestrator/skills/agent-memory/SKILL.md +0 -50
- package/src/orchestrator/skills/code-commenting/SKILL.md +0 -18
- package/src/orchestrator/skills/context-map/REFERENCE.md +0 -67
- package/src/orchestrator/skills/context-map/SKILL.md +0 -71
- package/src/orchestrator/skills/decomposition/SKILL.md +0 -103
- package/src/orchestrator/skills/documentation-standards/SKILL.md +0 -33
- package/src/orchestrator/skills/fast-review/REFERENCE.md +0 -28
- package/src/orchestrator/skills/memory-merger/SKILL.md +0 -77
- package/src/orchestrator/skills/observability-logging/LOG-SCHEMA.md +0 -238
- package/src/orchestrator/skills/observability-logging/SKILL.md +0 -73
- package/src/orchestrator/skills/orchestration-protocols/REFERENCE.md +0 -38
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +0 -120
- package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +0 -49
- package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +0 -38
- package/src/orchestrator/skills/performance-optimization/SKILL.md +0 -23
- package/src/orchestrator/skills/project-consistency/SKILL.md +0 -80
- package/src/orchestrator/skills/project-consistency/TEMPLATES.md +0 -35
- package/src/orchestrator/skills/react-development/SKILL.md +0 -24
- package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +0 -56
- package/src/orchestrator/skills/session-checkpoints/SKILL.md +0 -40
- package/src/orchestrator/skills/team-lead-reference/SKILL.md +0 -126
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { updateSkillMatrixContent, isEnvVarSatisfied } from './stack-config.js';
|
|
2
|
+
import { updateSkillMatrixContent, isEnvVarSatisfied, getExcludedCoreSkills, isPreselected } from './stack-config.js';
|
|
3
3
|
import type { StackConfig } from './types.js';
|
|
4
4
|
import type { SkillMatrixData } from './stack-config.js';
|
|
5
5
|
|
|
@@ -70,6 +70,30 @@ describe('isEnvVarSatisfied', () => {
|
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
+
describe('what a Python or Go project is given', () => {
|
|
74
|
+
const browser = { preselected: true, subCategory: 'e2e-testing' };
|
|
75
|
+
|
|
76
|
+
it('leaves TypeScript and web-interface rules, and the browser, out of an API service', () => {
|
|
77
|
+
const api = { language: 'python', frameworks: ['fastapi'] };
|
|
78
|
+
expect([...getExcludedCoreSkills(api)].sort()).toEqual(['accessibility-standards', 'frontend-design', 'seo-patterns', 'typescript-best-practices']);
|
|
79
|
+
expect(isPreselected(browser, api)).toBe(false);
|
|
80
|
+
expect(isPreselected(browser, { language: 'go', frameworks: ['gin'] })).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('keeps the web rules and the browser for a framework that renders pages', () => {
|
|
84
|
+
const site = { language: 'python', frameworks: ['django'] };
|
|
85
|
+
expect([...getExcludedCoreSkills(site)]).toEqual(['typescript-best-practices']);
|
|
86
|
+
expect(isPreselected(browser, site)).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('changes nothing for a JavaScript project, or a Python one with JavaScript in it', () => {
|
|
90
|
+
expect(getExcludedCoreSkills({ language: 'typescript' }).size).toBe(0);
|
|
91
|
+
expect(getExcludedCoreSkills({ language: 'python', packageManager: 'pnpm' }).size).toBe(0);
|
|
92
|
+
expect(isPreselected(browser, {})).toBe(true);
|
|
93
|
+
expect(isPreselected({ preselected: false }, {})).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
73
97
|
describe('updateSkillMatrixContent', () => {
|
|
74
98
|
it('fills database slot when a database tool is selected', () => {
|
|
75
99
|
const stack: StackConfig = { ides: ['vscode'], techTools: ['supabase'], teamTools: [] };
|
package/src/cli/stack-config.ts
CHANGED
|
@@ -148,6 +148,42 @@ export function getIncludedPluginIds(stack: StackConfig): Set<string> {
|
|
|
148
148
|
return new Set([...stack.techTools, ...stack.teamTools]);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
/** Frameworks of Python and Go that render pages, not only an API. */
|
|
152
|
+
const RENDERS_PAGES = ['django', 'flask']
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* A Python or Go project with no JavaScript in it, and no framework that
|
|
156
|
+
* renders pages: an API service, a CLI, a worker. It has no use for TypeScript
|
|
157
|
+
* or web-interface rules, and nothing for a browser to test.
|
|
158
|
+
*/
|
|
159
|
+
export function servesNoWebInterface(repoInfo?: RepoInfo): boolean {
|
|
160
|
+
const language = repoInfo?.language
|
|
161
|
+
if (language !== 'python' && language !== 'go') return false
|
|
162
|
+
if (repoInfo?.packageManager || repoInfo?.styling?.length) return false
|
|
163
|
+
return !(repoInfo?.frameworks ?? []).some((f) => RENDERS_PAGES.includes(f))
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Core skills to leave out for what the project is. A FastAPI service was
|
|
168
|
+
* given TypeScript, React, SEO and frontend-design rules on its first day; a
|
|
169
|
+
* Django or Flask app, which renders pages, keeps the web ones.
|
|
170
|
+
*/
|
|
171
|
+
export function getExcludedCoreSkills(repoInfo?: RepoInfo): Set<string> {
|
|
172
|
+
const language = repoInfo?.language
|
|
173
|
+
if ((language !== 'python' && language !== 'go') || repoInfo?.packageManager) return new Set()
|
|
174
|
+
const web = servesNoWebInterface(repoInfo) ? ['frontend-design', 'accessibility-standards', 'seo-patterns'] : []
|
|
175
|
+
return new Set(['typescript-best-practices', ...web])
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Whether an integration starts selected. Chrome DevTools is preselected for
|
|
180
|
+
* browser checks, which a project with no web interface cannot use.
|
|
181
|
+
*/
|
|
182
|
+
export function isPreselected(plugin: { preselected?: boolean; subCategory?: string }, repoInfo?: RepoInfo): boolean {
|
|
183
|
+
if (!plugin.preselected) return false
|
|
184
|
+
return !(plugin.subCategory === 'e2e-testing' && servesNoWebInterface(repoInfo))
|
|
185
|
+
}
|
|
186
|
+
|
|
151
187
|
/**
|
|
152
188
|
* Agents to EXCLUDE — content-engineer if no CMS, data-engineer if no DB.
|
|
153
189
|
*/
|
package/src/cli/update.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isAbsolute, resolve, relative, join, dirname } from 'node:path'
|
|
2
2
|
import { existsSync } from 'node:fs'
|
|
3
|
-
import { readFile,
|
|
3
|
+
import { readFile, mkdir, writeFile, unlink, copyFile, readdir, rm } from 'node:fs/promises'
|
|
4
4
|
import { readManifest, writeManifest } from './manifest.js'
|
|
5
5
|
import { multiselect, confirm, closePrompts, stdinIsExhausted, c } from './prompt.js'
|
|
6
6
|
import { isLegacyStack, migrateStackConfig, IDE_LABELS } from './types.js'
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
updateSkillMatrixFile,
|
|
12
12
|
resolveStack,
|
|
13
13
|
getCustomizationsTransform,
|
|
14
|
-
isEnvVarSatisfied,
|
|
15
|
-
} from './stack-config.js'
|
|
14
|
+
isEnvVarSatisfied, isPreselected } from './stack-config.js'
|
|
16
15
|
import { rebuildMcpConfig, getMcpConfigRelPath, retireLegacyMcpConfig, LEGACY_MCP_CONFIGS } from './mcp.js'
|
|
17
16
|
import { updateGitignore, LOCAL_DIRS } from './gitignore.js'
|
|
18
17
|
import { resolveManagedPaths, REQUIRED_CUSTOMIZATIONS } from './managed-paths.js'
|
|
@@ -391,7 +390,7 @@ export default async function update({
|
|
|
391
390
|
value: p.id,
|
|
392
391
|
selected: oldStack
|
|
393
392
|
? currentTech.has(p.id as TechTool)
|
|
394
|
-
: p
|
|
393
|
+
: isPreselected(p, repoInfo) || detectedTools.has(p.id),
|
|
395
394
|
}))
|
|
396
395
|
)
|
|
397
396
|
|
|
@@ -404,7 +403,7 @@ export default async function update({
|
|
|
404
403
|
value: p.id,
|
|
405
404
|
selected: oldStack
|
|
406
405
|
? currentTeam.has(p.id as TeamTool)
|
|
407
|
-
:
|
|
406
|
+
: isPreselected(p, repoInfo),
|
|
408
407
|
}))
|
|
409
408
|
)
|
|
410
409
|
|
|
@@ -720,9 +719,6 @@ export default async function update({
|
|
|
720
719
|
// cannot fix it. The population that most needs the new block is the one that
|
|
721
720
|
// never runs `init` again.
|
|
722
721
|
|
|
723
|
-
// ── Migrate legacy log files ────────────────────────────────────
|
|
724
|
-
await migrateLegacyLogs(projectRoot)
|
|
725
|
-
|
|
726
722
|
// ── Lessons: one file each, and the index agents read compiled from them ──
|
|
727
723
|
// Not compiled output of any target — agents read `.opencastle/` directly —
|
|
728
724
|
// but compiled all the same, and `sync --check` holds it to its sources.
|
|
@@ -1045,68 +1041,6 @@ async function migrateCustomizationsDir(projectRoot: string): Promise<void> {
|
|
|
1045
1041
|
}
|
|
1046
1042
|
}
|
|
1047
1043
|
|
|
1048
|
-
async function migrateLegacyLogs(projectRoot: string): Promise<void> {
|
|
1049
|
-
const candidateLogsDirs = [
|
|
1050
|
-
resolve(projectRoot, '.github', 'customizations', 'logs'),
|
|
1051
|
-
resolve(projectRoot, '.opencastle', 'logs'),
|
|
1052
|
-
]
|
|
1053
|
-
|
|
1054
|
-
const typeMap: Record<string, string> = {
|
|
1055
|
-
'sessions.ndjson': 'session',
|
|
1056
|
-
'delegations.ndjson': 'delegation',
|
|
1057
|
-
'reviews.ndjson': 'review',
|
|
1058
|
-
'panels.ndjson': 'panel',
|
|
1059
|
-
'disputes.ndjson': 'dispute',
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
for (const logsDir of candidateLogsDirs) {
|
|
1063
|
-
if (!existsSync(logsDir)) continue
|
|
1064
|
-
|
|
1065
|
-
const eventsFile = resolve(logsDir, 'events.ndjson')
|
|
1066
|
-
let totalMigrated = 0
|
|
1067
|
-
|
|
1068
|
-
for (const [filename, type] of Object.entries(typeMap)) {
|
|
1069
|
-
const filePath = resolve(logsDir, filename)
|
|
1070
|
-
if (!existsSync(filePath)) continue
|
|
1071
|
-
|
|
1072
|
-
let content: string
|
|
1073
|
-
try {
|
|
1074
|
-
content = await readFile(filePath, 'utf8')
|
|
1075
|
-
} catch {
|
|
1076
|
-
continue
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
const lines = content.split('\n').filter((line) => line.trim() !== '')
|
|
1080
|
-
if (lines.length === 0) continue
|
|
1081
|
-
|
|
1082
|
-
const migratedLines: string[] = []
|
|
1083
|
-
for (const line of lines) {
|
|
1084
|
-
try {
|
|
1085
|
-
const record = JSON.parse(line) as Record<string, unknown>
|
|
1086
|
-
if (!record['type']) {
|
|
1087
|
-
record['type'] = type
|
|
1088
|
-
}
|
|
1089
|
-
migratedLines.push(JSON.stringify(record))
|
|
1090
|
-
} catch {
|
|
1091
|
-
console.warn(` ${c.yellow('⚠')} Skipping malformed JSON line in ${filename}`)
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
if (migratedLines.length > 0) {
|
|
1096
|
-
await appendFile(eventsFile, migratedLines.join('\n') + '\n', 'utf8')
|
|
1097
|
-
totalMigrated += migratedLines.length
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
await rename(filePath, filePath + '.migrated')
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
if (totalMigrated > 0) {
|
|
1104
|
-
console.log(
|
|
1105
|
-
` ${c.green('✓')} Migrated ${c.bold(String(totalMigrated))} records from legacy log files to events.ndjson`
|
|
1106
|
-
)
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
1044
|
|
|
1111
1045
|
function sameSet(a: Set<string>, b: Set<string>): boolean {
|
|
1112
1046
|
if (a.size !== b.size) return false
|
|
@@ -2,25 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
# Workflow Templates
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Templates for recurring kinds of work that need more than the prompts give them: the steps, who does each, and what to check. The Team Lead follows one when a task matches it; in Claude Code each is also a `/oc:workflow-<name>` command.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| Template | For |
|
|
8
|
+
|----------|-----|
|
|
9
|
+
| [Database Migration](database-migration.md) | Schema, access-policy and data migrations |
|
|
10
|
+
| [CMS Schema Changes](schema-changes.md) | Content-model changes, and the queries and pages that use them |
|
|
11
|
+
| [Data Pipeline](data-pipeline.md) | Crawl → process → validate → import |
|
|
12
|
+
| [Performance Optimization](performance-optimization.md) | Measure → find the bottleneck → optimize → measure again |
|
|
13
|
+
| [Refactoring](refactoring.md) | Changing code without changing behaviour |
|
|
14
|
+
| [Security Audit](security-audit.md) | A security review, and fixing what it finds |
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
2. **Customize per task** — Templates define the structure; fill in specific files, agents, and criteria
|
|
11
|
-
3. **Track progress** — Use the phase structure to update session checkpoints
|
|
12
|
-
|
|
13
|
-
## Available Templates
|
|
14
|
-
|
|
15
|
-
| Template | Use Case |
|
|
16
|
-
|----------|----------|
|
|
17
|
-
| [Feature Implementation](feature-implementation.md) | Multi-layer features spanning DB → Query → UI → Tests |
|
|
18
|
-
| [Bug Fix](bug-fix.md) | Triage → RCA → Fix → Verify workflow |
|
|
19
|
-
| [Data Pipeline](data-pipeline.md) | Scrape → Convert → Enrich → Validate → Import |
|
|
20
|
-
| [Security Audit](security-audit.md) | Comprehensive security review workflow |
|
|
21
|
-
| [Performance Optimization](performance-optimization.md) | Measure → Analyze → Optimize → Verify |
|
|
22
|
-
| [Schema Changes](schema-changes.md) | CMS schema modifications, query updates, content model changes |
|
|
23
|
-
| [Database Migration](database-migration.md) | Database migrations, RLS policies, type generation, rollback |
|
|
24
|
-
| [Refactoring](refactoring.md) | Safe code refactoring with baseline metrics and behavior preservation |
|
|
16
|
+
Feature work and bug fixes have prompts of their own: `implement-feature` and `bug-fix`.
|
|
25
17
|
|
|
26
18
|
Every template ends by pointing at [the shared delivery phase](shared-delivery-phase.md). The compiler replaces that pointer with the phase itself, so each installed template is complete and the phase is not installed on its own.
|
|
@@ -2,147 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# Workflow: Data Pipeline
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For crawling, converting and importing data into the project's database or CMS. Project-specific sources, paths and rules: `.opencastle/stack/data-pipeline-config.md`, when there is one, and the **data-engineering** skill.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. **Analyse the source** (Data Engineer). What it offers, how its fields map to the target schema, how many records, its terms and rate limits, and any scraper the project already has to follow.
|
|
8
|
+
2. **Crawl** (Data Engineer). Raw records to files (NDJSON), with pagination, rate limiting and recovery from errors; log pages visited, records found and errors. Raw data is not committed.
|
|
9
|
+
3. **Process** (Data Engineer). Convert to the target schema, enrich and normalize by the project's rules, and validate every record against the schema; a bad record is skipped and logged with its reason, never dropped silently.
|
|
10
|
+
4. **Validate** (Team Lead). Spot-check 10–20 records by hand, run the validation over the whole set, and check for duplicates of what already exists.
|
|
11
|
+
5. **Import** (Data Engineer). A test batch of 5–10 records first, checked in the target; then the rest, idempotently, so a re-run changes nothing. Report created, updated, skipped and failed — counts that add up.
|
|
8
12
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
Phase 1: Source Analysis (sub-agent, inline)
|
|
13
|
-
Phase 2: Crawling (background agent)
|
|
14
|
-
Phase 3: Processing (sub-agent, sequential)
|
|
15
|
-
Phase 4: Validation (sub-agent, inline)
|
|
16
|
-
Phase 5: Import (sub-agent, inline)
|
|
17
|
-
Phase 6: Delivery (direct, Team Lead)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Branch & Delivery Strategy
|
|
23
|
-
|
|
24
|
-
The Team Lead creates the branch before any delegation and delivers it as the Delivery phase below describes. Branch naming: `feat/<ticket-id>-<short-description>`. Only code changes are committed — NDJSON data files in `tmp/` are NOT committed to Git.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Phase 1: Source Analysis
|
|
29
|
-
|
|
30
|
-
**Agent:** Data Engineer (via sub-agent)
|
|
31
|
-
**Type:** Sub-agent (inline)
|
|
32
|
-
|
|
33
|
-
### Steps
|
|
34
|
-
|
|
35
|
-
1. Analyze the target data source (website, API, file)
|
|
36
|
-
2. Identify data fields available and their mapping to the place schema
|
|
37
|
-
3. Check the data model documentation (Key Documentation in `.opencastle/project.instructions.md`) for required fields
|
|
38
|
-
4. Estimate record count
|
|
39
|
-
5. Check for existing scraper patterns (see **data-engineering** skill)
|
|
40
|
-
6. Create tracker issue with data source details
|
|
41
|
-
|
|
42
|
-
### Exit Criteria
|
|
43
|
-
|
|
44
|
-
- [ ] Source structure documented
|
|
45
|
-
- [ ] Field mapping defined (source field → target field)
|
|
46
|
-
- [ ] Estimated record count
|
|
47
|
-
- [ ] Tracker issue created
|
|
48
|
-
- [ ] Scraper approach decided (browser-based, fetch, API)
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Phase 2: Crawling
|
|
53
|
-
|
|
54
|
-
**Agent:** Data Engineer
|
|
55
|
-
**Type:** Background agent (may be long-running)
|
|
56
|
-
|
|
57
|
-
### Steps
|
|
58
|
-
|
|
59
|
-
1. Implement crawler following existing patterns (see `data-pipeline-config.md`)
|
|
60
|
-
2. Output raw data as NDJSON
|
|
61
|
-
3. Handle pagination, rate limiting, and error recovery
|
|
62
|
-
4. Log crawling statistics (pages visited, records extracted, errors)
|
|
63
|
-
|
|
64
|
-
### Exit Criteria
|
|
65
|
-
|
|
66
|
-
- [ ] Raw NDJSON file produced
|
|
67
|
-
- [ ] Crawling statistics logged
|
|
68
|
-
- [ ] No duplicate records
|
|
69
|
-
- [ ] Output contract returned
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Phase 3: Processing
|
|
74
|
-
|
|
75
|
-
**Agent:** Data Engineer (via sub-agent)
|
|
76
|
-
**Type:** Sub-agent (sequential — depends on Phase 2 output)
|
|
77
|
-
|
|
78
|
-
### Steps
|
|
79
|
-
|
|
80
|
-
1. Convert raw data to the target schema format
|
|
81
|
-
2. Enrich with appropriate metadata (geocoding, slug generation)
|
|
82
|
-
3. Images optimization
|
|
83
|
-
4. Normalize text fields (see data-pipeline-config.md for rules)
|
|
84
|
-
5. Validate against schema
|
|
85
|
-
6. Output processed NDJSON
|
|
86
|
-
|
|
87
|
-
### Exit Criteria
|
|
88
|
-
|
|
89
|
-
- [ ] Processed NDJSON matches schema
|
|
90
|
-
- [ ] All required fields present
|
|
91
|
-
- [ ] Slugs are unique
|
|
92
|
-
- [ ] Metadata complete
|
|
93
|
-
- [ ] Pipeline tests pass (run the project's test command — see **codebase-tool** skill)
|
|
94
|
-
- [ ] Output contract returned with quality metrics
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Phase 4: Validation
|
|
99
|
-
|
|
100
|
-
**Agent:** Team Lead (self)
|
|
101
|
-
**Type:** Sub-agent (inline)
|
|
102
|
-
|
|
103
|
-
### Steps
|
|
104
|
-
|
|
105
|
-
1. Spot-check 10-20 records manually
|
|
106
|
-
2. Run validation script against full dataset
|
|
107
|
-
3. Check for duplicates against existing data
|
|
108
|
-
4. Verify image URLs are accessible
|
|
109
|
-
5. Confirm field mapping accuracy
|
|
110
|
-
|
|
111
|
-
### Exit Criteria
|
|
112
|
-
|
|
113
|
-
- [ ] Spot check passed
|
|
114
|
-
- [ ] Validation script reports <1% error rate
|
|
115
|
-
- [ ] No duplicates with existing data
|
|
116
|
-
- [ ] Images accessible
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## Phase 5: Import
|
|
121
|
-
|
|
122
|
-
**Agent:** Data Engineer (via sub-agent)
|
|
123
|
-
**Type:** Sub-agent (inline — need immediate feedback)
|
|
124
|
-
|
|
125
|
-
### Steps
|
|
126
|
-
|
|
127
|
-
1. Import small test batch (5-10 records) first
|
|
128
|
-
2. Verify in CMS
|
|
129
|
-
3. Import full dataset
|
|
130
|
-
4. Log import statistics (created, updated, skipped, failed)
|
|
131
|
-
5. Update tracker issue and roadmap
|
|
132
|
-
|
|
133
|
-
### Exit Criteria
|
|
134
|
-
|
|
135
|
-
- [ ] Test batch verified in CMS
|
|
136
|
-
- [ ] Full import complete
|
|
137
|
-
- [ ] Import statistics logged
|
|
138
|
-
- [ ] <0.1% failure rate
|
|
139
|
-
- [ ] Output contract returned
|
|
140
|
-
- [ ] Delivery phase completed — branch pushed, PR opened (not merged), tracker linked
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
### Phase 6: Delivery
|
|
13
|
+
## Delivery
|
|
145
14
|
|
|
146
15
|
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
147
|
-
>
|
|
148
|
-
> Commit → Push → PR → tracker linkage. Team Lead owns delivery.
|
|
@@ -2,160 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# Workflow: Database Migration
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For a schema change, an access-policy change or a data migration. The database's own syntax and tools are in its skill and in `.opencastle/stack/<database>-config.md`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. **Plan** (Data Engineer). Read the current schema, its access policies and the known issues. Write down the tables and columns affected, the policy changes, what happens to existing rows, and how to roll it back.
|
|
8
|
+
2. **Migrate** (Data Engineer). A new migration in the project's naming convention — never a hand edit of the schema. Re-runnable; every new table guarded by its access control, deny by default and allow explicitly; an index for each column you query by; the rollback written with it. Apply it locally, then apply it again: the second run changes nothing.
|
|
9
|
+
3. **Regenerate the types** (Data Engineer), when the project generates them from the schema, and check they compile.
|
|
10
|
+
4. **Integrate** (Developer). Update the handlers and components that read or write the changed tables; run the tests, lint and build; check the affected pages in a browser.
|
|
11
|
+
5. **Verify** (Team Lead). Exercise each access policy from every role that should and should not see the rows; spot-check the data; walk the feature end to end. A change to auth or to access policies gets **panel-majority-vote**.
|
|
8
12
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
Phase 1: Migration Planning (sub-agent, inline)
|
|
13
|
-
Phase 2: Migration Implementation (sub-agent or background)
|
|
14
|
-
Phase 3: Type Generation (sub-agent, sequential)
|
|
15
|
-
Phase 4: Code Integration (sub-agent, sequential)
|
|
16
|
-
Phase 5: Verification & Rollback Test (sub-agent, inline)
|
|
17
|
-
Phase 6: Delivery (direct, Team Lead)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Branch & Delivery Strategy
|
|
23
|
-
|
|
24
|
-
The Team Lead creates the branch before any delegation and delivers it as the Delivery phase below describes. Branch naming: `feat/<ticket-id>-<short-description>` or `fix/<ticket-id>-<short-description>`.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Phase 1: Migration Planning
|
|
29
|
-
|
|
30
|
-
**Agent:** Data Engineer (via sub-agent)
|
|
31
|
-
**Type:** Sub-agent (inline)
|
|
32
|
-
|
|
33
|
-
### Steps
|
|
34
|
-
|
|
35
|
-
1. Read current schema in the migrations directory (see database customization) to understand existing tables
|
|
36
|
-
2. Check existing RLS policies using the database query tool
|
|
37
|
-
3. Read `.opencastle/project.instructions.md` for database architecture
|
|
38
|
-
4. Check `.opencastle/KNOWN-ISSUES.md` for database-related limitations
|
|
39
|
-
5. Document the migration plan: tables affected, columns added/removed, RLS changes
|
|
40
|
-
6. Write rollback strategy (how to reverse the migration)
|
|
41
|
-
7. Create tracker issue with migration details and rollback plan
|
|
42
|
-
|
|
43
|
-
### Exit Criteria
|
|
44
|
-
|
|
45
|
-
- [ ] Current schema understood
|
|
46
|
-
- [ ] Migration plan documented
|
|
47
|
-
- [ ] Rollback strategy defined
|
|
48
|
-
- [ ] Impact on existing data assessed
|
|
49
|
-
- [ ] Tracker issue created with rollback plan
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Phase 2: Migration Implementation
|
|
54
|
-
|
|
55
|
-
**Agent:** Data Engineer
|
|
56
|
-
**Type:** Sub-agent (simple changes) or Background (complex migrations)
|
|
57
|
-
|
|
58
|
-
### File Partition
|
|
59
|
-
|
|
60
|
-
> See the database customization file for project-specific migration paths.
|
|
61
|
-
|
|
62
|
-
- Migrations directory — migration SQL files
|
|
63
|
-
|
|
64
|
-
### Steps
|
|
65
|
-
|
|
66
|
-
1. Create migration file following naming convention: `YYYYMMDDHHMMSS_description.sql`
|
|
67
|
-
2. Write idempotent SQL (can safely re-run)
|
|
68
|
-
3. Include RLS policies for any new tables — default deny, explicit allow
|
|
69
|
-
4. Add indexes for frequently queried columns
|
|
70
|
-
5. Include SQL comments documenting the purpose
|
|
71
|
-
6. Apply migration using the database MCP tool
|
|
72
|
-
7. Verify migration applied successfully
|
|
73
|
-
|
|
74
|
-
### Exit Criteria
|
|
75
|
-
|
|
76
|
-
- [ ] Migration file created with idempotent SQL
|
|
77
|
-
- [ ] RLS policies included for new tables
|
|
78
|
-
- [ ] Indexes added for query columns
|
|
79
|
-
- [ ] Migration applied successfully
|
|
80
|
-
- [ ] Rollback SQL tested (or documented)
|
|
81
|
-
- [ ] Output contract returned
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Phase 3: Type Generation
|
|
86
|
-
|
|
87
|
-
**Agent:** Data Engineer (via sub-agent)
|
|
88
|
-
**Type:** Sub-agent (sequential — depends on Phase 2)
|
|
89
|
-
|
|
90
|
-
### Steps
|
|
91
|
-
|
|
92
|
-
1. Generate updated TypeScript types using the database MCP tool
|
|
93
|
-
2. Update any local type files that reference the changed tables
|
|
94
|
-
3. Verify types compile correctly
|
|
95
|
-
|
|
96
|
-
### Exit Criteria
|
|
97
|
-
|
|
98
|
-
- [ ] TypeScript types regenerated
|
|
99
|
-
- [ ] Types compile without errors
|
|
100
|
-
- [ ] Output contract returned
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## Phase 4: Code Integration
|
|
105
|
-
|
|
106
|
-
**Agent:** Developer (via sub-agent)
|
|
107
|
-
**Type:** Sub-agent (sequential — depends on Phase 3)
|
|
108
|
-
|
|
109
|
-
### File Partition
|
|
110
|
-
|
|
111
|
-
- Varies by feature — typically Server Actions, API routes, React components
|
|
112
|
-
|
|
113
|
-
### Steps
|
|
114
|
-
|
|
115
|
-
1. Update Server Actions / API routes to use new schema
|
|
116
|
-
2. Update components to handle new data fields
|
|
117
|
-
3. Run lint + test + build for affected projects
|
|
118
|
-
4. Start dev server and test in browser
|
|
119
|
-
|
|
120
|
-
### Exit Criteria
|
|
121
|
-
|
|
122
|
-
- [ ] Server Actions updated
|
|
123
|
-
- [ ] Components updated
|
|
124
|
-
- [ ] Lint + test + build pass
|
|
125
|
-
- [ ] Browser verification complete
|
|
126
|
-
- [ ] Output contract returned
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
## Phase 5: Verification & Rollback Test
|
|
131
|
-
|
|
132
|
-
**Agent:** Team Lead (self)
|
|
133
|
-
**Type:** Direct verification
|
|
134
|
-
|
|
135
|
-
### Steps
|
|
136
|
-
|
|
137
|
-
1. Review all output contracts from Phases 2–4
|
|
138
|
-
2. Verify RLS policies from different user roles (anon, authenticated, admin)
|
|
139
|
-
3. Spot-check data using the database query tool
|
|
140
|
-
4. Start dev server and verify end-to-end functionality
|
|
141
|
-
5. **Security check:** If the migration touches auth or RLS, schedule panel review
|
|
142
|
-
6. Document rollback procedure in tracker issue
|
|
143
|
-
7. Move tracker issue to Done
|
|
144
|
-
|
|
145
|
-
### Exit Criteria
|
|
146
|
-
|
|
147
|
-
- [ ] RLS policies tested from multiple roles
|
|
148
|
-
- [ ] Data integrity verified
|
|
149
|
-
- [ ] End-to-end flow works in browser
|
|
150
|
-
- [ ] Panel review passed (if auth/RLS changes)
|
|
151
|
-
- [ ] Rollback procedure documented
|
|
152
|
-
- [ ] Tracker issue moved to Done
|
|
153
|
-
- [ ] Delivery phase completed — branch pushed, PR opened (not merged), tracker linked
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
### Phase 6: Delivery
|
|
13
|
+
## Delivery
|
|
158
14
|
|
|
159
15
|
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
160
|
-
>
|
|
161
|
-
> Commit → Push → PR → tracker linkage. Team Lead owns delivery.
|
|
@@ -2,126 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# Workflow: Performance Optimization
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For making something measurably faster. Never optimize without a measurement.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. **Measure the baseline** (Performance Expert). A production build of the affected apps; Lighthouse on the key pages — the most traffic, the heaviest rendering — at least three runs, the median; the bundle size; the Core Web Vitals (LCP, INP, CLS) and TTFB; server render time.
|
|
8
|
+
2. **Find the bottlenecks** (Performance Expert). The top three, ranked by what the user feels: the largest chunks, client-side JavaScript that need not ship, images, caching headers, slow queries.
|
|
9
|
+
3. **Optimize** — in parallel where the files do not overlap: bundle and code splitting (Performance Expert), images (UI/UX Expert), data fetching and caching (Developer), indexes and query plans (Data Engineer).
|
|
10
|
+
4. **Verify** (Performance Expert). The same pages, the same build, the same runs: before against after, with no visual regression (browser) and no functional one (the test suite). Keep a change only if it measurably helps.
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
Phase 1: Baseline Measurement (sub-agent, inline)
|
|
11
|
-
Phase 2: Analysis (sub-agent, inline)
|
|
12
|
-
Phase 3: Optimization (background agents, parallel)
|
|
13
|
-
Phase 4: Verification (sub-agent, inline)
|
|
14
|
-
Phase 5: Delivery (direct, Team Lead)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Branch & Delivery Strategy
|
|
20
|
-
|
|
21
|
-
The Team Lead creates the branch before any delegation and delivers it as the Delivery phase below describes. Branch naming: `perf/<ticket-id>-<short-description>` or `feat/<ticket-id>-<short-description>`.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Phase 1: Baseline Measurement
|
|
26
|
-
|
|
27
|
-
**Agent:** Performance Expert (via sub-agent)
|
|
28
|
-
**Type:** Sub-agent (inline)
|
|
29
|
-
|
|
30
|
-
### Steps
|
|
31
|
-
|
|
32
|
-
1. Build the affected app(s) with production config
|
|
33
|
-
2. Run Lighthouse audit on key pages
|
|
34
|
-
3. Measure bundle size (production build output — see the **codebase-tool** skill for the build command)
|
|
35
|
-
4. Record Core Web Vitals: LCP, FID/INP, CLS, TTFB
|
|
36
|
-
5. Profile server-side rendering time
|
|
37
|
-
6. Document baseline metrics
|
|
38
|
-
|
|
39
|
-
### Key Pages to Measure
|
|
40
|
-
|
|
41
|
-
> See `.opencastle/project.instructions.md` for the app inventory and key routes. Prioritize pages with the most traffic and the most complex rendering.
|
|
42
|
-
|
|
43
|
-
### Exit Criteria
|
|
44
|
-
|
|
45
|
-
- [ ] Baseline metrics recorded for all key pages
|
|
46
|
-
- [ ] Bundle size documented
|
|
47
|
-
- [ ] Lighthouse scores saved
|
|
48
|
-
- [ ] Tracker issue created with targets
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Phase 2: Analysis
|
|
53
|
-
|
|
54
|
-
**Agent:** Performance Expert (via sub-agent)
|
|
55
|
-
**Type:** Sub-agent (inline)
|
|
56
|
-
|
|
57
|
-
### Steps
|
|
58
|
-
|
|
59
|
-
1. Identify the top 3 performance bottlenecks
|
|
60
|
-
2. Analyze bundle composition (largest chunks)
|
|
61
|
-
3. Check for unnecessary client-side JavaScript
|
|
62
|
-
4. Review image optimization (WebP/AVIF, lazy loading, sizing)
|
|
63
|
-
5. Check caching headers and ISR configuration
|
|
64
|
-
6. Review database query performance (if applicable)
|
|
65
|
-
7. Prioritize optimizations by impact/effort
|
|
66
|
-
|
|
67
|
-
### Exit Criteria
|
|
68
|
-
|
|
69
|
-
- [ ] Top 3 bottlenecks identified with evidence
|
|
70
|
-
- [ ] Optimization plan created (ordered by impact)
|
|
71
|
-
- [ ] Each optimization has expected improvement estimate
|
|
72
|
-
- [ ] File partitions mapped for parallel work
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Phase 3: Optimization (Parallel)
|
|
77
|
-
|
|
78
|
-
**Agents:** Varies by optimization type
|
|
79
|
-
**Type:** Background agents (parallel where file partitions allow)
|
|
80
|
-
|
|
81
|
-
### Typical Tracks
|
|
82
|
-
|
|
83
|
-
| Track | Agent | Focus | Files |
|
|
84
|
-
|-------|-------|-------|-------|
|
|
85
|
-
| A: Bundle | Performance Expert | Code splitting, tree shaking, dynamic imports | `app/`, `libs/` |
|
|
86
|
-
| B: Images | UI/UX Expert | Image optimization, lazy loading, srcset | `components/`, `public/` |
|
|
87
|
-
| C: Queries | Developer | Query optimization, caching | Query library, framework config |
|
|
88
|
-
| D: Database | Data Engineer | Index optimization, query planning | Database migrations |
|
|
89
|
-
|
|
90
|
-
### Exit Criteria (per track)
|
|
91
|
-
|
|
92
|
-
- [ ] Optimization implemented
|
|
93
|
-
- [ ] Lint + test + build pass
|
|
94
|
-
- [ ] Output contract with before/after metrics
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Phase 4: Verification
|
|
99
|
-
|
|
100
|
-
**Agent:** Performance Expert (via sub-agent)
|
|
101
|
-
**Type:** Sub-agent (inline)
|
|
102
|
-
|
|
103
|
-
### Steps
|
|
104
|
-
|
|
105
|
-
1. Rebuild with production config
|
|
106
|
-
2. Re-run Lighthouse on same pages as Phase 1
|
|
107
|
-
3. Compare metrics: before vs. after
|
|
108
|
-
4. Verify no visual regressions (browser test)
|
|
109
|
-
5. Confirm no functional regressions (test suite)
|
|
110
|
-
6. Document results
|
|
111
|
-
|
|
112
|
-
### Exit Criteria
|
|
113
|
-
|
|
114
|
-
- [ ] Metrics improved (or justified why not)
|
|
115
|
-
- [ ] No visual regressions
|
|
116
|
-
- [ ] No functional regressions
|
|
117
|
-
- [ ] Results documented in tracker issue
|
|
118
|
-
- [ ] Roadmap updated
|
|
119
|
-
- [ ] Delivery phase completed — branch pushed, PR opened (not merged), tracker linked
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
### Phase 5: Delivery
|
|
12
|
+
## Delivery
|
|
124
13
|
|
|
125
14
|
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
126
|
-
>
|
|
127
|
-
> Commit → Push → PR → tracker linkage. Team Lead owns delivery.
|