human-to-code 0.1.14 → 0.1.16

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 +17 -4
  2. package/SECURITY.md +16 -1
  3. package/dist/agents/direct/application.d.ts +3 -0
  4. package/dist/agents/direct/application.d.ts.map +1 -1
  5. package/dist/agents/direct/application.js +23 -2
  6. package/dist/agents/direct/application.js.map +1 -1
  7. package/dist/agents/direct/candidate-validation.d.ts +8 -0
  8. package/dist/agents/direct/candidate-validation.d.ts.map +1 -0
  9. package/dist/agents/direct/candidate-validation.js +125 -0
  10. package/dist/agents/direct/candidate-validation.js.map +1 -0
  11. package/dist/agents/direct/declarations.d.ts +3 -0
  12. package/dist/agents/direct/declarations.d.ts.map +1 -0
  13. package/dist/agents/direct/declarations.js +36 -0
  14. package/dist/agents/direct/declarations.js.map +1 -0
  15. package/dist/agents/direct/discovery.d.ts +4 -2
  16. package/dist/agents/direct/discovery.d.ts.map +1 -1
  17. package/dist/agents/direct/discovery.js +48 -5
  18. package/dist/agents/direct/discovery.js.map +1 -1
  19. package/dist/agents/direct/file-memory.d.ts.map +1 -1
  20. package/dist/agents/direct/file-memory.js +8 -12
  21. package/dist/agents/direct/file-memory.js.map +1 -1
  22. package/dist/agents/direct/index.d.ts +3 -0
  23. package/dist/agents/direct/index.d.ts.map +1 -1
  24. package/dist/agents/direct/index.js +3 -0
  25. package/dist/agents/direct/index.js.map +1 -1
  26. package/dist/agents/direct/marker-parser.d.ts.map +1 -1
  27. package/dist/agents/direct/marker-parser.js +18 -3
  28. package/dist/agents/direct/marker-parser.js.map +1 -1
  29. package/dist/agents/direct/presentation.d.ts +3 -0
  30. package/dist/agents/direct/presentation.d.ts.map +1 -1
  31. package/dist/agents/direct/presentation.js +16 -2
  32. package/dist/agents/direct/presentation.js.map +1 -1
  33. package/dist/agents/direct/replacement.d.ts +10 -0
  34. package/dist/agents/direct/replacement.d.ts.map +1 -0
  35. package/dist/agents/direct/replacement.js +19 -0
  36. package/dist/agents/direct/replacement.js.map +1 -0
  37. package/dist/agents/direct/types.d.ts +13 -0
  38. package/dist/agents/direct/types.d.ts.map +1 -1
  39. package/dist/cli.d.ts.map +1 -1
  40. package/dist/cli.js +19 -7
  41. package/dist/cli.js.map +1 -1
  42. package/dist/pipeline/file-memory.d.ts.map +1 -1
  43. package/dist/pipeline/file-memory.js +42 -1
  44. package/dist/pipeline/file-memory.js.map +1 -1
  45. package/docs/ARCHITECTURE.md +16 -10
  46. package/docs/MODULES.md +10 -6
  47. package/docs/SCALABILITY.md +4 -3
  48. package/docs/roadmap/README.md +2 -1
  49. package/docs/roadmap/ruby.md +3 -4
  50. package/package.json +5 -3
package/docs/MODULES.md CHANGED
@@ -84,12 +84,15 @@ accept typed, already-reviewed data and perform no I/O or mutation.
84
84
  | --- | --- |
85
85
  | `types.ts` | Direct-agent request, unit, progress, result, and provider-option types. |
86
86
  | `languages.ts` | Language-to-extension and human-readable prompt-label mapping. |
87
- | `marker-parser.ts` | Lightweight lexical scanner for real `@human` comment markers; quoted and already-commented examples stay inert. |
88
- | `discovery.ts` | Bounded file walking and conversion-unit creation for `.human` files and inline markers. |
89
- | `file-memory.ts` | Ephemeral declaration memory, replacement normalization, retry isolation, and sequential per-file generation. |
87
+ | `marker-parser.ts` | Lightweight lexical scanner for real line, block, and JSDoc `@human` comment markers; quoted and already-commented examples stay inert. |
88
+ | `discovery.ts` | Bounded file walking and conversion-unit creation, including existing-target and unsupported-marker notices. |
89
+ | `declarations.ts` | Language-aware declared-identifier extraction, including type-led C, C++, C#, and Java declarations. |
90
+ | `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
+ | `file-memory.ts` | Ephemeral declaration memory, replacement normalization, candidate-validation retry isolation, and sequential per-file generation. |
90
93
  | `generation-client.ts` | One direct provider request through OpenAI-compatible chat or Ollama, using the central direct prompt builder. |
91
- | `presentation.ts` | Stable conversion receipt and code-fence cleanup. |
92
- | `application.ts` | Exact-range inline replacement and whole-file writes. |
94
+ | `presentation.ts` | Stable conversion receipt and unambiguous single-code-block extraction; rejects multiple or unterminated fences. |
95
+ | `application.ts` | Stale-safe inline replacement and exclusive whole-file creation that never overwrites a sibling. |
93
96
  | `index.ts` | Direct-agent export surface used by the CLI and package entry point. |
94
97
 
95
98
  ### `src/agents/guided/`
@@ -112,7 +115,7 @@ accept typed, already-reviewed data and perform no I/O or mutation.
112
115
  | `patch.ts` | Constrained patch validation and atomic application (`preparePatch`, `applyPatchAtomic`, `PatchSafetyError`, `PatchPolicy`): scope/hash/anchor checks, protected/generated/lockfile refusal, traversal/symlink/binary/collision rejection, per-file atomic writes, rollback artifacts. |
113
116
  | `validation.ts` | Strong container-only validation (`validateBaselineAndCandidate`, `strongSandboxAvailable`): Docker/Podman sandbox with no network, read-only root, scrubbed environment, resource limits; unchanged baseline first, then candidate; secret-scanned output. |
114
117
  | `run-store.ts` | `RunStore`: durable, private, crash-safe run metadata (contracts, patches, reports, rollback artifacts) with recursive secret gating on every write. |
115
- | `file-memory.ts` | Dependency-free static declaration/signature indexing for every language scanned by the direct path. Produces exact line-range evidence without executing project code. |
118
+ | `file-memory.ts` | Dependency-free static declaration/signature indexing for every language scanned by the direct path, including JavaScript regex-literal awareness. Produces exact line-range evidence without executing project code. |
116
119
  | `simple.ts` | Deprecated source-compatibility re-export for `agents/direct/`; contains no implementation. |
117
120
  | `workflow.ts` | Deprecated source-compatibility re-export for `agents/guided/`; contains no implementation. |
118
121
 
@@ -129,5 +132,6 @@ accept typed, already-reviewed data and perform no I/O or mutation.
129
132
  | `test/certification.test.ts`, `test/release-gate.test.ts` | Certification evidence gate and release-status honesty. |
130
133
  | `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. |
131
134
  | `test/direct-agent.test.ts` | Lexical marker discovery, FileMemory indexing/normalization, provider prompts, retry isolation, and application. |
135
+ | `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. |
132
136
  | `test/cli.test.ts` | Command surface and exit codes. |
133
137
  | `test/package-smoke.mjs` | Packed-tarball install, public import, installed-CLI invocation (`npm run package:check`). |
@@ -87,9 +87,10 @@ between releases:
87
87
  `noUncheckedIndexedAccess` stay on; avoid `any` and non-null assertions —
88
88
  validate at the boundary and let types flow.
89
89
  - **Minimal production dependencies.** HTTP, hashing, JSON, process handling,
90
- provider access, and orchestration use Node built-ins. Adding a runtime
91
- dependency changes the supply-chain posture and needs a design discussion
92
- first.
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.
93
94
  - **Errors are typed and named.** Each layer exports its own error classes
94
95
  (`ArtifactValidationError`, `ProviderError`, `PatchSafetyError`, …) so the
95
96
  CLI can map failures to exit codes without string matching. Error messages
@@ -12,7 +12,8 @@ up this ladder deliberately:
12
12
  1. **Direct path** (`src/agents/direct/`) — the language has an entry in
13
13
  `LANGUAGE_PROFILES` (output extension + prompt label) and, if it has an
14
14
  inline-comment form, its source extensions are in `SCANNED_EXTENSIONS` for
15
- `@human` markers. No grounding, no validation; receipt-and-confirm only.
15
+ `@human` markers. This path has pre-write syntax/structure checks, but no API
16
+ grounding, project build/test execution, sandbox, or `VERIFIED` status.
16
17
  *Today: TypeScript, JavaScript, Python, Rust, Go, Java, Ruby, C#, C++, C.*
17
18
  2. **General fallback** (`src/analysis/adapters/general.ts`) — any declared
18
19
  language can flow through the guided pipeline ungrounded, permanently
@@ -1,9 +1,9 @@
1
1
  # Ruby support plan
2
2
 
3
3
  ## Status today
4
- Level 1: `LANGUAGE_PROFILES` has `ruby` (`.rb`); `.rb` is **not** yet in
5
- `SCANNED_EXTENSIONS`, so inline `# @human` markers in Ruby files are not
6
- discovered adding it is a one-line prerequisite worth shipping early.
4
+ Level 1: `LANGUAGE_PROFILES` has `ruby` (`.rb`) and `.rb` is in
5
+ `SCANNED_EXTENSIONS`, so whole-file `.human` and inline `# @human` markers
6
+ work through the direct path. No grounded profile exists yet.
7
7
 
8
8
  ## Target profile
9
9
  - `Ecosystem`: `ruby`.
@@ -38,7 +38,6 @@ elevated-risk. Dynamic requires make import grounding partially opaque —
38
38
  document as an accepted limitation like Python's.
39
39
 
40
40
  ## Checklist
41
- 0. Add `.rb` to `SCANNED_EXTENSIONS` in `agents/direct/discovery.ts` (independent quick win).
42
41
  1. `Ecosystem` union + `analysis/adapters/ruby.ts`.
43
42
  2. `ruby/gem`, `ruby/rails`, `ruby/rack` at `preview`.
44
43
  3. Register adapter; Ruby/Rails skill pack.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "human-to-code",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Safely turn reviewed natural-language change contracts into validated code patches.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,6 +28,9 @@
28
28
  "engines": {
29
29
  "node": ">=24.0.0"
30
30
  },
31
+ "dependencies": {
32
+ "typescript": "5.9.3"
33
+ },
31
34
  "scripts": {
32
35
  "build": "tsc -p tsconfig.json",
33
36
  "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
@@ -50,7 +53,6 @@
50
53
  "access": "public"
51
54
  },
52
55
  "devDependencies": {
53
- "@types/node": "24.13.3",
54
- "typescript": "5.9.3"
56
+ "@types/node": "24.13.3"
55
57
  }
56
58
  }