@smwb/onreel-git-mcp 0.3.0 → 0.5.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/README.md +222 -1
- package/dist/{chunk-L7CPE2SO.js → chunk-AGGJK2XZ.js} +2 -1
- package/dist/{chunk-GPRMI4PG.js → chunk-ZTME4HFD.js} +2 -2
- package/dist/git/index.js +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +3 -3
- package/dist/tracker/ci.lib.d.ts +36 -0
- package/dist/tracker/ci.schema.d.ts +162 -0
- package/dist/tracker/ci.types.d.ts +117 -0
- package/dist/tracker/github-ci.lib.d.ts +2 -0
- package/dist/tracker/github-pull.lib.d.ts +2 -0
- package/dist/tracker/gitlab-ci.lib.d.ts +2 -0
- package/dist/tracker/gitlab-pull.lib.d.ts +2 -0
- package/dist/tracker/http.lib.d.ts +9 -1
- package/dist/tracker/index.d.ts +12 -0
- package/dist/tracker/index.js +1986 -90
- package/dist/tracker/index.js.map +1 -1
- package/dist/tracker/mapping.const.d.ts +24 -0
- package/dist/tracker/pull.lib.d.ts +4 -0
- package/dist/tracker/pull.schema.d.ts +63 -0
- package/dist/tracker/pull.types.d.ts +74 -0
- package/dist/tracker/sourcecraft-ci.lib.d.ts +2 -0
- package/dist/tracker/sourcecraft-pull.lib.d.ts +2 -0
- package/dist/tracker/tracker.const.d.ts +12 -0
- package/dist/tracker/tracker.types.d.ts +37 -0
- package/dist/worktree/index.js +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-L7CPE2SO.js.map → chunk-AGGJK2XZ.js.map} +0 -0
- /package/dist/{chunk-GPRMI4PG.js.map → chunk-ZTME4HFD.js.map} +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { IssuePriority, IssueStatusCategory } from '../contract/contract.types.ts';
|
|
2
|
+
import type { CiEventCategory, CiStatusCategory } from './ci.schema.ts';
|
|
3
|
+
import type { PullRequestStatusCategory } from './pull.schema.ts';
|
|
2
4
|
/** SourceCraft: системные статусы. На паузе — ещё не закончено, но и не в работе: `open`. */
|
|
3
5
|
export declare const SOURCECRAFT_STATUSES: Readonly<Record<string, IssueStatusCategory>>;
|
|
4
6
|
/** Категория → слаг статуса SourceCraft при переводе задачи. */
|
|
@@ -26,3 +28,25 @@ export declare const GITHUB_IN_PROGRESS_LABEL = "in progress";
|
|
|
26
28
|
/** Метки GitHub для приоритета: `priority: <имя>`. */
|
|
27
29
|
export declare const GITHUB_PRIORITY_LABELS: Readonly<Record<string, IssuePriority>>;
|
|
28
30
|
export declare const ALL_STATUSES: readonly IssueStatusCategory[];
|
|
31
|
+
/** GitLab: state MR → категория; черновик — поле draft открытого MR. locked — слияние идёт, MR ещё открыт. */
|
|
32
|
+
export declare const GITLAB_MERGE_REQUEST_STATES: Readonly<Record<string, PullRequestStatusCategory>>;
|
|
33
|
+
/** GitLab: префикс заголовка, которым адаптер делает MR черновиком. */
|
|
34
|
+
export declare const GITLAB_DRAFT_PREFIX = "Draft: ";
|
|
35
|
+
/** GitLab: все формы префикса черновика, которые снимаются при переводе в open. */
|
|
36
|
+
export declare const GITLAB_DRAFT_PATTERN: RegExp;
|
|
37
|
+
/** SourceCraft: состояния PR. merging — слияние идёт, PR ещё открыт; discarded — закрыт без слияния. */
|
|
38
|
+
export declare const SOURCECRAFT_PULL_STATUSES: Readonly<Record<string, PullRequestStatusCategory>>;
|
|
39
|
+
/** GitHub: status прогона, задания и шага, пока не completed. */
|
|
40
|
+
export declare const GITHUB_RUN_STATUSES: Readonly<Record<string, CiStatusCategory>>;
|
|
41
|
+
/** GitHub: conclusion при status completed; не найдено — failed. */
|
|
42
|
+
export declare const GITHUB_RUN_CONCLUSIONS: Readonly<Record<string, CiStatusCategory>>;
|
|
43
|
+
/** GitHub: event прогона; не найдено — other. */
|
|
44
|
+
export declare const GITHUB_RUN_EVENTS: Readonly<Record<string, CiEventCategory>>;
|
|
45
|
+
/** GitLab: status пайплайна и задания; canceling — ещё не закончено. */
|
|
46
|
+
export declare const GITLAB_CI_STATUSES: Readonly<Record<string, CiStatusCategory>>;
|
|
47
|
+
/** GitLab: source пайплайна; не найдено — other. */
|
|
48
|
+
export declare const GITLAB_PIPELINE_SOURCES: Readonly<Record<string, CiEventCategory>>;
|
|
49
|
+
/** SourceCraft: status прогона, workflow, задачи и куба. */
|
|
50
|
+
export declare const SOURCECRAFT_CI_STATUSES: Readonly<Record<string, CiStatusCategory>>;
|
|
51
|
+
/** SourceCraft: event_type прогона. */
|
|
52
|
+
export declare const SOURCECRAFT_RUN_EVENTS: Readonly<Record<string, CiEventCategory>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PullRequestAdapter } from './pull.types.ts';
|
|
2
|
+
import type { AdapterContext, TrackerDefinition } from './tracker.types.ts';
|
|
3
|
+
/** Адаптер PR трекера (D-005); трекер без раздела pulls — TrackerError('unsupported', 'Трекер <title> не ведёт pull request-ы.'). */
|
|
4
|
+
export declare function pullRequestAdapterOf(definition: TrackerDefinition, context: AdapterContext): PullRequestAdapter;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Категория состояния PR единой модели (D-005); своё имя трекер отдаёт в status.name. */
|
|
3
|
+
export declare const pullRequestStatusCategorySchema: z.ZodEnum<{
|
|
4
|
+
closed: "closed";
|
|
5
|
+
draft: "draft";
|
|
6
|
+
merged: "merged";
|
|
7
|
+
open: "open";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const pullRequestFilterSchema: z.ZodEnum<{
|
|
10
|
+
author: "author";
|
|
11
|
+
createdAfter: "createdAfter";
|
|
12
|
+
createdBefore: "createdBefore";
|
|
13
|
+
labels: "labels";
|
|
14
|
+
search: "search";
|
|
15
|
+
source: "source";
|
|
16
|
+
status: "status";
|
|
17
|
+
target: "target";
|
|
18
|
+
updatedAfter: "updatedAfter";
|
|
19
|
+
updatedBefore: "updatedBefore";
|
|
20
|
+
}>;
|
|
21
|
+
export declare const pullRequestSortFieldSchema: z.ZodEnum<{
|
|
22
|
+
created: "created";
|
|
23
|
+
title: "title";
|
|
24
|
+
updated: "updated";
|
|
25
|
+
}>;
|
|
26
|
+
export declare const mergeMethodSchema: z.ZodEnum<{
|
|
27
|
+
merge: "merge";
|
|
28
|
+
rebase: "rebase";
|
|
29
|
+
squash: "squash";
|
|
30
|
+
}>;
|
|
31
|
+
export declare const pullRequestSchema: z.ZodObject<{
|
|
32
|
+
key: z.ZodString;
|
|
33
|
+
title: z.ZodString;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
35
|
+
status: z.ZodObject<{
|
|
36
|
+
category: z.ZodEnum<{
|
|
37
|
+
closed: "closed";
|
|
38
|
+
draft: "draft";
|
|
39
|
+
merged: "merged";
|
|
40
|
+
open: "open";
|
|
41
|
+
}>;
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
author: z.ZodOptional<z.ZodString>;
|
|
45
|
+
source: z.ZodString;
|
|
46
|
+
target: z.ZodString;
|
|
47
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
48
|
+
labels: z.ZodArray<z.ZodString>;
|
|
49
|
+
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
links: z.ZodArray<z.ZodObject<{
|
|
51
|
+
url: z.ZodString;
|
|
52
|
+
title: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
mergedAt: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
closedAt: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type PullRequestStatusCategory = z.infer<typeof pullRequestStatusCategorySchema>;
|
|
60
|
+
export type PullRequestFilter = z.infer<typeof pullRequestFilterSchema>;
|
|
61
|
+
export type PullRequestSortField = z.infer<typeof pullRequestSortFieldSchema>;
|
|
62
|
+
export type MergeMethod = z.infer<typeof mergeMethodSchema>;
|
|
63
|
+
export type PullRequest = z.infer<typeof pullRequestSchema>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IssueComment } from '../contract/contract.types.ts';
|
|
2
|
+
import type { MergeMethod, PullRequest, PullRequestFilter, PullRequestSortField, PullRequestStatusCategory } from './pull.schema.ts';
|
|
3
|
+
import type { AdapterContext, CommentCapabilities, CommentQuery, ListCapabilities, ListSort, PageQuery, TrackerPage } from './tracker.types.ts';
|
|
4
|
+
export type PullRequestQuery = PageQuery & {
|
|
5
|
+
status?: readonly PullRequestStatusCategory[] | undefined;
|
|
6
|
+
author?: string | undefined;
|
|
7
|
+
/** Ветка-источник и целевая ветка — имя без refs/heads/. */
|
|
8
|
+
source?: string | undefined;
|
|
9
|
+
target?: string | undefined;
|
|
10
|
+
labels?: readonly string[] | undefined;
|
|
11
|
+
search?: string | undefined;
|
|
12
|
+
createdAfter?: number | undefined;
|
|
13
|
+
createdBefore?: number | undefined;
|
|
14
|
+
updatedAfter?: number | undefined;
|
|
15
|
+
updatedBefore?: number | undefined;
|
|
16
|
+
sort?: ListSort<PullRequestSortField> | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type NewPullRequestInput = {
|
|
19
|
+
title: string;
|
|
20
|
+
source: string;
|
|
21
|
+
target: string;
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
/** Черновиком; по умолчанию — открытый PR. */
|
|
24
|
+
draft?: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type PullRequestPatchInput = {
|
|
27
|
+
title?: string | undefined;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
target?: string | undefined;
|
|
30
|
+
/** open — переоткрыть или снять черновик, draft — в черновик, closed — закрыть без слияния; merged — только merge(). */
|
|
31
|
+
status?: Exclude<PullRequestStatusCategory, 'merged'> | undefined;
|
|
32
|
+
};
|
|
33
|
+
export type MergeInput = {
|
|
34
|
+
/** Нет — способ по настройке репозитория; GitHub без неё шлёт merge, GitLab при 'merge' применяет squash-настройку MR/проекта. */
|
|
35
|
+
method?: MergeMethod | undefined;
|
|
36
|
+
/** Голова источника, которую видел вызывающий: другая — отказ conflict. GitHub и GitLab сверяют её сервером
|
|
37
|
+
* (атомарно, нужен полный sha); у SourceCraft сверка на клиенте — лучшее старание, push между чтением и
|
|
38
|
+
* слиянием ей не отсекается; штатный sha — полный, в нижнем регистре. */
|
|
39
|
+
headSha?: string | undefined;
|
|
40
|
+
/** Сообщение коммита слияния; первая строка — заголовок. */
|
|
41
|
+
message?: string | undefined;
|
|
42
|
+
/** Удалить ветку-источник после слияния. */
|
|
43
|
+
deleteSource?: boolean | undefined;
|
|
44
|
+
};
|
|
45
|
+
export type PullRequestAdapter = {
|
|
46
|
+
list(query: PullRequestQuery): Promise<TrackerPage<PullRequest>>;
|
|
47
|
+
get(key: string): Promise<PullRequest>;
|
|
48
|
+
create(input: NewPullRequestInput): Promise<PullRequest>;
|
|
49
|
+
update(key: string, patch: PullRequestPatchInput): Promise<PullRequest>;
|
|
50
|
+
/** Слияние; у SourceCraft асинхронное — вернётся PR с категорией open (status.name 'open' или 'merging') до
|
|
51
|
+
* завершения операции, либо уже merged; операция, отклонённая трекером (failed/cancel), — отказ conflict. */
|
|
52
|
+
merge(key: string, input: MergeInput): Promise<PullRequest>;
|
|
53
|
+
comments(key: string, query: CommentQuery): Promise<TrackerPage<IssueComment>>;
|
|
54
|
+
comment(key: string, body: string): Promise<IssueComment>;
|
|
55
|
+
};
|
|
56
|
+
export type PullRequestCapabilities = {
|
|
57
|
+
list: ListCapabilities<PullRequestFilter, PullRequestSortField>;
|
|
58
|
+
comments: CommentCapabilities;
|
|
59
|
+
create: boolean;
|
|
60
|
+
createDraft: boolean;
|
|
61
|
+
/** Поля, которые меняет update. */
|
|
62
|
+
update: readonly ('title' | 'description' | 'target')[];
|
|
63
|
+
/** Категории, в которые переводит update({ status }). */
|
|
64
|
+
statuses: readonly Exclude<PullRequestStatusCategory, 'merged'>[];
|
|
65
|
+
comment: boolean;
|
|
66
|
+
/** Способы слияния; пусто — merge не поддерживается. */
|
|
67
|
+
merge: readonly MergeMethod[];
|
|
68
|
+
deleteSourceOnMerge: boolean;
|
|
69
|
+
};
|
|
70
|
+
/** Раздел pulls определения трекера (D-005): на том же подключении, что и задачи. */
|
|
71
|
+
export type PullRequestDefinition = {
|
|
72
|
+
capabilities: PullRequestCapabilities;
|
|
73
|
+
create(context: AdapterContext): PullRequestAdapter;
|
|
74
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CiStatusCategory } from './ci.schema.ts';
|
|
1
2
|
import type { IssueCapabilities } from './tracker.types.ts';
|
|
2
3
|
/** Потолок ожидания ответа внешнего трекера, мс. */
|
|
3
4
|
export declare const TRACKER_TIMEOUT_MS = 15000;
|
|
@@ -20,3 +21,14 @@ export declare const COMMENT_FILTERS: readonly ['updatedAfter'];
|
|
|
20
21
|
export type CommentFilter = (typeof COMMENT_FILTERS)[number];
|
|
21
22
|
/** Возможности трекера без раздела issues (свои трекеры потребителя): статус и страницы, комментарии по порядку. */
|
|
22
23
|
export declare const LEGACY_ISSUE_CAPABILITIES: IssueCapabilities;
|
|
24
|
+
/** Окно лога CI по умолчанию и потолок окна одного вызова, байт (D-006). */
|
|
25
|
+
export declare const CI_LOG_DEFAULT_BYTES: number;
|
|
26
|
+
export declare const CI_LOG_MAX_BYTES: number;
|
|
27
|
+
/** Потолок чтения тела лога: дальше поток обрывается, лог — truncated. */
|
|
28
|
+
export declare const CI_LOG_READ_MAX_BYTES: number;
|
|
29
|
+
/** Таймаут загрузки лога, мс: логи больше ответов API. */
|
|
30
|
+
export declare const CI_LOG_TIMEOUT_MS = 60000;
|
|
31
|
+
/** Сколько страниц лога SourceCraft читается за один вызов log(). */
|
|
32
|
+
export declare const CI_LOG_PAGES_MAX = 50;
|
|
33
|
+
/** Законченные категории CI. */
|
|
34
|
+
export declare const CI_FINISHED_STATUSES: readonly CiStatusCategory[];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Issue, IssueComment, IssuePriority, IssueStatusCategory, TrackerDescriptor } from '../contract/contract.types.ts';
|
|
2
2
|
import type { LocalIssueStore } from '../kernel/store.types.ts';
|
|
3
|
+
import type { CiDefinition } from './ci.types.ts';
|
|
4
|
+
import type { PullRequestDefinition } from './pull.types.ts';
|
|
3
5
|
import type { CommentFilter, IssueFilter, IssueSortField } from './tracker.const.ts';
|
|
4
6
|
export type TrackerFetch = (input: string, init?: {
|
|
5
7
|
method?: string;
|
|
@@ -113,6 +115,10 @@ export type TrackerDefinition = {
|
|
|
113
115
|
create(context: AdapterContext): TrackerAdapter;
|
|
114
116
|
/** Фильтры и сортировка задач и комментариев; нет — LEGACY_ISSUE_CAPABILITIES. */
|
|
115
117
|
issues?: IssueCapabilities | undefined;
|
|
118
|
+
/** Pull request-ы на том же подключении (D-005); нет — трекер их не ведёт. */
|
|
119
|
+
pulls?: PullRequestDefinition | undefined;
|
|
120
|
+
/** CI трекера на том же подключении (D-005); нет — ciAdapterOf отказывает unsupported. */
|
|
121
|
+
ci?: CiDefinition | undefined;
|
|
116
122
|
};
|
|
117
123
|
export type TrackerFailure = 'failed' | 'unknown_issue' | 'invalid_request' | 'not_found' | 'unsupported' | 'conflict' | 'rate_limited';
|
|
118
124
|
export type JsonRequest = {
|
|
@@ -134,3 +140,34 @@ export type JsonResponse = {
|
|
|
134
140
|
body: unknown;
|
|
135
141
|
headers: Headers;
|
|
136
142
|
};
|
|
143
|
+
/** Запрос текста (лог CI): тело читается потоком, в памяти — только окно keep. */
|
|
144
|
+
export type TextRequest = {
|
|
145
|
+
fetch: TrackerFetch;
|
|
146
|
+
headers?: Record<string, string> | undefined;
|
|
147
|
+
/** Заголовок accept; по умолчанию text/plain. */
|
|
148
|
+
accept?: string | undefined;
|
|
149
|
+
/** Пропустить столько байт тела от начала (дочитывание по курсору). */
|
|
150
|
+
skip?: number | undefined;
|
|
151
|
+
/** Сколько байт держать и с какой стороны тела после skip: head — первые, tail — последние (кольцевой буфер). */
|
|
152
|
+
keep: {
|
|
153
|
+
bytes: number;
|
|
154
|
+
from: 'head' | 'tail';
|
|
155
|
+
};
|
|
156
|
+
/** Потолок чтения тела; по умолчанию CI_LOG_READ_MAX_BYTES. */
|
|
157
|
+
readMax?: number | undefined;
|
|
158
|
+
missing?: JsonRequest['missing'];
|
|
159
|
+
/** По умолчанию CI_LOG_TIMEOUT_MS. */
|
|
160
|
+
timeoutMs?: number | undefined;
|
|
161
|
+
};
|
|
162
|
+
export type TextResponse = {
|
|
163
|
+
/** Окно в UTF-8, границы сдвинуты к целым символам. */
|
|
164
|
+
text: string;
|
|
165
|
+
/** Смещение первого и за последним байтом окна от начала тела. */
|
|
166
|
+
start: number;
|
|
167
|
+
end: number;
|
|
168
|
+
/** Сколько байт тела прочитано. */
|
|
169
|
+
read: number;
|
|
170
|
+
/** Тело прочитано до конца (не оборвали по head и не упёрлись в readMax). */
|
|
171
|
+
whole: boolean;
|
|
172
|
+
headers: Headers;
|
|
173
|
+
};
|
package/dist/worktree/index.js
CHANGED
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
isDirty,
|
|
7
7
|
isGitPoolClosed,
|
|
8
8
|
pruneWorktrees
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-ZTME4HFD.js";
|
|
10
10
|
import {
|
|
11
11
|
checkManagedPath,
|
|
12
12
|
prepareWorktreeParent,
|
|
13
13
|
trashRoot
|
|
14
14
|
} from "../chunk-C6PHNSDC.js";
|
|
15
15
|
import "../chunk-3YP22YLA.js";
|
|
16
|
+
import "../chunk-AGGJK2XZ.js";
|
|
16
17
|
import "../chunk-4ZGRXIVA.js";
|
|
17
|
-
import "../chunk-L7CPE2SO.js";
|
|
18
18
|
|
|
19
19
|
// src/worktree/lifecycle.const.ts
|
|
20
20
|
var WORKTREE_RECONCILE_INTERVAL_MS = 3e4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smwb/onreel-git-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Библиотека модулей, выделенных из onreel: git-операции и безопасные пути, список файлов worktree, жизненный цикл worktree против порта WorktreeStore, адаптеры трекеров GitHub/GitLab/Jira/SourceCraft/локального и MCP-сервер на stdio",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git",
|
|
File without changes
|
|
File without changes
|