llm-mock-server 1.0.6 → 1.0.7
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.
- package/dist/cli/cli.d.ts +3 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +103 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/validators.d.ts +7 -0
- package/dist/cli/validators.d.ts.map +1 -0
- package/dist/cli/validators.js +53 -0
- package/dist/cli/validators.js.map +1 -0
- package/dist/formats/anthropic/index.d.ts +1 -1
- package/dist/formats/anthropic/index.d.ts.map +1 -1
- package/dist/formats/anthropic/index.js +1 -1
- package/dist/formats/anthropic/index.js.map +1 -1
- package/dist/formats/anthropic/parse.d.ts +2 -2
- package/dist/formats/anthropic/parse.d.ts.map +1 -1
- package/dist/formats/anthropic/parse.js +4 -2
- package/dist/formats/anthropic/parse.js.map +1 -1
- package/dist/formats/anthropic/schema.d.ts +1 -1
- package/dist/formats/anthropic/schema.d.ts.map +1 -1
- package/dist/formats/anthropic/schema.js +9 -4
- package/dist/formats/anthropic/schema.js.map +1 -1
- package/dist/formats/anthropic/serialize.d.ts +2 -2
- package/dist/formats/anthropic/serialize.d.ts.map +1 -1
- package/dist/formats/anthropic/serialize.js +76 -19
- package/dist/formats/anthropic/serialize.js.map +1 -1
- package/dist/formats/openai/chat-completions/index.d.ts +3 -0
- package/dist/formats/openai/chat-completions/index.d.ts.map +1 -0
- package/dist/formats/openai/chat-completions/index.js +13 -0
- package/dist/formats/openai/chat-completions/index.js.map +1 -0
- package/dist/formats/openai/chat-completions/parse.d.ts +4 -0
- package/dist/formats/openai/chat-completions/parse.d.ts.map +1 -0
- package/dist/formats/openai/chat-completions/parse.js +33 -0
- package/dist/formats/openai/chat-completions/parse.js.map +1 -0
- package/dist/formats/openai/chat-completions/schema.d.ts +93 -0
- package/dist/formats/openai/chat-completions/schema.d.ts.map +1 -0
- package/dist/formats/openai/chat-completions/schema.js +74 -0
- package/dist/formats/openai/chat-completions/schema.js.map +1 -0
- package/dist/formats/openai/chat-completions/serialize.d.ts +10 -0
- package/dist/formats/openai/chat-completions/serialize.d.ts.map +1 -0
- package/dist/formats/openai/chat-completions/serialize.js +99 -0
- package/dist/formats/openai/chat-completions/serialize.js.map +1 -0
- package/dist/formats/openai/responses/index.d.ts +3 -0
- package/dist/formats/openai/responses/index.d.ts.map +1 -0
- package/dist/formats/openai/responses/index.js +13 -0
- package/dist/formats/openai/responses/index.js.map +1 -0
- package/dist/formats/openai/responses/parse.d.ts +4 -0
- package/dist/formats/openai/responses/parse.d.ts.map +1 -0
- package/dist/formats/openai/responses/parse.js +51 -0
- package/dist/formats/openai/responses/parse.js.map +1 -0
- package/dist/formats/openai/responses/schema.d.ts +103 -0
- package/dist/formats/openai/responses/schema.d.ts.map +1 -0
- package/dist/formats/openai/responses/schema.js +71 -0
- package/dist/formats/openai/responses/schema.js.map +1 -0
- package/dist/formats/openai/responses/serialize.d.ts +10 -0
- package/dist/formats/openai/responses/serialize.d.ts.map +1 -0
- package/dist/formats/openai/responses/serialize.js +273 -0
- package/dist/formats/openai/responses/serialize.js.map +1 -0
- package/dist/formats/request-helpers.d.ts +1 -1
- package/dist/formats/request-helpers.d.ts.map +1 -1
- package/dist/formats/request-helpers.js.map +1 -1
- package/dist/formats/serialize-helpers.d.ts +1 -1
- package/dist/formats/serialize-helpers.d.ts.map +1 -1
- package/dist/formats/serialize-helpers.js +6 -3
- package/dist/formats/serialize-helpers.js.map +1 -1
- package/dist/formats/types.d.ts +2 -1
- package/dist/formats/types.d.ts.map +1 -1
- package/dist/history.d.ts +6 -2
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +2 -0
- package/dist/history.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +26 -9
- package/dist/loader.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +12 -4
- package/dist/logger.js.map +1 -1
- package/dist/mock-server.d.ts +44 -48
- package/dist/mock-server.d.ts.map +1 -1
- package/dist/mock-server.js +37 -85
- package/dist/mock-server.js.map +1 -1
- package/dist/route-handler.d.ts +1 -1
- package/dist/route-handler.d.ts.map +1 -1
- package/dist/route-handler.js +19 -7
- package/dist/route-handler.js.map +1 -1
- package/dist/rule-builder.d.ts +21 -0
- package/dist/rule-builder.d.ts.map +1 -0
- package/dist/rule-builder.js +58 -0
- package/dist/rule-builder.js.map +1 -0
- package/dist/rule-engine.d.ts +3 -1
- package/dist/rule-engine.d.ts.map +1 -1
- package/dist/rule-engine.js +7 -2
- package/dist/rule-engine.js.map +1 -1
- package/dist/sse-writer.d.ts +1 -1
- package/dist/sse-writer.d.ts.map +1 -1
- package/dist/types/reply.d.ts +51 -8
- package/dist/types/reply.d.ts.map +1 -1
- package/dist/types/request.d.ts +21 -6
- package/dist/types/request.d.ts.map +1 -1
- package/dist/types/rule.d.ts +65 -7
- package/dist/types/rule.d.ts.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -9
- package/.claude/skills/desloppify/SKILL.md +0 -308
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/canonical_import_20260315_000801.json +0 -242
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/canonical_import_20260315_000905.json +0 -248
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/canonical_import_20260315_000917.json +0 -248
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/canonical_import_20260315_000950.json +0 -311
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/claude_launch_prompt.md +0 -17
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/review_result.json +0 -255
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/review_result.template.json +0 -22
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/reviewer_instructions.md +0 -20
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/session.json +0 -20
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/canonical_import_20260315_050000.json +0 -286
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/canonical_import_20260315_050028.json +0 -303
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/claude_launch_prompt.md +0 -17
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/review_result.json +0 -297
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/review_result.template.json +0 -22
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/reviewer_instructions.md +0 -20
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/session.json +0 -20
- package/.desloppify/query.json +0 -1312
- package/.desloppify/review_packet_blind.json +0 -1249
- package/.desloppify/review_packets/holistic_packet_20260315_000339.json +0 -1471
- package/.desloppify/review_packets/holistic_packet_20260315_045546.json +0 -1480
- package/.desloppify/review_packets/holistic_packet_20260315_185401.json +0 -1407
- package/.desloppify/review_packets/holistic_packet_20260315_185613.json +0 -1407
- package/.desloppify/state-typescript.json +0 -8438
- package/.desloppify/state-typescript.json.bak +0 -8432
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-1.log +0 -384
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-10.log +0 -484
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-2.log +0 -408
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-3.log +0 -416
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-4.log +0 -360
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-5.log +0 -360
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-6.log +0 -364
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-7.log +0 -428
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-8.log +0 -388
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-9.log +0 -500
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-1.md +0 -83
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-10.md +0 -108
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-2.md +0 -89
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-3.md +0 -91
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-4.md +0 -77
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-5.md +0 -77
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-6.md +0 -78
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-7.md +0 -94
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-8.md +0 -84
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-9.md +0 -112
- package/.desloppify/subagents/runs/20260315_185401/results/batch-1.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-10.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-2.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-3.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-4.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-5.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-6.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-7.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-8.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-9.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/run.log +0 -36
- package/.desloppify/subagents/runs/20260315_185401/run_summary.json +0 -156
- package/.desloppify/subagents/runs/20260315_185613/holistic_findings_merged.json +0 -741
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-1.log +0 -579
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-10.log +0 -1537
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-2.log +0 -829
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-3.log +0 -927
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-4.log +0 -429
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-5.log +0 -276
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-6.log +0 -450
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-7.log +0 -730
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-8.log +0 -698
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-9.log +0 -938
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-1.md +0 -83
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-10.md +0 -108
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-2.md +0 -89
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-3.md +0 -91
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-4.md +0 -77
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-5.md +0 -77
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-6.md +0 -78
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-7.md +0 -94
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-8.md +0 -84
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-9.md +0 -112
- package/.desloppify/subagents/runs/20260315_185613/results/batch-1.raw.txt +0 -78
- package/.desloppify/subagents/runs/20260315_185613/results/batch-10.raw.txt +0 -242
- package/.desloppify/subagents/runs/20260315_185613/results/batch-2.raw.txt +0 -102
- package/.desloppify/subagents/runs/20260315_185613/results/batch-3.raw.txt +0 -94
- package/.desloppify/subagents/runs/20260315_185613/results/batch-4.raw.txt +0 -86
- package/.desloppify/subagents/runs/20260315_185613/results/batch-5.raw.txt +0 -1
- package/.desloppify/subagents/runs/20260315_185613/results/batch-6.raw.txt +0 -87
- package/.desloppify/subagents/runs/20260315_185613/results/batch-7.raw.txt +0 -1
- package/.desloppify/subagents/runs/20260315_185613/results/batch-8.raw.txt +0 -107
- package/.desloppify/subagents/runs/20260315_185613/results/batch-9.raw.txt +0 -67
- package/.desloppify/subagents/runs/20260315_185613/run.log +0 -96
- package/.desloppify/subagents/runs/20260315_185613/run_summary.json +0 -156
- package/.editorconfig +0 -12
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/docs.yml +0 -46
- package/.github/workflows/test.yml +0 -40
- package/.markdownlint.jsonc +0 -11
- package/.node-version +0 -1
- package/.oxfmtrc.json +0 -9
- package/.oxlintrc.json +0 -35
- package/docs/ARCHITECTURE.md +0 -125
- package/scorecard.png +0 -0
- package/src/cli/cli.ts +0 -141
- package/src/cli/validators.ts +0 -68
- package/src/formats/anthropic/index.ts +0 -14
- package/src/formats/anthropic/parse.ts +0 -70
- package/src/formats/anthropic/schema.ts +0 -74
- package/src/formats/anthropic/serialize.ts +0 -179
- package/src/formats/openai/chat-completions/index.ts +0 -14
- package/src/formats/openai/chat-completions/parse.ts +0 -47
- package/src/formats/openai/chat-completions/schema.ts +0 -92
- package/src/formats/openai/chat-completions/serialize.ts +0 -146
- package/src/formats/openai/responses/index.ts +0 -14
- package/src/formats/openai/responses/parse.ts +0 -73
- package/src/formats/openai/responses/schema.ts +0 -86
- package/src/formats/openai/responses/serialize.ts +0 -328
- package/src/formats/request-helpers.ts +0 -56
- package/src/formats/serialize-helpers.ts +0 -43
- package/src/formats/types.ts +0 -26
- package/src/history.ts +0 -70
- package/src/index.ts +0 -46
- package/src/loader.ts +0 -246
- package/src/logger.ts +0 -70
- package/src/mock-server.ts +0 -203
- package/src/route-handler.ts +0 -144
- package/src/rule-builder.ts +0 -73
- package/src/rule-engine.ts +0 -165
- package/src/sse-writer.ts +0 -35
- package/src/types/reply.ts +0 -92
- package/src/types/request.ts +0 -56
- package/src/types/rule.ts +0 -125
- package/src/types.ts +0 -24
- package/test/cli-validators.test.ts +0 -151
- package/test/formats/anthropic.test.ts +0 -336
- package/test/formats/openai.test.ts +0 -316
- package/test/formats/parse-helpers.test.ts +0 -315
- package/test/formats/responses.test.ts +0 -380
- package/test/helpers/make-req.ts +0 -18
- package/test/history.test.ts +0 -361
- package/test/loader.test.ts +0 -333
- package/test/logger.test.ts +0 -344
- package/test/mock-server.test.ts +0 -619
- package/test/rule-engine.test.ts +0 -229
- package/tsconfig.json +0 -24
- package/tsconfig.test.json +0 -11
- package/typedoc.json +0 -9
- package/vitest.config.ts +0 -18
|
@@ -1,741 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"assessments": {
|
|
3
|
-
"abstraction_fitness": {
|
|
4
|
-
"score": 79.3,
|
|
5
|
-
"components": [
|
|
6
|
-
"Abstraction Leverage",
|
|
7
|
-
"Indirection Cost",
|
|
8
|
-
"Interface Honesty"
|
|
9
|
-
],
|
|
10
|
-
"component_scores": {
|
|
11
|
-
"Abstraction Leverage": 82.0,
|
|
12
|
-
"Indirection Cost": 85.7,
|
|
13
|
-
"Interface Honesty": 86.0
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"ai_generated_debt": 86.5,
|
|
17
|
-
"api_surface_coherence": 67.3,
|
|
18
|
-
"authorization_consistency": 92.8,
|
|
19
|
-
"convention_outlier": 78.8,
|
|
20
|
-
"cross_module_architecture": 73.2,
|
|
21
|
-
"design_coherence": 72.8,
|
|
22
|
-
"error_consistency": 67.8,
|
|
23
|
-
"high_level_elegance": 66.7,
|
|
24
|
-
"incomplete_migration": 95.7,
|
|
25
|
-
"low_level_elegance": 78.3,
|
|
26
|
-
"mid_level_elegance": 82.3,
|
|
27
|
-
"package_organization": 61.6
|
|
28
|
-
},
|
|
29
|
-
"dimension_notes": {
|
|
30
|
-
"cross_module_architecture": {
|
|
31
|
-
"evidence": [
|
|
32
|
-
"src/types.ts is a barrel that re-exports request/reply/rule types, and internal modules like src/rule-engine.ts and src/formats/request-helpers.ts import from \"./types.js\"/\"../types.js\" instead of their domain-specific type files.",
|
|
33
|
-
"The root types barrel becomes a dependency hub for unrelated modules, increasing blast radius for type changes across domains."
|
|
34
|
-
],
|
|
35
|
-
"impact_scope": "subsystem",
|
|
36
|
-
"fix_scope": "multi_file_refactor",
|
|
37
|
-
"confidence": "high",
|
|
38
|
-
"issues_preventing_higher_score": ""
|
|
39
|
-
},
|
|
40
|
-
"high_level_elegance": {
|
|
41
|
-
"evidence": [
|
|
42
|
-
"src/formats/types.ts (format contracts) imports RequestMeta from src/formats/request-helpers.ts, coupling a contract type to a helper/logic module.",
|
|
43
|
-
"src/formats/request-helpers.ts mixes RequestMeta with buildMockRequest and parsing helpers, blurring ownership of the format boundary types."
|
|
44
|
-
],
|
|
45
|
-
"impact_scope": "module",
|
|
46
|
-
"fix_scope": "multi_file_refactor",
|
|
47
|
-
"confidence": "high",
|
|
48
|
-
"issues_preventing_higher_score": ""
|
|
49
|
-
},
|
|
50
|
-
"convention_outlier": {
|
|
51
|
-
"evidence": [
|
|
52
|
-
"Log level naming diverges: `LEVEL_PRIORITY` exposes `warning` while the logger API uses `warn`, and CLI validation only accepts `warning` (src/logger.ts, src/cli-validators.ts, src/cli.ts).",
|
|
53
|
-
"Validator API mixes sync and async parsing in the same module: `parseHost` is async while other `parse*` helpers are sync, making call sites and tests use different interaction patterns (src/cli-validators.ts, test/cli-validators.test.ts)."
|
|
54
|
-
],
|
|
55
|
-
"impact_scope": "module",
|
|
56
|
-
"fix_scope": "multi_file_refactor",
|
|
57
|
-
"confidence": "medium",
|
|
58
|
-
"issues_preventing_higher_score": "Conventions around log-level naming and validator async/sync shape are inconsistent within the CLI surface."
|
|
59
|
-
},
|
|
60
|
-
"error_consistency": {
|
|
61
|
-
"evidence": [
|
|
62
|
-
"Resolver exceptions in `src/route-handler.ts` are caught and converted into a normal fallback reply, returning HTTP 200 without an error payload.",
|
|
63
|
-
"In `src/formats/responses/parse.ts`, malformed tool entries are silently dropped via `safeParse`, while `src/formats/openai/parse.ts` and `src/formats/anthropic/parse.ts` hard-fail on schema validation."
|
|
64
|
-
],
|
|
65
|
-
"impact_scope": "subsystem",
|
|
66
|
-
"fix_scope": "multi_file_refactor",
|
|
67
|
-
"confidence": "high",
|
|
68
|
-
"issues_preventing_higher_score": ""
|
|
69
|
-
},
|
|
70
|
-
"mid_level_elegance": {
|
|
71
|
-
"evidence": [
|
|
72
|
-
"src/mock-server.ts registers routes from the formats array (openaiFormat/anthropicFormat/responsesFormat) and relies on each format\u2019s route.",
|
|
73
|
-
"src/cli.ts prints a hard-coded endpoints string instead of deriving from the same formats registry."
|
|
74
|
-
],
|
|
75
|
-
"impact_scope": "module",
|
|
76
|
-
"fix_scope": "multi_file_refactor",
|
|
77
|
-
"confidence": "medium",
|
|
78
|
-
"issues_preventing_higher_score": "Endpoint listing is a manual seam between CLI output and runtime route registration, which can drift when adding/removing formats."
|
|
79
|
-
},
|
|
80
|
-
"abstraction_fitness": {
|
|
81
|
-
"evidence": [
|
|
82
|
-
"src/mock-server.ts builds sequence rules inline in when().replySequence(), including mapping entries and calling createSequenceResolver, then sets rule.remaining.",
|
|
83
|
-
"src/loader.ts repeats near-identical sequence rule wiring in addSequenceRule(), including entry mapping, createSequenceResolver, and rule.remaining."
|
|
84
|
-
],
|
|
85
|
-
"impact_scope": "module",
|
|
86
|
-
"fix_scope": "multi_file_refactor",
|
|
87
|
-
"confidence": "high",
|
|
88
|
-
"issues_preventing_higher_score": "Sequence-rule construction is duplicated in two modules, making future option/behavior changes easy to miss in one path.",
|
|
89
|
-
"sub_axes": {
|
|
90
|
-
"abstraction_leverage": 79.0,
|
|
91
|
-
"indirection_cost": 84.0,
|
|
92
|
-
"interface_honesty": 83.0
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"low_level_elegance": {
|
|
96
|
-
"evidence": [
|
|
97
|
-
"src/formats/responses/serialize.ts serialize() mixes header creation, block construction, chunk flattening, and response finalization in one dense function.",
|
|
98
|
-
"src/formats/openai/serialize.ts serialize() builds text/tool chunks, finish/usage chunks, and envelopes inline without local extraction."
|
|
99
|
-
],
|
|
100
|
-
"impact_scope": "local",
|
|
101
|
-
"fix_scope": "single_edit",
|
|
102
|
-
"confidence": "medium",
|
|
103
|
-
"issues_preventing_higher_score": "Serialization functions are readable but locally dense; small extractions would make the control flow more intention-revealing."
|
|
104
|
-
},
|
|
105
|
-
"api_surface_coherence": {
|
|
106
|
-
"evidence": [
|
|
107
|
-
"parsePort/parseChunkSize/parseLatency use parseInt without strict digit validation, so values like \"10abc\" or \"1.5\" are accepted as 10 or 1.",
|
|
108
|
-
"parseLogLevel uses `value in LEVEL_PRIORITY`, which is true for prototype keys like \"toString\" and can accept non-log-level strings.",
|
|
109
|
-
"parseHost is async (DNS lookup) while other validators are sync, creating mixed sync/async API shape in the same validator module."
|
|
110
|
-
],
|
|
111
|
-
"impact_scope": "module",
|
|
112
|
-
"fix_scope": "single_edit",
|
|
113
|
-
"confidence": "high",
|
|
114
|
-
"issues_preventing_higher_score": ""
|
|
115
|
-
},
|
|
116
|
-
"authorization_consistency": {
|
|
117
|
-
"evidence": [
|
|
118
|
-
"MockServer wires all format routes via `this.app.post(format.route, createRouteHandler(format, deps))` with no auth/token checks in this file.",
|
|
119
|
-
"`host` option allows `\"0.0.0.0\"` exposure but there is no access-control or warning path in MockServer."
|
|
120
|
-
],
|
|
121
|
-
"impact_scope": "module",
|
|
122
|
-
"fix_scope": "single_edit",
|
|
123
|
-
"confidence": "medium",
|
|
124
|
-
"issues_preventing_higher_score": "No optional auth hook or explicit guard/warning when binding to public interfaces; the server is always unauthenticated regardless of host exposure."
|
|
125
|
-
},
|
|
126
|
-
"ai_generated_debt": {
|
|
127
|
-
"evidence": [
|
|
128
|
-
"src/types/request.ts uses multiple explanatory comments on self-describing fields (e.g., lastMessage/systemMessage/toolNames) that mostly restate the property name.",
|
|
129
|
-
"src/types/rule.ts has a long comment block on Match that largely repeats the union\u2019s behavior (string/RegExp/object/function)."
|
|
130
|
-
],
|
|
131
|
-
"impact_scope": "local",
|
|
132
|
-
"fix_scope": "single_edit",
|
|
133
|
-
"confidence": "medium",
|
|
134
|
-
"issues_preventing_higher_score": "Several comments restate obvious field semantics and could be reduced to higher-signal notes only."
|
|
135
|
-
},
|
|
136
|
-
"incomplete_migration": {
|
|
137
|
-
"evidence": [
|
|
138
|
-
"No @deprecated markers, migration TODOs, or legacy/new dual-path APIs appear in src/types/request.ts.",
|
|
139
|
-
"No @deprecated markers, migration TODOs, or legacy/new dual-path APIs appear in src/types/rule.ts."
|
|
140
|
-
],
|
|
141
|
-
"impact_scope": "local",
|
|
142
|
-
"fix_scope": "single_edit",
|
|
143
|
-
"confidence": "low",
|
|
144
|
-
"issues_preventing_higher_score": "Small surface area limits certainty; no migration residue observed in the reviewed files."
|
|
145
|
-
},
|
|
146
|
-
"package_organization": {
|
|
147
|
-
"evidence": [
|
|
148
|
-
"holistic_context.structure.directory_profiles shows `src/` has `file_count: 11` with mixed concerns (cli, server/runtime, history, loader, logger, rule-engine).",
|
|
149
|
-
"holistic_context.structure.coupling_matrix shows bidirectional edges `src/ \u2192 src/formats/` (3) and `src/formats/ \u2192 src/` (3), indicating a blurred boundary between core runtime and format-specific code."
|
|
150
|
-
],
|
|
151
|
-
"impact_scope": "subsystem",
|
|
152
|
-
"fix_scope": "multi_file_refactor",
|
|
153
|
-
"confidence": "high",
|
|
154
|
-
"issues_preventing_higher_score": ""
|
|
155
|
-
},
|
|
156
|
-
"design_coherence": {
|
|
157
|
-
"evidence": [
|
|
158
|
-
"Sequence rule construction is implemented in two places with similar step-mapping and resolver wiring (`MockServer.when().replySequence()` in src/mock-server.ts and `addSequenceRule()` in src/loader.ts).",
|
|
159
|
-
"The `MockServer` class mixes HTTP server lifecycle (Fastify setup/start/stop), rule authoring APIs, fallback management, and request history/logging state in one surface (src/mock-server.ts)."
|
|
160
|
-
],
|
|
161
|
-
"impact_scope": "subsystem",
|
|
162
|
-
"fix_scope": "multi_file_refactor",
|
|
163
|
-
"confidence": "medium",
|
|
164
|
-
"issues_preventing_higher_score": ""
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
"findings": [
|
|
168
|
-
{
|
|
169
|
-
"dimension": "cross_module_architecture",
|
|
170
|
-
"identifier": "types_barrel_hub",
|
|
171
|
-
"summary": "Root types barrel creates a dependency hub and obscures domain boundaries.",
|
|
172
|
-
"related_files": [
|
|
173
|
-
"src/types.ts",
|
|
174
|
-
"src/rule-engine.ts",
|
|
175
|
-
"src/formats/request-helpers.ts"
|
|
176
|
-
],
|
|
177
|
-
"evidence": [
|
|
178
|
-
"src/types.ts only re-exports from ./types/request.js, ./types/reply.js, ./types/rule.js.",
|
|
179
|
-
"src/rule-engine.ts and src/formats/request-helpers.ts import shared types from \"./types.js\"/\"../types.js\" rather than domain-specific type files."
|
|
180
|
-
],
|
|
181
|
-
"suggestion": "Prefer direct imports from domain type files (e.g., src/types/request.ts) for internal modules, or split into domain-specific entry points and reserve src/types.ts for external/public API use.",
|
|
182
|
-
"confidence": "high",
|
|
183
|
-
"impact_scope": "subsystem",
|
|
184
|
-
"fix_scope": "multi_file_refactor",
|
|
185
|
-
"root_cause_cluster": "type_barrel_hub"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"dimension": "high_level_elegance",
|
|
189
|
-
"identifier": "request_meta_in_helper",
|
|
190
|
-
"summary": "Format contract depends on helper module, blurring ownership of request boundary types.",
|
|
191
|
-
"related_files": [
|
|
192
|
-
"src/formats/types.ts",
|
|
193
|
-
"src/formats/request-helpers.ts"
|
|
194
|
-
],
|
|
195
|
-
"evidence": [
|
|
196
|
-
"src/formats/types.ts imports RequestMeta from ./request-helpers.js.",
|
|
197
|
-
"src/formats/request-helpers.ts combines RequestMeta with buildMockRequest and isStreaming logic."
|
|
198
|
-
],
|
|
199
|
-
"suggestion": "Move RequestMeta into a dedicated types module (e.g., src/formats/request-types.ts) or into src/formats/types.ts, and have request-helpers import it instead of defining it.",
|
|
200
|
-
"confidence": "high",
|
|
201
|
-
"impact_scope": "module",
|
|
202
|
-
"fix_scope": "multi_file_refactor",
|
|
203
|
-
"root_cause_cluster": "types_helpers_boundary_blur"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"dimension": "convention_outlier",
|
|
207
|
-
"identifier": "log_level_naming_mismatch",
|
|
208
|
-
"summary": "Log level naming is inconsistent (`warning` vs `warn`) across CLI and Logger APIs.",
|
|
209
|
-
"related_files": [
|
|
210
|
-
"src/logger.ts",
|
|
211
|
-
"src/cli-validators.ts",
|
|
212
|
-
"src/cli.ts"
|
|
213
|
-
],
|
|
214
|
-
"evidence": [
|
|
215
|
-
"`LEVEL_PRIORITY` defines `warning`, CLI validation only accepts `warning`, but Logger exposes `warn` and labels logs as `WARN` (src/logger.ts, src/cli-validators.ts).",
|
|
216
|
-
"CLI flag `--log-level` is the public surface; a user seeing `WARN` may reasonably try `warn`, which is rejected (src/cli.ts, src/cli-validators.ts)."
|
|
217
|
-
],
|
|
218
|
-
"suggestion": "Align on one string (`warn` or `warning`) and accept both in the validator to preserve compatibility; update logger constants and CLI help text accordingly.",
|
|
219
|
-
"confidence": "medium",
|
|
220
|
-
"impact_scope": "module",
|
|
221
|
-
"fix_scope": "multi_file_refactor"
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"dimension": "convention_outlier",
|
|
225
|
-
"identifier": "mixed_sync_async_parsers",
|
|
226
|
-
"summary": "CLI validators mix async and sync parsing styles, creating an API shape outlier.",
|
|
227
|
-
"related_files": [
|
|
228
|
-
"src/cli-validators.ts",
|
|
229
|
-
"test/cli-validators.test.ts"
|
|
230
|
-
],
|
|
231
|
-
"evidence": [
|
|
232
|
-
"`parseHost` is async (DNS lookup) while `parsePort`, `parseLogLevel`, `parseChunkSize`, and `parseLatency` are sync, so consumers must treat the module inconsistently (src/cli-validators.ts).",
|
|
233
|
-
"Tests reflect the split by mixing `await expect(parseHost(...))` with sync expectations for other parsers (test/cli-validators.test.ts)."
|
|
234
|
-
],
|
|
235
|
-
"suggestion": "Normalize the validator interface: either make all parsers async (returning Promises) or provide a sync `parseHostSync` and move the async lookup to the CLI entrypoint.",
|
|
236
|
-
"confidence": "low",
|
|
237
|
-
"impact_scope": "module",
|
|
238
|
-
"fix_scope": "multi_file_refactor"
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
"dimension": "error_consistency",
|
|
242
|
-
"identifier": "reload_rules_clears_on_error",
|
|
243
|
-
"summary": "Rules reload clears existing rules before load, and on failure only logs, leaving a running server with no rules.",
|
|
244
|
-
"related_files": [
|
|
245
|
-
"src/cli.ts",
|
|
246
|
-
"src/logger.ts"
|
|
247
|
-
],
|
|
248
|
-
"evidence": [
|
|
249
|
-
"Watch reload path does `server.reset(); await server.load(rulesPath);` inside a try/catch and only logs on error (src/cli.ts).",
|
|
250
|
-
"If `server.load` throws, prior rules are already cleared and the server continues running with an empty rule set, with no rollback (src/cli.ts)."
|
|
251
|
-
],
|
|
252
|
-
"suggestion": "Load into a temporary ruleset or only call `reset()` after a successful load; on failure, preserve the previous rules and log the error with context.",
|
|
253
|
-
"confidence": "medium",
|
|
254
|
-
"impact_scope": "module",
|
|
255
|
-
"fix_scope": "multi_file_refactor"
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
"dimension": "abstraction_fitness",
|
|
259
|
-
"identifier": "sequence_rule_duplication",
|
|
260
|
-
"summary": "Sequence rule construction is duplicated across MockServer and loader, risking drift.",
|
|
261
|
-
"related_files": [
|
|
262
|
-
"src/mock-server.ts",
|
|
263
|
-
"src/loader.ts",
|
|
264
|
-
"src/rule-engine.ts"
|
|
265
|
-
],
|
|
266
|
-
"evidence": [
|
|
267
|
-
"src/mock-server.ts when().replySequence() maps entries, calls createSequenceResolver, mutates rule.resolve and rule.remaining.",
|
|
268
|
-
"src/loader.ts addSequenceRule() performs the same mapping/resolve/remaining steps with a slightly different entry shape."
|
|
269
|
-
],
|
|
270
|
-
"suggestion": "Extract a shared helper (e.g., in src/rule-engine.ts) that accepts normalized sequence steps and applies createSequenceResolver + remaining, then reuse it from both MockServer and loader.",
|
|
271
|
-
"confidence": "high",
|
|
272
|
-
"impact_scope": "module",
|
|
273
|
-
"fix_scope": "multi_file_refactor",
|
|
274
|
-
"root_cause_cluster": "sequence_rule_duplication"
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
"dimension": "mid_level_elegance",
|
|
278
|
-
"identifier": "format_registry_split",
|
|
279
|
-
"summary": "CLI hard-codes endpoints while MockServer derives routes from format modules.",
|
|
280
|
-
"related_files": [
|
|
281
|
-
"src/mock-server.ts",
|
|
282
|
-
"src/cli.ts"
|
|
283
|
-
],
|
|
284
|
-
"evidence": [
|
|
285
|
-
"src/mock-server.ts registers routes by iterating formats[] with per-format route values.",
|
|
286
|
-
"src/cli.ts prints a static endpoints list string that must be updated manually."
|
|
287
|
-
],
|
|
288
|
-
"suggestion": "Expose a single formats registry (or route list) and have the CLI render endpoints from it, avoiding cross-module drift.",
|
|
289
|
-
"confidence": "medium",
|
|
290
|
-
"impact_scope": "module",
|
|
291
|
-
"fix_scope": "multi_file_refactor"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
"dimension": "api_surface_coherence",
|
|
295
|
-
"identifier": "lax_numeric_parsing",
|
|
296
|
-
"summary": "Numeric validators accept non-numeric suffixes due to parseInt behavior",
|
|
297
|
-
"related_files": [
|
|
298
|
-
"src/cli-validators.ts"
|
|
299
|
-
],
|
|
300
|
-
"evidence": [
|
|
301
|
-
"parsePort/parseChunkSize/parseLatency use parseInt and only check isNaN and range, so inputs like \"10abc\" or \"1.5\" pass as 10 or 1."
|
|
302
|
-
],
|
|
303
|
-
"suggestion": "Validate with a strict digit regex (e.g., `/^\\d+$/`) and use `Number(value)` + `Number.isInteger` before range checks.",
|
|
304
|
-
"confidence": "high",
|
|
305
|
-
"impact_scope": "module",
|
|
306
|
-
"fix_scope": "single_edit"
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
"dimension": "api_surface_coherence",
|
|
310
|
-
"identifier": "log_level_guard_proto_keys",
|
|
311
|
-
"summary": "Log-level guard accepts prototype keys because it uses `in`",
|
|
312
|
-
"related_files": [
|
|
313
|
-
"src/cli-validators.ts"
|
|
314
|
-
],
|
|
315
|
-
"evidence": [
|
|
316
|
-
"`isLogLevel` uses `value in LEVEL_PRIORITY`, which returns true for inherited keys like \"toString\"."
|
|
317
|
-
],
|
|
318
|
-
"suggestion": "Use `Object.hasOwn(LEVEL_PRIORITY, value)` or `VALID_LOG_LEVELS.includes(value as LogLevel)` to restrict to real log levels.",
|
|
319
|
-
"confidence": "high",
|
|
320
|
-
"impact_scope": "local",
|
|
321
|
-
"fix_scope": "single_edit"
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
"dimension": "api_surface_coherence",
|
|
325
|
-
"identifier": "mixed_sync_async_validators",
|
|
326
|
-
"summary": "Validator API mixes sync and async functions within the same surface",
|
|
327
|
-
"related_files": [
|
|
328
|
-
"src/cli-validators.ts"
|
|
329
|
-
],
|
|
330
|
-
"evidence": [
|
|
331
|
-
"parseHost is async (DNS lookup) while parsePort/parseLogLevel/parseChunkSize/parseLatency are synchronous."
|
|
332
|
-
],
|
|
333
|
-
"suggestion": "Either make all validators async (returning Promise) or split DNS resolution into a separate async phase so the core validator API is uniform.",
|
|
334
|
-
"confidence": "medium",
|
|
335
|
-
"impact_scope": "module",
|
|
336
|
-
"fix_scope": "multi_file_refactor"
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
"dimension": "ai_generated_debt",
|
|
340
|
-
"identifier": "restating_comments_on_types",
|
|
341
|
-
"summary": "Comments restate obvious type semantics, adding low-signal noise",
|
|
342
|
-
"related_files": [
|
|
343
|
-
"src/types/request.ts",
|
|
344
|
-
"src/types/rule.ts"
|
|
345
|
-
],
|
|
346
|
-
"evidence": [
|
|
347
|
-
"src/types/request.ts comments explain fields like lastMessage/systemMessage/toolNames in a way that mirrors the field name.",
|
|
348
|
-
"src/types/rule.ts Match comment block describes each union variant in a way that repeats the type definition."
|
|
349
|
-
],
|
|
350
|
-
"suggestion": "Trim comments to only convey non-obvious constraints or behavioral nuances; remove restatements of field names or type unions.",
|
|
351
|
-
"confidence": "medium",
|
|
352
|
-
"impact_scope": "local",
|
|
353
|
-
"fix_scope": "single_edit"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"dimension": "low_level_elegance",
|
|
357
|
-
"identifier": "redundant_optional_undefined",
|
|
358
|
-
"summary": "Optional fields redundantly include `| undefined`, creating inconsistency and noise",
|
|
359
|
-
"related_files": [
|
|
360
|
-
"src/types/request.ts",
|
|
361
|
-
"src/types/rule.ts"
|
|
362
|
-
],
|
|
363
|
-
"evidence": [
|
|
364
|
-
"src/types/request.ts declares `tools?: readonly ToolDef[] | undefined` and `toolCallId?: string | undefined`, which are already implied by `?`.",
|
|
365
|
-
"src/types/rule.ts uses `?:` without explicit `| undefined`, so the style is inconsistent across related type modules."
|
|
366
|
-
],
|
|
367
|
-
"suggestion": "Remove explicit `| undefined` from optional properties in src/types/request.ts to align with TypeScript conventions and the style used in src/types/rule.ts.",
|
|
368
|
-
"confidence": "high",
|
|
369
|
-
"impact_scope": "local",
|
|
370
|
-
"fix_scope": "single_edit"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"dimension": "package_organization",
|
|
374
|
-
"identifier": "flat_src_root_mixed_concerns",
|
|
375
|
-
"summary": "`src/` is a flat folder with mixed CLI/runtime/history concerns, obscuring ownership boundaries.",
|
|
376
|
-
"related_files": [
|
|
377
|
-
"src/cli.ts",
|
|
378
|
-
"src/history.ts",
|
|
379
|
-
"src/cli-validators.ts"
|
|
380
|
-
],
|
|
381
|
-
"evidence": [
|
|
382
|
-
"`holistic_context.structure.directory_profiles` lists 11 files in `src/` spanning CLI (`cli.ts`), history/state (`history.ts`), and core runtime (`mock-server.ts`, `rule-engine.ts`).",
|
|
383
|
-
"`holistic_context.structure.coupling_matrix` shows `src/ \u2194 src/formats/` bidirectional imports, which is a typical signal of missing subpackage boundaries."
|
|
384
|
-
],
|
|
385
|
-
"suggestion": "Staged reorg plan: 1) Create `src/cli/` and `src/server/` folders. 2) Move CLI files first: `src/cli.ts` \u2192 `src/cli/index.ts`, `src/cli-validators.ts` \u2192 `src/cli/validators.ts`. 3) Move runtime/state next: `src/history.ts` \u2192 `src/server/history.ts` (and later other runtime files like `mock-server.ts`, `rule-engine.ts` if desired). 4) Update import paths using `rg \"./cli-validators|./history\" src test` and edit imports to new locations. 5) Validate with `npm test` (vitest) and, if available, `npm run build` to ensure path resolution is correct.",
|
|
386
|
-
"confidence": "high",
|
|
387
|
-
"impact_scope": "subsystem",
|
|
388
|
-
"fix_scope": "multi_file_refactor",
|
|
389
|
-
"root_cause_cluster": "flat_src_root"
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
"dimension": "package_organization",
|
|
393
|
-
"identifier": "cli_validators_not_colocated",
|
|
394
|
-
"summary": "CLI-only validators live at `src/` root despite being used only by the CLI entrypoint.",
|
|
395
|
-
"related_files": [
|
|
396
|
-
"src/cli.ts",
|
|
397
|
-
"src/cli-validators.ts",
|
|
398
|
-
"test/cli-validators.test.ts"
|
|
399
|
-
],
|
|
400
|
-
"evidence": [
|
|
401
|
-
"`src/cli-validators.ts` is imported only by `src/cli.ts` and its dedicated test (`test/cli-validators.test.ts`).",
|
|
402
|
-
"No other modules consume `cli-validators.ts`, indicating it belongs inside a CLI-focused subpackage rather than the root."
|
|
403
|
-
],
|
|
404
|
-
"suggestion": "Staged reorg plan: 1) Create `src/cli/`. 2) Move `src/cli-validators.ts` \u2192 `src/cli/validators.ts`. 3) Update `src/cli.ts` to import from `./cli/validators.js` (or `./cli/validators.js` after moving `cli.ts` as part of a broader CLI folder move). 4) Update `test/cli-validators.test.ts` to import from `../src/cli/validators.js`. 5) Validate with `npm test` to ensure CLI parsing tests still pass.",
|
|
405
|
-
"confidence": "high",
|
|
406
|
-
"impact_scope": "module",
|
|
407
|
-
"fix_scope": "multi_file_refactor",
|
|
408
|
-
"root_cause_cluster": "flat_src_root"
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
"dimension": "high_level_elegance",
|
|
412
|
-
"identifier": "ownership_boundaries_blurred_by_root_layout",
|
|
413
|
-
"summary": "Top-level decomposition mixes CLI and runtime concerns, weakening domain-aligned ownership.",
|
|
414
|
-
"related_files": [
|
|
415
|
-
"src/cli.ts",
|
|
416
|
-
"src/history.ts"
|
|
417
|
-
],
|
|
418
|
-
"evidence": [
|
|
419
|
-
"CLI entry (`src/cli.ts`) and runtime/state (`src/history.ts`) sit side-by-side at the root, making the top-level package map less expressive than the format-specific subfolders under `src/formats/*`.",
|
|
420
|
-
"The flat root layout requires readers to scan files to infer domains instead of discovering boundaries through folder structure."
|
|
421
|
-
],
|
|
422
|
-
"suggestion": "Staged reorg plan: 1) Introduce explicit domain folders such as `src/cli/` and `src/runtime/` (or `src/server/`). 2) Move `src/cli.ts` (and `src/cli-validators.ts`) into `src/cli/` first, then move `src/history.ts` into `src/runtime/` alongside related runtime modules. 3) Update imports via `rg \"\\./cli|\\./history\" src test` and edit to new paths. 4) Validate with `npm test` and, if applicable, `npm run build` to confirm the public entrypoints still resolve correctly.",
|
|
423
|
-
"confidence": "medium",
|
|
424
|
-
"impact_scope": "subsystem",
|
|
425
|
-
"fix_scope": "multi_file_refactor",
|
|
426
|
-
"root_cause_cluster": "flat_src_root"
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
"dimension": "cross_module_architecture",
|
|
430
|
-
"identifier": "types_barrel_coupling_hub",
|
|
431
|
-
"summary": "Root types barrel concentrates multiple domains and amplifies cross-module coupling.",
|
|
432
|
-
"related_files": [
|
|
433
|
-
"src/types.ts",
|
|
434
|
-
"src/formats/types.ts",
|
|
435
|
-
"src/formats/request-helpers.ts"
|
|
436
|
-
],
|
|
437
|
-
"evidence": [
|
|
438
|
-
"src/types.ts re-exports request/reply/rule types into one root barrel, and format modules import from ../types.js rather than their specific domain files.",
|
|
439
|
-
"This pattern makes any change to request/reply/rule type boundaries ripple through a single high-fan-in module."
|
|
440
|
-
],
|
|
441
|
-
"suggestion": "Split the barrel into domain entry points (for example: `src/types/request.ts`, `src/types/reply.ts`, `src/types/rule.ts`) and update format imports to target the specific domain paths; keep `src/types.ts` only for external package exports if needed, and avoid internal imports from it.",
|
|
442
|
-
"confidence": "medium",
|
|
443
|
-
"impact_scope": "subsystem",
|
|
444
|
-
"fix_scope": "multi_file_refactor"
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
"dimension": "high_level_elegance",
|
|
448
|
-
"identifier": "format_layer_owns_request_construction",
|
|
449
|
-
"summary": "Format layer builds the core MockRequest, blurring ownership of request lifecycle.",
|
|
450
|
-
"related_files": [
|
|
451
|
-
"src/formats/request-helpers.ts",
|
|
452
|
-
"src/formats/types.ts",
|
|
453
|
-
"src/types.ts"
|
|
454
|
-
],
|
|
455
|
-
"evidence": [
|
|
456
|
-
"buildMockRequest in src/formats/request-helpers.ts derives lastMessage/systemMessage/toolNames and sets headers/path defaults, which are core request concerns.",
|
|
457
|
-
"Format interface in src/formats/types.ts consumes this helper indirectly, keeping request shape tied to the formats package."
|
|
458
|
-
],
|
|
459
|
-
"suggestion": "Move MockRequest construction into a core module (for example `src/request/build-mock-request.ts` or `src/core/mock-request.ts`) and have format parsers return a minimal parsed shape; use the core builder to add shared defaults and derived fields.",
|
|
460
|
-
"confidence": "medium",
|
|
461
|
-
"impact_scope": "subsystem",
|
|
462
|
-
"fix_scope": "multi_file_refactor"
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
"dimension": "package_organization",
|
|
466
|
-
"identifier": "flat_src_mixed_concerns",
|
|
467
|
-
"summary": "The root src/ directory is a mixed-concern flat folder that hides ownership boundaries.",
|
|
468
|
-
"related_files": [
|
|
469
|
-
"src/logger.ts",
|
|
470
|
-
"src/rule-engine.ts",
|
|
471
|
-
"src/types.ts",
|
|
472
|
-
"src/cli.ts",
|
|
473
|
-
"src/mock-server.ts",
|
|
474
|
-
"src/route-handler.ts",
|
|
475
|
-
"src/loader.ts"
|
|
476
|
-
],
|
|
477
|
-
"evidence": [
|
|
478
|
-
"holistic_context.structure shows src/ contains 11 production files spanning CLI/server/logging/rules/types, indicating mixed responsibilities in a single directory.",
|
|
479
|
-
"Core building blocks (logger, rule engine, types) live beside entrypoints, making navigation and change ownership less predictable.",
|
|
480
|
-
"`src/` contains 11 files across CLI, HTTP server, rule engine, logging, and utilities (directory profile shows `file_count: 11`).",
|
|
481
|
-
"Coupling shows bidirectional edges between `src/` and `src/formats/`, indicating blurred boundaries at the top level."
|
|
482
|
-
],
|
|
483
|
-
"suggestion": "Staged reorg plan: 1) Create target folders `src/core/`, `src/logging/`, and `src/entrypoints/`. 2) Move core building blocks: `git mv src/rule-engine.ts src/core/rule-engine.ts`, `git mv src/types.ts src/core/types.ts`. 3) Move logging: `git mv src/logger.ts src/logging/logger.ts`. 4) Update imports by searching: `rg -n \"from \\\"\\.\\/rule-engine\\\"|from \\\"\\.\\/types\\\"|from \\\"\\.\\/logger\\\"\" src test` and adjust to new paths. 5) Validate with `npm test` and `npm run build`.",
|
|
484
|
-
"confidence": "high",
|
|
485
|
-
"impact_scope": "codebase",
|
|
486
|
-
"fix_scope": "multi_file_refactor",
|
|
487
|
-
"merged_from": [
|
|
488
|
-
"flat_src_mixed_concerns"
|
|
489
|
-
]
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
"dimension": "design_coherence",
|
|
493
|
-
"identifier": "sequence_rule_duplication",
|
|
494
|
-
"summary": "Sequence rule normalization is duplicated in server API and loader paths",
|
|
495
|
-
"related_files": [
|
|
496
|
-
"src/mock-server.ts",
|
|
497
|
-
"src/loader.ts",
|
|
498
|
-
"src/rule-engine.ts"
|
|
499
|
-
],
|
|
500
|
-
"evidence": [
|
|
501
|
-
"`MockServer.when().replySequence()` maps `SequenceEntry` values into steps, creates a sequence resolver, assigns `rule.resolve`, and sets `rule.remaining`.",
|
|
502
|
-
"`addSequenceRule()` in `src/loader.ts` performs the same step normalization, `createSequenceResolver()` call, and `rule.remaining` setup for JSON5 rules."
|
|
503
|
-
],
|
|
504
|
-
"suggestion": "Extract a shared helper in `src/rule-engine.ts` (or a new `sequence` utility) that accepts normalized entries and returns a configured rule; use it from both `replySequence()` and `addSequenceRule()` to centralize sequence behavior.",
|
|
505
|
-
"confidence": "medium",
|
|
506
|
-
"impact_scope": "module",
|
|
507
|
-
"fix_scope": "multi_file_refactor"
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
"dimension": "design_coherence",
|
|
511
|
-
"identifier": "mockserver_multi_role",
|
|
512
|
-
"summary": "`MockServer` combines server lifecycle, rule authoring, and state tracking responsibilities",
|
|
513
|
-
"related_files": [
|
|
514
|
-
"src/mock-server.ts",
|
|
515
|
-
"src/rule-engine.ts",
|
|
516
|
-
"src/history.ts"
|
|
517
|
-
],
|
|
518
|
-
"evidence": [
|
|
519
|
-
"`MockServer` constructs the Fastify server and registers format routes in the constructor, exposes rule authoring methods (`when`, `whenTool`, `nextError`), manages fallback state, and owns `RequestHistory` and logging.",
|
|
520
|
-
"This blends HTTP runtime concerns with rule registry and history concerns that already exist as separate modules (`RuleEngine`, `RequestHistory`)."
|
|
521
|
-
],
|
|
522
|
-
"suggestion": "Split `MockServer` into a runtime/server wrapper and a rule/history registry (e.g., extract a `RuleRegistry` or `MockServerCore` that exposes `when*`, `history`, `rules`, and fallback), and keep Fastify lifecycle and route wiring in a thinner server class.",
|
|
523
|
-
"confidence": "medium",
|
|
524
|
-
"impact_scope": "subsystem",
|
|
525
|
-
"fix_scope": "architectural_change"
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
"dimension": "error_consistency",
|
|
529
|
-
"identifier": "resolver_errors_swallowed",
|
|
530
|
-
"summary": "Resolver exceptions are swallowed and returned as normal fallback replies",
|
|
531
|
-
"related_files": [
|
|
532
|
-
"src/route-handler.ts",
|
|
533
|
-
"src/types/reply.ts",
|
|
534
|
-
"src/mock-server.ts"
|
|
535
|
-
],
|
|
536
|
-
"evidence": [
|
|
537
|
-
"`resolveReply` catches resolver errors and returns `normalizeReply(fallback)` with no error signal.",
|
|
538
|
-
"Downstream in the handler, the fallback reply is serialized as a normal 200 response if it doesn\u2019t set `error`."
|
|
539
|
-
],
|
|
540
|
-
"suggestion": "Surface resolver failures explicitly: either rethrow and let Fastify return 500, or translate to `ReplyObject.error` with a 5xx status. Update `resolveReply` and `createRouteHandler` to propagate an error reply, and document the error contract in `src/types/reply.ts`.",
|
|
541
|
-
"confidence": "high",
|
|
542
|
-
"impact_scope": "subsystem",
|
|
543
|
-
"fix_scope": "multi_file_refactor",
|
|
544
|
-
"root_cause_cluster": "error_handling_policy"
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
"dimension": "error_consistency",
|
|
548
|
-
"identifier": "responses_tools_silent_drop",
|
|
549
|
-
"summary": "Responses tool parsing silently drops invalid tools unlike other formats",
|
|
550
|
-
"related_files": [
|
|
551
|
-
"src/formats/responses/parse.ts",
|
|
552
|
-
"src/formats/openai/parse.ts",
|
|
553
|
-
"src/formats/anthropic/parse.ts"
|
|
554
|
-
],
|
|
555
|
-
"evidence": [
|
|
556
|
-
"`parseTools` in responses uses `FunctionToolSchema.safeParse` and filters out failed parses, so malformed tool entries are ignored.",
|
|
557
|
-
"OpenAI and Anthropic requests rely on schema parsing that fails the whole request on invalid structures."
|
|
558
|
-
],
|
|
559
|
-
"suggestion": "Align tool-validation behavior across formats: either treat invalid tools as a request error for responses, or document and apply a consistent \u201cbest-effort\u201d policy across all formats. Prefer failing the request for invalid tools to keep error handling predictable.",
|
|
560
|
-
"confidence": "medium",
|
|
561
|
-
"impact_scope": "module",
|
|
562
|
-
"fix_scope": "multi_file_refactor",
|
|
563
|
-
"root_cause_cluster": "error_handling_policy"
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
"dimension": "low_level_elegance",
|
|
567
|
-
"identifier": "non_unique_ids",
|
|
568
|
-
"summary": "ID generation relies on Date.now(), risking collisions under concurrency",
|
|
569
|
-
"related_files": [
|
|
570
|
-
"src/formats/serialize-helpers.ts",
|
|
571
|
-
"src/formats/openai/serialize.ts",
|
|
572
|
-
"src/formats/responses/serialize.ts"
|
|
573
|
-
],
|
|
574
|
-
"evidence": [
|
|
575
|
-
"`genId` and `toolId` use `Date.now().toString(36)` which can repeat in the same millisecond.",
|
|
576
|
-
"Streaming serializers call these helpers multiple times per request, and concurrent requests can produce duplicate IDs."
|
|
577
|
-
],
|
|
578
|
-
"suggestion": "Switch to a collision-resistant ID source (e.g., `crypto.randomUUID()` or a process-wide monotonic counter with a random prefix). Update `genId`/`toolId` and regenerate IDs in the serializers to avoid duplicate response IDs.",
|
|
579
|
-
"confidence": "high",
|
|
580
|
-
"impact_scope": "subsystem",
|
|
581
|
-
"fix_scope": "single_edit"
|
|
582
|
-
}
|
|
583
|
-
],
|
|
584
|
-
"review_quality": {
|
|
585
|
-
"batch_count": 10,
|
|
586
|
-
"dimension_coverage": 0.262,
|
|
587
|
-
"evidence_density": 2.5,
|
|
588
|
-
"high_score_missing_issue_note": 0,
|
|
589
|
-
"finding_pressure": 43.94,
|
|
590
|
-
"dimensions_with_findings": 11
|
|
591
|
-
},
|
|
592
|
-
"review_scope": {
|
|
593
|
-
"reviewed_files_count": 41,
|
|
594
|
-
"successful_batch_count": 10,
|
|
595
|
-
"full_sweep_included": true,
|
|
596
|
-
"total_files": 41,
|
|
597
|
-
"imported_dimensions": [
|
|
598
|
-
"abstraction_fitness",
|
|
599
|
-
"ai_generated_debt",
|
|
600
|
-
"api_surface_coherence",
|
|
601
|
-
"authorization_consistency",
|
|
602
|
-
"convention_outlier",
|
|
603
|
-
"cross_module_architecture",
|
|
604
|
-
"design_coherence",
|
|
605
|
-
"error_consistency",
|
|
606
|
-
"high_level_elegance",
|
|
607
|
-
"incomplete_migration",
|
|
608
|
-
"low_level_elegance",
|
|
609
|
-
"mid_level_elegance",
|
|
610
|
-
"package_organization"
|
|
611
|
-
]
|
|
612
|
-
},
|
|
613
|
-
"reviewed_files": [
|
|
614
|
-
"src/types.ts",
|
|
615
|
-
"src/formats/types.ts",
|
|
616
|
-
"src/formats/request-helpers.ts",
|
|
617
|
-
"src/logger.ts",
|
|
618
|
-
"src/rule-engine.ts",
|
|
619
|
-
"src/history.ts",
|
|
620
|
-
"test/history.test.ts",
|
|
621
|
-
"src/cli.ts",
|
|
622
|
-
"src/formats/anthropic/schema.ts",
|
|
623
|
-
"src/formats/openai/schema.ts",
|
|
624
|
-
"src/formats/responses/schema.ts",
|
|
625
|
-
"src/types/request.ts",
|
|
626
|
-
"test/helpers/make-req.ts",
|
|
627
|
-
"test/cli-validators.test.ts",
|
|
628
|
-
"test/mock-server.test.ts",
|
|
629
|
-
"test/rule-engine.test.ts",
|
|
630
|
-
"src/cli-validators.ts",
|
|
631
|
-
"src/mock-server.ts",
|
|
632
|
-
"test/formats/anthropic.test.ts",
|
|
633
|
-
"src/formats/responses/serialize.ts",
|
|
634
|
-
"test/formats/responses.test.ts",
|
|
635
|
-
"src/loader.ts",
|
|
636
|
-
"test/formats/openai.test.ts",
|
|
637
|
-
"test/loader.test.ts",
|
|
638
|
-
"test/logger.test.ts",
|
|
639
|
-
"src/formats/openai/serialize.ts",
|
|
640
|
-
"src/types/rule.ts",
|
|
641
|
-
"vitest.config.ts",
|
|
642
|
-
"src/formats/anthropic/index.ts",
|
|
643
|
-
"src/formats/anthropic/parse.ts",
|
|
644
|
-
"src/formats/serialize-helpers.ts",
|
|
645
|
-
"src/formats/openai/index.ts",
|
|
646
|
-
"src/formats/openai/parse.ts",
|
|
647
|
-
"src/formats/responses/index.ts",
|
|
648
|
-
"src/formats/responses/parse.ts",
|
|
649
|
-
"README.md",
|
|
650
|
-
"src/formats/anthropic/serialize.ts",
|
|
651
|
-
"src/index.ts",
|
|
652
|
-
"src/route-handler.ts",
|
|
653
|
-
"src/sse-writer.ts",
|
|
654
|
-
"src/types/reply.ts"
|
|
655
|
-
],
|
|
656
|
-
"provenance": {
|
|
657
|
-
"kind": "blind_review_batch_import",
|
|
658
|
-
"blind": true,
|
|
659
|
-
"runner": "codex",
|
|
660
|
-
"run_stamp": "20260315_185613",
|
|
661
|
-
"created_at": "2026-03-15T19:12:25+00:00",
|
|
662
|
-
"batch_count": 10,
|
|
663
|
-
"batch_indexes": [
|
|
664
|
-
1,
|
|
665
|
-
2,
|
|
666
|
-
3,
|
|
667
|
-
4,
|
|
668
|
-
5,
|
|
669
|
-
6,
|
|
670
|
-
7,
|
|
671
|
-
8,
|
|
672
|
-
9,
|
|
673
|
-
10
|
|
674
|
-
],
|
|
675
|
-
"packet_path": "/Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/.desloppify/review_packet_blind.json",
|
|
676
|
-
"packet_sha256": "e663ded15d2a9ecb9c0d30321375d99c9508846539c46be15e8d706c8053de8c"
|
|
677
|
-
},
|
|
678
|
-
"assessment_coverage": {
|
|
679
|
-
"scored_dimensions": [
|
|
680
|
-
"naming_quality",
|
|
681
|
-
"logic_clarity",
|
|
682
|
-
"type_safety",
|
|
683
|
-
"contract_coherence",
|
|
684
|
-
"error_consistency",
|
|
685
|
-
"abstraction_fitness",
|
|
686
|
-
"ai_generated_debt",
|
|
687
|
-
"high_level_elegance",
|
|
688
|
-
"mid_level_elegance",
|
|
689
|
-
"low_level_elegance",
|
|
690
|
-
"cross_module_architecture",
|
|
691
|
-
"initialization_coupling",
|
|
692
|
-
"convention_outlier",
|
|
693
|
-
"dependency_health",
|
|
694
|
-
"test_strategy",
|
|
695
|
-
"api_surface_coherence",
|
|
696
|
-
"authorization_consistency",
|
|
697
|
-
"incomplete_migration",
|
|
698
|
-
"package_organization",
|
|
699
|
-
"design_coherence"
|
|
700
|
-
],
|
|
701
|
-
"selected_dimensions": [
|
|
702
|
-
"cross_module_architecture",
|
|
703
|
-
"convention_outlier",
|
|
704
|
-
"error_consistency",
|
|
705
|
-
"abstraction_fitness",
|
|
706
|
-
"api_surface_coherence",
|
|
707
|
-
"authorization_consistency",
|
|
708
|
-
"ai_generated_debt",
|
|
709
|
-
"incomplete_migration",
|
|
710
|
-
"package_organization",
|
|
711
|
-
"high_level_elegance",
|
|
712
|
-
"mid_level_elegance",
|
|
713
|
-
"low_level_elegance",
|
|
714
|
-
"design_coherence"
|
|
715
|
-
],
|
|
716
|
-
"imported_dimensions": [
|
|
717
|
-
"abstraction_fitness",
|
|
718
|
-
"ai_generated_debt",
|
|
719
|
-
"api_surface_coherence",
|
|
720
|
-
"authorization_consistency",
|
|
721
|
-
"convention_outlier",
|
|
722
|
-
"cross_module_architecture",
|
|
723
|
-
"design_coherence",
|
|
724
|
-
"error_consistency",
|
|
725
|
-
"high_level_elegance",
|
|
726
|
-
"incomplete_migration",
|
|
727
|
-
"low_level_elegance",
|
|
728
|
-
"mid_level_elegance",
|
|
729
|
-
"package_organization"
|
|
730
|
-
],
|
|
731
|
-
"missing_dimensions": [
|
|
732
|
-
"naming_quality",
|
|
733
|
-
"logic_clarity",
|
|
734
|
-
"type_safety",
|
|
735
|
-
"contract_coherence",
|
|
736
|
-
"initialization_coupling",
|
|
737
|
-
"dependency_health",
|
|
738
|
-
"test_strategy"
|
|
739
|
-
]
|
|
740
|
-
}
|
|
741
|
-
}
|