Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 106b72748c | |||
| 03bf82d8ee | |||
| 6a936603bd | |||
| 2a91662e63 | |||
| ea0c026c7e | |||
| d508e1d06c |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,6 +3,8 @@
|
|||||||
# artifacts
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
|
test/
|
||||||
|
test2/
|
||||||
|
|
||||||
# installs
|
# installs
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"gitzone": {
|
"@git.zone/cli": {
|
||||||
"projectType": "{{projectType}}",
|
"projectType": "{{projectType}}",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "{{module.githost}}",
|
"githost": "{{module.githost}}",
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"projectDomain": "{{module.projectDomain}}"
|
"projectDomain": "{{module.projectDomain}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"@ship.zone/szci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "{{module.npmAccessLevel}}"
|
"npmAccessLevel": "{{module.npmAccessLevel}}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"gitzone": {
|
"@git.zone/cli": {
|
||||||
"projectType": "{{projectType}}",
|
"projectType": "{{projectType}}",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "{{module.githost}}",
|
"githost": "{{module.githost}}",
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"projectDomain": "{{module.projectDomain}}"
|
"projectDomain": "{{module.projectDomain}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"@ship.zone/szci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"dockerRegistryRepoMap": {
|
"dockerRegistryRepoMap": {
|
||||||
"registry.gitlab.com": "{{dockerTargetImagePath}}"
|
"registry.gitlab.com": "{{dockerTargetImagePath}}"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"gitzone": {
|
"@git.zone/cli": {
|
||||||
"projectType": "website",
|
"projectType": "website",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "{{module.githost}}",
|
"githost": "{{module.githost}}",
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"projectDomain": "{{module.projectDomain}}"
|
"projectDomain": "{{module.projectDomain}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"@ship.zone/szci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"dockerRegistryRepoMap": {
|
"dockerRegistryRepoMap": {
|
||||||
"registry.gitlab.com": "{{docker.registryImageTag}}"
|
"registry.gitlab.com": "{{docker.registryImageTag}}"
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-12-04 - 2.2.1 - fix(commit)
|
||||||
|
Prevent auto-accept for BREAKING CHANGE commits; require manual confirmation and warn when --yes is used
|
||||||
|
|
||||||
|
- Do not auto-accept AI commit recommendations when the suggested change is a BREAKING CHANGE (major bump).
|
||||||
|
- Only auto-accept recommendations when -y/--yes is provided and the change is not breaking.
|
||||||
|
- When --yes is provided but the recommendation is a breaking change, log a warning and fall back to interactive confirmation.
|
||||||
|
- Introduced isBreakingChange and canAutoAccept flags to centralize the auto-accept logic.
|
||||||
|
|
||||||
## 2025-12-02 - 2.2.0 - feat(services)
|
## 2025-12-02 - 2.2.0 - feat(services)
|
||||||
Improve services manager and configuration; switch test templates to @git.zone/tstest; bump dev dependencies and update docs
|
Improve services manager and configuration; switch test templates to @git.zone/tstest; bump dev dependencies and update docs
|
||||||
|
|
||||||
|
|||||||
16
package.json
16
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@git.zone/cli",
|
"name": "@git.zone/cli",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "2.2.0",
|
"version": "2.2.2",
|
||||||
"description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
|
"description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
|
||||||
"main": "dist_ts/index.ts",
|
"main": "dist_ts/index.ts",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npm run clean && npm run prepareTest && npm run testCli && npm run testFormat && npm run testCommit && npm run testDeprecate && npm run testVersion && npm run testReadme && npm run testUpdate && npm run testTemplateNpm && npm run testTemplateLit) && rm -rf test",
|
"test": "(npm run clean && npm run prepareTest && npm run testCli && npm run testFormat && npm run testCommit && npm run testDeprecate && npm run testVersion && npm run testReadme && npm run testUpdate && npm run testTemplateNpm && npm run testTemplateLit) && rm -rf test",
|
||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "tsbuild tsfolders",
|
||||||
"clean": "(rm -rf test/)",
|
"clean": "(rm -rf test/)",
|
||||||
"prepareTest": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)",
|
"prepareTest": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)",
|
||||||
"testBuild": "npm run build && rm -r dist/",
|
"testBuild": "npm run build && rm -r dist/",
|
||||||
@@ -57,17 +57,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/gitzone/private/gitzone#readme",
|
"homepage": "https://gitlab.com/gitzone/private/gitzone#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^3.1.2",
|
"@git.zone/tsbuild": "^4.0.1",
|
||||||
"@git.zone/tsrun": "^2.0.0",
|
"@git.zone/tsrun": "^2.0.1",
|
||||||
"@git.zone/tstest": "^3.1.3",
|
"@git.zone/tstest": "^3.1.3",
|
||||||
"@push.rocks/smartdelay": "^3.0.5",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"@push.rocks/smartinteract": "^2.0.16",
|
"@push.rocks/smartinteract": "^2.0.16",
|
||||||
"@push.rocks/smartnetwork": "^4.4.0",
|
"@push.rocks/smartnetwork": "^4.4.0",
|
||||||
"@push.rocks/smartshell": "^3.3.0",
|
"@push.rocks/smartshell": "^3.3.0",
|
||||||
"@types/node": "^24.10.1"
|
"@types/node": "^24.10.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@git.zone/tsdoc": "^1.10.0",
|
"@git.zone/tsdoc": "^1.10.2",
|
||||||
"@git.zone/tspublish": "^1.10.3",
|
"@git.zone/tspublish": "^1.10.3",
|
||||||
"@push.rocks/commitinfo": "^1.0.12",
|
"@push.rocks/commitinfo": "^1.0.12",
|
||||||
"@push.rocks/early": "^4.0.4",
|
"@push.rocks/early": "^4.0.4",
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
"@push.rocks/projectinfo": "^5.0.2",
|
"@push.rocks/projectinfo": "^5.0.2",
|
||||||
"@push.rocks/smartcli": "^4.0.19",
|
"@push.rocks/smartcli": "^4.0.19",
|
||||||
"@push.rocks/smartdiff": "^1.0.3",
|
"@push.rocks/smartdiff": "^1.0.3",
|
||||||
"@push.rocks/smartfile": "^13.1.0",
|
"@push.rocks/smartfile": "^13.1.2",
|
||||||
"@push.rocks/smartfs": "^1.2.0",
|
"@push.rocks/smartfs": "^1.2.0",
|
||||||
"@push.rocks/smartgulp": "^3.0.4",
|
"@push.rocks/smartgulp": "^3.0.4",
|
||||||
"@push.rocks/smartjson": "^5.2.0",
|
"@push.rocks/smartjson": "^5.2.0",
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
"@push.rocks/smartunique": "^3.0.9",
|
"@push.rocks/smartunique": "^3.0.9",
|
||||||
"@push.rocks/smartupdate": "^2.0.6",
|
"@push.rocks/smartupdate": "^2.0.6",
|
||||||
"@types/through2": "^2.0.41",
|
"@types/through2": "^2.0.41",
|
||||||
"prettier": "^3.7.3",
|
"prettier": "^3.7.4",
|
||||||
"through2": "^4.0.2"
|
"through2": "^4.0.2"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
3604
pnpm-lock.yaml
generated
3604
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
1
test
1
test
Submodule test deleted from 0b89443584
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/cli',
|
name: '@git.zone/cli',
|
||||||
version: '2.2.0',
|
version: '2.2.1',
|
||||||
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ export class GitzoneConfig {
|
|||||||
|
|
||||||
public async readConfigFromCwd() {
|
public async readConfigFromCwd() {
|
||||||
const npmextraInstance = new plugins.npmextra.Npmextra(paths.cwd);
|
const npmextraInstance = new plugins.npmextra.Npmextra(paths.cwd);
|
||||||
this.data = npmextraInstance.dataFor<IGitzoneConfigData>('gitzone', {});
|
this.data = npmextraInstance.dataFor<IGitzoneConfigData>('@git.zone/cli', {});
|
||||||
this.data.npmciOptions = npmextraInstance.dataFor<
|
this.data.npmciOptions = npmextraInstance.dataFor<
|
||||||
IGitzoneConfigData['npmciOptions']
|
IGitzoneConfigData['npmciOptions']
|
||||||
>('npmci', {
|
>('@ship.zone/szci', {
|
||||||
npmAccessLevel: 'public',
|
npmAccessLevel: 'public',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,12 @@ export const run = async (argvArg: any) => {
|
|||||||
|
|
||||||
let answerBucket: plugins.smartinteract.AnswerBucket;
|
let answerBucket: plugins.smartinteract.AnswerBucket;
|
||||||
|
|
||||||
// Check if -y or --yes flag is set to auto-accept recommendations
|
// Check if -y/--yes flag is set AND version is not a breaking change
|
||||||
if (argvArg.y || argvArg.yes) {
|
// Breaking changes (major version bumps) always require manual confirmation
|
||||||
|
const isBreakingChange = nextCommitObject.recommendedNextVersionLevel === 'BREAKING CHANGE';
|
||||||
|
const canAutoAccept = (argvArg.y || argvArg.yes) && !isBreakingChange;
|
||||||
|
|
||||||
|
if (canAutoAccept) {
|
||||||
// Auto-mode: create AnswerBucket programmatically
|
// Auto-mode: create AnswerBucket programmatically
|
||||||
logger.log('info', '✓ Auto-accepting AI recommendations (--yes flag)');
|
logger.log('info', '✓ Auto-accepting AI recommendations (--yes flag)');
|
||||||
|
|
||||||
@@ -53,6 +57,10 @@ export const run = async (argvArg: any) => {
|
|||||||
value: !!(argvArg.p || argvArg.push), // Only push if -p flag also provided
|
value: !!(argvArg.p || argvArg.push), // Only push if -p flag also provided
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// Warn if --yes was provided but we're requiring confirmation due to breaking change
|
||||||
|
if (isBreakingChange && (argvArg.y || argvArg.yes)) {
|
||||||
|
logger.log('warn', '⚠️ BREAKING CHANGE detected - manual confirmation required');
|
||||||
|
}
|
||||||
// Interactive mode: prompt user for input
|
// Interactive mode: prompt user for input
|
||||||
const commitInteract = new plugins.smartinteract.SmartInteract();
|
const commitInteract = new plugins.smartinteract.SmartInteract();
|
||||||
commitInteract.addQuestions([
|
commitInteract.addQuestions([
|
||||||
|
|||||||
@@ -3,6 +3,29 @@ import * as paths from '../paths.js';
|
|||||||
import * as gulpFunction from '@push.rocks/gulp-function';
|
import * as gulpFunction from '@push.rocks/gulp-function';
|
||||||
import { Project } from '../classes.project.js';
|
import { Project } from '../classes.project.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrates npmextra.json from old namespace keys to new package-scoped keys
|
||||||
|
*/
|
||||||
|
const migrateNamespaceKeys = (npmextraJson: any): boolean => {
|
||||||
|
let migrated = false;
|
||||||
|
const migrations = [
|
||||||
|
{ oldKey: 'gitzone', newKey: '@git.zone/cli' },
|
||||||
|
{ oldKey: 'tsdoc', newKey: '@git.zone/tsdoc' },
|
||||||
|
{ oldKey: 'npmdocker', newKey: '@git.zone/tsdocker' },
|
||||||
|
{ oldKey: 'npmci', newKey: '@ship.zone/szci' },
|
||||||
|
{ oldKey: 'szci', newKey: '@ship.zone/szci' },
|
||||||
|
];
|
||||||
|
for (const { oldKey, newKey } of migrations) {
|
||||||
|
if (npmextraJson[oldKey] && !npmextraJson[newKey]) {
|
||||||
|
npmextraJson[newKey] = npmextraJson[oldKey];
|
||||||
|
delete npmextraJson[oldKey];
|
||||||
|
migrated = true;
|
||||||
|
console.log(`Migrated npmextra.json: ${oldKey} -> ${newKey}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return migrated;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* runs the npmextra file checking
|
* runs the npmextra file checking
|
||||||
*/
|
*/
|
||||||
@@ -13,8 +36,11 @@ export const run = async (projectArg: Project) => {
|
|||||||
const fileString = fileArg.contents.toString();
|
const fileString = fileArg.contents.toString();
|
||||||
const npmextraJson = JSON.parse(fileString);
|
const npmextraJson = JSON.parse(fileString);
|
||||||
|
|
||||||
if (!npmextraJson.gitzone) {
|
// Migrate old namespace keys to new package-scoped keys
|
||||||
npmextraJson.gitzone = {};
|
migrateNamespaceKeys(npmextraJson);
|
||||||
|
|
||||||
|
if (!npmextraJson['@git.zone/cli']) {
|
||||||
|
npmextraJson['@git.zone/cli'] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const expectedRepoInformation: string[] = [
|
const expectedRepoInformation: string[] = [
|
||||||
@@ -31,7 +57,7 @@ export const run = async (projectArg: Project) => {
|
|||||||
for (const expectedRepoInformationItem of expectedRepoInformation) {
|
for (const expectedRepoInformationItem of expectedRepoInformation) {
|
||||||
if (
|
if (
|
||||||
!plugins.smartobject.smartGet(
|
!plugins.smartobject.smartGet(
|
||||||
npmextraJson.gitzone,
|
npmextraJson['@git.zone/cli'],
|
||||||
expectedRepoInformationItem,
|
expectedRepoInformationItem,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@@ -53,7 +79,7 @@ export const run = async (projectArg: Project) => {
|
|||||||
);
|
);
|
||||||
if (cliProvidedValue) {
|
if (cliProvidedValue) {
|
||||||
plugins.smartobject.smartAdd(
|
plugins.smartobject.smartAdd(
|
||||||
npmextraJson.gitzone,
|
npmextraJson['@git.zone/cli'],
|
||||||
expectedRepoInformationItem,
|
expectedRepoInformationItem,
|
||||||
cliProvidedValue,
|
cliProvidedValue,
|
||||||
);
|
);
|
||||||
@@ -63,8 +89,8 @@ export const run = async (projectArg: Project) => {
|
|||||||
// delete obsolete
|
// delete obsolete
|
||||||
// tbd
|
// tbd
|
||||||
|
|
||||||
if (!npmextraJson.npmci) {
|
if (!npmextraJson['@ship.zone/szci']) {
|
||||||
npmextraJson.npmci = {};
|
npmextraJson['@ship.zone/szci'] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
fileArg.setContentsFromString(JSON.stringify(npmextraJson, null, 2));
|
fileArg.setContentsFromString(JSON.stringify(npmextraJson, null, 2));
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export const run = async (projectArg: Project) => {
|
|||||||
plugins.smartgulp.src([`package.json`]),
|
plugins.smartgulp.src([`package.json`]),
|
||||||
gulpFunction.forEach(async (fileArg: plugins.smartfile.SmartFile) => {
|
gulpFunction.forEach(async (fileArg: plugins.smartfile.SmartFile) => {
|
||||||
const npmextraConfig = new plugins.npmextra.Npmextra(paths.cwd);
|
const npmextraConfig = new plugins.npmextra.Npmextra(paths.cwd);
|
||||||
const gitzoneData: any = npmextraConfig.dataFor('gitzone', {});
|
const gitzoneData: any = npmextraConfig.dataFor('@git.zone/cli', {});
|
||||||
const fileString = fileArg.contents.toString();
|
const fileString = fileArg.contents.toString();
|
||||||
const packageJson = JSON.parse(fileString);
|
const packageJson = JSON.parse(fileString);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export let run = async (
|
|||||||
|
|
||||||
// Get configuration from npmextra
|
// Get configuration from npmextra
|
||||||
const npmextraConfig = new plugins.npmextra.Npmextra();
|
const npmextraConfig = new plugins.npmextra.Npmextra();
|
||||||
const formatConfig = npmextraConfig.dataFor<any>('gitzone.format', {
|
const formatConfig = npmextraConfig.dataFor<any>('@git.zone/cli.format', {
|
||||||
interactive: true,
|
interactive: true,
|
||||||
showDiffs: false,
|
showDiffs: false,
|
||||||
autoApprove: false,
|
autoApprove: false,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export class ServiceManager {
|
|||||||
*/
|
*/
|
||||||
private async loadServiceConfiguration(): Promise<void> {
|
private async loadServiceConfiguration(): Promise<void> {
|
||||||
const npmextraConfig = new plugins.npmextra.Npmextra(process.cwd());
|
const npmextraConfig = new plugins.npmextra.Npmextra(process.cwd());
|
||||||
const gitzoneConfig = npmextraConfig.dataFor<any>('gitzone', {});
|
const gitzoneConfig = npmextraConfig.dataFor<any>('@git.zone/cli', {});
|
||||||
|
|
||||||
// Check if services array exists
|
// Check if services array exists
|
||||||
if (!gitzoneConfig.services || !Array.isArray(gitzoneConfig.services) || gitzoneConfig.services.length === 0) {
|
if (!gitzoneConfig.services || !Array.isArray(gitzoneConfig.services) || gitzoneConfig.services.length === 0) {
|
||||||
@@ -84,11 +84,11 @@ export class ServiceManager {
|
|||||||
npmextraData = JSON.parse(content as string);
|
npmextraData = JSON.parse(content as string);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update gitzone.services
|
// Update @git.zone/cli.services
|
||||||
if (!npmextraData.gitzone) {
|
if (!npmextraData['@git.zone/cli']) {
|
||||||
npmextraData.gitzone = {};
|
npmextraData['@git.zone/cli'] = {};
|
||||||
}
|
}
|
||||||
npmextraData.gitzone.services = services;
|
npmextraData['@git.zone/cli'].services = services;
|
||||||
|
|
||||||
// Write back to npmextra.json
|
// Write back to npmextra.json
|
||||||
await plugins.smartfs
|
await plugins.smartfs
|
||||||
|
|||||||
Reference in New Issue
Block a user