@codraoss/core 0.9.5 → 0.9.13

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.
@@ -6,18 +6,18 @@ import {
6
6
  parseFileReviewResponse,
7
7
  parseRawBatchPayload,
8
8
  samePath
9
- } from "../chunk-2TF4DSRX.js";
9
+ } from "../chunk-4XEMXRNG.js";
10
+ import "../chunk-I5S3NBFL.js";
10
11
  import "../chunk-ONJZXUQT.js";
11
12
  import "../chunk-FKRCBUWZ.js";
12
13
  import "../chunk-KTDBDKL5.js";
13
- import "../chunk-IKVUW4WC.js";
14
- import "../chunk-XPYVLHSX.js";
15
- import "../chunk-Z5B5X7QP.js";
16
- import "../chunk-I5S3NBFL.js";
17
14
  import {
18
15
  NON_ANSWER_MAX_RESPONSE_CHARS,
19
16
  NON_ANSWER_MIN_DIFF_LINES
20
17
  } from "../chunk-W3RY755V.js";
18
+ import "../chunk-IKVUW4WC.js";
19
+ import "../chunk-XPYVLHSX.js";
20
+ import "../chunk-Z5B5X7QP.js";
21
21
  export {
22
22
  NON_ANSWER_MAX_RESPONSE_CHARS,
23
23
  NON_ANSWER_MIN_DIFF_LINES,
@@ -1,6 +1,8 @@
1
1
  import { JobSummary, RepoConfig, ParsedReviewComment, ClaimType, ReviewSettings, ReviewJobMessage } from '@codraoss/schema';
2
2
  import { R as ReviewModel, M as ModelErrorClassifier } from '../model-BkqfyVh9.js';
3
3
  export { F as FileReviewOutcome, a as ModelResponse, b as ModelResponseSchema } from '../model-BkqfyVh9.js';
4
+ import { a as ReviewFormatter } from '../formatter-CDFpqbDP.js';
5
+ export { R as ReviewOverviewInput } from '../formatter-CDFpqbDP.js';
4
6
  import { TokenTracker } from '../token-tracker.js';
5
7
  export { Logger } from '../logger.js';
6
8
  import '../position-zZl8KGVu.js';
@@ -369,27 +371,6 @@ interface GitProviderFactory {
369
371
  forInstallation(installationId: string): ReviewGitProvider;
370
372
  }
371
373
 
372
- interface ReviewFormatter {
373
- toReviewEvent(verdict: 'approve' | 'comment'): 'APPROVE' | 'COMMENT';
374
- summarizeVerdict(comments: ParsedReviewComment[], hasFailures: boolean): {
375
- verdict: 'approve' | 'comment';
376
- errors: number;
377
- warnings: number;
378
- };
379
- formatInlineComment(comment: ParsedReviewComment): string;
380
- formatReviewOverview(input: ReviewOverviewInput): string;
381
- }
382
- type ReviewOverviewInput = {
383
- commitSha: string;
384
- /** Comments actually posted. Zero means the header must not promise suggestions. */
385
- postedFindings: number;
386
- filesReviewed: number;
387
- linesReviewed: number;
388
- /** Candidates the gates dropped; on a clean review this is what "nothing to report" cost. */
389
- withheldFindings: number;
390
- filesFailed: number;
391
- };
392
-
393
374
  type ReviewTelemetryEvent = {
394
375
  linesReviewed: number;
395
376
  findingsReported: number;
@@ -455,7 +436,7 @@ interface KeyValueStore {
455
436
  expirationTtl?: number;
456
437
  }): Promise<void>;
457
438
  get(key: string, type: 'json'): Promise<unknown>;
458
- get(key: string, type: 'text'): Promise<string | null>;
439
+ get(key: string, type?: 'text'): Promise<string | null>;
459
440
  delete(key: string): Promise<void>;
460
441
  }
461
442
 
@@ -463,6 +444,7 @@ interface QueueProducer<T> {
463
444
  send(message: T, options?: {
464
445
  delaySeconds?: number;
465
446
  }): Promise<void>;
447
+ deleteJob?(jobId: string): Promise<void>;
466
448
  }
467
449
 
468
450
  interface JobOrchestrator {
@@ -507,7 +489,7 @@ declare class InMemoryKV implements KeyValueStore {
507
489
  put(key: string, value: string, options?: {
508
490
  expirationTtl?: number;
509
491
  }): Promise<void>;
510
- get(key: string, type: 'json' | 'text'): Promise<any>;
492
+ get(key: string, type?: 'json' | 'text'): Promise<any>;
511
493
  delete(key: string): Promise<void>;
512
494
  }
513
495
  declare class InMemoryQueue<T> implements QueueProducer<T> {
@@ -531,4 +513,4 @@ declare class InMemorySessionStore implements SessionStore {
531
513
  renewSession(token: string): Promise<void>;
532
514
  }
533
515
 
534
- export { type AuthorizationResult, type BulkFileReviewInput, type Clock, type DashboardSessionUser, type FileReviewRow, type FileReviewStore, type GitProviderFactory, type IdGenerator, type IdentityProvider, InMemoryKV, InMemoryOrchestrator, InMemoryQueue, InMemorySessionStore, type InstanceIdStore, type JobLeaseClaim, type JobOrchestrator, type JobRow, type JobStore, type KeyValueStore, type KvStore, type LearningStore, type ModelConfigReader, ModelErrorClassifier, type PersistedReviewJob, type PullRequestRecord, type QueueProducer, type RepoConfigLoader, type RepoConfigStore, type ReviewComment, type ReviewFormatter, type ReviewGitProvider, ReviewModel, type ReviewOverviewInput, type ReviewRuntime, type ReviewSettingsReader, type ReviewTelemetryEvent, type SecretStore, type SessionStore, type SuppressedFinding, type TelemetrySink, type WebhookDeliveryReader };
516
+ export { type AuthorizationResult, type BulkFileReviewInput, type Clock, type DashboardSessionUser, type FileReviewRow, type FileReviewStore, type GitProviderFactory, type IdGenerator, type IdentityProvider, InMemoryKV, InMemoryOrchestrator, InMemoryQueue, InMemorySessionStore, type InstanceIdStore, type JobLeaseClaim, type JobOrchestrator, type JobRow, type JobStore, type KeyValueStore, type KvStore, type LearningStore, type ModelConfigReader, ModelErrorClassifier, type PersistedReviewJob, type PullRequestRecord, type QueueProducer, type RepoConfigLoader, type RepoConfigStore, type ReviewComment, ReviewFormatter, type ReviewGitProvider, ReviewModel, type ReviewRuntime, type ReviewSettingsReader, type ReviewTelemetryEvent, type SecretStore, type SessionStore, type SuppressedFinding, type TelemetrySink, type WebhookDeliveryReader };
@@ -3,7 +3,7 @@ import {
3
3
  InMemoryOrchestrator,
4
4
  InMemoryQueue,
5
5
  InMemorySessionStore
6
- } from "../chunk-JC74XH7Q.js";
6
+ } from "../chunk-GDX2ZEBA.js";
7
7
  export {
8
8
  InMemoryKV,
9
9
  InMemoryOrchestrator,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ruleHitsToComments,
3
3
  scanFileForRuleHits
4
- } from "../chunk-754NO4DH.js";
4
+ } from "../chunk-EQL5OOEF.js";
5
5
  import "../chunk-JAF7JIZQ.js";
6
+ import "../chunk-W3RY755V.js";
6
7
  import "../chunk-IKVUW4WC.js";
7
8
  import "../chunk-XPYVLHSX.js";
8
- import "../chunk-W3RY755V.js";
9
9
  export {
10
10
  ruleHitsToComments,
11
11
  scanFileForRuleHits
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codraoss/core",
3
- "version": "0.9.5",
3
+ "version": "0.9.13",
4
4
  "description": "The Codra review engine: pure, transport- and platform-agnostic code review logic behind ports.",
5
5
  "author": "Devarshi Shimpi",
6
6
  "license": "AGPL-3.0-only",
@@ -28,6 +28,10 @@
28
28
  "types": "./dist/logger.d.ts",
29
29
  "import": "./dist/logger.js"
30
30
  },
31
+ "./formatter": {
32
+ "types": "./dist/formatter.d.ts",
33
+ "import": "./dist/formatter.js"
34
+ },
31
35
  "./diff": {
32
36
  "types": "./dist/diff/index.d.ts",
33
37
  "import": "./dist/diff/index.js"
@@ -87,76 +91,7 @@
87
91
  "README.md"
88
92
  ],
89
93
  "publishConfig": {
90
- "access": "public",
91
- "main": "./dist/index.js",
92
- "module": "./dist/index.js",
93
- "types": "./dist/index.d.ts",
94
- "exports": {
95
- ".": {
96
- "types": "./dist/index.d.ts",
97
- "import": "./dist/index.js"
98
- },
99
- "./ports": {
100
- "types": "./dist/ports/index.d.ts",
101
- "import": "./dist/ports/index.js"
102
- },
103
- "./logger": {
104
- "types": "./dist/logger.d.ts",
105
- "import": "./dist/logger.js"
106
- },
107
- "./diff": {
108
- "types": "./dist/diff/index.d.ts",
109
- "import": "./dist/diff/index.js"
110
- },
111
- "./model-output": {
112
- "types": "./dist/model-output/index.d.ts",
113
- "import": "./dist/model-output/index.js"
114
- },
115
- "./rules/detect": {
116
- "types": "./dist/rules/detect.d.ts",
117
- "import": "./dist/rules/detect.js"
118
- },
119
- "./rules/table": {
120
- "types": "./dist/rules/table.d.ts",
121
- "import": "./dist/rules/table.js"
122
- },
123
- "./claim-checks": {
124
- "types": "./dist/claim-checks.d.ts",
125
- "import": "./dist/claim-checks.js"
126
- },
127
- "./verify": {
128
- "types": "./dist/verify.d.ts",
129
- "import": "./dist/verify.js"
130
- },
131
- "./fingerprint": {
132
- "types": "./dist/fingerprint.d.ts",
133
- "import": "./dist/fingerprint.js"
134
- },
135
- "./timeout": {
136
- "types": "./dist/timeout.d.ts",
137
- "import": "./dist/timeout.js"
138
- },
139
- "./token-tracker": {
140
- "types": "./dist/token-tracker.d.ts",
141
- "import": "./dist/token-tracker.js"
142
- },
143
- "./prompts/file-review": {
144
- "types": "./dist/prompts/file-review.d.ts",
145
- "import": "./dist/prompts/file-review.js"
146
- },
147
- "./prompts/languages": {
148
- "types": "./dist/prompts/languages.d.ts",
149
- "import": "./dist/prompts/languages.js"
150
- },
151
- "./prompts/summary": {
152
- "types": "./dist/prompts/summary.d.ts",
153
- "import": "./dist/prompts/summary.js"
154
- },
155
- "./prompts/verify": {
156
- "types": "./dist/prompts/verify.d.ts",
157
- "import": "./dist/prompts/verify.js"
158
- }
159
- }
94
+ "access": "public"
160
95
  },
161
96
  "scripts": {
162
97
  "build": "tsup",
@@ -166,14 +101,14 @@
166
101
  "postpack": "node ../../scripts/swap-publish-exports.mjs restore"
167
102
  },
168
103
  "dependencies": {
169
- "@codraoss/schema": "^0.9.5",
104
+ "@codraoss/schema": "workspace:*",
170
105
  "jsonrepair": "^3.15.0",
171
- "picomatch": "^4.0.5",
106
+ "picomatch": "^4.0.7",
172
107
  "zod": "^4.3.6"
173
108
  },
174
109
  "devDependencies": {
175
110
  "@types/picomatch": "^4.0.3",
176
- "tsup": "^8.0.0"
111
+ "tsup": "^8.0.2"
177
112
  },
178
113
  "main": "./dist/index.js",
179
114
  "module": "./dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ports/in-memory.ts"],"sourcesContent":["import type { KeyValueStore } from './kv';\nimport type { QueueProducer } from './queue';\nimport type { JobOrchestrator } from './orchestrator';\nimport type { SessionStore, DashboardSessionUser } from './session-store';\nimport type { ReviewJobMessage } from '@codraoss/schema';\n\nexport class InMemoryKV implements KeyValueStore {\n private store = new Map<string, { value: string; expiresAt?: number }>();\n\n async put(key: string, value: string, options?: { expirationTtl?: number }): Promise<void> {\n const expiresAt = options?.expirationTtl ? Date.now() + options.expirationTtl * 1000 : undefined;\n this.store.set(key, { value, expiresAt });\n }\n\n async get(key: string, type: 'json' | 'text'): Promise<any> {\n const entry = this.store.get(key);\n if (!entry) return null;\n if (entry.expiresAt && Date.now() > entry.expiresAt) {\n this.store.delete(key);\n return null;\n }\n if (type === 'json') {\n try { return JSON.parse(entry.value); } catch { return null; }\n }\n return entry.value;\n }\n\n async delete(key: string): Promise<void> {\n this.store.delete(key);\n }\n}\n\nexport class InMemoryQueue<T> implements QueueProducer<T> {\n public messages: Array<{ message: T; delaySeconds?: number }> = [];\n\n async send(message: T, options?: { delaySeconds?: number }): Promise<void> {\n this.messages.push({ message, delaySeconds: options?.delaySeconds });\n }\n}\n\nexport class InMemoryOrchestrator implements JobOrchestrator {\n public jobs: Map<string, ReviewJobMessage> = new Map();\n\n async startReviewJob(id: string, params: ReviewJobMessage): Promise<void> {\n this.jobs.set(id, params);\n }\n}\n\nexport class InMemorySessionStore implements SessionStore {\n private kv = new InMemoryKV();\n\n async createSession(session: DashboardSessionUser): Promise<string> {\n const token = Math.random().toString(36).substring(2);\n await this.kv.put(`session:${token}`, JSON.stringify(session), { expirationTtl: 60 * 60 * 24 * 7 });\n return token;\n }\n\n async readSession(token: string): Promise<DashboardSessionUser | null> {\n return this.kv.get(`session:${token}`, 'json');\n }\n\n async destroySession(token: string): Promise<void> {\n await this.kv.delete(`session:${token}`);\n }\n\n async renewSession(token: string): Promise<void> {\n const session = await this.readSession(token);\n if (session) {\n await this.kv.put(`session:${token}`, JSON.stringify(session), { expirationTtl: 60 * 60 * 24 * 7 });\n }\n }\n}\n"],"mappings":";AAMO,IAAM,aAAN,MAA0C;AAAA,EACvC,QAAQ,oBAAI,IAAmD;AAAA,EAEvE,MAAM,IAAI,KAAa,OAAe,SA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