feat(cli): Add CLI support with command parsing and version display

This commit is contained in:
Philipp Kunz 2025-03-01 19:19:28 +00:00
parent 761f9ca1b6
commit c4a082031e
7 changed files with 56 additions and 2 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## 2025-03-01 - 1.3.0 - feat(cli)
Add CLI support with command parsing and version display
- Added a basic CLI interface using smartcli.
- Implemented command parsing with a 'restart' command.
- Integrated project version display in the CLI.
## 2025-03-01 - 1.2.0 - feat(core)
Introduce ProcessMonitor with memory management and spawning features

View File

@ -11,7 +11,8 @@
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "(tsdoc)"
"buildDocs": "(tsdoc)",
"start": "(tsrun ./cli.ts -v)"
},
"devDependencies": {
"@git.zone/tsbuild": "^2.1.25",
@ -22,6 +23,7 @@
"@types/node": "^22.13.8"
},
"dependencies": {
"@push.rocks/projectinfo": "^5.0.2",
"@push.rocks/smartcli": "^4.0.11",
"@push.rocks/smartpath": "^5.0.18",
"pidusage": "^4.0.0",

13
pnpm-lock.yaml generated
View File

@ -8,6 +8,9 @@ importers:
.:
dependencies:
'@push.rocks/projectinfo':
specifier: ^5.0.2
version: 5.0.2
'@push.rocks/smartcli':
specifier: ^4.0.11
version: 4.0.11
@ -710,6 +713,9 @@ packages:
'@push.rocks/mongodump@1.0.8':
resolution: {integrity: sha512-oDufyjNBg8I50OaJvbHhc0RnRpJQ544dr9her0G6sA8JmI3hD2/amTdcPLVIX1kzYf5GsTUKeWuRaZgdNqz3ew==}
'@push.rocks/projectinfo@5.0.2':
resolution: {integrity: sha512-zzieCal6jwR++o+fDl8gMpWkNV2cGEsbT96vCNZu/H9kr0iqRmapOiA4DFadkhOnhlDqvRr6TPaXESu2YUbI8Q==}
'@push.rocks/qenv@6.1.0':
resolution: {integrity: sha512-1FUFMlSVwFSFg8LbqfkzJ2LLP4lMGApUtgOpsvrde6+AxBmB4gjoNgCUH7z3xXfDAtYqcrtSELXBNE0xVL1MqQ==}
@ -5412,6 +5418,13 @@ snapshots:
transitivePeerDependencies:
- aws-crt
'@push.rocks/projectinfo@5.0.2':
dependencies:
'@push.rocks/smartfile': 10.0.41
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartstring': 4.0.15
'@push.rocks/qenv@6.1.0':
dependencies:
'@api.global/typedrequest': 3.1.10

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tspm',
version: '1.2.0',
version: '1.3.0',
description: 'a no fuzz process manager'
}

21
ts/cli.ts Normal file
View File

@ -0,0 +1,21 @@
import * as plugins from './plugins.js';
import * as paths from './paths.js';
export const run = async () => {
const tspmProjectinfo = new plugins.projectinfo.ProjectInfo(paths.packageDir);
const smartcliInstance = new plugins.smartcli.Smartcli();
smartcliInstance.addVersion(tspmProjectinfo.npm.version);
smartcliInstance.standardCommand().subscribe({
next: (argvArg) => {
console.log(`Please specify a command.`)
},
});
smartcliInstance.addCommand('restart').subscribe({
})
smartcliInstance.startParse();
}

View File

@ -1,2 +1,11 @@
export * from './classes.tspm.js';
export * from './classes.processmonitor.js';
import * as cli from './cli.js';
/**
* called to run as cli
*/
export const runCli = async () => {
await cli.run();
}

View File

@ -8,10 +8,12 @@ export {
}
// @push.rocks scope
import * as projectinfo from '@push.rocks/projectinfo';
import * as smartpath from '@push.rocks/smartpath';
import * as smartcli from '@push.rocks/smartcli';
export {
projectinfo,
smartpath,
smartcli,
}