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,102 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"batch": "Conventions & Errors",
|
|
3
|
-
"batch_index": 2,
|
|
4
|
-
"assessments": {
|
|
5
|
-
"convention_outlier": 86.0,
|
|
6
|
-
"error_consistency": 84.0,
|
|
7
|
-
"mid_level_elegance": 90.0
|
|
8
|
-
},
|
|
9
|
-
"dimension_notes": {
|
|
10
|
-
"convention_outlier": {
|
|
11
|
-
"evidence": [
|
|
12
|
-
"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).",
|
|
13
|
-
"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)."
|
|
14
|
-
],
|
|
15
|
-
"impact_scope": "module",
|
|
16
|
-
"fix_scope": "multi_file_refactor",
|
|
17
|
-
"confidence": "medium",
|
|
18
|
-
"issues_preventing_higher_score": "Conventions around log-level naming and validator async/sync shape are inconsistent within the CLI surface."
|
|
19
|
-
},
|
|
20
|
-
"error_consistency": {
|
|
21
|
-
"evidence": [
|
|
22
|
-
"Rules reload path resets server state before load and then only logs on failure, leaving the server running with cleared rules if reload fails (src/cli.ts, src/logger.ts)."
|
|
23
|
-
],
|
|
24
|
-
"impact_scope": "module",
|
|
25
|
-
"fix_scope": "multi_file_refactor",
|
|
26
|
-
"confidence": "medium"
|
|
27
|
-
},
|
|
28
|
-
"mid_level_elegance": {
|
|
29
|
-
"evidence": [
|
|
30
|
-
"CLI start-up output bypasses the Logger and writes directly to `console.log`, while runtime events use Logger formatting and filtering (src/cli.ts, src/logger.ts)."
|
|
31
|
-
],
|
|
32
|
-
"impact_scope": "module",
|
|
33
|
-
"fix_scope": "single_edit",
|
|
34
|
-
"confidence": "low",
|
|
35
|
-
"issues_preventing_higher_score": "Startup logging is routed through a different seam than the rest of runtime logging, making log formatting and filtering inconsistent."
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"findings": [
|
|
39
|
-
{
|
|
40
|
-
"dimension": "convention_outlier",
|
|
41
|
-
"identifier": "log_level_naming_mismatch",
|
|
42
|
-
"summary": "Log level naming is inconsistent (`warning` vs `warn`) across CLI and Logger APIs.",
|
|
43
|
-
"related_files": [
|
|
44
|
-
"src/logger.ts",
|
|
45
|
-
"src/cli-validators.ts",
|
|
46
|
-
"src/cli.ts"
|
|
47
|
-
],
|
|
48
|
-
"evidence": [
|
|
49
|
-
"`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).",
|
|
50
|
-
"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)."
|
|
51
|
-
],
|
|
52
|
-
"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.",
|
|
53
|
-
"confidence": "medium",
|
|
54
|
-
"impact_scope": "module",
|
|
55
|
-
"fix_scope": "multi_file_refactor"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"dimension": "convention_outlier",
|
|
59
|
-
"identifier": "mixed_sync_async_parsers",
|
|
60
|
-
"summary": "CLI validators mix async and sync parsing styles, creating an API shape outlier.",
|
|
61
|
-
"related_files": [
|
|
62
|
-
"src/cli-validators.ts",
|
|
63
|
-
"test/cli-validators.test.ts"
|
|
64
|
-
],
|
|
65
|
-
"evidence": [
|
|
66
|
-
"`parseHost` is async (DNS lookup) while `parsePort`, `parseLogLevel`, `parseChunkSize`, and `parseLatency` are sync, so consumers must treat the module inconsistently (src/cli-validators.ts).",
|
|
67
|
-
"Tests reflect the split by mixing `await expect(parseHost(...))` with sync expectations for other parsers (test/cli-validators.test.ts)."
|
|
68
|
-
],
|
|
69
|
-
"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.",
|
|
70
|
-
"confidence": "low",
|
|
71
|
-
"impact_scope": "module",
|
|
72
|
-
"fix_scope": "multi_file_refactor"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"dimension": "error_consistency",
|
|
76
|
-
"identifier": "reload_rules_clears_on_error",
|
|
77
|
-
"summary": "Rules reload clears existing rules before load, and on failure only logs, leaving a running server with no rules.",
|
|
78
|
-
"related_files": [
|
|
79
|
-
"src/cli.ts",
|
|
80
|
-
"src/logger.ts"
|
|
81
|
-
],
|
|
82
|
-
"evidence": [
|
|
83
|
-
"Watch reload path does `server.reset(); await server.load(rulesPath);` inside a try/catch and only logs on error (src/cli.ts).",
|
|
84
|
-
"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)."
|
|
85
|
-
],
|
|
86
|
-
"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.",
|
|
87
|
-
"confidence": "medium",
|
|
88
|
-
"impact_scope": "module",
|
|
89
|
-
"fix_scope": "multi_file_refactor"
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
"retrospective": {
|
|
93
|
-
"root_causes": [
|
|
94
|
-
"Public CLI surface does not have a single authoritative source for naming and error-handling conventions."
|
|
95
|
-
],
|
|
96
|
-
"likely_symptoms": [
|
|
97
|
-
"log_level_naming_mismatch",
|
|
98
|
-
"mixed_sync_async_parsers"
|
|
99
|
-
],
|
|
100
|
-
"possible_false_positives": []
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"batch": "Abstractions & Dependencies",
|
|
3
|
-
"batch_index": 3,
|
|
4
|
-
"assessments": {
|
|
5
|
-
"abstraction_fitness": 82.0,
|
|
6
|
-
"mid_level_elegance": 84.0,
|
|
7
|
-
"low_level_elegance": 88.0
|
|
8
|
-
},
|
|
9
|
-
"dimension_notes": {
|
|
10
|
-
"abstraction_fitness": {
|
|
11
|
-
"evidence": [
|
|
12
|
-
"src/mock-server.ts builds sequence rules inline in when().replySequence(), including mapping entries and calling createSequenceResolver, then sets rule.remaining.",
|
|
13
|
-
"src/loader.ts repeats near-identical sequence rule wiring in addSequenceRule(), including entry mapping, createSequenceResolver, and rule.remaining."
|
|
14
|
-
],
|
|
15
|
-
"impact_scope": "module",
|
|
16
|
-
"fix_scope": "multi_file_refactor",
|
|
17
|
-
"confidence": "high",
|
|
18
|
-
"issues_preventing_higher_score": "Sequence-rule construction is duplicated in two modules, making future option/behavior changes easy to miss in one path.",
|
|
19
|
-
"sub_axes": {
|
|
20
|
-
"abstraction_leverage": 79.0,
|
|
21
|
-
"indirection_cost": 84.0,
|
|
22
|
-
"interface_honesty": 83.0
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"mid_level_elegance": {
|
|
26
|
-
"evidence": [
|
|
27
|
-
"src/mock-server.ts registers routes from the formats array (openaiFormat/anthropicFormat/responsesFormat) and relies on each format’s route.",
|
|
28
|
-
"src/cli.ts prints a hard-coded endpoints string instead of deriving from the same formats registry."
|
|
29
|
-
],
|
|
30
|
-
"impact_scope": "module",
|
|
31
|
-
"fix_scope": "multi_file_refactor",
|
|
32
|
-
"confidence": "medium",
|
|
33
|
-
"issues_preventing_higher_score": "Endpoint listing is a manual seam between CLI output and runtime route registration, which can drift when adding/removing formats."
|
|
34
|
-
},
|
|
35
|
-
"low_level_elegance": {
|
|
36
|
-
"evidence": [
|
|
37
|
-
"src/formats/responses/serialize.ts serialize() mixes header creation, block construction, chunk flattening, and response finalization in one dense function.",
|
|
38
|
-
"src/formats/openai/serialize.ts serialize() builds text/tool chunks, finish/usage chunks, and envelopes inline without local extraction."
|
|
39
|
-
],
|
|
40
|
-
"impact_scope": "local",
|
|
41
|
-
"fix_scope": "single_edit",
|
|
42
|
-
"confidence": "medium",
|
|
43
|
-
"issues_preventing_higher_score": "Serialization functions are readable but locally dense; small extractions would make the control flow more intention-revealing."
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"findings": [
|
|
47
|
-
{
|
|
48
|
-
"dimension": "abstraction_fitness",
|
|
49
|
-
"identifier": "sequence_rule_duplication",
|
|
50
|
-
"summary": "Sequence rule construction is duplicated across MockServer and loader, risking drift.",
|
|
51
|
-
"related_files": [
|
|
52
|
-
"src/mock-server.ts",
|
|
53
|
-
"src/loader.ts",
|
|
54
|
-
"src/rule-engine.ts"
|
|
55
|
-
],
|
|
56
|
-
"evidence": [
|
|
57
|
-
"src/mock-server.ts when().replySequence() maps entries, calls createSequenceResolver, mutates rule.resolve and rule.remaining.",
|
|
58
|
-
"src/loader.ts addSequenceRule() performs the same mapping/resolve/remaining steps with a slightly different entry shape."
|
|
59
|
-
],
|
|
60
|
-
"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.",
|
|
61
|
-
"confidence": "high",
|
|
62
|
-
"impact_scope": "module",
|
|
63
|
-
"fix_scope": "multi_file_refactor",
|
|
64
|
-
"root_cause_cluster": "sequence_rule_duplication"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"dimension": "mid_level_elegance",
|
|
68
|
-
"identifier": "format_registry_split",
|
|
69
|
-
"summary": "CLI hard-codes endpoints while MockServer derives routes from format modules.",
|
|
70
|
-
"related_files": [
|
|
71
|
-
"src/mock-server.ts",
|
|
72
|
-
"src/cli.ts"
|
|
73
|
-
],
|
|
74
|
-
"evidence": [
|
|
75
|
-
"src/mock-server.ts registers routes by iterating formats[] with per-format route values.",
|
|
76
|
-
"src/cli.ts prints a static endpoints list string that must be updated manually."
|
|
77
|
-
],
|
|
78
|
-
"suggestion": "Expose a single formats registry (or route list) and have the CLI render endpoints from it, avoiding cross-module drift.",
|
|
79
|
-
"confidence": "medium",
|
|
80
|
-
"impact_scope": "module",
|
|
81
|
-
"fix_scope": "multi_file_refactor"
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"retrospective": {
|
|
85
|
-
"root_causes": [
|
|
86
|
-
"Shared logic exists without a single owning abstraction, leading to duplication across modules."
|
|
87
|
-
],
|
|
88
|
-
"likely_symptoms": [
|
|
89
|
-
"sequence_rule_duplication",
|
|
90
|
-
"format_registry_split"
|
|
91
|
-
],
|
|
92
|
-
"possible_false_positives": []
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"batch": "Testing & API",
|
|
3
|
-
"batch_index": 4,
|
|
4
|
-
"assessments": {
|
|
5
|
-
"api_surface_coherence": 76.0,
|
|
6
|
-
"mid_level_elegance": 86.0
|
|
7
|
-
},
|
|
8
|
-
"dimension_notes": {
|
|
9
|
-
"api_surface_coherence": {
|
|
10
|
-
"evidence": [
|
|
11
|
-
"parsePort/parseChunkSize/parseLatency use parseInt without strict digit validation, so values like \"10abc\" or \"1.5\" are accepted as 10 or 1.",
|
|
12
|
-
"parseLogLevel uses `value in LEVEL_PRIORITY`, which is true for prototype keys like \"toString\" and can accept non-log-level strings.",
|
|
13
|
-
"parseHost is async (DNS lookup) while other validators are sync, creating mixed sync/async API shape in the same validator module."
|
|
14
|
-
],
|
|
15
|
-
"impact_scope": "module",
|
|
16
|
-
"fix_scope": "single_edit",
|
|
17
|
-
"confidence": "high"
|
|
18
|
-
},
|
|
19
|
-
"mid_level_elegance": {
|
|
20
|
-
"evidence": [
|
|
21
|
-
"parseHost introduces network I/O during validation, while peer validators are pure, forcing callers into an async control flow for otherwise synchronous validation."
|
|
22
|
-
],
|
|
23
|
-
"impact_scope": "module",
|
|
24
|
-
"fix_scope": "single_edit",
|
|
25
|
-
"confidence": "medium",
|
|
26
|
-
"issues_preventing_higher_score": "Validation seams are not uniform: one validator performs async DNS lookup while others are synchronous, complicating orchestration of CLI validation flow."
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"findings": [
|
|
30
|
-
{
|
|
31
|
-
"dimension": "api_surface_coherence",
|
|
32
|
-
"identifier": "lax_numeric_parsing",
|
|
33
|
-
"summary": "Numeric validators accept non-numeric suffixes due to parseInt behavior",
|
|
34
|
-
"related_files": [
|
|
35
|
-
"src/cli-validators.ts"
|
|
36
|
-
],
|
|
37
|
-
"evidence": [
|
|
38
|
-
"parsePort/parseChunkSize/parseLatency use parseInt and only check isNaN and range, so inputs like \"10abc\" or \"1.5\" pass as 10 or 1."
|
|
39
|
-
],
|
|
40
|
-
"suggestion": "Validate with a strict digit regex (e.g., `/^\\d+$/`) and use `Number(value)` + `Number.isInteger` before range checks.",
|
|
41
|
-
"confidence": "high",
|
|
42
|
-
"impact_scope": "module",
|
|
43
|
-
"fix_scope": "single_edit"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"dimension": "api_surface_coherence",
|
|
47
|
-
"identifier": "log_level_guard_proto_keys",
|
|
48
|
-
"summary": "Log-level guard accepts prototype keys because it uses `in`",
|
|
49
|
-
"related_files": [
|
|
50
|
-
"src/cli-validators.ts"
|
|
51
|
-
],
|
|
52
|
-
"evidence": [
|
|
53
|
-
"`isLogLevel` uses `value in LEVEL_PRIORITY`, which returns true for inherited keys like \"toString\"."
|
|
54
|
-
],
|
|
55
|
-
"suggestion": "Use `Object.hasOwn(LEVEL_PRIORITY, value)` or `VALID_LOG_LEVELS.includes(value as LogLevel)` to restrict to real log levels.",
|
|
56
|
-
"confidence": "high",
|
|
57
|
-
"impact_scope": "local",
|
|
58
|
-
"fix_scope": "single_edit"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"dimension": "api_surface_coherence",
|
|
62
|
-
"identifier": "mixed_sync_async_validators",
|
|
63
|
-
"summary": "Validator API mixes sync and async functions within the same surface",
|
|
64
|
-
"related_files": [
|
|
65
|
-
"src/cli-validators.ts"
|
|
66
|
-
],
|
|
67
|
-
"evidence": [
|
|
68
|
-
"parseHost is async (DNS lookup) while parsePort/parseLogLevel/parseChunkSize/parseLatency are synchronous."
|
|
69
|
-
],
|
|
70
|
-
"suggestion": "Either make all validators async (returning Promise) or split DNS resolution into a separate async phase so the core validator API is uniform.",
|
|
71
|
-
"confidence": "medium",
|
|
72
|
-
"impact_scope": "module",
|
|
73
|
-
"fix_scope": "multi_file_refactor"
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
"retrospective": {
|
|
77
|
-
"root_causes": [
|
|
78
|
-
"Validators prioritize permissive parsing and ad-hoc checks over strict, uniform validation rules."
|
|
79
|
-
],
|
|
80
|
-
"likely_symptoms": [
|
|
81
|
-
"lax_numeric_parsing",
|
|
82
|
-
"mixed_sync_async_validators"
|
|
83
|
-
],
|
|
84
|
-
"possible_false_positives": []
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"batch":"Authorization","batch_index":5,"assessments":{"authorization_consistency":92.0,"mid_level_elegance":90.0},"dimension_notes":{"authorization_consistency":{"evidence":["MockServer wires all format routes via `this.app.post(format.route, createRouteHandler(format, deps))` with no auth/token checks in this file.","`host` option allows `\"0.0.0.0\"` exposure but there is no access-control or warning path in MockServer."],"impact_scope":"module","fix_scope":"single_edit","confidence":"medium","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."},"mid_level_elegance":{"evidence":["Route wiring and dependency injection happen inside the constructor, so adding middleware/auth per format requires editing `MockServer` internals rather than a seam or hook.","The dependency bag passed to `createRouteHandler` is assembled inline with implicit shape and no local contract comments, making the handoff less explicit."],"impact_scope":"module","fix_scope":"single_edit","confidence":"low","issues_preventing_higher_score":"Handoff between MockServer and route-handler is implicit and not externally configurable, limiting seam clarity for auth/middleware composition."}},"findings":[],"retrospective":{"root_causes":[],"likely_symptoms":[],"possible_false_positives":[]}}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"batch": "AI Debt & Migrations",
|
|
3
|
-
"batch_index": 6,
|
|
4
|
-
"assessments": {
|
|
5
|
-
"ai_generated_debt": 90.0,
|
|
6
|
-
"incomplete_migration": 95.0,
|
|
7
|
-
"low_level_elegance": 88.0
|
|
8
|
-
},
|
|
9
|
-
"dimension_notes": {
|
|
10
|
-
"ai_generated_debt": {
|
|
11
|
-
"evidence": [
|
|
12
|
-
"src/types/request.ts uses multiple explanatory comments on self-describing fields (e.g., lastMessage/systemMessage/toolNames) that mostly restate the property name.",
|
|
13
|
-
"src/types/rule.ts has a long comment block on Match that largely repeats the union’s behavior (string/RegExp/object/function)."
|
|
14
|
-
],
|
|
15
|
-
"impact_scope": "local",
|
|
16
|
-
"fix_scope": "single_edit",
|
|
17
|
-
"confidence": "medium",
|
|
18
|
-
"issues_preventing_higher_score": "Several comments restate obvious field semantics and could be reduced to higher-signal notes only."
|
|
19
|
-
},
|
|
20
|
-
"incomplete_migration": {
|
|
21
|
-
"evidence": [
|
|
22
|
-
"No @deprecated markers, migration TODOs, or legacy/new dual-path APIs appear in src/types/request.ts.",
|
|
23
|
-
"No @deprecated markers, migration TODOs, or legacy/new dual-path APIs appear in src/types/rule.ts."
|
|
24
|
-
],
|
|
25
|
-
"impact_scope": "local",
|
|
26
|
-
"fix_scope": "single_edit",
|
|
27
|
-
"confidence": "low",
|
|
28
|
-
"issues_preventing_higher_score": "Small surface area limits certainty; no migration residue observed in the reviewed files."
|
|
29
|
-
},
|
|
30
|
-
"low_level_elegance": {
|
|
31
|
-
"evidence": [
|
|
32
|
-
"src/types/request.ts uses optional properties with explicit `| undefined` (e.g., tools?: readonly ToolDef[] | undefined; toolCallId?: string | undefined).",
|
|
33
|
-
"src/types/rule.ts uses optional properties without explicit `| undefined` (e.g., message?: string | RegExp; toolCallId?: string), creating inconsistent type style."
|
|
34
|
-
],
|
|
35
|
-
"impact_scope": "local",
|
|
36
|
-
"fix_scope": "single_edit",
|
|
37
|
-
"confidence": "high",
|
|
38
|
-
"issues_preventing_higher_score": "Inconsistent and redundant optional typing adds noise and small but repeated cognitive overhead."
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"findings": [
|
|
42
|
-
{
|
|
43
|
-
"dimension": "ai_generated_debt",
|
|
44
|
-
"identifier": "restating_comments_on_types",
|
|
45
|
-
"summary": "Comments restate obvious type semantics, adding low-signal noise",
|
|
46
|
-
"related_files": [
|
|
47
|
-
"src/types/request.ts",
|
|
48
|
-
"src/types/rule.ts"
|
|
49
|
-
],
|
|
50
|
-
"evidence": [
|
|
51
|
-
"src/types/request.ts comments explain fields like lastMessage/systemMessage/toolNames in a way that mirrors the field name.",
|
|
52
|
-
"src/types/rule.ts Match comment block describes each union variant in a way that repeats the type definition."
|
|
53
|
-
],
|
|
54
|
-
"suggestion": "Trim comments to only convey non-obvious constraints or behavioral nuances; remove restatements of field names or type unions.",
|
|
55
|
-
"confidence": "medium",
|
|
56
|
-
"impact_scope": "local",
|
|
57
|
-
"fix_scope": "single_edit"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"dimension": "low_level_elegance",
|
|
61
|
-
"identifier": "redundant_optional_undefined",
|
|
62
|
-
"summary": "Optional fields redundantly include `| undefined`, creating inconsistency and noise",
|
|
63
|
-
"related_files": [
|
|
64
|
-
"src/types/request.ts",
|
|
65
|
-
"src/types/rule.ts"
|
|
66
|
-
],
|
|
67
|
-
"evidence": [
|
|
68
|
-
"src/types/request.ts declares `tools?: readonly ToolDef[] | undefined` and `toolCallId?: string | undefined`, which are already implied by `?`.",
|
|
69
|
-
"src/types/rule.ts uses `?:` without explicit `| undefined`, so the style is inconsistent across related type modules."
|
|
70
|
-
],
|
|
71
|
-
"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.",
|
|
72
|
-
"confidence": "high",
|
|
73
|
-
"impact_scope": "local",
|
|
74
|
-
"fix_scope": "single_edit"
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
|
-
"retrospective": {
|
|
78
|
-
"root_causes": [
|
|
79
|
-
"Documentation and type style appear auto-generated or copied without consolidation, leading to minor noise."
|
|
80
|
-
],
|
|
81
|
-
"likely_symptoms": [
|
|
82
|
-
"restating_comments_on_types",
|
|
83
|
-
"redundant_optional_undefined"
|
|
84
|
-
],
|
|
85
|
-
"possible_false_positives": []
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"batch":"Package Organization","batch_index":7,"assessments":{"package_organization":80.0,"high_level_elegance":83.0},"dimension_notes":{"package_organization":{"evidence":["holistic_context.structure.directory_profiles shows `src/` has `file_count: 11` with mixed concerns (cli, server/runtime, history, loader, logger, rule-engine).","holistic_context.structure.coupling_matrix shows bidirectional edges `src/ → src/formats/` (3) and `src/formats/ → src/` (3), indicating a blurred boundary between core runtime and format-specific code."],"impact_scope":"subsystem","fix_scope":"multi_file_refactor","confidence":"high"},"high_level_elegance":{"evidence":["Top-level `src/` bundles CLI entry (`cli.ts`), CLI validators (`cli-validators.ts`), and runtime/state (`history.ts`) in a single flat folder, making ownership boundaries non-obvious for newcomers.","Format-specific areas are cleanly grouped under `src/formats/*`, but core runtime files remain flat, which weakens the overall domain-aligned decomposition."],"impact_scope":"subsystem","fix_scope":"multi_file_refactor","confidence":"medium"}},"findings":[{"dimension":"package_organization","identifier":"flat_src_root_mixed_concerns","summary":"`src/` is a flat folder with mixed CLI/runtime/history concerns, obscuring ownership boundaries.","related_files":["src/cli.ts","src/history.ts","src/cli-validators.ts"],"evidence":["`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`).","`holistic_context.structure.coupling_matrix` shows `src/ ↔ src/formats/` bidirectional imports, which is a typical signal of missing subpackage boundaries."],"suggestion":"Staged reorg plan: 1) Create `src/cli/` and `src/server/` folders. 2) Move CLI files first: `src/cli.ts` → `src/cli/index.ts`, `src/cli-validators.ts` → `src/cli/validators.ts`. 3) Move runtime/state next: `src/history.ts` → `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.","confidence":"high","impact_scope":"subsystem","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"},{"dimension":"package_organization","identifier":"cli_validators_not_colocated","summary":"CLI-only validators live at `src/` root despite being used only by the CLI entrypoint.","related_files":["src/cli.ts","src/cli-validators.ts","test/cli-validators.test.ts"],"evidence":["`src/cli-validators.ts` is imported only by `src/cli.ts` and its dedicated test (`test/cli-validators.test.ts`).","No other modules consume `cli-validators.ts`, indicating it belongs inside a CLI-focused subpackage rather than the root."],"suggestion":"Staged reorg plan: 1) Create `src/cli/`. 2) Move `src/cli-validators.ts` → `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.","confidence":"high","impact_scope":"module","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"},{"dimension":"high_level_elegance","identifier":"ownership_boundaries_blurred_by_root_layout","summary":"Top-level decomposition mixes CLI and runtime concerns, weakening domain-aligned ownership.","related_files":["src/cli.ts","src/history.ts"],"evidence":["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/*`.","The flat root layout requires readers to scan files to infer domains instead of discovering boundaries through folder structure."],"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.","confidence":"medium","impact_scope":"subsystem","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"}],"retrospective":{"root_causes":["Flat `src/` root mixes multiple domains without subpackages, reducing navigability and ownership clarity."],"likely_symptoms":["cli_validators_not_colocated"],"possible_false_positives":[]}}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"batch": "Governance & Contracts",
|
|
3
|
-
"batch_index": 8,
|
|
4
|
-
"assessments": {
|
|
5
|
-
"cross_module_architecture": 88.0,
|
|
6
|
-
"high_level_elegance": 87.0,
|
|
7
|
-
"package_organization": 82.0
|
|
8
|
-
},
|
|
9
|
-
"dimension_notes": {
|
|
10
|
-
"cross_module_architecture": {
|
|
11
|
-
"evidence": [
|
|
12
|
-
"src/types.ts is a root barrel that re-exports three distinct type domains (request/reply/rule) and is a top imported module in the codebase (fan_in 19 per holistic_context.god_modules).",
|
|
13
|
-
"src/formats/types.ts and src/formats/request-helpers.ts both import from ../types.js, pulling format-specific code through the root barrel."
|
|
14
|
-
],
|
|
15
|
-
"impact_scope": "subsystem",
|
|
16
|
-
"fix_scope": "multi_file_refactor",
|
|
17
|
-
"confidence": "medium",
|
|
18
|
-
"issues_preventing_higher_score": "The root-level types barrel concentrates multiple domain contracts and becomes a coupling hub; narrowing entry points would reduce cross-module blast radius."
|
|
19
|
-
},
|
|
20
|
-
"high_level_elegance": {
|
|
21
|
-
"evidence": [
|
|
22
|
-
"src/formats/request-helpers.ts constructs the core MockRequest (including headers/path defaults and message-derived fields), tying core request shape to the format layer rather than a core request module.",
|
|
23
|
-
"src/formats/types.ts defines the Format interface yet relies on root-level types via ../types.js, reinforcing format-layer ownership of core request lifecycle."
|
|
24
|
-
],
|
|
25
|
-
"impact_scope": "subsystem",
|
|
26
|
-
"fix_scope": "multi_file_refactor",
|
|
27
|
-
"confidence": "medium",
|
|
28
|
-
"issues_preventing_higher_score": "Request lifecycle ownership is blurred between core and format layers, making high-level responsibilities less crisp."
|
|
29
|
-
},
|
|
30
|
-
"package_organization": {
|
|
31
|
-
"evidence": [
|
|
32
|
-
"holistic_context.structure shows src/ has 11 production files (avg_fan_in 3.8) spanning CLI, server, logging, rules, and types, indicating a flat, mixed-concern directory.",
|
|
33
|
-
"Within src/, core building blocks like src/logger.ts, src/rule-engine.ts, and src/types.ts sit alongside unrelated entrypoints (cli.ts, mock-server.ts), which obscures ownership boundaries."
|
|
34
|
-
],
|
|
35
|
-
"impact_scope": "codebase",
|
|
36
|
-
"fix_scope": "multi_file_refactor",
|
|
37
|
-
"confidence": "high"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"findings": [
|
|
41
|
-
{
|
|
42
|
-
"dimension": "cross_module_architecture",
|
|
43
|
-
"identifier": "types_barrel_coupling_hub",
|
|
44
|
-
"summary": "Root types barrel concentrates multiple domains and amplifies cross-module coupling.",
|
|
45
|
-
"related_files": [
|
|
46
|
-
"src/types.ts",
|
|
47
|
-
"src/formats/types.ts",
|
|
48
|
-
"src/formats/request-helpers.ts"
|
|
49
|
-
],
|
|
50
|
-
"evidence": [
|
|
51
|
-
"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.",
|
|
52
|
-
"This pattern makes any change to request/reply/rule type boundaries ripple through a single high-fan-in module."
|
|
53
|
-
],
|
|
54
|
-
"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.",
|
|
55
|
-
"confidence": "medium",
|
|
56
|
-
"impact_scope": "subsystem",
|
|
57
|
-
"fix_scope": "multi_file_refactor"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"dimension": "high_level_elegance",
|
|
61
|
-
"identifier": "format_layer_owns_request_construction",
|
|
62
|
-
"summary": "Format layer builds the core MockRequest, blurring ownership of request lifecycle.",
|
|
63
|
-
"related_files": [
|
|
64
|
-
"src/formats/request-helpers.ts",
|
|
65
|
-
"src/formats/types.ts",
|
|
66
|
-
"src/types.ts"
|
|
67
|
-
],
|
|
68
|
-
"evidence": [
|
|
69
|
-
"buildMockRequest in src/formats/request-helpers.ts derives lastMessage/systemMessage/toolNames and sets headers/path defaults, which are core request concerns.",
|
|
70
|
-
"Format interface in src/formats/types.ts consumes this helper indirectly, keeping request shape tied to the formats package."
|
|
71
|
-
],
|
|
72
|
-
"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.",
|
|
73
|
-
"confidence": "medium",
|
|
74
|
-
"impact_scope": "subsystem",
|
|
75
|
-
"fix_scope": "multi_file_refactor"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"dimension": "package_organization",
|
|
79
|
-
"identifier": "flat_src_mixed_concerns",
|
|
80
|
-
"summary": "The root src/ directory is a mixed-concern flat folder that hides ownership boundaries.",
|
|
81
|
-
"related_files": [
|
|
82
|
-
"src/logger.ts",
|
|
83
|
-
"src/rule-engine.ts",
|
|
84
|
-
"src/types.ts"
|
|
85
|
-
],
|
|
86
|
-
"evidence": [
|
|
87
|
-
"holistic_context.structure shows src/ contains 11 production files spanning CLI/server/logging/rules/types, indicating mixed responsibilities in a single directory.",
|
|
88
|
-
"Core building blocks (logger, rule engine, types) live beside entrypoints, making navigation and change ownership less predictable."
|
|
89
|
-
],
|
|
90
|
-
"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`.",
|
|
91
|
-
"confidence": "high",
|
|
92
|
-
"impact_scope": "codebase",
|
|
93
|
-
"fix_scope": "multi_file_refactor"
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
"retrospective": {
|
|
97
|
-
"root_causes": [
|
|
98
|
-
"Core domain types and request lifecycle are centralized at the root level, encouraging broad coupling and diffusing ownership boundaries.",
|
|
99
|
-
"The src/ directory has grown organically without sub-package delineation, leading to mixed concerns."
|
|
100
|
-
],
|
|
101
|
-
"likely_symptoms": [
|
|
102
|
-
"types_barrel_coupling_hub",
|
|
103
|
-
"format_layer_owns_request_construction"
|
|
104
|
-
],
|
|
105
|
-
"possible_false_positives": []
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"batch": "Cross-cutting Sweep",
|
|
3
|
-
"batch_index": 9,
|
|
4
|
-
"assessments": {
|
|
5
|
-
"design_coherence": 82.0
|
|
6
|
-
},
|
|
7
|
-
"dimension_notes": {
|
|
8
|
-
"design_coherence": {
|
|
9
|
-
"evidence": [
|
|
10
|
-
"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).",
|
|
11
|
-
"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)."
|
|
12
|
-
],
|
|
13
|
-
"impact_scope": "subsystem",
|
|
14
|
-
"fix_scope": "multi_file_refactor",
|
|
15
|
-
"confidence": "medium"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"findings": [
|
|
19
|
-
{
|
|
20
|
-
"dimension": "design_coherence",
|
|
21
|
-
"identifier": "sequence_rule_duplication",
|
|
22
|
-
"summary": "Sequence rule normalization is duplicated in server API and loader paths",
|
|
23
|
-
"related_files": [
|
|
24
|
-
"src/mock-server.ts",
|
|
25
|
-
"src/loader.ts",
|
|
26
|
-
"src/rule-engine.ts"
|
|
27
|
-
],
|
|
28
|
-
"evidence": [
|
|
29
|
-
"`MockServer.when().replySequence()` maps `SequenceEntry` values into steps, creates a sequence resolver, assigns `rule.resolve`, and sets `rule.remaining`.",
|
|
30
|
-
"`addSequenceRule()` in `src/loader.ts` performs the same step normalization, `createSequenceResolver()` call, and `rule.remaining` setup for JSON5 rules."
|
|
31
|
-
],
|
|
32
|
-
"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.",
|
|
33
|
-
"confidence": "medium",
|
|
34
|
-
"impact_scope": "module",
|
|
35
|
-
"fix_scope": "multi_file_refactor"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"dimension": "design_coherence",
|
|
39
|
-
"identifier": "mockserver_multi_role",
|
|
40
|
-
"summary": "`MockServer` combines server lifecycle, rule authoring, and state tracking responsibilities",
|
|
41
|
-
"related_files": [
|
|
42
|
-
"src/mock-server.ts",
|
|
43
|
-
"src/rule-engine.ts",
|
|
44
|
-
"src/history.ts"
|
|
45
|
-
],
|
|
46
|
-
"evidence": [
|
|
47
|
-
"`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.",
|
|
48
|
-
"This blends HTTP runtime concerns with rule registry and history concerns that already exist as separate modules (`RuleEngine`, `RequestHistory`)."
|
|
49
|
-
],
|
|
50
|
-
"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.",
|
|
51
|
-
"confidence": "medium",
|
|
52
|
-
"impact_scope": "subsystem",
|
|
53
|
-
"fix_scope": "architectural_change"
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"retrospective": {
|
|
57
|
-
"root_causes": [
|
|
58
|
-
"Sequence rule behavior is implemented in parallel call paths without a shared abstraction.",
|
|
59
|
-
"Top-level API class aggregates multiple subsystems to present a convenient surface, but lacks internal separation."
|
|
60
|
-
],
|
|
61
|
-
"likely_symptoms": [
|
|
62
|
-
"sequence_rule_duplication",
|
|
63
|
-
"mockserver_multi_role"
|
|
64
|
-
],
|
|
65
|
-
"possible_false_positives": []
|
|
66
|
-
}
|
|
67
|
-
}
|