feat(P03): multi-project support, NFR milestone versioning, phase context reset, install scripts (v0.3.0)
This commit is contained in:
+17
-4
@@ -30,10 +30,21 @@ export interface MilestoneBranchInfo {
|
||||
export class GitBranch {
|
||||
private projectPath: string;
|
||||
private gitContext: GitContext;
|
||||
private projectSlug?: string;
|
||||
|
||||
constructor(projectPath: string) {
|
||||
constructor(projectPath: string, projectSlug?: string) {
|
||||
this.projectPath = projectPath;
|
||||
this.gitContext = new GitContext(projectPath);
|
||||
this.projectSlug = projectSlug;
|
||||
this.gitContext = new GitContext(projectPath, projectSlug);
|
||||
}
|
||||
|
||||
setProjectSlug(slug: string | undefined): void {
|
||||
this.projectSlug = slug;
|
||||
this.gitContext.setProjectSlug(slug);
|
||||
}
|
||||
|
||||
private prefix(name: string): string {
|
||||
return this.projectSlug ? `${this.projectSlug}/${name}` : name;
|
||||
}
|
||||
|
||||
private git(args: string): string {
|
||||
@@ -58,7 +69,8 @@ export class GitBranch {
|
||||
createPhaseBranch(phaseNumber: number, phaseName: string): BranchCreateResult {
|
||||
const padded = String(phaseNumber).padStart(2, "0");
|
||||
const slug = this.slugify(phaseName);
|
||||
const branchName = `phase/${padded}-${slug}`;
|
||||
const baseName = `phase/${padded}-${slug}`;
|
||||
const branchName = this.prefix(baseName);
|
||||
|
||||
const existing = this.gitContext.getBranches().find((b) => b.name === branchName);
|
||||
if (existing) {
|
||||
@@ -75,7 +87,8 @@ export class GitBranch {
|
||||
|
||||
createMilestoneBranch(version: string, milestoneName: string): BranchCreateResult {
|
||||
const slug = this.slugify(milestoneName);
|
||||
const branchName = `milestone/${version}-${slug}`;
|
||||
const baseName = `milestone/${version}-${slug}`;
|
||||
const branchName = this.prefix(baseName);
|
||||
|
||||
const existing = this.gitContext.getBranches().find((b) => b.name === branchName);
|
||||
if (existing) {
|
||||
|
||||
Reference in New Issue
Block a user