@nimiplatform/nimi-coding 0.3.0 → 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.
Files changed (118) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/CONTRIBUTING.md +3 -3
  3. package/README.md +285 -41
  4. package/README.zh-CN.md +294 -31
  5. package/bin/nimicoding.mjs +1 -1
  6. package/cli/commands/authority.mjs +849 -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 +173 -0
  13. package/cli/dev/check-product-conformance.mjs +917 -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 +490 -0
  18. package/cli/lib/authority/closed-sets.mjs +646 -0
  19. package/cli/lib/authority/compile.mjs +110 -0
  20. package/cli/lib/authority/consumers.mjs +470 -0
  21. package/cli/lib/authority/diagnostics.mjs +87 -0
  22. package/cli/lib/authority/diff.mjs +287 -0
  23. package/cli/lib/authority/discover.mjs +447 -0
  24. package/cli/lib/authority/evidence-snapshot.mjs +1 -0
  25. package/cli/lib/authority/evidence.mjs +1432 -0
  26. package/cli/lib/authority/format.mjs +197 -0
  27. package/cli/lib/authority/git-snapshot.mjs +1065 -0
  28. package/cli/lib/authority/graph.mjs +351 -0
  29. package/cli/lib/authority/impact.mjs +252 -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 +222 -0
  35. package/cli/lib/authority/sarif.mjs +181 -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 +312 -0
  40. package/cli/lib/authority/surface.mjs +79 -0
  41. package/cli/lib/authority/terms.mjs +421 -0
  42. package/cli/lib/authority/tracked-text.mjs +70 -0
  43. package/cli/lib/authority/validate.mjs +308 -0
  44. package/cli/lib/bootstrap.mjs +55 -71
  45. package/cli/lib/doctor.mjs +40 -123
  46. package/cli/lib/entrypoints.mjs +103 -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-evidence-bindings.schema.yaml +53 -0
  56. package/contracts/authority-evidence-probe-results.schema.yaml +38 -0
  57. package/contracts/authority-impact-dispositions.schema.yaml +13 -0
  58. package/contracts/authority-scope-bindings.schema.yaml +15 -0
  59. package/contracts/authority-source.schema.yaml +64 -0
  60. package/contracts/authority-verifier-bindings.schema.yaml +20 -0
  61. package/methodology/authority-authoring.yaml +144 -0
  62. package/methodology/core.yaml +31 -26
  63. package/package.json +10 -6
  64. package/spec/authority-anchors.yaml +99 -0
  65. package/spec/authority-audit.yaml +85 -0
  66. package/spec/authority-authoring.yaml +150 -0
  67. package/spec/authority-closed-sets.yaml +65 -0
  68. package/spec/authority-consumers.yaml +70 -0
  69. package/spec/authority-context.yaml +50 -0
  70. package/spec/authority-discovery.yaml +119 -0
  71. package/spec/authority-evidence.yaml +200 -0
  72. package/spec/authority-graph.yaml +59 -0
  73. package/spec/authority-impact.yaml +84 -0
  74. package/spec/authority-review.yaml +89 -0
  75. package/spec/authority-terms.yaml +59 -0
  76. package/spec/product-scope.yaml +36 -23
  77. package/cli/commands/blueprint-audit.mjs +0 -91
  78. package/cli/commands/classify-spec-tree.mjs +0 -5
  79. package/cli/commands/generate-spec-derived-docs.mjs +0 -151
  80. package/cli/commands/generate-spec-migration-plan.mjs +0 -30
  81. package/cli/commands/surface-validator-command.mjs +0 -49
  82. package/cli/commands/validate-domain-admission.mjs +0 -5
  83. package/cli/commands/validate-guidance-bodies.mjs +0 -5
  84. package/cli/commands/validate-placement.mjs +0 -5
  85. package/cli/commands/validate-projection-edges.mjs +0 -5
  86. package/cli/commands/validate-spec-audit.mjs +0 -27
  87. package/cli/commands/validate-spec-governance.mjs +0 -124
  88. package/cli/commands/validate-spec-tree.mjs +0 -27
  89. package/cli/commands/validate-table-family.mjs +0 -5
  90. package/cli/commands/validate-tracked-output-admission.mjs +0 -5
  91. package/cli/lib/blueprint-audit.mjs +0 -363
  92. package/cli/lib/contracts.mjs +0 -21
  93. package/cli/lib/internal/contracts-loaders.mjs +0 -47
  94. package/cli/lib/internal/contracts-parse.mjs +0 -192
  95. package/cli/lib/internal/governance/runner.mjs +0 -35
  96. package/cli/lib/internal/surface-taxonomy-validators.mjs +0 -1147
  97. package/cli/lib/internal/validators-shared.mjs +0 -12
  98. package/cli/lib/internal/validators-spec-helpers.mjs +0 -52
  99. package/cli/lib/internal/validators-spec.mjs +0 -380
  100. package/cli/lib/validators.mjs +0 -30
  101. package/config/bootstrap.yaml +0 -6
  102. package/config/spec-generation-inputs.yaml +0 -41
  103. package/contracts/domain-admission.schema.yaml +0 -56
  104. package/contracts/migration-inventory.schema.yaml +0 -15
  105. package/contracts/negative-fixtures.yaml +0 -26
  106. package/contracts/placement-contract.schema.yaml +0 -127
  107. package/contracts/projection-edge.schema.yaml +0 -46
  108. package/contracts/shared-enums.yaml +0 -63
  109. package/contracts/spec-generation-audit.schema.yaml +0 -46
  110. package/contracts/spec-generation-inputs.schema.yaml +0 -43
  111. package/contracts/spec-layout.schema.yaml +0 -32
  112. package/contracts/surface-taxonomy.schema.yaml +0 -139
  113. package/contracts/table-family.schema.yaml +0 -133
  114. package/contracts/tracked-output-admission.schema.yaml +0 -17
  115. package/methodology/four-closure-policy.yaml +0 -20
  116. package/methodology/role-separation-policy.yaml +0 -22
  117. package/methodology/spec-reconstruction.yaml +0 -69
  118. 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,53 @@
1
+ version: 1
2
+ contract:
3
+ id: nimicoding.authority-evidence-bindings.v1
4
+ owner: nimi-coding
5
+ visibility: package_internal
6
+ format: nimicoding.authority-evidence-bindings/v1
7
+ probe: package-script-target-reachability/v1
8
+ container:
9
+ path: .nimi/config
10
+ Git_index: one_exact_tracked_stage-zero_regular_entry
11
+ worktree: exact_current_regular_non-symlink_bytes
12
+ identifier_pattern: '^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z](?:[a-z0-9-]*[a-z0-9])?)+$'
13
+ script_pattern: '^[a-z0-9](?:[a-z0-9._:-]*[a-z0-9])?$'
14
+ version_pattern: '^[A-Za-z0-9](?:[A-Za-z0-9._+-]*[A-Za-z0-9])?$'
15
+ fields:
16
+ top: [format, required_bindings, bindings]
17
+ binding: [id, authority, probe, manifest, command, tests, external_probe]
18
+ authority: [unit, scope]
19
+ command: [script, target]
20
+ tests: [script, targets]
21
+ external_probe: [id, version, required]
22
+ paths:
23
+ form: non_empty_repository_relative_POSIX_path
24
+ forbidden: [absolute, empty_segment, dot_segment, dot_dot_segment, backslash, NUL, any_case-folded_.git_path_segment]
25
+ resolution: lexical_and_physical_containment_in_exact_repository_root
26
+ symlink_or_non_regular_leaf_or_parent: refused_and_never_followed
27
+ package_script_grammar:
28
+ parsing: static_manifest_string_comparison_only
29
+ separator: one_ASCII_space_between_tokens_with_no_leading_or_trailing_space
30
+ command: node --import tsx <target>
31
+ tests: pnpm exec vitest run <targets...>
32
+ targets: exact_binding_paths_in_declared_order_using_only_ASCII_letters_digits_dot_underscore_hyphen_and_slash
33
+ forbidden: [quoting, escaping, environment_assignment, additional_option_or_flag, glob, pipe, redirect, command_substitution, command_chaining, arbitrary_executable]
34
+ constraints:
35
+ required_bindings: non_empty_unique_exact_binding_IDs
36
+ binding_ID: unique_exact_dotted_lowercase_identifier
37
+ authority_unit: exact_active_rule_ID
38
+ authority_scope: exact_member_of_the_bound_active_rule_scope
39
+ probe: fixed_package_owned_probe_only
40
+ manifest: one_safe_repository_relative_regular_JSON_file_locator
41
+ command_script: one_exact_manifest_scripts_key
42
+ command_target: one_safe_repository_relative_regular_file_locator
43
+ tests_script: one_exact_manifest_scripts_key_distinct_from_command_script
44
+ test_targets: non_empty_unique_safe_repository_relative_regular_file_locators
45
+ within_binding_locator_roles: manifest_command_target_and_test_targets_are_pairwise_portable-distinct
46
+ cross_binding_locator_paths: exact_duplicates_may_share_one_input_but_portable_case_collisions_are_forbidden
47
+ configured_binding_not_required: evaluated_but_does_not_create_required_coverage
48
+ external_probe: null_or_exact_object
49
+ external_probe_ID: exact_dotted_lowercase_identifier
50
+ external_probe_version: explicit_non_empty_version
51
+ external_probe_required: boolean
52
+ duplicate_or_extra_fields: forbidden
53
+ binding_product_semantics_defaults_or_conformance_claims: forbidden
@@ -0,0 +1,38 @@
1
+ version: 1
2
+ contract:
3
+ id: nimicoding.authority-evidence-probe-results.v1
4
+ owner: nimi-coding
5
+ visibility: package_internal
6
+ format: nimicoding.authority-evidence-probe-results/v1
7
+ container:
8
+ path: .nimi/local
9
+ entry: one_exact_regular_non-symlink_supplied_observation_file
10
+ Git_tracking: not_required
11
+ identity_pattern: '^sha256:[0-9a-f]{64}$'
12
+ identifier_pattern: '^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z](?:[a-z0-9-]*[a-z0-9])?)+$'
13
+ version_pattern: '^[A-Za-z0-9](?:[A-Za-z0-9._+-]*[A-Za-z0-9])?$'
14
+ fields:
15
+ top: [format, authority_content_identity, repository_input_identity, binding_identity, results]
16
+ item: [binding, probe, version, adapter, execution, outcome]
17
+ adapter: [id, version]
18
+ execution: [completed, failed, unsupported]
19
+ outcome:
20
+ completed: [passed, failed]
21
+ failed_or_unsupported: null
22
+ constraints:
23
+ identities: exact_lowercase_SHA-256_identities_of_the_captured_inputs
24
+ results: unique_by_binding_with_no_extra_or_duplicate_items
25
+ binding: exact_configured_binding_ID_with_one_external_probe_declaration
26
+ probe_and_version: exact_match_to_the_binding_external_probe
27
+ adapter_ID: exact_dotted_lowercase_identifier
28
+ adapter_version: explicit_non_empty_version
29
+ malformed_unknown_or_identity_mismatched_result: refused_not_gap_or_clean
30
+ missing_declared_result: represented_by_runtime_as_not_provided
31
+ execution_and_outcome: exact_conditional_shape
32
+ extra_fields: forbidden
33
+ trust:
34
+ source: external_supplied_observation
35
+ package_attestation: false
36
+ shape_identity_or_coverage_validation_proves_execution: false
37
+ reported_pass_proves_conformance_or_test_success: false
38
+ external_result_creates_deterministic_finding_or_blocking_authority: false
@@ -0,0 +1,13 @@
1
+ version: 1
2
+ contract:
3
+ id: nimicoding.authority-impact-dispositions.v1
4
+ owner: nimi-coding
5
+ visibility: package_internal
6
+ format: nimicoding.authority-impact-dispositions/v1
7
+ identifier_pattern: '^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z](?:[a-z0-9-]*[a-z0-9])?)+$'
8
+ status: addressed
9
+ fields:
10
+ top: [format, rules]
11
+ rule: [id, consumers, test]
12
+ consumer: [scope, status, evidence]
13
+ test: [status, evidence]
@@ -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,64 @@
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
+ migration_inputs:
8
+ format: nimicoding.authority/v1
9
+ admitted_by: [fmt --upgrade, diff, compile, check, impact]
10
+ rationale: history_snapshots_and_migration_inputs_are_read_not_authored
11
+ compatibility_product_surface: none_v1_is_not_a_current_authoring_format
12
+ file_suffixes: [.authority.yaml, .authority.md]
13
+ yaml_document:
14
+ allowed_fields: [format, owner, scope, units]
15
+ required_fields: [format, units]
16
+ container_defaults:
17
+ owner: applies_to_every_unit_that_omits_owner
18
+ scope: one_scope_value_applied_to_every_active_rule_that_omits_scope
19
+ definitions_do_not_inherit_scope: true
20
+ unit_omission_defaults:
21
+ lifecycle: active
22
+ relations: []
23
+ both_levels_absent: fail_closed_no_inference
24
+ units: non_empty_sequence_of_closed_authority_unit_mappings
25
+ unit_format_field: forbidden
26
+ unit_identity: explicit_and_independent_of_file_name_source_index_move_order_or_regroup
27
+ source_order: non_semantic
28
+ legacy_top_level_single_unit_mapping: rejected
29
+ markdown_document:
30
+ units_per_file: 1
31
+ identifier_pattern: '^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z](?:[a-z0-9-]*[a-z0-9])?)+$'
32
+ kinds: [rule, definition]
33
+ lifecycles: [active, removed]
34
+ modalities: [must, must_not]
35
+ text_values:
36
+ fields: [title, meaning, statement, condition, failure, reason]
37
+ unicode: well_formed_scalar_sequence
38
+ non_empty: true
39
+ trim: no_leading_or_trailing_whitespace
40
+ line_break_code_points: [U+000A, U+000B, U+000C, U+000D, U+0085, U+2028, U+2029]
41
+ fields:
42
+ yaml_document: [format, owner, scope, units]
43
+ yaml_document_migration_input: [format, units]
44
+ unit_common: [id, kind, owner, lifecycle, title, relations]
45
+ active_definition_required: [meaning]
46
+ active_rule_required: [modality, scope, statement, condition, failure]
47
+ removed_required: [reason]
48
+ yaml_unit_allowed: [id, kind, owner, lifecycle, title, meaning, modality, scope, statement, condition, failure, reason, relations]
49
+ markdown_frontmatter_allowed: [format, id, kind, owner, lifecycle, modality, scope, relations]
50
+ relation_item_fields: [type, target]
51
+ relation_types:
52
+ applies_to:
53
+ source: active_rule
54
+ target: active_definition
55
+ minimum_outgoing: 1
56
+ supersedes:
57
+ source: active_or_removed_unit
58
+ target: removed_same_kind
59
+ maximum_outgoing: 1
60
+ maximum_incoming: 1
61
+ ordering:
62
+ unit: id
63
+ scope: lexical
64
+ relation: [type, target]
@@ -0,0 +1,20 @@
1
+ version: 1
2
+ contract:
3
+ id: nimicoding.authority-verifier-bindings.v1
4
+ owner: nimi-coding
5
+ visibility: package_internal
6
+ format: nimicoding.authority-verifier-bindings/v1
7
+ detector: minimum-independent-incoming-reference/v1
8
+ identifier_pattern: '^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z](?:[a-z0-9-]*[a-z0-9])?)+$'
9
+ policies: [advisory, blocking]
10
+ fields:
11
+ top: [format, required_bindings, bindings]
12
+ binding: [id, detector, premise, targets, minimum, policy]
13
+ constraints:
14
+ required_bindings: non_empty_unique_exact_binding_IDs
15
+ binding_ID: unique_exact_dotted_lowercase_identifier
16
+ premise: exact_active_rule_ID
17
+ targets: non_empty_unique_exact_active_definition_IDs
18
+ minimum: positive_safe_integer
19
+ policy: advisory_or_blocking
20
+ extra_fields: forbidden
@@ -0,0 +1,144 @@
1
+ version: 2
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; address every obligation and rerun impact.
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
+ legacy: nimicoding.authority/v1 remains accepted unchanged; fmt --upgrade emits v2 and hoists uniform defaults.
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
+ - fmt --upgrade emits v2, hoists uniform owner/single scope, and preserves compiled meaning.
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
+ impact: nimicoding authority impact <before-path> <after-path> --dispositions <file> --max-bytes <positive-integer> --json
78
+ boundaries:
79
+ - Diff compares complete canonical inputs; formatting, profile, file, and order-only changes are semantic zero.
80
+ - Impact follows declared reverse applies_to/supersedes only. Each impacted active rule needs evidence for every before/after scope consumer and one test obligation.
81
+ - Diff/impact budgets cover complete compact payloads; budget failure returns no partial result.
82
+ - Dispositions are local evidence under .nimi/local, never authority or proof that implementation, consumers, or tests are synchronized.
83
+
84
+ disposition_authoring:
85
+ workflow:
86
+ - Write the empty skeleton and run impact to obtain exact obligations from the failed result.
87
+ - Add exactly one entry per impacted active rule using real project evidence, then rerun impact with the same budget. Missing or extra dispositions fail.
88
+ empty_skeleton: |
89
+ format: nimicoding.authority-impact-dispositions/v1
90
+ rules: []
91
+ complete_example: |
92
+ format: nimicoding.authority-impact-dispositions/v1
93
+ rules:
94
+ - id: rule.checkout-session
95
+ consumers:
96
+ - scope: api.checkout
97
+ status: addressed
98
+ evidence: src/checkout/session-handler.ts
99
+ test:
100
+ status: addressed
101
+ evidence: tests/checkout-session.test.ts
102
+
103
+ canonical_examples:
104
+ complete_yaml_lifecycle: |
105
+ format: nimicoding.authority/v2
106
+ scope: api.checkout
107
+ units:
108
+ - id: definition.session-v0
109
+ kind: definition
110
+ owner: team.identity
111
+ lifecycle: removed
112
+ title: Legacy session
113
+ reason: Replaced by the current session definition.
114
+ - id: definition.session
115
+ kind: definition
116
+ owner: team.identity
117
+ title: Session
118
+ meaning: A server-issued identity context presented with a protected request.
119
+ relations:
120
+ - type: supersedes
121
+ target: definition.session-v0
122
+ - id: rule.checkout-no-anonymous-v0
123
+ kind: rule
124
+ owner: team.checkout
125
+ lifecycle: removed
126
+ title: Legacy anonymous checkout prohibition
127
+ reason: Replaced by the current checkout prohibition.
128
+ - id: rule.checkout-no-anonymous
129
+ kind: rule
130
+ owner: team.checkout
131
+ title: Anonymous checkout is prohibited
132
+ modality: must_not
133
+ statement: Checkout creates an order without a valid session.
134
+ condition: Always.
135
+ failure: Reject the request before creating an order.
136
+ relations:
137
+ - type: applies_to
138
+ target: definition.session
139
+ - type: supersedes
140
+ target: rule.checkout-no-anonymous-v0
141
+
142
+ final_boundaries:
143
+ - Authority is only project-authored *.authority.yaml or *.authority.md under .nimi/spec; derived/local output is not authority.
144
+ - Derived reads are bounded and read-only; none selects authority, supplies complete task context, or proves completion.
@@ -1,33 +1,38 @@
1
- version: 3
1
+ version: 5
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
+ - complete_declared_outgoing_interpretation_closure
13
+ - bounded_explicit_relation_graph_navigation
14
+ - project_bound_deterministic_authority_audit_and_SARIF_projection
15
+ - semantic_diff_and_declared_review_obligations
16
+ - optional_L3_repository_governance_checks
11
17
  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
18
+ - project_product_semantics
19
+ - historical_document_reconstruction_or_inference
20
+ - profile_specific_authority_validation
21
+ - task_planning_or_state
22
+ - agent_delegation_or_AI_execution
23
+ - implementation_or_review_completion
24
+ - host_workflow_commands
25
+ - storage_semantic_search_visualization_or_Atlas
26
26
  authority_order:
27
- - host_product_spec
28
- - package_methodology_and_contracts
27
+ - host_canonical_authority_under_.nimi/spec
28
+ - projected_compact_authoring_methodology
29
+ - package_internal_compiler_contracts
29
30
  - 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
31
+ boundaries:
32
+ 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
33
+ context: complete_declared_outgoing_interpretation_closure_not_complete_task_context
34
+ graph: bounded_explicit_relation_navigation_not_semantic_inference_or_raw_IR
35
+ audit: explicit_project_verifier_bindings_not_prose_inference_plugin_execution_or_product_authority
36
+ impact: declared_review_obligations_not_implementation_consumer_or_test_sync_proof
37
+ authority_admission: nimicoding_authority_check_on_complete_canonical_root
38
+ 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.0",
3
+ "version": "0.4.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]