@nimiplatform/nimi-coding 0.3.1 → 0.4.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 +23 -0
- package/CONTRIBUTING.md +3 -3
- package/README.md +285 -41
- package/README.zh-CN.md +294 -31
- package/bin/nimicoding.mjs +1 -1
- package/cli/commands/authority.mjs +849 -0
- package/cli/commands/clear.mjs +27 -7
- package/cli/commands/doctor.mjs +10 -1
- package/cli/commands/start.mjs +23 -27
- package/cli/commands/sync.mjs +21 -101
- package/cli/constants.mjs +7 -31
- package/cli/dev/check-authority-surface.mjs +173 -0
- package/cli/dev/check-product-conformance.mjs +917 -0
- package/cli/help.mjs +10 -17
- package/cli/index.mjs +6 -47
- package/cli/lib/authority/anchors.mjs +491 -0
- package/cli/lib/authority/audit.mjs +490 -0
- package/cli/lib/authority/closed-sets.mjs +646 -0
- package/cli/lib/authority/compile.mjs +110 -0
- package/cli/lib/authority/consumers.mjs +470 -0
- package/cli/lib/authority/diagnostics.mjs +87 -0
- package/cli/lib/authority/diff.mjs +287 -0
- package/cli/lib/authority/discover.mjs +447 -0
- package/cli/lib/authority/evidence-snapshot.mjs +1 -0
- package/cli/lib/authority/evidence.mjs +1432 -0
- package/cli/lib/authority/format.mjs +197 -0
- package/cli/lib/authority/git-snapshot.mjs +1065 -0
- package/cli/lib/authority/graph.mjs +351 -0
- package/cli/lib/authority/impact.mjs +252 -0
- package/cli/lib/authority/lexicon.mjs +55 -0
- package/cli/lib/authority/query.mjs +162 -0
- package/cli/lib/authority/repository-corpus.mjs +37 -0
- package/cli/lib/authority/repository-inventory.mjs +34 -0
- package/cli/lib/authority/review.mjs +222 -0
- package/cli/lib/authority/sarif.mjs +181 -0
- package/cli/lib/authority/scope-bindings.mjs +225 -0
- package/cli/lib/authority/source-map.mjs +105 -0
- package/cli/lib/authority/source-markdown.mjs +167 -0
- package/cli/lib/authority/source-yaml.mjs +312 -0
- package/cli/lib/authority/surface.mjs +79 -0
- package/cli/lib/authority/terms.mjs +421 -0
- package/cli/lib/authority/tracked-text.mjs +70 -0
- package/cli/lib/authority/validate.mjs +308 -0
- package/cli/lib/bootstrap.mjs +55 -71
- package/cli/lib/doctor.mjs +40 -123
- package/cli/lib/entrypoints.mjs +103 -105
- package/cli/lib/fs-helpers.mjs +139 -15
- package/cli/lib/internal/governance/config.mjs +0 -36
- package/cli/lib/shared.mjs +8 -21
- package/cli/lib/sync.mjs +81 -92
- package/cli/lib/value-helpers.mjs +0 -26
- package/cli/lib/yaml-helpers.mjs +1 -124
- package/cli/seeds/bootstrap.mjs +31 -87
- package/cli/seeds/seed-policy.yaml +9 -63
- package/contracts/authority-evidence-bindings.schema.yaml +53 -0
- package/contracts/authority-evidence-probe-results.schema.yaml +38 -0
- package/contracts/authority-impact-dispositions.schema.yaml +13 -0
- package/contracts/authority-scope-bindings.schema.yaml +15 -0
- package/contracts/authority-source.schema.yaml +64 -0
- package/contracts/authority-verifier-bindings.schema.yaml +20 -0
- package/methodology/authority-authoring.yaml +144 -0
- package/methodology/core.yaml +31 -26
- package/package.json +10 -6
- package/spec/authority-anchors.yaml +99 -0
- package/spec/authority-audit.yaml +85 -0
- package/spec/authority-authoring.yaml +150 -0
- package/spec/authority-closed-sets.yaml +65 -0
- package/spec/authority-consumers.yaml +70 -0
- package/spec/authority-context.yaml +50 -0
- package/spec/authority-discovery.yaml +119 -0
- package/spec/authority-evidence.yaml +200 -0
- package/spec/authority-graph.yaml +59 -0
- package/spec/authority-impact.yaml +84 -0
- package/spec/authority-review.yaml +89 -0
- package/spec/authority-terms.yaml +59 -0
- package/spec/product-scope.yaml +36 -23
- package/cli/commands/blueprint-audit.mjs +0 -91
- package/cli/commands/classify-spec-tree.mjs +0 -5
- package/cli/commands/generate-spec-derived-docs.mjs +0 -151
- package/cli/commands/generate-spec-migration-plan.mjs +0 -30
- package/cli/commands/surface-validator-command.mjs +0 -49
- package/cli/commands/validate-domain-admission.mjs +0 -5
- package/cli/commands/validate-guidance-bodies.mjs +0 -5
- package/cli/commands/validate-placement.mjs +0 -5
- package/cli/commands/validate-projection-edges.mjs +0 -5
- package/cli/commands/validate-spec-audit.mjs +0 -27
- package/cli/commands/validate-spec-governance.mjs +0 -144
- package/cli/commands/validate-spec-tree.mjs +0 -27
- package/cli/commands/validate-table-family.mjs +0 -5
- package/cli/commands/validate-tracked-output-admission.mjs +0 -5
- package/cli/lib/blueprint-audit.mjs +0 -363
- package/cli/lib/contracts.mjs +0 -21
- package/cli/lib/internal/contracts-loaders.mjs +0 -47
- package/cli/lib/internal/contracts-parse.mjs +0 -192
- package/cli/lib/internal/governance/runner.mjs +0 -35
- package/cli/lib/internal/surface-taxonomy-validators.mjs +0 -1147
- package/cli/lib/internal/validators-shared.mjs +0 -12
- package/cli/lib/internal/validators-spec-helpers.mjs +0 -52
- package/cli/lib/internal/validators-spec.mjs +0 -380
- package/cli/lib/validators.mjs +0 -30
- package/config/bootstrap.yaml +0 -6
- package/config/spec-generation-inputs.yaml +0 -41
- package/contracts/domain-admission.schema.yaml +0 -56
- package/contracts/migration-inventory.schema.yaml +0 -15
- package/contracts/negative-fixtures.yaml +0 -26
- package/contracts/placement-contract.schema.yaml +0 -127
- package/contracts/projection-edge.schema.yaml +0 -46
- package/contracts/shared-enums.yaml +0 -63
- package/contracts/spec-generation-audit.schema.yaml +0 -46
- package/contracts/spec-generation-inputs.schema.yaml +0 -43
- package/contracts/spec-layout.schema.yaml +0 -32
- package/contracts/surface-taxonomy.schema.yaml +0 -139
- package/contracts/table-family.schema.yaml +0 -133
- package/contracts/tracked-output-admission.schema.yaml +0 -17
- package/methodology/four-closure-policy.yaml +0 -20
- package/methodology/role-separation-policy.yaml +0 -22
- package/methodology/spec-reconstruction.yaml +0 -69
- package/spec/_meta/spec-tree-model.yaml +0 -44
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.4.0
|
|
6
|
+
|
|
7
|
+
- Added bounded fail-closed `authority anchors` validation for closed lexical file/script anchors and optional tracked-file scope globs against an exact Git repository root.
|
|
8
|
+
- Added optional fail-closed `authority check --scope-bindings <file>` enforcement for exact bidirectional registration of active-rule scopes without repository path resolution.
|
|
9
|
+
- Added strict single-unit Canonical Markdown and closed multi-unit Canonical YAML `authority fmt`, `authority check`, and package-private deterministic compilation with SourceMaps.
|
|
10
|
+
- Added `nimicoding.authority/v2` container defaults plus deterministic `fmt --upgrade` from v1 while retaining v1 only as an explicit migration and history-facing input.
|
|
11
|
+
- Hard-cut read-only fail-closed `authority discover` to `nimicoding.authority-discovery/v2`, adding singular exact kind/owner/scope/lifecycle filters, SourceMapped deterministic normalized-term snippets, and an optional complete M1 direct-authored relation preview; the ranking tuple is unchanged, and the product never selects authority, supplies context, or performs semantic search.
|
|
12
|
+
- Added exact-ID `authority query` and complete fail-closed bounded `authority context` over admitted compiler products.
|
|
13
|
+
- Added byte-bounded compiler-output `authority diff` and explicit-relation `authority impact` with retained tombstones and fail-closed consumer/test dispositions.
|
|
14
|
+
- Added fail-closed `authority refs`, `authority path`, and `authority subgraph` over explicit admitted relations with portable SourceMap locations, deterministic traversal, and hop/unit/edge/UTF-8 byte budgets.
|
|
15
|
+
- Added repository-bound `authority consumers`, `authority terms`, and `authority closed-sets` reports for deterministic spec-consumption inventory, exact identifier cross-reference, and paired closed-vocabulary drift detection.
|
|
16
|
+
- Added project-bound deterministic `authority audit` with governance-bound observations/findings, required-coverage gaps, stable fingerprints, and SARIF 2.1.0 projection.
|
|
17
|
+
- Added Git-aware exact `authority review`: one immutable base commit and one race-checked current worktree snapshot compose the existing compiler, diff, impact, and current-audit products without changing Git or authority.
|
|
18
|
+
- Added machine-first current-worktree `authority evidence` with exact authority/package-script/test-target bindings, independent content identities, a closed static `package-script-target-reachability/v1` probe, and identity-bound external supplied results; it executes nothing and always leaves conformance not evaluated.
|
|
19
|
+
- Corrected public CLI pipe flushing so large JSON diagnostics and bounded semantic payloads complete before process exit.
|
|
20
|
+
- Hard-cut the legacy reconstruction, taxonomy, table, generation-audit, placement, and spec-governance command plane; `authority check` is now the sole `.nimi/spec` conformance gate.
|
|
21
|
+
- Contracted bootstrap/sync to one exact compact-guide projection plus managed instruction blocks; unrelated host files are ignored and exact deprecated projection paths fail closed.
|
|
22
|
+
- Retained `validate-ai-governance` only as optional L3 repository governance, separate from authority admission and host task execution.
|
|
23
|
+
- Hardened managed project paths with no-follow/shared-inode preflight, fatal UTF-8 host-envelope reads, strict managed-block topology, exact-span clear behavior, and effective-final `.gitignore` rule matching; failed preflight performs no managed mutation.
|
|
24
|
+
- Added behavioural product-conformance gates that verify the repository-bound command contracts against worktree and packed-package implementations.
|
|
25
|
+
|
|
3
26
|
## 0.3.1
|
|
4
27
|
|
|
5
28
|
- Made `validate-spec-governance --scope all` fail closed on the canonical spec tree before running project-configured checks.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Contributing
|
|
2
2
|
|
|
3
|
-
Nimi Coding accepts changes to methodology,
|
|
3
|
+
Nimi Coding accepts changes to canonical-authority methodology, formatter/compiler primitives, exact managed projections, deterministic authority gates, and optional L3 repository checks. Historical-format reconstruction, product-semantic generation, AI-host control, provider execution, task-state management, and review-state management are outside this package.
|
|
4
4
|
|
|
5
5
|
Before opening a change:
|
|
6
6
|
|
|
@@ -11,6 +11,6 @@ pnpm check:pack
|
|
|
11
11
|
pnpm check:ci
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Contract changes must update their parser or validator, negative cases, documentation, and package projection tests together. Do not add
|
|
14
|
+
Contract changes must update their parser or validator, negative cases, documentation, and package projection tests together. Do not add historical-format compatibility; Git history is the recovery evidence.
|
|
15
15
|
|
|
16
|
-
Never commit `.nimi/local/**`,
|
|
16
|
+
Never commit `.nimi/local/**`, credentials, provider transcripts, or private repository evidence.
|
package/README.md
CHANGED
|
@@ -1,64 +1,308 @@
|
|
|
1
1
|
# Nimi Coding
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Deterministic authority for AI coding systems and third-party extensions.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Nimi Coding turns project-owned normative specifications into stable identities, exact source locations, authored relations, and bounded fail-closed machine products. AI hosts, agent frameworks, CI systems, editor tooling, and third-party extensions can use those products to discover authority, assemble evidence, navigate relationships, and review exact changes without treating model inference as repository truth.
|
|
8
|
+
|
|
9
|
+
Most end users should not need to invoke `nimicoding` directly. The primary integration surface is the documented CLI and its purpose-specific JSON products. Nimi Coding is not an AI agent, planner, code generator, approval workflow, or universal specification language.
|
|
10
|
+
|
|
11
|
+
## Why it exists
|
|
12
|
+
|
|
13
|
+
AI models are good at generating code. They are less reliable at determining which document is authoritative, whether a search result is complete, how a rule moved across files, which declared relationships a change affects, or whether available evidence actually proves conformance.
|
|
14
|
+
|
|
15
|
+
Nimi Coding makes those questions explicit:
|
|
16
|
+
|
|
17
|
+
| AI coding problem | Nimi Coding control |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Several documents appear authoritative | One closed canonical authority boundary |
|
|
20
|
+
| Paths and headings change | Stable logical unit IDs independent of files and order |
|
|
21
|
+
| Search returns noisy or truncated context | Bounded discovery, exact query, declared context, and graph products |
|
|
22
|
+
| A model cannot cite the exact source | Portable field- and relation-level SourceMap locations |
|
|
23
|
+
| Textual diffs obscure semantic change | Stable-ID semantic diff and declared impact obligations |
|
|
24
|
+
| “No result” is presented as “clean” | Explicit budgets, completeness, gaps, refusal, and failure semantics |
|
|
25
|
+
| A Git review may mix moving inputs | Immutable base OID plus race-checked complete worktree capture |
|
|
26
|
+
| A file or test name is treated as proof | Evidence and conformance are separate product states |
|
|
27
|
+
|
|
28
|
+
## Product model
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
Project-owned canonical authority
|
|
32
|
+
.nimi/spec/**/*.authority.{yaml,md}
|
|
33
|
+
│
|
|
34
|
+
▼
|
|
35
|
+
Authority Foundation
|
|
36
|
+
fmt · check · compile CLI over private AuthorityIR/SourceMap
|
|
37
|
+
│
|
|
38
|
+
▼
|
|
39
|
+
Spec Intelligence Plane
|
|
40
|
+
discover · query · context · refs/path/subgraph
|
|
41
|
+
diff · impact · audit · review · evidence
|
|
42
|
+
│
|
|
43
|
+
▼
|
|
44
|
+
Purpose-specific JSON / human output / SARIF (audit only)
|
|
45
|
+
│
|
|
46
|
+
▼
|
|
47
|
+
AI hosts · third-party extensions · CI · future editor/UI surfaces
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Projects own all product meaning. Nimi Coding admits, locates, relates, and derives bounded products from that meaning; it does not invent it. OpenAPI, JSON Schema, Protobuf, tests, ADRs, and design documents remain the right tools for specialized structure, executable verification, rationale, examples, and diagrams.
|
|
51
|
+
|
|
52
|
+
## What works today
|
|
53
|
+
|
|
54
|
+
| Layer | Current capability | Truth boundary |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Authority Foundation | Canonical YAML/Markdown, formatter, complete-root check, private deterministic compiler and SourceMap | Unknown or unsupported canonical input is rejected, not ignored |
|
|
57
|
+
| Discovery and exact reads | Exact kind/owner/scope/lifecycle filters, normalized lexical snippets, optional direct relation preview, exact query, bounded declared context | No semantic search, automatic authority selection, or absence proof |
|
|
58
|
+
| Graph navigation | Incoming/outgoing refs, deterministic paths, bounded subgraphs over `applies_to` and `supersedes` | Only authored relations; no inferred semantic graph |
|
|
59
|
+
| Change intelligence | Stable-ID semantic diff and relation-derived impact obligations | Impact is a review requirement, not synchronization proof |
|
|
60
|
+
| Deterministic audit | Project-owned verifier bindings, observations/findings/required gaps, JSON and SARIF 2.1.0 | The current built-in detector is a narrow governance verifier, not a natural-language contradiction engine |
|
|
61
|
+
| Git-aware review | Immutable base commit plus exact, race-checked current worktree snapshot composed through compile/diff/impact/audit | Read-only; not branch, PR, approval, or release orchestration |
|
|
62
|
+
| Authority-to-code evidence | Exact authority/scope to declared package-script command/test target reachability | Static narrow slice only; commands/tests are not executed and completed evidence leaves conformance `not_evaluated` |
|
|
63
|
+
|
|
64
|
+
The current Nimi-realm validation corpus contains 38 canonical containers, 793 authority units, and 1,260 authored relations. Those figures demonstrate a real large-corpus replay; they are not package limits or a claim that the grammar covers every possible domain.
|
|
65
|
+
|
|
66
|
+
## Five-minute adoption path
|
|
67
|
+
|
|
68
|
+
Install and initialize the package:
|
|
8
69
|
|
|
9
70
|
```bash
|
|
10
71
|
pnpm add -D @nimiplatform/nimi-coding
|
|
11
72
|
pnpm exec nimicoding start --yes
|
|
12
73
|
```
|
|
13
74
|
|
|
14
|
-
|
|
75
|
+
`start` creates the compact AI-visible authoring guide, managed instruction blocks in `AGENTS.md` and `CLAUDE.md`, and the ignored `.nimi/local/` root. It does not generate product semantics or create `.nimi/spec` for the project.
|
|
76
|
+
|
|
77
|
+
Author a complete canonical source such as `.nimi/spec/checkout.authority.yaml`:
|
|
15
78
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
79
|
+
```yaml
|
|
80
|
+
format: nimicoding.authority/v2
|
|
81
|
+
owner: team.checkout
|
|
82
|
+
scope: api.checkout
|
|
83
|
+
units:
|
|
84
|
+
- id: definition.checkout-session
|
|
85
|
+
kind: definition
|
|
86
|
+
title: Checkout session
|
|
87
|
+
meaning: A server-owned session representing an active checkout.
|
|
88
|
+
- id: rule.checkout-session
|
|
89
|
+
kind: rule
|
|
90
|
+
title: Checkout requires a server-owned session
|
|
91
|
+
modality: must
|
|
92
|
+
statement: Checkout operations use a server-owned checkout session.
|
|
93
|
+
condition: Whenever a checkout operation begins.
|
|
94
|
+
failure: Reject the operation.
|
|
95
|
+
relations:
|
|
96
|
+
- type: applies_to
|
|
97
|
+
target: definition.checkout-session
|
|
98
|
+
```
|
|
20
99
|
|
|
21
|
-
|
|
100
|
+
> The example is the current v2 authoring format: the container carries `owner` and a single `scope`, and units omit `lifecycle` and empty `relations`. `nimicoding.authority/v1` is a migration input only -- `fmt --upgrade` reads it and emits v2, and history-facing commands still read it -- not a format to author in.
|
|
22
101
|
|
|
23
|
-
|
|
102
|
+
Format changed files, admit the complete root, and query one exact unit:
|
|
24
103
|
|
|
25
104
|
```bash
|
|
26
|
-
|
|
27
|
-
pnpm exec nimicoding
|
|
28
|
-
pnpm exec nimicoding
|
|
29
|
-
pnpm exec nimicoding sync --apply
|
|
30
|
-
pnpm exec nimicoding doctor --json
|
|
31
|
-
pnpm exec nimicoding clear --yes
|
|
32
|
-
|
|
33
|
-
# Spec construction evidence
|
|
34
|
-
pnpm exec nimicoding blueprint-audit --json
|
|
35
|
-
pnpm exec nimicoding classify-spec-tree --root .nimi/spec --json
|
|
36
|
-
pnpm exec nimicoding generate-spec-migration-plan --root .nimi/spec --json
|
|
37
|
-
pnpm exec nimicoding generate-spec-derived-docs --profile nimi --scope spec-human-doc
|
|
38
|
-
|
|
39
|
-
# Deterministic validation
|
|
40
|
-
pnpm exec nimicoding validate-spec-tree -- .nimi/spec
|
|
41
|
-
pnpm exec nimicoding validate-spec-audit -- .nimi/local/state/spec-generation/spec-generation-audit.yaml
|
|
42
|
-
pnpm exec nimicoding validate-placement --profile nimi --root .nimi/spec
|
|
43
|
-
pnpm exec nimicoding validate-table-family --profile nimi --root .nimi/spec
|
|
44
|
-
pnpm exec nimicoding validate-projection-edges --profile nimi --root .nimi/spec
|
|
45
|
-
pnpm exec nimicoding validate-guidance-bodies --profile nimi --root .nimi/spec
|
|
46
|
-
pnpm exec nimicoding validate-domain-admission --profile nimi --root .nimi/spec
|
|
47
|
-
pnpm exec nimicoding validate-tracked-output-admission --profile nimi --root .nimi/spec
|
|
48
|
-
pnpm exec nimicoding validate-spec-governance --profile nimi --scope all
|
|
49
|
-
pnpm exec nimicoding validate-ai-governance --profile nimi --scope all
|
|
105
|
+
pnpm exec nimicoding authority fmt .nimi/spec/checkout.authority.yaml
|
|
106
|
+
pnpm exec nimicoding authority check .nimi/spec --json
|
|
107
|
+
pnpm exec nimicoding authority query .nimi/spec rule.checkout-session --max-bytes 32768 --json
|
|
50
108
|
```
|
|
51
109
|
|
|
52
|
-
`
|
|
110
|
+
`authority check` on the complete root is the sole .nimi/spec conformance gate. Formatting a file does not admit its semantics, and checking only a changed file cannot replace the complete-root check. When `--scope-bindings <file>` is supplied, check also requires an exact bidirectional match between registered scopes and active-rule scope use; it validates binding declarations without resolving repository paths.
|
|
111
|
+
|
|
112
|
+
### Static authority anchors
|
|
113
|
+
|
|
114
|
+
`authority anchors` performs bounded, read-only lexical validation against one exact Git worktree root:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm exec nimicoding authority anchors . \
|
|
118
|
+
--spec .nimi/spec \
|
|
119
|
+
--scope-bindings .nimi/config/authority-scope-bindings.yaml \
|
|
120
|
+
--max-units 1024 \
|
|
121
|
+
--max-anchors 4096 \
|
|
122
|
+
--max-bytes 2097152 \
|
|
123
|
+
--json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The anchor grammar is closed and case-sensitive. A **token** is one maximal non-whitespace sequence; punctuation attached without whitespace remains part of that token.
|
|
127
|
+
|
|
128
|
+
- **Class A — file path:** a token containing at least one `/` and ending exactly in one of `.mjs`, `.js`, `.ts`, `.tsx`, `.rs`, `.go`, `.yaml`, `.yml`, `.md`, `.json`, `.proto`, or `.ps1`. Tokens beginning with `~` (including `~/`), `/`, an ASCII-letter Windows drive prefix such as `C:\` or `C:/`, or `\\` (UNC) are excluded by deterministic prefix checks because they denote runtime or host paths rather than repository paths. Every admitted token must equal a path returned by the repository-root `git ls-files` tracked-file inventory. There is no path normalization, prefix removal, or inferred match.
|
|
129
|
+
- **Class B — package script:** the token `pnpm`, exactly one ASCII space, then one maximal non-whitespace script-name token. The name is admitted when it contains `:` or fully matches `[a-z][a-z0-9:-]*`; pnpm builtins `add`, `audit`, `create`, `dlx`, `exec`, `install`, `link`, `list`, `outdated`, `patch`, `publish`, `remove`, `run`, `update`, and `why` are excluded before exact own-key resolution against the root `package.json` `scripts` object. Nothing is executed.
|
|
130
|
+
|
|
131
|
+
Only active-unit `meaning`, `statement`, `condition`, and `failure` fields are scanned. With `--scope-bindings`, every `path_glob` must match at least one tracked file; `*` excludes `/`, `?` matches one non-`/` character, and `**` crosses path segments. `module` and `command` bindings remain structure-only in this version. Human and JSON results report `{units, anchorsChecked, diagnostics}`; anchor diagnostics are ordered by unit ID, anchor text, field, and class and identify the exact unit and field. Unit, anchor, and compact UTF-8 result-byte budgets reject the whole validation rather than truncating it.
|
|
132
|
+
|
|
133
|
+
Canonical YAML is a closed `format` plus non-empty `units` container. Canonical Markdown is a strict single-unit profile. The model is intentionally compact: `Rule` and `Definition`, `active` and `removed`, `must` and `must_not`, plus authored `applies_to` and linear `supersedes` relations.
|
|
134
|
+
|
|
135
|
+
If a domain needs member-level API, schema, enum, state-machine, formula, or catalog structure that this grammar does not support, keep that precision in a specialized artifact outside the canonical grammar. Connect it only through an explicitly admitted project binding or adapter; the current built-in evidence slice supports package-script targets, not general API, schema, consumer, or runtime integration. Do not add arbitrary canonical fields: unknown fields fail closed so that no consumer can silently ignore intended authority.
|
|
136
|
+
|
|
137
|
+
## AI host and extension journey
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
Task has no exact authority ID
|
|
141
|
+
→ discover bounded lexical candidates
|
|
142
|
+
→ host or project authority chooses an exact ID
|
|
143
|
+
→ query/context/refs/path/subgraph
|
|
144
|
+
→ host plans and edits
|
|
145
|
+
→ fmt changed sources + check the complete root
|
|
146
|
+
→ review immutable base versus exact worktree
|
|
147
|
+
(semantic diff + declared impact + current audit)
|
|
148
|
+
→ separately, if configured, inspect current-worktree evidence
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The host owns authority selection, planning, editing, retries, remediation, review state, and completion. Nimi Coding owns request validation, deterministic computation, explicit budgets, exact locations, and honest result boundaries.
|
|
152
|
+
|
|
153
|
+
For machine integration, invoke the CLI with an argument array and consume both its exit status and JSON envelope. Read product-specific operation, completeness, policy, gap, and evidence states; never infer clean from an empty candidate/finding array. Invalid usage or internal failure and a completed-but-blocking or incomplete product have distinct command-specific exits.
|
|
154
|
+
|
|
155
|
+
In a configured Git project, use exact Git-aware review for one composed authority change product:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
pnpm exec nimicoding authority review . \
|
|
159
|
+
--base origin/main \
|
|
160
|
+
--bindings .nimi/config/authority-verifiers.yaml \
|
|
161
|
+
--dispositions .nimi/local/authority-impact-dispositions.yaml \
|
|
162
|
+
--max-units 1024 \
|
|
163
|
+
--max-edges 4096 \
|
|
164
|
+
--max-bytes 2097152 \
|
|
165
|
+
--json
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
This example assumes that the repository already owns valid verifier bindings and impact dispositions, and that `origin/main` resolves to a commit containing `.nimi/spec`. `start` intentionally creates none of those project semantics or governance files.
|
|
169
|
+
|
|
170
|
+
The base ref is resolved once to a full commit OID. The base `.nimi/spec` tree is read from Git objects; the complete current `.nimi/spec` filesystem tree includes tracked unchanged files, edits, deletions, untracked files, and unsupported entries. Capture races, missing objects, invalid corpora, malformed bindings/dispositions, and insufficient budgets refuse the result instead of publishing a mixed or false-clean review. The command never checks out, stashes, resets, stages, commits, or manages a PR.
|
|
171
|
+
|
|
172
|
+
## Comparison: old Nimi, current Nimi Coding, and a mature conventional spec stack
|
|
173
|
+
|
|
174
|
+
“Conventional spec” here means a serious combination of Markdown/ADR, OpenAPI, JSON Schema or Protobuf, tests, and repository conventions—not an artificially weak pile of prose.
|
|
175
|
+
|
|
176
|
+
| Dimension | Pre-refactor Nimi spec system | Current Nimi Coding | Mature conventional spec stack |
|
|
177
|
+
| --- | --- | --- | --- |
|
|
178
|
+
| Authority boundary | Human contracts, tables, generated views, maps, and profile rules required precedence conventions | One closed canonical authority root | Several specialized sources of truth, usually without one cross-format boundary |
|
|
179
|
+
| Reference corpus shape | 144 mixed files: 101 Markdown, 43 YAML, including 33 generated views and 42 tables | 38 canonical containers compiling to 793 stable units | Project-specific and heterogeneous |
|
|
180
|
+
| Identity | Contract IDs, `R-*` anchors, paths, and table rows were not universal | One stable ID per unit, independent of file, order, move, or regroup | Strong inside some formats, inconsistent across formats |
|
|
181
|
+
| Domain-internal precision | Some tables modeled entities, required fields, API operations, Prisma/OpenAPI/service locators directly | Many enum/schema/state/catalog details remain atomic prose inside a Definition | OpenAPI, Schema, Protobuf, and dedicated DSLs are strongest in their domains |
|
|
182
|
+
| Human rationale | Rich contracts and generated guides | Deliberately compact; long rationale belongs outside canonical authority | ADRs and design documents are strongest |
|
|
183
|
+
| Admission | Multiple profile-specific validators and generators | One complete-root, fail-closed admission oracle | Strong per structured format; Markdown and cross-format admission vary |
|
|
184
|
+
| Unknown input | Behavior depended on the consuming profile/tool | Rejected everywhere under the canonical root | Often preserved or silently ignored unless a schema/linter forbids it |
|
|
185
|
+
| Duplication and drift | Human/table/generated/alignment representations could diverge | One canonical unit representation; derived products are rebuildable | Cross-document and cross-format drift remains common |
|
|
186
|
+
| AI retrieval | Search and project-specific projections had duplicate/noisy inputs | Bounded discovery, exact query, and purpose-specific JSON | Full-text/RAG is flexible but completeness and noise vary |
|
|
187
|
+
| Source traceability | Different profiles exposed locations differently | Uniform portable SourceMap for units, fields, and authored relations | Good within individual tools, inconsistent across tools |
|
|
188
|
+
| Relationship graph | Links, maps, custom fields, and Atlas-like projections | One authored, bounded `applies_to`/`supersedes` graph | `$ref`, links, imports, and conventions remain format-specific |
|
|
189
|
+
| Conflict discovery | Custom checks could find project-specific drift | Structural conflicts are deterministic; prose contradictions still require AI/human analysis | Format-local conflicts can be strong; cross-format conflict remains difficult |
|
|
190
|
+
| Semantic change | File diff and generated drift dominated | Stable-ID semantic diff; rename/regroup/format-only changes can be semantic zero | Prose is line-diffed; specialized formats may have excellent domain diff tools |
|
|
191
|
+
| Impact and audit | Project scripts, maps, and team knowledge | Declared relation impact plus project-bound finding/gap semantics | Build graphs, CODEOWNERS, linters, and tests are strong but fragmented |
|
|
192
|
+
| Git review | No unified exact authority snapshot product | Immutable-base, race-checked worktree review | Usually Git diff plus independent format-specific checks |
|
|
193
|
+
| Spec-to-code relationship | Direct paths were detailed but could become stale | A narrow, identity-bound package-script evidence slice exists | Codegen, type checking, and contract tests can be substantially stronger |
|
|
194
|
+
| Executable conformance | Some custom scripts checked specific project facts | Intentionally not claimed by current evidence | High-quality tests and executable contracts are strongest |
|
|
195
|
+
| Ecosystem | Highly project-specific | Stable CLI/JSON products, but no public JS SDK or model/tool standard yet | OpenAPI/Schema/test ecosystems and third-party interoperability are mature |
|
|
196
|
+
| Authoring cost | Multiple representations and generators were expensive | IDs, owners, scopes, lifecycles, and relations require discipline | Lowest during exploration; governance cost rises with corpus size |
|
|
197
|
+
| Best fit | A project-specific integrated spec system | Stable normative authority control alongside a large, AI-consumed estate of specialized specs | Exploration and specialized API/data/behavior contracts |
|
|
198
|
+
|
|
199
|
+
The redesign is not a universal win on every axis. It is a deliberate exchange: current Nimi Coding gains a uniform authority coordinate system, deterministic machine consumption, and exact review semantics, while specialized formats retain domain precision, executable verification, ecosystem maturity, and human explanation.
|
|
200
|
+
|
|
201
|
+
## Comprehensive assessment
|
|
202
|
+
|
|
203
|
+
The current architecture is already a strong substrate for AI coding because it addresses authority identity, retrieval, traceability, change review, and false-clean prevention without depending on a particular model.
|
|
204
|
+
|
|
205
|
+
Three levels of product truth should remain distinct:
|
|
206
|
+
|
|
207
|
+
1. **Strong today:** stable identity, fail-closed admission, exact SourceMap, authored graph navigation, bounded machine products, semantic diff, and exact Git review.
|
|
208
|
+
2. **Improved but incomplete:** locating and tracing the exact inputs for human/AI conflict review, task-context assembly, owner/scope accountability, and spec-to-code traceability. Contradiction judgment itself is not a deterministic product.
|
|
209
|
+
3. **Intentionally not solved:** universal business-semantic completeness, automatic authority selection, executable code conformance, model reasoning, and AI workflow orchestration.
|
|
210
|
+
|
|
211
|
+
The long-term ceiling is high if Nimi Coding standardizes the authority protocol rather than attempting to absorb every domain language. A model-native ecosystem could train AI systems to discover before guessing, resolve exact IDs, distinguish authored facts from inference, honor gaps and completeness, and request review/evidence after edits. Deterministic runtime products must remain the oracle; model familiarity must never replace admission or evidence.
|
|
212
|
+
|
|
213
|
+
## Safety and truth boundaries
|
|
214
|
+
|
|
215
|
+
- Only `*.authority.yaml` and `*.authority.md` under `.nimi/spec/**` are canonical product authority.
|
|
216
|
+
- IDs, relations, owners, and scopes are declared facts. Nimi Coding does not infer relations or organizational truth from prose.
|
|
217
|
+
- `discover` is deterministic lexical candidate retrieval, not semantic search, selection, context assembly, or absence proof.
|
|
218
|
+
- `context` is a complete bounded outgoing interpretation closure, not complete task context.
|
|
219
|
+
- `audit` evaluates explicitly bound deterministic governance checks; it does not prove that all business rules are non-contradictory.
|
|
220
|
+
- `impact` produces declared review obligations; a disposition does not prove implementation or tests are synchronized.
|
|
221
|
+
- `review` audits the captured current snapshot and does not attribute a current finding to the change unless a future product explicitly compares finding fingerprints.
|
|
222
|
+
- Snapshot no-follow hardening is platform-dependent. On `win32`, Node.js does not expose `O_NOFOLLOW`/`O_DIRECTORY`, so snapshot capture uses surrounding `lstat`/`realpath` validation without descriptor-level no-follow guarantees.
|
|
223
|
+
- `evidence` currently proves only declared package-script target reachability. It executes no command or test; every completed evidence product reports `conformanceStatus: not_evaluated`, while refused input returns no evidence product.
|
|
224
|
+
- Raw AuthorityIR, SourceMap internals, and compiler implementation are package-private. There is currently no public JavaScript API (`exports` is empty).
|
|
225
|
+
- `.nimi/local/**` is derived or local evidence, never product authority.
|
|
226
|
+
|
|
227
|
+
## Future roadmap
|
|
228
|
+
|
|
229
|
+
The roadmap is paused at the current validated baseline. The entries below are candidate lanes, not implementation authorization, release promises, or an implied sequence. A future iteration should select one real adopter journey at a time.
|
|
230
|
+
|
|
231
|
+
| Candidate lane | Intended product | Entry condition |
|
|
232
|
+
| --- | --- | --- |
|
|
233
|
+
| Stateless AI tool adapter | Typed tools over current bounded JSON products, potentially via MCP or an extension API | A real host integration demonstrates that direct CLI invocation is insufficient |
|
|
234
|
+
| General M4 API/consumer evidence | API/consumer locators and producer → API → consumer reachability | A real canonical-authority seam exists; no inference from the current package-script slice |
|
|
235
|
+
| D2 IDE/LSP | Live diagnostics, exact-ID navigation/completion, full-snapshot unsaved-buffer overlays | A sustained editor journey justifies a separate delivery unit |
|
|
236
|
+
| D3 local Studio | Read-only unit/graph/diff/impact/audit/evidence exploration | Several real review/exploration journeys are validated first |
|
|
237
|
+
| D4 external semantic candidates | Model/embedding/reranking candidates with provenance and abstention | Lexical/graph shortcomings are measured on an owner-approved task corpus |
|
|
238
|
+
| E1 multi-repository Atlas | Visibility-filtered composition of canonical repository snapshots | Ecosystem repositories, identity, visibility, ownership, and workspace membership are explicit |
|
|
239
|
+
|
|
240
|
+
Conditional work remains separate:
|
|
241
|
+
|
|
242
|
+
- Structured Definitions, replacement DAGs, owner/scope registries, or a public library API require demonstrated authoring/query/consumer loss.
|
|
243
|
+
- Storage, SQLite, cache, or incremental compilation require a real workload to violate a predeclared SLO and profiling to identify repeated parse/index/join as the cause.
|
|
244
|
+
- Version bump, tag, publish, ecosystem activation, and release compatibility are independent release decisions.
|
|
245
|
+
- AI planning, delegation, execution, approval, task state, model/provider orchestration, and inferred model findings do not belong in the core package.
|
|
246
|
+
|
|
247
|
+
## Command reference
|
|
248
|
+
|
|
249
|
+
The current public integration surface is the CLI. All budgets are explicit positive safe integers; a product that cannot fit its required budget refuses rather than truncating a blocking-capable result.
|
|
250
|
+
|
|
251
|
+
| Purpose | Commands |
|
|
252
|
+
| --- | --- |
|
|
253
|
+
| Author and admit | `authority fmt`, `authority check`, `authority compile` |
|
|
254
|
+
| Find and read | `authority discover`, `authority query`, `authority context` |
|
|
255
|
+
| Navigate | `authority refs`, `authority path`, `authority subgraph` |
|
|
256
|
+
| Analyze and review | `authority audit`, `authority diff`, `authority impact`, `authority review` |
|
|
257
|
+
| Validate lexical anchors | `authority anchors` |
|
|
258
|
+
| Connect bounded evidence | `authority evidence` |
|
|
259
|
+
| Project lifecycle | `start`, `sync`, `doctor`, `clear` |
|
|
260
|
+
| Optional L3 repository governance | `validate-ai-governance` |
|
|
261
|
+
|
|
262
|
+
<details>
|
|
263
|
+
<summary>Complete authority command syntax</summary>
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
nimicoding authority fmt <file> [--check] [--upgrade] [--json]
|
|
267
|
+
nimicoding authority check <path> [--scope-bindings <file>] [--require-format <format>] [--json]
|
|
268
|
+
nimicoding authority compile <path> [--json]
|
|
269
|
+
nimicoding authority anchors <repository-path> --spec <corpus-path> [--scope-bindings <file>] [--embedded-paths] --max-units <n> --max-anchors <n> --max-bytes <n> [--json]
|
|
270
|
+
nimicoding authority consumers <repository-path> --spec <corpus-path> [--external-root <scheme>=<path>]... --max-files <n> --max-refs <n> --max-bytes <n> [--json]
|
|
271
|
+
nimicoding authority terms <repository-path> --spec <corpus-path> [--term <t>] [--code] --max-units <n> --max-terms <n> --max-bytes <n> [--json]
|
|
272
|
+
nimicoding authority closed-sets <repository-path> --spec <corpus-path> --max-units <n> --max-sets <n> --max-bytes <n> [--json]
|
|
273
|
+
nimicoding authority discover <path> <query> [--kind <definition|rule>] [--owner <exact-owner>] [--scope <exact-scope>] [--lifecycle <active|removed>] --max-candidates <n> --max-snippet-terms <n> --max-bytes <n> [--preview-direction <incoming|outgoing|both> --relations <comma-separated-relation-types> --max-edges <n>] [--json]
|
|
274
|
+
nimicoding authority query <path> <id> --max-bytes <n> [--json]
|
|
275
|
+
nimicoding authority context <path> <id> --max-units <n> --max-bytes <n> [--json]
|
|
276
|
+
nimicoding authority refs <path> <id> --direction <incoming|outgoing|both> --relations <comma-separated-relation-types> --max-units <n> --max-edges <n> --max-bytes <n> [--json]
|
|
277
|
+
nimicoding authority path <path> <from-id> <to-id> --traversal <directed|incidence> --relations <comma-separated-relation-types> --max-hops <n> --max-units <n> --max-edges <n> --max-bytes <n> [--json]
|
|
278
|
+
nimicoding authority subgraph <path> <id> --direction <incoming|outgoing|both> --relations <comma-separated-relation-types> --depth <n> --max-units <n> --max-edges <n> --max-bytes <n> [--json]
|
|
279
|
+
nimicoding authority audit <path> --bindings <file> --max-units <n> --max-edges <n> --max-bytes <n> [--json|--sarif]
|
|
280
|
+
nimicoding authority diff <before-path> <after-path> --max-bytes <n> [--json]
|
|
281
|
+
nimicoding authority impact <before-path> <after-path> --dispositions <file> --max-bytes <n> [--json]
|
|
282
|
+
nimicoding authority review <repository-path> --base <git-ref> --bindings <file> --dispositions <file> --max-units <n> --max-edges <n> --max-bytes <n> [--json]
|
|
283
|
+
nimicoding authority evidence <repository-path> --bindings <tracked-.nimi/config-path> [--probe-results <.nimi/local-path>] --max-units <n> --max-bindings <n> --max-locators <n> --max-edges <n> --max-input-bytes <n> --max-bytes <n> [--json]
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
</details>
|
|
287
|
+
|
|
288
|
+
Relation types are a non-empty unique subset of the closed set `applies_to,supersedes`; discovery relation preview requires direction, relation types, and edge budget together.
|
|
289
|
+
|
|
290
|
+
<details>
|
|
291
|
+
<summary>Project lifecycle, governance, and global syntax</summary>
|
|
292
|
+
|
|
293
|
+
```text
|
|
294
|
+
nimicoding start [--yes]
|
|
295
|
+
nimicoding sync [--apply|--check|--dry-run] [--json]
|
|
296
|
+
nimicoding clear [--yes]
|
|
297
|
+
nimicoding doctor [--verbose|--json]
|
|
298
|
+
nimicoding validate-ai-governance --profile <profile-id> --scope <all|agents-freshness|context-budget|structure-budget|high-risk-doc-metadata> [--json]
|
|
299
|
+
```
|
|
53
300
|
|
|
54
|
-
|
|
301
|
+
Global presentation options are `--lang en|zh`, `--color`, and `--no-color`.
|
|
55
302
|
|
|
56
|
-
|
|
57
|
-
2. Package methodology and contracts remain package authority and project into `.nimi/{methodology,contracts,config}/**`.
|
|
58
|
-
3. Generated views, audit evidence, and operational state are non-authoritative.
|
|
59
|
-
4. Unknown placement or unresolved semantic ambiguity fails closed.
|
|
303
|
+
</details>
|
|
60
304
|
|
|
61
|
-
|
|
305
|
+
Projection ownership is exact: `start`/`sync` own only their documented managed paths and marked instruction blocks. Files outside those exact managed surfaces are not inspected or modified by projection sync. Optional `validate-ai-governance` remains separate from authority admission and host task execution.
|
|
62
306
|
|
|
63
307
|
## Development
|
|
64
308
|
|