human-to-code 0.1.16 → 0.1.18

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 (50) hide show
  1. package/Readme.md +18 -7
  2. package/SECURITY.md +25 -7
  3. package/dist/agents/direct/candidate-overlay.d.ts +36 -0
  4. package/dist/agents/direct/candidate-overlay.d.ts.map +1 -0
  5. package/dist/agents/direct/candidate-overlay.js +123 -0
  6. package/dist/agents/direct/candidate-overlay.js.map +1 -0
  7. package/dist/agents/direct/candidate-validation.d.ts.map +1 -1
  8. package/dist/agents/direct/candidate-validation.js +57 -18
  9. package/dist/agents/direct/candidate-validation.js.map +1 -1
  10. package/dist/agents/direct/dependency-graph.d.ts +25 -0
  11. package/dist/agents/direct/dependency-graph.d.ts.map +1 -0
  12. package/dist/agents/direct/dependency-graph.js +140 -0
  13. package/dist/agents/direct/dependency-graph.js.map +1 -0
  14. package/dist/agents/direct/discovery.d.ts +2 -0
  15. package/dist/agents/direct/discovery.d.ts.map +1 -1
  16. package/dist/agents/direct/discovery.js +4 -0
  17. package/dist/agents/direct/discovery.js.map +1 -1
  18. package/dist/agents/direct/generation-client.d.ts +11 -0
  19. package/dist/agents/direct/generation-client.d.ts.map +1 -1
  20. package/dist/agents/direct/generation-client.js +20 -9
  21. package/dist/agents/direct/generation-client.js.map +1 -1
  22. package/dist/agents/direct/index.d.ts +4 -0
  23. package/dist/agents/direct/index.d.ts.map +1 -1
  24. package/dist/agents/direct/index.js +4 -0
  25. package/dist/agents/direct/index.js.map +1 -1
  26. package/dist/agents/direct/presentation.js +2 -2
  27. package/dist/agents/direct/presentation.js.map +1 -1
  28. package/dist/agents/direct/program-diagnostics.d.ts +39 -0
  29. package/dist/agents/direct/program-diagnostics.d.ts.map +1 -0
  30. package/dist/agents/direct/program-diagnostics.js +170 -0
  31. package/dist/agents/direct/program-diagnostics.js.map +1 -0
  32. package/dist/agents/direct/staged-validation.d.ts +53 -0
  33. package/dist/agents/direct/staged-validation.d.ts.map +1 -0
  34. package/dist/agents/direct/staged-validation.js +182 -0
  35. package/dist/agents/direct/staged-validation.js.map +1 -0
  36. package/dist/cli.d.ts.map +1 -1
  37. package/dist/cli.js +54 -3
  38. package/dist/cli.js.map +1 -1
  39. package/dist/prompts/direct-repair.d.ts +30 -0
  40. package/dist/prompts/direct-repair.d.ts.map +1 -0
  41. package/dist/prompts/direct-repair.js +34 -0
  42. package/dist/prompts/direct-repair.js.map +1 -0
  43. package/dist/prompts/index.d.ts +1 -0
  44. package/dist/prompts/index.d.ts.map +1 -1
  45. package/dist/prompts/index.js +1 -0
  46. package/dist/prompts/index.js.map +1 -1
  47. package/docs/ARCHITECTURE.md +22 -8
  48. package/docs/MODULES.md +8 -2
  49. package/docs/SCALABILITY.md +9 -3
  50. package/package.json +3 -4
package/docs/MODULES.md CHANGED
@@ -71,6 +71,7 @@ accept typed, already-reviewed data and perform no I/O or mutation.
71
71
  | Module | Purpose |
72
72
  | --- | --- |
73
73
  | `direct-conversion.ts` | System and user messages for whole-file and inline direct conversion, including FileMemory rules and examples. |
74
+ | `direct-repair.ts` | Bounded cross-file repair messages for one generated JS/TS unit: original instruction, current candidate, normalized compiler diagnostics, and related generated files, all framed as untrusted data. |
74
75
  | `guided-patch.ts` | Structured patch-generation messages: reviewed contract, target profile, immutable snapshot hash, compiler skills, and wrapped untrusted evidence. |
75
76
  | `guided-repair.ts` | Bounded repair messages that freeze contract, snapshot, validation plan, paths, operations, and scope. |
76
77
  | `provider-output.ts` | Host-enforced JSON output-contract message used only when a provider lacks native JSON Schema support. |
@@ -88,9 +89,13 @@ accept typed, already-reviewed data and perform no I/O or mutation.
88
89
  | `discovery.ts` | Bounded file walking and conversion-unit creation, including existing-target and unsupported-marker notices. |
89
90
  | `declarations.ts` | Language-aware declared-identifier extraction, including type-led C, C++, C#, and Java declarations. |
90
91
  | `replacement.ts` | Exact inline-marker byte verification plus newline-preserving indentation formatting shared by memory and application. |
91
- | `candidate-validation.ts` | Pre-write syntax gate: TypeScript parser diagnostics for JS/TS and deterministic structure checks for other direct languages. It does not claim semantic or sandbox verification. |
92
+ | `candidate-validation.ts` | Baseline-aware pre-write syntax gate: TypeScript parser diagnostics for JS/TS and deterministic structure checks for other direct languages. Inline units are rejected only for newly introduced diagnostics. It does not claim semantic or sandbox verification. |
93
+ | `candidate-overlay.ts` | In-memory candidate overlay combining whole-file outputs and inline replacements for staged validation; the working tree stays unchanged and stale or conflicting units are excluded fail-closed. |
94
+ | `program-diagnostics.ts` | Combined TypeScript Compiler API validation over the candidate overlay: permissive fixed compiler options, an overlay-aware compiler host, bundled `node:` builtin typings, and multiplicity/location-aware baseline-vs-candidate diagnostic comparison. Static compilation only — it never imports or executes project code. |
95
+ | `dependency-graph.ts` | Resolved-import dependency grouping of candidate files and bounded diagnostic-to-unit attribution; diagnostics that cannot be safely attributed fail the whole staged batch. |
96
+ | `staged-validation.ts` | Orchestrates overlay build, combined program validation, group rejection, and the bounded per-unit repair budget (secret-scanned repair context, injected repair callback). Produces per-unit accept/reject results for the CLI. |
92
97
  | `file-memory.ts` | Ephemeral declaration memory, replacement normalization, candidate-validation retry isolation, and sequential per-file generation. |
93
- | `generation-client.ts` | One direct provider request through OpenAI-compatible chat or Ollama, using the central direct prompt builder. |
98
+ | `generation-client.ts` | Direct provider requests through OpenAI-compatible chat or Ollama: one conversion request per unit plus bounded cross-file repair requests, always using the central prompt builders. |
94
99
  | `presentation.ts` | Stable conversion receipt and unambiguous single-code-block extraction; rejects multiple or unterminated fences. |
95
100
  | `application.ts` | Stale-safe inline replacement and exclusive whole-file creation that never overwrites a sibling. |
96
101
  | `index.ts` | Direct-agent export surface used by the CLI and package entry point. |
@@ -133,5 +138,6 @@ accept typed, already-reviewed data and perform no I/O or mutation.
133
138
  | `test/planner.test.ts`, `test/patch.test.ts`, `test/snapshot.test.ts`, `test/run-store.test.ts`, `test/validation.test.ts`, `test/guided-agent.test.ts` | Guided mechanics and lifecycle stage by stage, including apply/rollback and repair limits. |
134
139
  | `test/direct-agent.test.ts` | Lexical marker discovery, FileMemory indexing/normalization, provider prompts, retry isolation, and application. |
135
140
  | `test/direct-reliability.test.ts` | Regression coverage for direct issues 02 and 04–11: JSDoc, output cleanup, validation, overwrite/staleness/indent guards, regex memory, C-family declarations, and discovery notices. |
141
+ | `test/staged-validation.test.ts` | Issue 12 coverage: calculator-style cross-file rejection, consistent-candidate acceptance, bounded repair success and exhaustion, named-import/member/union/arity detection, baseline tolerance and multiplicity comparison, dependency-group isolation, and overlay write guards. |
136
142
  | `test/cli.test.ts` | Command surface and exit codes. |
137
143
  | `test/package-smoke.mjs` | Packed-tarball install, public import, installed-CLI invocation (`npm run package:check`). |
@@ -88,9 +88,15 @@ between releases:
88
88
  validate at the boundary and let types flow.
89
89
  - **Minimal production dependencies.** HTTP, hashing, JSON, process handling,
90
90
  provider access, and orchestration use Node built-ins. TypeScript is the one
91
- deliberate runtime parser dependency for direct JS/TS candidate validation.
92
- Adding another runtime dependency changes the supply-chain posture and needs
93
- a design discussion first.
91
+ deliberate runtime compiler dependency for direct JS/TS candidate validation,
92
+ both per-file syntax checks and the combined candidate-project type check;
93
+ `@types/node` ships with it so `node:` builtin imports resolve in target
94
+ projects without their own type dependencies. Combined validation builds a
95
+ TypeScript program over the project's JS/TS files per staged pass, so its
96
+ cost grows with project size — the walk is bounded and `skipLibCheck` is
97
+ forced, but very large repositories pay a real compile cost per conversion
98
+ run. Adding another runtime dependency changes the supply-chain posture and
99
+ needs a design discussion first.
94
100
  - **Errors are typed and named.** Each layer exports its own error classes
95
101
  (`ArtifactValidationError`, `ProviderError`, `PatchSafetyError`, …) so the
96
102
  CLI can map failures to exit codes without string matching. Error messages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "human-to-code",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Safely turn reviewed natural-language change contracts into validated code patches.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,6 +29,7 @@
29
29
  "node": ">=24.0.0"
30
30
  },
31
31
  "dependencies": {
32
+ "@types/node": "24.13.3",
32
33
  "typescript": "5.9.3"
33
34
  },
34
35
  "scripts": {
@@ -52,7 +53,5 @@
52
53
  "publishConfig": {
53
54
  "access": "public"
54
55
  },
55
- "devDependencies": {
56
- "@types/node": "24.13.3"
57
- }
56
+ "devDependencies": {}
58
57
  }