Skip to content

Commit 2938677

Browse files
committed
v2
1 parent 01847c7 commit 2938677

1,096 files changed

Lines changed: 141390 additions & 117530 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/rules/best-api.mdc

Lines changed: 238 additions & 80 deletions
Large diffs are not rendered by default.

.agents/rules/docs-creator.mdc

Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,15 @@ least one useful inbound link from the owning neighborhood.
327327
- No placeholder comments (`// your logic here`, `// Your validation logic`).
328328
- In Plite schema examples, never repeat derived structural membership:
329329
non-inline elements belong to `block`, while inline elements do not. In Plate
330-
examples, use `topLevel: false` for structural internals and
330+
examples, use `blockContent: false` for structural internals and
331331
`plugins.blockContent()` for normal-flow container content.
332+
- Use direct `root`/named-root content, omitted closed defaults,
333+
`schema.element.textBlock()` for ordinary editable blocks,
334+
validator-backed narrow `property.json()`, placement-owned
335+
`role: "metadata"`, Plate `schemaIdentity`, and runtime
336+
`create`/`assertDocument`/`assertFragment`/`isMarkableVoid`. Plate callers
337+
pass plugin descriptors directly to schema APIs; only raw Plite schemas use
338+
`schema.handle.*`.
332339
- `showLineNumbers` + `{n-m}` highlights on snippets longer than ~15 lines.
333340
- `title="filename.tsx"` when file context matters.
334341

@@ -549,10 +556,15 @@ Required shape:
549556
- show the package install command
550557
- import plugin APIs from the actual `platejs` or `@platejs/*` path
551558
- add the plugin to `createPlateEditor`
552-
- declare an ordinary node `component` in `createPlatePlugin({ component })`
553-
- bind or replace an existing Plate descriptor's component with one terminal
554-
`.configure({ component })`; convert base descriptors with
555-
`toPlatePlugin(BasePlugin).configure({ component })`
559+
- declare an ordinary node `component` in
560+
`createBasePlugin({ component })` or `createPlatePlugin({ component })`
561+
- replace an existing descriptor's component with one terminal
562+
`.configure({ component })`
563+
- keep Base `.extend()` free of `component`; independent defaults belong in
564+
the constructor
565+
- use `toPlatePlugin()` at the owning React adapter to publish a reusable
566+
Plate-layer descriptor or add genuine Plate-only authoring; a terminal
567+
consumer never inserts conversion merely to set `component`
556568
- never teach `.withComponent()`
557569
- never teach `render.node` as a public plugin-authoring surface
558570
- teach codecs as
@@ -564,20 +576,60 @@ Required shape:
564576
global codec helper, casts, or callback annotations
565577
- document the MIME-keyed map's `'text/html'` value as one rule or a
566578
non-empty ordered rule tuple; multiple representations stay in that map
567-
- keep Plate `extension` objects and callback returns plain; constructors
568-
and `.extend()` contextually type them
579+
- teach Plite-native fields directly on the Plate plugin root:
580+
`conflicts`, `readMiddleware`, commands, corrections, declarations,
581+
contributions, `on`, activation, and validation; never teach a nested
582+
`extension` wrapper
569583
- keep Plate-context capture inside the authoring callback and extract
570584
domain inputs; never teach a context identity helper, callback annotation,
571-
cast, or `any` to recover nested inference
585+
cast, or `any` to recover erased inference
572586
- use `defineEditorExtension` imported from `@platejs/plite` only for
573-
independently reusable standalone Plite descriptors
587+
independently reusable standalone Plite descriptors composed as
588+
dependencies
574589
- put constructor-accessible fields and their context callbacks directly in
575590
`createBasePlugin()` / `createPlatePlugin()`; use `.extend()` only for an
576-
imported/prebuilt descriptor, a shared factory the constructor cannot
591+
imported/prebuilt plugin descriptor, a shared factory the constructor cannot
577592
access, or a real earlier-stage type dependency
593+
- teach `name` as descriptor identity and `type` as serialized node identity
594+
- never teach `PluginConfig`, `__config`, `clone()`, `pluginApi`, `getApi`,
595+
or a second Plite `config` channel
596+
- teach `DefinitionOf<typeof FooPlugin>` as the sole descriptor-definition
597+
extractor and name an alias `FooDefinition`; never teach `InferConfig`,
598+
`FooConfig`, or an unsuffixed alias for an extracted definition
599+
- teach `api` as a factory at Plite, Base, and Plate layers, even when it
600+
needs no context: `api: () => ({ ... })`, never `api: { ... }`
601+
- show one destructured API factory context object, never positional
602+
`(editor, context)` arguments, and never teach `.configure({ api })`
603+
- show one object factory call with no caller generics; do not claim the
604+
implementation uses one self-referential generic when contextual
605+
inference requires a private inferred environment plus author input
606+
- teach the root `EditorExtensionDependencyReference` only as a shallow,
607+
non-generic `name` plus optional `enabled` reference; never expose the
608+
internal normalized installed-capability carrier, higher-kinded encoding,
609+
or recursive exact dependency ancestry
610+
- teach `EditorExtensionTypeProvider` as the sole public value-sensitive
611+
capability bridge; never teach its internal carrier or expansion machinery
612+
- teach typed portals as a static literal-name plus capability-equivalence
613+
proof and a runtime exact-descriptor-identity proof; never imply that a
614+
same-name object is an interchangeable runtime token
615+
- never teach Core's author-source-to-canonical-lowered normalization
616+
aliases; plugin authors supply one object and receive one descriptor
617+
- show low-level React composition as `react({ dom })` with the exact DOM
618+
descriptor; never teach `react()`, flattened DOM options, caller
619+
generics, or implementation casts
620+
- put lifecycle and host/DOM events in one root `on` family with prefixless
621+
child names: `keyDown`, `paste`, `nodeChange`, `textChange`, and capture
622+
variants; never teach a `handlers` bucket
623+
- teach clipboard ingress only as a direct `clipboardHandler(...)` entry in
624+
`contributions`, never as a root `clipboard` field; teach only
625+
`clipboardHandler(handler)`, with the handler transaction contextually
626+
inferred from the owning extension or Plate stage, and never pass an
627+
editor to the helper
628+
- teach Plite owner-local capabilities as `read` and `update`, pure
629+
core-read policy as `readMiddleware`, and config-free `validate`
578630
5. Style plugins without distinct components should document their schema
579631
placement truth. Cross-cut block styles configure
580-
`options.targetPluginKeys`; render/parser injection is derived and must not
632+
root `targetPluginNames`; render/parser injection is derived and must not
581633
be taught as a second target configuration. Text styles declare marks and
582634
do not invent block target lists. Document `inject.nodeProps` only for real
583635
rendering defaults and mappings.
@@ -586,9 +638,11 @@ Required shape:
586638
controls.
587639
7. `## Plugins` for actual plugin objects.
588640
8. `## API Reference` and `## Transforms` only for real
589-
`editor.api.<pluginKey>.*` and `editor.update.<group>.*` surfaces. Teach
641+
`editor.api.<pluginName>.*` and `editor.update.<group>.*` surfaces. Teach
590642
`editor.plugin(Plugin).api.*` only when the example is intentionally generic
591-
package code or needs exact descriptor ownership. When that descriptor is
643+
package code or needs exact descriptor ownership; teach
644+
`editor.extension(Extension).api.*` for exact raw Plite ownership. These
645+
paths expose one descriptor-owned API, never root-merged methods. When that descriptor is
592646
optional, show `const plugin = editor.plugin(Plugin)` and guard portal access
593647
with `plugin.installed`; disabled plugins count as absent. Never teach root
594648
API probing, node/schema/cache inference, or caught portal errors as plugin

.agents/rules/editor-audit.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,15 @@ adaptation and debt fields answer “what should still change inside that base?
344344
A local base can win while a reference ownership rule, compiler step, failure
345345
boundary, or proof invariant is still worth adapting.
346346

347+
Run a second pass over every reference win below the feature row. A donor may
348+
lose the overall capability comparison while still having a better reusable
349+
architecture pattern: feature-local declarations, compilation, precedence,
350+
caching, failure isolation, lifecycle, or proof topology. For each such
351+
pattern, show the current local owner graph and its deletion cone, then record
352+
`adapt`, `reject`, or `defer` independently. A 1:1 feature score is incomplete
353+
if it never asks whether the donor removes a central registry or reverses an
354+
ownership dependency.
355+
347356
Do not make a global superiority claim unless the full matrix validator passes
348357
and the conclusion enumerates every classification count, concept ID, material
349358
evidence gap, and exception. Architecture fitness for Plite/Plate's constraints
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env node
2+
export declare const validateConceptMatrix: ({
3+
ledger,
4+
manifest,
5+
}: {
6+
ledger: any;
7+
manifest: any;
8+
}) => {
9+
classifications: {
10+
[k: string]: {
11+
count: any;
12+
ids: any;
13+
};
14+
};
15+
concepts: any;
16+
integrity: {
17+
cannedProfiles: number;
18+
duplicateRows: number;
19+
groupedIds: number;
20+
missingPriorCandidates: number;
21+
missingRows: number;
22+
unknownIds: number;
23+
unresolvedCells: number;
24+
};
25+
localDebt: {
26+
[k: string]: {
27+
count: any;
28+
ids: any;
29+
};
30+
};
31+
origins: {
32+
[k: string]: {
33+
count: any;
34+
ids: any;
35+
};
36+
};
37+
preferredBases: {
38+
[k: string]: {
39+
count: any;
40+
ids: any;
41+
};
42+
};
43+
priorCandidates: {
44+
[k: string]: {
45+
count: any;
46+
ids: any;
47+
};
48+
};
49+
priorities: {
50+
[k: string]: {
51+
count: any;
52+
ids: any;
53+
};
54+
};
55+
proofAdaptations: {
56+
[k: string]: {
57+
count: any;
58+
ids: any;
59+
};
60+
};
61+
referenceAdaptations: {
62+
[k: string]: {
63+
count: any;
64+
ids: any;
65+
};
66+
};
67+
rows: number;
68+
verdicts: {
69+
[k: string]: {
70+
count: any;
71+
ids: any;
72+
};
73+
};
74+
};

0 commit comments

Comments
 (0)