feat(cli): split commit and release into target-based workflows

This commit is contained in:
2026-05-10 10:01:09 +00:00
parent 738fbaa64f
commit 0e27d54ad2
22 changed files with 1938 additions and 1057 deletions
+33 -3
View File
@@ -3,6 +3,8 @@ import * as plugins from './mod.plugins.js';
export interface ICommitConfig {
alwaysTest: boolean;
alwaysBuild: boolean;
confirmation: 'prompt' | 'auto' | 'plan';
steps: string[];
}
/**
@@ -15,7 +17,7 @@ export class CommitConfig {
constructor(cwd: string = process.cwd()) {
this.cwd = cwd;
this.config = { alwaysTest: false, alwaysBuild: false };
this.config = { alwaysTest: false, alwaysBuild: false, confirmation: 'prompt', steps: ['analyze', 'changelog', 'commit'] };
}
/**
@@ -34,9 +36,19 @@ export class CommitConfig {
const smartconfigInstance = new plugins.smartconfig.Smartconfig(this.cwd);
const gitzoneConfig = smartconfigInstance.dataFor<any>('@git.zone/cli', {});
const alwaysTest = gitzoneConfig?.commit?.alwaysTest ?? false;
const alwaysBuild = gitzoneConfig?.commit?.alwaysBuild ?? false;
this.config = {
alwaysTest: gitzoneConfig?.commit?.alwaysTest ?? false,
alwaysBuild: gitzoneConfig?.commit?.alwaysBuild ?? false,
alwaysTest,
alwaysBuild,
confirmation: gitzoneConfig?.commit?.confirmation ?? 'prompt',
steps: gitzoneConfig?.commit?.steps || [
'analyze',
...(alwaysTest ? ['test'] : []),
...(alwaysBuild ? ['build'] : []),
'changelog',
'commit',
],
};
}
@@ -66,6 +78,8 @@ export class CommitConfig {
// Update commit settings
smartconfigData['@git.zone/cli'].commit.alwaysTest = this.config.alwaysTest;
smartconfigData['@git.zone/cli'].commit.alwaysBuild = this.config.alwaysBuild;
smartconfigData['@git.zone/cli'].commit.confirmation = this.config.confirmation;
smartconfigData['@git.zone/cli'].commit.steps = this.config.steps;
// Write back to file
await plugins.smartfs
@@ -101,4 +115,20 @@ export class CommitConfig {
public setAlwaysBuild(value: boolean): void {
this.config.alwaysBuild = value;
}
public getConfirmation(): 'prompt' | 'auto' | 'plan' {
return this.config.confirmation;
}
public setConfirmation(value: 'prompt' | 'auto' | 'plan'): void {
this.config.confirmation = value;
}
public getSteps(): string[] {
return [...this.config.steps];
}
public setSteps(steps: string[]): void {
this.config.steps = [...steps];
}
}