@codraoss/core 0.9.5 → 0.9.12
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/{chunk-2TF4DSRX.js → chunk-4XEMXRNG.js} +12 -12
- package/dist/{chunk-754NO4DH.js → chunk-EQL5OOEF.js} +4 -4
- package/dist/{chunk-JC74XH7Q.js → chunk-GDX2ZEBA.js} +1 -1
- package/dist/chunk-GDX2ZEBA.js.map +1 -0
- package/dist/formatter-CDFpqbDP.d.ts +24 -0
- package/dist/formatter.d.ts +29 -0
- package/dist/formatter.js +111 -0
- package/dist/formatter.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -19
- package/dist/index.js.map +1 -1
- package/dist/model-output/index.js +5 -5
- package/dist/ports/index.d.ts +6 -24
- package/dist/ports/index.js +1 -1
- package/dist/rules/detect.js +2 -2
- package/package.json +10 -2
- package/dist/chunk-JC74XH7Q.js.map +0 -1
- /package/dist/{chunk-2TF4DSRX.js.map → chunk-4XEMXRNG.js.map} +0 -0
- /package/dist/{chunk-754NO4DH.js.map → chunk-EQL5OOEF.js.map} +0 -0
|
@@ -6,18 +6,18 @@ import {
|
|
|
6
6
|
parseFileReviewResponse,
|
|
7
7
|
parseRawBatchPayload,
|
|
8
8
|
samePath
|
|
9
|
-
} from "../chunk-
|
|
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,
|
package/dist/ports/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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,
|
|
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 };
|
package/dist/ports/index.js
CHANGED
package/dist/rules/detect.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ruleHitsToComments,
|
|
3
3
|
scanFileForRuleHits
|
|
4
|
-
} from "../chunk-
|
|
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.
|
|
3
|
+
"version": "0.9.12",
|
|
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"
|
|
@@ -104,6 +108,10 @@
|
|
|
104
108
|
"types": "./dist/logger.d.ts",
|
|
105
109
|
"import": "./dist/logger.js"
|
|
106
110
|
},
|
|
111
|
+
"./formatter": {
|
|
112
|
+
"types": "./dist/formatter.d.ts",
|
|
113
|
+
"import": "./dist/formatter.js"
|
|
114
|
+
},
|
|
107
115
|
"./diff": {
|
|
108
116
|
"types": "./dist/diff/index.d.ts",
|
|
109
117
|
"import": "./dist/diff/index.js"
|
|
@@ -166,7 +174,7 @@
|
|
|
166
174
|
"postpack": "node ../../scripts/swap-publish-exports.mjs restore"
|
|
167
175
|
},
|
|
168
176
|
"dependencies": {
|
|
169
|
-
"@codraoss/schema": "
|
|
177
|
+
"@codraoss/schema": "*",
|
|
170
178
|
"jsonrepair": "^3.15.0",
|
|
171
179
|
"picomatch": "^4.0.5",
|
|
172
180
|
"zod": "^4.3.6"
|
|
@@ -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,SAAqD;AACzF,U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