@nimiplatform/nimi-coding 0.3.1 → 0.5.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.
Files changed (115) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/CONTRIBUTING.md +3 -3
  3. package/README.md +297 -41
  4. package/README.zh-CN.md +306 -31
  5. package/bin/nimicoding.mjs +1 -1
  6. package/cli/commands/authority.mjs +804 -0
  7. package/cli/commands/clear.mjs +27 -7
  8. package/cli/commands/doctor.mjs +10 -1
  9. package/cli/commands/start.mjs +23 -27
  10. package/cli/commands/sync.mjs +21 -101
  11. package/cli/constants.mjs +7 -31
  12. package/cli/dev/check-authority-surface.mjs +182 -0
  13. package/cli/dev/check-product-conformance.mjs +889 -0
  14. package/cli/help.mjs +10 -17
  15. package/cli/index.mjs +6 -47
  16. package/cli/lib/authority/anchors.mjs +491 -0
  17. package/cli/lib/authority/audit.mjs +567 -0
  18. package/cli/lib/authority/change-candidates.mjs +807 -0
  19. package/cli/lib/authority/closed-sets.mjs +645 -0
  20. package/cli/lib/authority/compile.mjs +92 -0
  21. package/cli/lib/authority/compiled-snapshot.mjs +143 -0
  22. package/cli/lib/authority/consumers.mjs +520 -0
  23. package/cli/lib/authority/diagnostics.mjs +93 -0
  24. package/cli/lib/authority/diff.mjs +310 -0
  25. package/cli/lib/authority/discover.mjs +447 -0
  26. package/cli/lib/authority/format.mjs +169 -0
  27. package/cli/lib/authority/git-snapshot.mjs +720 -0
  28. package/cli/lib/authority/graph.mjs +351 -0
  29. package/cli/lib/authority/impact.mjs +125 -0
  30. package/cli/lib/authority/lexicon.mjs +55 -0
  31. package/cli/lib/authority/query.mjs +162 -0
  32. package/cli/lib/authority/repository-corpus.mjs +37 -0
  33. package/cli/lib/authority/repository-inventory.mjs +34 -0
  34. package/cli/lib/authority/review.mjs +212 -0
  35. package/cli/lib/authority/sarif.mjs +174 -0
  36. package/cli/lib/authority/scope-bindings.mjs +225 -0
  37. package/cli/lib/authority/source-map.mjs +105 -0
  38. package/cli/lib/authority/source-markdown.mjs +167 -0
  39. package/cli/lib/authority/source-yaml.mjs +308 -0
  40. package/cli/lib/authority/surface.mjs +97 -0
  41. package/cli/lib/authority/terms.mjs +422 -0
  42. package/cli/lib/authority/tracked-text.mjs +70 -0
  43. package/cli/lib/authority/validate.mjs +300 -0
  44. package/cli/lib/bootstrap.mjs +55 -71
  45. package/cli/lib/doctor.mjs +40 -123
  46. package/cli/lib/entrypoints.mjs +104 -105
  47. package/cli/lib/fs-helpers.mjs +139 -15
  48. package/cli/lib/internal/governance/config.mjs +0 -36
  49. package/cli/lib/shared.mjs +8 -21
  50. package/cli/lib/sync.mjs +81 -92
  51. package/cli/lib/value-helpers.mjs +0 -26
  52. package/cli/lib/yaml-helpers.mjs +1 -124
  53. package/cli/seeds/bootstrap.mjs +31 -87
  54. package/cli/seeds/seed-policy.yaml +9 -63
  55. package/contracts/authority-scope-bindings.schema.yaml +15 -0
  56. package/contracts/authority-source.schema.yaml +58 -0
  57. package/contracts/authority-verifier-bindings.schema.yaml +31 -0
  58. package/methodology/authority-authoring.yaml +127 -0
  59. package/methodology/core.yaml +34 -27
  60. package/package.json +10 -6
  61. package/spec/authority-anchors.yaml +99 -0
  62. package/spec/authority-audit.yaml +89 -0
  63. package/spec/authority-authoring.yaml +137 -0
  64. package/spec/authority-change-candidates.yaml +146 -0
  65. package/spec/authority-closed-sets.yaml +65 -0
  66. package/spec/authority-consumers.yaml +77 -0
  67. package/spec/authority-context.yaml +50 -0
  68. package/spec/authority-discovery.yaml +119 -0
  69. package/spec/authority-graph.yaml +59 -0
  70. package/spec/authority-impact.yaml +61 -0
  71. package/spec/authority-review.yaml +71 -0
  72. package/spec/authority-terms.yaml +63 -0
  73. package/spec/product-scope.yaml +37 -23
  74. package/cli/commands/blueprint-audit.mjs +0 -91
  75. package/cli/commands/classify-spec-tree.mjs +0 -5
  76. package/cli/commands/generate-spec-derived-docs.mjs +0 -151
  77. package/cli/commands/generate-spec-migration-plan.mjs +0 -30
  78. package/cli/commands/surface-validator-command.mjs +0 -49
  79. package/cli/commands/validate-domain-admission.mjs +0 -5
  80. package/cli/commands/validate-guidance-bodies.mjs +0 -5
  81. package/cli/commands/validate-placement.mjs +0 -5
  82. package/cli/commands/validate-projection-edges.mjs +0 -5
  83. package/cli/commands/validate-spec-audit.mjs +0 -27
  84. package/cli/commands/validate-spec-governance.mjs +0 -144
  85. package/cli/commands/validate-spec-tree.mjs +0 -27
  86. package/cli/commands/validate-table-family.mjs +0 -5
  87. package/cli/commands/validate-tracked-output-admission.mjs +0 -5
  88. package/cli/lib/blueprint-audit.mjs +0 -363
  89. package/cli/lib/contracts.mjs +0 -21
  90. package/cli/lib/internal/contracts-loaders.mjs +0 -47
  91. package/cli/lib/internal/contracts-parse.mjs +0 -192
  92. package/cli/lib/internal/governance/runner.mjs +0 -35
  93. package/cli/lib/internal/surface-taxonomy-validators.mjs +0 -1147
  94. package/cli/lib/internal/validators-shared.mjs +0 -12
  95. package/cli/lib/internal/validators-spec-helpers.mjs +0 -52
  96. package/cli/lib/internal/validators-spec.mjs +0 -380
  97. package/cli/lib/validators.mjs +0 -30
  98. package/config/bootstrap.yaml +0 -6
  99. package/config/spec-generation-inputs.yaml +0 -41
  100. package/contracts/domain-admission.schema.yaml +0 -56
  101. package/contracts/migration-inventory.schema.yaml +0 -15
  102. package/contracts/negative-fixtures.yaml +0 -26
  103. package/contracts/placement-contract.schema.yaml +0 -127
  104. package/contracts/projection-edge.schema.yaml +0 -46
  105. package/contracts/shared-enums.yaml +0 -63
  106. package/contracts/spec-generation-audit.schema.yaml +0 -46
  107. package/contracts/spec-generation-inputs.schema.yaml +0 -43
  108. package/contracts/spec-layout.schema.yaml +0 -32
  109. package/contracts/surface-taxonomy.schema.yaml +0 -139
  110. package/contracts/table-family.schema.yaml +0 -133
  111. package/contracts/tracked-output-admission.schema.yaml +0 -17
  112. package/methodology/four-closure-policy.yaml +0 -20
  113. package/methodology/role-separation-policy.yaml +0 -22
  114. package/methodology/spec-reconstruction.yaml +0 -69
  115. package/spec/_meta/spec-tree-model.yaml +0 -44
@@ -1,64 +1,10 @@
1
- policy_id: nimicoding.seed-projection.v1
2
- description: |
3
- Single source of truth for how nimi-coding package source is projected into
4
- a host project's .nimi/** bootstrap surface. Every entry under the declared
5
- source dirs is projected unless excluded; per-path ownership overrides
6
- control whether the projected file stays package-canonical (refresh on sync,
7
- drift is an error) or only carries the initial seed (host owns drift).
8
-
1
+ policy_id: nimicoding.seed-projection.v3
2
+ description: Exact downstream projection registry for canonical authority authoring.
9
3
  projections:
10
- - source_dir: config
11
- output_dir: .nimi/config
12
- - source_dir: contracts
13
- output_dir: .nimi/contracts
14
- - source_dir: methodology
15
- output_dir: .nimi/methodology
16
-
17
- default_ownership: package_canonical
18
-
19
- ownership_semantics:
20
- package_canonical:
21
- initial_seed: true
22
- refresh_on_sync: true
23
- drift_is_error: true
24
- description: |
25
- Package source is canonical truth. nimicoding sync --apply rewrites
26
- drifted host copies. nimicoding sync --check exits non-zero on any
27
- drift or missing entry. doctor performs byte comparison.
28
- host_state_seed:
29
- initial_seed: true
30
- refresh_on_sync: false
31
- drift_is_error: false
32
- description: |
33
- Package ships an initial seed, but host owns the canonical content
34
- after first install. nimicoding sync --apply only writes when the
35
- host file is missing. Drift never fails sync or doctor.
36
- host_profile_override:
37
- initial_seed: true
38
- refresh_on_sync: false
39
- drift_is_error: false
40
- description: |
41
- Package ships the generic default, but an admitted host profile may own
42
- the canonical content after bootstrap. nimicoding sync --apply only
43
- writes when the host file is missing. Drift never fails sync or doctor.
44
-
45
- ownership_overrides:
46
- - path: .nimi/config/spec-generation-inputs.yaml
47
- ownership: host_state_seed
48
- reason: |
49
- spec-generation-inputs carries host-specific reconstruction inputs
50
- (code_roots, docs_roots, human_note_paths, blueprint refs). Package
51
- only seeds the initial template; once the host populates real input
52
- paths, sync --apply must not overwrite them.
53
- - path: .nimi/contracts/domain-admission.schema.yaml
54
- ownership: host_profile_override
55
- reason: |
56
- domain-admission is host-profile-specific. The package owns the generic
57
- default project skeleton, while a product host such as Nimi owns its
58
- admitted product domain list.
59
- - path: .nimi/methodology/spec-reconstruction.yaml
60
- ownership: host_profile_override
61
- reason: |
62
- spec-reconstruction declares host-specific required output domains and
63
- generation shape. The package owns the generic default project skeleton,
64
- while a product host may own a more specific reconstruction profile.
4
+ - source: methodology/authority-authoring.yaml
5
+ output: .nimi/methodology/authority-authoring.yaml
6
+ ownership: package_canonical
7
+ downstream_consumer: project AI reads the compact canonical authority authoring guide
8
+ deprecated_projections:
9
+ - .nimi/config/spec-generation-inputs.yaml
10
+ - .nimi/contracts/domain-admission.schema.yaml
@@ -0,0 +1,15 @@
1
+ version: 1
2
+ contract:
3
+ id: nimicoding.scope-bindings.v1
4
+ owner: nimi-coding
5
+ visibility: package_internal
6
+ format: nimicoding.scope-bindings/v1
7
+ fields:
8
+ top: [format, scopes]
9
+ scope: [scope, bindings]
10
+ binding: [kind, value]
11
+ binding_kinds: [path_glob, module, command]
12
+ text_values:
13
+ unicode: well_formed_scalar_sequence
14
+ non_empty: true
15
+ line_break_code_points: [U+000A, U+000B, U+000C, U+000D, U+0085, U+2028, U+2029]
@@ -0,0 +1,58 @@
1
+ version: 1
2
+ contract:
3
+ id: nimicoding.authority-source.v2
4
+ owner: nimi-coding
5
+ visibility: package_internal
6
+ format: nimicoding.authority/v2
7
+ file_suffixes: [.authority.yaml, .authority.md]
8
+ yaml_document:
9
+ allowed_fields: [format, owner, scope, units]
10
+ required_fields: [format, units]
11
+ container_defaults:
12
+ owner: applies_to_every_unit_that_omits_owner
13
+ scope: one_scope_value_applied_to_every_active_rule_that_omits_scope
14
+ definitions_do_not_inherit_scope: true
15
+ unit_omission_defaults:
16
+ lifecycle: active
17
+ relations: []
18
+ both_levels_absent: fail_closed_no_inference
19
+ units: non_empty_sequence_of_closed_authority_unit_mappings
20
+ unit_format_field: forbidden
21
+ unit_identity: explicit_and_independent_of_file_name_source_index_move_order_or_regroup
22
+ source_order: non_semantic
23
+ legacy_top_level_single_unit_mapping: rejected
24
+ markdown_document:
25
+ units_per_file: 1
26
+ identifier_pattern: '^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z](?:[a-z0-9-]*[a-z0-9])?)+$'
27
+ kinds: [rule, definition]
28
+ lifecycles: [active, removed]
29
+ modalities: [must, must_not]
30
+ text_values:
31
+ fields: [title, meaning, statement, condition, failure, reason]
32
+ unicode: well_formed_scalar_sequence
33
+ non_empty: true
34
+ trim: no_leading_or_trailing_whitespace
35
+ line_break_code_points: [U+000A, U+000B, U+000C, U+000D, U+0085, U+2028, U+2029]
36
+ fields:
37
+ yaml_document: [format, owner, scope, units]
38
+ unit_common: [id, kind, owner, lifecycle, title, relations]
39
+ active_definition_required: [meaning]
40
+ active_rule_required: [modality, scope, statement, condition, failure]
41
+ removed_required: [reason]
42
+ yaml_unit_allowed: [id, kind, owner, lifecycle, title, meaning, modality, scope, statement, condition, failure, reason, relations]
43
+ markdown_frontmatter_allowed: [format, id, kind, owner, lifecycle, modality, scope, relations]
44
+ relation_item_fields: [type, target]
45
+ relation_types:
46
+ applies_to:
47
+ source: active_rule
48
+ target: active_definition
49
+ minimum_outgoing: 1
50
+ supersedes:
51
+ source: active_or_removed_unit
52
+ target: removed_same_kind
53
+ maximum_outgoing: 1
54
+ maximum_incoming: 1
55
+ ordering:
56
+ unit: id
57
+ scope: lexical
58
+ relation: [type, target]
@@ -0,0 +1,31 @@
1
+ version: 2
2
+ contract:
3
+ id: nimicoding.authority-verifier-bindings.v2
4
+ owner: nimi-coding
5
+ visibility: package_internal
6
+ format: nimicoding.authority-verifier-bindings/v2
7
+ detectors:
8
+ - minimum-independent-incoming-reference/v1
9
+ - exact-lexical-invariant/v1
10
+ identifier_pattern: '^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z](?:[a-z0-9-]*[a-z0-9])?)+$'
11
+ token_pattern: '^[\p{L}\p{N}](?:[\p{L}\p{N}_.-]*[\p{L}\p{N}])?$'
12
+ policies: [advisory, blocking]
13
+ lexical_matches: [token, phrase]
14
+ lexical_expectations: [present, absent]
15
+ fields:
16
+ top: [format, bindings]
17
+ graph_binding: [id, detector, premise, targets, minimum, policy]
18
+ lexical_binding: [id, detector, term, match, expectation, policy]
19
+ constraints:
20
+ bindings: non_empty_closed_detector_binding_list
21
+ binding_ID: unique_exact_dotted_lowercase_identifier
22
+ graph_premise: exact_active_rule_ID
23
+ graph_targets: non_empty_unique_exact_active_definition_IDs
24
+ graph_minimum: positive_safe_integer
25
+ lexical_term: non_empty_trimmed_single_line_exact_text
26
+ lexical_token: token_pattern_when_match_is_token
27
+ lexical_phrase: exact_case_sensitive_code_point_substring
28
+ lexical_corpus: active_authority_only
29
+ lexical_fields: [meaning, statement, condition, failure]
30
+ policy: advisory_or_blocking
31
+ extra_fields: forbidden
@@ -0,0 +1,127 @@
1
+ version: 4
2
+ id: nimicoding.authority-authoring
3
+ purpose: Author explicit .nimi/spec authority without inference.
4
+ authority_boundary:
5
+ canonical_root: .nimi/spec
6
+ sources: ["*.authority.yaml", "*.authority.md"]
7
+ rule: The project owns product meaning; nimicoding formats, validates, and derives read-only results.
8
+ AI_inputs: [this_guide, task_authority, bounded_discovery, exact_query_or_bounded_context, diagnostics]
9
+ do_not_read: [complete_authority_corpus, contracts, package_internal_specs]
10
+
11
+ daily_workflow:
12
+ - If no exact ID is known, run nimicoding authority discover <path> <query> --max-candidates 10 --max-snippet-terms 24 --max-bytes 131072 --json. Filters are exact; pass --preview-direction, --relations, and --max-edges together. It neither selects nor proves absence.
13
+ - Select an ID only from task or product authority. Use nimicoding authority query <path> <id> --max-bytes <positive-integer> --json for one unit, or context <path> <id> --max-units <positive-integer> --max-bytes <positive-integer> --json for its declared outgoing applies_to/supersedes closure. Context is not complete task context.
14
+ - Modify only project-owned canonical authority. Choose every product value before writing; never infer an ID, owner, scope, condition, failure, or relation.
15
+ - Run nimicoding authority fmt <changed-file> for each changed file.
16
+ - Run nimicoding authority check <complete-path> [--scope-bindings <file>] --json; then compile. For repository anchors run nimicoding authority anchors <repository-path> --spec <corpus-path> [--scope-bindings <file>] --max-units <positive-safe-integer> --max-anchors <positive-safe-integer> --max-bytes <positive-safe-integer> --json.
17
+ - For semantic changes, run diff and impact with explicit budgets and complete inputs. Treat returned obligations only as host-owned follow-up targets; run the project's real code, type, test, and gate workflow separately.
18
+ - Never continue from compiler diagnostics, unknown IDs, budget failures, or partial/guessed results.
19
+
20
+ source_profiles:
21
+ yaml:
22
+ shape: "Closed mapping: format nimicoding.authority/v2; owner?; scope string?; units. Units/IDs/order unchanged."
23
+ defaults: owner/rule scope inherit; unit overrides; definitions lack scope.
24
+ omissions: lifecycle active and relations [] may be omitted; removed/reason stay explicit; missing owner/rule scope at both levels fails.
25
+ format: nimicoding.authority/v2_only_without_legacy_migration_or_history_input
26
+ markdown:
27
+ shape: One unit per file. Front matter carries format, id, kind, owner, lifecycle, rule modality/scope, and relations.
28
+ title: One plain H1.
29
+ sections:
30
+ active_definition: [Meaning]
31
+ active_rule: [Statement, Condition, Failure]
32
+ removed_unit: [Removal reason]
33
+ boundary: Each section is one plain-text line; no free prose or unknown structures.
34
+ shared_text_rule: Text fields are non-empty trimmed single-line Unicode.
35
+
36
+ common_fields:
37
+ id: Stable dot-separated lower-case identity; never reuse a removed ID.
38
+ kind: rule or definition.
39
+ owner: Accountable dotted lower-case unit or container value.
40
+ lifecycle: active or explicit removed.
41
+ title: Required display label.
42
+ relations: Type/target pairs; omitted means [].
43
+
44
+ unit_shapes:
45
+ active_definition:
46
+ required: [id, kind, title, meaning]
47
+ fixed: {kind: definition, lifecycle: active}
48
+ forbidden: [modality, scope, statement, condition, failure, reason]
49
+ active_rule:
50
+ required: [id, kind, title, modality, statement, condition, failure]
51
+ fixed: {kind: rule, lifecycle: active}
52
+ modality: must or must_not.
53
+ scope: Non-empty unique unit list or one inherited container value.
54
+ condition: Write the actual condition; use Always. only when unconditional.
55
+ failure: State observable failure; never pseudo-success or silent fallback.
56
+ forbidden: [meaning, reason]
57
+ removed_tombstone:
58
+ required: [id, kind, lifecycle, title, reason]
59
+ fixed: {lifecycle: removed}
60
+ boundary: Preserve the stable identity and kind. reason is lifecycle rationale, not normative replacement content.
61
+ forbidden: [meaning, modality, scope, statement, condition, failure]
62
+
63
+ relation_rules:
64
+ applies_to: Required one or more times from each active rule to active definitions only.
65
+ supersedes: Optional from active or removed to one removed unit of the same kind; at most one incoming/outgoing edge, acyclic linear lineage.
66
+ resolution: Targets resolve by exact ID in the complete input; invalid, dangling, mismatched, cyclic, duplicate, or inferred edges fail.
67
+
68
+ formatter_and_diagnostics:
69
+ - fmt canonicalizes; v2 strips redundant unit defaults but keeps container choices.
70
+ - Any source format other than nimicoding.authority/v2 fails fmt, check, compile, diff, impact, and review admission.
71
+ - check/compile use the complete path and fail closed; no public or partial AuthorityIR is emitted.
72
+ - Diagnostics give locations, reasons, conflicts, and repair categories, never product values.
73
+ - Fix values only from task or product authority. Do not invent container defaults, fallback data, historical inference, internal contracts, or wildcard corpus reading.
74
+
75
+ change_workflow:
76
+ diff: nimicoding authority diff <before-path> <after-path> --max-bytes <positive-integer> --json
77
+ candidates: nimicoding authority change-candidates <before-path> <after-path> --channels <comma-separated-closed-set> --max-candidates <positive-safe-integer> --max-reasons <positive-safe-integer> --max-bytes <positive-safe-integer> --json
78
+ impact: nimicoding authority impact <before-path> <after-path> --max-bytes <positive-integer> --json
79
+ boundaries:
80
+ - Diff compares complete canonical inputs; formatting, profile, file, and order-only changes are semantic zero.
81
+ - Change candidates are the complete union only for caller-requested exact owner, scope, changed-term, direct-relation, Definition-identity, and Definition-title channels. They are recall inputs for AI or human judgment, never conflict, retirement, authority, absence, or conformance findings.
82
+ - Impact follows declared reverse applies_to/supersedes only and reports every before/after scope consumer plus one test follow-up target for each impacted active rule.
83
+ - Diff/impact budgets cover complete compact payloads; budget failure returns no partial result.
84
+ - Impact accepts no disposition, receipt, external result, test outcome, or completion state. The host owns execution and workflow state.
85
+
86
+ canonical_examples:
87
+ complete_yaml_lifecycle: |
88
+ format: nimicoding.authority/v2
89
+ scope: api.checkout
90
+ units:
91
+ - id: definition.session-v0
92
+ kind: definition
93
+ owner: team.identity
94
+ lifecycle: removed
95
+ title: Legacy session
96
+ reason: Replaced by the current session definition.
97
+ - id: definition.session
98
+ kind: definition
99
+ owner: team.identity
100
+ title: Session
101
+ meaning: A server-issued identity context presented with a protected request.
102
+ relations:
103
+ - type: supersedes
104
+ target: definition.session-v0
105
+ - id: rule.checkout-no-anonymous-v0
106
+ kind: rule
107
+ owner: team.checkout
108
+ lifecycle: removed
109
+ title: Legacy anonymous checkout prohibition
110
+ reason: Replaced by the current checkout prohibition.
111
+ - id: rule.checkout-no-anonymous
112
+ kind: rule
113
+ owner: team.checkout
114
+ title: Anonymous checkout is prohibited
115
+ modality: must_not
116
+ statement: Checkout creates an order without a valid session.
117
+ condition: Always.
118
+ failure: Reject the request before creating an order.
119
+ relations:
120
+ - type: applies_to
121
+ target: definition.session
122
+ - type: supersedes
123
+ target: rule.checkout-no-anonymous-v0
124
+
125
+ final_boundaries:
126
+ - Authority is only project-authored *.authority.yaml or *.authority.md under .nimi/spec; derived/local output is not authority.
127
+ - Derived reads are bounded and read-only; none selects authority, supplies complete task context, or proves completion.
@@ -1,33 +1,40 @@
1
- version: 3
1
+ version: 6
2
2
  methodology:
3
3
  id: nimi-coding
4
- mission: Preserve explicit product authority while AI-assisted changes are designed, implemented, and verified by the host environment.
4
+ mission: Preserve explicit project-authored canonical authority through deterministic formatting, compilation, and fail-closed gates.
5
5
  package_boundary:
6
6
  owns:
7
- - methodology_principles
8
- - spec_construction_contracts
9
- - managed_methodology_and_contract_projections
10
- - deterministic_spec_and_governance_validation
7
+ - compact_canonical_authority_authoring_methodology
8
+ - exact_package_projection_and_managed_instruction_blocks
9
+ - canonical_authority_formatter_and_conformance_gate
10
+ - bounded_deterministic_exact_filtered_lexical_candidate_discovery_with_SourceMapped_field_snippets_and_optional_direct_authored_relation_preview
11
+ - private_compiler_filtered_lexical_discovery_and_exact_query
12
+ - immutable_per_invocation_compiler_snapshots_transient_exact_indexes_and_change_derived_candidate_recall
13
+ - complete_declared_outgoing_interpretation_closure
14
+ - bounded_explicit_relation_graph_navigation
15
+ - project_bound_deterministic_authority_audit_and_SARIF_projection
16
+ - semantic_diff_and_declared_review_obligations
17
+ - optional_L3_repository_governance_checks
11
18
  does_not_own:
12
- - task_planning
13
- - task_state
14
- - agent_delegation
15
- - implementation_execution
16
- - review_or_approval_state
17
- - provider_runtime
18
- principles:
19
- - authority_before_convenience
20
- - explicit_complexity_over_ambiguous_simplicity
21
- - root_cause_over_local_patch
22
- - no_pseudo_success
23
- - evidence_must_not_override_authority
24
- - generated_views_are_never_canonical
25
- - unresolved_semantic_forks_fail_closed
19
+ - project_product_semantics
20
+ - historical_document_reconstruction_or_inference
21
+ - profile_specific_authority_validation
22
+ - task_planning_or_state
23
+ - agent_delegation_or_AI_execution
24
+ - implementation_or_review_completion
25
+ - host_workflow_commands
26
+ - storage_semantic_search_visualization_or_Atlas
26
27
  authority_order:
27
- - host_product_spec
28
- - package_methodology_and_contracts
29
- - local_non_authority_evidence
30
- - implementation
31
- host_integration:
32
- execution_owner: host_native_capabilities
33
- constraint: nimi-coding_outputs_may_inform_but_must_not_orchestrate_host_execution
28
+ - host_canonical_authority_under_.nimi/spec
29
+ - projected_compact_authoring_methodology
30
+ - package_internal_compiler_contracts
31
+ - local_derived_output
32
+ boundaries:
33
+ discovery: bounded_exact_filtered_lexical_candidates_with_SourceMapped_field_snippets_and_optional_M1_direct_authored_relation_preview_not_semantic_search_selection_context_complete_recall_or_absence_proof
34
+ change_candidates: complete_union_for_explicit_requested_exact_channels_not_conflict_retirement_authority_or_conformance_judgment
35
+ context: complete_declared_outgoing_interpretation_closure_not_complete_task_context
36
+ graph: bounded_explicit_relation_navigation_not_semantic_inference_or_raw_IR
37
+ audit: explicit_project_verifier_bindings_not_prose_inference_plugin_execution_or_product_authority
38
+ impact: declared_relation_impact_and_host_follow_up_targets_not_implementation_consumer_or_test_sync_proof
39
+ authority_admission: nimicoding_authority_check_on_complete_canonical_root
40
+ optional_repository_governance: separate_L3_not_authority_admission
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nimiplatform/nimi-coding",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
- "description": "AI-native methodology, spec construction, and deterministic governance validation.",
5
+ "description": "Canonical authority methodology, formatter, compiler primitives, and deterministic gates.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://docs.nimi.ai/nimicoding",
8
8
  "repository": {
@@ -24,6 +24,7 @@
24
24
  "bin": {
25
25
  "nimicoding": "bin/nimicoding.mjs"
26
26
  },
27
+ "exports": {},
27
28
  "packageManager": "pnpm@10.32.1",
28
29
  "engines": {
29
30
  "node": ">=24.0.0",
@@ -43,7 +44,6 @@
43
44
  "files": [
44
45
  "bin",
45
46
  "cli",
46
- "config",
47
47
  "contracts",
48
48
  "methodology",
49
49
  "spec",
@@ -56,8 +56,12 @@
56
56
  "LICENSE"
57
57
  ],
58
58
  "scripts": {
59
- "test": "node ./cli/dev/run-suite.mjs",
60
- "check:ci": "pnpm test && pnpm check:pack && node ./cli/dev/run-cli-smoke.mjs",
61
- "check:pack": "npm pack --dry-run"
59
+ "check:authority-surface": "node ./cli/dev/check-authority-surface.mjs",
60
+ "check:product-conformance": "node ./cli/dev/check-product-conformance.mjs",
61
+ "check:product-conformance:packed": "node ./cli/dev/check-product-conformance.mjs --packed",
62
+ "check:ci": "pnpm test && pnpm check:pack && pnpm check:product-conformance:packed && node ./cli/dev/run-cli-smoke.mjs",
63
+ "check:pack": "npm pack --dry-run",
64
+ "prepack": "node ./cli/dev/check-authority-surface.mjs && node ./cli/dev/check-product-conformance.mjs",
65
+ "test": "node ./cli/dev/run-suite.mjs"
62
66
  }
63
67
  }
@@ -0,0 +1,99 @@
1
+ version: 1
2
+ spec:
3
+ id: nimicoding.authority-anchors.v1
4
+ owner: nimi-coding
5
+ status: active
6
+ product_claim: bounded_static_lexical_anchor_validation_against_one_exact_Git_tracked_file_inventory_and_root_package_scripts
7
+ command: nimicoding authority anchors <repository-path> --spec <corpus-path> [--scope-bindings <file>] [--embedded-paths] --max-units <positive-safe-integer> --max-anchors <positive-safe-integer> --max-bytes <positive-safe-integer> [--json]
8
+ surface:
9
+ report_format: nimicoding.authority-anchors/v1
10
+ corpus_root: repository_authority_corpus_only
11
+ boolean_flags: [json, embedded-paths]
12
+ value_flags: [spec, scope-bindings]
13
+ integer_flags: [max-units, max-anchors, max-bytes]
14
+ repeatable_flags: []
15
+ findings_change_exit_code: true
16
+ inputs:
17
+ repository:
18
+ shape: exact_non_symlink_Git_worktree_root
19
+ tracked_files: one_complete_git_ls_files_cached_NUL_inventory
20
+ Git_environment: inherited_Git_overrides_traces_replacements_lazy_fetch_prompts_and_locale_are_sanitized_as_for_authority_snapshots
21
+ writes_or_execution: forbidden
22
+ corpus:
23
+ root: exact_repository_relative_.nimi/spec_resolved_realpath
24
+ admission: complete_authority_compile_required
25
+ units: active_only
26
+ fields:
27
+ shared_lexicon: normative_field_set_is_one_shared_definition_across_report_products
28
+ active_definition: [meaning]
29
+ active_rule: [statement, condition, failure]
30
+ removed: []
31
+ scope_bindings:
32
+ required: false
33
+ structural_contract: nimicoding.scope-bindings/v1
34
+ evaluated_kinds: [path_glob]
35
+ declaration_only_kinds: [module, command]
36
+ lexical_grammar:
37
+ token: maximal_non_whitespace_sequence
38
+ class_A:
39
+ name: tracked_file_path
40
+ requirements:
41
+ - token_contains_at_least_one_forward_slash
42
+ - token_ends_exactly_with_one_known_lowercase_extension
43
+ excluded_prefixes:
44
+ - any_leading_tilde_including_tilde_forward_slash
45
+ - POSIX_absolute_forward_slash
46
+ - ASCII_letter_colon_forward_or_back_slash_Windows_drive
47
+ - two_leading_backslashes_UNC
48
+ exclusion_evaluation: deterministic_exact_prefix_checks_before_class_A_admission
49
+ extensions: [mjs, js, ts, tsx, rs, go, yaml, yml, md, json, proto, ps1]
50
+ resolution: exact_byte_text_membership_in_the_decoded_Git_tracked_file_inventory
51
+ normalization_or_inference: forbidden
52
+ class_B:
53
+ name: root_package_script
54
+ phrase: pnpm_followed_by_exactly_one_ASCII_space_then_one_maximal_non_whitespace_script_name_token
55
+ script_name_admission: contains_colon_OR_fully_matches_[a-z][a-z0-9:-]*
56
+ builtin_subcommands_excluded: [add, audit, create, dlx, exec, install, link, list, outdated, patch, publish, remove, run, update, why]
57
+ resolution: exact_own_key_membership_in_repository_root_package.json_scripts
58
+ execution: forbidden
59
+ class_C:
60
+ name: embedded_repository_path
61
+ admission: opt_in_via_--embedded-paths
62
+ shape: maximal_embedded_<root>/<segment>(/<segment>)*.<extension>_substring
63
+ segment_alphabet: shared_lexicon_[A-Za-z0-9_.-]
64
+ roots: Git_tracked_top_level_segments_plus_.nimi
65
+ left_boundary:
66
+ segment_character: rejected_as_mid_segment_start
67
+ separator_run_after_a_longer_path: rejected_as_foreign_tail
68
+ relative_prefix_dot_or_dot_dot: admitted
69
+ excluded_context: glob_star_or_angle_bracket_placeholder
70
+ resolution: exact_byte_text_membership_in_the_decoded_Git_tracked_file_inventory
71
+ scope_path_globs:
72
+ candidates: complete_Git_tracked_file_inventory
73
+ matching: whole_repository_relative_path_case_sensitive
74
+ operators:
75
+ star: zero_or_more_non_slash_characters
76
+ question: one_non_slash_character
77
+ double_star: zero_or_more_characters_including_slash
78
+ double_star_slash: zero_or_more_complete_path_segments
79
+ zero_matches: diagnostic_lists_exact_scope_and_glob
80
+ result:
81
+ trackedPathSetDigest: sha256_hex_of_nimicoding.repository-inventory/v1_canonical_tracked_path_set_preimage
82
+ summary_fields: [units, anchorsChecked, diagnostics]
83
+ diagnostic_location: exact_unit_ID_field_SourceMap_range_and_source_pointer
84
+ anchor_diagnostic_fields: [unitId, field, anchor]
85
+ scope_diagnostic_fields: [scope, glob]
86
+ ordering:
87
+ anchors: [unit_ID, anchor_text, field, class]
88
+ scope_globs: [scope, glob]
89
+ unresolved_anchor_or_glob: complete_invalid_product_exit_1
90
+ human_and_json: required
91
+ budgets:
92
+ max_units: complete_active_unit_count
93
+ max_anchors: complete_extracted_anchor_occurrence_count
94
+ max_bytes: UTF-8_size_of_compact_format_complete_summary_and_diagnostics_product
95
+ overflow: refused_exit_1_with_required_and_admitted_values
96
+ N_and_N_minus_1: exact_symmetric_boundary
97
+ truncation_or_partial_result: forbidden
98
+ usage_failure: missing_repeated_unknown_or_invalid_CLI_argument_exit_2_without_anchor_product
99
+ not_claimed: [semantic_path_inference, module_resolution, command_binding_resolution, command_execution, test_execution, code_conformance]
@@ -0,0 +1,89 @@
1
+ version: 2
2
+ spec:
3
+ id: nimicoding.authority-audit.v2
4
+ owner: nimi-coding
5
+ status: active
6
+ product_claim: complete_admitted_authority_and_one_explicit_closed_binding_list_produce_only_deterministic_violation_findings_and_narrow_counts
7
+ command: nimicoding authority audit <path> --bindings <file> --max-units <positive-safe-integer> --max-edges <positive-safe-integer> --max-bytes <positive-safe-integer> [--json|--sarif]
8
+ surface:
9
+ report_format: nimicoding.authority-audit/v2
10
+ corpus_root: complete_input_authority_corpus
11
+ boolean_flags: [json, sarif]
12
+ value_flags: [bindings]
13
+ integer_flags: [max-units, max-edges, max-bytes]
14
+ repeatable_flags: []
15
+ blocking_findings_change_exit_code: true
16
+ advisory_findings_change_exit_code: false
17
+ runtime:
18
+ function: auditAuthorityPath(authorityPath_bindingsPath_budgets)
19
+ source: one_complete_package_private_AuthorityIR_SourceMap_and_one_closed_binding_document
20
+ binding:
21
+ format: nimicoding.authority-verifier-bindings/v2
22
+ authority: package://@nimiplatform/nimi-coding/contracts/authority-verifier-bindings.schema.yaml
23
+ top_level_fields: [format, bindings]
24
+ bindings: non_empty
25
+ binding_ID: unique_exact_dotted_lowercase_identifier
26
+ unknown_detector_extra_field_invalid_authority_ref_or_empty_list: refused_with_null_audit
27
+ detectors:
28
+ minimum-independent-incoming-reference/v1:
29
+ binding_fields: [id, detector, premise, targets, minimum, policy]
30
+ premise: exact_active_rule_selected_by_binding
31
+ targets: non_empty_unique_exact_active_definitions_selected_by_binding
32
+ attachment: premise_must_have_direct_applies_to_each_target
33
+ measurement: distinct_other_active_rule_sources_with_direct_applies_to_target
34
+ minimum: positive_safe_integer_from_binding
35
+ exact-lexical-invariant/v1:
36
+ binding_fields: [id, detector, term, match, expectation, policy]
37
+ corpus: complete_active_authority
38
+ fields: [meaning, statement, condition, failure]
39
+ case: sensitive
40
+ match:
41
+ token: exact_literal_with_boundaries_outside_Unicode_letter_number_underscore_dot_or_hyphen
42
+ phrase: exact_non_overlapping_code_point_substring
43
+ expectation: [present, absent]
44
+ no_synonym_stemming_embedding_normalization_or_diff_derived_policy: true
45
+ result:
46
+ format: nimicoding.authority-audit/v2
47
+ top_level_fields: [format, operationStatus, blockingStatus, findings, counts, budgets]
48
+ operationStatus: completed
49
+ blockingStatus:
50
+ blocked: at_least_one_blocking_finding
51
+ clear: no_blocking_finding_advisory_findings_may_still_exist
52
+ common_item_fields: [code, fingerprint, detector, binding, premise, basis, message, policy, authorityRefs, primaryLocation, relatedLocations, witness]
53
+ location_fields: [file, range, sourcePointer]
54
+ related_location_fields: [role, location]
55
+ basis: configured
56
+ positive_binding_records_or_pass_witnesses: forbidden
57
+ findings:
58
+ - premise_target_direct_attachment_missing
59
+ - minimum_independent_incoming_reference_not_met
60
+ - exact_lexical_expectation_violation
61
+ ordering:
62
+ findings: [binding_ID, target_ID_when_present, code]
63
+ fingerprint:
64
+ algorithm: SHA-256_with_sha256_colon_prefix
65
+ excludes: [file, range, sourcePointer, policy, message, corpus_digest, run_identity]
66
+ counts:
67
+ fields: [bindings, returned, traversal]
68
+ binding_fields: [configured, evaluated]
69
+ returned_fields: [findings]
70
+ traversal_fields: [units, edges]
71
+ budgets:
72
+ required: [maxUnits, maxEdges, maxBytes]
73
+ values: positive_safe_integers
74
+ units: distinct_units_inspected_by_all_configured_detectors
75
+ edges: distinct_authored_edges_inspected_by_graph_detectors
76
+ bytes: UTF-8_bytes_of_compact_JSON.stringify_audit
77
+ overflow: AUTH_AUDIT_BUDGET_with_null_audit_and_partial_false
78
+ outcomes:
79
+ clear: audit_present_blockingStatus_clear_exit_0
80
+ blocked: audit_present_blockingStatus_blocked_exit_1
81
+ refused: invalid_corpus_binding_authority_reference_or_budget_with_null_audit_exit_1
82
+ partial: forbidden
83
+ boundaries:
84
+ writes_authority: false
85
+ binding_is_canonical_product_authority: false
86
+ natural_language_contradiction_or_business_completeness: not_evaluated
87
+ detector_plugin_DSL_exception_filter_external_result_or_dynamic_execution: forbidden
88
+ blocking_policy_inference_from_diff: forbidden
89
+ public_JS_exports: none