chief-clancy 0.7.0 → 0.7.1
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 +1 -1
- package/dist/bundle/clancy-once.js +50 -50
- package/package.json +5 -2
- package/src/templates/.env.example.github +19 -1
- package/src/templates/.env.example.jira +25 -1
- package/src/templates/.env.example.linear +19 -1
- package/dist/schemas/bitbucket-pr.d.ts +0 -137
- package/dist/schemas/bitbucket-pr.d.ts.map +0 -1
- package/dist/schemas/bitbucket-pr.js +0 -75
- package/dist/schemas/bitbucket-pr.js.map +0 -1
- package/dist/schemas/env.d.ts +0 -170
- package/dist/schemas/env.d.ts.map +0 -1
- package/dist/schemas/env.js +0 -69
- package/dist/schemas/env.js.map +0 -1
- package/dist/schemas/github-issues.d.ts +0 -105
- package/dist/schemas/github-issues.d.ts.map +0 -1
- package/dist/schemas/github-issues.js +0 -54
- package/dist/schemas/github-issues.js.map +0 -1
- package/dist/schemas/gitlab-mr.d.ts +0 -73
- package/dist/schemas/gitlab-mr.d.ts.map +0 -1
- package/dist/schemas/gitlab-mr.js +0 -33
- package/dist/schemas/gitlab-mr.js.map +0 -1
- package/dist/schemas/jira.d.ts +0 -59
- package/dist/schemas/jira.d.ts.map +0 -1
- package/dist/schemas/jira.js +0 -56
- package/dist/schemas/jira.js.map +0 -1
- package/dist/schemas/linear.d.ts +0 -108
- package/dist/schemas/linear.d.ts.map +0 -1
- package/dist/schemas/linear.js +0 -84
- package/dist/schemas/linear.js.map +0 -1
- package/dist/scripts/afk/afk.d.ts +0 -21
- package/dist/scripts/afk/afk.d.ts.map +0 -1
- package/dist/scripts/afk/afk.js +0 -145
- package/dist/scripts/afk/afk.js.map +0 -1
- package/dist/scripts/afk/report/report.d.ts +0 -47
- package/dist/scripts/afk/report/report.d.ts.map +0 -1
- package/dist/scripts/afk/report/report.js +0 -194
- package/dist/scripts/afk/report/report.js.map +0 -1
- package/dist/scripts/board/github/github.d.ts +0 -104
- package/dist/scripts/board/github/github.d.ts.map +0 -1
- package/dist/scripts/board/github/github.js +0 -291
- package/dist/scripts/board/github/github.js.map +0 -1
- package/dist/scripts/board/jira/jira.d.ts +0 -139
- package/dist/scripts/board/jira/jira.d.ts.map +0 -1
- package/dist/scripts/board/jira/jira.js +0 -378
- package/dist/scripts/board/jira/jira.js.map +0 -1
- package/dist/scripts/board/linear/linear.d.ts +0 -129
- package/dist/scripts/board/linear/linear.d.ts.map +0 -1
- package/dist/scripts/board/linear/linear.js +0 -393
- package/dist/scripts/board/linear/linear.js.map +0 -1
- package/dist/scripts/once/board-ops/board-ops.d.ts +0 -26
- package/dist/scripts/once/board-ops/board-ops.d.ts.map +0 -1
- package/dist/scripts/once/board-ops/board-ops.js +0 -113
- package/dist/scripts/once/board-ops/board-ops.js.map +0 -1
- package/dist/scripts/once/cost/cost.d.ts +0 -10
- package/dist/scripts/once/cost/cost.d.ts.map +0 -1
- package/dist/scripts/once/cost/cost.js +0 -23
- package/dist/scripts/once/cost/cost.js.map +0 -1
- package/dist/scripts/once/deliver/deliver.d.ts +0 -37
- package/dist/scripts/once/deliver/deliver.d.ts.map +0 -1
- package/dist/scripts/once/deliver/deliver.js +0 -253
- package/dist/scripts/once/deliver/deliver.js.map +0 -1
- package/dist/scripts/once/fetch-ticket/fetch-ticket.d.ts +0 -22
- package/dist/scripts/once/fetch-ticket/fetch-ticket.d.ts.map +0 -1
- package/dist/scripts/once/fetch-ticket/fetch-ticket.js +0 -123
- package/dist/scripts/once/fetch-ticket/fetch-ticket.js.map +0 -1
- package/dist/scripts/once/git-token/git-token.d.ts +0 -13
- package/dist/scripts/once/git-token/git-token.d.ts.map +0 -1
- package/dist/scripts/once/git-token/git-token.js +0 -30
- package/dist/scripts/once/git-token/git-token.js.map +0 -1
- package/dist/scripts/once/lock/lock.d.ts +0 -17
- package/dist/scripts/once/lock/lock.d.ts.map +0 -1
- package/dist/scripts/once/lock/lock.js +0 -70
- package/dist/scripts/once/lock/lock.js.map +0 -1
- package/dist/scripts/once/once.d.ts +0 -12
- package/dist/scripts/once/once.d.ts.map +0 -1
- package/dist/scripts/once/once.js +0 -452
- package/dist/scripts/once/once.js.map +0 -1
- package/dist/scripts/once/pr-creation/pr-creation.d.ts +0 -11
- package/dist/scripts/once/pr-creation/pr-creation.d.ts.map +0 -1
- package/dist/scripts/once/pr-creation/pr-creation.js +0 -50
- package/dist/scripts/once/pr-creation/pr-creation.js.map +0 -1
- package/dist/scripts/once/resume/resume.d.ts +0 -24
- package/dist/scripts/once/resume/resume.d.ts.map +0 -1
- package/dist/scripts/once/resume/resume.js +0 -159
- package/dist/scripts/once/resume/resume.js.map +0 -1
- package/dist/scripts/once/rework/rework.d.ts +0 -32
- package/dist/scripts/once/rework/rework.d.ts.map +0 -1
- package/dist/scripts/once/rework/rework.js +0 -208
- package/dist/scripts/once/rework/rework.js.map +0 -1
- package/dist/scripts/once/types/types.d.ts +0 -13
- package/dist/scripts/once/types/types.d.ts.map +0 -1
- package/dist/scripts/once/types/types.js +0 -2
- package/dist/scripts/once/types/types.js.map +0 -1
- package/dist/scripts/shared/branch/branch.d.ts +0 -50
- package/dist/scripts/shared/branch/branch.d.ts.map +0 -1
- package/dist/scripts/shared/branch/branch.js +0 -61
- package/dist/scripts/shared/branch/branch.js.map +0 -1
- package/dist/scripts/shared/claude-cli/claude-cli.d.ts +0 -31
- package/dist/scripts/shared/claude-cli/claude-cli.d.ts.map +0 -1
- package/dist/scripts/shared/claude-cli/claude-cli.js +0 -60
- package/dist/scripts/shared/claude-cli/claude-cli.js.map +0 -1
- package/dist/scripts/shared/env-schema/env-schema.d.ts +0 -27
- package/dist/scripts/shared/env-schema/env-schema.d.ts.map +0 -1
- package/dist/scripts/shared/env-schema/env-schema.js +0 -47
- package/dist/scripts/shared/env-schema/env-schema.js.map +0 -1
- package/dist/scripts/shared/feasibility/feasibility.d.ts +0 -30
- package/dist/scripts/shared/feasibility/feasibility.d.ts.map +0 -1
- package/dist/scripts/shared/feasibility/feasibility.js +0 -68
- package/dist/scripts/shared/feasibility/feasibility.js.map +0 -1
- package/dist/scripts/shared/format/format.d.ts +0 -11
- package/dist/scripts/shared/format/format.d.ts.map +0 -1
- package/dist/scripts/shared/format/format.js +0 -23
- package/dist/scripts/shared/format/format.js.map +0 -1
- package/dist/scripts/shared/git-ops/git-ops.d.ts +0 -90
- package/dist/scripts/shared/git-ops/git-ops.d.ts.map +0 -1
- package/dist/scripts/shared/git-ops/git-ops.js +0 -190
- package/dist/scripts/shared/git-ops/git-ops.js.map +0 -1
- package/dist/scripts/shared/http/http.d.ts +0 -54
- package/dist/scripts/shared/http/http.d.ts.map +0 -1
- package/dist/scripts/shared/http/http.js +0 -76
- package/dist/scripts/shared/http/http.js.map +0 -1
- package/dist/scripts/shared/notify/notify.d.ts +0 -46
- package/dist/scripts/shared/notify/notify.d.ts.map +0 -1
- package/dist/scripts/shared/notify/notify.js +0 -88
- package/dist/scripts/shared/notify/notify.js.map +0 -1
- package/dist/scripts/shared/preflight/preflight.d.ts +0 -40
- package/dist/scripts/shared/preflight/preflight.d.ts.map +0 -1
- package/dist/scripts/shared/preflight/preflight.js +0 -96
- package/dist/scripts/shared/preflight/preflight.js.map +0 -1
- package/dist/scripts/shared/progress/progress.d.ts +0 -88
- package/dist/scripts/shared/progress/progress.d.ts.map +0 -1
- package/dist/scripts/shared/progress/progress.js +0 -210
- package/dist/scripts/shared/progress/progress.js.map +0 -1
- package/dist/scripts/shared/prompt/prompt.d.ts +0 -58
- package/dist/scripts/shared/prompt/prompt.d.ts.map +0 -1
- package/dist/scripts/shared/prompt/prompt.js +0 -123
- package/dist/scripts/shared/prompt/prompt.js.map +0 -1
- package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts +0 -82
- package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts.map +0 -1
- package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js +0 -301
- package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js.map +0 -1
- package/dist/scripts/shared/pull-request/github/github.d.ts +0 -72
- package/dist/scripts/shared/pull-request/github/github.d.ts.map +0 -1
- package/dist/scripts/shared/pull-request/github/github.js +0 -226
- package/dist/scripts/shared/pull-request/github/github.js.map +0 -1
- package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts +0 -74
- package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts.map +0 -1
- package/dist/scripts/shared/pull-request/gitlab/gitlab.js +0 -220
- package/dist/scripts/shared/pull-request/gitlab/gitlab.js.map +0 -1
- package/dist/scripts/shared/pull-request/post-pr/post-pr.d.ts +0 -31
- package/dist/scripts/shared/pull-request/post-pr/post-pr.d.ts.map +0 -1
- package/dist/scripts/shared/pull-request/post-pr/post-pr.js +0 -61
- package/dist/scripts/shared/pull-request/post-pr/post-pr.js.map +0 -1
- package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts +0 -41
- package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts.map +0 -1
- package/dist/scripts/shared/pull-request/pr-body/pr-body.js +0 -93
- package/dist/scripts/shared/pull-request/pr-body/pr-body.js.map +0 -1
- package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts +0 -23
- package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts.map +0 -1
- package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js +0 -30
- package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js.map +0 -1
- package/dist/scripts/shared/remote/remote.d.ts +0 -41
- package/dist/scripts/shared/remote/remote.d.ts.map +0 -1
- package/dist/scripts/shared/remote/remote.js +0 -227
- package/dist/scripts/shared/remote/remote.js.map +0 -1
- package/dist/types/board.d.ts +0 -13
- package/dist/types/board.d.ts.map +0 -1
- package/dist/types/board.js +0 -5
- package/dist/types/board.js.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/types/remote.d.ts +0 -55
- package/dist/types/remote.d.ts.map +0 -1
- package/dist/types/remote.js +0 -5
- package/dist/types/remote.js.map +0 -1
- package/dist/utils/parse-json/parse-json.d.ts +0 -20
- package/dist/utils/parse-json/parse-json.d.ts.map +0 -1
- package/dist/utils/parse-json/parse-json.js +0 -27
- package/dist/utils/parse-json/parse-json.js.map +0 -1
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST a pull request / merge request and return a typed result.
|
|
3
|
-
*
|
|
4
|
-
* Handles the common try/catch, response parsing, error formatting,
|
|
5
|
-
* and "already exists" detection shared by all git host implementations.
|
|
6
|
-
*
|
|
7
|
-
* @param url - The API endpoint to POST to.
|
|
8
|
-
* @param headers - HTTP headers (including auth).
|
|
9
|
-
* @param body - The request body (JSON-serialised).
|
|
10
|
-
* @param parseSuccess - Extract `{ url, number }` from the success response JSON.
|
|
11
|
-
* @param isAlreadyExists - Optional check for duplicate PR detection.
|
|
12
|
-
* @returns A typed `PrCreationResult`.
|
|
13
|
-
*/
|
|
14
|
-
export async function postPullRequest(url, headers, body, parseSuccess, isAlreadyExists) {
|
|
15
|
-
const controller = new AbortController();
|
|
16
|
-
const timeout = setTimeout(() => controller.abort(), 30_000);
|
|
17
|
-
try {
|
|
18
|
-
const response = await fetch(url, {
|
|
19
|
-
method: 'POST',
|
|
20
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
21
|
-
body: JSON.stringify(body),
|
|
22
|
-
signal: controller.signal,
|
|
23
|
-
});
|
|
24
|
-
if (!response.ok) {
|
|
25
|
-
const text = await response.text().catch(() => '');
|
|
26
|
-
const alreadyExists = isAlreadyExists?.(response.status, text) ?? false;
|
|
27
|
-
return {
|
|
28
|
-
ok: false,
|
|
29
|
-
error: `HTTP ${response.status}${text ? `: ${text.slice(0, 200)}` : ''}`,
|
|
30
|
-
alreadyExists,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const json = await response.json();
|
|
34
|
-
const parsed = parseSuccess(json);
|
|
35
|
-
if (!parsed.url && !parsed.number) {
|
|
36
|
-
return {
|
|
37
|
-
ok: false,
|
|
38
|
-
error: 'PR created but response missing URL and number',
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return { ok: true, url: parsed.url, number: parsed.number };
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
return {
|
|
45
|
-
ok: false,
|
|
46
|
-
error: err instanceof Error ? err.message : String(err),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
finally {
|
|
50
|
-
clearTimeout(timeout);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Build a Basic Auth header value from username and token.
|
|
55
|
-
*
|
|
56
|
-
* Used by Bitbucket Cloud which requires HTTP Basic Auth.
|
|
57
|
-
*/
|
|
58
|
-
export function basicAuth(username, token) {
|
|
59
|
-
return `Basic ${Buffer.from(`${username}:${token}`).toString('base64')}`;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=post-pr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"post-pr.js","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/post-pr/post-pr.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,OAA+B,EAC/B,IAA6B,EAC7B,YAAgE,EAChE,eAA2D;IAE3D,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;IAE7D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC3D,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IA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AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB,EAAE,KAAa;IACvD,OAAO,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PR/MR body builder.
|
|
3
|
-
*
|
|
4
|
-
* Constructs the pull request description with a link back to the
|
|
5
|
-
* board ticket and a Clancy footer.
|
|
6
|
-
*/
|
|
7
|
-
import type { ProgressEntry } from '../../../../scripts/shared/progress/progress.js';
|
|
8
|
-
import type { BoardConfig, Ticket } from '../../../../types/index.js';
|
|
9
|
-
/**
|
|
10
|
-
* Check whether a target branch is an epic or milestone branch.
|
|
11
|
-
*
|
|
12
|
-
* @param targetBranch - The branch the PR targets.
|
|
13
|
-
* @returns `true` if it's an epic (`epic/`) or milestone (`milestone/`) branch.
|
|
14
|
-
*/
|
|
15
|
-
export declare function isEpicBranch(targetBranch: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Build the PR/MR body for a ticket.
|
|
18
|
-
*
|
|
19
|
-
* Includes a link back to the board ticket (auto-close for GitHub Issues
|
|
20
|
-
* when targeting the base branch, or "Part of" when targeting an epic branch)
|
|
21
|
-
* and a Clancy attribution footer.
|
|
22
|
-
*
|
|
23
|
-
* @param config - The board configuration.
|
|
24
|
-
* @param ticket - The ticket being implemented.
|
|
25
|
-
* @param targetBranch - The branch the PR targets (used to determine `Closes` vs `Part of`).
|
|
26
|
-
* @param verificationWarning - Optional warning text when verification checks failed after max retries. Included as a `## Verification Warning` section before the footer.
|
|
27
|
-
* @returns The PR body as a markdown string.
|
|
28
|
-
*/
|
|
29
|
-
export declare function buildPrBody(config: BoardConfig, ticket: Ticket, targetBranch?: string, verificationWarning?: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* Build the PR body for the final epic PR (epic branch → base branch).
|
|
32
|
-
*
|
|
33
|
-
* Lists all child tickets with their PR numbers for traceability.
|
|
34
|
-
*
|
|
35
|
-
* @param epicKey - The epic ticket key (e.g., `'PROJ-100'`).
|
|
36
|
-
* @param epicTitle - The epic ticket title.
|
|
37
|
-
* @param childEntries - Progress entries for child tickets (with `prNumber`).
|
|
38
|
-
* @returns The epic PR body as a markdown string.
|
|
39
|
-
*/
|
|
40
|
-
export declare function buildEpicPrBody(epicKey: string, epicTitle: string, childEntries: ProgressEntry[]): string;
|
|
41
|
-
//# sourceMappingURL=pr-body.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pr-body.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/pr-body/pr-body.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EACrB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,CA4DR;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,aAAa,EAAE,GAC5B,MAAM,CAkBR"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check whether a target branch is an epic or milestone branch.
|
|
3
|
-
*
|
|
4
|
-
* @param targetBranch - The branch the PR targets.
|
|
5
|
-
* @returns `true` if it's an epic (`epic/`) or milestone (`milestone/`) branch.
|
|
6
|
-
*/
|
|
7
|
-
export function isEpicBranch(targetBranch) {
|
|
8
|
-
return (targetBranch.startsWith('epic/') || targetBranch.startsWith('milestone/'));
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Build the PR/MR body for a ticket.
|
|
12
|
-
*
|
|
13
|
-
* Includes a link back to the board ticket (auto-close for GitHub Issues
|
|
14
|
-
* when targeting the base branch, or "Part of" when targeting an epic branch)
|
|
15
|
-
* and a Clancy attribution footer.
|
|
16
|
-
*
|
|
17
|
-
* @param config - The board configuration.
|
|
18
|
-
* @param ticket - The ticket being implemented.
|
|
19
|
-
* @param targetBranch - The branch the PR targets (used to determine `Closes` vs `Part of`).
|
|
20
|
-
* @param verificationWarning - Optional warning text when verification checks failed after max retries. Included as a `## Verification Warning` section before the footer.
|
|
21
|
-
* @returns The PR body as a markdown string.
|
|
22
|
-
*/
|
|
23
|
-
export function buildPrBody(config, ticket, targetBranch, verificationWarning) {
|
|
24
|
-
const lines = [];
|
|
25
|
-
const isEpic = targetBranch ? isEpicBranch(targetBranch) : false;
|
|
26
|
-
switch (config.provider) {
|
|
27
|
-
case 'github':
|
|
28
|
-
lines.push(isEpic ? `Part of ${ticket.key}` : `Closes ${ticket.key}`);
|
|
29
|
-
break;
|
|
30
|
-
case 'jira':
|
|
31
|
-
lines.push(`**Jira:** [${ticket.key}](${config.env.JIRA_BASE_URL}/browse/${ticket.key})`);
|
|
32
|
-
break;
|
|
33
|
-
case 'linear':
|
|
34
|
-
lines.push(`**Linear:** ${ticket.key}`);
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
lines.push('');
|
|
38
|
-
if (ticket.description) {
|
|
39
|
-
lines.push('## Description');
|
|
40
|
-
lines.push('');
|
|
41
|
-
lines.push(ticket.description);
|
|
42
|
-
lines.push('');
|
|
43
|
-
}
|
|
44
|
-
if (verificationWarning) {
|
|
45
|
-
lines.push('## ⚠ Verification Warning');
|
|
46
|
-
lines.push('');
|
|
47
|
-
lines.push(verificationWarning);
|
|
48
|
-
lines.push('');
|
|
49
|
-
lines.push('This PR may need manual fixes before merging.');
|
|
50
|
-
lines.push('');
|
|
51
|
-
}
|
|
52
|
-
lines.push('---');
|
|
53
|
-
lines.push('*Created by [Clancy](https://github.com/Pushedskydiver/clancy)*');
|
|
54
|
-
lines.push('');
|
|
55
|
-
lines.push('---');
|
|
56
|
-
lines.push('<details>');
|
|
57
|
-
lines.push('<summary><strong>Rework instructions</strong> (click to expand)</summary>');
|
|
58
|
-
lines.push('');
|
|
59
|
-
lines.push('To request changes:');
|
|
60
|
-
lines.push('- **Code comments** — leave inline comments on specific lines. These are always picked up automatically.');
|
|
61
|
-
lines.push('- **General feedback** — reply with a comment starting with `Rework:` followed by what needs fixing. Comments without the `Rework:` prefix are treated as discussion.');
|
|
62
|
-
lines.push('');
|
|
63
|
-
lines.push("Example: `Rework: The form validation doesn't handle empty passwords`");
|
|
64
|
-
lines.push('');
|
|
65
|
-
lines.push('</details>');
|
|
66
|
-
return lines.join('\n');
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Build the PR body for the final epic PR (epic branch → base branch).
|
|
70
|
-
*
|
|
71
|
-
* Lists all child tickets with their PR numbers for traceability.
|
|
72
|
-
*
|
|
73
|
-
* @param epicKey - The epic ticket key (e.g., `'PROJ-100'`).
|
|
74
|
-
* @param epicTitle - The epic ticket title.
|
|
75
|
-
* @param childEntries - Progress entries for child tickets (with `prNumber`).
|
|
76
|
-
* @returns The epic PR body as a markdown string.
|
|
77
|
-
*/
|
|
78
|
-
export function buildEpicPrBody(epicKey, epicTitle, childEntries) {
|
|
79
|
-
const lines = [];
|
|
80
|
-
lines.push(`## ${epicKey} — ${epicTitle}`);
|
|
81
|
-
lines.push('');
|
|
82
|
-
lines.push('### Children');
|
|
83
|
-
lines.push('');
|
|
84
|
-
for (const entry of childEntries) {
|
|
85
|
-
const prRef = entry.prNumber ? ` (#${entry.prNumber})` : '';
|
|
86
|
-
lines.push(`- ${entry.key} — ${entry.summary}${prRef}`);
|
|
87
|
-
}
|
|
88
|
-
lines.push('');
|
|
89
|
-
lines.push('---');
|
|
90
|
-
lines.push('*Created by [Clancy](https://github.com/Pushedskydiver/clancy)*');
|
|
91
|
-
return lines.join('\n');
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=pr-body.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pr-body.js","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/pr-body/pr-body.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,YAAoB;IAC/C,OAAO,CACL,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAC1E,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CACzB,MAAmB,EACnB,MAAc,EACd,YAAqB,EACrB,mBAA4B;IAE5B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEjE,QAAQ,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,KAAK,QAAQ;YACX,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;YACtE,MAAM;QACR,KAAK,MAAM;YACT,KAAK,CAAC,IAAI,CACR,cAAc,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,aAAa,WAAW,MAAM,CAAC,GAAG,GAAG,CAC9E,CAAC;YACF,MAAM;QACR,KAAK,QAAQ;YACX,KAAK,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;YACxC,MAAM;IACV,CAAC;IAED,KAAK,CAA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IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAEzB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,SAAiB,EACjB,YAA6B;IAE7B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,MAAM,OAAO,MAAM,SAAS,EAAE,CAAC,CAAC;IAC3C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,GAAG,MAAM,KAAK,CAAC,OAAO,GAAG,KAAK,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,KAAK,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IAE9E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rework comment detection and extraction utilities.
|
|
3
|
-
*
|
|
4
|
-
* Comments starting with "Rework:" (case-insensitive) are treated as
|
|
5
|
-
* rework requests. All other comments are treated as discussion and ignored.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Check if a comment is a rework request (starts with "Rework:" case-insensitive).
|
|
9
|
-
*
|
|
10
|
-
* @param body - The comment body to check.
|
|
11
|
-
* @returns `true` if the comment starts with "Rework:".
|
|
12
|
-
*/
|
|
13
|
-
export declare function isReworkComment(body: string): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Extract the rework description from a "Rework: ..." comment.
|
|
16
|
-
*
|
|
17
|
-
* Strips the "Rework:" prefix and returns the remaining content trimmed.
|
|
18
|
-
*
|
|
19
|
-
* @param body - The full comment body starting with "Rework:".
|
|
20
|
-
* @returns The description after the prefix.
|
|
21
|
-
*/
|
|
22
|
-
export declare function extractReworkContent(body: string): string;
|
|
23
|
-
//# sourceMappingURL=rework-comment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rework-comment.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/rework-comment/rework-comment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKzD"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rework comment detection and extraction utilities.
|
|
3
|
-
*
|
|
4
|
-
* Comments starting with "Rework:" (case-insensitive) are treated as
|
|
5
|
-
* rework requests. All other comments are treated as discussion and ignored.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Check if a comment is a rework request (starts with "Rework:" case-insensitive).
|
|
9
|
-
*
|
|
10
|
-
* @param body - The comment body to check.
|
|
11
|
-
* @returns `true` if the comment starts with "Rework:".
|
|
12
|
-
*/
|
|
13
|
-
export function isReworkComment(body) {
|
|
14
|
-
return body.trim().toLowerCase().startsWith('rework:');
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Extract the rework description from a "Rework: ..." comment.
|
|
18
|
-
*
|
|
19
|
-
* Strips the "Rework:" prefix and returns the remaining content trimmed.
|
|
20
|
-
*
|
|
21
|
-
* @param body - The full comment body starting with "Rework:".
|
|
22
|
-
* @returns The description after the prefix.
|
|
23
|
-
*/
|
|
24
|
-
export function extractReworkContent(body) {
|
|
25
|
-
return body
|
|
26
|
-
.trim()
|
|
27
|
-
.replace(/^rework:\s*/i, '')
|
|
28
|
-
.trim();
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=rework-comment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rework-comment.js","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/rework-comment/rework-comment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,IAAI;SACR,IAAI,EAAE;SACN,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { GitPlatform, RemoteInfo } from '../../../types/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Parse a git remote URL into platform-specific info.
|
|
4
|
-
*
|
|
5
|
-
* Supports HTTPS, SSH, and SSH-URL formats for GitHub, GitLab, Bitbucket
|
|
6
|
-
* (Cloud and Server), Azure DevOps, and self-hosted instances.
|
|
7
|
-
*
|
|
8
|
-
* @param rawUrl - The raw git remote URL.
|
|
9
|
-
* @returns Parsed remote info with platform and path details.
|
|
10
|
-
*/
|
|
11
|
-
export declare function parseRemote(rawUrl: string): RemoteInfo;
|
|
12
|
-
/**
|
|
13
|
-
* Detect the git hosting platform from a hostname.
|
|
14
|
-
*
|
|
15
|
-
* Uses known domain patterns. Self-hosted instances with custom domains
|
|
16
|
-
* (e.g. `git.acme.com`) fall through to 'unknown' — use `CLANCY_GIT_PLATFORM`
|
|
17
|
-
* env var to override.
|
|
18
|
-
*
|
|
19
|
-
* @param hostname - The hostname from the remote URL.
|
|
20
|
-
* @returns The detected platform.
|
|
21
|
-
*/
|
|
22
|
-
export declare function detectPlatformFromHostname(hostname: string): GitPlatform;
|
|
23
|
-
/**
|
|
24
|
-
* Detect the remote origin info from the current git repository.
|
|
25
|
-
*
|
|
26
|
-
* Falls back to `{ host: 'none' }` if no remote is configured or
|
|
27
|
-
* if the command fails.
|
|
28
|
-
*
|
|
29
|
-
* @param platformOverride - Override platform detection (from `CLANCY_GIT_PLATFORM` env var).
|
|
30
|
-
* @returns Parsed remote info.
|
|
31
|
-
*/
|
|
32
|
-
export declare function detectRemote(platformOverride?: string): RemoteInfo;
|
|
33
|
-
/**
|
|
34
|
-
* Build the API base URL for a given remote.
|
|
35
|
-
*
|
|
36
|
-
* @param remote - The parsed remote info.
|
|
37
|
-
* @param apiUrlOverride - Override from `CLANCY_GIT_API_URL` env var.
|
|
38
|
-
* @returns The API base URL, or undefined if not applicable.
|
|
39
|
-
*/
|
|
40
|
-
export declare function buildApiBaseUrl(remote: RemoteInfo, apiUrlOverride?: string): string | undefined;
|
|
41
|
-
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../../src/scripts/shared/remote/remote.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAgChE;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAgEtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAWxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,CAmBlE;AAgED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAClB,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,GAAG,SAAS,CAiBpB"}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remote git host detection.
|
|
3
|
-
*
|
|
4
|
-
* Parses `git remote get-url origin` to detect the hosting platform
|
|
5
|
-
* (GitHub, GitLab, Bitbucket, etc.) and extract owner/repo/project info.
|
|
6
|
-
*/
|
|
7
|
-
import { execFileSync } from 'node:child_process';
|
|
8
|
-
/**
|
|
9
|
-
* Extract hostname and path from a raw git remote URL.
|
|
10
|
-
*
|
|
11
|
-
* Strips `.git` suffix, then tries SSH (`git@host:path`) and
|
|
12
|
-
* HTTPS/SSH-URL (`https://host/path`, `ssh://git@host/path`) formats.
|
|
13
|
-
*
|
|
14
|
-
* @param rawUrl - The raw git remote URL.
|
|
15
|
-
* @returns The extracted hostname and path, or `undefined` if unparseable.
|
|
16
|
-
*/
|
|
17
|
-
function extractHostAndPath(rawUrl) {
|
|
18
|
-
const url = rawUrl.trim().replace(/\.git$/, '');
|
|
19
|
-
// SSH format: git@<host>:<path>
|
|
20
|
-
const sshMatch = url.match(/^git@([^:]+):(.+)$/);
|
|
21
|
-
// HTTPS or SSH-URL format: https://<host>/<path> or ssh://git@<host>/<path>
|
|
22
|
-
const httpsMatch = url.match(/^(?:https?|ssh):\/\/(?:[^@]+@)?([^/:]+)(?::\d+)?\/(.+)$/);
|
|
23
|
-
const hostname = sshMatch?.[1] ?? httpsMatch?.[1];
|
|
24
|
-
const path = sshMatch?.[2] ?? httpsMatch?.[2];
|
|
25
|
-
if (!hostname || !path)
|
|
26
|
-
return undefined;
|
|
27
|
-
return { hostname, path };
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Parse a git remote URL into platform-specific info.
|
|
31
|
-
*
|
|
32
|
-
* Supports HTTPS, SSH, and SSH-URL formats for GitHub, GitLab, Bitbucket
|
|
33
|
-
* (Cloud and Server), Azure DevOps, and self-hosted instances.
|
|
34
|
-
*
|
|
35
|
-
* @param rawUrl - The raw git remote URL.
|
|
36
|
-
* @returns Parsed remote info with platform and path details.
|
|
37
|
-
*/
|
|
38
|
-
export function parseRemote(rawUrl) {
|
|
39
|
-
const extracted = extractHostAndPath(rawUrl);
|
|
40
|
-
if (!extracted) {
|
|
41
|
-
return { host: 'unknown', url: rawUrl };
|
|
42
|
-
}
|
|
43
|
-
const { hostname, path } = extracted;
|
|
44
|
-
const platform = detectPlatformFromHostname(hostname);
|
|
45
|
-
switch (platform) {
|
|
46
|
-
case 'github': {
|
|
47
|
-
const parts = path.split('/');
|
|
48
|
-
if (parts.length >= 2) {
|
|
49
|
-
return {
|
|
50
|
-
host: 'github',
|
|
51
|
-
owner: parts[0],
|
|
52
|
-
repo: parts[1],
|
|
53
|
-
hostname,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return { host: 'unknown', url: rawUrl };
|
|
57
|
-
}
|
|
58
|
-
case 'gitlab': {
|
|
59
|
-
return {
|
|
60
|
-
host: 'gitlab',
|
|
61
|
-
projectPath: path,
|
|
62
|
-
hostname,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
case 'bitbucket': {
|
|
66
|
-
// Bitbucket Server uses /scm/<projectKey>/<repo> format
|
|
67
|
-
const scmMatch = path.match(/^scm\/([^/]+)\/(.+)$/);
|
|
68
|
-
if (scmMatch) {
|
|
69
|
-
return {
|
|
70
|
-
host: 'bitbucket-server',
|
|
71
|
-
projectKey: scmMatch[1],
|
|
72
|
-
repoSlug: scmMatch[2],
|
|
73
|
-
hostname,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
// Bitbucket Cloud: <workspace>/<repo>
|
|
77
|
-
const parts = path.split('/');
|
|
78
|
-
if (parts.length >= 2) {
|
|
79
|
-
return {
|
|
80
|
-
host: 'bitbucket',
|
|
81
|
-
workspace: parts[0],
|
|
82
|
-
repoSlug: parts[1],
|
|
83
|
-
hostname,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return { host: 'unknown', url: rawUrl };
|
|
87
|
-
}
|
|
88
|
-
case 'azure':
|
|
89
|
-
return { host: 'azure', url: rawUrl };
|
|
90
|
-
default:
|
|
91
|
-
return { host: 'unknown', url: rawUrl };
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Detect the git hosting platform from a hostname.
|
|
96
|
-
*
|
|
97
|
-
* Uses known domain patterns. Self-hosted instances with custom domains
|
|
98
|
-
* (e.g. `git.acme.com`) fall through to 'unknown' — use `CLANCY_GIT_PLATFORM`
|
|
99
|
-
* env var to override.
|
|
100
|
-
*
|
|
101
|
-
* @param hostname - The hostname from the remote URL.
|
|
102
|
-
* @returns The detected platform.
|
|
103
|
-
*/
|
|
104
|
-
export function detectPlatformFromHostname(hostname) {
|
|
105
|
-
const lower = hostname.toLowerCase();
|
|
106
|
-
if (lower === 'github.com' || lower.includes('github'))
|
|
107
|
-
return 'github';
|
|
108
|
-
if (lower === 'gitlab.com' || lower.includes('gitlab'))
|
|
109
|
-
return 'gitlab';
|
|
110
|
-
if (lower === 'bitbucket.org' || lower.includes('bitbucket'))
|
|
111
|
-
return 'bitbucket';
|
|
112
|
-
if (lower.includes('dev.azure') || lower.includes('visualstudio'))
|
|
113
|
-
return 'azure';
|
|
114
|
-
return 'unknown';
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Detect the remote origin info from the current git repository.
|
|
118
|
-
*
|
|
119
|
-
* Falls back to `{ host: 'none' }` if no remote is configured or
|
|
120
|
-
* if the command fails.
|
|
121
|
-
*
|
|
122
|
-
* @param platformOverride - Override platform detection (from `CLANCY_GIT_PLATFORM` env var).
|
|
123
|
-
* @returns Parsed remote info.
|
|
124
|
-
*/
|
|
125
|
-
export function detectRemote(platformOverride) {
|
|
126
|
-
let rawUrl;
|
|
127
|
-
try {
|
|
128
|
-
rawUrl = execFileSync('git', ['remote', 'get-url', 'origin'], {
|
|
129
|
-
encoding: 'utf8',
|
|
130
|
-
}).trim();
|
|
131
|
-
}
|
|
132
|
-
catch {
|
|
133
|
-
return { host: 'none' };
|
|
134
|
-
}
|
|
135
|
-
if (!rawUrl)
|
|
136
|
-
return { host: 'none' };
|
|
137
|
-
// If user explicitly overrides the platform, always use it — they know better
|
|
138
|
-
if (platformOverride) {
|
|
139
|
-
return overrideRemotePlatform(rawUrl, platformOverride);
|
|
140
|
-
}
|
|
141
|
-
return parseRemote(rawUrl);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Re-parse a remote URL with a known platform override.
|
|
145
|
-
*
|
|
146
|
-
* Used when auto-detection fails (self-hosted with custom domain)
|
|
147
|
-
* and the user sets `CLANCY_GIT_PLATFORM`.
|
|
148
|
-
*/
|
|
149
|
-
function overrideRemotePlatform(rawUrl, platform) {
|
|
150
|
-
const extracted = extractHostAndPath(rawUrl);
|
|
151
|
-
if (!extracted)
|
|
152
|
-
return { host: 'unknown', url: rawUrl };
|
|
153
|
-
const { hostname, path } = extracted;
|
|
154
|
-
switch (platform.toLowerCase()) {
|
|
155
|
-
case 'github': {
|
|
156
|
-
const parts = path.split('/');
|
|
157
|
-
if (parts.length >= 2) {
|
|
158
|
-
return { host: 'github', owner: parts[0], repo: parts[1], hostname };
|
|
159
|
-
}
|
|
160
|
-
return { host: 'unknown', url: rawUrl };
|
|
161
|
-
}
|
|
162
|
-
case 'gitlab':
|
|
163
|
-
return { host: 'gitlab', projectPath: path, hostname };
|
|
164
|
-
case 'bitbucket': {
|
|
165
|
-
const parts = path.split('/');
|
|
166
|
-
if (parts.length >= 2) {
|
|
167
|
-
return {
|
|
168
|
-
host: 'bitbucket',
|
|
169
|
-
workspace: parts[0],
|
|
170
|
-
repoSlug: parts[1],
|
|
171
|
-
hostname,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
return { host: 'unknown', url: rawUrl };
|
|
175
|
-
}
|
|
176
|
-
case 'bitbucket-server': {
|
|
177
|
-
// Strip leading scm/ prefix used in Bitbucket Server URLs
|
|
178
|
-
const scmMatch = path.match(/^scm\/([^/]+)\/(.+)$/);
|
|
179
|
-
if (scmMatch) {
|
|
180
|
-
return {
|
|
181
|
-
host: 'bitbucket-server',
|
|
182
|
-
projectKey: scmMatch[1],
|
|
183
|
-
repoSlug: scmMatch[2],
|
|
184
|
-
hostname,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
const parts = path.split('/');
|
|
188
|
-
if (parts.length >= 2) {
|
|
189
|
-
return {
|
|
190
|
-
host: 'bitbucket-server',
|
|
191
|
-
projectKey: parts[0],
|
|
192
|
-
repoSlug: parts[1],
|
|
193
|
-
hostname,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
return { host: 'unknown', url: rawUrl };
|
|
197
|
-
}
|
|
198
|
-
default:
|
|
199
|
-
return { host: 'unknown', url: rawUrl };
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Build the API base URL for a given remote.
|
|
204
|
-
*
|
|
205
|
-
* @param remote - The parsed remote info.
|
|
206
|
-
* @param apiUrlOverride - Override from `CLANCY_GIT_API_URL` env var.
|
|
207
|
-
* @returns The API base URL, or undefined if not applicable.
|
|
208
|
-
*/
|
|
209
|
-
export function buildApiBaseUrl(remote, apiUrlOverride) {
|
|
210
|
-
if (apiUrlOverride)
|
|
211
|
-
return apiUrlOverride.replace(/\/$/, '');
|
|
212
|
-
switch (remote.host) {
|
|
213
|
-
case 'github':
|
|
214
|
-
return remote.hostname === 'github.com'
|
|
215
|
-
? 'https://api.github.com'
|
|
216
|
-
: `https://${remote.hostname}/api/v3`;
|
|
217
|
-
case 'gitlab':
|
|
218
|
-
return `https://${remote.hostname}/api/v4`;
|
|
219
|
-
case 'bitbucket':
|
|
220
|
-
return 'https://api.bitbucket.org/2.0';
|
|
221
|
-
case 'bitbucket-server':
|
|
222
|
-
return `https://${remote.hostname}/rest/api/1.0`;
|
|
223
|
-
default:
|
|
224
|
-
return undefined;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
//# sourceMappingURL=remote.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../../src/scripts/shared/remote/remote.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CACzB,MAAc;IAEd,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEhD,gCAAgC;IAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAEjD,4EAA4E;IAC5E,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAC1B,yDAAyD,CAC1D,CAAC;IAEF,MAAM,QAAQ,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IAE9C,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAEzC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE7C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,CAA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AAC;IAE7D,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,QAAQ,KAAK,YAAY;gBACrC,CAAC,CAAC,wBAAwB;gBAC1B,CAAC,CAAC,WAAW,MAAM,CAAC,QAAQ,SAAS,CAAC;QAC1C,KAAK,QAAQ;YACX,OAAO,WAAW,MAAM,CAAC,QAAQ,SAAS,CAAC;QAC7C,KAAK,WAAW;YACd,OAAO,+BAA+B,CAAC;QACzC,KAAK,kBAAkB;YACrB,OAAO,WAAW,MAAM,CAAC,QAAQ,eAAe,CAAC;QACnD;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
package/dist/types/board.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Board-related types shared across board scripts.
|
|
3
|
-
*/
|
|
4
|
-
/** Supported board providers. */
|
|
5
|
-
export type BoardProvider = 'jira' | 'github' | 'linear';
|
|
6
|
-
/** A normalised ticket from any board provider. */
|
|
7
|
-
export type Ticket = {
|
|
8
|
-
key: string;
|
|
9
|
-
title: string;
|
|
10
|
-
description: string;
|
|
11
|
-
provider: BoardProvider;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=board.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../../src/types/board.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,iCAAiC;AACjC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD,mDAAmD;AACnD,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;CACzB,CAAC"}
|
package/dist/types/board.js
DELETED
package/dist/types/board.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"board.js","sourceRoot":"","sources":["../../src/types/board.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type { BoardProvider, Ticket } from './board.js';
|
|
2
|
-
export type { GitPlatform, PrCreationResult, PrReviewState, ProgressStatus, RemoteInfo, } from './remote.js';
|
|
3
|
-
export type { BoardConfig, GitHubEnv, JiraEnv, LinearEnv, SharedEnv, } from '../schemas/env.js';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,SAAS,EACT,SAAS,GACV,MAAM,kBAAkB,CAAC"}
|
package/dist/types/index.js
DELETED
package/dist/types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|