Compare commits

...

14 Commits

Author SHA1 Message Date
a41e3d5d2c 1.18.9
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-23 18:24:13 +00:00
c45cff89de fix(mod_commit): Stage and commit deno.json when bumping/syncing versions and create/update git tags 2025-10-23 18:24:13 +00:00
7bb43ad478 1.18.8
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-23 18:18:09 +00:00
8dcaf1c631 fix(mod_commit): Improve commit workflow: detect project type and current branch; add robust version bump helpers for npm/deno 2025-10-23 18:18:08 +00:00
422761806d 1.18.7
Some checks failed
Default (tags) / security (push) Failing after 1s
Default (tags) / test (push) Failing after 1s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-09-07 08:27:52 +00:00
31360240a9 fix(claude): Add .claude local settings to whitelist dev tool permissions 2025-09-07 08:27:52 +00:00
e338ee584f 1.18.6
Some checks failed
Default (tags) / security (push) Failing after 1s
Default (tags) / test (push) Failing after 1s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-09-07 07:56:47 +00:00
31d2e18830 fix(deps): Bump dependency versions and add local Claude settings 2025-09-07 07:56:46 +00:00
a162ddabbb 1.18.5
Some checks failed
Default (tags) / security (push) Failing after 1s
Default (tags) / test (push) Failing after 1s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-08-17 15:50:58 +00:00
5dfa1d72aa fix(dependencies): Bump smartshell and smartscaf versions; add .claude local settings 2025-08-17 15:50:58 +00:00
7074a19a7f 1.18.4
Some checks failed
Default (tags) / security (push) Failing after 1s
Default (tags) / test (push) Failing after 1s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-08-17 13:31:39 +00:00
5774fb4da2 fix(cli): Update dependencies, add local Claude settings, and update gitignore template 2025-08-17 13:31:38 +00:00
be45ce765d 1.18.3
Some checks failed
Default (tags) / security (push) Failing after 1s
Default (tags) / test (push) Failing after 1s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-08-16 13:25:57 +00:00
2a250b8823 fix(services): Simplify S3 endpoint handling in ServiceConfiguration to store host only 2025-08-16 13:25:57 +00:00
8 changed files with 2628 additions and 4852 deletions

View File

@@ -19,4 +19,8 @@ node_modules/
dist/
dist_*/
# AI
.claude/
.serena/
#------# custom

View File

@@ -1,5 +1,57 @@
# Changelog
## 2025-10-23 - 1.18.9 - fix(mod_commit)
Stage and commit deno.json when bumping/syncing versions and create/update git tags
- bumpDenoVersion now creates a Smartshell instance and runs git add deno.json, git commit -m "v<newVersion>", and git tag v<newVersion> to persist the version bump
- syncVersionToDenoJson now stages deno.json, amends the npm version commit with --no-edit, and recreates the tag with -fa to keep package.json and deno.json in sync
- Added informative logger messages after creating commits and tags
## 2025-10-23 - 1.18.8 - fix(mod_commit)
Improve commit workflow: detect project type and current branch; add robust version bump helpers for npm/deno
- Add mod_commit/mod.helpers.ts with utilities: detectCurrentBranch(), detectProjectType(), bumpProjectVersion(), bumpDenoVersion(), bumpNpmVersion(), syncVersionToDenoJson(), and calculateNewVersion()
- Refactor ts/mod_commit/index.ts to use the new helpers: bumpProjectVersion(projectType, ... ) instead of a hard npm version call and push the actual current branch instead of hardcoding 'master'
- Support bumping versions for npm-only, deno-only, and hybrid (both) projects and synchronize versions from package.json to deno.json when applicable
- Improve branch detection with a fallback to 'master' and informative logging on detection failures
- Add local Claude settings file (.claude/settings.local.json) (editor/CI config) — no code behavior change but included in diff
## 2025-09-07 - 1.18.7 - fix(claude)
Add .claude local settings to whitelist dev tool permissions
- Add .claude/settings.local.json to configure allowed permissions for local AI/tooling helpers (Bash commands, WebFetch, and mcp_serena actions).
- Disable enableAllProjectMcpServers (set to false) to limit automatic project MCP server usage.
## 2025-09-07 - 1.18.6 - fix(deps)
Bump dependency versions and add local Claude settings
- Updated devDependencies: @git.zone/tsbuild ^2.6.4 → ^2.6.8, @git.zone/tstest ^2.3.4 → ^2.3.6, @push.rocks/smartfile ^11.2.5 → ^11.2.7
- Updated dependencies: @git.zone/tsdoc ^1.5.1 → ^1.5.2, @git.zone/tspublish ^1.10.1 → ^1.10.3, @push.rocks/smartlog ^3.1.8 → ^3.1.9, @push.rocks/smartnpm ^2.0.4 → ^2.0.6, @push.rocks/smartscaf ^4.0.17 → ^4.0.19
- Added .claude/settings.local.json to configure local Claude permissions/settings
## 2025-08-17 - 1.18.5 - fix(dependencies)
Bump smartshell and smartscaf versions; add .claude local settings
- Update @push.rocks/smartshell from ^3.2.4 to ^3.3.0 in package.json
- Update @push.rocks/smartscaf from ^4.0.16 to ^4.0.17 in package.json
- Add .claude/settings.local.json for local assistant permissions/configuration
## 2025-08-17 - 1.18.4 - fix(cli)
Update dependencies, add local Claude settings, and update gitignore template
- Bump several dependencies: @git.zone/tsbuild -> ^2.6.4, @git.zone/tspublish -> ^1.10.1, @git.zone/tstest -> ^2.3.4, @push.rocks/smartfile -> ^11.2.5, @push.rocks/npmextra -> ^5.3.3, @push.rocks/smartchok -> ^1.1.1, @push.rocks/smartlog -> ^3.1.8, @push.rocks/smartpath -> ^6.0.0, prettier -> ^3.6.2
- Add .claude/settings.local.json with local permissions configuration for AI tooling
- Update assets/templates/gitignore to ignore .claude/ and .serena/ directories
- Add pnpm onlyBuiltDependencies entries: esbuild and mongodb-memory-server
## 2025-08-16 - 1.18.3 - fix(services)
Simplify S3 endpoint handling in ServiceConfiguration to store host only
- S3_ENDPOINT now stores the raw host (e.g. 'localhost') instead of a full URL with protocol and port.
- Default .nogit/env.json creation uses the host-only S3_ENDPOINT.
- Sync/update logic (when syncing with Docker or reconfiguring ports) sets S3_ENDPOINT to the host only.
- Consumers that previously relied on S3_ENDPOINT containing protocol and port should now construct the full endpoint URL using S3_USESSL, S3_HOST and S3_PORT.
## 2025-08-16 - 1.18.1 - fix(services)
Improve services and commit flow: stop AiDoc, use silent docker inspect, sync ports with logging, fix config loading, and bump deps

View File

@@ -1,7 +1,7 @@
{
"name": "@git.zone/cli",
"private": false,
"version": "1.18.2",
"version": "1.18.9",
"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",
"typings": "dist_ts/index.d.ts",
@@ -57,45 +57,45 @@
},
"homepage": "https://gitlab.com/gitzone/private/gitzone#readme",
"devDependencies": {
"@git.zone/tsbuild": "^2.3.2",
"@git.zone/tsbuild": "^2.6.8",
"@git.zone/tsrun": "^1.3.3",
"@git.zone/tstest": "^1.0.96",
"@git.zone/tstest": "^2.3.6",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile": "^11.2.0",
"@push.rocks/smartfile": "^11.2.7",
"@push.rocks/smartinteract": "^2.0.16",
"@push.rocks/smartnetwork": "^4.1.2",
"@push.rocks/smartshell": "^3.2.4",
"@push.rocks/smartshell": "^3.3.0",
"@types/node": "^22.15.18"
},
"dependencies": {
"@git.zone/tsdoc": "^1.5.1",
"@git.zone/tspublish": "^1.9.1",
"@git.zone/tsdoc": "^1.5.2",
"@git.zone/tspublish": "^1.10.3",
"@push.rocks/commitinfo": "^1.0.12",
"@push.rocks/early": "^4.0.4",
"@push.rocks/gulp-function": "^3.0.7",
"@push.rocks/lik": "^6.2.2",
"@push.rocks/npmextra": "^5.1.2",
"@push.rocks/npmextra": "^5.3.3",
"@push.rocks/projectinfo": "^5.0.2",
"@push.rocks/smartchok": "^1.0.34",
"@push.rocks/smartchok": "^1.1.1",
"@push.rocks/smartcli": "^4.0.11",
"@push.rocks/smartdiff": "^1.0.3",
"@push.rocks/smartgulp": "^3.0.4",
"@push.rocks/smartjson": "^5.0.20",
"@push.rocks/smartlegal": "^1.0.27",
"@push.rocks/smartlog": "^3.0.9",
"@push.rocks/smartlog": "^3.1.9",
"@push.rocks/smartlog-destination-local": "^9.0.2",
"@push.rocks/smartmustache": "^3.0.2",
"@push.rocks/smartnpm": "^2.0.4",
"@push.rocks/smartnpm": "^2.0.6",
"@push.rocks/smartobject": "^1.0.12",
"@push.rocks/smartopen": "^2.0.0",
"@push.rocks/smartpath": "^5.0.18",
"@push.rocks/smartpath": "^6.0.0",
"@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartscaf": "^4.0.16",
"@push.rocks/smartscaf": "^4.0.19",
"@push.rocks/smartstream": "^3.2.5",
"@push.rocks/smartunique": "^3.0.9",
"@push.rocks/smartupdate": "^2.0.6",
"@types/through2": "^2.0.41",
"prettier": "^3.5.3",
"prettier": "^3.6.2",
"through2": "^4.0.2"
},
"files": [
@@ -116,6 +116,8 @@
"pnpm": {
"overrides": {},
"onlyBuiltDependencies": [
"esbuild",
"mongodb-memory-server",
"puppeteer",
"sharp"
]

7133
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/cli',
version: '1.18.1',
version: '1.18.9',
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.'
}

View File

@@ -3,6 +3,7 @@
import * as plugins from './mod.plugins.js';
import * as paths from '../paths.js';
import { logger } from '../gitzone.logging.js';
import * as helpers from './mod.helpers.js';
export const run = async (argvArg: any) => {
if (argvArg.format) {
@@ -113,12 +114,18 @@ export const run = async (argvArg: any) => {
logger.log('info', `Staging files for commit:`);
await smartshellInstance.exec(`git add -A`);
await smartshellInstance.exec(`git commit -m "${commitString}"`);
await smartshellInstance.exec(`npm version ${commitVersionType}`);
// Detect project type and bump version accordingly
const projectType = await helpers.detectProjectType();
await helpers.bumpProjectVersion(projectType, commitVersionType);
if (
answerBucket.getAnswerFor('pushToOrigin') &&
!(process.env.CI === 'true')
) {
await smartshellInstance.exec(`git push origin master --follow-tags`);
// Detect current branch instead of hardcoding "master"
const currentBranch = await helpers.detectCurrentBranch();
await smartshellInstance.exec(`git push origin ${currentBranch} --follow-tags`);
}
};

View File

@@ -0,0 +1,234 @@
import * as plugins from './mod.plugins.js';
import * as paths from '../paths.js';
import { logger } from '../gitzone.logging.js';
export type ProjectType = 'npm' | 'deno' | 'both' | 'none';
export type VersionType = 'patch' | 'minor' | 'major';
/**
* Detects the current git branch
* @returns The current branch name, defaults to 'master' if detection fails
*/
export async function detectCurrentBranch(): Promise<string> {
try {
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
sourceFilePaths: [],
});
const result = await smartshellInstance.exec('git branch --show-current');
const branchName = result.stdout.trim();
if (!branchName) {
logger.log('warn', 'Could not detect current branch, falling back to "master"');
return 'master';
}
logger.log('info', `Detected current branch: ${branchName}`);
return branchName;
} catch (error) {
logger.log('warn', `Failed to detect branch: ${error.message}, falling back to "master"`);
return 'master';
}
}
/**
* Detects the project type based on presence of package.json and/or deno.json
* @returns The project type
*/
export async function detectProjectType(): Promise<ProjectType> {
const packageJsonPath = plugins.path.join(paths.cwd, 'package.json');
const denoJsonPath = plugins.path.join(paths.cwd, 'deno.json');
const hasPackageJson = await plugins.smartfile.fs.fileExists(packageJsonPath);
const hasDenoJson = await plugins.smartfile.fs.fileExists(denoJsonPath);
if (hasPackageJson && hasDenoJson) {
logger.log('info', 'Detected dual project (npm + deno)');
return 'both';
} else if (hasPackageJson) {
logger.log('info', 'Detected npm project');
return 'npm';
} else if (hasDenoJson) {
logger.log('info', 'Detected deno project');
return 'deno';
} else {
throw new Error('No package.json or deno.json found in current directory');
}
}
/**
* Parses a semantic version string and bumps it according to the version type
* @param currentVersion Current version string (e.g., "1.2.3")
* @param versionType Type of version bump
* @returns New version string
*/
function calculateNewVersion(currentVersion: string, versionType: VersionType): string {
const versionMatch = currentVersion.match(/^(\d+)\.(\d+)\.(\d+)/);
if (!versionMatch) {
throw new Error(`Invalid version format: ${currentVersion}`);
}
let [, major, minor, patch] = versionMatch.map(Number);
switch (versionType) {
case 'major':
major += 1;
minor = 0;
patch = 0;
break;
case 'minor':
minor += 1;
patch = 0;
break;
case 'patch':
patch += 1;
break;
}
return `${major}.${minor}.${patch}`;
}
/**
* Bumps the version in deno.json, commits the change, and creates a tag
* @param versionType Type of version bump
* @returns The new version string
*/
export async function bumpDenoVersion(versionType: VersionType): Promise<string> {
const denoJsonPath = plugins.path.join(paths.cwd, 'deno.json');
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
sourceFilePaths: [],
});
try {
// Read deno.json
const denoConfig = plugins.smartfile.fs.toObjectSync(
denoJsonPath
) as { version?: string };
if (!denoConfig.version) {
throw new Error('deno.json does not contain a version field');
}
const currentVersion = denoConfig.version;
const newVersion = calculateNewVersion(currentVersion, versionType);
logger.log('info', `Bumping deno.json version: ${currentVersion}${newVersion}`);
// Update version
denoConfig.version = newVersion;
// Write back to disk
await plugins.smartfile.memory.toFs(
JSON.stringify(denoConfig, null, 2) + '\n',
denoJsonPath
);
// Stage the deno.json file
await smartshellInstance.exec('git add deno.json');
// Commit the version bump
await smartshellInstance.exec(`git commit -m "v${newVersion}"`);
// Create the version tag
await smartshellInstance.exec(`git tag v${newVersion} -m "v${newVersion}"`);
logger.log('info', `Created commit and tag v${newVersion}`);
return newVersion;
} catch (error) {
throw new Error(`Failed to bump deno.json version: ${error.message}`);
}
}
/**
* Bumps the version in package.json using npm version command
* @param versionType Type of version bump
* @returns The new version string
*/
async function bumpNpmVersion(versionType: VersionType): Promise<string> {
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
sourceFilePaths: [],
});
logger.log('info', `Bumping package.json version using npm version ${versionType}`);
const result = await smartshellInstance.exec(`npm version ${versionType}`);
// npm version returns the new version with a 'v' prefix, e.g., "v1.2.3"
const newVersion = result.stdout.trim().replace(/^v/, '');
return newVersion;
}
/**
* Syncs the version from package.json to deno.json and amends the npm commit
* @param version The version to sync
*/
async function syncVersionToDenoJson(version: string): Promise<void> {
const denoJsonPath = plugins.path.join(paths.cwd, 'deno.json');
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
sourceFilePaths: [],
});
try {
const denoConfig = plugins.smartfile.fs.toObjectSync(
denoJsonPath
) as { version?: string };
logger.log('info', `Syncing version to deno.json: ${version}`);
denoConfig.version = version;
await plugins.smartfile.memory.toFs(
JSON.stringify(denoConfig, null, 2) + '\n',
denoJsonPath
);
// Stage the deno.json file
await smartshellInstance.exec('git add deno.json');
// Amend the npm version commit to include deno.json
await smartshellInstance.exec('git commit --amend --no-edit');
// Re-create the tag with force to update it
await smartshellInstance.exec(`git tag -fa v${version} -m "v${version}"`);
logger.log('info', `Amended commit to include deno.json and updated tag v${version}`);
} catch (error) {
throw new Error(`Failed to sync version to deno.json: ${error.message}`);
}
}
/**
* Bumps the project version based on project type
* @param projectType The detected project type
* @param versionType The type of version bump
* @returns The new version string
*/
export async function bumpProjectVersion(
projectType: ProjectType,
versionType: VersionType
): Promise<string> {
switch (projectType) {
case 'npm':
return await bumpNpmVersion(versionType);
case 'deno':
return await bumpDenoVersion(versionType);
case 'both': {
// Bump npm version first (it handles git tags)
const newVersion = await bumpNpmVersion(versionType);
// Then sync to deno.json
await syncVersionToDenoJson(newVersion);
return newVersion;
}
case 'none':
throw new Error('Cannot bump version: no package.json or deno.json found');
default:
throw new Error(`Unknown project type: ${projectType}`);
}
}

View File

@@ -126,7 +126,7 @@ export class ServiceConfiguration {
S3_ACCESSKEY: 'defaultadmin',
S3_SECRETKEY: 'defaultpass',
S3_BUCKET: `${projectName}-documents`,
S3_ENDPOINT: `http://${s3Host}:${s3PortStr}`,
S3_ENDPOINT: s3Host,
S3_USESSL: false
};
@@ -244,8 +244,7 @@ export class ServiceConfiguration {
// Always update S3_ENDPOINT based on current settings
const oldEndpoint = this.config.S3_ENDPOINT;
const protocol = this.config.S3_USESSL ? 'https' : 'http';
this.config.S3_ENDPOINT = `${protocol}://${this.config.S3_HOST}:${this.config.S3_PORT}`;
this.config.S3_ENDPOINT = this.config.S3_HOST;
if (oldEndpoint !== this.config.S3_ENDPOINT) {
fieldsAdded.push('S3_ENDPOINT');
updated = true;
@@ -335,8 +334,7 @@ export class ServiceConfiguration {
if (updated) {
// Update derived fields
this.config.MONGODB_URL = `mongodb://${this.config.MONGODB_USER}:${this.config.MONGODB_PASS}@${this.config.MONGODB_HOST}:${this.config.MONGODB_PORT}/${this.config.MONGODB_NAME}?authSource=admin`;
const protocol = this.config.S3_USESSL ? 'https' : 'http';
this.config.S3_ENDPOINT = `${protocol}://${this.config.S3_HOST}:${this.config.S3_PORT}`;
this.config.S3_ENDPOINT = this.config.S3_HOST;
await this.saveConfig();
logger.log('ok', '✅ Configuration synced with Docker containers');
@@ -393,8 +391,7 @@ export class ServiceConfiguration {
if (updated) {
// Update derived fields
this.config.MONGODB_URL = `mongodb://${this.config.MONGODB_USER}:${this.config.MONGODB_PASS}@${this.config.MONGODB_HOST}:${this.config.MONGODB_PORT}/${this.config.MONGODB_NAME}?authSource=admin`;
const protocol = this.config.S3_USESSL ? 'https' : 'http';
this.config.S3_ENDPOINT = `${protocol}://${this.config.S3_HOST}:${this.config.S3_PORT}`;
this.config.S3_ENDPOINT = this.config.S3_HOST;
await this.saveConfig();
}
@@ -423,8 +420,7 @@ export class ServiceConfiguration {
// Update derived fields
this.config.MONGODB_URL = `mongodb://${this.config.MONGODB_USER}:${this.config.MONGODB_PASS}@${this.config.MONGODB_HOST}:${this.config.MONGODB_PORT}/${this.config.MONGODB_NAME}?authSource=admin`;
const protocol = this.config.S3_USESSL ? 'https' : 'http';
this.config.S3_ENDPOINT = `${protocol}://${this.config.S3_HOST}:${this.config.S3_PORT}`;
this.config.S3_ENDPOINT = this.config.S3_HOST;
await this.saveConfig();