@dtmd/temper 0.0.3 → 0.0.6
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 +10 -12
- package/dist/src/assembly.d.ts +32 -19
- package/dist/src/assembly.js +10 -10
- package/dist/src/builtins.d.ts +181 -12
- package/dist/src/builtins.js +269 -9
- package/dist/src/claude-code.d.ts +7 -9
- package/dist/src/claude-code.js +6 -8
- package/dist/src/contract.d.ts +97 -30
- package/dist/src/contract.js +80 -10
- package/dist/src/declarations.d.ts +28 -61
- package/dist/src/declarations.js +364 -50
- package/dist/src/emit.d.ts +13 -32
- package/dist/src/emit.js +136 -53
- package/dist/src/generated/AssemblyFactRow.d.ts +29 -0
- package/dist/src/generated/AssemblyFactRow.js +2 -0
- package/dist/src/generated/BoundRow.d.ts +14 -0
- package/dist/src/generated/BoundRow.js +2 -0
- package/dist/src/generated/CharsetRow.d.ts +15 -0
- package/dist/src/generated/CharsetRow.js +2 -0
- package/dist/src/generated/ClauseRow.d.ts +97 -0
- package/dist/src/generated/ClauseRow.js +1 -0
- package/dist/src/generated/CollectionEntryRow.d.ts +23 -0
- package/dist/src/generated/CollectionEntryRow.js +2 -0
- package/dist/src/generated/CollectionEntryWire.d.ts +17 -0
- package/dist/src/generated/CollectionEntryWire.js +2 -0
- package/dist/src/generated/CountBoundRow.d.ts +13 -0
- package/dist/src/generated/CountBoundRow.js +2 -0
- package/dist/src/generated/Declarations.d.ts +72 -0
- package/dist/src/generated/Declarations.js +1 -0
- package/dist/src/generated/DegreeBoundRow.d.ts +15 -0
- package/dist/src/generated/DegreeBoundRow.js +1 -0
- package/dist/src/generated/EdgeBoundRow.d.ts +13 -0
- package/dist/src/generated/EdgeBoundRow.js +2 -0
- package/dist/src/generated/EmbeddedMember.d.ts +45 -0
- package/dist/src/generated/EmbeddedMember.js +1 -0
- package/dist/src/generated/EmbeddedMemberCollectionEntry.d.ts +21 -0
- package/dist/src/generated/EmbeddedMemberCollectionEntry.js +1 -0
- package/dist/src/generated/FeatureValue.d.ts +23 -0
- package/dist/src/generated/FeatureValue.js +1 -0
- package/dist/src/generated/Features.d.ts +82 -0
- package/dist/src/generated/Features.js +1 -0
- package/dist/src/generated/FencedBlock.d.ts +24 -0
- package/dist/src/generated/FencedBlock.js +2 -0
- package/dist/src/generated/IncludeRow.d.ts +18 -0
- package/dist/src/generated/IncludeRow.js +2 -0
- package/dist/src/generated/KindFactRow.d.ts +51 -0
- package/dist/src/generated/KindFactRow.js +1 -0
- package/dist/src/generated/LayoutRegionRow.d.ts +29 -0
- package/dist/src/generated/LayoutRegionRow.js +2 -0
- package/dist/src/generated/LayoutRow.d.ts +12 -0
- package/dist/src/generated/LayoutRow.js +1 -0
- package/dist/src/generated/MentionRow.d.ts +17 -0
- package/dist/src/generated/MentionRow.js +2 -0
- package/dist/src/generated/NestedMemberRow.d.ts +39 -0
- package/dist/src/generated/NestedMemberRow.js +1 -0
- package/dist/src/generated/Payload.d.ts +25 -0
- package/dist/src/generated/Payload.js +1 -0
- package/dist/src/generated/PayloadMember.d.ts +31 -0
- package/dist/src/generated/PayloadMember.js +2 -0
- package/dist/src/generated/RangeBoundRow.d.ts +15 -0
- package/dist/src/generated/RangeBoundRow.js +2 -0
- package/dist/src/generated/RequirementRow.d.ts +40 -0
- package/dist/src/generated/RequirementRow.js +1 -0
- package/dist/src/generated/SatisfiesRow.d.ts +14 -0
- package/dist/src/generated/SatisfiesRow.js +2 -0
- package/dist/src/generated/Section.d.ts +21 -0
- package/dist/src/generated/Section.js +2 -0
- package/dist/src/generated/SectionContainsRow.d.ts +14 -0
- package/dist/src/generated/SectionContainsRow.js +2 -0
- package/dist/src/generated/ValueType.d.ts +9 -0
- package/dist/src/generated/ValueType.js +2 -0
- package/dist/src/generated/index.d.ts +29 -0
- package/dist/src/generated/index.js +1 -0
- package/dist/src/index.d.ts +15 -19
- package/dist/src/index.js +10 -13
- package/dist/src/kind.d.ts +163 -41
- package/dist/src/kind.js +24 -24
- package/dist/src/needs.d.ts +8 -8
- package/dist/src/needs.js +7 -7
- package/dist/src/prose.d.ts +75 -28
- package/dist/src/prose.js +0 -0
- package/package.json +1 -1
- package/dist/src/genres.d.ts +0 -38
- package/dist/src/genres.js +0 -24
package/dist/src/builtins.js
CHANGED
|
@@ -1,27 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The built-in Claude Code kinds — the face nouns a harness author imports
|
|
3
|
-
*
|
|
2
|
+
* The built-in Claude Code kinds — the face nouns a harness author imports.
|
|
3
|
+
* Each is an
|
|
4
4
|
* ordinary `kind<T>()` value built with the same constructor every provider uses
|
|
5
5
|
* (ownership not privilege). Their five facts are external facts about the Claude
|
|
6
6
|
* Code harness, cited at the point of claim.
|
|
7
7
|
*
|
|
8
8
|
* These are the SDK's own provider-face exports, surfaced through the
|
|
9
|
-
* `@dtmd/temper/claude-code` subpath
|
|
10
|
-
*
|
|
9
|
+
* `@dtmd/temper/claude-code` subpath
|
|
10
|
+
* — never from the root.
|
|
11
11
|
*/
|
|
12
12
|
import { kind } from "./kind.js";
|
|
13
|
+
import { allowedChars, clause, deny, forbiddenKeys, maxLen, maxLines, minLen, nameMatchesDir, required, uniqueName, } from "./contract.js";
|
|
13
14
|
/**
|
|
14
15
|
* `skill` — `.claude/skills/<name>/SKILL.md`, a directory unit, YAML frontmatter
|
|
15
|
-
* carrying `name` then `description`; registers
|
|
16
|
+
* carrying `name` then `description`; registers on both documented invocation
|
|
17
|
+
* channels — user-invoked (`/name`) and description-trigger — modulated per
|
|
18
|
+
* member by the `disable-model-invocation`/`user-invocable` fields
|
|
16
19
|
* (code.claude.com/docs/en/skills, agentskills.io/specification, retrieved
|
|
17
|
-
* 2026-07-
|
|
20
|
+
* 2026-07-07).
|
|
18
21
|
*/
|
|
19
22
|
export const skill = kind({
|
|
20
23
|
name: "skill",
|
|
21
24
|
locus: { kind: "at", root: ".claude/skills", glob: "*/SKILL.md" },
|
|
22
25
|
format: "yaml-frontmatter",
|
|
23
26
|
unitShape: "directory",
|
|
24
|
-
registration: { via: "description-trigger", field: "description" },
|
|
27
|
+
registration: [{ via: "user-invoked" }, { via: "description-trigger", field: "description" }],
|
|
28
|
+
identityField: "name",
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* `command` — `.claude/commands/*.md`, the skill surface's legacy file placement
|
|
32
|
+
* (Claude Code merged commands into skills; code.claude.com/docs/en/skills,
|
|
33
|
+
* retrieved 2026-07-07): a lone file (identity from the stem, so no
|
|
34
|
+
* `identityField` — like `rule`), the skill's field schema by import, registering
|
|
35
|
+
* on the same two documented invocation channels as `skill`.
|
|
36
|
+
*/
|
|
37
|
+
export const command = kind({
|
|
38
|
+
name: "command",
|
|
39
|
+
locus: { kind: "at", root: ".claude/commands", glob: "*.md" },
|
|
40
|
+
format: "yaml-frontmatter",
|
|
41
|
+
unitShape: "file",
|
|
42
|
+
registration: [{ via: "user-invoked" }, { via: "description-trigger", field: "description" }],
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* `agent` — every markdown file under `.claude/agents`, discovered recursively (a
|
|
46
|
+
* containing subdirectory is purely organizational), YAML frontmatter carrying
|
|
47
|
+
* `name` then `description`; identity is the `name` field (never the filename),
|
|
48
|
+
* the named-field mode; registers on the description-trigger channel only — no
|
|
49
|
+
* user-invoked slash command (code.claude.com/docs/en/sub-agents, retrieved
|
|
50
|
+
* 2026-07-07).
|
|
51
|
+
*/
|
|
52
|
+
export const agent = kind({
|
|
53
|
+
name: "agent",
|
|
54
|
+
locus: { kind: "at", root: ".claude/agents", glob: "**/*.md" },
|
|
55
|
+
format: "yaml-frontmatter",
|
|
56
|
+
unitShape: "named-field",
|
|
57
|
+
registration: [{ via: "description-trigger", field: "description" }],
|
|
25
58
|
identityField: "name",
|
|
26
59
|
});
|
|
27
60
|
/**
|
|
@@ -34,7 +67,7 @@ export const rule = kind({
|
|
|
34
67
|
locus: { kind: "at", root: ".claude/rules", glob: "*.md" },
|
|
35
68
|
format: "yaml-frontmatter",
|
|
36
69
|
unitShape: "file",
|
|
37
|
-
registration: { via: "paths-match", field: "paths" },
|
|
70
|
+
registration: [{ via: "paths-match", field: "paths" }],
|
|
38
71
|
});
|
|
39
72
|
/**
|
|
40
73
|
* `memory` — a root `<name>.md` (`CLAUDE.md`, `AGENTS.md`), a lone file loaded
|
|
@@ -47,5 +80,232 @@ export const memory = kind({
|
|
|
47
80
|
name: "memory",
|
|
48
81
|
locus: { kind: "at", root: ".", glob: "**/CLAUDE.md" },
|
|
49
82
|
unitShape: "file",
|
|
50
|
-
registration: { via: "always" },
|
|
83
|
+
registration: [{ via: "always" }],
|
|
51
84
|
});
|
|
85
|
+
/**
|
|
86
|
+
* The default contract for `skill` — Anthropic's documented skill contract: the Agent
|
|
87
|
+
* Skills open standard (agentskills.io), Anthropic's platform upload
|
|
88
|
+
* validation, and Claude Code's own docs.
|
|
89
|
+
* All sources retrieved 2026-07-09.
|
|
90
|
+
*
|
|
91
|
+
* Checks the strictest documented profile: the spec and upload validation are
|
|
92
|
+
* hard, Claude Code's runtime is deliberately forgiving ("All fields are
|
|
93
|
+
* optional") — a skill that passes here loads everywhere the format is
|
|
94
|
+
* honored, not merely on the machine it was written on; where the runtime
|
|
95
|
+
* diverges, the clause's own guidance says so.
|
|
96
|
+
*
|
|
97
|
+
* Deliberately absent — undecidable, so never gate clauses: whether the
|
|
98
|
+
* description actually triggers well or reads third-person (semantic);
|
|
99
|
+
* vagueness/no-op detection (semantic); gerund naming (judgment). Two
|
|
100
|
+
* decidable spec rules are also absent, pending a vocabulary addition (a
|
|
101
|
+
* narrow shape predicate governs additions): the name
|
|
102
|
+
* must not start/end with a hyphen or contain consecutive hyphens; likewise
|
|
103
|
+
* the platform's "no XML tags in the description."
|
|
104
|
+
*
|
|
105
|
+
* Authoring notes the clauses cannot carry: prefer gerund or noun-phrase
|
|
106
|
+
* names (`processing-pdfs`, `pdf-processing`) over vague ones (`helper`,
|
|
107
|
+
* `utils`); `disable-model-invocation: true` for side-effectful workflows you
|
|
108
|
+
* want to time yourself; `user-invocable: false` for background knowledge
|
|
109
|
+
* that is not a command; `metadata` is the sanctioned home for versioning —
|
|
110
|
+
* there is no top-level `version` field.
|
|
111
|
+
*/
|
|
112
|
+
export const skillDefaultContract = [
|
|
113
|
+
clause(required("name"), {
|
|
114
|
+
severity: "required",
|
|
115
|
+
guidance: "Every skill declares a `name` — the slug the harness binds to. Claude Code alone would default it from the directory name, but a nameless skill is not portable: the spec and Anthropic's upload validation both require it.",
|
|
116
|
+
cite: "https://agentskills.io/specification#frontmatter (retrieved 2026-07-09)",
|
|
117
|
+
}),
|
|
118
|
+
clause(minLen("name", 1), {
|
|
119
|
+
severity: "required",
|
|
120
|
+
guidance: "A present-but-empty name fails the spec's 1-64 character bound.",
|
|
121
|
+
cite: "https://agentskills.io/specification#name-field (retrieved 2026-07-09)",
|
|
122
|
+
}),
|
|
123
|
+
clause(allowedChars("name", { ranges: ["a-z", "0-9"], chars: "-" }), {
|
|
124
|
+
severity: "required",
|
|
125
|
+
guidance: "Lowercase letters, digits, and hyphens only — `PDF-Processing` is the spec's own counter-example. The charset also keeps XML out of the name, which Anthropic's upload validation separately forbids.",
|
|
126
|
+
cite: "https://agentskills.io/specification#name-field (retrieved 2026-07-09)",
|
|
127
|
+
}),
|
|
128
|
+
clause(maxLen("name", 64), {
|
|
129
|
+
severity: "required",
|
|
130
|
+
guidance: "Keep the name short and slug-like; it becomes a directory and an id.",
|
|
131
|
+
cite: "https://agentskills.io/specification#name-field (retrieved 2026-07-09)",
|
|
132
|
+
}),
|
|
133
|
+
clause(deny("name", ["anthropic", "claude"]), {
|
|
134
|
+
severity: "required",
|
|
135
|
+
guidance: "Reserved words, enforced by Anthropic's platform upload validation (not by the open spec, and not by Claude Code's runtime — which itself ships a `claude-api` skill). Keep them out if the skill will ever travel through the API or claude.ai.",
|
|
136
|
+
cite: "https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview#skill-structure (retrieved 2026-07-09)",
|
|
137
|
+
}),
|
|
138
|
+
clause(nameMatchesDir(), {
|
|
139
|
+
severity: "required",
|
|
140
|
+
guidance: "The spec requires the name to match its parent directory. Claude Code decouples the two (the frontmatter name is a display label; the directory names the slash command, except for a plugin-root SKILL.md) — but a mismatch is a portability trap and a reader trap even where it loads.",
|
|
141
|
+
cite: "https://agentskills.io/specification#name-field (retrieved 2026-07-09)",
|
|
142
|
+
}),
|
|
143
|
+
clause(required("description"), {
|
|
144
|
+
severity: "required",
|
|
145
|
+
guidance: "The description is how the model chooses this skill from potentially 100+ available — it is the skill's API. Claude Code would fall back to the body's first paragraph; the spec and upload validation require it declared.",
|
|
146
|
+
cite: "https://agentskills.io/specification#frontmatter (retrieved 2026-07-09)",
|
|
147
|
+
}),
|
|
148
|
+
clause(minLen("description", 1), {
|
|
149
|
+
severity: "required",
|
|
150
|
+
guidance: "Say both what the skill does and when to use it, with the keywords a user would naturally say. Write in third person — the text is injected into the system prompt, and inconsistent point-of-view causes discovery problems.",
|
|
151
|
+
cite: "https://agentskills.io/specification#description-field (retrieved 2026-07-09)",
|
|
152
|
+
}),
|
|
153
|
+
clause(maxLen("description", 1024), {
|
|
154
|
+
severity: "required",
|
|
155
|
+
guidance: "The spec's cap. Claude Code additionally truncates the skill listing at 1,536 combined characters (description + when_to_use) — truncation, not rejection, but text past the fold cannot help the model choose.",
|
|
156
|
+
cite: "https://agentskills.io/specification#description-field (retrieved 2026-07-09)",
|
|
157
|
+
}),
|
|
158
|
+
clause(maxLen("compatibility", 500), {
|
|
159
|
+
severity: "required",
|
|
160
|
+
guidance: "Optional field; when present the spec caps it at 500 characters. Most skills do not need it.",
|
|
161
|
+
cite: "https://agentskills.io/specification#frontmatter (retrieved 2026-07-09)",
|
|
162
|
+
}),
|
|
163
|
+
clause(maxLines(500), {
|
|
164
|
+
severity: "advisory",
|
|
165
|
+
guidance: "Progressive disclosure: keep SKILL.md under 500 lines and move detailed reference material to separate files, one level deep. Once a skill loads, its body stays in context across turns — every line is a recurring token cost. The context window is a public good.",
|
|
166
|
+
cite: "https://agentskills.io/specification#progressive-disclosure (retrieved 2026-07-09)",
|
|
167
|
+
}),
|
|
168
|
+
clause(forbiddenKeys(["globs", "alwaysApply"]), {
|
|
169
|
+
severity: "required",
|
|
170
|
+
guidance: "Cursor `.mdc` keys. Nothing in the Agent Skills spec or Claude Code's documented frontmatter accepts them — a skill authored with them is carrying dead configuration that another tool's semantics silently fail to apply.",
|
|
171
|
+
cite: "https://agentskills.io/specification#frontmatter (retrieved 2026-07-09)",
|
|
172
|
+
}),
|
|
173
|
+
];
|
|
174
|
+
/**
|
|
175
|
+
* The default contract for `command` — `skillDefaultContract`'s clauses minus `nameMatchesDir`: a
|
|
176
|
+
* command is a lone file with no parent directory to match, so the one clause
|
|
177
|
+
* that ranges over the directory relationship does not apply; every other
|
|
178
|
+
* documented skill-schema recommendation, name-requiredness included, still
|
|
179
|
+
* governs a command by the same import (code.claude.com/docs/en/skills,
|
|
180
|
+
* retrieved 2026-07-07).
|
|
181
|
+
*/
|
|
182
|
+
export const commandDefaultContract = skillDefaultContract.filter((entry) => entry.predicate.key !== "name-matches-dir");
|
|
183
|
+
/**
|
|
184
|
+
* The default contract for `agent` — Anthropic's documented subagent contract
|
|
185
|
+
* (code.claude.com/docs/en/sub-agents, retrieved 2026-07-07): `name` and
|
|
186
|
+
* `description` are the only required fields, `name` is a "unique identifier
|
|
187
|
+
* using lowercase letters and hyphens" (no digits, unlike a skill's `name`), and
|
|
188
|
+
* "keep `name` values unique across the whole tree" — a same-scope collision
|
|
189
|
+
* loads only one definition.
|
|
190
|
+
*
|
|
191
|
+
* Deliberately narrow, like `ruleDefaultContract`: undecidable properties (whether the
|
|
192
|
+
* description triggers well, model/permissionMode's semi-open vocabularies) stay
|
|
193
|
+
* out of the gate — the format documents little else that is decidable.
|
|
194
|
+
*/
|
|
195
|
+
export const agentDefaultContract = [
|
|
196
|
+
clause(required("name"), {
|
|
197
|
+
severity: "required",
|
|
198
|
+
guidance: "Every subagent declares a `name` — its unique identifier. Claude Code binds identity to this field alone, never the filename, so a nameless subagent cannot be delegated to.",
|
|
199
|
+
cite: "https://code.claude.com/docs/en/sub-agents (retrieved 2026-07-07)",
|
|
200
|
+
}),
|
|
201
|
+
clause(allowedChars("name", { ranges: ["a-z"], chars: "-" }), {
|
|
202
|
+
severity: "required",
|
|
203
|
+
guidance: "Lowercase letters and hyphens only — no digits, unlike a skill's `[a-z0-9-]` name. Hooks receive this value as `agent_type`.",
|
|
204
|
+
cite: "https://code.claude.com/docs/en/sub-agents (retrieved 2026-07-07)",
|
|
205
|
+
}),
|
|
206
|
+
clause(uniqueName(), {
|
|
207
|
+
severity: "required",
|
|
208
|
+
guidance: "Keep `name` values unique across the whole tree — when two files in one scope declare the same name, Claude Code loads only one of them, silently shadowing the other.",
|
|
209
|
+
cite: "https://code.claude.com/docs/en/sub-agents (retrieved 2026-07-07)",
|
|
210
|
+
}),
|
|
211
|
+
clause(required("description"), {
|
|
212
|
+
severity: "required",
|
|
213
|
+
guidance: "The description is how Claude decides when to delegate to this subagent — write it so the trigger is unambiguous.",
|
|
214
|
+
cite: "https://code.claude.com/docs/en/sub-agents (retrieved 2026-07-07)",
|
|
215
|
+
}),
|
|
216
|
+
];
|
|
217
|
+
/**
|
|
218
|
+
* The default contract for `rule` — Anthropic's documented contract for a Claude Code
|
|
219
|
+
* rules file, sourced from the memory docs (`.claude/rules/` landed in
|
|
220
|
+
* v2.0.64; `packages/rule.anthropic/PACKAGE.md`, the curated authoring
|
|
221
|
+
* reference this migrates verbatim). All sources retrieved 2026-07-09.
|
|
222
|
+
*
|
|
223
|
+
* `paths` is the one documented frontmatter key for rules: glob patterns
|
|
224
|
+
* (brace expansion supported) that scope the rule to matching files. Rules
|
|
225
|
+
* without it load at launch with the same priority as CLAUDE.md; path-scoped
|
|
226
|
+
* rules load when Claude reads a matching file. Note skills now take a
|
|
227
|
+
* `paths` key too — the two schemas are separate. (Guidance only: an
|
|
228
|
+
* optional field asserts nothing decidable, so it carries no clause of its
|
|
229
|
+
* own: `required` is the one
|
|
230
|
+
* presence predicate, and its absence is not itself a predicate.)
|
|
231
|
+
* https://code.claude.com/docs/en/memory#path-specific-rules (retrieved 2026-07-09)
|
|
232
|
+
*
|
|
233
|
+
* What the clauses cannot carry, as guidance: keep a rule to facts Claude
|
|
234
|
+
* should hold whenever the rule is in scope — concrete enough to verify ("use
|
|
235
|
+
* 2-space indentation", not "format code properly"). If an entry is a
|
|
236
|
+
* multi-step procedure or only matters occasionally, it belongs in a skill
|
|
237
|
+
* (on-demand) rather than a rule (always-on). Prefer path-scoped rules when
|
|
238
|
+
* one convention governs scattered paths; prefer per-directory CLAUDE.md when
|
|
239
|
+
* directory owners maintain their own. Treat rules like code: prune them when
|
|
240
|
+
* behavior drifts, and test a change by watching whether Claude's behavior
|
|
241
|
+
* actually shifts.
|
|
242
|
+
*/
|
|
243
|
+
export const ruleDefaultContract = [
|
|
244
|
+
clause(forbiddenKeys(["description", "globs", "alwaysApply"]), {
|
|
245
|
+
severity: "required",
|
|
246
|
+
guidance: "Cursor `.mdc` keys. Claude Code's documented rules schema is `paths`-only; a rule authored with Cursor frontmatter is configuration another tool's semantics silently fail to honor — the rule loads, the scoping you meant does not. (That Claude Code ignores unknown keys is observed behavior, not documented contract — the documented schema is the citation.)",
|
|
247
|
+
cite: "https://code.claude.com/docs/en/memory#path-specific-rules (retrieved 2026-07-09)",
|
|
248
|
+
}),
|
|
249
|
+
clause(maxLines(200), {
|
|
250
|
+
severity: "advisory",
|
|
251
|
+
guidance: "Unconditional rules are always-on context, paid every session: the docs' size target is under 200 lines per memory file — 'longer files consume more context and reduce adherence.' (Distinct from the hard 200-line/25KB cutoff, which applies only to auto-memory MEMORY.md; rules load in full regardless of length.) For each line ask: would removing it cause Claude to make mistakes? If not, cut it.",
|
|
252
|
+
cite: "https://code.claude.com/docs/en/memory#write-effective-instructions (retrieved 2026-07-09)",
|
|
253
|
+
}),
|
|
254
|
+
];
|
|
255
|
+
/**
|
|
256
|
+
* The default contract for the qualified `claude-code.memory` kind — Anthropic's
|
|
257
|
+
* documented contract for a project `CLAUDE.md` (`packages/memory.anthropic/PACKAGE.md`,
|
|
258
|
+
* the curated authoring reference this migrates verbatim). Retrieved 2026-07-09.
|
|
259
|
+
*
|
|
260
|
+
* Deliberately near-empty, because the format is: `CLAUDE.md` is plain
|
|
261
|
+
* markdown with no documented frontmatter and no required fields
|
|
262
|
+
* (code.claude.com/docs/en/memory, retrieved 2026-07-09), so there is no
|
|
263
|
+
* schema to gate — manufacturing a required field or a forbidden-key list
|
|
264
|
+
* would fake a check the format does not carry. The single clause is a context-cost
|
|
265
|
+
* budget; everything else the contract could say is guidance.
|
|
266
|
+
*
|
|
267
|
+
* What the clauses cannot carry, as guidance: a `paths:` frontmatter block
|
|
268
|
+
* belongs on a `.claude/rules/*.md` file, not on `CLAUDE.md` — the memory
|
|
269
|
+
* docs document `paths` only for rules, so a rules-style header on
|
|
270
|
+
* `CLAUDE.md` is dead configuration. Split a large file with `@path` imports
|
|
271
|
+
* (resolved relative to the importing file, absolute allowed, recursion
|
|
272
|
+
* capped at four hops; wrap a path in backticks to mention it without
|
|
273
|
+
* importing). If the repo already ships an `AGENTS.md` for other agents,
|
|
274
|
+
* don't duplicate it — create a `CLAUDE.md` that `@AGENTS.md`-imports it (or
|
|
275
|
+
* symlink, except on Windows where the import is the recommended bridge).
|
|
276
|
+
* Mind the loading asymmetry: every ancestor `CLAUDE.md` loads in full at
|
|
277
|
+
* launch, while files in subdirectories load only when Claude reads a file
|
|
278
|
+
* there — so a rule that must always hold belongs above the working
|
|
279
|
+
* directory, not below it. Personal, un-shared notes go in `CLAUDE.local.md`
|
|
280
|
+
* (gitignored), appended after `CLAUDE.md` at its level.
|
|
281
|
+
*/
|
|
282
|
+
export const memoryAnthropicDefaultContract = [
|
|
283
|
+
clause(maxLines(200), {
|
|
284
|
+
severity: "advisory",
|
|
285
|
+
guidance: "CLAUDE.md is always-on context, paid every session. The memory docs' size target is under 200 lines per memory file — 'longer files consume more context and reduce adherence.' For each line ask: would removing it cause Claude to make mistakes? If not, cut it. (Advisory: Claude Code loads the file in full regardless of length; this is a context-cost budget, not a hard cutoff.)",
|
|
286
|
+
cite: "https://code.claude.com/docs/en/memory#write-effective-instructions (retrieved 2026-07-09)",
|
|
287
|
+
}),
|
|
288
|
+
];
|
|
289
|
+
/**
|
|
290
|
+
* The default contract for the qualified `agents-md.memory` kind — the AGENTS.md
|
|
291
|
+
* standard's contract for a memory file, which is that there is almost none
|
|
292
|
+
* (`packages/memory.agents-md/PACKAGE.md`, the curated authoring reference
|
|
293
|
+
* this migrates). Guidance-only, and that is the honest encoding: `AGENTS.md`
|
|
294
|
+
* "is just standard Markdown" with no required fields, no sections, and no
|
|
295
|
+
* frontmatter (agents.md, retrieved 2026-07-09); the format deliberately
|
|
296
|
+
* constrains nothing. A default contract that manufactured a required field, a size
|
|
297
|
+
* gate, or a forbidden-key list would assert a contract the standard
|
|
298
|
+
* disclaims. Even the tempting size
|
|
299
|
+
* number is a *tool's* rule, not the format's: agents read the closest
|
|
300
|
+
* `AGENTS.md` in the tree (nested, nearest-wins; agents.md, retrieved
|
|
301
|
+
* 2026-07-09); Codex concatenates the chain root-to-cwd and stops once
|
|
302
|
+
* combined size hits a byte budget, not a per-file line count
|
|
303
|
+
* (`project_doc_max_bytes`, 32 KiB default;
|
|
304
|
+
* developers.openai.com/codex/guides/agents-md, retrieved 2026-07-09);
|
|
305
|
+
* Gemini CLI reads `GEMINI.md` by default and only treats `AGENTS.md` as an
|
|
306
|
+
* alias when configured via `context.fileName` (geminicli.com/docs/cli/gemini-md,
|
|
307
|
+
* retrieved 2026-07-09); Claude Code does not read `AGENTS.md` natively —
|
|
308
|
+
* bridge it with a `CLAUDE.md` that `@AGENTS.md`-imports it
|
|
309
|
+
* (code.claude.com/docs/en/memory, retrieved 2026-07-09).
|
|
310
|
+
*/
|
|
311
|
+
export const memoryAgentsMdDefaultContract = [];
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `@dtmd/temper/claude-code` subpath — the first-party Claude Code
|
|
3
|
-
* provider face
|
|
4
|
-
* package — the provider face is a subpath export"). A harness author who
|
|
3
|
+
* provider face. A harness author who
|
|
5
4
|
* targets Claude Code imports the built-in kinds from here, never the root:
|
|
6
|
-
* the root carries only the six-noun core, and identity travels by import
|
|
7
|
-
*
|
|
8
|
-
* specifier like any other. The built-in
|
|
9
|
-
*
|
|
10
|
-
* exist.
|
|
5
|
+
* the root carries only the six-noun core, and identity travels by import,
|
|
6
|
+
* so a subpath specifier is a full module
|
|
7
|
+
* specifier like any other. The built-in default contracts join the kinds here
|
|
8
|
+
* too: adoption is `import { skill, skillDefaultContract } from "@dtmd/temper/claude-code"`.
|
|
11
9
|
*/
|
|
12
|
-
export type { Memory, Rule, Skill } from "./builtins.js";
|
|
13
|
-
export { memory, rule, skill } from "./builtins.js";
|
|
10
|
+
export type { Agent, Memory, Rule, Skill } from "./builtins.js";
|
|
11
|
+
export { agent, agentDefaultContract, command, commandDefaultContract, memory, memoryAgentsMdDefaultContract, memoryAnthropicDefaultContract, rule, ruleDefaultContract, skill, skillDefaultContract, } from "./builtins.js";
|
|
14
12
|
export type { Blocks, File, Prose, Text } from "./prose.js";
|
|
15
13
|
export { blocks, file, text } from "./prose.js";
|
package/dist/src/claude-code.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `@dtmd/temper/claude-code` subpath — the first-party Claude Code
|
|
3
|
-
* provider face
|
|
4
|
-
* package — the provider face is a subpath export"). A harness author who
|
|
3
|
+
* provider face. A harness author who
|
|
5
4
|
* targets Claude Code imports the built-in kinds from here, never the root:
|
|
6
|
-
* the root carries only the six-noun core, and identity travels by import
|
|
7
|
-
*
|
|
8
|
-
* specifier like any other. The built-in
|
|
9
|
-
*
|
|
10
|
-
* exist.
|
|
5
|
+
* the root carries only the six-noun core, and identity travels by import,
|
|
6
|
+
* so a subpath specifier is a full module
|
|
7
|
+
* specifier like any other. The built-in default contracts join the kinds here
|
|
8
|
+
* too: adoption is `import { skill, skillDefaultContract } from "@dtmd/temper/claude-code"`.
|
|
11
9
|
*/
|
|
12
|
-
export { memory, rule, skill } from "./builtins.js";
|
|
10
|
+
export { agent, agentDefaultContract, command, commandDefaultContract, memory, memoryAgentsMdDefaultContract, memoryAnthropicDefaultContract, rule, ruleDefaultContract, skill, skillDefaultContract, } from "./builtins.js";
|
|
13
11
|
export { blocks, file, text } from "./prose.js";
|
package/dist/src/contract.d.ts
CHANGED
|
@@ -1,29 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contracts — clauses and requirements as typed values
|
|
2
|
+
* Contracts — clauses and requirements as typed values.
|
|
3
3
|
* A clause is `predicate · severity · guidance · cite`; a requirement is
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (`10-contracts.md`, the two walls).
|
|
4
|
+
* `prose · kind · required · clauses? · verifiedBy?`. Both erase to compiled data
|
|
5
|
+
* at the seam: the author composes typed objects, the engine
|
|
6
|
+
* consumes their rows. The predicate vocabulary is the closed algebra — a clause
|
|
7
|
+
* outside it is a squiggle, not a runtime rejection.
|
|
9
8
|
*/
|
|
10
9
|
import type { KindDefinition } from "./kind.js";
|
|
11
10
|
/** A clause's delivery posture: `required` gate-blocks, `advisory` reports. */
|
|
12
11
|
export type Severity = "required" | "advisory";
|
|
13
12
|
/**
|
|
14
|
-
* A member of the closed predicate algebra
|
|
15
|
-
*
|
|
16
|
-
* severity
|
|
17
|
-
*
|
|
18
|
-
*
|
|
13
|
+
* A member of the closed predicate algebra. Both a kind's
|
|
14
|
+
* own `expect` clauses and a requirement's `clauses` compile to the row's full
|
|
15
|
+
* `key`/`field`/`severity`/argument shape (`declarations.ts` `clauseRow`): a
|
|
16
|
+
* floor clause's own `bound`/`charset`/`keys`/`values` ride the row alongside
|
|
17
|
+
* a requirement's `count`/`target`/`degree`, so the lock encodes the floor
|
|
18
|
+
* losslessly rather than identity+severity alone.
|
|
19
19
|
*/
|
|
20
20
|
export interface Predicate {
|
|
21
21
|
/** The predicate's clause key (`required`, `max_len`, `max_lines`, …). */
|
|
22
22
|
readonly key: string;
|
|
23
23
|
/** The field (or marker) the predicate constrains, when it names one. */
|
|
24
24
|
readonly field?: string;
|
|
25
|
-
/** The predicate's scalar bounds
|
|
25
|
+
/** The predicate's scalar bounds, keyed per predicate (`min`/`max`,
|
|
26
|
+
* `incoming_min`/`incoming_max`/`outgoing_min`/`outgoing_max`). */
|
|
26
27
|
readonly args?: Readonly<Record<string, number>>;
|
|
28
|
+
/**
|
|
29
|
+
* `membership`'s target requirement name — a separate slot from `field` (the
|
|
30
|
+
* checked field) since `membership` names both.
|
|
31
|
+
*/
|
|
32
|
+
readonly target?: string;
|
|
33
|
+
/** `allowed_chars`'s declared character class. */
|
|
34
|
+
readonly charset?: Charset;
|
|
35
|
+
/** `forbidden_keys`'s forbidden key list. */
|
|
36
|
+
readonly keys?: readonly string[];
|
|
37
|
+
/** `enum`/`deny`'s permitted or forbidden value list. */
|
|
38
|
+
readonly values?: readonly string[];
|
|
39
|
+
/** `range`'s inclusive numeric bound. */
|
|
40
|
+
readonly range?: {
|
|
41
|
+
readonly min: number;
|
|
42
|
+
readonly max: number;
|
|
43
|
+
};
|
|
44
|
+
/** `section_contains`'s heading-text prefix and the marker each governed section must carry. */
|
|
45
|
+
readonly section?: {
|
|
46
|
+
readonly heading: string;
|
|
47
|
+
readonly marker: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The character class `allowed_chars` admits — inclusive ranges plus individual
|
|
52
|
+
* characters, e.g. `[a-z0-9-]`. Each range is a `"<lo>-<hi>"` two-character
|
|
53
|
+
* span (`src/contract.rs` `parse_range`'s wire spelling).
|
|
54
|
+
*/
|
|
55
|
+
export interface Charset {
|
|
56
|
+
readonly ranges?: readonly string[];
|
|
57
|
+
readonly chars?: string;
|
|
27
58
|
}
|
|
28
59
|
/** A field or marker is present. */
|
|
29
60
|
export declare const required: (field: string) => Predicate;
|
|
@@ -34,19 +65,58 @@ export declare const minLen: (field: string, n: number) => Predicate;
|
|
|
34
65
|
/** The field's value is at most `n` characters. */
|
|
35
66
|
export declare const maxLen: (field: string, n: number) => Predicate;
|
|
36
67
|
/** The field's characters are drawn from a declared class (`allowed_chars`). */
|
|
37
|
-
export declare const allowedChars: (field: string) => Predicate;
|
|
68
|
+
export declare const allowedChars: (field: string, charset: Charset) => Predicate;
|
|
38
69
|
/** The member's body is at most `n` lines. */
|
|
39
70
|
export declare const maxLines: (n: number) => Predicate;
|
|
40
71
|
/** The forbidden keys (e.g. the Cursor `globs`/`alwaysApply` keys) are absent. */
|
|
41
|
-
export declare const forbiddenKeys: () => Predicate;
|
|
72
|
+
export declare const forbiddenKeys: (keys: readonly string[]) => Predicate;
|
|
73
|
+
/** The field's value is none of `values` (forbidden values). */
|
|
74
|
+
export declare const deny: (field: string, values: readonly string[]) => Predicate;
|
|
42
75
|
/** The named headings are present. */
|
|
43
76
|
export declare const requireSections: () => Predicate;
|
|
44
77
|
/** The member's name matches its directory. */
|
|
45
78
|
export declare const nameMatchesDir: () => Predicate;
|
|
79
|
+
/** Names are unique within the artifact kind (a scope-wide identity collision). */
|
|
80
|
+
export declare const uniqueName: () => Predicate;
|
|
81
|
+
/**
|
|
82
|
+
* The named field may be present — always satisfied, recording the key as part of a
|
|
83
|
+
* declared (closed) schema. `dependency-exists` has no constructor: the engine holds
|
|
84
|
+
* it back absent a decidable reference syntax, so a hand-authored clause would fail
|
|
85
|
+
* admissibility.
|
|
86
|
+
*/
|
|
87
|
+
export declare const optional: (field: string) => Predicate;
|
|
88
|
+
/** The field's numeric value lies within the inclusive `[min, max]` bound. */
|
|
89
|
+
export declare const range: (field: string, min: number, max: number) => Predicate;
|
|
90
|
+
/** The field's value is one of `values`. Spelled `enumOf` — `enum` is a reserved word. */
|
|
91
|
+
export declare const enumOf: (field: string, values: readonly string[]) => Predicate;
|
|
92
|
+
/** The named body marker is defined (e.g. `disable-model-invocation`). */
|
|
93
|
+
export declare const mustDefine: (marker: string) => Predicate;
|
|
94
|
+
/** Every body section whose heading *starts with* `heading` carries `marker` in its body. */
|
|
95
|
+
export declare const sectionContains: (heading: string, marker: string) => Predicate;
|
|
96
|
+
/** The satisfier set's size lies in the inclusive `[min, max]` bound. */
|
|
97
|
+
export declare const count: (bounds: {
|
|
98
|
+
min?: number;
|
|
99
|
+
max?: number;
|
|
100
|
+
}) => Predicate;
|
|
101
|
+
/** The field's extracted value does not repeat across the satisfier set. */
|
|
102
|
+
export declare const unique: (field: string) => Predicate;
|
|
103
|
+
/** Every satisfier's `field` value is drawn from a feature over `target`'s own satisfier set. */
|
|
104
|
+
export declare const membership: (field: string, target: string) => Predicate;
|
|
105
|
+
/** The in/out edge-count bound every satisfier must land in. At least one direction must be given. */
|
|
106
|
+
export declare const degree: (bounds: {
|
|
107
|
+
incoming?: {
|
|
108
|
+
min?: number;
|
|
109
|
+
max?: number;
|
|
110
|
+
};
|
|
111
|
+
outgoing?: {
|
|
112
|
+
min?: number;
|
|
113
|
+
max?: number;
|
|
114
|
+
};
|
|
115
|
+
}) => Predicate;
|
|
46
116
|
/**
|
|
47
117
|
* A clause — a predicate the author marks with a severity, the just-in-time
|
|
48
118
|
* guidance the predicate cannot encode, and the external-fact `cite` that makes
|
|
49
|
-
* a maintained floor auditable
|
|
119
|
+
* a maintained floor auditable.
|
|
50
120
|
*/
|
|
51
121
|
export interface Clause {
|
|
52
122
|
readonly predicate: Predicate;
|
|
@@ -61,24 +131,21 @@ export declare function clause(predicate: Predicate, opts: {
|
|
|
61
131
|
cite?: string;
|
|
62
132
|
}): Clause;
|
|
63
133
|
/**
|
|
64
|
-
* A requirement — a named obligation on the harness
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* `
|
|
68
|
-
*
|
|
134
|
+
* A requirement — a named obligation on the harness. `prose` is the authored
|
|
135
|
+
* intent, carried never interpreted; `kind` constrains what may fill it **by
|
|
136
|
+
* import** (a value, never a string); `required` is the posture declaration;
|
|
137
|
+
* `clauses` are the requirement's own set-/edge-scope demands — ordinary
|
|
138
|
+
* [`Clause`] values whose predicates range over the satisfier set
|
|
139
|
+
* (`count`/`unique`/`membership`) or its graph neighborhood (`degree`), the
|
|
140
|
+
* same four-channel clause as everywhere; `verifiedBy` wires the behavioral
|
|
141
|
+
* remainder.
|
|
69
142
|
*/
|
|
70
143
|
export interface Requirement {
|
|
71
|
-
readonly
|
|
72
|
-
readonly kind?: KindDefinition<
|
|
144
|
+
readonly prose: string;
|
|
145
|
+
readonly kind?: KindDefinition<never>;
|
|
73
146
|
readonly required?: boolean;
|
|
74
|
-
readonly
|
|
75
|
-
readonly min?: number;
|
|
76
|
-
readonly max?: number;
|
|
77
|
-
};
|
|
78
|
-
readonly unique?: string;
|
|
79
|
-
readonly membership?: string;
|
|
80
|
-
readonly degree?: string;
|
|
147
|
+
readonly clauses?: readonly Clause[];
|
|
81
148
|
readonly verifiedBy?: string;
|
|
82
149
|
}
|
|
83
|
-
/** An identity helper — types a requirement literal at the keystroke
|
|
150
|
+
/** An identity helper — types a requirement literal at the keystroke. */
|
|
84
151
|
export declare function requirement(init: Requirement): Requirement;
|
package/dist/src/contract.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contracts — clauses and requirements as typed values
|
|
2
|
+
* Contracts — clauses and requirements as typed values.
|
|
3
3
|
* A clause is `predicate · severity · guidance · cite`; a requirement is
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (`10-contracts.md`, the two walls).
|
|
4
|
+
* `prose · kind · required · clauses? · verifiedBy?`. Both erase to compiled data
|
|
5
|
+
* at the seam: the author composes typed objects, the engine
|
|
6
|
+
* consumes their rows. The predicate vocabulary is the closed algebra — a clause
|
|
7
|
+
* outside it is a squiggle, not a runtime rejection.
|
|
9
8
|
*/
|
|
10
|
-
// Node-scope predicates
|
|
9
|
+
// Node-scope predicates.
|
|
11
10
|
/** A field or marker is present. */
|
|
12
11
|
export const required = (field) => ({ key: "required", field });
|
|
13
12
|
/** The field's parsed scalar type is as declared. */
|
|
@@ -17,20 +16,91 @@ export const minLen = (field, n) => ({ key: "min_len", field, args: { min: n } }
|
|
|
17
16
|
/** The field's value is at most `n` characters. */
|
|
18
17
|
export const maxLen = (field, n) => ({ key: "max_len", field, args: { max: n } });
|
|
19
18
|
/** The field's characters are drawn from a declared class (`allowed_chars`). */
|
|
20
|
-
export const allowedChars = (field) => ({
|
|
19
|
+
export const allowedChars = (field, charset) => ({
|
|
20
|
+
key: "allowed_chars",
|
|
21
|
+
field,
|
|
22
|
+
charset,
|
|
23
|
+
});
|
|
21
24
|
/** The member's body is at most `n` lines. */
|
|
22
25
|
export const maxLines = (n) => ({ key: "max_lines", args: { max: n } });
|
|
23
26
|
/** The forbidden keys (e.g. the Cursor `globs`/`alwaysApply` keys) are absent. */
|
|
24
|
-
export const forbiddenKeys = () => ({ key: "forbidden_keys" });
|
|
27
|
+
export const forbiddenKeys = (keys) => ({ key: "forbidden_keys", keys });
|
|
28
|
+
/** The field's value is none of `values` (forbidden values). */
|
|
29
|
+
export const deny = (field, values) => ({
|
|
30
|
+
key: "deny",
|
|
31
|
+
field,
|
|
32
|
+
values,
|
|
33
|
+
});
|
|
25
34
|
/** The named headings are present. */
|
|
26
35
|
export const requireSections = () => ({ key: "require_sections" });
|
|
27
36
|
/** The member's name matches its directory. */
|
|
28
37
|
export const nameMatchesDir = () => ({ key: "name-matches-dir" });
|
|
38
|
+
/** Names are unique within the artifact kind (a scope-wide identity collision). */
|
|
39
|
+
export const uniqueName = () => ({ key: "unique-name" });
|
|
40
|
+
/**
|
|
41
|
+
* The named field may be present — always satisfied, recording the key as part of a
|
|
42
|
+
* declared (closed) schema. `dependency-exists` has no constructor: the engine holds
|
|
43
|
+
* it back absent a decidable reference syntax, so a hand-authored clause would fail
|
|
44
|
+
* admissibility.
|
|
45
|
+
*/
|
|
46
|
+
export const optional = (field) => ({ key: "optional", field });
|
|
47
|
+
/** The field's numeric value lies within the inclusive `[min, max]` bound. */
|
|
48
|
+
export const range = (field, min, max) => ({
|
|
49
|
+
key: "range",
|
|
50
|
+
field,
|
|
51
|
+
range: { min, max },
|
|
52
|
+
});
|
|
53
|
+
/** The field's value is one of `values`. Spelled `enumOf` — `enum` is a reserved word. */
|
|
54
|
+
export const enumOf = (field, values) => ({
|
|
55
|
+
key: "enum",
|
|
56
|
+
field,
|
|
57
|
+
values,
|
|
58
|
+
});
|
|
59
|
+
/** The named body marker is defined (e.g. `disable-model-invocation`). */
|
|
60
|
+
export const mustDefine = (marker) => ({ key: "must_define", field: marker });
|
|
61
|
+
/** Every body section whose heading *starts with* `heading` carries `marker` in its body. */
|
|
62
|
+
export const sectionContains = (heading, marker) => ({
|
|
63
|
+
key: "section_contains",
|
|
64
|
+
section: { heading, marker },
|
|
65
|
+
});
|
|
66
|
+
// Node-set/edge-scope predicates — a requirement's set-scope demands ride
|
|
67
|
+
// these as ordinary clause values, the same four-channel `clause()` shape as
|
|
68
|
+
// the node-scope predicates above.
|
|
69
|
+
/** The satisfier set's size lies in the inclusive `[min, max]` bound. */
|
|
70
|
+
export const count = (bounds) => {
|
|
71
|
+
const args = {};
|
|
72
|
+
if (bounds.min !== undefined)
|
|
73
|
+
args.min = bounds.min;
|
|
74
|
+
if (bounds.max !== undefined)
|
|
75
|
+
args.max = bounds.max;
|
|
76
|
+
return { key: "count", args };
|
|
77
|
+
};
|
|
78
|
+
/** The field's extracted value does not repeat across the satisfier set. */
|
|
79
|
+
export const unique = (field) => ({ key: "unique", field });
|
|
80
|
+
/** Every satisfier's `field` value is drawn from a feature over `target`'s own satisfier set. */
|
|
81
|
+
export const membership = (field, target) => ({
|
|
82
|
+
key: "membership",
|
|
83
|
+
field,
|
|
84
|
+
target,
|
|
85
|
+
});
|
|
86
|
+
/** The in/out edge-count bound every satisfier must land in. At least one direction must be given. */
|
|
87
|
+
export const degree = (bounds) => {
|
|
88
|
+
const args = {};
|
|
89
|
+
if (bounds.incoming?.min !== undefined)
|
|
90
|
+
args.incoming_min = bounds.incoming.min;
|
|
91
|
+
if (bounds.incoming?.max !== undefined)
|
|
92
|
+
args.incoming_max = bounds.incoming.max;
|
|
93
|
+
if (bounds.outgoing?.min !== undefined)
|
|
94
|
+
args.outgoing_min = bounds.outgoing.min;
|
|
95
|
+
if (bounds.outgoing?.max !== undefined)
|
|
96
|
+
args.outgoing_max = bounds.outgoing.max;
|
|
97
|
+
return { key: "degree", args };
|
|
98
|
+
};
|
|
29
99
|
/** Compose a clause value — a predicate under a declared severity, with optional guidance/cite. */
|
|
30
100
|
export function clause(predicate, opts) {
|
|
31
101
|
return { predicate, severity: opts.severity, guidance: opts.guidance, cite: opts.cite };
|
|
32
102
|
}
|
|
33
|
-
/** An identity helper — types a requirement literal at the keystroke
|
|
103
|
+
/** An identity helper — types a requirement literal at the keystroke. */
|
|
34
104
|
export function requirement(init) {
|
|
35
105
|
return init;
|
|
36
106
|
}
|