opencastle 1.1.1 → 1.2.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 +22 -5
- package/bin/cli.mjs +6 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +24 -2
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/agent-plugin.d.ts +119 -0
- package/dist/cli/agent-plugin.d.ts.map +1 -0
- package/dist/cli/agent-plugin.js +449 -0
- package/dist/cli/agent-plugin.js.map +1 -0
- package/dist/cli/agent-plugin.test.d.ts +2 -0
- package/dist/cli/agent-plugin.test.d.ts.map +1 -0
- package/dist/cli/agent-plugin.test.js +227 -0
- package/dist/cli/agent-plugin.test.js.map +1 -0
- package/dist/cli/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +99 -26
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/convoy/gates.d.ts +2 -20
- package/dist/cli/convoy/gates.d.ts.map +1 -1
- package/dist/cli/convoy/gates.js +3 -111
- package/dist/cli/convoy/gates.js.map +1 -1
- package/dist/cli/copy.d.ts +0 -8
- package/dist/cli/copy.d.ts.map +1 -1
- package/dist/cli/copy.js +0 -21
- package/dist/cli/copy.js.map +1 -1
- package/dist/cli/dispatcher.test.js +2 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +2 -0
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +2 -0
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init.test.js +36 -24
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/layers.d.ts +8 -0
- package/dist/cli/layers.d.ts.map +1 -1
- package/dist/cli/layers.js +130 -13
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/layers.test.js +2 -2
- package/dist/cli/layers.test.js.map +1 -1
- package/dist/cli/legacy-install.test.js +8 -1
- package/dist/cli/legacy-install.test.js.map +1 -1
- package/dist/cli/lesson-command.test.d.ts +2 -0
- package/dist/cli/lesson-command.test.d.ts.map +1 -0
- package/dist/cli/lesson-command.test.js +100 -0
- package/dist/cli/lesson-command.test.js.map +1 -0
- package/dist/cli/lesson.d.ts +0 -9
- package/dist/cli/lesson.d.ts.map +1 -1
- package/dist/cli/lesson.js +212 -276
- package/dist/cli/lesson.js.map +1 -1
- package/dist/cli/lessons.d.ts +134 -0
- package/dist/cli/lessons.d.ts.map +1 -0
- package/dist/cli/lessons.js +493 -0
- package/dist/cli/lessons.js.map +1 -0
- package/dist/cli/lessons.test.d.ts +2 -0
- package/dist/cli/lessons.test.d.ts.map +1 -0
- package/dist/cli/lessons.test.js +214 -0
- package/dist/cli/lessons.test.js.map +1 -0
- package/dist/cli/pack-plugins.d.ts +8 -0
- package/dist/cli/pack-plugins.d.ts.map +1 -0
- package/dist/cli/pack-plugins.js +70 -0
- package/dist/cli/pack-plugins.js.map +1 -0
- package/dist/cli/plugin-command.test.d.ts +2 -0
- package/dist/cli/plugin-command.test.d.ts.map +1 -0
- package/dist/cli/plugin-command.test.js +114 -0
- package/dist/cli/plugin-command.test.js.map +1 -0
- package/dist/cli/plugin.d.ts +30 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +291 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/promote-command.test.d.ts +2 -0
- package/dist/cli/promote-command.test.d.ts.map +1 -0
- package/dist/cli/promote-command.test.js +151 -0
- package/dist/cli/promote-command.test.js.map +1 -0
- package/dist/cli/promote.d.ts +12 -0
- package/dist/cli/promote.d.ts.map +1 -0
- package/dist/cli/promote.js +364 -0
- package/dist/cli/promote.js.map +1 -0
- package/dist/cli/secret-scan.d.ts +21 -0
- package/dist/cli/secret-scan.d.ts.map +1 -0
- package/dist/cli/secret-scan.js +114 -0
- package/dist/cli/secret-scan.js.map +1 -0
- package/dist/cli/sync-check.d.ts.map +1 -1
- package/dist/cli/sync-check.js +9 -0
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/team-commands.test.js +2 -2
- package/dist/cli/team-commands.test.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +18 -0
- package/dist/cli/update.js.map +1 -1
- package/dist/orchestrator/plugins/agent-plugins.test.d.ts +2 -0
- package/dist/orchestrator/plugins/agent-plugins.test.d.ts.map +1 -0
- package/dist/orchestrator/plugins/agent-plugins.test.js +32 -0
- package/dist/orchestrator/plugins/agent-plugins.test.js.map +1 -0
- package/package.json +2 -1
- package/src/cli/adapters/single-file-base.ts +23 -2
- package/src/cli/agent-plugin.test.ts +267 -0
- package/src/cli/agent-plugin.ts +469 -0
- package/src/cli/baseline.ts +99 -26
- package/src/cli/convoy/gates.ts +9 -142
- package/src/cli/copy.ts +0 -25
- package/src/cli/dispatcher.test.ts +2 -2
- package/src/cli/docs-accuracy.test.ts +2 -0
- package/src/cli/doctor.ts +2 -0
- package/src/cli/fixtures/lessons-template-1.0.md +70 -0
- package/src/cli/init.test.ts +37 -24
- package/src/cli/layers.test.ts +2 -2
- package/src/cli/layers.ts +144 -14
- package/src/cli/legacy-install.test.ts +11 -1
- package/src/cli/lesson-command.test.ts +117 -0
- package/src/cli/lesson.ts +215 -266
- package/src/cli/lessons.test.ts +254 -0
- package/src/cli/lessons.ts +540 -0
- package/src/cli/pack-plugins.ts +70 -0
- package/src/cli/plugin-command.test.ts +125 -0
- package/src/cli/plugin.ts +309 -0
- package/src/cli/promote-command.test.ts +170 -0
- package/src/cli/promote.ts +371 -0
- package/src/cli/secret-scan.ts +154 -0
- package/src/cli/sync-check.ts +9 -0
- package/src/cli/team-commands.test.ts +2 -2
- package/src/cli/update.ts +20 -0
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/orchestrator/agents/researcher.agent.md +1 -1
- package/src/orchestrator/customizations/LESSONS-LEARNED.md +10 -66
- package/src/orchestrator/customizations/README.md +2 -1
- package/src/orchestrator/customizations/logs/README.md +1 -1
- package/src/orchestrator/plugins/agent-plugins.test.ts +34 -0
- package/src/orchestrator/plugins/astro/mcp.json +9 -0
- package/src/orchestrator/plugins/astro/plugin.json +21 -0
- package/src/orchestrator/plugins/chrome-devtools/mcp.json +13 -0
- package/src/orchestrator/plugins/chrome-devtools/plugin.json +21 -0
- package/src/orchestrator/plugins/cloudflare/mcp.json +9 -0
- package/src/orchestrator/plugins/cloudflare/plugin.json +21 -0
- package/src/orchestrator/plugins/contentful/mcp.json +13 -0
- package/src/orchestrator/plugins/contentful/plugin.json +21 -0
- package/src/orchestrator/plugins/convex/mcp.json +15 -0
- package/src/orchestrator/plugins/convex/plugin.json +21 -0
- package/src/orchestrator/plugins/coolify/mcp.json +13 -0
- package/src/orchestrator/plugins/coolify/plugin.json +25 -0
- package/src/orchestrator/plugins/cypress/plugin.json +21 -0
- package/src/orchestrator/plugins/drizzle/plugin.json +21 -0
- package/src/orchestrator/plugins/expo/mcp.json +9 -0
- package/src/orchestrator/plugins/expo/plugin.json +21 -0
- package/src/orchestrator/plugins/figma/mcp.json +9 -0
- package/src/orchestrator/plugins/figma/plugin.json +21 -0
- package/src/orchestrator/plugins/hetzner/plugin.json +24 -0
- package/src/orchestrator/plugins/jira/mcp.json +9 -0
- package/src/orchestrator/plugins/jira/plugin.json +21 -0
- package/src/orchestrator/plugins/linear/mcp.json +9 -0
- package/src/orchestrator/plugins/linear/plugin.json +21 -0
- package/src/orchestrator/plugins/netlify/mcp.json +13 -0
- package/src/orchestrator/plugins/netlify/plugin.json +21 -0
- package/src/orchestrator/plugins/nextjs/mcp.json +13 -0
- package/src/orchestrator/plugins/nextjs/plugin.json +21 -0
- package/src/orchestrator/plugins/notion/mcp.json +9 -0
- package/src/orchestrator/plugins/notion/plugin.json +21 -0
- package/src/orchestrator/plugins/nx/mcp.json +14 -0
- package/src/orchestrator/plugins/nx/plugin.json +21 -0
- package/src/orchestrator/plugins/playwright/mcp.json +13 -0
- package/src/orchestrator/plugins/playwright/plugin.json +21 -0
- package/src/orchestrator/plugins/prisma/mcp.json +14 -0
- package/src/orchestrator/plugins/prisma/plugin.json +21 -0
- package/src/orchestrator/plugins/resend/mcp.json +13 -0
- package/src/orchestrator/plugins/resend/plugin.json +24 -0
- package/src/orchestrator/plugins/sanity/mcp.json +9 -0
- package/src/orchestrator/plugins/sanity/plugin.json +21 -0
- package/src/orchestrator/plugins/sentry/mcp.json +12 -0
- package/src/orchestrator/plugins/sentry/plugin.json +24 -0
- package/src/orchestrator/plugins/slack/mcp.json +13 -0
- package/src/orchestrator/plugins/slack/plugin.json +24 -0
- package/src/orchestrator/plugins/strapi/mcp.json +13 -0
- package/src/orchestrator/plugins/strapi/plugin.json +21 -0
- package/src/orchestrator/plugins/stripe/mcp.json +9 -0
- package/src/orchestrator/plugins/stripe/plugin.json +21 -0
- package/src/orchestrator/plugins/supabase/mcp.json +9 -0
- package/src/orchestrator/plugins/supabase/plugin.json +21 -0
- package/src/orchestrator/plugins/teams/plugin.json +24 -0
- package/src/orchestrator/plugins/trello/mcp.json +13 -0
- package/src/orchestrator/plugins/trello/plugin.json +25 -0
- package/src/orchestrator/plugins/turborepo/plugin.json +21 -0
- package/src/orchestrator/plugins/vercel/mcp.json +9 -0
- package/src/orchestrator/plugins/vercel/plugin.json +21 -0
- package/src/orchestrator/plugins/vitest/plugin.json +21 -0
- package/src/orchestrator/skill-config-links.test.ts +2 -1
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +1 -1
- package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
- package/src/orchestrator/skills/decomposition/SKILL.md +1 -1
- package/src/orchestrator/skills/memory-merger/SKILL.md +17 -21
- package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +44 -23
- package/src/orchestrator/skills/self-improvement/SKILL.md +30 -15
- /package/src/orchestrator/plugins/astro/{SKILL.md → skills/astro-framework/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/chrome-devtools/{SKILL.md → skills/browser-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/cloudflare/{SKILL.md → skills/cloudflare-platform/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/contentful/{SKILL.md → skills/contentful-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/convex/{SKILL.md → skills/convex-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/coolify/{SKILL.md → skills/coolify-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/cypress/{SKILL.md → skills/cypress-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/drizzle/{SKILL.md → skills/drizzle-orm/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/expo/{SKILL.md → skills/expo-development/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/figma/{SKILL.md → skills/figma-design/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/hetzner/{SKILL.md → skills/hetzner-cloud/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/jira/{SKILL.md → skills/jira-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/linear/{SKILL.md → skills/linear-task-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/netlify/{SKILL.md → skills/netlify-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/nextjs/{SKILL.md → skills/nextjs-framework/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/notion/{SKILL.md → skills/notion-knowledge-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/nx/{SKILL.md → skills/nx-workspace/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/playwright/{SKILL.md → skills/playwright-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/prisma/{SKILL.md → skills/prisma-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/resend/{SKILL.md → skills/resend-email/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/sanity/{SKILL.md → skills/sanity-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/sentry/{SKILL.md → skills/sentry-monitoring/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/slack/{SKILL.md → skills/slack-notifications/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/strapi/{SKILL.md → skills/strapi-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/stripe/{SKILL.md → skills/stripe-payments/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/supabase/{SKILL.md → skills/supabase-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/teams/{SKILL.md → skills/teams-notifications/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/trello/{SKILL.md → skills/trello-task-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/turborepo/{SKILL.md → skills/turborepo-monorepo/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/vercel/{SKILL.md → skills/vercel-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/vitest/{SKILL.md → skills/vitest-testing/SKILL.md} +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lessons: what agents on a project learned the hard way, kept as one file each.
|
|
3
|
+
*
|
|
4
|
+
* They used to be entries appended to `.opencastle/LESSONS-LEARNED.md`, each
|
|
5
|
+
* numbered one past the highest number in the file. On a team that is the
|
|
6
|
+
* shape of a merge conflict: two branches each append at the end and each
|
|
7
|
+
* call theirs LES-042. One file per lesson, named by date and title, merges
|
|
8
|
+
* like any other new file, and the index agents read first is compiled from
|
|
9
|
+
* them — rewritten by every `sync`, checked by `sync --check`, never edited.
|
|
10
|
+
*
|
|
11
|
+
* A lesson can cite the code it is about. Copilot Memory showed the value of
|
|
12
|
+
* that: a memory checked against the current code before use does not mislead
|
|
13
|
+
* an agent after a refactor. Here each cited file's fingerprint, taken when the
|
|
14
|
+
* lesson was last verified, lets `doctor` say which lessons the code has moved
|
|
15
|
+
* under — without git history, which a shallow CI clone does not have.
|
|
16
|
+
*/
|
|
17
|
+
export declare const LESSON_CATEGORIES: readonly ["task-management", "jira", "mcp-tools", "codebase-tool", "terminal", "framework", "cms", "database", "git", "deployment", "browser-testing", "general"];
|
|
18
|
+
export type LessonCategory = (typeof LESSON_CATEGORIES)[number];
|
|
19
|
+
export declare const LESSON_SEVERITIES: readonly ["high", "medium", "low"];
|
|
20
|
+
export type LessonSeverity = (typeof LESSON_SEVERITIES)[number];
|
|
21
|
+
/** Relative to `.opencastle/`. */
|
|
22
|
+
export declare const LESSONS_DIR = "lessons";
|
|
23
|
+
export declare const LESSONS_INDEX = "LESSONS-LEARNED.md";
|
|
24
|
+
/** The first line of a compiled index; a file without it is the old single-file log. */
|
|
25
|
+
export declare const INDEX_MARKER = "<!-- Generated by OpenCastle from the files in lessons/. Add a lesson with \"opencastle lesson\"; this index is rewritten by every sync. -->";
|
|
26
|
+
export interface Lesson {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
category: string;
|
|
30
|
+
severity: string;
|
|
31
|
+
/** YYYY-MM-DD. */
|
|
32
|
+
added: string;
|
|
33
|
+
/** Project-relative paths, optionally `:line`, the lesson is about. */
|
|
34
|
+
citations: string[];
|
|
35
|
+
/** YYYY-MM-DD of the last check that the lesson still holds. */
|
|
36
|
+
verified?: string;
|
|
37
|
+
/** Each cited file's content fingerprint at that check, by path. */
|
|
38
|
+
fingerprints?: Record<string, string>;
|
|
39
|
+
status: 'active' | 'archived';
|
|
40
|
+
/** The skill or instruction file an archived lesson was merged into. */
|
|
41
|
+
mergedInto?: string;
|
|
42
|
+
/** Where a lesson came from, when not from `opencastle lesson`. */
|
|
43
|
+
source?: string;
|
|
44
|
+
/** Markdown: Problem, Wrong approach, Correct approach, Why. */
|
|
45
|
+
body: string;
|
|
46
|
+
/** File name within `lessons/`. */
|
|
47
|
+
file: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function isLessonCategory(s: string): s is LessonCategory;
|
|
50
|
+
export declare function isLessonSeverity(s: string): s is LessonSeverity;
|
|
51
|
+
export declare function today(): string;
|
|
52
|
+
/** `quote shell variables` → `quote-shell-variables`, cut at a word under 50 characters. */
|
|
53
|
+
export declare function slugOf(title: string): string;
|
|
54
|
+
/** A new lesson's id: its date and title, made unique among `taken`. */
|
|
55
|
+
export declare function newLessonId(title: string, date: string, taken: Set<string>): string;
|
|
56
|
+
export declare function renderLesson(lesson: Omit<Lesson, 'file'>): string;
|
|
57
|
+
/** The body for a lesson written from its parts. */
|
|
58
|
+
export declare function lessonBody(parts: {
|
|
59
|
+
problem: string;
|
|
60
|
+
wrong?: string;
|
|
61
|
+
correct?: string;
|
|
62
|
+
why?: string;
|
|
63
|
+
}): string;
|
|
64
|
+
/** Parse one lesson file. Returns an error string for one that cannot be read as a lesson. */
|
|
65
|
+
export declare function parseLesson(text: string, file: string): Lesson | string;
|
|
66
|
+
/** Every lesson in `<customizations>/lessons/`, and the files that could not be read as one. */
|
|
67
|
+
export declare function readLessons(customizationsDir: string): {
|
|
68
|
+
lessons: Lesson[];
|
|
69
|
+
problems: string[];
|
|
70
|
+
};
|
|
71
|
+
export declare function findLesson(lessons: Lesson[], idOrFile: string): Lesson | undefined;
|
|
72
|
+
export declare function renderIndex(lessons: Lesson[]): string;
|
|
73
|
+
export declare function isCompiledIndex(text: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The lessons in an old `LESSONS-LEARNED.md`, wherever in the file they are.
|
|
76
|
+
*
|
|
77
|
+
* Agents appended them wherever they saw fit — after the index as often as
|
|
78
|
+
* before it — and with categories and severities the CLI never offered, so
|
|
79
|
+
* this reads each `### LES-NNN:` block on its own and keeps what it says.
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseLegacyLessons(text: string): Array<Omit<Lesson, 'file'>>;
|
|
82
|
+
export interface LessonsSync {
|
|
83
|
+
/** Lessons moved out of the old single file. */
|
|
84
|
+
migrated: number;
|
|
85
|
+
/** Where the old file was kept, when it held anything of the team's. */
|
|
86
|
+
backup?: string;
|
|
87
|
+
index: 'created' | 'updated' | 'unchanged' | 'absent';
|
|
88
|
+
problems: string[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Bring `.opencastle/` to the current shape: lessons in the old single file
|
|
92
|
+
* moved into `lessons/`, and the index rewritten from the files. Run by `sync`
|
|
93
|
+
* and by every `opencastle lesson` that writes.
|
|
94
|
+
*
|
|
95
|
+
* A project with neither an index nor a `lessons/` directory is left as it is:
|
|
96
|
+
* someone removed the file, and putting it back is not ours to decide.
|
|
97
|
+
*/
|
|
98
|
+
export declare function syncLessons(customizationsDir: string): LessonsSync;
|
|
99
|
+
/**
|
|
100
|
+
* What `sync --check` and `doctor` say about the index, or null when it is
|
|
101
|
+
* current. Never writes.
|
|
102
|
+
*/
|
|
103
|
+
export declare function lessonsIndexDrift(customizationsDir: string): string | null;
|
|
104
|
+
/** The path part of a citation: `src/a.ts:12` and `src/a.ts#L12` both cite `src/a.ts`. */
|
|
105
|
+
export declare function citedPath(citation: string): string;
|
|
106
|
+
/** Why a citation cannot be recorded, or null when it can. */
|
|
107
|
+
export declare function citationProblem(projectRoot: string, citation: string): string | null;
|
|
108
|
+
/**
|
|
109
|
+
* A short digest of a file's content, line endings normalised so a checkout
|
|
110
|
+
* with `core.autocrlf` does not read as a change. Null for what is not a file.
|
|
111
|
+
*/
|
|
112
|
+
export declare function fingerprintOf(projectRoot: string, path: string): string | null;
|
|
113
|
+
/** The fingerprint of every file a lesson cites, by path. */
|
|
114
|
+
export declare function fingerprintsOf(projectRoot: string, citations: string[]): Record<string, string>;
|
|
115
|
+
export interface StaleCitation {
|
|
116
|
+
lesson: Lesson;
|
|
117
|
+
citation: string;
|
|
118
|
+
why: 'missing' | 'changed';
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Citations whose file is gone, or whose content differs from its fingerprint
|
|
122
|
+
* when the lesson was last verified. A citation recorded with no fingerprint —
|
|
123
|
+
* a directory, or a lesson written by hand — is checked for existence only.
|
|
124
|
+
*/
|
|
125
|
+
export declare function staleCitations(projectRoot: string, lessons: Lesson[]): StaleCitation[];
|
|
126
|
+
/** The check `doctor` runs on a project's lessons. */
|
|
127
|
+
export declare function checkLessons(projectRoot: string): {
|
|
128
|
+
ok: boolean;
|
|
129
|
+
label: string;
|
|
130
|
+
detail?: string;
|
|
131
|
+
warning?: boolean;
|
|
132
|
+
fix?: string;
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=lessons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lessons.d.ts","sourceRoot":"","sources":["../../src/cli/lessons.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,mKAapB,CAAA;AACV,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,iBAAiB,oCAAqC,CAAA;AACnE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,kCAAkC;AAClC,eAAO,MAAM,WAAW,YAAY,CAAA;AACpC,eAAO,MAAM,aAAa,uBAAuB,CAAA;AAEjD,wFAAwF;AACxF,eAAO,MAAM,YAAY,iJACqH,CAAA;AAE9I,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC7B,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mEAAmE;IACnE,MAAM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AC3B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAiBtF;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG;IACjD,EAAE,EAAE,OAAO,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CA2CA"}
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
4
|
+
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
5
|
+
/**
|
|
6
|
+
* Lessons: what agents on a project learned the hard way, kept as one file each.
|
|
7
|
+
*
|
|
8
|
+
* They used to be entries appended to `.opencastle/LESSONS-LEARNED.md`, each
|
|
9
|
+
* numbered one past the highest number in the file. On a team that is the
|
|
10
|
+
* shape of a merge conflict: two branches each append at the end and each
|
|
11
|
+
* call theirs LES-042. One file per lesson, named by date and title, merges
|
|
12
|
+
* like any other new file, and the index agents read first is compiled from
|
|
13
|
+
* them — rewritten by every `sync`, checked by `sync --check`, never edited.
|
|
14
|
+
*
|
|
15
|
+
* A lesson can cite the code it is about. Copilot Memory showed the value of
|
|
16
|
+
* that: a memory checked against the current code before use does not mislead
|
|
17
|
+
* an agent after a refactor. Here each cited file's fingerprint, taken when the
|
|
18
|
+
* lesson was last verified, lets `doctor` say which lessons the code has moved
|
|
19
|
+
* under — without git history, which a shallow CI clone does not have.
|
|
20
|
+
*/
|
|
21
|
+
export const LESSON_CATEGORIES = [
|
|
22
|
+
'task-management',
|
|
23
|
+
'jira',
|
|
24
|
+
'mcp-tools',
|
|
25
|
+
'codebase-tool',
|
|
26
|
+
'terminal',
|
|
27
|
+
'framework',
|
|
28
|
+
'cms',
|
|
29
|
+
'database',
|
|
30
|
+
'git',
|
|
31
|
+
'deployment',
|
|
32
|
+
'browser-testing',
|
|
33
|
+
'general',
|
|
34
|
+
];
|
|
35
|
+
export const LESSON_SEVERITIES = ['high', 'medium', 'low'];
|
|
36
|
+
/** Relative to `.opencastle/`. */
|
|
37
|
+
export const LESSONS_DIR = 'lessons';
|
|
38
|
+
export const LESSONS_INDEX = 'LESSONS-LEARNED.md';
|
|
39
|
+
/** The first line of a compiled index; a file without it is the old single-file log. */
|
|
40
|
+
export const INDEX_MARKER = '<!-- Generated by OpenCastle from the files in lessons/. Add a lesson with "opencastle lesson"; this index is rewritten by every sync. -->';
|
|
41
|
+
export function isLessonCategory(s) {
|
|
42
|
+
return LESSON_CATEGORIES.includes(s);
|
|
43
|
+
}
|
|
44
|
+
export function isLessonSeverity(s) {
|
|
45
|
+
return LESSON_SEVERITIES.includes(s);
|
|
46
|
+
}
|
|
47
|
+
export function today() {
|
|
48
|
+
return new Date().toISOString().slice(0, 10);
|
|
49
|
+
}
|
|
50
|
+
/** `quote shell variables` → `quote-shell-variables`, cut at a word under 50 characters. */
|
|
51
|
+
export function slugOf(title) {
|
|
52
|
+
const words = title
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.normalize('NFKD')
|
|
55
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
56
|
+
.replace(/[^a-z0-9]+/g, ' ')
|
|
57
|
+
.trim()
|
|
58
|
+
.split(/\s+/)
|
|
59
|
+
.filter(Boolean);
|
|
60
|
+
let slug = '';
|
|
61
|
+
for (const w of words) {
|
|
62
|
+
const next = slug ? `${slug}-${w}` : w;
|
|
63
|
+
if (next.length > 50)
|
|
64
|
+
break;
|
|
65
|
+
slug = next;
|
|
66
|
+
}
|
|
67
|
+
return slug || 'lesson';
|
|
68
|
+
}
|
|
69
|
+
/** A new lesson's id: its date and title, made unique among `taken`. */
|
|
70
|
+
export function newLessonId(title, date, taken) {
|
|
71
|
+
const base = `${date}-${slugOf(title)}`;
|
|
72
|
+
let id = base;
|
|
73
|
+
for (let n = 2; taken.has(id); n++)
|
|
74
|
+
id = `${base}-${n}`;
|
|
75
|
+
return id;
|
|
76
|
+
}
|
|
77
|
+
// ── One lesson file ──────────────────────────────────────────
|
|
78
|
+
export function renderLesson(lesson) {
|
|
79
|
+
const meta = {
|
|
80
|
+
id: lesson.id,
|
|
81
|
+
title: lesson.title,
|
|
82
|
+
category: lesson.category,
|
|
83
|
+
severity: lesson.severity,
|
|
84
|
+
added: lesson.added,
|
|
85
|
+
};
|
|
86
|
+
if (lesson.citations.length > 0)
|
|
87
|
+
meta.citations = lesson.citations;
|
|
88
|
+
if (lesson.verified)
|
|
89
|
+
meta.verified = lesson.verified;
|
|
90
|
+
if (lesson.fingerprints && Object.keys(lesson.fingerprints).length > 0)
|
|
91
|
+
meta.fingerprints = lesson.fingerprints;
|
|
92
|
+
if (lesson.status === 'archived')
|
|
93
|
+
meta.status = 'archived';
|
|
94
|
+
if (lesson.mergedInto)
|
|
95
|
+
meta.mergedInto = lesson.mergedInto;
|
|
96
|
+
if (lesson.source)
|
|
97
|
+
meta.source = lesson.source;
|
|
98
|
+
// Strings stay strings: an unquoted date would come back from YAML as a Date.
|
|
99
|
+
const yaml = stringifyYaml(meta, { defaultStringType: 'QUOTE_DOUBLE', defaultKeyType: 'PLAIN', lineWidth: 0 });
|
|
100
|
+
return `---\n${yaml}---\n\n${lesson.body.trim()}\n`;
|
|
101
|
+
}
|
|
102
|
+
/** The body for a lesson written from its parts. */
|
|
103
|
+
export function lessonBody(parts) {
|
|
104
|
+
const out = [`**Problem:** ${parts.problem.trim()}`];
|
|
105
|
+
if (parts.wrong)
|
|
106
|
+
out.push(`**Wrong approach:** ${parts.wrong.trim()}`);
|
|
107
|
+
if (parts.correct)
|
|
108
|
+
out.push(`**Correct approach:** ${parts.correct.trim()}`);
|
|
109
|
+
if (parts.why)
|
|
110
|
+
out.push(`**Why:** ${parts.why.trim()}`);
|
|
111
|
+
return out.join('\n\n');
|
|
112
|
+
}
|
|
113
|
+
const FRONTMATTER = /^\uFEFF?---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
114
|
+
/** Parse one lesson file. Returns an error string for one that cannot be read as a lesson. */
|
|
115
|
+
export function parseLesson(text, file) {
|
|
116
|
+
const m = FRONTMATTER.exec(text);
|
|
117
|
+
if (!m)
|
|
118
|
+
return 'has no frontmatter';
|
|
119
|
+
let meta;
|
|
120
|
+
try {
|
|
121
|
+
meta = (parseYaml(m[1]) ?? {});
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
return `has frontmatter that is not valid YAML — ${err.message}`;
|
|
125
|
+
}
|
|
126
|
+
const str = (k) => {
|
|
127
|
+
const v = meta[k];
|
|
128
|
+
if (v instanceof Date)
|
|
129
|
+
return v.toISOString().slice(0, 10);
|
|
130
|
+
return typeof v === 'string' || typeof v === 'number' ? String(v) : undefined;
|
|
131
|
+
};
|
|
132
|
+
const id = str('id') ?? file.replace(/\.md$/, '');
|
|
133
|
+
const title = str('title');
|
|
134
|
+
if (!title)
|
|
135
|
+
return 'has no title';
|
|
136
|
+
const citations = Array.isArray(meta.citations) ? meta.citations.filter((c) => typeof c === 'string') : [];
|
|
137
|
+
const prints = meta.fingerprints && typeof meta.fingerprints === 'object' && !Array.isArray(meta.fingerprints)
|
|
138
|
+
? Object.fromEntries(Object.entries(meta.fingerprints).filter((e) => typeof e[1] === 'string'))
|
|
139
|
+
: undefined;
|
|
140
|
+
return {
|
|
141
|
+
id,
|
|
142
|
+
title,
|
|
143
|
+
category: str('category') ?? 'general',
|
|
144
|
+
severity: str('severity') ?? 'medium',
|
|
145
|
+
added: str('added') ?? '',
|
|
146
|
+
citations,
|
|
147
|
+
verified: str('verified'),
|
|
148
|
+
...(prints && Object.keys(prints).length > 0 && { fingerprints: prints }),
|
|
149
|
+
status: str('status') === 'archived' ? 'archived' : 'active',
|
|
150
|
+
mergedInto: str('mergedInto'),
|
|
151
|
+
source: str('source'),
|
|
152
|
+
body: m[2].trim(),
|
|
153
|
+
file,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/** Every lesson in `<customizations>/lessons/`, and the files that could not be read as one. */
|
|
157
|
+
export function readLessons(customizationsDir) {
|
|
158
|
+
const dir = join(customizationsDir, LESSONS_DIR);
|
|
159
|
+
const lessons = [];
|
|
160
|
+
const problems = [];
|
|
161
|
+
let names;
|
|
162
|
+
try {
|
|
163
|
+
names = readdirSync(dir);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return { lessons, problems };
|
|
167
|
+
}
|
|
168
|
+
for (const name of names.sort()) {
|
|
169
|
+
if (!name.endsWith('.md') || name.startsWith('.'))
|
|
170
|
+
continue;
|
|
171
|
+
let text;
|
|
172
|
+
try {
|
|
173
|
+
text = readFileSync(join(dir, name), 'utf8');
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
problems.push(`${LESSONS_DIR}/${name} cannot be read — ${err.message}`);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
const parsed = parseLesson(text, name);
|
|
180
|
+
if (typeof parsed === 'string')
|
|
181
|
+
problems.push(`${LESSONS_DIR}/${name} ${parsed}`);
|
|
182
|
+
else
|
|
183
|
+
lessons.push(parsed);
|
|
184
|
+
}
|
|
185
|
+
return { lessons, problems };
|
|
186
|
+
}
|
|
187
|
+
export function findLesson(lessons, idOrFile) {
|
|
188
|
+
const want = idOrFile.replace(/^.*[\\/]/, '').replace(/\.md$/, '');
|
|
189
|
+
return lessons.find((l) => l.id === want || l.file.replace(/\.md$/, '') === want);
|
|
190
|
+
}
|
|
191
|
+
// ── The index agents read ────────────────────────────────────
|
|
192
|
+
const byDate = (a, b) => a.added < b.added ? -1 : a.added > b.added ? 1 : a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
193
|
+
/** One line of Markdown, whatever a title holds. */
|
|
194
|
+
function inline(text) {
|
|
195
|
+
return text.replace(/[\r\n]+/g, ' ').trim();
|
|
196
|
+
}
|
|
197
|
+
export function renderIndex(lessons) {
|
|
198
|
+
const active = lessons.filter((l) => l.status === 'active');
|
|
199
|
+
const archived = lessons.filter((l) => l.status === 'archived');
|
|
200
|
+
const out = [
|
|
201
|
+
INDEX_MARKER,
|
|
202
|
+
'',
|
|
203
|
+
'# Lessons Learned',
|
|
204
|
+
'',
|
|
205
|
+
'What agents on this project learned the hard way: a command that failed, a',
|
|
206
|
+
'tool quirk, a convention written down nowhere else. **Read this before you',
|
|
207
|
+
'start work**, then open the lessons that match your task.',
|
|
208
|
+
'',
|
|
209
|
+
'Each lesson is a file in [`lessons/`](lessons/). Add one with',
|
|
210
|
+
'`opencastle lesson --title ... --category ... --severity ... --problem ...`',
|
|
211
|
+
'(and `--cite <path>` for the code it is about). Do not edit this index:',
|
|
212
|
+
'it is rewritten from those files by every `opencastle sync`.',
|
|
213
|
+
];
|
|
214
|
+
if (active.length === 0)
|
|
215
|
+
out.push('', 'No lessons yet.');
|
|
216
|
+
const categories = [...new Set(active.map((l) => l.category))].sort();
|
|
217
|
+
for (const category of categories) {
|
|
218
|
+
out.push('', `## ${category}`, '');
|
|
219
|
+
for (const l of active.filter((x) => x.category === category).sort(byDate)) {
|
|
220
|
+
const cites = l.citations.length > 0 ? ` · cites ${l.citations.map((c) => `\`${c}\``).join(', ')}` : '';
|
|
221
|
+
out.push(`- **${inline(l.title)}** — \`${l.severity}\` · ${l.added || 'undated'}${cites} · [${LESSONS_DIR}/${l.file}](${LESSONS_DIR}/${l.file})`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (archived.length > 0) {
|
|
225
|
+
out.push('', '## Archived', '', 'Merged into a skill or instruction file, where agents now meet them. Kept for the record.', '');
|
|
226
|
+
for (const l of archived.sort(byDate)) {
|
|
227
|
+
const into = l.mergedInto ? ` → \`${l.mergedInto}\`` : '';
|
|
228
|
+
out.push(`- **${inline(l.title)}**${into} · [${LESSONS_DIR}/${l.file}](${LESSONS_DIR}/${l.file})`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return out.join('\n') + '\n';
|
|
232
|
+
}
|
|
233
|
+
export function isCompiledIndex(text) {
|
|
234
|
+
return text.replace(/^\uFEFF/, '').trimStart().startsWith(INDEX_MARKER);
|
|
235
|
+
}
|
|
236
|
+
// ── The old single-file log ──────────────────────────────────
|
|
237
|
+
/**
|
|
238
|
+
* The shipped template, whitespace-normalised and hashed, in every version a
|
|
239
|
+
* release copied into projects. A file that is still exactly one of these has
|
|
240
|
+
* nothing of the team's in it, so moving to the new index needs no backup.
|
|
241
|
+
*/
|
|
242
|
+
const LEGACY_TEMPLATES = new Set([
|
|
243
|
+
'575e04ca16faf38f222e8d367c18f829de34f15131aa97a48ed30eeb32bf6fb2',
|
|
244
|
+
'81360338e425d73813368b4d15c950da7b48f858df3c364e461223f766599b11',
|
|
245
|
+
]);
|
|
246
|
+
function templateHash(text) {
|
|
247
|
+
return createHash('sha256').update(text.replace(/\s+/g, ' ').trim()).digest('hex');
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The lessons in an old `LESSONS-LEARNED.md`, wherever in the file they are.
|
|
251
|
+
*
|
|
252
|
+
* Agents appended them wherever they saw fit — after the index as often as
|
|
253
|
+
* before it — and with categories and severities the CLI never offered, so
|
|
254
|
+
* this reads each `### LES-NNN:` block on its own and keeps what it says.
|
|
255
|
+
*/
|
|
256
|
+
export function parseLegacyLessons(text) {
|
|
257
|
+
const lines = text.replace(/\r\n/g, '\n').split('\n');
|
|
258
|
+
const out = [];
|
|
259
|
+
for (let i = 0; i < lines.length; i++) {
|
|
260
|
+
const head = /^###\s+(LES-\d+)\s*:\s*(.+?)\s*$/.exec(lines[i]);
|
|
261
|
+
if (!head)
|
|
262
|
+
continue;
|
|
263
|
+
const block = [];
|
|
264
|
+
let j = i + 1;
|
|
265
|
+
for (; j < lines.length; j++) {
|
|
266
|
+
if (/^#{1,3}\s/.test(lines[j]))
|
|
267
|
+
break;
|
|
268
|
+
block.push(lines[j]);
|
|
269
|
+
}
|
|
270
|
+
i = j - 1;
|
|
271
|
+
const field = (name) => {
|
|
272
|
+
for (const line of block) {
|
|
273
|
+
const m = new RegExp(`^\\|\\s*\\*\\*${name}\\*\\*\\s*\\|\\s*(.*?)\\s*\\|\\s*$`).exec(line);
|
|
274
|
+
if (m)
|
|
275
|
+
return m[1];
|
|
276
|
+
}
|
|
277
|
+
return undefined;
|
|
278
|
+
};
|
|
279
|
+
const firstWord = (v) => {
|
|
280
|
+
if (!v)
|
|
281
|
+
return undefined;
|
|
282
|
+
const ticked = /`([^`]+)`/.exec(v);
|
|
283
|
+
return (ticked ? ticked[1] : v.split(/\s+/)[0]).trim() || undefined;
|
|
284
|
+
};
|
|
285
|
+
const body = block
|
|
286
|
+
.filter((l) => !/^\s*\|.*\|\s*$/.test(l))
|
|
287
|
+
.filter((l) => !/^\s*`{3,}\s*(markdown)?\s*$/.test(l))
|
|
288
|
+
.join('\n')
|
|
289
|
+
.replace(/(\n\s*---\s*)+\s*$/, '')
|
|
290
|
+
.trim();
|
|
291
|
+
out.push({
|
|
292
|
+
id: head[1],
|
|
293
|
+
title: head[2],
|
|
294
|
+
category: firstWord(field('Category')) ?? 'general',
|
|
295
|
+
severity: firstWord(field('Severity')) ?? 'medium',
|
|
296
|
+
added: firstWord(field('Added')) ?? '',
|
|
297
|
+
citations: [],
|
|
298
|
+
status: 'active',
|
|
299
|
+
body,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
return out;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Bring `.opencastle/` to the current shape: lessons in the old single file
|
|
306
|
+
* moved into `lessons/`, and the index rewritten from the files. Run by `sync`
|
|
307
|
+
* and by every `opencastle lesson` that writes.
|
|
308
|
+
*
|
|
309
|
+
* A project with neither an index nor a `lessons/` directory is left as it is:
|
|
310
|
+
* someone removed the file, and putting it back is not ours to decide.
|
|
311
|
+
*/
|
|
312
|
+
export function syncLessons(customizationsDir) {
|
|
313
|
+
const indexPath = join(customizationsDir, LESSONS_INDEX);
|
|
314
|
+
const dir = join(customizationsDir, LESSONS_DIR);
|
|
315
|
+
const result = { migrated: 0, index: 'absent', problems: [] };
|
|
316
|
+
let current = null;
|
|
317
|
+
try {
|
|
318
|
+
current = readFileSync(indexPath, 'utf8');
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
current = null;
|
|
322
|
+
}
|
|
323
|
+
if (current !== null && !isCompiledIndex(current)) {
|
|
324
|
+
const legacy = parseLegacyLessons(current);
|
|
325
|
+
const { lessons: existing } = readLessons(customizationsDir);
|
|
326
|
+
const taken = new Set(existing.map((l) => l.id));
|
|
327
|
+
for (const lesson of legacy) {
|
|
328
|
+
// Run twice — an interrupted sync, or a teammate's sync merged in — and
|
|
329
|
+
// the lesson is already there under its number.
|
|
330
|
+
if (taken.has(lesson.id))
|
|
331
|
+
continue;
|
|
332
|
+
mkdirSync(dir, { recursive: true });
|
|
333
|
+
writeFileSync(join(dir, `${lesson.id}-${slugOf(lesson.title)}.md`), renderLesson(lesson));
|
|
334
|
+
taken.add(lesson.id);
|
|
335
|
+
result.migrated++;
|
|
336
|
+
}
|
|
337
|
+
if (legacy.length > 0 || !LEGACY_TEMPLATES.has(templateHash(current))) {
|
|
338
|
+
const backup = `${indexPath}.opencastle-backup`;
|
|
339
|
+
if (!existsSync(backup))
|
|
340
|
+
writeFileSync(backup, current);
|
|
341
|
+
result.backup = relative(dirname(customizationsDir), backup).split(sep).join('/');
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (current === null && !existsSync(dir))
|
|
345
|
+
return result;
|
|
346
|
+
const { lessons, problems } = readLessons(customizationsDir);
|
|
347
|
+
result.problems = problems;
|
|
348
|
+
const next = renderIndex(lessons);
|
|
349
|
+
if (current === next) {
|
|
350
|
+
result.index = 'unchanged';
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
writeFileSync(indexPath, next);
|
|
354
|
+
result.index = current === null ? 'created' : 'updated';
|
|
355
|
+
}
|
|
356
|
+
return result;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* What `sync --check` and `doctor` say about the index, or null when it is
|
|
360
|
+
* current. Never writes.
|
|
361
|
+
*/
|
|
362
|
+
export function lessonsIndexDrift(customizationsDir) {
|
|
363
|
+
const indexPath = join(customizationsDir, LESSONS_INDEX);
|
|
364
|
+
const dir = join(customizationsDir, LESSONS_DIR);
|
|
365
|
+
let current;
|
|
366
|
+
try {
|
|
367
|
+
current = readFileSync(indexPath, 'utf8');
|
|
368
|
+
}
|
|
369
|
+
catch {
|
|
370
|
+
current = null;
|
|
371
|
+
}
|
|
372
|
+
if (current !== null && !isCompiledIndex(current)) {
|
|
373
|
+
const n = parseLegacyLessons(current).length;
|
|
374
|
+
return n > 0
|
|
375
|
+
? `holds ${n} lesson(s) in the old single-file format; sync moves each into ${LESSONS_DIR}/`
|
|
376
|
+
: 'is the old single-file log; sync replaces it with an index of lessons/';
|
|
377
|
+
}
|
|
378
|
+
if (current === null)
|
|
379
|
+
return existsSync(dir) ? `is missing, while ${LESSONS_DIR}/ has lessons to list` : null;
|
|
380
|
+
const { lessons } = readLessons(customizationsDir);
|
|
381
|
+
return current === renderIndex(lessons) ? null : `does not list what is in ${LESSONS_DIR}/ — a lesson was added, changed or merged in`;
|
|
382
|
+
}
|
|
383
|
+
// ── Citations ────────────────────────────────────────────────
|
|
384
|
+
/** The path part of a citation: `src/a.ts:12` and `src/a.ts#L12` both cite `src/a.ts`. */
|
|
385
|
+
export function citedPath(citation) {
|
|
386
|
+
return citation.replace(/#L\d+(-L?\d+)?$/, '').replace(/:\d+(-\d+)?$/, '').replace(/^\.\//, '');
|
|
387
|
+
}
|
|
388
|
+
/** Why a citation cannot be recorded, or null when it can. */
|
|
389
|
+
export function citationProblem(projectRoot, citation) {
|
|
390
|
+
const path = citedPath(citation);
|
|
391
|
+
if (!path || isAbsolute(path) || /^[A-Za-z]:[\\/]/.test(path))
|
|
392
|
+
return `cite a path relative to the project root, not ${citation}`;
|
|
393
|
+
const abs = resolve(projectRoot, path);
|
|
394
|
+
if (relative(projectRoot, abs).startsWith('..'))
|
|
395
|
+
return `${citation} is outside the project`;
|
|
396
|
+
if (!existsSync(abs))
|
|
397
|
+
return `${citation} does not exist`;
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* A short digest of a file's content, line endings normalised so a checkout
|
|
402
|
+
* with `core.autocrlf` does not read as a change. Null for what is not a file.
|
|
403
|
+
*/
|
|
404
|
+
export function fingerprintOf(projectRoot, path) {
|
|
405
|
+
try {
|
|
406
|
+
const text = readFileSync(resolve(projectRoot, path), 'utf8').replace(/\r\n/g, '\n');
|
|
407
|
+
return createHash('sha256').update(text).digest('hex').slice(0, 12);
|
|
408
|
+
}
|
|
409
|
+
catch {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/** The fingerprint of every file a lesson cites, by path. */
|
|
414
|
+
export function fingerprintsOf(projectRoot, citations) {
|
|
415
|
+
const out = {};
|
|
416
|
+
for (const c of citations) {
|
|
417
|
+
const path = citedPath(c);
|
|
418
|
+
const print = fingerprintOf(projectRoot, path);
|
|
419
|
+
if (print)
|
|
420
|
+
out[path] = print;
|
|
421
|
+
}
|
|
422
|
+
return out;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Citations whose file is gone, or whose content differs from its fingerprint
|
|
426
|
+
* when the lesson was last verified. A citation recorded with no fingerprint —
|
|
427
|
+
* a directory, or a lesson written by hand — is checked for existence only.
|
|
428
|
+
*/
|
|
429
|
+
export function staleCitations(projectRoot, lessons) {
|
|
430
|
+
const out = [];
|
|
431
|
+
for (const lesson of lessons) {
|
|
432
|
+
if (lesson.status !== 'active')
|
|
433
|
+
continue;
|
|
434
|
+
for (const citation of lesson.citations) {
|
|
435
|
+
const path = citedPath(citation);
|
|
436
|
+
const abs = resolve(projectRoot, path);
|
|
437
|
+
if (!existsSync(abs)) {
|
|
438
|
+
out.push({ lesson, citation, why: 'missing' });
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
if (!statSync(abs).isFile())
|
|
442
|
+
continue;
|
|
443
|
+
const want = lesson.fingerprints?.[path];
|
|
444
|
+
if (want && fingerprintOf(projectRoot, path) !== want)
|
|
445
|
+
out.push({ lesson, citation, why: 'changed' });
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return out;
|
|
449
|
+
}
|
|
450
|
+
/** The check `doctor` runs on a project's lessons. */
|
|
451
|
+
export function checkLessons(projectRoot) {
|
|
452
|
+
const label = 'Lessons';
|
|
453
|
+
const dir = join(projectRoot, '.opencastle');
|
|
454
|
+
const drift = lessonsIndexDrift(dir);
|
|
455
|
+
if (drift) {
|
|
456
|
+
return { ok: true, warning: true, label, detail: `.opencastle/${LESSONS_INDEX} ${drift}`, fix: 'opencastle sync' };
|
|
457
|
+
}
|
|
458
|
+
const { lessons, problems } = readLessons(dir);
|
|
459
|
+
if (problems.length > 0) {
|
|
460
|
+
return {
|
|
461
|
+
ok: true,
|
|
462
|
+
warning: true,
|
|
463
|
+
label,
|
|
464
|
+
detail: problems.map((p) => `.opencastle/${p}`).join('; '),
|
|
465
|
+
fix: 'fix the frontmatter of each, or delete it',
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
const active = lessons.filter((l) => l.status === 'active');
|
|
469
|
+
if (active.length === 0)
|
|
470
|
+
return { ok: true, label, detail: 'none recorded yet' };
|
|
471
|
+
const stale = staleCitations(projectRoot, active);
|
|
472
|
+
if (stale.length > 0) {
|
|
473
|
+
const said = stale.map((s) => s.why === 'missing'
|
|
474
|
+
? `${s.lesson.id} cites ${s.citation}, which no longer exists`
|
|
475
|
+
: `${s.lesson.id} cites ${s.citation}, which has changed since it was verified${s.lesson.verified ? ` on ${s.lesson.verified}` : ''}`);
|
|
476
|
+
const ids = [...new Set(stale.map((s) => s.lesson.id))];
|
|
477
|
+
return {
|
|
478
|
+
ok: true,
|
|
479
|
+
warning: true,
|
|
480
|
+
label,
|
|
481
|
+
detail: said.join('; '),
|
|
482
|
+
fix: `check that each still holds, then opencastle lesson verify ${ids[0]}${ids.length > 1 ? ' (and the others)' : ''} — ` +
|
|
483
|
+
'with --cite <path> for a file that moved — or retire it with opencastle lesson archive <id> --into <file>',
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
const cited = active.filter((l) => l.citations.length > 0).length;
|
|
487
|
+
return {
|
|
488
|
+
ok: true,
|
|
489
|
+
label,
|
|
490
|
+
detail: `${active.length} lesson(s)${cited > 0 ? `; the ${cited} that cite code match it` : ''}`,
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
//# sourceMappingURL=lessons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lessons.js","sourceRoot":"","sources":["../../src/cli/lessons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACnG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC7E,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAA;AAErE;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,iBAAiB;IACjB,MAAM;IACN,WAAW;IACX,eAAe;IACf,UAAU;IACV,WAAW;IACX,KAAK;IACL,UAAU;IACV,KAAK;IACL,YAAY;IACZ,iBAAiB;IACjB,SAAS;CACD,CAAA;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