specweave 0.24.6 → 0.24.9

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.
Files changed (76) hide show
  1. package/CLAUDE.md +64 -0
  2. package/README.md +34 -0
  3. package/dist/src/cli/commands/init.d.ts.map +1 -1
  4. package/dist/src/cli/commands/init.js +3 -1
  5. package/dist/src/cli/commands/init.js.map +1 -1
  6. package/dist/src/cli/helpers/issue-tracker/github-multi-repo.d.ts +5 -2
  7. package/dist/src/cli/helpers/issue-tracker/github-multi-repo.d.ts.map +1 -1
  8. package/dist/src/cli/helpers/issue-tracker/github-multi-repo.js +90 -8
  9. package/dist/src/cli/helpers/issue-tracker/github-multi-repo.js.map +1 -1
  10. package/dist/src/cli/helpers/issue-tracker/github.d.ts +2 -1
  11. package/dist/src/cli/helpers/issue-tracker/github.d.ts.map +1 -1
  12. package/dist/src/cli/helpers/issue-tracker/github.js +4 -3
  13. package/dist/src/cli/helpers/issue-tracker/github.js.map +1 -1
  14. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  15. package/dist/src/cli/helpers/issue-tracker/index.js +26 -9
  16. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  17. package/dist/src/cli/helpers/issue-tracker/types.d.ts +1 -0
  18. package/dist/src/cli/helpers/issue-tracker/types.d.ts.map +1 -1
  19. package/dist/src/cli/helpers/issue-tracker/types.js.map +1 -1
  20. package/dist/src/core/repo-structure/git-error-handler.d.ts +37 -0
  21. package/dist/src/core/repo-structure/git-error-handler.d.ts.map +1 -0
  22. package/dist/src/core/repo-structure/git-error-handler.js +214 -0
  23. package/dist/src/core/repo-structure/git-error-handler.js.map +1 -0
  24. package/dist/src/core/repo-structure/git-provider.d.ts +183 -0
  25. package/dist/src/core/repo-structure/git-provider.d.ts.map +1 -0
  26. package/dist/src/core/repo-structure/git-provider.js +57 -0
  27. package/dist/src/core/repo-structure/git-provider.js.map +1 -0
  28. package/dist/src/core/repo-structure/github-validator.d.ts +1 -0
  29. package/dist/src/core/repo-structure/github-validator.d.ts.map +1 -1
  30. package/dist/src/core/repo-structure/github-validator.js +35 -9
  31. package/dist/src/core/repo-structure/github-validator.js.map +1 -1
  32. package/dist/src/core/repo-structure/platform-registry.d.ts +114 -0
  33. package/dist/src/core/repo-structure/platform-registry.d.ts.map +1 -0
  34. package/dist/src/core/repo-structure/platform-registry.js +206 -0
  35. package/dist/src/core/repo-structure/platform-registry.js.map +1 -0
  36. package/dist/src/core/repo-structure/prompt-consolidator.d.ts +42 -0
  37. package/dist/src/core/repo-structure/prompt-consolidator.d.ts.map +1 -1
  38. package/dist/src/core/repo-structure/prompt-consolidator.js +102 -0
  39. package/dist/src/core/repo-structure/prompt-consolidator.js.map +1 -1
  40. package/dist/src/core/repo-structure/providers/azure-devops-provider.d.ts +64 -0
  41. package/dist/src/core/repo-structure/providers/azure-devops-provider.d.ts.map +1 -0
  42. package/dist/src/core/repo-structure/providers/azure-devops-provider.js +263 -0
  43. package/dist/src/core/repo-structure/providers/azure-devops-provider.js.map +1 -0
  44. package/dist/src/core/repo-structure/providers/bitbucket-provider.d.ts +55 -0
  45. package/dist/src/core/repo-structure/providers/bitbucket-provider.d.ts.map +1 -0
  46. package/dist/src/core/repo-structure/providers/bitbucket-provider.js +238 -0
  47. package/dist/src/core/repo-structure/providers/bitbucket-provider.js.map +1 -0
  48. package/dist/src/core/repo-structure/providers/github-provider.d.ts +53 -0
  49. package/dist/src/core/repo-structure/providers/github-provider.d.ts.map +1 -0
  50. package/dist/src/core/repo-structure/providers/github-provider.js +239 -0
  51. package/dist/src/core/repo-structure/providers/github-provider.js.map +1 -0
  52. package/dist/src/core/repo-structure/providers/gitlab-provider.d.ts +51 -0
  53. package/dist/src/core/repo-structure/providers/gitlab-provider.d.ts.map +1 -0
  54. package/dist/src/core/repo-structure/providers/gitlab-provider.js +251 -0
  55. package/dist/src/core/repo-structure/providers/gitlab-provider.js.map +1 -0
  56. package/dist/src/core/repo-structure/providers/index.d.ts +35 -0
  57. package/dist/src/core/repo-structure/providers/index.d.ts.map +1 -0
  58. package/dist/src/core/repo-structure/providers/index.js +68 -0
  59. package/dist/src/core/repo-structure/providers/index.js.map +1 -0
  60. package/dist/src/core/repo-structure/providers/local-provider.d.ts +61 -0
  61. package/dist/src/core/repo-structure/providers/local-provider.d.ts.map +1 -0
  62. package/dist/src/core/repo-structure/providers/local-provider.js +148 -0
  63. package/dist/src/core/repo-structure/providers/local-provider.js.map +1 -0
  64. package/dist/src/core/repo-structure/repo-structure-manager.d.ts +21 -4
  65. package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
  66. package/dist/src/core/repo-structure/repo-structure-manager.js +380 -113
  67. package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
  68. package/dist/src/core/repo-structure/url-generator.d.ts +80 -0
  69. package/dist/src/core/repo-structure/url-generator.d.ts.map +1 -0
  70. package/dist/src/core/repo-structure/url-generator.js +110 -0
  71. package/dist/src/core/repo-structure/url-generator.js.map +1 -0
  72. package/package.json +1 -1
  73. package/plugins/specweave/hooks/post-task-completion.sh +69 -175
  74. package/plugins/specweave/lib/hooks/consolidated-sync.js +183 -0
  75. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +64 -0
  76. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +96 -0
@@ -0,0 +1,263 @@
1
+ /**
2
+ * Azure DevOps Provider Implementation
3
+ *
4
+ * Implements GitProvider interface for Azure DevOps Repos.
5
+ * Handles repository validation, creation, and management via Azure DevOps REST API.
6
+ *
7
+ * @module providers/azure-devops-provider
8
+ */
9
+ import { BaseGitProvider } from '../git-provider.js';
10
+ import { getActionableError, formatActionableError } from '../git-error-handler.js';
11
+ /**
12
+ * Azure DevOps Provider
13
+ *
14
+ * Implements Git operations for Azure DevOps platform.
15
+ * Note: Azure DevOps uses organization/project/repository structure.
16
+ * The "owner" parameter typically represents "organization/project".
17
+ */
18
+ export class AzureDevOpsProvider extends BaseGitProvider {
19
+ constructor(config) {
20
+ super({
21
+ type: 'azure-devops',
22
+ name: 'Azure DevOps',
23
+ host: config?.host || 'dev.azure.com',
24
+ apiBaseUrl: config?.apiBaseUrl || 'https://dev.azure.com',
25
+ selfHosted: config?.selfHosted || false,
26
+ customDomain: config?.customDomain
27
+ });
28
+ }
29
+ /**
30
+ * Validate if a repository exists in Azure DevOps
31
+ * owner format: "organization/project"
32
+ */
33
+ async validateRepository(owner, repo, token) {
34
+ try {
35
+ const [organization, project] = this.parseOwner(owner);
36
+ const headers = {
37
+ 'Accept': 'application/json'
38
+ };
39
+ if (token) {
40
+ // Azure DevOps uses Basic Auth with PAT
41
+ const auth = Buffer.from(`:${token}`).toString('base64');
42
+ headers['Authorization'] = `Basic ${auth}`;
43
+ }
44
+ const response = await fetch(`${this.config.apiBaseUrl}/${organization}/${project}/_apis/git/repositories/${repo}?api-version=7.0`, { headers });
45
+ if (response.status === 404) {
46
+ // Repository does not exist (good for creation)
47
+ return { exists: false, valid: true };
48
+ }
49
+ if (response.status === 200) {
50
+ // Repository already exists
51
+ const data = await response.json();
52
+ return {
53
+ exists: true,
54
+ valid: true,
55
+ url: data.webUrl || data.remoteUrl
56
+ };
57
+ }
58
+ if (response.status === 401 || response.status === 403) {
59
+ // Authentication or permission error
60
+ const apiError = {
61
+ status: response.status,
62
+ message: response.statusText,
63
+ platform: 'azure-devops',
64
+ operation: 'validate_repo',
65
+ resourceType: 'repository',
66
+ resourceName: `${organization}/${project}/${repo}`
67
+ };
68
+ const actionable = getActionableError(apiError);
69
+ return { exists: false, valid: false, error: formatActionableError(actionable) };
70
+ }
71
+ // Other error
72
+ const apiError = {
73
+ status: response.status,
74
+ message: response.statusText,
75
+ platform: 'azure-devops',
76
+ operation: 'validate_repo',
77
+ resourceType: 'repository',
78
+ resourceName: `${organization}/${project}/${repo}`
79
+ };
80
+ const actionable = getActionableError(apiError);
81
+ return {
82
+ exists: false,
83
+ valid: false,
84
+ error: formatActionableError(actionable)
85
+ };
86
+ }
87
+ catch (error) {
88
+ return {
89
+ exists: false,
90
+ valid: false,
91
+ error: `Network error: ${error instanceof Error ? error.message : String(error)}`
92
+ };
93
+ }
94
+ }
95
+ /**
96
+ * Validate if an Azure DevOps organization/project exists
97
+ * owner format: "organization/project"
98
+ */
99
+ async validateOwner(owner, token) {
100
+ const headers = {
101
+ 'Accept': 'application/json'
102
+ };
103
+ if (token) {
104
+ const auth = Buffer.from(`:${token}`).toString('base64');
105
+ headers['Authorization'] = `Basic ${auth}`;
106
+ }
107
+ try {
108
+ const [organization, project] = this.parseOwner(owner);
109
+ // Validate organization exists by checking projects
110
+ const orgResponse = await fetch(`${this.config.apiBaseUrl}/${organization}/_apis/projects?api-version=7.0`, { headers });
111
+ if (orgResponse.status !== 200) {
112
+ const apiError = {
113
+ status: 404,
114
+ message: 'Organization not found',
115
+ platform: 'azure-devops',
116
+ operation: 'validate_owner',
117
+ resourceType: 'organization',
118
+ resourceName: organization
119
+ };
120
+ const actionable = getActionableError(apiError);
121
+ return { valid: false, error: formatActionableError(actionable) };
122
+ }
123
+ // If project specified, validate it exists
124
+ if (project) {
125
+ const projectResponse = await fetch(`${this.config.apiBaseUrl}/${organization}/_apis/projects/${project}?api-version=7.0`, { headers });
126
+ if (projectResponse.status !== 200) {
127
+ const apiError = {
128
+ status: 404,
129
+ message: 'Project not found',
130
+ platform: 'azure-devops',
131
+ operation: 'validate_owner',
132
+ resourceType: 'project',
133
+ resourceName: `${organization}/${project}`
134
+ };
135
+ const actionable = getActionableError(apiError);
136
+ return { valid: false, error: formatActionableError(actionable) };
137
+ }
138
+ }
139
+ // Azure DevOps organizations are always "organization" type
140
+ return { valid: true, type: 'organization' };
141
+ }
142
+ catch (error) {
143
+ return {
144
+ valid: false,
145
+ error: `Network error: ${error instanceof Error ? error.message : String(error)}`
146
+ };
147
+ }
148
+ }
149
+ /**
150
+ * Create a new repository in Azure DevOps
151
+ */
152
+ async createRepository(options, token) {
153
+ const [organization, project] = this.parseOwner(options.owner);
154
+ if (!project) {
155
+ throw new Error('Azure DevOps requires a project. Use format: "organization/project"');
156
+ }
157
+ const payload = {
158
+ name: options.name,
159
+ project: {
160
+ name: project
161
+ }
162
+ };
163
+ const auth = Buffer.from(`:${token}`).toString('base64');
164
+ const response = await fetch(`${this.config.apiBaseUrl}/${organization}/${project}/_apis/git/repositories?api-version=7.0`, {
165
+ method: 'POST',
166
+ headers: {
167
+ 'Authorization': `Basic ${auth}`,
168
+ 'Accept': 'application/json',
169
+ 'Content-Type': 'application/json'
170
+ },
171
+ body: JSON.stringify(payload)
172
+ });
173
+ if (!response.ok) {
174
+ const error = await response.json();
175
+ // Handle "already exists" error
176
+ if (error.message?.includes('already exists') || error.typeKey === 'GitRepositoryNameAlreadyExistsException') {
177
+ // Repository already exists, return URL
178
+ const host = this.config.customDomain || this.config.host;
179
+ return `https://${host}/${organization}/${project}/_git/${options.name}`;
180
+ }
181
+ // Handle other errors with actionable messages
182
+ const apiError = {
183
+ status: response.status,
184
+ message: error.message || response.statusText,
185
+ platform: 'azure-devops',
186
+ operation: 'create_repo',
187
+ resourceType: 'repository',
188
+ resourceName: `${organization}/${project}/${options.name}`
189
+ };
190
+ const actionable = getActionableError(apiError);
191
+ throw new Error(formatActionableError(actionable));
192
+ }
193
+ const data = await response.json();
194
+ return data.webUrl || data.remoteUrl;
195
+ }
196
+ /**
197
+ * Check if account is an organization (always true for Azure DevOps)
198
+ */
199
+ async isOrganization(account, token) {
200
+ // Azure DevOps always uses organizations
201
+ return true;
202
+ }
203
+ /**
204
+ * Get token creation URL
205
+ */
206
+ getTokenUrl() {
207
+ if (this.config.selfHosted) {
208
+ return `https://${this.config.customDomain || this.config.host}/_usersSettings/tokens`;
209
+ }
210
+ return 'https://dev.azure.com/_usersSettings/tokens';
211
+ }
212
+ /**
213
+ * Get required token scopes
214
+ */
215
+ getRequiredScopes(isOrganization) {
216
+ return ['vso.code_write', 'vso.code_manage', 'vso.project'];
217
+ }
218
+ /**
219
+ * Override getRemoteUrl for Azure DevOps-specific URL format
220
+ */
221
+ getRemoteUrl(owner, repo, urlType) {
222
+ const [organization, project] = this.parseOwner(owner);
223
+ const host = this.config.customDomain || this.config.host;
224
+ if (!project) {
225
+ throw new Error('Azure DevOps requires a project. Use format: "organization/project"');
226
+ }
227
+ if (urlType === 'ssh') {
228
+ return `git@ssh.${host}:v3/${organization}/${project}/${repo}`;
229
+ }
230
+ else {
231
+ return `https://${host}/${organization}/${project}/_git/${repo}`;
232
+ }
233
+ }
234
+ /**
235
+ * Override getAuthHeaders for Azure DevOps-specific auth (Basic Auth with PAT)
236
+ */
237
+ getAuthHeaders(token) {
238
+ const auth = Buffer.from(`:${token}`).toString('base64');
239
+ return {
240
+ 'Authorization': `Basic ${auth}`,
241
+ 'Accept': 'application/json',
242
+ 'Content-Type': 'application/json'
243
+ };
244
+ }
245
+ /**
246
+ * Parse owner string into organization and project
247
+ * Format: "organization" or "organization/project"
248
+ */
249
+ parseOwner(owner) {
250
+ const parts = owner.split('/');
251
+ if (parts.length === 1) {
252
+ return [parts[0], null];
253
+ }
254
+ return [parts[0], parts[1]];
255
+ }
256
+ }
257
+ /**
258
+ * Create an Azure DevOps provider instance
259
+ */
260
+ export function createAzureDevOpsProvider(config) {
261
+ return new AzureDevOpsProvider(config);
262
+ }
263
+ //# sourceMappingURL=azure-devops-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azure-devops-provider.js","sourceRoot":"","sources":["../../../../../src/core/repo-structure/providers/azure-devops-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAsG,MAAM,oBAAoB,CAAC;AACzJ,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAoB,MAAM,yBAAyB,CAAC;AAGtG;;;;;;GAMG;AACH,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IACtD,YAAY,MAAgC;QAC1C,KAAK,CAAC;YACJ,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,cAAc;YACpB,I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,OAAO,SAAS,IAAI,EAAE,CAAC;QACnE,CAAC;IACH,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,KAAa;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACzD,OAAO;YACL,eAAe,EAAE,SAAS,IAAI,EAAE;YAChC,QAAQ,EAAE,kBAAkB;YAC5B,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACK,UAAU,CAAC,KAAa;QAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAgC;IACxE,OAAO,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Bitbucket Provider Implementation
3
+ *
4
+ * Implements GitProvider interface for Bitbucket.org and Bitbucket Server/Data Center.
5
+ * Handles repository validation, creation, and management via Bitbucket API 2.0.
6
+ *
7
+ * @module providers/bitbucket-provider
8
+ */
9
+ import { BaseGitProvider, type PlatformConfig, type RepoValidationResult, type OwnerValidationResult, type CreateRepoOptions } from '../git-provider.js';
10
+ /**
11
+ * Bitbucket Provider
12
+ *
13
+ * Implements Git operations for Bitbucket platform.
14
+ * Supports both Bitbucket.org and Bitbucket Server/Data Center.
15
+ */
16
+ export declare class BitbucketProvider extends BaseGitProvider {
17
+ constructor(config?: Partial<PlatformConfig>);
18
+ /**
19
+ * Validate if a repository exists on Bitbucket
20
+ */
21
+ validateRepository(owner: string, repo: string, token?: string): Promise<RepoValidationResult>;
22
+ /**
23
+ * Validate if a Bitbucket workspace (user or team) exists
24
+ */
25
+ validateOwner(owner: string, token?: string): Promise<OwnerValidationResult>;
26
+ /**
27
+ * Create a new repository on Bitbucket
28
+ */
29
+ createRepository(options: CreateRepoOptions, token: string): Promise<string>;
30
+ /**
31
+ * Check if a workspace is a team (organization)
32
+ */
33
+ isOrganization(account: string, token?: string): Promise<boolean>;
34
+ /**
35
+ * Get token creation URL
36
+ */
37
+ getTokenUrl(): string;
38
+ /**
39
+ * Get required token scopes
40
+ */
41
+ getRequiredScopes(isOrganization?: boolean): string[];
42
+ /**
43
+ * Override SSH user for Bitbucket
44
+ */
45
+ protected getSSHUser(): string;
46
+ /**
47
+ * Override getAuthHeaders for Bitbucket-specific auth (Bearer token)
48
+ */
49
+ protected getAuthHeaders(token: string): Record<string, string>;
50
+ }
51
+ /**
52
+ * Create a Bitbucket provider instance
53
+ */
54
+ export declare function createBitbucketProvider(config?: Partial<PlatformConfig>): BitbucketProvider;
55
+ //# sourceMappingURL=bitbucket-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitbucket-provider.d.ts","sourceRoot":"","sources":["../../../../../src/core/repo-structure/providers/bitbucket-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGzJ;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAW5C;;OAEG;IACG,kBAAkB,CACtB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,oBAAoB,CAAC;IAuEhC;;OAEG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,qBAAqB,CAAC;IAsDjC;;OAEG;IACG,gBAAgB,CACpB,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC;IAoDlB;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAyBvE;;OAEG;IACH,WAAW,IAAI,MAAM;IAOrB;;OAEG;IACH,iBAAiB,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE;IAIrD;;OAEG;IACH,SAAS,CAAC,UAAU,IAAI,MAAM;IAI9B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAOhE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,iBAAiB,CAE3F"}
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Bitbucket Provider Implementation
3
+ *
4
+ * Implements GitProvider interface for Bitbucket.org and Bitbucket Server/Data Center.
5
+ * Handles repository validation, creation, and management via Bitbucket API 2.0.
6
+ *
7
+ * @module providers/bitbucket-provider
8
+ */
9
+ import { BaseGitProvider } from '../git-provider.js';
10
+ import { getActionableError, formatActionableError } from '../git-error-handler.js';
11
+ /**
12
+ * Bitbucket Provider
13
+ *
14
+ * Implements Git operations for Bitbucket platform.
15
+ * Supports both Bitbucket.org and Bitbucket Server/Data Center.
16
+ */
17
+ export class BitbucketProvider extends BaseGitProvider {
18
+ constructor(config) {
19
+ super({
20
+ type: 'bitbucket',
21
+ name: 'Bitbucket',
22
+ host: config?.host || 'bitbucket.org',
23
+ apiBaseUrl: config?.apiBaseUrl || 'https://api.bitbucket.org/2.0',
24
+ selfHosted: config?.selfHosted || false,
25
+ customDomain: config?.customDomain
26
+ });
27
+ }
28
+ /**
29
+ * Validate if a repository exists on Bitbucket
30
+ */
31
+ async validateRepository(owner, repo, token) {
32
+ try {
33
+ const headers = {
34
+ 'Accept': 'application/json'
35
+ };
36
+ if (token) {
37
+ headers['Authorization'] = `Bearer ${token}`;
38
+ }
39
+ const response = await fetch(this.getApiUrl(`/repositories/${owner}/${repo}`), { headers });
40
+ if (response.status === 404) {
41
+ // Repository does not exist (good for creation)
42
+ return { exists: false, valid: true };
43
+ }
44
+ if (response.status === 200) {
45
+ // Repository already exists
46
+ const data = await response.json();
47
+ return {
48
+ exists: true,
49
+ valid: true,
50
+ url: data.links.html.href
51
+ };
52
+ }
53
+ if (response.status === 401 || response.status === 403) {
54
+ // Authentication or permission error
55
+ const apiError = {
56
+ status: response.status,
57
+ message: response.statusText,
58
+ platform: 'bitbucket',
59
+ operation: 'validate_repo',
60
+ resourceType: 'repository',
61
+ resourceName: `${owner}/${repo}`
62
+ };
63
+ const actionable = getActionableError(apiError);
64
+ return { exists: false, valid: false, error: formatActionableError(actionable) };
65
+ }
66
+ // Other error
67
+ const apiError = {
68
+ status: response.status,
69
+ message: response.statusText,
70
+ platform: 'bitbucket',
71
+ operation: 'validate_repo',
72
+ resourceType: 'repository',
73
+ resourceName: `${owner}/${repo}`
74
+ };
75
+ const actionable = getActionableError(apiError);
76
+ return {
77
+ exists: false,
78
+ valid: false,
79
+ error: formatActionableError(actionable)
80
+ };
81
+ }
82
+ catch (error) {
83
+ return {
84
+ exists: false,
85
+ valid: false,
86
+ error: `Network error: ${error instanceof Error ? error.message : String(error)}`
87
+ };
88
+ }
89
+ }
90
+ /**
91
+ * Validate if a Bitbucket workspace (user or team) exists
92
+ */
93
+ async validateOwner(owner, token) {
94
+ const headers = {
95
+ 'Accept': 'application/json'
96
+ };
97
+ if (token) {
98
+ headers['Authorization'] = `Bearer ${token}`;
99
+ }
100
+ try {
101
+ // Try as workspace (can be user or team)
102
+ const workspaceResponse = await fetch(this.getApiUrl(`/workspaces/${owner}`), { headers });
103
+ if (workspaceResponse.status === 200) {
104
+ const data = await workspaceResponse.json();
105
+ // Workspace can be either user or team
106
+ const type = data.type === 'team' ? 'organization' : 'user';
107
+ return { valid: true, type };
108
+ }
109
+ // Try as user
110
+ const userResponse = await fetch(this.getApiUrl(`/users/${owner}`), { headers });
111
+ if (userResponse.status === 200) {
112
+ return { valid: true, type: 'user' };
113
+ }
114
+ // Not found
115
+ const apiError = {
116
+ status: 404,
117
+ message: 'Not Found',
118
+ platform: 'bitbucket',
119
+ operation: 'validate_owner',
120
+ resourceType: 'workspace',
121
+ resourceName: owner
122
+ };
123
+ const actionable = getActionableError(apiError);
124
+ return { valid: false, error: formatActionableError(actionable) };
125
+ }
126
+ catch (error) {
127
+ return {
128
+ valid: false,
129
+ error: `Network error: ${error instanceof Error ? error.message : String(error)}`
130
+ };
131
+ }
132
+ }
133
+ /**
134
+ * Create a new repository on Bitbucket
135
+ */
136
+ async createRepository(options, token) {
137
+ const payload = {
138
+ scm: 'git',
139
+ name: options.name,
140
+ description: options.description,
141
+ is_private: options.visibility === 'private',
142
+ has_issues: options.hasIssues !== false,
143
+ has_wiki: options.hasWiki || false,
144
+ fork_policy: 'no_public_forks'
145
+ };
146
+ const response = await fetch(this.getApiUrl(`/repositories/${options.owner}/${options.name}`), {
147
+ method: 'POST',
148
+ headers: {
149
+ 'Authorization': `Bearer ${token}`,
150
+ 'Accept': 'application/json',
151
+ 'Content-Type': 'application/json'
152
+ },
153
+ body: JSON.stringify(payload)
154
+ });
155
+ if (!response.ok) {
156
+ const error = await response.json();
157
+ // Handle "already exists" error
158
+ if (response.status === 400 && error.error?.message?.includes('already exists')) {
159
+ // Repository already exists, return URL
160
+ const host = this.config.customDomain || this.config.host;
161
+ return `https://${host}/${options.owner}/${options.name}`;
162
+ }
163
+ // Handle other errors with actionable messages
164
+ const apiError = {
165
+ status: response.status,
166
+ message: error.error?.message || response.statusText,
167
+ platform: 'bitbucket',
168
+ operation: 'create_repo',
169
+ resourceType: 'repository',
170
+ resourceName: `${options.owner}/${options.name}`
171
+ };
172
+ const actionable = getActionableError(apiError);
173
+ throw new Error(formatActionableError(actionable));
174
+ }
175
+ const data = await response.json();
176
+ return data.links.html.href;
177
+ }
178
+ /**
179
+ * Check if a workspace is a team (organization)
180
+ */
181
+ async isOrganization(account, token) {
182
+ try {
183
+ const headers = {
184
+ 'Accept': 'application/json'
185
+ };
186
+ if (token) {
187
+ headers['Authorization'] = `Bearer ${token}`;
188
+ }
189
+ const response = await fetch(this.getApiUrl(`/workspaces/${account}`), { headers });
190
+ if (response.ok) {
191
+ const data = await response.json();
192
+ return data.type === 'team';
193
+ }
194
+ }
195
+ catch {
196
+ // Assume user if we can't determine
197
+ }
198
+ return false;
199
+ }
200
+ /**
201
+ * Get token creation URL
202
+ */
203
+ getTokenUrl() {
204
+ if (this.config.selfHosted) {
205
+ return `https://${this.config.customDomain || this.config.host}/account/settings/app-passwords/`;
206
+ }
207
+ return 'https://bitbucket.org/account/settings/app-passwords/';
208
+ }
209
+ /**
210
+ * Get required token scopes
211
+ */
212
+ getRequiredScopes(isOrganization) {
213
+ return ['repository:read', 'repository:write', 'repository:admin'];
214
+ }
215
+ /**
216
+ * Override SSH user for Bitbucket
217
+ */
218
+ getSSHUser() {
219
+ return 'git';
220
+ }
221
+ /**
222
+ * Override getAuthHeaders for Bitbucket-specific auth (Bearer token)
223
+ */
224
+ getAuthHeaders(token) {
225
+ return {
226
+ 'Authorization': `Bearer ${token}`,
227
+ 'Accept': 'application/json',
228
+ 'Content-Type': 'application/json'
229
+ };
230
+ }
231
+ }
232
+ /**
233
+ * Create a Bitbucket provider instance
234
+ */
235
+ export function createBitbucketProvider(config) {
236
+ return new BitbucketProvider(config);
237
+ }
238
+ //# sourceMappingURL=bitbucket-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitbucket-provider.js","sourceRoot":"","sources":["../../../../../src/core/repo-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 * Handles repository validation, creation, and management via GitHub API.
6
+ *
7
+ * @module providers/github-provider
8
+ */
9
+ import { BaseGitProvider, type PlatformConfig, type RepoValidationResult, type OwnerValidationResult, type CreateRepoOptions } from '../git-provider.js';
10
+ /**
11
+ * GitHub Provider
12
+ *
13
+ * Implements Git operations for GitHub platform.
14
+ */
15
+ export declare class GitHubProvider extends BaseGitProvider {
16
+ constructor(config?: Partial<PlatformConfig>);
17
+ /**
18
+ * Validate if a repository exists on GitHub
19
+ */
20
+ validateRepository(owner: string, repo: string, token?: string): Promise<RepoValidationResult>;
21
+ /**
22
+ * Validate if a GitHub owner (user or organization) exists
23
+ */
24
+ validateOwner(owner: string, token?: string): Promise<OwnerValidationResult>;
25
+ /**
26
+ * Create a new repository on GitHub
27
+ */
28
+ createRepository(options: CreateRepoOptions, token: string): Promise<string>;
29
+ /**
30
+ * Check if an account is an organization
31
+ */
32
+ isOrganization(account: string, token?: string): Promise<boolean>;
33
+ /**
34
+ * Get token creation URL
35
+ */
36
+ getTokenUrl(): string;
37
+ /**
38
+ * Get required token scopes
39
+ */
40
+ getRequiredScopes(isOrganization?: boolean): string[];
41
+ /**
42
+ * Override getAuthHeaders for GitHub-specific auth
43
+ */
44
+ protected getAuthHeaders(token: string): Record<string, string>;
45
+ }
46
+ /**
47
+ * Create a GitHub provider instance
48
+ *
49
+ * @param config - Optional platform configuration
50
+ * @returns GitHub provider instance
51
+ */
52
+ export declare function createGitHubProvider(config?: Partial<PlatformConfig>): GitHubProvider;
53
+ //# sourceMappingURL=github-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-provider.d.ts","sourceRoot":"","sources":["../../../../../src/core/repo-structure/providers/github-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIzJ;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,eAAe;gBACrC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAW5C;;OAEG;IACG,kBAAkB,CACtB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,oBAAoB,CAAC;IAuEhC;;OAEG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,qBAAqB,CAAC;IAqDjC;;OAEG;IACG,gBAAgB,CACpB,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC;IAmDlB;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAyBvE;;OAEG;IACH,WAAW,IAAI,MAAM;IAOrB;;OAEG;IACH,iBAAiB,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE;IAQrD;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAOhE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAErF"}