@dialecte/cli 0.2.0 → 0.2.2

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.
Files changed (4) hide show
  1. package/README.md +65 -17
  2. package/dist/cli.js +1530 -1035
  3. package/dist/lookups.js +291 -177
  4. package/package.json +3 -2
package/README.md CHANGED
@@ -32,6 +32,7 @@ dialecte models # which model each tier (fast, standard, strong, fron
32
32
  dialecte doctor # versions, core API generation, skills and station agents in sync, local checkouts
33
33
  dialecte rules # code-rules self-check of the changed files
34
34
  dialecte gate [--full] # the package's Definition of Done, with the real counts
35
+ dialecte gate --hook # in a commit hook: the suite, unless a green gate --full of the committed tree answers it
35
36
  dialecte tdd red|green|status # receipts: each new test failed on an assertion before the code, then passed untouched
36
37
  dialecte new verb <namespace> <query|transaction> <name>
37
38
  dialecte handover <lots.json> # the guarded commit-by-lots hand-over a human runs (run, list)
@@ -70,23 +71,44 @@ Env: `RUNS=5 dialecte bench` (repetitions kept as the min); `COVERAGE_CHILD_CAP=
70
71
  Every Dialecte package ships the agent skills that describe it in `skills/<name>/SKILL.md` (open
71
72
  [Agent Skills](https://agentskills.io) format), versioned with its code.
72
73
 
73
- - **In an app**: `npx @dialecte/cli skills sync` links the skills of your `@dialecte/*` (and any other)
74
- dependencies into `.claude/skills` and `.agents/skills` (Codex, Cursor, Gemini CLI, Copilot read the
74
+ - **In an app**: `npx @dialecte/cli skills sync` links the consumer skills of your `@dialecte/*` (and any
75
+ other) dependencies into `.claude/skills` and `.agents/skills` (Codex, Cursor, Gemini CLI, Copilot read the
75
76
  latter; add `--agent copilot` for `.github/skills`). Links follow your installed versions; rerun after
76
77
  adding a dependency. `--copy` writes copies instead of links.
77
- - **Station agents (Claude Code)**: when Claude Code is a target (the default) and the project's model vendor
78
- is anthropic, `skills sync` also writes one agent per station of `dialecte-lot` into
78
+ - **Consumer and contributor skills**: a skill whose frontmatter says `metadata:` / `audience: contributor` is
79
+ for changing a dialecte package (core's `dialecte-contributing`, `dialecte-lot`); a skill without one is a
80
+ consumer skill. A sync installs the consumer skills only and names the contributor skills it left out;
81
+ `--contributing` installs them too and is remembered (`contributing` in `.dialecte-skills.json`) until
82
+ `--no-contributing` removes them. `dialecte doctor` expects the skills of the audience the manifest says;
83
+ `skills check` refuses another audience value.
84
+ - **Station agents (Claude Code)**: when Claude Code is a target (the default), the contributor skills are
85
+ installed and the project's model vendor is anthropic, `skills sync` also writes one agent per station of `dialecte-lot` into
79
86
  `.claude/agents/dialecte-<station>.md`: `implementer` and `fixer` (standard tier), `implementer-strong` and
80
- `reviewer` (strong), `eval-runner` and `standard-reader` (standard), `grader` and `searcher` (fast). Each file
87
+ `reviewer` and `grader` (strong), `eval-runner` and `standard-reader` (standard), `searcher` (fast). Each file
81
88
  sets the model (from the `dialecte models` map, as the alias Claude Code accepts: `sonnet`, `opus`,
82
89
  `haiku`) and the tools: the reviewer holds the read tools and Bash (it runs the tests) and no Write or Edit,
83
- the searcher and the grader hold read tools only. The body is a few lines naming the station, the skills to
84
- load and the never-list; it never copies a skill. The files are owned through the manifest: replaced on
90
+ the searcher and the grader hold read tools only. These files are adapters: a station's tier and access
91
+ (`read`, `review`, `edit`) are the cli's, its definition is the `dialecte-lot` skill's `references/stations.md`
92
+ (one `### <station>` section with a `- Tier:` and an `- Access:` line), and the Claude tool names are only the
93
+ Claude form of the access. The body is a few lines naming the station and its section in the installed
94
+ `.claude/skills/dialecte-lot/references/stations.md`, the skills to load and the never-list; it never copies a skill.
95
+ The `eval-runner` and the `grader` read neither the page nor a lot skill (they judge the skill under test): their
96
+ brief carries their definition and names the only skill text they read. `skills check`, in a package shipping `dialecte-lot`, refuses a
97
+ `references/stations.md` that is missing, lacks a station, has an unknown section or a `Tier:` / `Access:` line out of
98
+ line with the cli. The files are owned through the manifest: replaced on
85
99
  every sync, removed when no longer produced, and a file of your own with the same name is reported, never
86
100
  overwritten. `dialecte doctor` warns about a stale or missing one. Other hosts (Copilot / VS Code, Codex,
87
101
  Gemini) get no agent files from this command yet: the tier of each station comes from `dialecte models`
88
102
  there, as the `Tier:` line of a brief says.
89
- - **Session-start check (Claude Code)**: `skills sync` adds a `SessionStart` hook running
103
+ - **Session-start check, every agent**: when `dialecte-lot` is installed by the sync (whatever the targets),
104
+ `skills sync` writes a section in the project's root `AGENTS.md`, between `<!-- dialecte-skills:session-check -->`
105
+ and `<!-- /dialecte-skills:session-check -->`, telling the agent to run `npx --no-install @dialecte/cli doctor --brief`
106
+ at a session start. It is created when there is no `AGENTS.md`, else appended after one blank line (every byte of
107
+ your text stays, line ends included), replaced when an older release wrote another sentence, and removed (with the
108
+ blank line it added, the file deleted when nothing else is left) by `--no-session-check`, `--no-contributing` or
109
+ a sync without `dialecte-lot`. A marker without its pair, or a doubled one, leaves the file alone with a warning.
110
+ An `AGENTS.md` holding only the section is no evidence of a vendor.
111
+ - **Session-start check (Claude Code)**: the same check as an adapter: `skills sync` adds a `SessionStart` hook running
90
112
  `npx --no-install @dialecte/cli doctor --brief` (the installed cli: no download at a session start) to
91
113
  `.claude/settings.json`, inserted by a minimal text edit (the rest of your file stays byte for byte), never
92
114
  duplicated, removed when you drop the claude target. If you edited the hook's text since, removal cuts only
@@ -95,7 +117,8 @@ Every Dialecte package ships the agent skills that describe it in `skills/<name>
95
117
  versions and the station agents are in sync, otherwise one line per problem with its fix, and always exits 0.
96
118
  `--no-session-check` leaves the hook out (and removes the one a sync added). Elsewhere, the `dialecte` skill
97
119
  tells the agent to run `doctor` first.
98
- - **Working on Dialecte**: `npx @dialecte/cli skills sync --from ../` takes them from your local checkouts.
120
+ - **Working on Dialecte**: `npx @dialecte/cli skills sync --from ../ --contributing` takes them from your local
121
+ checkouts, the contributor skills included.
99
122
  - **In a package**: `dialecte skills generate` rewrites the `<!-- dialecte-skills:generated <kind> -->`
100
123
  blocks (`extensions`, `core-methods`, `hooks`, `api`, `intents`) from the source; the `api` block lists
101
124
  the methods, then one section per package entry (each `exports` subpath shipping a `.d.ts`) with the
@@ -123,8 +146,10 @@ Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage
123
146
  whose arguments a caller can copy (written-out values first; never a test case field, a fixture constant
124
147
  or a cast). No such call, no example.
125
148
  - `dialecte members <expression>` (`doc.query`, `doc.query.reference`, `tx.lifecycle.extract`): the
126
- IntelliSense walk on demand, from the live types of the package where it runs. In an app, point it at
127
- the namespace holding your project's types: `--namespace <Name> --entry <module>`.
149
+ IntelliSense walk on demand, from the live types of the package where it runs. In an app it reads the
150
+ installed dialecte (a dependency built on `@dialecte/core` exporting `./<version>` with its `./<version>/test`
151
+ entry: its namespace is its name capitalized, `Scl` from `@dialecte/scl/v2019C1`); with several, it lists them and
152
+ `--package <name>` / `--version <v>` picks one. `--namespace <Name> --entry <module>` override.
128
153
  - `dialecte schema <Tag> [--package <name>]`: parents, children in order with how often each may appear,
129
154
  attributes (required, identity, default, fixed, enumeration, pattern), text, xsi:type variants - read
130
155
  through the readers of the core each installed dialecte depends on (how often a child may appear is core's
@@ -140,9 +165,8 @@ Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage
140
165
  `dialecte skills sync` remembered as `vendor` in `.dialecte-skills.json`, in every skill folder of the
141
166
  project. Sync detects it from the project (`.claude/`, `AGENTS.md` + `.codex/`, `.gemini/`; a folder holding
142
167
  only the skills a sync wrote is no evidence) and asks on a terminal when several agents, a multi-vendor host
143
- (Copilot, Cursor) or none are found. Without a terminal, a first sync that cannot tell (no manifest, nothing detected) exits 2 naming
144
- `--vendor <id>`, which also sets it without asking; a project that already has a manifest and an ambiguous
145
- or empty detection keeps syncing without a vendor and is told how to set it. When manifests disagree, `models` warns on stderr, naming them, and uses the
168
+ (Copilot, Cursor) or none are found. Without a terminal, a sync that cannot tell installs the skills without a vendor (`models` stays
169
+ unset: the skills need none) and says how to set it: `--vendor <id>`, which also sets it without asking. When manifests disagree, `models` warns on stderr, naming them, and uses the
146
170
  most recently written; an unknown vendor id in a manifest is ignored with a warning. Exit 1 for an unknown
147
171
  `--vendor`, 2 when no vendor is known.
148
172
 
@@ -218,6 +242,22 @@ the answer.
218
242
  whatever the store holds. The key leaves out the Node version and the environment (a path given
219
243
  through an environment variable); a `file:` dependency edited and restored to the same size within
220
244
  the same modification time is not seen either.
245
+ - `dialecte gate --hook [--no-reuse]` runs in a commit hook: the test steps of `--full` (its steps counting
246
+ tests), unless a green `--full` record of what is committed answers them. Its key is the one a `--full` run of
247
+ that state stores - the tree, what npm installed, the `file:` dependencies, the full gate's command hash - with
248
+ the tree taken from the index git hands the hook (`GIT_INDEX_FILE`, else the worktree's index), never from the
249
+ working files: a merge commit and a partial commit check what they record. A green record of that key prints
250
+ one line, `gate --hook: tests reused from gate --full green on tree <tree> at <time> (HEAD <sha>)`, and runs
251
+ nothing; otherwise `gate --hook: no green gate --full of tree <tree> with this install: running the tests`, the
252
+ test steps (rerun serially on a failure, as the gate does), then one vitest summary line of their summed counts (what the hand-over's hook reader counts),
253
+ and `gate --hook: green` or `gate --hook: failed at <step>` (exit 1). It runs no hygiene and no tdd step,
254
+ reads no hand-over hold (it runs inside `handover run`'s own commit) and records nothing: `handover run`
255
+ records the hook. `--no-reuse` runs the tests whatever the store holds, and so does a hook whose git variables name another
256
+ repository than its folder's (the cli ignores them, so what is committed is unknown); `--hook` with `--fast` or `--full` is
257
+ refused (exit 2). Write it in the hook as an npm script (`"test:hook": "dialecte gate --hook"`), so the
258
+ hand-over reads it as a test step of its own: its card line reads `reused by the hook` when the hook answered
259
+ from a record. The cli's own hook runs `npm run check` (type-check, lint, format; no suite), `npm run
260
+ test:hook`, then `npm run build`.
221
261
  - A running step looks running. Each `gate` step and `tdd`'s vitest run is announced before its work:
222
262
  off a terminal a start line `▶ <step>` (then a line every 30 s of silence and the result), on a
223
263
  terminal one spinner line `⠋ <step> - <what runs> <elapsed>` that the step's result line replaces (the
@@ -843,6 +883,7 @@ A package tunes them in its package.json:
843
883
  },
844
884
  "generatedDocs": [".vitepress/data/elements-catalog.json"],
845
885
  "referencePatterns": ["SPEC-[0-9]+"],
886
+ "allowReferences": ["ticket number"],
846
887
  "baseBranch": "main"
847
888
  }
848
889
  ```
@@ -852,7 +893,11 @@ when it counts no test; `changedOnly: true` marks a step that runs only the test
852
893
  so "No test files found" passes with a note instead of failing; `restoresGeneratedDocs: true` restores the `generatedDocs` byte for byte after
853
894
  it); `baseBranch` is the branch
854
895
  `worktree add` starts from and `worktree prune` compares with (default `main`); `referencePatterns` adds the package's own patterns (extended regular expressions) to the plan
855
- tags and citations `rules` and `handover` refuse.
896
+ tags and citations `rules` and `handover` refuse; `allowReferences` lifts the generic tags the package commits on
897
+ purpose - `ticket number`, `acceptance criterion`, `plan tag` (an app that cites its issue numbers) - and
898
+ refuses any other label: a citation of a standard is never allowed. A lot may hold a symbolic link, a link to a
899
+ folder included: it is hashed and scanned as its target text and committed as a link, the way git stores it (a
900
+ rehearsal copies it as the same relative link).
856
901
 
857
902
  ### GitHub text: recap and text check
858
903
 
@@ -1041,9 +1086,12 @@ lockfile). Build core there (`npm run build`) before running the tests. A releas
1041
1086
  per dependency (its field, name and spec), and says how to pin it
1042
1087
  (`npm install --save-exact <name>@<version>`).
1043
1088
 
1044
- The cli has a commit hook: `.husky/pre-commit` runs `npm run check`, then `npm run build`. `npm install` in the
1089
+ The cli has a commit hook: `.husky/pre-commit` runs `npm run check` (type-check, lint, format; no suite), then
1090
+ `npm run test:hook` (`dialecte gate --hook` from the sources: the suite, unless a green `gate --full` of the
1091
+ committed tree answers it), then `npm run build`. `npm install` in the
1045
1092
  cli checkout activates it (`"prepare": "husky"` sets `core.hooksPath` to `.husky/_`), and `dialecte worktree add`
1046
- copies `.husky/_` into each new worktree, so `handover run` proves a cli lot again at its commit. A hook
1093
+ copies `.husky/_` into each new worktree, so `handover run` proves a cli lot again at its commit, running the
1094
+ suite only for a tree no green `gate --full` checked. A hook
1047
1095
  runs with git's `GIT_DIR`, `GIT_INDEX_FILE` and the commit's identity set: the suite's setup file
1048
1096
  (`test/git-environment.setup.ts`, vitest `setupFiles`) clears them before any test, so a test's git acts on
1049
1097
  its scratch repository only, and the cli clears git's repository variables at its start.