specweave 0.15.1 ā 0.16.2
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 +38 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +162 -3
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/helpers/github/increment-profile-selector.d.ts +47 -0
- package/dist/cli/helpers/github/increment-profile-selector.d.ts.map +1 -0
- package/dist/cli/helpers/github/increment-profile-selector.js +186 -0
- package/dist/cli/helpers/github/increment-profile-selector.js.map +1 -0
- package/dist/cli/helpers/github/profile-manager.d.ts +119 -0
- package/dist/cli/helpers/github/profile-manager.d.ts.map +1 -0
- package/dist/cli/helpers/github/profile-manager.js +311 -0
- package/dist/cli/helpers/github/profile-manager.js.map +1 -0
- package/dist/cli/helpers/issue-tracker/github-multi-repo.d.ts +81 -0
- package/dist/cli/helpers/issue-tracker/github-multi-repo.d.ts.map +1 -0
- package/dist/cli/helpers/issue-tracker/github-multi-repo.js +385 -0
- package/dist/cli/helpers/issue-tracker/github-multi-repo.js.map +1 -0
- package/dist/cli/helpers/issue-tracker/github.d.ts +13 -0
- package/dist/cli/helpers/issue-tracker/github.d.ts.map +1 -1
- package/dist/cli/helpers/issue-tracker/github.js +38 -143
- package/dist/cli/helpers/issue-tracker/github.js.map +1 -1
- package/dist/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/cli/helpers/issue-tracker/index.js +126 -43
- package/dist/cli/helpers/issue-tracker/index.js.map +1 -1
- package/dist/cli/helpers/issue-tracker/utils.d.ts +8 -0
- package/dist/cli/helpers/issue-tracker/utils.d.ts.map +1 -1
- package/dist/cli/helpers/issue-tracker/utils.js +46 -0
- package/dist/cli/helpers/issue-tracker/utils.js.map +1 -1
- package/dist/core/increment/active-increment-manager.d.ts +79 -0
- package/dist/core/increment/active-increment-manager.d.ts.map +1 -0
- package/dist/core/increment/active-increment-manager.js +153 -0
- package/dist/core/increment/active-increment-manager.js.map +1 -0
- package/dist/core/increment/metadata-manager.d.ts +2 -0
- package/dist/core/increment/metadata-manager.d.ts.map +1 -1
- package/dist/core/increment/metadata-manager.js +15 -0
- package/dist/core/increment/metadata-manager.js.map +1 -1
- package/dist/utils/git-detector.d.ts +84 -0
- package/dist/utils/git-detector.d.ts.map +1 -0
- package/dist/utils/git-detector.js +233 -0
- package/dist/utils/git-detector.js.map +1 -0
- package/package.json +2 -2
- package/plugins/specweave/commands/specweave-done.md +109 -1
- package/plugins/specweave/hooks/lib/update-status-line.sh +30 -4
- package/plugins/specweave/hooks/post-increment-planning.sh +50 -5
- package/plugins/specweave/hooks/user-prompt-submit.sh +77 -21
- package/plugins/specweave/skills/increment-planner/SKILL.md +12 -5
- package/plugins/specweave/skills/increment-planner/scripts/feature-utils.js +26 -5
- package/plugins/specweave-ado/skills/ado-sync/SKILL.md +2 -2
- package/plugins/specweave-figma/ARCHITECTURE.md +1 -1
- package/plugins/specweave-figma/README.md +1 -1
- package/plugins/specweave-ml/README.md +1 -1
- package/src/templates/CLAUDE.md.template +8 -9
- package/plugins/specweave-github/hooks/post-increment-done.sh +0 -224
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Increment Profile Selector
|
|
3
|
+
*
|
|
4
|
+
* Handles profile selection when creating new increments
|
|
5
|
+
* in multi-repository projects
|
|
6
|
+
*
|
|
7
|
+
* @module cli/helpers/github/increment-profile-selector
|
|
8
|
+
*/
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import { GitHubProfileManager } from './profile-manager.js';
|
|
13
|
+
/**
|
|
14
|
+
* Select GitHub profile for an increment
|
|
15
|
+
*
|
|
16
|
+
* @param projectPath - Path to project root
|
|
17
|
+
* @param incrementId - Increment identifier
|
|
18
|
+
* @returns Selected profile ID or null
|
|
19
|
+
*/
|
|
20
|
+
export async function selectProfileForIncrement(projectPath, incrementId) {
|
|
21
|
+
const manager = new GitHubProfileManager(projectPath);
|
|
22
|
+
// Check if profiles exist
|
|
23
|
+
if (!manager.hasProfiles()) {
|
|
24
|
+
console.log(chalk.gray('No GitHub profiles configured - skipping repository selection'));
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const profileCount = manager.getProfileCount();
|
|
28
|
+
// If only one profile, auto-select it
|
|
29
|
+
if (profileCount === 1) {
|
|
30
|
+
const profile = manager.getActiveProfile();
|
|
31
|
+
if (profile) {
|
|
32
|
+
console.log(chalk.gray(`Using GitHub repository: ${profile.config.owner}/${profile.config.repo}`));
|
|
33
|
+
return profile.id;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Multiple profiles - prompt for selection
|
|
37
|
+
console.log(chalk.cyan('\nšÆ Repository Selection\n'));
|
|
38
|
+
console.log(chalk.gray(`Select the GitHub repository for increment ${incrementId}:\n`));
|
|
39
|
+
const profile = await manager.selectProfile(`Which repository should '${incrementId}' sync to?`);
|
|
40
|
+
if (profile) {
|
|
41
|
+
console.log(chalk.green(`ā Selected: ${profile.displayName} (${profile.config.owner}/${profile.config.repo})\n`));
|
|
42
|
+
return profile.id;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Save profile selection to increment metadata
|
|
48
|
+
*
|
|
49
|
+
* @param projectPath - Path to project root
|
|
50
|
+
* @param incrementId - Increment identifier
|
|
51
|
+
* @param profileId - Selected profile ID
|
|
52
|
+
*/
|
|
53
|
+
export async function saveIncrementProfile(projectPath, incrementId, profileId) {
|
|
54
|
+
const metadataPath = path.join(projectPath, '.specweave', 'increments', incrementId, 'metadata.json');
|
|
55
|
+
let metadata;
|
|
56
|
+
// Load existing metadata or create new
|
|
57
|
+
if (fs.existsSync(metadataPath)) {
|
|
58
|
+
const content = fs.readFileSync(metadataPath, 'utf-8');
|
|
59
|
+
metadata = JSON.parse(content);
|
|
60
|
+
metadata.githubProfile = profileId;
|
|
61
|
+
metadata.updatedAt = new Date().toISOString();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
metadata = {
|
|
65
|
+
incrementId,
|
|
66
|
+
githubProfile: profileId,
|
|
67
|
+
createdAt: new Date().toISOString(),
|
|
68
|
+
updatedAt: new Date().toISOString()
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// Ensure directory exists
|
|
72
|
+
const dir = path.dirname(metadataPath);
|
|
73
|
+
if (!fs.existsSync(dir)) {
|
|
74
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
75
|
+
}
|
|
76
|
+
// Save metadata
|
|
77
|
+
fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2) + '\n');
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get profile for an existing increment
|
|
81
|
+
*
|
|
82
|
+
* @param projectPath - Path to project root
|
|
83
|
+
* @param incrementId - Increment identifier
|
|
84
|
+
* @returns Profile ID or null
|
|
85
|
+
*/
|
|
86
|
+
export function getIncrementProfile(projectPath, incrementId) {
|
|
87
|
+
const metadataPath = path.join(projectPath, '.specweave', 'increments', incrementId, 'metadata.json');
|
|
88
|
+
if (!fs.existsSync(metadataPath)) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
const content = fs.readFileSync(metadataPath, 'utf-8');
|
|
93
|
+
const metadata = JSON.parse(content);
|
|
94
|
+
return metadata.githubProfile || null;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error(chalk.red(`Failed to read increment metadata: ${error}`));
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Prompt to change profile for an increment
|
|
103
|
+
*
|
|
104
|
+
* @param projectPath - Path to project root
|
|
105
|
+
* @param incrementId - Increment identifier
|
|
106
|
+
* @returns New profile ID or null
|
|
107
|
+
*/
|
|
108
|
+
export async function changeIncrementProfile(projectPath, incrementId) {
|
|
109
|
+
const manager = new GitHubProfileManager(projectPath);
|
|
110
|
+
const currentProfileId = getIncrementProfile(projectPath, incrementId);
|
|
111
|
+
if (!manager.hasProfiles()) {
|
|
112
|
+
console.log(chalk.yellow('No GitHub profiles configured'));
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
// Show current profile
|
|
116
|
+
if (currentProfileId) {
|
|
117
|
+
const currentProfile = manager.getProfile(currentProfileId);
|
|
118
|
+
if (currentProfile) {
|
|
119
|
+
console.log(chalk.gray(`Current repository: ${currentProfile.displayName} (${currentProfile.config.owner}/${currentProfile.config.repo})`));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
console.log(chalk.gray('No repository currently selected'));
|
|
124
|
+
}
|
|
125
|
+
// Prompt for new profile
|
|
126
|
+
const newProfile = await manager.selectProfile('Select new repository:');
|
|
127
|
+
if (newProfile && newProfile.id !== currentProfileId) {
|
|
128
|
+
await saveIncrementProfile(projectPath, incrementId, newProfile.id);
|
|
129
|
+
console.log(chalk.green(`ā Changed to: ${newProfile.displayName}`));
|
|
130
|
+
return newProfile.id;
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* List all increments grouped by profile
|
|
136
|
+
*
|
|
137
|
+
* @param projectPath - Path to project root
|
|
138
|
+
*/
|
|
139
|
+
export function listIncrementsByProfile(projectPath) {
|
|
140
|
+
const manager = new GitHubProfileManager(projectPath);
|
|
141
|
+
const incrementsDir = path.join(projectPath, '.specweave', 'increments');
|
|
142
|
+
if (!fs.existsSync(incrementsDir)) {
|
|
143
|
+
console.log(chalk.yellow('No increments found'));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
// Build profile map
|
|
147
|
+
const profileMap = new Map();
|
|
148
|
+
const noProfile = [];
|
|
149
|
+
// Scan all increments
|
|
150
|
+
const increments = fs.readdirSync(incrementsDir)
|
|
151
|
+
.filter(dir => dir.match(/^\d{4}-/)); // Only numbered increments
|
|
152
|
+
for (const incrementId of increments) {
|
|
153
|
+
const profileId = getIncrementProfile(projectPath, incrementId);
|
|
154
|
+
if (profileId) {
|
|
155
|
+
if (!profileMap.has(profileId)) {
|
|
156
|
+
profileMap.set(profileId, []);
|
|
157
|
+
}
|
|
158
|
+
profileMap.get(profileId).push(incrementId);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
noProfile.push(incrementId);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Display results
|
|
165
|
+
console.log(chalk.cyan('\nIncrements by Repository:\n'));
|
|
166
|
+
// Show mapped increments
|
|
167
|
+
for (const [profileId, incrementIds] of profileMap) {
|
|
168
|
+
const profile = manager.getProfile(profileId);
|
|
169
|
+
if (profile) {
|
|
170
|
+
console.log(chalk.white(`${profile.displayName} (${profile.config.owner}/${profile.config.repo}):`));
|
|
171
|
+
incrementIds.forEach(id => {
|
|
172
|
+
console.log(` - ${id}`);
|
|
173
|
+
});
|
|
174
|
+
console.log('');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Show unmapped increments
|
|
178
|
+
if (noProfile.length > 0) {
|
|
179
|
+
console.log(chalk.yellow('No repository assigned:'));
|
|
180
|
+
noProfile.forEach(id => {
|
|
181
|
+
console.log(` - ${id}`);
|
|
182
|
+
});
|
|
183
|
+
console.log('');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=increment-profile-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"increment-profile-selector.js","sourceRoot":"","sources":["../../../../src/cli/helpers/github/increment-profile-selector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAs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CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,2BAA2B;IAC3B,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC;QACrD,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;YACrB,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Profile Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages multiple GitHub repository profiles for multi-repo projects
|
|
5
|
+
* Handles CRUD operations and profile selection for increments
|
|
6
|
+
*
|
|
7
|
+
* @module cli/helpers/github/profile-manager
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* GitHub repository profile
|
|
11
|
+
*/
|
|
12
|
+
export interface GitHubProfile {
|
|
13
|
+
id: string;
|
|
14
|
+
provider: 'github';
|
|
15
|
+
displayName: string;
|
|
16
|
+
config: {
|
|
17
|
+
owner: string;
|
|
18
|
+
repo: string;
|
|
19
|
+
monorepoProjects?: string[];
|
|
20
|
+
};
|
|
21
|
+
timeRange?: {
|
|
22
|
+
default: string;
|
|
23
|
+
max: string;
|
|
24
|
+
};
|
|
25
|
+
rateLimits?: {
|
|
26
|
+
maxItemsPerSync: number;
|
|
27
|
+
warnThreshold: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* GitHub Profile Manager
|
|
32
|
+
*
|
|
33
|
+
* Handles all profile-related operations
|
|
34
|
+
*/
|
|
35
|
+
export declare class GitHubProfileManager {
|
|
36
|
+
private configPath;
|
|
37
|
+
private config;
|
|
38
|
+
constructor(projectPath: string);
|
|
39
|
+
/**
|
|
40
|
+
* Load config from disk
|
|
41
|
+
*/
|
|
42
|
+
private loadConfig;
|
|
43
|
+
/**
|
|
44
|
+
* Save config to disk
|
|
45
|
+
*/
|
|
46
|
+
private saveConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Get all GitHub profiles
|
|
49
|
+
*
|
|
50
|
+
* @returns Array of GitHub profiles
|
|
51
|
+
*/
|
|
52
|
+
getAllProfiles(): GitHubProfile[];
|
|
53
|
+
/**
|
|
54
|
+
* Get a specific profile by ID
|
|
55
|
+
*
|
|
56
|
+
* @param id - Profile ID
|
|
57
|
+
* @returns Profile or null
|
|
58
|
+
*/
|
|
59
|
+
getProfile(id: string): GitHubProfile | null;
|
|
60
|
+
/**
|
|
61
|
+
* Get the active/default profile
|
|
62
|
+
*
|
|
63
|
+
* @returns Active profile or null
|
|
64
|
+
*/
|
|
65
|
+
getActiveProfile(): GitHubProfile | null;
|
|
66
|
+
/**
|
|
67
|
+
* Add a new profile
|
|
68
|
+
*
|
|
69
|
+
* @param profile - Profile to add
|
|
70
|
+
* @returns Success status
|
|
71
|
+
*/
|
|
72
|
+
addProfile(profile: Omit<GitHubProfile, 'provider'>): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Update an existing profile
|
|
75
|
+
*
|
|
76
|
+
* @param id - Profile ID
|
|
77
|
+
* @param updates - Partial profile updates
|
|
78
|
+
* @returns Success status
|
|
79
|
+
*/
|
|
80
|
+
updateProfile(id: string, updates: Partial<Omit<GitHubProfile, 'id' | 'provider'>>): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Delete a profile
|
|
83
|
+
*
|
|
84
|
+
* @param id - Profile ID
|
|
85
|
+
* @returns Success status
|
|
86
|
+
*/
|
|
87
|
+
deleteProfile(id: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Set active profile
|
|
90
|
+
*
|
|
91
|
+
* @param id - Profile ID
|
|
92
|
+
* @returns Success status
|
|
93
|
+
*/
|
|
94
|
+
setActiveProfile(id: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Interactive profile selection
|
|
97
|
+
*
|
|
98
|
+
* @param message - Prompt message
|
|
99
|
+
* @returns Selected profile or null
|
|
100
|
+
*/
|
|
101
|
+
selectProfile(message?: string): Promise<GitHubProfile | null>;
|
|
102
|
+
/**
|
|
103
|
+
* Check if any profiles exist
|
|
104
|
+
*
|
|
105
|
+
* @returns True if profiles exist
|
|
106
|
+
*/
|
|
107
|
+
hasProfiles(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Get profile count
|
|
110
|
+
*
|
|
111
|
+
* @returns Number of profiles
|
|
112
|
+
*/
|
|
113
|
+
getProfileCount(): number;
|
|
114
|
+
/**
|
|
115
|
+
* List all profiles (formatted for display)
|
|
116
|
+
*/
|
|
117
|
+
listProfiles(): void;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=profile-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-manager.d.ts","sourceRoot":"","sources":["../../../../src/cli/helpers/github/profile-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC7B,CAAC;IACF,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,UAAU,CAAC,EAAE;QACX,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAkBD;;;;GAIG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAkB;gBAEpB,WAAW,EAAE,MAAM;IAK/B;;OAEG;IACH,OAAO,CAAC,UAAU;IAgClB;;OAEG;IACH,OAAO,CAAC,UAAU;IAalB;;;;OAIG;IACH,cAAc,IAAI,aAAa,EAAE;IAUjC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAQ5C;;;;OAIG;IACH,gBAAgB,IAAI,aAAa,GAAG,IAAI;IAUxC;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG,OAAO;IA4C7D;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,UAAU,CAAC,CAAC,GAAG,OAAO;IAuB5F;;;;;OAKG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IA+BlC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAiBrC;;;;;OAKG;IACG,aAAa,CAAC,OAAO,GAAE,MAAoC,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IA2BjG;;;;OAIG;IACH,WAAW,IAAI,OAAO;IAItB;;;;OAIG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,YAAY,IAAI,IAAI;CAwBrB"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Profile Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages multiple GitHub repository profiles for multi-repo projects
|
|
5
|
+
* Handles CRUD operations and profile selection for increments
|
|
6
|
+
*
|
|
7
|
+
* @module cli/helpers/github/profile-manager
|
|
8
|
+
*/
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import inquirer from 'inquirer';
|
|
13
|
+
/**
|
|
14
|
+
* GitHub Profile Manager
|
|
15
|
+
*
|
|
16
|
+
* Handles all profile-related operations
|
|
17
|
+
*/
|
|
18
|
+
export class GitHubProfileManager {
|
|
19
|
+
constructor(projectPath) {
|
|
20
|
+
this.configPath = path.join(projectPath, '.specweave', 'config.json');
|
|
21
|
+
this.loadConfig();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Load config from disk
|
|
25
|
+
*/
|
|
26
|
+
loadConfig() {
|
|
27
|
+
try {
|
|
28
|
+
if (fs.existsSync(this.configPath)) {
|
|
29
|
+
const content = fs.readFileSync(this.configPath, 'utf-8');
|
|
30
|
+
this.config = JSON.parse(content);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.config = {};
|
|
34
|
+
}
|
|
35
|
+
// Ensure sync structure exists
|
|
36
|
+
if (!this.config.sync) {
|
|
37
|
+
this.config.sync = {
|
|
38
|
+
enabled: false,
|
|
39
|
+
activeProfile: '',
|
|
40
|
+
profiles: {}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (!this.config.sync.profiles) {
|
|
44
|
+
this.config.sync.profiles = {};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error(chalk.red('Failed to load config:'), error);
|
|
49
|
+
this.config = {
|
|
50
|
+
sync: {
|
|
51
|
+
enabled: false,
|
|
52
|
+
activeProfile: '',
|
|
53
|
+
profiles: {}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Save config to disk
|
|
60
|
+
*/
|
|
61
|
+
saveConfig() {
|
|
62
|
+
try {
|
|
63
|
+
const dir = path.dirname(this.configPath);
|
|
64
|
+
if (!fs.existsSync(dir)) {
|
|
65
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
66
|
+
}
|
|
67
|
+
fs.writeFileSync(this.configPath, JSON.stringify(this.config, null, 2) + '\n');
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error(chalk.red('Failed to save config:'), error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get all GitHub profiles
|
|
76
|
+
*
|
|
77
|
+
* @returns Array of GitHub profiles
|
|
78
|
+
*/
|
|
79
|
+
getAllProfiles() {
|
|
80
|
+
if (!this.config.sync?.profiles) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
return Object.entries(this.config.sync.profiles)
|
|
84
|
+
.filter(([_, profile]) => profile.provider === 'github')
|
|
85
|
+
.map(([id, profile]) => ({ ...profile, id }));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get a specific profile by ID
|
|
89
|
+
*
|
|
90
|
+
* @param id - Profile ID
|
|
91
|
+
* @returns Profile or null
|
|
92
|
+
*/
|
|
93
|
+
getProfile(id) {
|
|
94
|
+
const profile = this.config.sync?.profiles?.[id];
|
|
95
|
+
if (!profile || profile.provider !== 'github') {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return { ...profile, id };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get the active/default profile
|
|
102
|
+
*
|
|
103
|
+
* @returns Active profile or null
|
|
104
|
+
*/
|
|
105
|
+
getActiveProfile() {
|
|
106
|
+
const activeId = this.config.sync?.activeProfile;
|
|
107
|
+
if (!activeId) {
|
|
108
|
+
// If no active profile set, return the first GitHub profile
|
|
109
|
+
const profiles = this.getAllProfiles();
|
|
110
|
+
return profiles.length > 0 ? profiles[0] : null;
|
|
111
|
+
}
|
|
112
|
+
return this.getProfile(activeId);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Add a new profile
|
|
116
|
+
*
|
|
117
|
+
* @param profile - Profile to add
|
|
118
|
+
* @returns Success status
|
|
119
|
+
*/
|
|
120
|
+
addProfile(profile) {
|
|
121
|
+
try {
|
|
122
|
+
if (!this.config.sync) {
|
|
123
|
+
this.config.sync = {
|
|
124
|
+
enabled: true,
|
|
125
|
+
activeProfile: profile.id,
|
|
126
|
+
profiles: {}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// Check if ID already exists
|
|
130
|
+
if (this.config.sync.profiles[profile.id]) {
|
|
131
|
+
console.error(chalk.red(`Profile with ID '${profile.id}' already exists`));
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
// Add the profile
|
|
135
|
+
this.config.sync.profiles[profile.id] = {
|
|
136
|
+
...profile,
|
|
137
|
+
provider: 'github',
|
|
138
|
+
timeRange: profile.timeRange || {
|
|
139
|
+
default: '1M',
|
|
140
|
+
max: '6M'
|
|
141
|
+
},
|
|
142
|
+
rateLimits: profile.rateLimits || {
|
|
143
|
+
maxItemsPerSync: 500,
|
|
144
|
+
warnThreshold: 100
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
// Set as active if it's the first profile
|
|
148
|
+
if (!this.config.sync.activeProfile) {
|
|
149
|
+
this.config.sync.activeProfile = profile.id;
|
|
150
|
+
this.config.sync.enabled = true;
|
|
151
|
+
}
|
|
152
|
+
this.saveConfig();
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
console.error(chalk.red('Failed to add profile:'), error);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Update an existing profile
|
|
162
|
+
*
|
|
163
|
+
* @param id - Profile ID
|
|
164
|
+
* @param updates - Partial profile updates
|
|
165
|
+
* @returns Success status
|
|
166
|
+
*/
|
|
167
|
+
updateProfile(id, updates) {
|
|
168
|
+
try {
|
|
169
|
+
const profile = this.config.sync?.profiles?.[id];
|
|
170
|
+
if (!profile) {
|
|
171
|
+
console.error(chalk.red(`Profile '${id}' not found`));
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
// Update the profile
|
|
175
|
+
this.config.sync.profiles[id] = {
|
|
176
|
+
...profile,
|
|
177
|
+
...updates,
|
|
178
|
+
provider: 'github' // Ensure provider stays as github
|
|
179
|
+
};
|
|
180
|
+
this.saveConfig();
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
console.error(chalk.red('Failed to update profile:'), error);
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Delete a profile
|
|
190
|
+
*
|
|
191
|
+
* @param id - Profile ID
|
|
192
|
+
* @returns Success status
|
|
193
|
+
*/
|
|
194
|
+
deleteProfile(id) {
|
|
195
|
+
try {
|
|
196
|
+
if (!this.config.sync?.profiles?.[id]) {
|
|
197
|
+
console.error(chalk.red(`Profile '${id}' not found`));
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
// Delete the profile
|
|
201
|
+
delete this.config.sync.profiles[id];
|
|
202
|
+
// Update active profile if necessary
|
|
203
|
+
if (this.config.sync.activeProfile === id) {
|
|
204
|
+
const remainingProfiles = this.getAllProfiles();
|
|
205
|
+
this.config.sync.activeProfile = remainingProfiles.length > 0
|
|
206
|
+
? remainingProfiles[0].id
|
|
207
|
+
: '';
|
|
208
|
+
// Disable sync if no profiles left
|
|
209
|
+
if (remainingProfiles.length === 0) {
|
|
210
|
+
this.config.sync.enabled = false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
this.saveConfig();
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error(chalk.red('Failed to delete profile:'), error);
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Set active profile
|
|
223
|
+
*
|
|
224
|
+
* @param id - Profile ID
|
|
225
|
+
* @returns Success status
|
|
226
|
+
*/
|
|
227
|
+
setActiveProfile(id) {
|
|
228
|
+
try {
|
|
229
|
+
if (!this.config.sync?.profiles?.[id]) {
|
|
230
|
+
console.error(chalk.red(`Profile '${id}' not found`));
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
this.config.sync.activeProfile = id;
|
|
234
|
+
this.config.sync.enabled = true;
|
|
235
|
+
this.saveConfig();
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
console.error(chalk.red('Failed to set active profile:'), error);
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Interactive profile selection
|
|
245
|
+
*
|
|
246
|
+
* @param message - Prompt message
|
|
247
|
+
* @returns Selected profile or null
|
|
248
|
+
*/
|
|
249
|
+
async selectProfile(message = 'Select GitHub repository:') {
|
|
250
|
+
const profiles = this.getAllProfiles();
|
|
251
|
+
if (profiles.length === 0) {
|
|
252
|
+
console.log(chalk.yellow('No GitHub profiles configured'));
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
if (profiles.length === 1) {
|
|
256
|
+
// Auto-select if only one profile
|
|
257
|
+
return profiles[0];
|
|
258
|
+
}
|
|
259
|
+
const { selectedId } = await inquirer.prompt([{
|
|
260
|
+
type: 'list',
|
|
261
|
+
name: 'selectedId',
|
|
262
|
+
message,
|
|
263
|
+
choices: profiles.map(p => ({
|
|
264
|
+
name: `${p.displayName} (${p.config.owner}/${p.config.repo})`,
|
|
265
|
+
value: p.id,
|
|
266
|
+
short: p.id
|
|
267
|
+
}))
|
|
268
|
+
}]);
|
|
269
|
+
return this.getProfile(selectedId);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Check if any profiles exist
|
|
273
|
+
*
|
|
274
|
+
* @returns True if profiles exist
|
|
275
|
+
*/
|
|
276
|
+
hasProfiles() {
|
|
277
|
+
return this.getAllProfiles().length > 0;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Get profile count
|
|
281
|
+
*
|
|
282
|
+
* @returns Number of profiles
|
|
283
|
+
*/
|
|
284
|
+
getProfileCount() {
|
|
285
|
+
return this.getAllProfiles().length;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* List all profiles (formatted for display)
|
|
289
|
+
*/
|
|
290
|
+
listProfiles() {
|
|
291
|
+
const profiles = this.getAllProfiles();
|
|
292
|
+
const activeId = this.config.sync?.activeProfile;
|
|
293
|
+
if (profiles.length === 0) {
|
|
294
|
+
console.log(chalk.yellow('No GitHub profiles configured'));
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
console.log(chalk.cyan('\nGitHub Repository Profiles:\n'));
|
|
298
|
+
profiles.forEach(profile => {
|
|
299
|
+
const isActive = profile.id === activeId;
|
|
300
|
+
const marker = isActive ? chalk.green('ā') : ' ';
|
|
301
|
+
const label = isActive ? chalk.green('(active)') : '';
|
|
302
|
+
console.log(`${marker} ${chalk.white(profile.id)}: ${profile.displayName} ${label}`);
|
|
303
|
+
console.log(` ${chalk.gray(`${profile.config.owner}/${profile.config.repo}`)}`);
|
|
304
|
+
if (profile.config.monorepoProjects && profile.config.monorepoProjects.length > 0) {
|
|
305
|
+
console.log(` ${chalk.gray('Projects:')} ${profile.config.monorepoProjects.join(', ')}`);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
console.log('');
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=profile-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-manager.js","sourceRoot":"","sources":["../../../../src/cli/helpers/github/profile-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAwChC;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IAI/B,YAAY,WAAmB;QAC7B,IAAI,CAAC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