feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

View File

@@ -0,0 +1,8 @@
'use strict';
module.exports = {
stdin: false,
stderr: false,
supportsHyperlink: function () { // eslint-disable-line object-shorthand
return false;
}
};

View File

@@ -0,0 +1,6 @@
export function supportsHyperlink(stream: {
isTTY?: boolean | undefined;
}): boolean;
export declare const stdout: boolean;
export declare const stderr: boolean;

View File

@@ -0,0 +1,133 @@
'use strict';
const supportsColor = require('supports-color');
const hasFlag = require('has-flag');
/**
@param {string} versionString
@returns {{ major: number, minor: number, patch: number }}
*/
function parseVersion(versionString) {
if (/^\d{3,4}$/.test(versionString)) {
// Env var doesn't always use dots. example: 4601 => 46.1.0
const m = /(\d{1,2})(\d{2})/.exec(versionString) || [];
return {
major: 0,
minor: parseInt(m[1], 10),
patch: parseInt(m[2], 10)
};
}
const versions = (versionString || '').split('.').map(n => parseInt(n, 10));
return {
major: versions[0],
minor: versions[1],
patch: versions[2]
};
}
/**
@param {{ isTTY?: boolean | undefined }} stream
@returns {boolean}
*/
// eslint-disable-next-line complexity
function supportsHyperlink(stream) {
const {
CI,
FORCE_HYPERLINK,
NETLIFY,
TEAMCITY_VERSION,
TERM_PROGRAM,
TERM_PROGRAM_VERSION,
VTE_VERSION,
TERM,
} = process.env;
if (FORCE_HYPERLINK) {
return !(FORCE_HYPERLINK.length > 0 && parseInt(FORCE_HYPERLINK, 10) === 0);
}
if (hasFlag('no-hyperlink') || hasFlag('no-hyperlinks') || hasFlag('hyperlink=false') || hasFlag('hyperlink=never')) {
return false;
}
if (hasFlag('hyperlink=true') || hasFlag('hyperlink=always')) {
return true;
}
// Netlify does not run a TTY, it does not need `supportsColor` check
if (NETLIFY) {
return true;
}
// If they specify no colors, they probably don't want hyperlinks.
if (!supportsColor.supportsColor(stream)) {
return false;
}
if (stream && !stream.isTTY) {
return false;
}
// Windows Terminal
if ('WT_SESSION' in process.env) {
return true;
}
if (process.platform === 'win32') {
return false;
}
if (CI) {
return false;
}
if (TEAMCITY_VERSION) {
return false;
}
if (TERM_PROGRAM) {
const version = parseVersion(TERM_PROGRAM_VERSION || '');
switch (TERM_PROGRAM) {
case 'iTerm.app':
if (version.major === 3) {
return version.minor >= 1;
}
return version.major > 3;
case 'WezTerm':
return version.major >= 20200620;
case 'vscode':
// eslint-disable-next-line no-mixed-operators
return version.major > 1 || version.major === 1 && version.minor >= 72;
case 'ghostty':
return true;
// No default
}
}
if (VTE_VERSION) {
// 0.50.0 was supposed to support hyperlinks, but throws a segfault
if (VTE_VERSION === '0.50.0') {
return false;
}
const version = parseVersion(VTE_VERSION);
return version.major > 0 || version.minor >= 50;
}
switch (TERM) {
case 'alacritty':
// Support added in v0.11 (2022-10-13)
return true;
// No default
}
return false;
}
module.exports = {
supportsHyperlink,
stdout: supportsHyperlink(process.stdout),
stderr: supportsHyperlink(process.stderr)
};

View File

@@ -0,0 +1,10 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Copyright (c) James Talmage <james@talmage.io> (https://github.com/jamestalmage)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,49 @@
{
"name": "supports-hyperlinks",
"version": "3.2.0",
"description": "Detect whether a terminal supports hyperlinks",
"license": "MIT",
"repository": "chalk/supports-hyperlinks",
"funding": "https://github.com/chalk/supports-hyperlinks?sponsor=1",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=14.18"
},
"scripts": {
"//test": "xo && ava && tsc",
"test": "ava"
},
"files": [
"index.js",
"index.d.ts",
"browser.js"
],
"browser": "browser.js",
"keywords": [
"link",
"terminal",
"hyperlink",
"cli",
"detect",
"check",
"ansi",
"escapes",
"console"
],
"dependencies": {
"has-flag": "^4.0.0",
"supports-color": "^7.0.0"
},
"devDependencies": {
"@tsconfig/node14": "^1.0.3",
"@types/supports-color": "^8.1.1",
"ava": "^3.2.0",
"codecov": "^3.5.0",
"typescript": "^4.9.5",
"xo": "^0.53.0"
}
}

View File

@@ -0,0 +1,39 @@
# supports-hyperlinks
> Detect whether a terminal supports hyperlinks
Terminal emulators are [starting to support hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda). While many terminals have long detected URL's and linkified them, allowing you to Command-Click or Control-Click them to open a browser, you were forced to print the long unsightly URL's on the screen. As of spring 2017 [a few terminals](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) began supporting HTML like links, where the link text and destination could be specified separately.
This module allows you to detect if hyperlinks are supported in the current Terminal.
As this is a new development, we anticipate the list of supported terminals to grow rapidly. Please open an issue or submit a PR as new terminals implement support.
## Install
```sh
npm install supports-hyperlinks
```
## Usage
```js
import supportsHyperlinks from 'supports-hyperlinks';
if (supportsHyperlinks.stdout) {
console.log('Terminal stdout supports hyperlinks');
}
if (supportsHyperlinks.stderr) {
console.log('Terminal stderr supports hyperlinks');
}
```
## API
Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is a `boolean`, indicating whether or not hyperlinks are supported.
## Info
Obeys the `--no-hyperlinks`, `--hyperlink=always`, and `--hyperlink=never` CLI flags.
Can be overridden by the user with the flags `--hyperlinks=always` and `--no-hyperlinks`. For situations where using those flags are not possible, add the environment variable `FORCE_HYPERLINK=1` to forcefully enable hyperlinks or `FORCE_HYPERLINK=0` to forcefully disable. The use of `FORCE_HYPERLINK` overrides all other hyperlink support checks.