mcp-git-issue-priority 1.0.0
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/LICENSE +21 -0
- package/README.md +412 -0
- package/dist/config/index.d.ts +20 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +76 -0
- package/dist/config/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/models/audit-log.d.ts +57 -0
- package/dist/models/audit-log.d.ts.map +1 -0
- package/dist/models/audit-log.js +50 -0
- package/dist/models/audit-log.js.map +1 -0
- package/dist/models/batch-state.d.ts +81 -0
- package/dist/models/batch-state.d.ts.map +1 -0
- package/dist/models/batch-state.js +38 -0
- package/dist/models/batch-state.js.map +1 -0
- package/dist/models/index.d.ts +9 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +9 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/issue.d.ts +193 -0
- package/dist/models/issue.d.ts.map +1 -0
- package/dist/models/issue.js +86 -0
- package/dist/models/issue.js.map +1 -0
- package/dist/models/lock.d.ts +35 -0
- package/dist/models/lock.d.ts.map +1 -0
- package/dist/models/lock.js +48 -0
- package/dist/models/lock.js.map +1 -0
- package/dist/models/pr-status.d.ts +152 -0
- package/dist/models/pr-status.d.ts.map +1 -0
- package/dist/models/pr-status.js +36 -0
- package/dist/models/pr-status.js.map +1 -0
- package/dist/models/priority-score.d.ts +41 -0
- package/dist/models/priority-score.d.ts.map +1 -0
- package/dist/models/priority-score.js +64 -0
- package/dist/models/priority-score.js.map +1 -0
- package/dist/models/selection-filter.d.ts +16 -0
- package/dist/models/selection-filter.d.ts.map +1 -0
- package/dist/models/selection-filter.js +40 -0
- package/dist/models/selection-filter.js.map +1 -0
- package/dist/models/workflow-state.d.ts +126 -0
- package/dist/models/workflow-state.d.ts.map +1 -0
- package/dist/models/workflow-state.js +106 -0
- package/dist/models/workflow-state.js.map +1 -0
- package/dist/services/batch.d.ts +23 -0
- package/dist/services/batch.d.ts.map +1 -0
- package/dist/services/batch.js +126 -0
- package/dist/services/batch.js.map +1 -0
- package/dist/services/github.d.ts +48 -0
- package/dist/services/github.d.ts.map +1 -0
- package/dist/services/github.js +315 -0
- package/dist/services/github.js.map +1 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +7 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/locking.d.ts +42 -0
- package/dist/services/locking.d.ts.map +1 -0
- package/dist/services/locking.js +195 -0
- package/dist/services/locking.js.map +1 -0
- package/dist/services/logging.d.ts +40 -0
- package/dist/services/logging.d.ts.map +1 -0
- package/dist/services/logging.js +80 -0
- package/dist/services/logging.js.map +1 -0
- package/dist/services/priority.d.ts +18 -0
- package/dist/services/priority.d.ts.map +1 -0
- package/dist/services/priority.js +33 -0
- package/dist/services/priority.js.map +1 -0
- package/dist/services/workflow.d.ts +39 -0
- package/dist/services/workflow.d.ts.map +1 -0
- package/dist/services/workflow.js +201 -0
- package/dist/services/workflow.js.map +1 -0
- package/dist/tools/advance-workflow.d.ts +3 -0
- package/dist/tools/advance-workflow.d.ts.map +1 -0
- package/dist/tools/advance-workflow.js +120 -0
- package/dist/tools/advance-workflow.js.map +1 -0
- package/dist/tools/batch-continue.d.ts +3 -0
- package/dist/tools/batch-continue.d.ts.map +1 -0
- package/dist/tools/batch-continue.js +133 -0
- package/dist/tools/batch-continue.js.map +1 -0
- package/dist/tools/bulk-update-issues.d.ts +3 -0
- package/dist/tools/bulk-update-issues.d.ts.map +1 -0
- package/dist/tools/bulk-update-issues.js +87 -0
- package/dist/tools/bulk-update-issues.js.map +1 -0
- package/dist/tools/create-issue.d.ts +41 -0
- package/dist/tools/create-issue.d.ts.map +1 -0
- package/dist/tools/create-issue.js +186 -0
- package/dist/tools/create-issue.js.map +1 -0
- package/dist/tools/force-claim.d.ts +3 -0
- package/dist/tools/force-claim.d.ts.map +1 -0
- package/dist/tools/force-claim.js +99 -0
- package/dist/tools/force-claim.js.map +1 -0
- package/dist/tools/get-pr-status.d.ts +3 -0
- package/dist/tools/get-pr-status.d.ts.map +1 -0
- package/dist/tools/get-pr-status.js +51 -0
- package/dist/tools/get-pr-status.js.map +1 -0
- package/dist/tools/get-workflow-analytics.d.ts +3 -0
- package/dist/tools/get-workflow-analytics.d.ts.map +1 -0
- package/dist/tools/get-workflow-analytics.js +264 -0
- package/dist/tools/get-workflow-analytics.js.map +1 -0
- package/dist/tools/get-workflow-status.d.ts +3 -0
- package/dist/tools/get-workflow-status.d.ts.map +1 -0
- package/dist/tools/get-workflow-status.js +103 -0
- package/dist/tools/get-workflow-status.js.map +1 -0
- package/dist/tools/implement-batch.d.ts +3 -0
- package/dist/tools/implement-batch.d.ts.map +1 -0
- package/dist/tools/implement-batch.js +124 -0
- package/dist/tools/implement-batch.js.map +1 -0
- package/dist/tools/list-backlog.d.ts +3 -0
- package/dist/tools/list-backlog.d.ts.map +1 -0
- package/dist/tools/list-backlog.js +146 -0
- package/dist/tools/list-backlog.js.map +1 -0
- package/dist/tools/release-lock.d.ts +3 -0
- package/dist/tools/release-lock.d.ts.map +1 -0
- package/dist/tools/release-lock.js +95 -0
- package/dist/tools/release-lock.js.map +1 -0
- package/dist/tools/select-next-issue.d.ts +3 -0
- package/dist/tools/select-next-issue.d.ts.map +1 -0
- package/dist/tools/select-next-issue.js +192 -0
- package/dist/tools/select-next-issue.js.map +1 -0
- package/dist/tools/sync-backlog-labels.d.ts +3 -0
- package/dist/tools/sync-backlog-labels.d.ts.map +1 -0
- package/dist/tools/sync-backlog-labels.js +164 -0
- package/dist/tools/sync-backlog-labels.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WorkflowPhaseSchema } from './workflow-state.js';
|
|
3
|
+
export const AuditLogLevelSchema = z.enum(['info', 'warn', 'error']);
|
|
4
|
+
export const AuditLogOutcomeSchema = z.enum(['success', 'failure', 'skipped']);
|
|
5
|
+
export const AuditLogEntrySchema = z.object({
|
|
6
|
+
timestamp: z.string().datetime(),
|
|
7
|
+
level: AuditLogLevelSchema,
|
|
8
|
+
tool: z.string(),
|
|
9
|
+
sessionId: z.string().uuid(),
|
|
10
|
+
repoFullName: z.string().optional(),
|
|
11
|
+
issueNumber: z.number().int().positive().optional(),
|
|
12
|
+
phase: WorkflowPhaseSchema.optional(),
|
|
13
|
+
duration: z.number().int().nonnegative().optional(),
|
|
14
|
+
outcome: AuditLogOutcomeSchema,
|
|
15
|
+
error: z.string().optional(),
|
|
16
|
+
metadata: z.record(z.unknown()).optional(),
|
|
17
|
+
});
|
|
18
|
+
export function createAuditLogEntry(tool, sessionId, outcome, options) {
|
|
19
|
+
return {
|
|
20
|
+
timestamp: new Date().toISOString(),
|
|
21
|
+
level: options?.level ?? (outcome === 'failure' ? 'error' : 'info'),
|
|
22
|
+
tool,
|
|
23
|
+
sessionId,
|
|
24
|
+
outcome,
|
|
25
|
+
...(options?.repoFullName && { repoFullName: options.repoFullName }),
|
|
26
|
+
...(options?.issueNumber && { issueNumber: options.issueNumber }),
|
|
27
|
+
...(options?.phase && { phase: options.phase }),
|
|
28
|
+
...(options?.duration !== undefined && { duration: options.duration }),
|
|
29
|
+
...(options?.error && { error: options.error }),
|
|
30
|
+
...(options?.metadata && { metadata: options.metadata }),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function serializeLogEntry(entry) {
|
|
34
|
+
return JSON.stringify(entry);
|
|
35
|
+
}
|
|
36
|
+
export function parseLogEntry(line) {
|
|
37
|
+
try {
|
|
38
|
+
const data = JSON.parse(line);
|
|
39
|
+
const result = AuditLogEntrySchema.safeParse(data);
|
|
40
|
+
return result.success ? result.data : null;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function getLogFileName(date = new Date()) {
|
|
47
|
+
const dateStr = date.toISOString().split('T')[0];
|
|
48
|
+
return `audit-${dateStr}.jsonl`;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=audit-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.js","sourceRoot":"","sources":["../../src/models/audit-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAGrE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAG/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACnD,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IACrC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACnD,OAAO,EAAE,qBAAqB;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;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MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAa,IAAI,IAAI,EAAE;IACpD,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,SAAS,OAAO,QAAQ,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CompletedIssueSchema: z.ZodObject<{
|
|
3
|
+
issue: z.ZodNumber;
|
|
4
|
+
pr: z.ZodNumber;
|
|
5
|
+
startedAt: z.ZodString;
|
|
6
|
+
mergedAt: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
pr: number;
|
|
9
|
+
issue: number;
|
|
10
|
+
startedAt: string;
|
|
11
|
+
mergedAt: string;
|
|
12
|
+
}, {
|
|
13
|
+
pr: number;
|
|
14
|
+
issue: number;
|
|
15
|
+
startedAt: string;
|
|
16
|
+
mergedAt: string;
|
|
17
|
+
}>;
|
|
18
|
+
export type CompletedIssue = z.infer<typeof CompletedIssueSchema>;
|
|
19
|
+
export declare const BatchStateSchema: z.ZodObject<{
|
|
20
|
+
batchId: z.ZodString;
|
|
21
|
+
repository: z.ZodString;
|
|
22
|
+
totalCount: z.ZodNumber;
|
|
23
|
+
completedCount: z.ZodNumber;
|
|
24
|
+
currentIssue: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
currentPr: z.ZodNullable<z.ZodNumber>;
|
|
26
|
+
queue: z.ZodArray<z.ZodNumber, "many">;
|
|
27
|
+
completed: z.ZodArray<z.ZodObject<{
|
|
28
|
+
issue: z.ZodNumber;
|
|
29
|
+
pr: z.ZodNumber;
|
|
30
|
+
startedAt: z.ZodString;
|
|
31
|
+
mergedAt: z.ZodString;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
pr: number;
|
|
34
|
+
issue: number;
|
|
35
|
+
startedAt: string;
|
|
36
|
+
mergedAt: string;
|
|
37
|
+
}, {
|
|
38
|
+
pr: number;
|
|
39
|
+
issue: number;
|
|
40
|
+
startedAt: string;
|
|
41
|
+
mergedAt: string;
|
|
42
|
+
}>, "many">;
|
|
43
|
+
startedAt: z.ZodString;
|
|
44
|
+
status: z.ZodEnum<["in_progress", "completed", "timeout", "abandoned"]>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
status: "abandoned" | "completed" | "in_progress" | "timeout";
|
|
47
|
+
repository: string;
|
|
48
|
+
startedAt: string;
|
|
49
|
+
batchId: string;
|
|
50
|
+
totalCount: number;
|
|
51
|
+
completedCount: number;
|
|
52
|
+
currentIssue: number | null;
|
|
53
|
+
currentPr: number | null;
|
|
54
|
+
queue: number[];
|
|
55
|
+
completed: {
|
|
56
|
+
pr: number;
|
|
57
|
+
issue: number;
|
|
58
|
+
startedAt: string;
|
|
59
|
+
mergedAt: string;
|
|
60
|
+
}[];
|
|
61
|
+
}, {
|
|
62
|
+
status: "abandoned" | "completed" | "in_progress" | "timeout";
|
|
63
|
+
repository: string;
|
|
64
|
+
startedAt: string;
|
|
65
|
+
batchId: string;
|
|
66
|
+
totalCount: number;
|
|
67
|
+
completedCount: number;
|
|
68
|
+
currentIssue: number | null;
|
|
69
|
+
currentPr: number | null;
|
|
70
|
+
queue: number[];
|
|
71
|
+
completed: {
|
|
72
|
+
pr: number;
|
|
73
|
+
issue: number;
|
|
74
|
+
startedAt: string;
|
|
75
|
+
mergedAt: string;
|
|
76
|
+
}[];
|
|
77
|
+
}>;
|
|
78
|
+
export type BatchState = z.infer<typeof BatchStateSchema>;
|
|
79
|
+
export declare function createBatchState(repository: string, totalCount: number, queue: number[]): BatchState;
|
|
80
|
+
export declare function validateBatchState(data: unknown): BatchState | null;
|
|
81
|
+
//# sourceMappingURL=batch-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-state.d.ts","sourceRoot":"","sources":["../../src/models/batch-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;EAK/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EAAE,GACd,UAAU,CAaZ;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAGnE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CompletedIssueSchema = z.object({
|
|
3
|
+
issue: z.number().int().positive(),
|
|
4
|
+
pr: z.number().int().positive(),
|
|
5
|
+
startedAt: z.string().datetime(),
|
|
6
|
+
mergedAt: z.string().datetime(),
|
|
7
|
+
});
|
|
8
|
+
export const BatchStateSchema = z.object({
|
|
9
|
+
batchId: z.string().uuid(),
|
|
10
|
+
repository: z.string(),
|
|
11
|
+
totalCount: z.number().int().nonnegative(),
|
|
12
|
+
completedCount: z.number().int().nonnegative(),
|
|
13
|
+
currentIssue: z.number().int().positive().nullable(),
|
|
14
|
+
currentPr: z.number().int().positive().nullable(),
|
|
15
|
+
queue: z.array(z.number().int().positive()),
|
|
16
|
+
completed: z.array(CompletedIssueSchema),
|
|
17
|
+
startedAt: z.string().datetime(),
|
|
18
|
+
status: z.enum(['in_progress', 'completed', 'timeout', 'abandoned']),
|
|
19
|
+
});
|
|
20
|
+
export function createBatchState(repository, totalCount, queue) {
|
|
21
|
+
return {
|
|
22
|
+
batchId: crypto.randomUUID(),
|
|
23
|
+
repository,
|
|
24
|
+
totalCount,
|
|
25
|
+
completedCount: 0,
|
|
26
|
+
currentIssue: null,
|
|
27
|
+
currentPr: null,
|
|
28
|
+
queue,
|
|
29
|
+
completed: [],
|
|
30
|
+
startedAt: new Date().toISOString(),
|
|
31
|
+
status: 'in_progress',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function validateBatchState(data) {
|
|
35
|
+
const result = BatchStateSchema.safeParse(data);
|
|
36
|
+
return result.success ? result.data : null;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=batch-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-state.js","sourceRoot":"","sources":["../../src/models/batch-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC/B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,OA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CAAC,IAAI,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './issue.js';
|
|
2
|
+
export * from './lock.js';
|
|
3
|
+
export * from './workflow-state.js';
|
|
4
|
+
export * from './priority-score.js';
|
|
5
|
+
export * from './selection-filter.js';
|
|
6
|
+
export * from './audit-log.js';
|
|
7
|
+
export * from './batch-state.js';
|
|
8
|
+
export * from './pr-status.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './issue.js';
|
|
2
|
+
export * from './lock.js';
|
|
3
|
+
export * from './workflow-state.js';
|
|
4
|
+
export * from './priority-score.js';
|
|
5
|
+
export * from './selection-filter.js';
|
|
6
|
+
export * from './audit-log.js';
|
|
7
|
+
export * from './batch-state.js';
|
|
8
|
+
export * from './pr-status.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const LabelSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
color: z.ZodString;
|
|
5
|
+
description: z.ZodNullable<z.ZodString>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
name: string;
|
|
8
|
+
color: string;
|
|
9
|
+
description: string | null;
|
|
10
|
+
}, {
|
|
11
|
+
name: string;
|
|
12
|
+
color: string;
|
|
13
|
+
description: string | null;
|
|
14
|
+
}>;
|
|
15
|
+
export type Label = z.infer<typeof LabelSchema>;
|
|
16
|
+
export declare const AssigneeSchema: z.ZodObject<{
|
|
17
|
+
login: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
login: string;
|
|
20
|
+
}, {
|
|
21
|
+
login: string;
|
|
22
|
+
}>;
|
|
23
|
+
export type Assignee = z.infer<typeof AssigneeSchema>;
|
|
24
|
+
export declare const RepositoryContextSchema: z.ZodObject<{
|
|
25
|
+
owner: z.ZodString;
|
|
26
|
+
repo: z.ZodString;
|
|
27
|
+
full_name: z.ZodString;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
owner: string;
|
|
30
|
+
repo: string;
|
|
31
|
+
full_name: string;
|
|
32
|
+
}, {
|
|
33
|
+
owner: string;
|
|
34
|
+
repo: string;
|
|
35
|
+
full_name: string;
|
|
36
|
+
}>;
|
|
37
|
+
export type RepositoryContext = z.infer<typeof RepositoryContextSchema>;
|
|
38
|
+
export declare const IssueSchema: z.ZodObject<{
|
|
39
|
+
number: z.ZodNumber;
|
|
40
|
+
title: z.ZodString;
|
|
41
|
+
body: z.ZodNullable<z.ZodString>;
|
|
42
|
+
state: z.ZodEnum<["open", "closed"]>;
|
|
43
|
+
created_at: z.ZodString;
|
|
44
|
+
updated_at: z.ZodString;
|
|
45
|
+
labels: z.ZodArray<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
color: z.ZodString;
|
|
48
|
+
description: z.ZodNullable<z.ZodString>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
name: string;
|
|
51
|
+
color: string;
|
|
52
|
+
description: string | null;
|
|
53
|
+
}, {
|
|
54
|
+
name: string;
|
|
55
|
+
color: string;
|
|
56
|
+
description: string | null;
|
|
57
|
+
}>, "many">;
|
|
58
|
+
assignees: z.ZodArray<z.ZodObject<{
|
|
59
|
+
login: z.ZodString;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
login: string;
|
|
62
|
+
}, {
|
|
63
|
+
login: string;
|
|
64
|
+
}>, "many">;
|
|
65
|
+
html_url: z.ZodString;
|
|
66
|
+
repository: z.ZodObject<{
|
|
67
|
+
owner: z.ZodString;
|
|
68
|
+
repo: z.ZodString;
|
|
69
|
+
full_name: z.ZodString;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
owner: string;
|
|
72
|
+
repo: string;
|
|
73
|
+
full_name: string;
|
|
74
|
+
}, {
|
|
75
|
+
owner: string;
|
|
76
|
+
repo: string;
|
|
77
|
+
full_name: string;
|
|
78
|
+
}>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
number: number;
|
|
81
|
+
title: string;
|
|
82
|
+
body: string | null;
|
|
83
|
+
state: "open" | "closed";
|
|
84
|
+
created_at: string;
|
|
85
|
+
updated_at: string;
|
|
86
|
+
labels: {
|
|
87
|
+
name: string;
|
|
88
|
+
color: string;
|
|
89
|
+
description: string | null;
|
|
90
|
+
}[];
|
|
91
|
+
assignees: {
|
|
92
|
+
login: string;
|
|
93
|
+
}[];
|
|
94
|
+
html_url: string;
|
|
95
|
+
repository: {
|
|
96
|
+
owner: string;
|
|
97
|
+
repo: string;
|
|
98
|
+
full_name: string;
|
|
99
|
+
};
|
|
100
|
+
}, {
|
|
101
|
+
number: number;
|
|
102
|
+
title: string;
|
|
103
|
+
body: string | null;
|
|
104
|
+
state: "open" | "closed";
|
|
105
|
+
created_at: string;
|
|
106
|
+
updated_at: string;
|
|
107
|
+
labels: {
|
|
108
|
+
name: string;
|
|
109
|
+
color: string;
|
|
110
|
+
description: string | null;
|
|
111
|
+
}[];
|
|
112
|
+
assignees: {
|
|
113
|
+
login: string;
|
|
114
|
+
}[];
|
|
115
|
+
html_url: string;
|
|
116
|
+
repository: {
|
|
117
|
+
owner: string;
|
|
118
|
+
repo: string;
|
|
119
|
+
full_name: string;
|
|
120
|
+
};
|
|
121
|
+
}>;
|
|
122
|
+
export type Issue = z.infer<typeof IssueSchema>;
|
|
123
|
+
export declare const PriorityLabelSchema: z.ZodEnum<["priority:critical", "priority:high", "priority:medium", "priority:low"]>;
|
|
124
|
+
export type PriorityLabel = z.infer<typeof PriorityLabelSchema>;
|
|
125
|
+
export declare const TypeLabelSchema: z.ZodEnum<["type:bug", "type:feature", "type:chore", "type:docs"]>;
|
|
126
|
+
export type TypeLabel = z.infer<typeof TypeLabelSchema>;
|
|
127
|
+
export declare const StatusLabelSchema: z.ZodEnum<["status:backlog", "status:in-progress", "status:in-review", "status:blocked"]>;
|
|
128
|
+
export type StatusLabel = z.infer<typeof StatusLabelSchema>;
|
|
129
|
+
export declare const IssueTypeSchema: z.ZodEnum<["bug", "feature", "chore", "docs"]>;
|
|
130
|
+
export type IssueType = z.infer<typeof IssueTypeSchema>;
|
|
131
|
+
export declare const IssuePrioritySchema: z.ZodEnum<["critical", "high", "medium", "low"]>;
|
|
132
|
+
export type IssuePriority = z.infer<typeof IssuePrioritySchema>;
|
|
133
|
+
export declare function getPriorityLabel(issue: Issue): PriorityLabel | null;
|
|
134
|
+
export declare function getTypeLabel(issue: Issue): TypeLabel | null;
|
|
135
|
+
export declare function getStatusLabel(issue: Issue): StatusLabel | null;
|
|
136
|
+
export declare function hasLabel(issue: Issue, labelName: string): boolean;
|
|
137
|
+
export declare const LABEL_DEFINITIONS: {
|
|
138
|
+
readonly priority: {
|
|
139
|
+
readonly 'priority:critical': {
|
|
140
|
+
readonly color: "b60205";
|
|
141
|
+
readonly description: "Production down, security vulnerability";
|
|
142
|
+
};
|
|
143
|
+
readonly 'priority:high': {
|
|
144
|
+
readonly color: "d93f0b";
|
|
145
|
+
readonly description: "Major feature blocked, significant impact";
|
|
146
|
+
};
|
|
147
|
+
readonly 'priority:medium': {
|
|
148
|
+
readonly color: "fbca04";
|
|
149
|
+
readonly description: "Normal feature work, non-blocking";
|
|
150
|
+
};
|
|
151
|
+
readonly 'priority:low': {
|
|
152
|
+
readonly color: "0e8a16";
|
|
153
|
+
readonly description: "Nice-to-have, minor improvements";
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
readonly type: {
|
|
157
|
+
readonly 'type:bug': {
|
|
158
|
+
readonly color: "d73a4a";
|
|
159
|
+
readonly description: "Defect in existing functionality";
|
|
160
|
+
};
|
|
161
|
+
readonly 'type:feature': {
|
|
162
|
+
readonly color: "a2eeef";
|
|
163
|
+
readonly description: "New capability or enhancement";
|
|
164
|
+
};
|
|
165
|
+
readonly 'type:chore': {
|
|
166
|
+
readonly color: "fef2c0";
|
|
167
|
+
readonly description: "Maintenance, refactoring, dependencies";
|
|
168
|
+
};
|
|
169
|
+
readonly 'type:docs': {
|
|
170
|
+
readonly color: "0075ca";
|
|
171
|
+
readonly description: "Documentation only changes";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
readonly status: {
|
|
175
|
+
readonly 'status:backlog': {
|
|
176
|
+
readonly color: "cfd3d7";
|
|
177
|
+
readonly description: "Not yet started";
|
|
178
|
+
};
|
|
179
|
+
readonly 'status:in-progress': {
|
|
180
|
+
readonly color: "0e8a16";
|
|
181
|
+
readonly description: "Actively being worked";
|
|
182
|
+
};
|
|
183
|
+
readonly 'status:in-review': {
|
|
184
|
+
readonly color: "fbca04";
|
|
185
|
+
readonly description: "PR open, awaiting review";
|
|
186
|
+
};
|
|
187
|
+
readonly 'status:blocked': {
|
|
188
|
+
readonly color: "b60205";
|
|
189
|
+
readonly description: "Cannot proceed, requires input";
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
//# sourceMappingURL=issue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/models/issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW;;;;;;;;;;;;EAItB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,cAAc;;;;;;EAEzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAIlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWtB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,mBAAmB,sFAK9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,eAAe,oEAAkE,CAAC;AAE/F,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,iBAAiB,2FAK5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,eAAe,gDAA8C,CAAC;AAC3E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,mBAAmB,kDAAgD,CAAC;AACjF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,CAKnE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAK3D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,IAAI,CAK/D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBpB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const LabelSchema = z.object({
|
|
3
|
+
name: z.string(),
|
|
4
|
+
color: z.string(),
|
|
5
|
+
description: z.string().nullable(),
|
|
6
|
+
});
|
|
7
|
+
export const AssigneeSchema = z.object({
|
|
8
|
+
login: z.string(),
|
|
9
|
+
});
|
|
10
|
+
export const RepositoryContextSchema = z.object({
|
|
11
|
+
owner: z.string(),
|
|
12
|
+
repo: z.string(),
|
|
13
|
+
full_name: z.string(),
|
|
14
|
+
});
|
|
15
|
+
export const IssueSchema = z.object({
|
|
16
|
+
number: z.number().int().positive(),
|
|
17
|
+
title: z.string(),
|
|
18
|
+
body: z.string().nullable(),
|
|
19
|
+
state: z.enum(['open', 'closed']),
|
|
20
|
+
created_at: z.string(),
|
|
21
|
+
updated_at: z.string(),
|
|
22
|
+
labels: z.array(LabelSchema),
|
|
23
|
+
assignees: z.array(AssigneeSchema),
|
|
24
|
+
html_url: z.string().url(),
|
|
25
|
+
repository: RepositoryContextSchema,
|
|
26
|
+
});
|
|
27
|
+
export const PriorityLabelSchema = z.enum([
|
|
28
|
+
'priority:critical',
|
|
29
|
+
'priority:high',
|
|
30
|
+
'priority:medium',
|
|
31
|
+
'priority:low',
|
|
32
|
+
]);
|
|
33
|
+
export const TypeLabelSchema = z.enum(['type:bug', 'type:feature', 'type:chore', 'type:docs']);
|
|
34
|
+
export const StatusLabelSchema = z.enum([
|
|
35
|
+
'status:backlog',
|
|
36
|
+
'status:in-progress',
|
|
37
|
+
'status:in-review',
|
|
38
|
+
'status:blocked',
|
|
39
|
+
]);
|
|
40
|
+
export const IssueTypeSchema = z.enum(['bug', 'feature', 'chore', 'docs']);
|
|
41
|
+
export const IssuePrioritySchema = z.enum(['critical', 'high', 'medium', 'low']);
|
|
42
|
+
export function getPriorityLabel(issue) {
|
|
43
|
+
const priorityLabel = issue.labels.find((l) => l.name.startsWith('priority:'));
|
|
44
|
+
if (!priorityLabel)
|
|
45
|
+
return null;
|
|
46
|
+
const result = PriorityLabelSchema.safeParse(priorityLabel.name);
|
|
47
|
+
return result.success ? result.data : null;
|
|
48
|
+
}
|
|
49
|
+
export function getTypeLabel(issue) {
|
|
50
|
+
const typeLabel = issue.labels.find((l) => l.name.startsWith('type:'));
|
|
51
|
+
if (!typeLabel)
|
|
52
|
+
return null;
|
|
53
|
+
const result = TypeLabelSchema.safeParse(typeLabel.name);
|
|
54
|
+
return result.success ? result.data : null;
|
|
55
|
+
}
|
|
56
|
+
export function getStatusLabel(issue) {
|
|
57
|
+
const statusLabel = issue.labels.find((l) => l.name.startsWith('status:'));
|
|
58
|
+
if (!statusLabel)
|
|
59
|
+
return null;
|
|
60
|
+
const result = StatusLabelSchema.safeParse(statusLabel.name);
|
|
61
|
+
return result.success ? result.data : null;
|
|
62
|
+
}
|
|
63
|
+
export function hasLabel(issue, labelName) {
|
|
64
|
+
return issue.labels.some((l) => l.name === labelName);
|
|
65
|
+
}
|
|
66
|
+
export const LABEL_DEFINITIONS = {
|
|
67
|
+
priority: {
|
|
68
|
+
'priority:critical': { color: 'b60205', description: 'Production down, security vulnerability' },
|
|
69
|
+
'priority:high': { color: 'd93f0b', description: 'Major feature blocked, significant impact' },
|
|
70
|
+
'priority:medium': { color: 'fbca04', description: 'Normal feature work, non-blocking' },
|
|
71
|
+
'priority:low': { color: '0e8a16', description: 'Nice-to-have, minor improvements' },
|
|
72
|
+
},
|
|
73
|
+
type: {
|
|
74
|
+
'type:bug': { color: 'd73a4a', description: 'Defect in existing functionality' },
|
|
75
|
+
'type:feature': { color: 'a2eeef', description: 'New capability or enhancement' },
|
|
76
|
+
'type:chore': { color: 'fef2c0', description: 'Maintenance, refactoring, dependencies' },
|
|
77
|
+
'type:docs': { color: '0075ca', description: 'Documentation only changes' },
|
|
78
|
+
},
|
|
79
|
+
status: {
|
|
80
|
+
'status:backlog': { color: 'cfd3d7', description: 'Not yet started' },
|
|
81
|
+
'status:in-progress': { color: '0e8a16', description: 'Actively being worked' },
|
|
82
|
+
'status:in-review': { color: 'fbca04', description: 'PR open, awaiting review' },
|
|
83
|
+
'status:blocked': { color: 'b60205', description: 'Cannot proceed, requires input' },
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue.js","sourceRoot":"","sources":["../../src/models/issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,CAAC,CA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E,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE;QACxF,WAAW,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;KAC5E;IACD,MAAM,EAAE;QACN,gBAAgB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE;QACrE,oBAAoB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE;QAC/E,kBAAkB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAChF,gBAAgB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,gCAAgC,EAAE;KACrF;CACO,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const LockSchema: z.ZodObject<{
|
|
3
|
+
issueNumber: z.ZodNumber;
|
|
4
|
+
repoFullName: z.ZodString;
|
|
5
|
+
pid: z.ZodNumber;
|
|
6
|
+
sessionId: z.ZodString;
|
|
7
|
+
acquiredAt: z.ZodString;
|
|
8
|
+
lastUpdated: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
issueNumber: number;
|
|
11
|
+
repoFullName: string;
|
|
12
|
+
pid: number;
|
|
13
|
+
sessionId: string;
|
|
14
|
+
acquiredAt: string;
|
|
15
|
+
lastUpdated: string;
|
|
16
|
+
}, {
|
|
17
|
+
issueNumber: number;
|
|
18
|
+
repoFullName: string;
|
|
19
|
+
pid: number;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
acquiredAt: string;
|
|
22
|
+
lastUpdated: string;
|
|
23
|
+
}>;
|
|
24
|
+
export type Lock = z.infer<typeof LockSchema>;
|
|
25
|
+
export declare function createLock(issueNumber: number, repoFullName: string, sessionId: string, pid?: number): Lock;
|
|
26
|
+
export declare function getLockFileName(owner: string, repo: string, issueNumber: number): string;
|
|
27
|
+
export declare function parseLockFileName(fileName: string): {
|
|
28
|
+
owner: string;
|
|
29
|
+
repo: string;
|
|
30
|
+
issueNumber: number;
|
|
31
|
+
} | null;
|
|
32
|
+
export declare function validateLock(data: unknown): Lock | null;
|
|
33
|
+
export declare function isProcessAlive(pid: number): Promise<boolean>;
|
|
34
|
+
export declare const LOCK_STALE_TIMEOUT_MS: number;
|
|
35
|
+
//# sourceMappingURL=lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../src/models/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;EAOrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,wBAAgB,UAAU,CACxB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,MAAoB,GACxB,IAAI,CAUN;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAExF;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,GACf;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQ7D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAGvD;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOlE;AAED,eAAO,MAAM,qBAAqB,QAAiB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const LockSchema = z.object({
|
|
3
|
+
issueNumber: z.number().int().positive(),
|
|
4
|
+
repoFullName: z.string().regex(/^[^/]+\/[^/]+$/),
|
|
5
|
+
pid: z.number().int().positive(),
|
|
6
|
+
sessionId: z.string().uuid(),
|
|
7
|
+
acquiredAt: z.string().datetime(),
|
|
8
|
+
lastUpdated: z.string().datetime(),
|
|
9
|
+
});
|
|
10
|
+
export function createLock(issueNumber, repoFullName, sessionId, pid = process.pid) {
|
|
11
|
+
const now = new Date().toISOString();
|
|
12
|
+
return {
|
|
13
|
+
issueNumber,
|
|
14
|
+
repoFullName,
|
|
15
|
+
pid,
|
|
16
|
+
sessionId,
|
|
17
|
+
acquiredAt: now,
|
|
18
|
+
lastUpdated: now,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function getLockFileName(owner, repo, issueNumber) {
|
|
22
|
+
return `${owner}_${repo}_${issueNumber}.lockdata`;
|
|
23
|
+
}
|
|
24
|
+
export function parseLockFileName(fileName) {
|
|
25
|
+
const match = fileName.match(/^([^_]+)_([^_]+)_(\d+)\.lockdata$/);
|
|
26
|
+
if (!match)
|
|
27
|
+
return null;
|
|
28
|
+
return {
|
|
29
|
+
owner: match[1],
|
|
30
|
+
repo: match[2],
|
|
31
|
+
issueNumber: parseInt(match[3], 10),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function validateLock(data) {
|
|
35
|
+
const result = LockSchema.safeParse(data);
|
|
36
|
+
return result.success ? result.data : null;
|
|
37
|
+
}
|
|
38
|
+
export async function isProcessAlive(pid) {
|
|
39
|
+
try {
|
|
40
|
+
process.kill(pid, 0);
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return err.code === 'EPERM';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export const LOCK_STALE_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes
|
|
48
|
+
//# sourceMappingURL=lock.js.map
|
|
@@ -0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