@bazilio-san/glm-cc 1.0.4 → 1.0.5
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/package.json +2 -1
- package/_tmp/glm.ps1 +0 -12
- package/scripts/pre-commit +0 -58
- package/scripts/publish.js +0 -86
- package/scripts/remove-nul.js +0 -53
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bazilio-san/glm-cc",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "CLI tool for running claude with custom GLM configuration",
|
|
5
5
|
"main": "bin/glm.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"glm": "./bin/glm.js"
|
|
8
8
|
},
|
|
9
|
+
"type": "module",
|
|
9
10
|
"scripts": {
|
|
10
11
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
12
|
},
|
package/_tmp/glm.ps1
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Set environment variables for current PowerShell session
|
|
2
|
-
$env:ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic"
|
|
3
|
-
# Макаров
|
|
4
|
-
$env:ANTHROPIC_AUTH_TOKEN = "76e74fbef042406eb6cdc9134f7e817a.NsdiQkKuihWd2yfp"
|
|
5
|
-
# Уклеин
|
|
6
|
-
$env:ANTHROPIC_AUTH_TOKEN_ = "9dbf5f5f27f44505920c03c8aafd88d1.riY7D9a3pMbQXmkn"
|
|
7
|
-
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "glm-4.5-air"
|
|
8
|
-
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "glm-4.6"
|
|
9
|
-
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "glm-4.6"
|
|
10
|
-
|
|
11
|
-
# Launch claude program (if installed and available in PATH)
|
|
12
|
-
claude
|
package/scripts/pre-commit
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
#=============== Version update before commit: minor + 1 ==========================
|
|
4
|
-
|
|
5
|
-
#File: .git/hooks/pre-commit
|
|
6
|
-
# Version 2020-08-22
|
|
7
|
-
|
|
8
|
-
c='\033[0;35m'
|
|
9
|
-
y='\033[0;33m'
|
|
10
|
-
c0='\033[0;0m'
|
|
11
|
-
g='\033[0;32m'
|
|
12
|
-
set -e
|
|
13
|
-
echo -e "$c**** [pre-commit hook] ****$c0"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
update_version(){
|
|
17
|
-
old_version=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'`
|
|
18
|
-
echo -e "$c**** Old version is $g$old_version$c ****$c0"
|
|
19
|
-
version_split=( ${old_version//./ } )
|
|
20
|
-
major=${version_split[0]:-0}
|
|
21
|
-
minor=${version_split[1]:-0}
|
|
22
|
-
patch=${version_split[2]:-0}
|
|
23
|
-
let "patch=patch+1"
|
|
24
|
-
new_version="${major}.${minor}.${patch}"
|
|
25
|
-
|
|
26
|
-
repo=`cat package.json | grep name | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'`
|
|
27
|
-
echo -e "$c**** Bumping version of $g$repo$c: $y$old_version$c -> $g$new_version$c ****$c0"
|
|
28
|
-
sed -i -e "0,/$old_version/s/$old_version/$new_version/" package.json
|
|
29
|
-
echo -e "$g"
|
|
30
|
-
npm version 2>&1 | head -2 | tail -1
|
|
31
|
-
echo -e "$c0"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
branch_name=$(git symbolic-ref --short HEAD)
|
|
35
|
-
retcode=$?
|
|
36
|
-
|
|
37
|
-
if [[ $retcode -ne 0 ]] ; then
|
|
38
|
-
echo -e "$y**** Version will not be bumped since retcode is not equals 0 ****$c0"
|
|
39
|
-
exit 0
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
if [[ $branch_name == *"_nap" ]] ; then
|
|
43
|
-
echo -e "$y**** Version will not be bumped since branch name ends with '_nap'. ****$c0"
|
|
44
|
-
exit 0
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
if [[ $branch_name == *"_local" ]] ; then
|
|
48
|
-
echo -e "$y**** Version will not be bumped since branch name ends with '_local'. ****$c0"
|
|
49
|
-
exit 0
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
if [[ "$DONT_BUMP_VERSION" -eq "1" ]] ; then
|
|
53
|
-
echo -e "$y**** Version will not be bumped since variable DONT_BUMP_VERSION is set. ****$c0"
|
|
54
|
-
exit 0
|
|
55
|
-
fi
|
|
56
|
-
|
|
57
|
-
update_version
|
|
58
|
-
git add package.json
|
package/scripts/publish.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { execSync } from 'node:child_process';
|
|
4
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
-
import { dirname, join, resolve } from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
|
|
8
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const projectRoot = resolve(__dirname, '..');
|
|
10
|
-
|
|
11
|
-
const c = '\x1b[35m';
|
|
12
|
-
const y = '\x1b[33m';
|
|
13
|
-
const r = '\x1b[31m';
|
|
14
|
-
const g = '\x1b[32m';
|
|
15
|
-
const c0 = '\x1b[0m';
|
|
16
|
-
|
|
17
|
-
function log(color, msg) {
|
|
18
|
-
process.stdout.write(`${color}${msg}${c0}\n`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function run(cmd, opts = {}) {
|
|
22
|
-
try {
|
|
23
|
-
const result = execSync(cmd, { encoding: 'utf-8', stdio: opts.stdio || 'pipe', cwd: opts.cwd || projectRoot });
|
|
24
|
-
return result ? result.trim() : '';
|
|
25
|
-
} catch (e) {
|
|
26
|
-
if (opts.ignoreError) return '';
|
|
27
|
-
log(r, `**** ERROR running: ${cmd} ****`);
|
|
28
|
-
log(r, e.stderr || e.message);
|
|
29
|
-
throw e;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function fail(msg) {
|
|
34
|
-
log(r, msg);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function readJson(filePath) {
|
|
39
|
-
return JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function bumpPatch(version) {
|
|
43
|
-
const [major, minor, patch] = version.split('.').map(Number);
|
|
44
|
-
return `${major}.${minor}.${patch + 1}`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function setJsonVersion(filePath, newVer) {
|
|
48
|
-
const content = readFileSync(filePath, 'utf-8');
|
|
49
|
-
writeFileSync(filePath, content.replace(/("version"\s*:\s*")[\d.]+(")/, `$1${newVer}$2`), 'utf-8');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ── Main ──
|
|
53
|
-
|
|
54
|
-
const expectedBranch = 'master';
|
|
55
|
-
|
|
56
|
-
const branch = run('git symbolic-ref --short HEAD');
|
|
57
|
-
if (branch !== expectedBranch) {
|
|
58
|
-
fail(`**** git branch should be ${expectedBranch}, current: ${branch} ****`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// 1. Bump version
|
|
62
|
-
const pkgPath = join(projectRoot, 'package.json');
|
|
63
|
-
const pkg = readJson(pkgPath);
|
|
64
|
-
const oldVersion = pkg.version;
|
|
65
|
-
const newVersion = bumpPatch(oldVersion);
|
|
66
|
-
const repoName = pkg.name;
|
|
67
|
-
|
|
68
|
-
log(c, `**** Bumping ${repoName}: ${oldVersion} -> ${newVersion} ****`);
|
|
69
|
-
setJsonVersion(pkgPath, newVersion);
|
|
70
|
-
|
|
71
|
-
// 2. Commit & push
|
|
72
|
-
run('git add -A');
|
|
73
|
-
run(`git commit --no-verify -m "${newVersion}"`);
|
|
74
|
-
run(`git push origin refs/heads/${expectedBranch}:${expectedBranch}`);
|
|
75
|
-
log(g, '**** Pushed commit ****');
|
|
76
|
-
|
|
77
|
-
// 3. Tag & push tag
|
|
78
|
-
run(`git tag "v${newVersion}"`);
|
|
79
|
-
run(`git push origin "v${newVersion}"`);
|
|
80
|
-
log(g, `**** Tagged v${newVersion} ****`);
|
|
81
|
-
|
|
82
|
-
// 4. npm publish
|
|
83
|
-
log(c, '**** Publishing to npm ****');
|
|
84
|
-
run('npm publish', { stdio: 'inherit' });
|
|
85
|
-
|
|
86
|
-
log(g, `\n**** Done: ${repoName}@${newVersion} ****`);
|
package/scripts/remove-nul.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Script to remove 'nul' file that accidentally gets created on Windows
|
|
5
|
-
* This file is created when using 2>nul redirection in Windows commands
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
|
-
import { dirname } from 'path';
|
|
12
|
-
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = dirname(__filename);
|
|
15
|
-
|
|
16
|
-
// Get project root (parent of scripts directory)
|
|
17
|
-
const projectRoot = path.resolve(__dirname, '..');
|
|
18
|
-
|
|
19
|
-
// File to remove
|
|
20
|
-
const nulFile = path.join(projectRoot, 'nul');
|
|
21
|
-
|
|
22
|
-
// Check if file exists and remove it
|
|
23
|
-
if (fs.existsSync(nulFile)) {
|
|
24
|
-
try {
|
|
25
|
-
fs.unlinkSync(nulFile);
|
|
26
|
-
console.log('✅ Removed "nul" file from project root');
|
|
27
|
-
} catch (error) {
|
|
28
|
-
console.error('❌ Error removing "nul" file:', error.message);
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
console.log('ℹ️ No "nul" file found in project root');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Also check for other common accidental files on Windows
|
|
36
|
-
const accidentalFiles = ['nul', 'NUL', 'con', 'CON', 'aux', 'AUX', 'prn', 'PRN'];
|
|
37
|
-
|
|
38
|
-
accidentalFiles.forEach(fileName => {
|
|
39
|
-
const filePath = path.join(projectRoot, fileName);
|
|
40
|
-
if (fs.existsSync(filePath)) {
|
|
41
|
-
try {
|
|
42
|
-
const stats = fs.statSync(filePath);
|
|
43
|
-
if (stats.isFile()) {
|
|
44
|
-
fs.unlinkSync(filePath);
|
|
45
|
-
console.log(`✅ Removed "${fileName}" file from project root`);
|
|
46
|
-
}
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error(`⚠️ Could not remove "${fileName}":`, error.message);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
console.log('🎯 Cleanup completed');
|