@lamentis/naome 1.3.0 → 1.3.1

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 (137) hide show
  1. package/Cargo.lock +2 -2
  2. package/README.md +11 -2
  3. package/bin/naome.js +62 -24
  4. package/crates/naome-cli/Cargo.toml +1 -1
  5. package/crates/naome-cli/src/context_commands.rs +47 -0
  6. package/crates/naome-cli/src/dispatcher.rs +6 -0
  7. package/crates/naome-cli/src/main.rs +43 -6
  8. package/crates/naome-cli/src/quality_commands.rs +31 -46
  9. package/crates/naome-cli/src/quality_output.rs +34 -0
  10. package/crates/naome-cli/src/quality_reconcile_command.rs +45 -0
  11. package/crates/naome-cli/src/repository_model_commands.rs +84 -0
  12. package/crates/naome-cli/src/task_commands.rs +62 -0
  13. package/crates/naome-cli/src/workflow_commands.rs +100 -3
  14. package/crates/naome-core/Cargo.toml +1 -1
  15. package/crates/naome-core/src/context/helpers.rs +75 -0
  16. package/crates/naome-core/src/context/select.rs +134 -0
  17. package/crates/naome-core/src/context/types.rs +43 -0
  18. package/crates/naome-core/src/context.rs +6 -0
  19. package/crates/naome-core/src/decision/states.rs +1 -1
  20. package/crates/naome-core/src/decision.rs +4 -1
  21. package/crates/naome-core/src/install_plan.rs +18 -0
  22. package/crates/naome-core/src/journal.rs +2 -7
  23. package/crates/naome-core/src/lib.rs +33 -10
  24. package/crates/naome-core/src/quality/adapter_ios.rs +131 -0
  25. package/crates/naome-core/src/quality/adapter_support.rs +67 -0
  26. package/crates/naome-core/src/quality/adapters.rs +81 -18
  27. package/crates/naome-core/src/quality/cache.rs +7 -9
  28. package/crates/naome-core/src/quality/checks/duplicate_blocks.rs +4 -7
  29. package/crates/naome-core/src/quality/config.rs +21 -3
  30. package/crates/naome-core/src/quality/mod.rs +138 -7
  31. package/crates/naome-core/src/quality/reconcile.rs +138 -0
  32. package/crates/naome-core/src/quality/reconcile_anchors.rs +64 -0
  33. package/crates/naome-core/src/quality/scanner/analysis.rs +20 -5
  34. package/crates/naome-core/src/quality/scanner.rs +62 -17
  35. package/crates/naome-core/src/quality/semantic/checks.rs +17 -0
  36. package/crates/naome-core/src/quality/semantic/route.rs +1 -1
  37. package/crates/naome-core/src/quality/structure/adapter_ios.rs +149 -0
  38. package/crates/naome-core/src/quality/structure/adapters.rs +60 -42
  39. package/crates/naome-core/src/quality/structure/checks/directory.rs +6 -4
  40. package/crates/naome-core/src/quality/structure/classify/roles.rs +51 -5
  41. package/crates/naome-core/src/quality/structure/config.rs +24 -3
  42. package/crates/naome-core/src/quality/structure/mod.rs +3 -0
  43. package/crates/naome-core/src/quality/types.rs +20 -1
  44. package/crates/naome-core/src/repository_model/detect.rs +188 -0
  45. package/crates/naome-core/src/repository_model/explain.rs +121 -0
  46. package/crates/naome-core/src/repository_model/path_scan.rs +67 -0
  47. package/crates/naome-core/src/repository_model/path_support.rs +59 -0
  48. package/crates/naome-core/src/repository_model/types.rs +152 -0
  49. package/crates/naome-core/src/repository_model/world.rs +48 -0
  50. package/crates/naome-core/src/repository_model/world_adapters.rs +145 -0
  51. package/crates/naome-core/src/repository_model/world_path_facts.rs +55 -0
  52. package/crates/naome-core/src/repository_model/world_paths.rs +168 -0
  53. package/crates/naome-core/src/repository_model.rs +164 -0
  54. package/crates/naome-core/src/route/builtin_checks.rs +40 -1
  55. package/crates/naome-core/src/task_ledger/import.rs +142 -0
  56. package/crates/naome-core/src/task_ledger/model.rs +13 -0
  57. package/crates/naome-core/src/task_ledger/proof_record.rs +52 -0
  58. package/crates/naome-core/src/task_ledger/read.rs +118 -0
  59. package/crates/naome-core/src/task_ledger/render.rs +55 -0
  60. package/crates/naome-core/src/task_ledger/write.rs +38 -0
  61. package/crates/naome-core/src/task_ledger.rs +48 -0
  62. package/crates/naome-core/src/task_state/api.rs +4 -2
  63. package/crates/naome-core/src/task_state/completed_refresh.rs +5 -16
  64. package/crates/naome-core/src/task_state/diff.rs +2 -2
  65. package/crates/naome-core/src/task_state/evidence.rs +8 -3
  66. package/crates/naome-core/src/task_state/mod.rs +1 -1
  67. package/crates/naome-core/src/task_state/progress.rs +13 -0
  68. package/crates/naome-core/src/task_state/proof_model.rs +8 -8
  69. package/crates/naome-core/src/task_state/repair.rs +2 -2
  70. package/crates/naome-core/src/task_state/task_diff_api.rs +9 -18
  71. package/crates/naome-core/src/task_state/types.rs +24 -0
  72. package/crates/naome-core/src/verification.rs +29 -18
  73. package/crates/naome-core/src/workflow/agent/capability.rs +194 -0
  74. package/crates/naome-core/src/workflow/agent/context_delta.rs +42 -0
  75. package/crates/naome-core/src/workflow/agent/decision.rs +32 -0
  76. package/crates/naome-core/src/workflow/agent/execution.rs +80 -0
  77. package/crates/naome-core/src/workflow/agent/proof.rs +24 -0
  78. package/crates/naome-core/src/workflow/agent/support.rs +58 -0
  79. package/crates/naome-core/src/workflow/agent/watchdog.rs +47 -0
  80. package/crates/naome-core/src/workflow/agent.rs +34 -0
  81. package/crates/naome-core/src/workflow/agent_types.rs +105 -0
  82. package/crates/naome-core/src/workflow/doctor.rs +39 -0
  83. package/crates/naome-core/src/workflow/mod.rs +11 -0
  84. package/crates/naome-core/src/workflow/output.rs +8 -2
  85. package/crates/naome-core/src/workflow/phase_inference.rs +1 -1
  86. package/crates/naome-core/tests/context.rs +99 -0
  87. package/crates/naome-core/tests/harness_health.rs +4 -0
  88. package/crates/naome-core/tests/install_plan.rs +12 -0
  89. package/crates/naome-core/tests/quality.rs +178 -2
  90. package/crates/naome-core/tests/quality_performance.rs +39 -2
  91. package/crates/naome-core/tests/quality_structure_adapters.rs +39 -0
  92. package/crates/naome-core/tests/repo_support/mod.rs +5 -1
  93. package/crates/naome-core/tests/repo_support/verification_values.rs +55 -0
  94. package/crates/naome-core/tests/repository_model.rs +281 -0
  95. package/crates/naome-core/tests/route_user_diff.rs +49 -1
  96. package/crates/naome-core/tests/semantic_legacy.rs +72 -38
  97. package/crates/naome-core/tests/task_ledger.rs +328 -0
  98. package/crates/naome-core/tests/task_state.rs +28 -0
  99. package/crates/naome-core/tests/verification.rs +29 -36
  100. package/crates/naome-core/tests/workflow_agent.rs +233 -0
  101. package/crates/naome-core/tests/workflow_agent_support/mod.rs +159 -0
  102. package/crates/naome-core/tests/workflow_doctor.rs +21 -0
  103. package/installer/codex-hooks.js +121 -0
  104. package/installer/context.js +10 -0
  105. package/installer/filesystem.js +4 -0
  106. package/installer/flows.js +8 -4
  107. package/installer/harness-files.js +6 -0
  108. package/installer/install-plan.js +4 -0
  109. package/installer/main.js +1 -1
  110. package/installer/native.js +1 -1
  111. package/native/darwin-arm64/naome +0 -0
  112. package/native/linux-x64/naome +0 -0
  113. package/package.json +1 -1
  114. package/templates/naome-root/.codex/config.toml +2 -0
  115. package/templates/naome-root/.codex/hooks.json +70 -0
  116. package/templates/naome-root/.naome/bin/check-harness-health.js +8 -6
  117. package/templates/naome-root/.naome/bin/check-task-state.js +12 -7
  118. package/templates/naome-root/.naome/bin/codex-hook-io.js +122 -0
  119. package/templates/naome-root/.naome/bin/codex-hook-policy.js +180 -0
  120. package/templates/naome-root/.naome/bin/codex-hook-runtime.js +174 -0
  121. package/templates/naome-root/.naome/bin/codex-hook.js +6 -0
  122. package/templates/naome-root/.naome/bin/naome.js +35 -4
  123. package/templates/naome-root/.naome/manifest.json +12 -6
  124. package/templates/naome-root/.naome/repository-model.json +6 -0
  125. package/templates/naome-root/.naome/repository-quality.json +3 -1
  126. package/templates/naome-root/.naome/verification.json +15 -1
  127. package/templates/naome-root/AGENTS.md +38 -83
  128. package/templates/naome-root/docs/naome/agent-workflow.md +54 -18
  129. package/templates/naome-root/docs/naome/codex-hooks.md +82 -0
  130. package/templates/naome-root/docs/naome/context-economy.md +73 -0
  131. package/templates/naome-root/docs/naome/first-run.md +25 -14
  132. package/templates/naome-root/docs/naome/index.md +18 -10
  133. package/templates/naome-root/docs/naome/repository-model.md +92 -0
  134. package/templates/naome-root/docs/naome/repository-quality.md +47 -7
  135. package/templates/naome-root/docs/naome/repository-structure.md +10 -3
  136. package/templates/naome-root/docs/naome/task-ledger.md +71 -0
  137. package/templates/naome-root/docs/naome/testing.md +16 -3
@@ -6,7 +6,17 @@ NAOME keeps legacy debt visible without blocking unrelated feature work.
6
6
 
7
7
  - `naome quality check --changed` blocks only on files changed in the current
8
8
  diff. If a legacy file is touched, that file must satisfy the configured
9
- quality rules before commit.
9
+ quality and semantic changed rules before commit.
10
+ - `naome quality check --path <path>` is the early touched-file gate. Run it
11
+ immediately after editing a file to catch file length, diff growth, function
12
+ length, top-level symbol count, same-file duplicate regions, structure
13
+ issues, and stale adapter/model policy before a large task accumulates.
14
+ Repeat `--path` for a small touched set. This is a fast local feedback gate;
15
+ the final `--changed` gate still remains required.
16
+ - `naome semantic check --changed` is also exposed as the explicit semantic
17
+ changed gate. Fresh verification profiles require it next to
18
+ `repository-quality-check`; `quality check --changed` includes the same
19
+ semantic changed findings for backward compatibility with older profiles.
10
20
  - `naome quality report` scans the repository with normal budgets and reports
11
21
  debt without failing feature work. Full repository duplicate,
12
22
  near-duplicate, and semantic grouping checks are deep-only.
@@ -33,12 +43,41 @@ Adapters are plug-and-play profiles such as `rust` or
33
43
  path rules at runtime without hard-coding a specific product repository into
34
44
  the generic template.
35
45
 
46
+ Repository stacks can change after setup. `quality check --changed` and
47
+ `quality report` compare current repository signals with committed
48
+ `enabledAdapters`; when a new stack is present but not enabled, they emit
49
+ `adapter-policy-stale`. Use `naome quality reconcile --json` to inspect the
50
+ delta and `naome quality reconcile --write` to update
51
+ `.naome/repository-quality.json` and `.naome/repository-structure.json`
52
+ deterministically. Do not hand-edit adapter lists as the normal path.
53
+
54
+ Built-in adapter detection is path/manifest based and deterministic:
55
+
56
+ - `rust`: `Cargo.toml` or `.rs` files.
57
+ - `javascript-typescript`: `package.json` or JS/TS files.
58
+ - `swift`: `Package.swift` or `.swift` files.
59
+ - `xcode`: `.xcodeproj` or `.xcworkspace` content.
60
+ - `xctest`: Swift test targets such as `Tests`, `*Tests`, or `*UITests`.
61
+ - `swiftui`: SwiftUI-style app/view paths such as `*App.swift`,
62
+ `*View.swift`, `Views`, or Preview Content.
63
+ - `ios-app-structure`: iOS app entrypoints, `Info.plist`, entitlements, or
64
+ asset catalogs.
65
+ - `swift-package`: Swift Package Manager `Sources` and `Tests` layout.
66
+ - `ios-resources`: `.xcassets`, `.strings`, `.plist`, `.storyboard`, `.xib`,
67
+ and entitlements.
68
+ - `generated-ios`: SwiftGen, Sourcery, protobuf, and `*.generated.swift`
69
+ outputs.
70
+
36
71
  Local `pathRules` are project overrides, not product defaults. They may document
37
72
  repo-specific debt or special file roles, but loosening a rule to pass a feature
38
73
  diff requires human review.
39
74
 
40
75
  The scanner has three modes:
41
76
 
77
+ - `PathScoped`: explicitly requested touched files are read fully, with the
78
+ repository path index used for path/structure context. It avoids fully
79
+ analyzing unrelated changed files, making it suitable directly after file
80
+ writes.
42
81
  - `ChangedFast`: changed files are read fully; unchanged files may contribute
43
82
  cached facts for duplicate comparison.
44
83
  - `Report`: repository-wide, budgeted debt visibility. If budgets are hit, JSON
@@ -64,29 +103,30 @@ path roles, module/layer policy, adapters, and cleanup routing.
64
103
  Agents may propose stricter repo-specific rules after inspecting the language
65
104
  and stack.
66
105
 
67
- ## Planned Semantic Cleanup
106
+ ## Semantic Cleanup
68
107
 
69
108
  Some maintainability debt is semantic rather than purely syntactic. Examples
70
109
  include inline legacy compatibility fixtures, copied config objects, stale test
71
110
  builders, hand-written schema snapshots, and helper data that should move into a
72
111
  shared factory after enough call sites accumulate.
73
112
 
74
- NAOME should detect these with a generic semantic-cleanup layer instead of
75
- hard-coding product paths or deleting compatibility fixtures opportunistically.
76
- The planned model is:
113
+ NAOME detects these with a generic semantic-cleanup layer instead of hard-coding
114
+ product paths or deleting compatibility fixtures opportunistically. The model
115
+ is:
77
116
 
78
117
  - detect repeated object shapes, schema literals, fixture builders, and config
79
118
  snapshots across changed and report-mode files;
80
119
  - classify each finding as `legacy fixture`, `duplicated fixture`,
81
120
  `schema snapshot`, `generated metadata`, or `inline builder`;
82
121
  - keep existing report-mode debt visible without blocking unrelated work;
83
- - block only changed/new semantic debt unless local policy marks it report-only;
122
+ - block changed/new semantic debt through `quality check --changed` and
123
+ `semantic check --changed`;
84
124
  - route cleanup to extract a shared fixture, builder, schema writer, or generated
85
125
  metadata refresh command;
86
126
  - preserve behavior by requiring tests before removing or consolidating legacy
87
127
  compatibility fixtures.
88
128
 
89
- The first implementation exposes this as a scout, not an auto-fixer:
129
+ Semantic cleanup is a scout and gate, not an auto-fixer:
90
130
 
91
131
  - `naome semantic report --json` runs a budgeted semantic report.
92
132
  - `naome semantic report --deep --json` runs repo-wide semantic grouping.
@@ -36,9 +36,16 @@ module location is more appropriate.
36
36
  ## Adapters
37
37
 
38
38
  The core is language-independent. Adapters add deterministic signals for stack
39
- conventions. Built-in adapters currently include `rust` and
40
- `javascript-typescript`; future adapters can add source roots, test roots,
41
- module roots, and allowed root files without changing gate behavior.
39
+ conventions. Built-in adapters currently include `rust`,
40
+ `javascript-typescript`, `swift`, `xcode`, `xctest`, `swiftui`,
41
+ `ios-app-structure`, `swift-package`, `ios-resources`, and `generated-ios`.
42
+ Future adapters can add source roots, test roots, module roots, and allowed
43
+ root files without changing gate behavior.
44
+
45
+ If the repository later adds a new stack, `quality check --changed` and
46
+ `quality report` emit `adapter-policy-stale` until
47
+ `naome quality reconcile --write` updates the committed quality and structure
48
+ policy files.
42
49
 
43
50
  ## Local Policy
44
51
 
@@ -0,0 +1,71 @@
1
+ # Task Ledger
2
+
3
+ NAOME task state is moving from one mutable aggregate file to a canonical task
4
+ ledger. The compatibility file `.naome/task-state.json` remains supported, but
5
+ new deterministic task tooling can use `.naome/tasks/` as the source of truth.
6
+
7
+ ## Layout
8
+
9
+ ```text
10
+ .naome/tasks/
11
+ active.json
12
+ <task-id>/
13
+ task.json
14
+ events.jsonl
15
+ mutations.json
16
+ proofs/
17
+ <check-id>.json
18
+ ```
19
+
20
+ - `active.json` identifies the primary task and leaves room for future
21
+ worklanes.
22
+ - `task.json` contains the stable task contract: request, prompt, admission,
23
+ allowed paths, change types, required checks, and human-review policy.
24
+ - `events.jsonl` is append-only. Status changes, blockers, and later decisions
25
+ are added as events instead of rewriting the whole task.
26
+ - `mutations.json` records touched paths and mutation ownership.
27
+ - `proofs/<check-id>.json` stores one verification result per check so parallel
28
+ checks do not rewrite the same file.
29
+
30
+ ## Compatibility
31
+
32
+ Existing `naome.task-state.v1` and `naome.task-state.v2` files remain valid. If
33
+ `.naome/tasks/active.json` exists, NAOME readers build a canonical task model
34
+ from the ledger and render a `naome.task-state.v2` projection. If no ledger is
35
+ present, readers fall back to `.naome/task-state.json`.
36
+
37
+ Use this command when an external tool needs the compatibility file refreshed:
38
+
39
+ ```text
40
+ node .naome/bin/naome.js task render-state --write --json
41
+ ```
42
+
43
+ `naome sync` automatically splits an active legacy `task-state` file into the
44
+ ledger layout. The explicit command remains available for repair or tests:
45
+
46
+ ```text
47
+ node .naome/bin/naome.js task migrate-ledger --write --json
48
+ ```
49
+
50
+ After `.naome/tasks/active.json` exists, `.naome/task-state.json` is a rendered
51
+ compatibility projection. NAOME gates reject a stale projection and report the
52
+ render command instead of accepting hand-edited aggregate state.
53
+
54
+ ## Conflict Policy
55
+
56
+ `.naome/tasks/` is NAOME control state. It is not task feature scope and is not
57
+ required as proof evidence. Gates ignore ledger control files when checking
58
+ whether product changes stay inside `allowedPaths`.
59
+
60
+ The intended long-term model is:
61
+
62
+ ```text
63
+ task spec + events + mutations + proofs + verification config
64
+ => canonical task model
65
+ => generated task-state projection
66
+ => gates / route / commit / completion
67
+ ```
68
+
69
+ This keeps old repositories backward-compatible while making future parallel
70
+ agents safer: separate agents and checks can write separate event/proof files
71
+ instead of all competing for `.naome/task-state.json`.
@@ -9,6 +9,18 @@ Status: Uninitialized
9
9
  | NAOME baseline | Built-in harness proof | See Known Checks | Seeded by installer; extend during first-run intake. |
10
10
  | Repository-specific work | Unknown | Unknown | Fill during first-run intake. |
11
11
 
12
+ ## Early Feedback
13
+
14
+ After writing or heavily editing a file, run
15
+ `node .naome/bin/naome.js quality check --path <path>` for immediate
16
+ touched-file feedback. This catches local size, symbol, duplicate, structure,
17
+ and stale-policy issues before the task grows. It does not replace the final
18
+ `repository-quality-check`; always run the changed-file gate before completion.
19
+
20
+ Optional Codex hooks can provide the same kind of early feedback during an
21
+ agent run. They are acceleration only; final proof still comes from the
22
+ commands in this document and `.naome/verification.json`.
23
+
12
24
  ## Known Checks
13
25
 
14
26
  | Check id | Command | Cwd | Cost | Last verified |
@@ -17,6 +29,7 @@ Status: Uninitialized
17
29
  | naome-harness-health | `node .naome/bin/check-harness-health.js` | `.` | fast | null |
18
30
  | naome-task-state | `node .naome/bin/check-task-state.js` | `.` | fast | null |
19
31
  | repository-quality-check | `node .naome/bin/naome.js quality check --changed` | `.` | fast | null |
32
+ | repository-semantic-check | `node .naome/bin/naome.js semantic check --changed` | `.` | fast | null |
20
33
 
21
34
  ## Verification Phases
22
35
 
@@ -57,8 +70,8 @@ phase is failing or missing.
57
70
  and 10 release gates.
58
71
  - Store long command output as a compact summary that preserves command, cwd,
59
72
  exit code, relevant lines, affected paths, and artifacts.
60
- - When intake defines change types, include `repository-quality-check` as a
61
- required check for source, structure, documentation, harness, template, and
62
- CI changes.
73
+ - When intake defines change types, include `repository-quality-check` and
74
+ `repository-semantic-check` as required checks for source, structure,
75
+ documentation, harness, template, and CI changes.
63
76
  - Before completion, select proof from the Verification Map when possible.
64
77
  - Report exact commands and results. Do not claim proof that did not run.