Conversation
…rmalizers Move 9 pure-function modules from server/src/llm/ to cli/src/analysis/ as the foundation for native analysis (--native mode, Issue #238, Phase 12 v4.8.0). New modules in cli/src/analysis/: - prompt-types.ts: AnalysisResponse, PromptQualityResponse, SQLiteMessageRow, ContentBlock - prompt-constants.ts: Canonical categories and classification guidance strings - prompts.ts: buildSessionAnalysisInstructions, buildPromptQualityInstructions, buildFacetOnlyInstructions - message-format.ts: formatMessagesForAnalysis, classifyStoredUserMessage, formatSessionMetaLine - response-parsers.ts: parseAnalysisResponse, parsePromptQualityResponse, extractJsonPayload - normalize-utils.ts: levenshtein, normalizeCategory, kebabToTitleCase - friction-normalize.ts: normalizeFrictionCategory - pattern-normalize.ts: normalizePatternCategory, getPatternCategoryLabel - prompt-quality-normalize.ts: normalizePromptQualityCategory, getPQCategoryLabel, getPQCategoryType Added 9 ./analysis/* exports to cli/package.json. Moved test files to cli/src/analysis/__tests__/ (5 test files, 131 tests). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ights/cli/analysis/* Server files now re-export from the CLI analysis/ package, preserving the exact same public API surface with zero breaking changes. Converted to re-exports: - server/src/llm/prompt-types.ts - server/src/llm/prompt-constants.ts - server/src/llm/prompts.ts - server/src/llm/message-format.ts - server/src/llm/response-parsers.ts - server/src/llm/normalize-utils.ts - server/src/llm/friction-normalize.ts - server/src/llm/pattern-normalize.ts - server/src/llm/prompt-quality-normalize.ts All existing server imports (analysis.ts, facet-extraction.ts, prompt-quality-analysis.ts, analysis-db.ts, shared-aggregation.ts) continue to work unchanged via re-exports. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
Author
|
Thank you :) Please share your valuable feedback to improve this tool |
Owner
Author
TA Synthesis (Phase 2): Prompt Module Migration — Round 1Review of Domain Specialist Comments
Second Pass FindingsAfter reviewing both independent reviews and re-checking the diff:
No new issues found in second pass. Consolidated Review (For Dev Agent)🔴 FIX NOW: None. ❌ NOT APPLICABLE: None — all findings were valid observations. 🟡 SUGGESTIONS (non-blocking, dev's discretion):
Final VerdictPASS — ready for merge. Zero blocking issues from either reviewer. Pure refactor confirmed: no schema changes, no API changes, no functional changes. Build and 939 tests pass. Server re-export chain verified on PR branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
server/src/llm/tocli/src/analysis/./analysis/*exports tocli/package.json@code-insights/cli/analysis/*cli/src/analysis/__tests__/(131 tests)Closes #238
What
Creates
cli/src/analysis/with 9 modules:prompt-types.ts— types (AnalysisResponse, PromptQualityResponse, SQLiteMessageRow, ContentBlock)prompt-constants.ts— canonical categories + classification guidance stringsprompts.ts— prompt builder functions (buildSessionAnalysisInstructions, buildPromptQualityInstructions, buildFacetOnlyInstructions, buildCacheableConversationBlock)message-format.ts— formatMessagesForAnalysis, classifyStoredUserMessage, formatSessionMetaLineresponse-parsers.ts— parseAnalysisResponse, parsePromptQualityResponse, extractJsonPayloadnormalize-utils.ts— levenshtein, normalizeCategory, kebabToTitleCasefriction-normalize.ts— normalizeFrictionCategorypattern-normalize.ts— normalizePatternCategory, getPatternCategoryLabelprompt-quality-normalize.ts— normalizePromptQualityCategory, getPQCategoryLabel, getPQCategoryTypeWhy
Foundation for Phase 12 native analysis (v4.8.0). The CLI needs to build analysis prompts for
--nativemode (claude -p), but prompt builders lived inserver/src/llm/. The CLI cannot import from the server package (circular: server already imports from CLI for DB access). Moving the pure-function modules to CLI breaks the circular dependency.How
cli/src/analysis/with all 9 modules, adjusting imports between them to stay relative withinanalysis/message-format.tsinlinedsafeParseJson(5-line pure helper) rather than importing across the package boundary — mirrors the existing pattern inserver/src/utils.tsanddashboard/src/lib/types.tsprompt-types.tsgainedContentBlock(was inserver/src/llm/types.ts) sinceprompts.tsneeds it — both definitions are structurally identical and TypeScript structural typing ensures compatibilitySchema Impact
Verification
pnpm build— CLI + server + dashboard all clean)The 5 migrated test files run in both CLI (
cli/src/analysis/__tests__/) and server (server/src/llm/*.test.ts) locations, giving double coverage confirming the re-export chain works.Test plan
pnpm buildpasses from repo root (zero errors)pnpm testpasses (939 tests, 43 files)cli/src/analysis/__tests__/all pass (131 tests)🤖 Generated with Claude Code