specweave 0.24.1 → 0.24.8
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/CLAUDE.md +106 -0
- package/README.md +34 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +80 -41
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/github-multi-repo.d.ts +5 -2
- package/dist/src/cli/helpers/issue-tracker/github-multi-repo.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/github-multi-repo.js +72 -6
- package/dist/src/cli/helpers/issue-tracker/github-multi-repo.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/github.d.ts +2 -1
- package/dist/src/cli/helpers/issue-tracker/github.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/github.js +4 -3
- package/dist/src/cli/helpers/issue-tracker/github.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.js +26 -9
- package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/types.d.ts +2 -1
- package/dist/src/cli/helpers/issue-tracker/types.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/types.js.map +1 -1
- package/dist/src/config/types.d.ts +24 -24
- package/dist/src/core/config/types.d.ts +25 -0
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js +6 -0
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/repo-structure/git-error-handler.d.ts +37 -0
- package/dist/src/core/repo-structure/git-error-handler.d.ts.map +1 -0
- package/dist/src/core/repo-structure/git-error-handler.js +214 -0
- package/dist/src/core/repo-structure/git-error-handler.js.map +1 -0
- package/dist/src/core/repo-structure/git-provider.d.ts +183 -0
- package/dist/src/core/repo-structure/git-provider.d.ts.map +1 -0
- package/dist/src/core/repo-structure/git-provider.js +57 -0
- package/dist/src/core/repo-structure/git-provider.js.map +1 -0
- package/dist/src/core/repo-structure/github-validator.d.ts +1 -0
- package/dist/src/core/repo-structure/github-validator.d.ts.map +1 -1
- package/dist/src/core/repo-structure/github-validator.js +35 -9
- package/dist/src/core/repo-structure/github-validator.js.map +1 -1
- package/dist/src/core/repo-structure/platform-registry.d.ts +114 -0
- package/dist/src/core/repo-structure/platform-registry.d.ts.map +1 -0
- package/dist/src/core/repo-structure/platform-registry.js +195 -0
- package/dist/src/core/repo-structure/platform-registry.js.map +1 -0
- package/dist/src/core/repo-structure/prompt-consolidator.d.ts +30 -0
- package/dist/src/core/repo-structure/prompt-consolidator.d.ts.map +1 -1
- package/dist/src/core/repo-structure/prompt-consolidator.js +69 -0
- package/dist/src/core/repo-structure/prompt-consolidator.js.map +1 -1
- package/dist/src/core/repo-structure/providers/bitbucket-provider.d.ts +54 -0
- package/dist/src/core/repo-structure/providers/bitbucket-provider.d.ts.map +1 -0
- package/dist/src/core/repo-structure/providers/bitbucket-provider.js +104 -0
- package/dist/src/core/repo-structure/providers/bitbucket-provider.js.map +1 -0
- package/dist/src/core/repo-structure/providers/github-provider.d.ts +53 -0
- package/dist/src/core/repo-structure/providers/github-provider.d.ts.map +1 -0
- package/dist/src/core/repo-structure/providers/github-provider.js +239 -0
- package/dist/src/core/repo-structure/providers/github-provider.js.map +1 -0
- package/dist/src/core/repo-structure/providers/gitlab-provider.d.ts +50 -0
- package/dist/src/core/repo-structure/providers/gitlab-provider.d.ts.map +1 -0
- package/dist/src/core/repo-structure/providers/gitlab-provider.js +97 -0
- package/dist/src/core/repo-structure/providers/gitlab-provider.js.map +1 -0
- package/dist/src/core/repo-structure/providers/index.d.ts +33 -0
- package/dist/src/core/repo-structure/providers/index.d.ts.map +1 -0
- package/dist/src/core/repo-structure/providers/index.js +60 -0
- package/dist/src/core/repo-structure/providers/index.js.map +1 -0
- package/dist/src/core/repo-structure/repo-bulk-discovery.d.ts +33 -0
- package/dist/src/core/repo-structure/repo-bulk-discovery.d.ts.map +1 -0
- package/dist/src/core/repo-structure/repo-bulk-discovery.js +275 -0
- package/dist/src/core/repo-structure/repo-bulk-discovery.js.map +1 -0
- package/dist/src/core/repo-structure/repo-structure-manager.d.ts +18 -2
- package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
- package/dist/src/core/repo-structure/repo-structure-manager.js +303 -85
- package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
- package/dist/src/core/repo-structure/url-generator.d.ts +80 -0
- package/dist/src/core/repo-structure/url-generator.d.ts.map +1 -0
- package/dist/src/core/repo-structure/url-generator.js +110 -0
- package/dist/src/core/repo-structure/url-generator.js.map +1 -0
- package/dist/src/init/architecture/types.d.ts +6 -6
- package/dist/src/utils/plugin-validator.d.ts.map +1 -1
- package/dist/src/utils/plugin-validator.js +15 -14
- package/dist/src/utils/plugin-validator.js.map +1 -1
- package/package.json +4 -4
- package/plugins/specweave/.claude-plugin/plugin.json +4 -4
- package/plugins/specweave/agents/pm/AGENT.md +2 -0
- package/plugins/specweave/commands/specweave-do.md +0 -47
- package/plugins/specweave/commands/specweave-increment.md +0 -82
- package/plugins/specweave/commands/specweave-next.md +0 -47
- package/plugins/specweave/hooks/post-task-completion.sh +67 -6
- package/plugins/specweave/hooks/pre-edit-spec.sh +11 -0
- package/plugins/specweave/hooks/pre-task-completion.sh +69 -2
- package/plugins/specweave/hooks/pre-write-spec.sh +11 -0
- package/plugins/specweave/skills/increment-planner/SKILL.md +124 -4
- package/plugins/specweave-ado/lib/ado-multi-project-sync.js +0 -1
- package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
- package/plugins/specweave/agents/pm/AGENT.md.bak +0 -1893
- package/plugins/specweave/hooks/docs-changed.sh.backup +0 -79
- package/plugins/specweave/hooks/human-input-required.sh.backup +0 -75
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh.bak +0 -245
- package/plugins/specweave/hooks/lib/sync-spec-content.sh.bak +0 -149
- package/plugins/specweave/hooks/lib/validate-spec-status.sh.bak +0 -163
- package/plugins/specweave/hooks/post-first-increment.sh.backup +0 -61
- package/plugins/specweave/hooks/post-first-increment.sh.bak +0 -61
- package/plugins/specweave/hooks/post-increment-change.sh.backup +0 -98
- package/plugins/specweave/hooks/post-increment-completion.sh.backup +0 -231
- package/plugins/specweave/hooks/post-increment-planning.sh.backup +0 -1048
- package/plugins/specweave/hooks/post-increment-status-change.sh.backup +0 -147
- package/plugins/specweave/hooks/post-spec-update.sh.backup +0 -158
- package/plugins/specweave/hooks/post-spec-update.sh.bak +0 -158
- package/plugins/specweave/hooks/post-user-story-complete.sh.backup +0 -179
- package/plugins/specweave/hooks/post-user-story-complete.sh.bak +0 -179
- package/plugins/specweave/hooks/pre-command-deduplication.sh.backup +0 -83
- package/plugins/specweave/hooks/pre-command-deduplication.sh.bak +0 -83
- package/plugins/specweave/hooks/pre-implementation.sh.backup +0 -67
- package/plugins/specweave/hooks/pre-task-completion.sh.backup +0 -194
- package/plugins/specweave/hooks/pre-tool-use.sh.backup +0 -133
- package/plugins/specweave/hooks/user-prompt-submit.sh.backup +0 -386
- package/plugins/specweave/hooks/user-prompt-submit.sh.bak +0 -386
- package/plugins/specweave/lib/hooks/auto-transition.js.bak +0 -50
- package/plugins/specweave/lib/hooks/auto-transition.ts.bak +0 -84
- package/plugins/specweave/lib/hooks/git-diff-analyzer.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/git-diff-analyzer.d.ts.bak +0 -89
- package/plugins/specweave/lib/hooks/git-diff-analyzer.js.bak +0 -142
- package/plugins/specweave/lib/hooks/git-diff-analyzer.ts.bak +0 -269
- package/plugins/specweave/lib/hooks/invoke-translator-skill.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/invoke-translator-skill.d.ts.bak +0 -60
- package/plugins/specweave/lib/hooks/invoke-translator-skill.js.bak +0 -155
- package/plugins/specweave/lib/hooks/invoke-translator-skill.ts.bak +0 -264
- package/plugins/specweave/lib/hooks/prepare-reflection-context.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/prepare-reflection-context.d.ts.bak +0 -42
- package/plugins/specweave/lib/hooks/prepare-reflection-context.js.bak +0 -110
- package/plugins/specweave/lib/hooks/prepare-reflection-context.ts.bak +0 -178
- package/plugins/specweave/lib/hooks/reflection-config-loader.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/reflection-config-loader.d.ts.bak +0 -45
- package/plugins/specweave/lib/hooks/reflection-config-loader.js.bak +0 -92
- package/plugins/specweave/lib/hooks/reflection-config-loader.ts.bak +0 -156
- package/plugins/specweave/lib/hooks/reflection-parser.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/reflection-parser.d.ts.bak +0 -33
- package/plugins/specweave/lib/hooks/reflection-parser.js.bak +0 -301
- package/plugins/specweave/lib/hooks/reflection-parser.ts.bak +0 -484
- package/plugins/specweave/lib/hooks/reflection-prompt-builder.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/reflection-prompt-builder.d.ts.bak +0 -56
- package/plugins/specweave/lib/hooks/reflection-prompt-builder.js.bak +0 -182
- package/plugins/specweave/lib/hooks/reflection-prompt-builder.ts.bak +0 -306
- package/plugins/specweave/lib/hooks/reflection-storage.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/reflection-storage.d.ts.bak +0 -64
- package/plugins/specweave/lib/hooks/reflection-storage.js.bak +0 -231
- package/plugins/specweave/lib/hooks/reflection-storage.ts.bak +0 -369
- package/plugins/specweave/lib/hooks/run-self-reflection.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/run-self-reflection.d.ts.bak +0 -43
- package/plugins/specweave/lib/hooks/run-self-reflection.js.bak +0 -132
- package/plugins/specweave/lib/hooks/run-self-reflection.ts.bak +0 -258
- package/plugins/specweave/lib/hooks/sync-cache.js.bak +0 -294
- package/plugins/specweave/lib/hooks/sync-living-docs.d.js.bak +0 -1
- package/plugins/specweave/lib/hooks/sync-living-docs.d.ts.bak +0 -27
- package/plugins/specweave/lib/hooks/sync-living-docs.js.bak +0 -339
- package/plugins/specweave/lib/hooks/sync-us-tasks.js.bak +0 -476
- package/plugins/specweave/lib/hooks/translate-file.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/translate-file.d.ts.bak +0 -59
- package/plugins/specweave/lib/hooks/translate-file.js.bak +0 -289
- package/plugins/specweave/lib/hooks/translate-file.ts.bak +0 -428
- package/plugins/specweave/lib/hooks/translate-living-docs.d.js.bak +0 -0
- package/plugins/specweave/lib/hooks/translate-living-docs.d.ts.bak +0 -13
- package/plugins/specweave/lib/hooks/translate-living-docs.js.bak +0 -119
- package/plugins/specweave/lib/hooks/translate-living-docs.ts.bak +0 -224
- package/plugins/specweave/lib/hooks/update-ac-status.js.bak +0 -51
- package/plugins/specweave/lib/hooks/update-ac-status.ts.bak +0 -103
- package/plugins/specweave/lib/hooks/update-tasks-md.d.js.bak +0 -1
- package/plugins/specweave/lib/hooks/update-tasks-md.d.ts.bak +0 -29
- package/plugins/specweave/lib/hooks/update-tasks-md.js.bak +0 -296
- package/plugins/specweave/lib/hooks/update-tasks-md.ts.bak +0 -489
- package/plugins/specweave-ado/hooks/post-living-docs-update.sh.backup +0 -353
- package/plugins/specweave-ado/hooks/post-task-completion.sh.backup +0 -172
- package/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -170
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +0 -228
- package/plugins/specweave-github/hooks/post-task-completion.sh.backup +0 -258
- package/plugins/specweave-jira/hooks/post-task-completion.sh.backup +0 -172
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +0 -444
- package/plugins/specweave-release/hooks/post-task-completion.sh.backup +0 -110
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Provider Implementation
|
|
3
|
+
*
|
|
4
|
+
* Implements GitProvider interface for GitHub.com and GitHub Enterprise.
|
|
5
|
+
* Handles repository validation, creation, and management via GitHub API.
|
|
6
|
+
*
|
|
7
|
+
* @module providers/github-provider
|
|
8
|
+
*/
|
|
9
|
+
import { BaseGitProvider } from '../git-provider.js';
|
|
10
|
+
import { getActionableError, formatActionableError } from '../git-error-handler.js';
|
|
11
|
+
/**
|
|
12
|
+
* GitHub Provider
|
|
13
|
+
*
|
|
14
|
+
* Implements Git operations for GitHub platform.
|
|
15
|
+
*/
|
|
16
|
+
export class GitHubProvider extends BaseGitProvider {
|
|
17
|
+
constructor(config) {
|
|
18
|
+
super({
|
|
19
|
+
type: 'github',
|
|
20
|
+
name: 'GitHub',
|
|
21
|
+
host: config?.host || 'github.com',
|
|
22
|
+
apiBaseUrl: config?.apiBaseUrl || 'https://api.github.com',
|
|
23
|
+
selfHosted: config?.selfHosted || false,
|
|
24
|
+
customDomain: config?.customDomain
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validate if a repository exists on GitHub
|
|
29
|
+
*/
|
|
30
|
+
async validateRepository(owner, repo, token) {
|
|
31
|
+
try {
|
|
32
|
+
const headers = {
|
|
33
|
+
'Accept': 'application/vnd.github.v3+json'
|
|
34
|
+
};
|
|
35
|
+
if (token) {
|
|
36
|
+
headers['Authorization'] = `token ${token}`;
|
|
37
|
+
}
|
|
38
|
+
const response = await fetch(this.getApiUrl(`/repos/${owner}/${repo}`), { headers });
|
|
39
|
+
if (response.status === 404) {
|
|
40
|
+
// Repository does not exist (good for creation)
|
|
41
|
+
return { exists: false, valid: true };
|
|
42
|
+
}
|
|
43
|
+
if (response.status === 200) {
|
|
44
|
+
// Repository already exists
|
|
45
|
+
const data = await response.json();
|
|
46
|
+
return {
|
|
47
|
+
exists: true,
|
|
48
|
+
valid: true,
|
|
49
|
+
url: data.html_url
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (response.status === 401 || response.status === 403) {
|
|
53
|
+
// Authentication or permission error
|
|
54
|
+
const apiError = {
|
|
55
|
+
status: response.status,
|
|
56
|
+
message: response.statusText,
|
|
57
|
+
platform: 'github',
|
|
58
|
+
operation: 'validate_repo',
|
|
59
|
+
resourceType: 'repository',
|
|
60
|
+
resourceName: `${owner}/${repo}`
|
|
61
|
+
};
|
|
62
|
+
const actionable = getActionableError(apiError);
|
|
63
|
+
return { exists: false, valid: false, error: formatActionableError(actionable) };
|
|
64
|
+
}
|
|
65
|
+
// Other error
|
|
66
|
+
const apiError = {
|
|
67
|
+
status: response.status,
|
|
68
|
+
message: response.statusText,
|
|
69
|
+
platform: 'github',
|
|
70
|
+
operation: 'validate_repo',
|
|
71
|
+
resourceType: 'repository',
|
|
72
|
+
resourceName: `${owner}/${repo}`
|
|
73
|
+
};
|
|
74
|
+
const actionable = getActionableError(apiError);
|
|
75
|
+
return {
|
|
76
|
+
exists: false,
|
|
77
|
+
valid: false,
|
|
78
|
+
error: formatActionableError(actionable)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return {
|
|
83
|
+
exists: false,
|
|
84
|
+
valid: false,
|
|
85
|
+
error: `Network error: ${error instanceof Error ? error.message : String(error)}`
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Validate if a GitHub owner (user or organization) exists
|
|
91
|
+
*/
|
|
92
|
+
async validateOwner(owner, token) {
|
|
93
|
+
const headers = {
|
|
94
|
+
'Accept': 'application/vnd.github.v3+json'
|
|
95
|
+
};
|
|
96
|
+
if (token) {
|
|
97
|
+
headers['Authorization'] = `token ${token}`;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
// Try as user first
|
|
101
|
+
const userResponse = await fetch(this.getApiUrl(`/users/${owner}`), { headers });
|
|
102
|
+
if (userResponse.status === 200) {
|
|
103
|
+
const data = await userResponse.json();
|
|
104
|
+
const type = data.type === 'Organization' ? 'organization' : 'user';
|
|
105
|
+
return { valid: true, type };
|
|
106
|
+
}
|
|
107
|
+
// Try as organization
|
|
108
|
+
const orgResponse = await fetch(this.getApiUrl(`/orgs/${owner}`), { headers });
|
|
109
|
+
if (orgResponse.status === 200) {
|
|
110
|
+
return { valid: true, type: 'organization' };
|
|
111
|
+
}
|
|
112
|
+
// Not found
|
|
113
|
+
const apiError = {
|
|
114
|
+
status: 404,
|
|
115
|
+
message: 'Not Found',
|
|
116
|
+
platform: 'github',
|
|
117
|
+
operation: 'validate_owner',
|
|
118
|
+
resourceType: 'user',
|
|
119
|
+
resourceName: owner
|
|
120
|
+
};
|
|
121
|
+
const actionable = getActionableError(apiError);
|
|
122
|
+
return { valid: false, error: formatActionableError(actionable) };
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
return {
|
|
126
|
+
valid: false,
|
|
127
|
+
error: `Network error: ${error instanceof Error ? error.message : String(error)}`
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Create a new repository on GitHub
|
|
133
|
+
*/
|
|
134
|
+
async createRepository(options, token) {
|
|
135
|
+
// Check if it's an organization or user
|
|
136
|
+
const isOrg = await this.isOrganization(options.owner, token);
|
|
137
|
+
const endpoint = isOrg
|
|
138
|
+
? this.getApiUrl(`/orgs/${options.owner}/repos`)
|
|
139
|
+
: this.getApiUrl('/user/repos');
|
|
140
|
+
const response = await fetch(endpoint, {
|
|
141
|
+
method: 'POST',
|
|
142
|
+
headers: {
|
|
143
|
+
'Authorization': `token ${token}`,
|
|
144
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
145
|
+
'Content-Type': 'application/json'
|
|
146
|
+
},
|
|
147
|
+
body: JSON.stringify({
|
|
148
|
+
name: options.name,
|
|
149
|
+
description: options.description,
|
|
150
|
+
private: options.visibility === 'private',
|
|
151
|
+
auto_init: options.autoInit || false,
|
|
152
|
+
has_issues: options.hasIssues !== false,
|
|
153
|
+
has_wiki: options.hasWiki || false
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
if (!response.ok) {
|
|
157
|
+
const error = await response.json();
|
|
158
|
+
// Handle "already exists" error
|
|
159
|
+
if (error.errors?.[0]?.message?.includes('already exists')) {
|
|
160
|
+
// Repository already exists, return URL
|
|
161
|
+
return `https://${this.config.host}/${options.owner}/${options.name}`;
|
|
162
|
+
}
|
|
163
|
+
// Handle other errors with actionable messages
|
|
164
|
+
const apiError = {
|
|
165
|
+
status: response.status,
|
|
166
|
+
message: error.message || response.statusText,
|
|
167
|
+
platform: 'github',
|
|
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.html_url;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Check if an account is an organization
|
|
180
|
+
*/
|
|
181
|
+
async isOrganization(account, token) {
|
|
182
|
+
try {
|
|
183
|
+
const headers = {
|
|
184
|
+
'Accept': 'application/vnd.github.v3+json'
|
|
185
|
+
};
|
|
186
|
+
if (token) {
|
|
187
|
+
headers['Authorization'] = `token ${token}`;
|
|
188
|
+
}
|
|
189
|
+
const response = await fetch(this.getApiUrl(`/users/${account}`), { headers });
|
|
190
|
+
if (response.ok) {
|
|
191
|
+
const data = await response.json();
|
|
192
|
+
return data.type === 'Organization';
|
|
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}/settings/tokens/new`;
|
|
206
|
+
}
|
|
207
|
+
return 'https://github.com/settings/tokens/new';
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get required token scopes
|
|
211
|
+
*/
|
|
212
|
+
getRequiredScopes(isOrganization) {
|
|
213
|
+
const scopes = ['repo'];
|
|
214
|
+
if (isOrganization) {
|
|
215
|
+
scopes.push('admin:org');
|
|
216
|
+
}
|
|
217
|
+
return scopes;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Override getAuthHeaders for GitHub-specific auth
|
|
221
|
+
*/
|
|
222
|
+
getAuthHeaders(token) {
|
|
223
|
+
return {
|
|
224
|
+
'Authorization': `token ${token}`,
|
|
225
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
226
|
+
'Content-Type': 'application/json'
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Create a GitHub provider instance
|
|
232
|
+
*
|
|
233
|
+
* @param config - Optional platform configuration
|
|
234
|
+
* @returns GitHub provider instance
|
|
235
|
+
*/
|
|
236
|
+
export function createGitHubProvider(config) {
|
|
237
|
+
return new GitHubProvider(config);
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=github-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-provider.js","sourceRoot":"","sources":["../../../../../src/core/repo-structure/providers/github-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;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,eAAe;IACjD,YAAY,MAAgC;QAC1C,KAAK,CAAC;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,YAAY;YAClC,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,wBAAwB;YAC1D,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,KAAK;YACvC,YAAY,EAAE,MAAM,EAAE,YAAY;SACnC,CAAC,CAAC;IAC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AAE,CAAC;YAC3B,OAAO,WAAW,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,sBAAsB,CAAC;QACvF,CAAC;QACD,OAAO,wCAAwC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,cAAwB;QACxC,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,KAAa;QACpC,OAAO;YACL,eAAe,EAAE,SAAS,KAAK,EAAE;YACjC,QAAQ,EAAE,gCAAgC;YAC1C,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAgC;IACnE,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitLab Provider Implementation (STUB)
|
|
3
|
+
*
|
|
4
|
+
* Stub implementation for GitLab.com and self-hosted GitLab instances.
|
|
5
|
+
* Full implementation coming soon!
|
|
6
|
+
*
|
|
7
|
+
* @module providers/gitlab-provider
|
|
8
|
+
*/
|
|
9
|
+
import { BaseGitProvider, type PlatformConfig, type RepoValidationResult, type OwnerValidationResult, type CreateRepoOptions } from '../git-provider.js';
|
|
10
|
+
/**
|
|
11
|
+
* GitLab Provider (Stub)
|
|
12
|
+
*
|
|
13
|
+
* Placeholder implementation for GitLab support.
|
|
14
|
+
*/
|
|
15
|
+
export declare class GitLabProvider extends BaseGitProvider {
|
|
16
|
+
constructor(config?: Partial<PlatformConfig>);
|
|
17
|
+
/**
|
|
18
|
+
* Validate repository (stub)
|
|
19
|
+
*/
|
|
20
|
+
validateRepository(owner: string, repo: string, token?: string): Promise<RepoValidationResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Validate owner (stub)
|
|
23
|
+
*/
|
|
24
|
+
validateOwner(owner: string, token?: string): Promise<OwnerValidationResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Create repository (stub)
|
|
27
|
+
*/
|
|
28
|
+
createRepository(options: CreateRepoOptions, token: string): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if organization (stub)
|
|
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 GitLab-specific auth (PRIVATE-TOKEN)
|
|
43
|
+
*/
|
|
44
|
+
protected getAuthHeaders(token: string): Record<string, string>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create a GitLab provider instance
|
|
48
|
+
*/
|
|
49
|
+
export declare function createGitLabProvider(config?: Partial<PlatformConfig>): GitLabProvider;
|
|
50
|
+
//# sourceMappingURL=gitlab-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-provider.d.ts","sourceRoot":"","sources":["../../../../../src/core/repo-structure/providers/gitlab-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;AAEzJ;;;;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;IAmBhC;;OAEG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;OAEG;IACG,gBAAgB,CACpB,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC;IAIlB;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvE;;OAEG;IACH,WAAW,IAAI,MAAM;IAOrB;;OAEG;IACH,iBAAiB,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE;IAIrD;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAOhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAErF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitLab Provider Implementation (STUB)
|
|
3
|
+
*
|
|
4
|
+
* Stub implementation for GitLab.com and self-hosted GitLab instances.
|
|
5
|
+
* Full implementation coming soon!
|
|
6
|
+
*
|
|
7
|
+
* @module providers/gitlab-provider
|
|
8
|
+
*/
|
|
9
|
+
import { BaseGitProvider } from '../git-provider.js';
|
|
10
|
+
/**
|
|
11
|
+
* GitLab Provider (Stub)
|
|
12
|
+
*
|
|
13
|
+
* Placeholder implementation for GitLab support.
|
|
14
|
+
*/
|
|
15
|
+
export class GitLabProvider extends BaseGitProvider {
|
|
16
|
+
constructor(config) {
|
|
17
|
+
super({
|
|
18
|
+
type: 'gitlab',
|
|
19
|
+
name: 'GitLab',
|
|
20
|
+
host: config?.host || 'gitlab.com',
|
|
21
|
+
apiBaseUrl: config?.apiBaseUrl || 'https://gitlab.com/api/v4',
|
|
22
|
+
selfHosted: config?.selfHosted || false,
|
|
23
|
+
customDomain: config?.customDomain
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Validate repository (stub)
|
|
28
|
+
*/
|
|
29
|
+
async validateRepository(owner, repo, token) {
|
|
30
|
+
throw new Error(`
|
|
31
|
+
❌ GitLab Support Coming Soon!
|
|
32
|
+
|
|
33
|
+
GitLab integration is not yet implemented.
|
|
34
|
+
Currently, only GitHub is fully supported.
|
|
35
|
+
|
|
36
|
+
🔜 What's coming:
|
|
37
|
+
• GitLab.com and self-hosted GitLab support
|
|
38
|
+
• Project validation and creation
|
|
39
|
+
• Group/namespace support
|
|
40
|
+
• SSH and HTTPS remote URLs
|
|
41
|
+
|
|
42
|
+
For now, please use GitHub or wait for the next SpecWeave release.
|
|
43
|
+
|
|
44
|
+
📖 Track progress: https://github.com/anton-abyzov/specweave/issues
|
|
45
|
+
`.trim());
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Validate owner (stub)
|
|
49
|
+
*/
|
|
50
|
+
async validateOwner(owner, token) {
|
|
51
|
+
throw new Error('GitLab support coming soon! Please use GitHub for now.');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create repository (stub)
|
|
55
|
+
*/
|
|
56
|
+
async createRepository(options, token) {
|
|
57
|
+
throw new Error('GitLab support coming soon! Please use GitHub for now.');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if organization (stub)
|
|
61
|
+
*/
|
|
62
|
+
async isOrganization(account, token) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get token creation URL
|
|
67
|
+
*/
|
|
68
|
+
getTokenUrl() {
|
|
69
|
+
if (this.config.selfHosted) {
|
|
70
|
+
return `https://${this.config.customDomain || this.config.host}/-/profile/personal_access_tokens`;
|
|
71
|
+
}
|
|
72
|
+
return 'https://gitlab.com/-/profile/personal_access_tokens';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get required token scopes
|
|
76
|
+
*/
|
|
77
|
+
getRequiredScopes(isOrganization) {
|
|
78
|
+
return ['api', 'read_repository', 'write_repository'];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Override getAuthHeaders for GitLab-specific auth (PRIVATE-TOKEN)
|
|
82
|
+
*/
|
|
83
|
+
getAuthHeaders(token) {
|
|
84
|
+
return {
|
|
85
|
+
'PRIVATE-TOKEN': token,
|
|
86
|
+
'Accept': 'application/json',
|
|
87
|
+
'Content-Type': 'application/json'
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a GitLab provider instance
|
|
93
|
+
*/
|
|
94
|
+
export function createGitLabProvider(config) {
|
|
95
|
+
return new GitLabProvider(config);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=gitlab-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-provider.js","sourceRoot":"","sources":["../../../../../src/core/repo-structure/providers/gitlab-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAsG,MAAM,oBAAoB,CAAC;AAEzJ;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,eAAe;IACjD,YAAY,MAAgC;QAC1C,KAAK,CAAC;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,YAAY;YAClC,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,2BAA2B;YAC7D,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,KAAK;YACvC,YAAY,EAAE,MAAM,EAAE,YAAY;SACnC,CAAC,CAAC;IACL,CAAC;IAED;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
+
* initialization functions.
|
|
6
|
+
*
|
|
7
|
+
* @module providers
|
|
8
|
+
*/
|
|
9
|
+
export { GitHubProvider, createGitHubProvider } from './github-provider.js';
|
|
10
|
+
export { GitLabProvider, createGitLabProvider } from './gitlab-provider.js';
|
|
11
|
+
export { BitbucketProvider, createBitbucketProvider } from './bitbucket-provider.js';
|
|
12
|
+
/**
|
|
13
|
+
* Initialize and register all Git providers
|
|
14
|
+
*
|
|
15
|
+
* Call this once during application initialization to make
|
|
16
|
+
* all providers available through the platform registry.
|
|
17
|
+
*
|
|
18
|
+
* Idempotent: Safe to call multiple times - only initializes once.
|
|
19
|
+
*/
|
|
20
|
+
export declare function initializeProviders(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Reset provider initialization state (for testing only)
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare function resetProviders(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get provider by platform type (convenience function)
|
|
28
|
+
*
|
|
29
|
+
* @param platform - Platform type
|
|
30
|
+
* @returns Provider instance or undefined
|
|
31
|
+
*/
|
|
32
|
+
export declare function getProvider(platform: 'github' | 'gitlab' | 'bitbucket'): import("../git-provider.js").GitProvider;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/repo-structure/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAarF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAkB1C;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,4CAGtE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Providers Index
|
|
3
|
+
*
|
|
4
|
+
* Exports all Git provider implementations and provides
|
|
5
|
+
* initialization functions.
|
|
6
|
+
*
|
|
7
|
+
* @module providers
|
|
8
|
+
*/
|
|
9
|
+
export { GitHubProvider, createGitHubProvider } from './github-provider.js';
|
|
10
|
+
export { GitLabProvider, createGitLabProvider } from './gitlab-provider.js';
|
|
11
|
+
export { BitbucketProvider, createBitbucketProvider } from './bitbucket-provider.js';
|
|
12
|
+
import { getPlatformRegistry } from '../platform-registry.js';
|
|
13
|
+
import { createGitHubProvider } from './github-provider.js';
|
|
14
|
+
import { createGitLabProvider } from './gitlab-provider.js';
|
|
15
|
+
import { createBitbucketProvider } from './bitbucket-provider.js';
|
|
16
|
+
/**
|
|
17
|
+
* Track whether providers have been initialized
|
|
18
|
+
* Prevents re-initialization in long-running sessions (Issue #2 fix)
|
|
19
|
+
*/
|
|
20
|
+
let providersInitialized = false;
|
|
21
|
+
/**
|
|
22
|
+
* Initialize and register all Git providers
|
|
23
|
+
*
|
|
24
|
+
* Call this once during application initialization to make
|
|
25
|
+
* all providers available through the platform registry.
|
|
26
|
+
*
|
|
27
|
+
* Idempotent: Safe to call multiple times - only initializes once.
|
|
28
|
+
*/
|
|
29
|
+
export function initializeProviders() {
|
|
30
|
+
// Idempotency guard: prevent re-initialization (Issue #2 fix)
|
|
31
|
+
if (providersInitialized) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const registry = getPlatformRegistry();
|
|
35
|
+
// Register GitHub provider (fully supported)
|
|
36
|
+
registry.registerProvider('github', createGitHubProvider());
|
|
37
|
+
// Register GitLab provider (stub - coming soon)
|
|
38
|
+
registry.registerProvider('gitlab', createGitLabProvider());
|
|
39
|
+
// Register Bitbucket provider (stub - coming soon)
|
|
40
|
+
registry.registerProvider('bitbucket', createBitbucketProvider());
|
|
41
|
+
providersInitialized = true;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Reset provider initialization state (for testing only)
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export function resetProviders() {
|
|
48
|
+
providersInitialized = false;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get provider by platform type (convenience function)
|
|
52
|
+
*
|
|
53
|
+
* @param platform - Platform type
|
|
54
|
+
* @returns Provider instance or undefined
|
|
55
|
+
*/
|
|
56
|
+
export function getProvider(platform) {
|
|
57
|
+
const registry = getPlatformRegistry();
|
|
58
|
+
return registry.getProvider(platform);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/repo-structure/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;;GAGG;AACH,IAAI,oBAAoB,GAAG,KAAK,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB;IACjC,8DAA8D;IAC9D,IAAI,oBAAoB,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IAEvC,6CAA6C;IAC7C,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAE5D,gDAAgD;IAChD,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAE5D,mDAAmD;IACnD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,uBAAuB,EAAE,CAAC,CAAC;IAElE,oBAAoB,GAAG,IAAI,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,oBAAoB,GAAG,KAAK,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,QAA2C;IACrE,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IACvC,OAAO,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repository Bulk Discovery Helper
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to bulk-discover and filter GitHub repositories
|
|
5
|
+
* during the SpecWeave init flow, optimizing repository configuration
|
|
6
|
+
* for users with many repositories.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Bulk import all repos from owner/organization
|
|
10
|
+
* - Pattern matching (starts-with, ends-with, contains)
|
|
11
|
+
* - Regex matching (advanced filtering)
|
|
12
|
+
* - Preview and confirmation before auto-populating configs
|
|
13
|
+
*/
|
|
14
|
+
import { Octokit } from '@octokit/rest';
|
|
15
|
+
export interface DiscoveredRepo {
|
|
16
|
+
name: string;
|
|
17
|
+
full_name: string;
|
|
18
|
+
owner: string;
|
|
19
|
+
description: string | null;
|
|
20
|
+
private: boolean;
|
|
21
|
+
updated_at: string;
|
|
22
|
+
}
|
|
23
|
+
export interface BulkDiscoveryResult {
|
|
24
|
+
repositories: DiscoveredRepo[];
|
|
25
|
+
strategy: 'manual' | 'all-repos' | 'pattern' | 'regex';
|
|
26
|
+
pattern?: string;
|
|
27
|
+
source?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Main bulk discovery flow
|
|
31
|
+
*/
|
|
32
|
+
export declare function discoverRepositories(octokit: Octokit, owner: string, isOrg: boolean, expectedCount: number): Promise<BulkDiscoveryResult | null>;
|
|
33
|
+
//# sourceMappingURL=repo-bulk-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-bulk-discovery.d.ts","sourceRoot":"","sources":["../../../../src/core/repo-structure/repo-bulk-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKxC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAgID;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CA6KrC"}
|