@erclx/canon 5.52.0 → 5.54.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/CHANGELOG.md +17 -0
- package/README.md +11 -13
- package/claude/.claude-plugin/plugin.json +1 -1
- package/claude/skills/canon-cli/SKILL.md +5 -8
- package/claude/skills/context-fold/REQUIREMENT.md +0 -1
- package/claude/skills/design-identity/REQUIREMENT.md +2 -2
- package/claude/skills/design-identity/SKILL.md +6 -6
- package/claude/skills/design-record/REQUIREMENT.md +2 -2
- package/claude/skills/design-record/SKILL.md +4 -4
- package/claude/skills/design-record/references/folder.md +1 -1
- package/claude/skills/design-taste/REQUIREMENT.md +1 -1
- package/claude/skills/design-taste/references/kinds.md +0 -1
- package/claude/skills/draw-figure/REQUIREMENT.md +3 -4
- package/claude/skills/draw-figure/SKILL.md +5 -6
- package/claude/skills/draw-figure/references/figures.md +0 -1
- package/claude/skills/draw-figure/references/hand-drawn.md +1 -1
- package/claude/skills/pick-by-eye/REQUIREMENT.md +4 -5
- package/claude/skills/pick-by-eye/SKILL.md +34 -41
- package/claude/skills/pick-by-eye/references/board.md +42 -0
- package/claude/skills/pick-by-eye/references/live-arms.md +3 -3
- package/claude/skills/plan-groundwork/SKILL.md +1 -1
- package/claude/skills/teach-craft/REQUIREMENT.md +30 -0
- package/claude/skills/teach-craft/SKILL.md +70 -0
- package/claude/skills/teach-craft/references/adopted.md +113 -0
- package/claude/skills/teach-craft/references/lesson-craft.md +60 -0
- package/claude/skills/{teach-workspace → teach-craft}/references/pedagogy.md +41 -6
- package/docs/agents/audits.md +0 -1
- package/docs/agents/install-and-sync.md +0 -8
- package/docs/target/migrations.md +16 -2
- package/docs/target/projects.md +1 -1
- package/docs/workflow/parallel-features.md +1 -1
- package/docs/workflow/skill-map-on-request.md +10 -22
- package/docs/workflow/skill-map.md +11 -14
- package/docs/workflow/visual-design-workflow.md +1 -4
- package/governance/detect.toml +1 -6
- package/governance/renames.toml +0 -1
- package/package.json +2 -8
- package/scripts/core/regen-web-previews.ts +2 -67
- package/src/audits/catalog.ts +0 -1
- package/src/browser/engine.ts +3 -6
- package/src/capture/render.ts +1 -1
- package/src/claude/cases/authoring.ts +0 -12
- package/src/claude/cases/misc.ts +0 -22
- package/src/claude/cases/workflow.ts +2 -38
- package/src/claude/skills-audit.ts +1 -1
- package/src/cli/help.ts +0 -10
- package/src/cli.ts +0 -8
- package/src/commands/design.ts +16 -315
- package/src/commands/records.ts +0 -1
- package/src/commands/serve.ts +2 -2
- package/src/commands/sync.ts +4 -5
- package/src/design/components.ts +8 -1514
- package/src/design/css.ts +5 -6
- package/src/design/fonts.ts +3 -5
- package/src/design/regen.ts +5 -32
- package/src/design/render.ts +1 -1
- package/src/design/tokens.ts +3 -2
- package/src/driver/drive.ts +3 -4
- package/src/driver/steps.ts +2 -5
- package/src/gate/stages.ts +4 -10
- package/src/gov/audit.ts +1 -6
- package/src/inventory/walk.ts +1 -1
- package/src/markdown/scope.ts +6 -35
- package/src/records/validate.ts +4 -176
- package/src/sandbox/equivalence.ts +0 -5
- package/src/shipped/references.ts +1 -2
- package/src/sync/check.ts +4 -29
- package/src/sync/stamp.ts +6 -6
- package/src/sync/target.ts +1 -4
- package/tooling/claude/reference.md +1 -1
- package/tooling/claude/seeds/canon/DESIGN.md +1 -1
- package/claude/skills/canvas-board/REQUIREMENT.md +0 -35
- package/claude/skills/canvas-board/SKILL.md +0 -143
- package/claude/skills/canvas-board/references/canvas.md +0 -170
- package/claude/skills/draft-and-pick/REQUIREMENT.md +0 -26
- package/claude/skills/draft-and-pick/SKILL.md +0 -11
- package/claude/skills/draft-doc/REQUIREMENT.md +0 -26
- package/claude/skills/draft-doc/SKILL.md +0 -11
- package/claude/skills/draft-figure/REQUIREMENT.md +0 -26
- package/claude/skills/draft-figure/SKILL.md +0 -11
- package/claude/skills/draft-identity/REQUIREMENT.md +0 -26
- package/claude/skills/draft-identity/SKILL.md +0 -11
- package/claude/skills/draft-ready/REQUIREMENT.md +0 -26
- package/claude/skills/draft-ready/SKILL.md +0 -11
- package/claude/skills/draft-screencast/REQUIREMENT.md +0 -26
- package/claude/skills/draft-screencast/SKILL.md +0 -11
- package/claude/skills/draft-slides/REQUIREMENT.md +0 -26
- package/claude/skills/draft-slides/SKILL.md +0 -11
- package/claude/skills/make-deck/REQUIREMENT.md +0 -36
- package/claude/skills/make-deck/SKILL.md +0 -80
- package/claude/skills/make-deck/references/deck.md +0 -183
- package/claude/skills/read-frames/REQUIREMENT.md +0 -30
- package/claude/skills/read-frames/SKILL.md +0 -55
- package/claude/skills/record-screencast/REQUIREMENT.md +0 -35
- package/claude/skills/record-screencast/SKILL.md +0 -99
- package/claude/skills/script-screencast/REQUIREMENT.md +0 -34
- package/claude/skills/script-screencast/SKILL.md +0 -70
- package/claude/skills/script-screencast/references/beats-template.md +0 -119
- package/claude/skills/teach-workspace/REQUIREMENT.md +0 -34
- package/claude/skills/teach-workspace/SKILL.md +0 -196
- package/claude/skills/teach-workspace/references/glossary.md +0 -90
- package/claude/skills/teach-workspace/references/lesson-build.md +0 -106
- package/claude/skills/teach-workspace/references/lesson-craft.md +0 -135
- package/claude/skills/teach-workspace/references/promotion-fold.md +0 -35
- package/claude/skills/teach-workspace/references/promotion.md +0 -116
- package/claude/skills/teach-workspace/references/revisit.md +0 -28
- package/claude/skills/teach-workspace/references/teach.md +0 -211
- package/claude/skills/video-craft/REQUIREMENT.md +0 -35
- package/claude/skills/video-craft/SKILL.md +0 -96
- package/claude/skills/video-craft/references/adopted.md +0 -110
- package/governance/rules/ui/canvas.md +0 -13
- package/src/canvas/address.ts +0 -227
- package/src/canvas/arrange.ts +0 -66
- package/src/canvas/capture.ts +0 -391
- package/src/canvas/client/app.tsx +0 -188
- package/src/canvas/client/inspector/align-grid.tsx +0 -162
- package/src/canvas/client/inspector/color-field.tsx +0 -398
- package/src/canvas/client/inspector/color-inputs.tsx +0 -139
- package/src/canvas/client/inspector/color-picker.tsx +0 -668
- package/src/canvas/client/inspector/color-space.ts +0 -240
- package/src/canvas/client/inspector/field.tsx +0 -263
- package/src/canvas/client/inspector/fields.css +0 -763
- package/src/canvas/client/inspector/section.tsx +0 -27
- package/src/canvas/client/inspector/size-field.tsx +0 -69
- package/src/canvas/client/inspector/token-select.tsx +0 -109
- package/src/canvas/client/inspector/values.ts +0 -297
- package/src/canvas/client/inspector.tsx +0 -692
- package/src/canvas/client/keys.ts +0 -71
- package/src/canvas/client/layers.tsx +0 -118
- package/src/canvas/client/main.tsx +0 -71
- package/src/canvas/client/pages-panel.tsx +0 -212
- package/src/canvas/client/panel-handle.tsx +0 -90
- package/src/canvas/client/selection.tsx +0 -199
- package/src/canvas/client/shell.css +0 -762
- package/src/canvas/client/state.ts +0 -792
- package/src/canvas/client/surface.tsx +0 -803
- package/src/canvas/client/theme-panel.tsx +0 -55
- package/src/canvas/client/tools.tsx +0 -153
- package/src/canvas/content.ts +0 -781
- package/src/canvas/edit.ts +0 -575
- package/src/canvas/editing.ts +0 -203
- package/src/canvas/fit.ts +0 -238
- package/src/canvas/global.d.ts +0 -15
- package/src/canvas/history.ts +0 -116
- package/src/canvas/index.html +0 -20
- package/src/canvas/server.ts +0 -766
- package/src/canvas/tokens.ts +0 -221
- package/src/commands/canvas.ts +0 -1097
- package/src/commands/demo.ts +0 -542
- package/src/commands/slides.ts +0 -184
- package/src/commands/teach.ts +0 -1401
- package/src/demo/beats.ts +0 -135
- package/src/demo/compile.ts +0 -350
- package/src/demo/container.ts +0 -219
- package/src/demo/cursors.ts +0 -55
- package/src/demo/drive.ts +0 -442
- package/src/demo/pointer.ts +0 -178
- package/src/demo/theme.ts +0 -112
- package/src/demo/timeline.ts +0 -64
- package/src/design/adapter.ts +0 -59
- package/src/design/base.css +0 -203
- package/src/design/brand-favicon.ts +0 -18
- package/src/design/neutral.ts +0 -127
- package/src/design/project-fonts.ts +0 -392
- package/src/slides/convert/chart.ts +0 -165
- package/src/slides/convert/deck.ts +0 -244
- package/src/slides/convert/export.ts +0 -567
- package/src/slides/convert/master.ts +0 -198
- package/src/slides/convert/shapes.ts +0 -804
- package/src/slides/convert/svg.ts +0 -38
- package/src/slides/convert/walk.ts +0 -671
- package/src/slides/decks.ts +0 -110
- package/src/slides/open.ts +0 -18
- package/src/slides/package/fonts.ts +0 -301
- package/src/slides/package/motion.ts +0 -316
- package/src/slides/package/test-face.ts +0 -113
- package/src/teach/browser/compile.ts +0 -44
- package/src/teach/browser/dismiss.ts +0 -76
- package/src/teach/browser/focus-line.ts +0 -19
- package/src/teach/browser/glossary-filter.ts +0 -44
- package/src/teach/browser/head.ts +0 -30
- package/src/teach/browser/quiz.ts +0 -19
- package/src/teach/browser/reload.ts +0 -9
- package/src/teach/browser/sidebar.ts +0 -233
- package/src/teach/browser/theme.ts +0 -18
- package/src/teach/components/code.tsx +0 -24
- package/src/teach/components/heading.tsx +0 -11
- package/src/teach/components/list.tsx +0 -17
- package/src/teach/components/paragraph.tsx +0 -29
- package/src/teach/components/refs.tsx +0 -28
- package/src/teach/cross-references.ts +0 -78
- package/src/teach/fonts.ts +0 -16
- package/src/teach/highlight.ts +0 -71
- package/src/teach/html/jsx-dev-runtime.ts +0 -13
- package/src/teach/html/jsx-runtime.ts +0 -113
- package/src/teach/html/raw.ts +0 -28
- package/src/teach/lesson.ts +0 -178
- package/src/teach/nav.ts +0 -1337
- package/src/teach/render.ts +0 -240
- package/src/teach/workspace.ts +0 -1164
- package/src/teach/write-if-changed.ts +0 -17
package/src/teach/lesson.ts
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs'
|
|
2
|
-
import { join } from 'node:path'
|
|
3
|
-
import {
|
|
4
|
-
readWorkspace,
|
|
5
|
-
refuse,
|
|
6
|
-
TEACH_ASSETS,
|
|
7
|
-
TEACH_LESSONS,
|
|
8
|
-
TEACH_STYLESHEET,
|
|
9
|
-
type TeachRefused,
|
|
10
|
-
} from '@/teach/workspace'
|
|
11
|
-
|
|
12
|
-
/** Four digits inside a workspace, per the standard, because one holds many. */
|
|
13
|
-
const LESSON_WIDTH = 4
|
|
14
|
-
|
|
15
|
-
/** The ordinal a lesson filename opens with, which fixes its read order. */
|
|
16
|
-
export const LESSON_NUMBER = /^(\d{4})-/
|
|
17
|
-
|
|
18
|
-
const LESSON_SLUG = /^[a-z0-9]+(-[a-z0-9]+)*$/
|
|
19
|
-
|
|
20
|
-
/** A quiz needs a right answer and at least one thing to confuse it with. */
|
|
21
|
-
const MIN_OPTIONS = 2
|
|
22
|
-
|
|
23
|
-
export interface QuizOrder {
|
|
24
|
-
/** One-based, so a report reads the same way the lesson numbers them. */
|
|
25
|
-
readonly question: number
|
|
26
|
-
/**
|
|
27
|
-
* Authored indices in the order the lesson presents them, where the authored
|
|
28
|
-
* index `0` is the correct answer. The author writes the correct option first
|
|
29
|
-
* and reads its position back off this list.
|
|
30
|
-
*/
|
|
31
|
-
readonly order: readonly number[]
|
|
32
|
-
/** Where the correct answer lands, one-based, so no caller derives it. */
|
|
33
|
-
readonly answer: number
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface LessonPlanned {
|
|
37
|
-
readonly ok: true
|
|
38
|
-
readonly slug: string
|
|
39
|
-
/** Relative to the root, so a caller prints a path a reader can open. */
|
|
40
|
-
readonly path: string
|
|
41
|
-
readonly lesson: string
|
|
42
|
-
/** Read this and embed its content in the lesson's `<style>` block. */
|
|
43
|
-
readonly stylesheet: string
|
|
44
|
-
/** False on the first lesson in a workspace, which writes the stylesheet. */
|
|
45
|
-
readonly stylesheetExists: boolean
|
|
46
|
-
/** The mission's success lines, reported as the exit criteria they are. */
|
|
47
|
-
readonly success: readonly string[]
|
|
48
|
-
readonly quiz: readonly QuizOrder[]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export type LessonOutcome = LessonPlanned | TeachRefused
|
|
52
|
-
|
|
53
|
-
export interface LessonRequest {
|
|
54
|
-
readonly slug: string
|
|
55
|
-
readonly questions: number
|
|
56
|
-
readonly options: number
|
|
57
|
-
/**
|
|
58
|
-
* Injected so a test can assert the shape of an order against a generator it
|
|
59
|
-
* controls. Every caller outside a test takes the default, which is what
|
|
60
|
-
* keeps the position of a correct answer off the author's judgment.
|
|
61
|
-
*/
|
|
62
|
-
readonly random?: () => number
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* A uniform permutation of `0 .. count - 1` by Fisher-Yates.
|
|
67
|
-
*
|
|
68
|
-
* The bias this exists against is the authored order surviving into the
|
|
69
|
-
* lesson, which puts the correct answer first whenever the author wrote it
|
|
70
|
-
* first. Drawing the permutation here rather than in a prompt is what makes the
|
|
71
|
-
* position unguessable from the outside.
|
|
72
|
-
*/
|
|
73
|
-
function shuffled(count: number, random: () => number): number[] {
|
|
74
|
-
const order = Array.from({ length: count }, (_, index) => index)
|
|
75
|
-
|
|
76
|
-
for (let index = count - 1; index > 0; index -= 1) {
|
|
77
|
-
const pick = Math.floor(random() * (index + 1))
|
|
78
|
-
const held = order[index]
|
|
79
|
-
order[index] = order[pick]
|
|
80
|
-
order[pick] = held
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return order
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* One presentation order per question, each carrying where the correct answer
|
|
88
|
-
* landed. Both halves travel together because a caller deriving the position
|
|
89
|
-
* itself is a caller that can derive it wrongly.
|
|
90
|
-
*/
|
|
91
|
-
export function orderQuiz(
|
|
92
|
-
questions: number,
|
|
93
|
-
options: number,
|
|
94
|
-
random: () => number = Math.random,
|
|
95
|
-
): QuizOrder[] {
|
|
96
|
-
return Array.from({ length: questions }, (_, index) => {
|
|
97
|
-
const order = shuffled(options, random)
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
question: index + 1,
|
|
101
|
-
order,
|
|
102
|
-
answer: order.indexOf(0) + 1,
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The number the next lesson takes, read off the filenames already there.
|
|
109
|
-
*
|
|
110
|
-
* A file whose name carries no ordinal moves nothing, the way a workspace
|
|
111
|
-
* folder with no ordinal moves no workspace number. Numbering past it would
|
|
112
|
-
* renumber nothing and skipping it would hide it.
|
|
113
|
-
*/
|
|
114
|
-
function nextLesson(files: readonly string[]): string {
|
|
115
|
-
const highest = files
|
|
116
|
-
.map((file) => LESSON_NUMBER.exec(file)?.[1])
|
|
117
|
-
.filter((ordinal): ordinal is string => ordinal !== undefined)
|
|
118
|
-
.reduce((carry, ordinal) => Math.max(carry, Number(ordinal)), 0)
|
|
119
|
-
|
|
120
|
-
return String(highest + 1).padStart(LESSON_WIDTH, '0')
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Everything a lesson needs resolved before it is written: where it goes, which
|
|
125
|
-
* stylesheet it embeds and whether that file is already on disk, the mission's
|
|
126
|
-
* exit criteria, and the order each quiz presents its options in.
|
|
127
|
-
*
|
|
128
|
-
* The stylesheet is reported rather than written. Every lesson after the first
|
|
129
|
-
* reads the one the first wrote, so a verb that rewrote it on every lesson
|
|
130
|
-
* would discard whatever the last one added.
|
|
131
|
-
*/
|
|
132
|
-
export async function planLesson(
|
|
133
|
-
root: string,
|
|
134
|
-
selector: string,
|
|
135
|
-
request: LessonRequest,
|
|
136
|
-
): Promise<LessonOutcome> {
|
|
137
|
-
if (!LESSON_SLUG.test(request.slug)) {
|
|
138
|
-
return refuse('bad-input', `Not a kebab-case slug: ${request.slug}.`, [
|
|
139
|
-
request.slug,
|
|
140
|
-
])
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (!Number.isInteger(request.questions) || request.questions < 1) {
|
|
144
|
-
return refuse(
|
|
145
|
-
'bad-input',
|
|
146
|
-
'A lesson carries at least one question. Pass --questions <n>.',
|
|
147
|
-
)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (!Number.isInteger(request.options) || request.options < MIN_OPTIONS) {
|
|
151
|
-
return refuse(
|
|
152
|
-
'bad-input',
|
|
153
|
-
`A question carries at least ${MIN_OPTIONS} options. Pass --options <n>.`,
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const found = await readWorkspace(root, selector)
|
|
158
|
-
if (!found.ok) return found
|
|
159
|
-
|
|
160
|
-
const workspace = found.workspace
|
|
161
|
-
const lesson = join(
|
|
162
|
-
workspace.path,
|
|
163
|
-
TEACH_LESSONS,
|
|
164
|
-
`${nextLesson(workspace.lessonFiles)}-${request.slug}.html`,
|
|
165
|
-
)
|
|
166
|
-
const stylesheet = join(workspace.path, TEACH_ASSETS, TEACH_STYLESHEET)
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
ok: true,
|
|
170
|
-
slug: workspace.slug,
|
|
171
|
-
path: workspace.path,
|
|
172
|
-
lesson,
|
|
173
|
-
stylesheet,
|
|
174
|
-
stylesheetExists: existsSync(join(root, stylesheet)),
|
|
175
|
-
success: workspace.success,
|
|
176
|
-
quiz: orderQuiz(request.questions, request.options, request.random),
|
|
177
|
-
}
|
|
178
|
-
}
|