Compare commits

..

96 Commits

Author SHA1 Message Date
jkunz c07b2969b8 v4.1.0
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
2026-05-13 14:52:58 +00:00
jkunz a5ec2717c5 feat(terminal): add live terminal task rendering with interactive and non-interactive output modes 2026-05-13 14:52:18 +00:00
jkunz 8852bd5c86 v4.0.21
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
2026-04-30 14:29:50 +00:00
jkunz 6279f2cbad fix(smartcli): tighten command parsing and error handling while updating build and package configuration 2026-04-30 14:29:50 +00:00
jkunz e3f5616320 fix(core): Remove flawed safety check in getUserArgs and debug log
- Fixed bug where CLI with no args would return entire argv including node path
- Removed debug 'Wanted command: ...' log from startParse()
2026-01-12 01:22:25 +00:00
jkunz 40c0dfb3df 4.0.19
Default (tags) / security (push) Failing after 22s
Default (tags) / test (push) Failing after 15s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-28 18:38:18 +00:00
jkunz 4f243289b8 fix(license): Update license files 2025-10-28 18:38:18 +00:00
jkunz 2d28939986 4.0.18
Default (tags) / security (push) Failing after 27s
Default (tags) / test (push) Failing after 26s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-28 15:42:40 +00:00
jkunz 01623eab2a fix(smartcli): Allow passing argv to startParse and improve getUserArgs Deno/runtime handling; update tests and add license 2025-10-28 15:42:39 +00:00
jkunz 5c65c43589 4.0.17
Default (tags) / security (push) Failing after 21s
Default (tags) / test (push) Failing after 13s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-28 15:10:45 +00:00
jkunz 72109e478f fix(license): Add MIT license and local Claude settings 2025-10-28 15:10:44 +00:00
jkunz 53d9956735 4.0.16
Default (tags) / security (push) Failing after 21s
Default (tags) / test (push) Failing after 13s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-28 14:59:46 +00:00
jkunz 913f8556d0 fix(smartcli.helpers): Improve CLI argument parsing and Deno runtime detection; use getUserArgs consistently 2025-10-28 14:59:46 +00:00
jkunz e905af4b21 4.0.15
Default (tags) / security (push) Failing after 22s
Default (tags) / test (push) Failing after 14s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-28 13:53:34 +00:00
jkunz 2e0b7d5053 fix(smartcli.helpers): Add robust getUserArgs helper and refactor Smartcli to use it; add MIT license and update documentation 2025-10-28 13:53:34 +00:00
jkunz 270f75e8e0 4.0.14
Default (tags) / security (push) Failing after 21s
Default (tags) / test (push) Failing after 12s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-28 09:32:21 +00:00
jkunz b9ec1e2be6 fix(license): Add MIT license file 2025-10-28 09:32:21 +00:00
jkunz 86d62407e7 4.0.13
Default (tags) / security (push) Failing after 23s
Default (tags) / test (push) Failing after 13s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-10-28 06:27:29 +00:00
jkunz 6efd6232d1 fix(smartcli): Improve CLI argument parsing, update deps and tests 2025-10-28 06:27:29 +00:00
philkunz 44296dc57a 4.0.12 2025-04-01 14:19:35 +00:00
philkunz a08627f058 fix(docs): Update documentation with comprehensive usage examples, improved command alias descriptions, and detailed configuration instructions 2025-04-01 14:19:35 +00:00
philkunz e525e04b07 update description 2024-05-29 14:12:09 +02:00
philkunz 5e2225669d 4.0.11 2024-05-28 13:42:11 +02:00
philkunz a4a3343b1d fix(core): update 2024-05-28 13:42:10 +02:00
philkunz e10e8cf90d 4.0.10 2024-04-14 01:02:06 +02:00
philkunz 19900d088e fix(core): update 2024-04-14 01:02:06 +02:00
philkunz 3e5793f842 4.0.9 2024-04-12 18:24:32 +02:00
philkunz 4fd13e65c4 fix(core): update 2024-04-12 18:24:31 +02:00
philkunz e5a8bbf4a3 update npmextra.json: githost 2024-04-01 21:34:10 +02:00
philkunz f28589603b update npmextra.json: githost 2024-04-01 19:57:50 +02:00
philkunz fed411a30f update npmextra.json: githost 2024-03-30 21:46:48 +01:00
philkunz 2328801f03 4.0.8 2023-08-19 09:47:04 +02:00
philkunz 60883fed6d fix(core): update 2023-08-19 09:47:03 +02:00
philkunz e9fc5b98f2 4.0.7 2023-07-12 15:09:53 +02:00
philkunz fef954c423 fix(core): update 2023-07-12 15:09:53 +02:00
philkunz 39408d9832 switch to new org scheme 2023-07-11 00:25:26 +02:00
philkunz 26d9b3e9cc switch to new org scheme 2023-07-10 02:42:41 +02:00
philkunz 5f027430bf 4.0.6 2022-08-07 11:40:46 +02:00
philkunz d3385782ed fix(core): update 2022-08-07 11:40:45 +02:00
philkunz 7384b54e09 4.0.5 2022-08-04 12:22:49 +02:00
philkunz 0eac72e15d fix(core): update 2022-08-04 12:22:49 +02:00
philkunz b7957b0ab6 4.0.4 2022-08-03 20:21:54 +02:00
philkunz 99a0a9ca81 fix(core): update 2022-08-03 20:21:54 +02:00
philkunz bd66903419 4.0.3 2022-08-03 18:48:40 +02:00
philkunz 740d8dac35 fix(core): update 2022-08-03 18:48:40 +02:00
philkunz 488e7410fe 4.0.2 2022-08-03 18:47:35 +02:00
philkunz 04deb8960c fix(core): update 2022-08-03 18:47:35 +02:00
philkunz 19f0a9563f 4.0.1 2022-08-03 17:07:11 +02:00
philkunz db1e866fe1 fix(core): update 2022-08-03 17:07:11 +02:00
philkunz f7c24a0bd2 4.0.0 2022-08-03 17:00:36 +02:00
philkunz fa59d2da40 BREAKING CHANGE(core): switch to esm 2022-08-03 17:00:36 +02:00
philkunz 311232aeea 3.0.14 2021-04-07 20:28:58 +00:00
philkunz 4cd0844bc3 fix(core): update 2021-04-07 20:28:57 +00:00
philkunz 17c1a687c8 3.0.13 2021-04-07 20:25:18 +00:00
philkunz 1d1264c2b3 fix(core): update 2021-04-07 20:25:17 +00:00
philkunz b036e609ce 3.0.12 2020-05-29 17:48:18 +00:00
philkunz c2ec0df907 fix(core): update 2020-05-29 17:48:17 +00:00
philkunz 167b4d29df 3.0.11 2020-04-13 21:53:18 +00:00
philkunz 02fec216db fix(core): more consistent handling of process.enc.CLI_CALL 2020-04-13 21:53:18 +00:00
philkunz 4e9d2f3e8c 3.0.10 2020-04-13 21:44:27 +00:00
philkunz 65d8a8b6f5 fix(core): now works better with tapbundle tests 2020-04-13 21:44:27 +00:00
philkunz 8e04bd6a62 3.0.9 2020-03-11 22:50:40 +00:00
philkunz 687a5f7c4e fix(core): update 2020-03-11 22:50:40 +00:00
philkunz 17983b1da9 3.0.8 2020-03-11 22:49:44 +00:00
philkunz 5fcdf1ff8f fix(core): update 2020-03-11 22:49:43 +00:00
philkunz ef7ee7fc73 3.0.7 2018-12-11 01:50:59 +01:00
philkunz c48e85897e fix(core): update 2018-12-11 01:50:59 +01:00
philkunz 9466b3e473 3.0.6 2018-09-30 22:45:12 +02:00
philkunz ab3127b8a6 fix(ci): remove obsolete dependencies 2018-09-30 22:45:12 +02:00
philkunz 1e62e27980 3.0.5 2018-09-30 22:36:31 +02:00
philkunz 4b87004478 fix(core): update 2018-09-30 22:36:30 +02:00
philkunz 7750f1fbf5 3.0.4 2018-08-31 00:14:18 +02:00
philkunz c4e5ba6587 fix(structure): remove dist/ dir from git repo 2018-08-31 00:14:18 +02:00
philkunz 9d1f0f22ba 3.0.3 2018-08-31 00:13:05 +02:00
philkunz 1ce9e32116 fix(dependencies): update to latest versions 2018-08-31 00:13:05 +02:00
Phil Kunz adfda70522 3.0.2 2018-06-28 23:57:41 +02:00
Phil Kunz c701e3e04c fix(core): slim down dependencies 2018-06-28 23:57:40 +02:00
philkunz 7b1de5b31d 3.0.1 2018-05-04 00:19:45 +02:00
philkunz 7908fd8cfd update 2018-05-04 00:19:41 +02:00
philkunz 21bd0c9279 3.0.0 2018-05-03 12:10:48 +02:00
philkunz 9d1108e40d change to an all rxjs Subject architecture 2018-05-03 12:10:39 +02:00
philkunz 390e0cb491 system change 2018-03-03 13:57:54 +01:00
philkunz 032fd0c2fd fix(core): cleanup 2018-01-27 18:06:13 +01:00
philkunz 440881c3d8 remove package-lock since using yarn 2018-01-27 18:05:06 +01:00
philkunz f208121e2c 2.0.12 2018-01-27 18:02:05 +01:00
philkunz 7c4ae84871 fix(improve security CI step): 2018-01-27 18:02:01 +01:00
philkunz 668f6c3e16 2.0.11 2018-01-27 17:59:08 +01:00
philkunz b1e08aad1f fix(core): remove vulnerable paths 2018-01-27 17:59:04 +01:00
philkunz f1ab614cdf update ci 2018-01-27 02:27:55 +01:00
philkunz 995c808512 update ci 2018-01-27 02:26:10 +01:00
philkunz 28acb867a0 update ci 2018-01-27 02:23:24 +01:00
philkunz 3148a50d43 update ci 2018-01-27 02:21:53 +01:00
philkunz 41c99de4d8 2.0.10 2018-01-27 02:20:46 +01:00
philkunz a91f56dacf add security step to CI 2018-01-27 02:20:41 +01:00
philkunz f60f17f91e 2.0.9 2017-10-12 23:02:03 +02:00
philkunz d154cf0d0f ensure compatibility with code assertion library 2017-10-12 23:02:00 +02:00
34 changed files with 15865 additions and 1453 deletions
+66
View File
@@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
+124
View File
@@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true
+17 -1
View File
@@ -1,4 +1,20 @@
node_modules/
.nogit/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom
-86
View File
@@ -1,86 +0,0 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- mirror
- test
- release
- trigger
- pages
mirror:
stage: mirror
script:
- npmci git mirror
tags:
- docker
testLEGACY:
stage: test
script:
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci npm prepare
- npmci npm publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
script:
- npmci command yarn global add npmpage
- npmci command npmpage
tags:
- docker
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
+32
View File
@@ -0,0 +1,32 @@
{
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartcli",
"description": "A library that simplifies building reactive command-line applications using observables, with robust support for commands, arguments, options, aliases, and asynchronous operation management.",
"npmPackagename": "@push.rocks/smartcli",
"license": "MIT",
"projectDomain": "push.rocks"
},
"release": {
"targets": {
"npm": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
}
},
"schemaVersion": 2
},
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [LICENSE](LICENSE) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
},
"@ship.zone/szci": {
"npmGlobalTools": []
}
}
+11
View File
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Push.Rocks
Copyright (c) 2015 Task Venture Capital GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
-26
View File
@@ -1,26 +0,0 @@
# smartcli
nodejs wrapper for CLI related tasks
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartcli)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartcli)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartcli)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartcli/)
## Status for master
[![build status](https://GitLab.com/pushrocks/smartcli/badges/master/build.svg)](https://GitLab.com/pushrocks/smartcli/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartcli/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartcli/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartcli.svg)](https://www.npmjs.com/package/smartcli)
[![Dependency Status](https://david-dm.org/pushrocks/smartcli.svg)](https://david-dm.org/pushrocks/smartcli)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartcli/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartcli/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartcli/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartcli)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://)
+424
View File
@@ -0,0 +1,424 @@
# Changelog
## Pending
## 2026-05-13 - 4.1.0
### Features
- add live terminal task rendering with interactive and non-interactive output modes (terminal)
- introduces SmartcliTerminal and SmartcliTerminalTask exports for fixed-row task rendering
- supports task updates, completion, failure handling, and persistent error output
- detects interactive terminals and falls back to append-only logs in CI or non-TTY environments
- adds tests covering interactive rendering, non-interactive logging, and error attachment behavior
## 2026-04-30 - 4.0.21 - fix(smartcli)
tighten command parsing and error handling while updating build and package configuration
- throw an explicit error when triggering an unregistered command instead of failing on an undefined subject
- make the cli version property optional to align with current typing expectations
- update tests to use explicit argv input and export the tap startup call for runtime compatibility
- enable stricter TypeScript configuration and refresh build, dependency, and package metadata files
## 2025-10-28 - 4.0.19 - fix(license)
Update license files and add local tool settings
- Update LICENSE header to reference Task Venture Capital GmbH as copyright holder
- Add a new license file containing the full MIT license text
- Add .claude/settings.local.json to store local tool permission settings
## 2025-10-28 - 4.0.18 - fix(smartcli)
Allow passing argv to startParse and improve getUserArgs Deno/runtime handling; update tests and add license
- Smartcli.startParse now accepts an optional testArgv parameter to bypass automatic runtime detection (makes testing deterministic).
- getUserArgs logic refined: always prefer Deno.args when available (handles Deno run and compiled executables reliably) and improve execPath fallback and slicing behavior for Node/Bun/other launchers.
- Tests updated: test/test.node+deno+bun.ts now passes process.argv explicitly to startParse to avoid Deno.args interference in test environments.
- Added MIT LICENSE file and a local .claude/settings.local.json for environment/permission settings.
## 2025-10-28 - 4.0.17 - fix(license)
Add MIT license and local Claude settings
- Add LICENSE file (MIT) to repository
- Add .claude/settings.local.json with local permissions for tooling
## 2025-10-28 - 4.0.16 - fix(smartcli.helpers)
Improve CLI argument parsing and Deno runtime detection; use getUserArgs consistently
- Enhance getUserArgs() to prefer Deno.args but detect when process.argv was manipulated (e.g. in tests) and fallback to manual parsing
- Add robust handling of process.execPath / execPath basename and compute correct argv offset for known launchers vs. compiled executables
- Call getUserArgs() (no explicit process.argv) from Smartcli.getOption and Smartcli.startParse to ensure consistent cross-runtime behavior
- Expand readme.hints.md with detailed cross-runtime examples and explanation of Deno.args vs process.argv for compiled executables
- Add local claude settings file for tooling configuration
## 2025-10-28 - 4.0.15 - fix(smartcli.helpers)
Add robust getUserArgs helper and refactor Smartcli to use it; add MIT license and update documentation
- Add ts/smartcli.helpers.ts: getUserArgs to normalize user arguments across Node.js, Deno (run/compiled), and Bun, with safety checks for test environments
- Refactor Smartcli (ts/smartcli.classes.smartcli.ts) to use getUserArgs in startParse and getOption for correct argument parsing and improved test compatibility
- Update readme.hints.md with detailed cross-runtime CLI argument parsing guidance
- Add LICENSE (MIT) file
- Add .claude/settings.local.json (local settings)
## 2025-10-28 - 4.0.14 - fix(license)
Add MIT license file
- Add MIT License file to repository to clarify licensing and copyright (Push.Rocks 2015).
## 2025-10-27 - 4.0.13 - fix(smartcli)
Improve CLI argument parsing, update deps and tests
- Enhance startParse() to filter runtime executables and script paths (node, deno, bun, tsx, ts-node) so commands are detected correctly across runtimes.
- Switch path import to node:path in plugins for ESM compatibility.
- Bump various dependencies and devDependencies (including @push.rocks/lik, @push.rocks/smartlog, @push.rocks/smartpromise, @push.rocks/smartrx, yargs-parser, @git.zone tooling) and add packageManager field.
- Replace / reorganize tests: add/modify test/test.node+deno+bun.ts, adjust test script to use --verbose.
- Add deno.lock and include many resolved npm dependencies.
- Add LICENSE file (MIT).
## 2025-04-01 - 4.0.12 - fix(docs)
Update documentation with comprehensive usage examples, improved command alias descriptions, and detailed configuration instructions
- Revised readme.md with in-depth examples covering multiple CLI scenarios and RxJS integration
- Updated package.json and npmextra.json descriptions and keywords to reflect enhanced functionality
- Expanded usage guide with additional commands, error handling strategies, and testing guidelines
## 2024-05-29 - 4.0.11 - general
update description
- Updated the project description
## 2024-05-28 - 4.0.10 - core
fix(core): update
- Fixed core functionality
## 2024-04-13 - 4.0.9 - core
fix(core): update
- Improved core update handling
## 2024-04-12 - 4.0.8 - core / npmextra
- fix(core): update
- update npmextra.json: githost (this change was applied multiple times)
## 2023-08-19 - 4.0.7 - core
fix(core): update
- Fixed core issues
## 2023-07-12 - 4.0.6 - core / org
- fix(core): update
- switch to new org scheme (applied twice)
## 2022-08-07 - 4.0.5 - core
fix(core): update
- Fixed core functionality
## 2022-08-04 - 4.0.4 - core
fix(core): update
- Improved core update
## 2022-08-03 - 4.0.3 - core
fix(core): update
- Fixed core issues
## 2022-08-03 - 4.0.2 - core
fix(core): update
- Updated core handling
## 2022-08-03 - 4.0.1 - core
fix(core): update
- Fixed core functionality
## 2022-08-03 - 4.0.0 - core
fix(core): update
- Improved core update handling
## 2022-08-03 - 3.0.14 - core
BREAKING CHANGE(core): switch to esm
- Switched the project to use ECMAScript modules
## 2021-04-07 - 3.0.13 - core
fix(core): update
- Fixed core update issues
## 2021-04-07 - 3.0.12 - core
fix(core): update
- Updated core functionality
## 2020-05-29 - 3.0.11 - core
fix(core): update
- Fixed core functionality
## 2020-04-13 - 3.0.10 - core
fix(core): more consistent handling of process.enc.CLI_CALL
- Made process.enc.CLI_CALL handling more consistent
## 2020-04-13 - 3.0.9 - core
fix(core): now works better with tapbundle tests
- Improved compatibility with tapbundle tests
## 2020-03-11 - 3.0.8 - core
fix(core): update
- Updated core functionality
## 2020-03-11 - 3.0.7 - core
fix(core): update
- Fixed core update issues
## 2018-12-11 - 3.0.6 - core
fix(core): update
- Updated core functionality
## 2018-09-30 - 3.0.5 - ci
fix(ci): remove obsolete dependencies
- Removed obsolete dependencies from CI configuration
## 2018-09-30 - 3.0.4 - core
fix(core): update
- Updated core functionality
## 2018-08-30 - 3.0.3 - structure
fix(structure): remove dist/ dir from git repo
- Removed the dist/ directory from the repository
## 2018-08-30 - 3.0.2 - dependencies
fix(dependencies): update to latest versions
- Bumped dependency versions to the latest
## 2018-06-28 - 3.0.1 - core
fix(core): slim down dependencies
- Slimmed down core dependencies
## 2018-05-03 - 3.0.0 - general
update
- General update
## 2018-05-03 - 2.0.12 - core / architecture
- change to an all rxjs Subject architecture
- system change
- fix(core): cleanup
- remove package-lock since using yarn
## 2018-01-27 - 2.0.11 - security
fix(improve security CI step):
- Improved security in the CI step
## 2018-01-27 - 2.0.10 - core / ci
- fix(core): remove vulnerable paths
- update ci (applied multiple times)
## 2018-01-27 - 2.0.09 - CI
add security step to CI
- Added an extra security step in the CI process
## 2017-10-12 - 2.0.08 - compatibility
ensure compatibility with code assertion library
- Ensured compatibility with the code assertion library
## 2017-10-12 - 2.0.07 - tests / cli
- fix tests and add .triggerOnlyOnProcessEnvCliCall()
- fix linting issues
## 2017-05-07 - 2.0.06 - tasks
fix promise rejection on standard task
- Fixed a promise rejection issue on standard tasks
## 2017-04-23 - 2.0.05 - tapbundle
use new tapbundle
- Switched to the new tapbundle for testing
## 2017-04-22 - 2.0.04 - tests
- comment out one test that makes problems due to tap
- update tests
## 2017-04-22 - 2.0.03 - npmextra
add npmextra.json
- Added npmextra.json for extra configuration
## 2017-04-22 - 2.0.02 - ci
update ci
- Updated CI configuration
## 2017-04-22 - 2.0.01 - misc
- update .gitignore
- update to latest standards
## 2016-12-18 - 2.0.00 - core
fix argvArg for observables
- Fixed the argvArg handling for observables
## 2016-12-18 - 1.0.16 - triggers
introduce triggers
- Introduced triggers
## 2016-11-19 - 1.0.15 - triggers / docs
- added .triggerCommandByName
- improve README
## 2016-11-19 - 1.0.14 - metadata
Update Metadata
- Updated project metadata
## 2016-11-19 - 1.0.13 - docs
improve README
- Improved the README documentation
## 2016-11-19 - 1.0.11 - core / tests / docs
- cleanup
- improve README
- update test file
## 2016-10-14 - 1.0.10 - deps
update deps
- Updated dependencies
## 2016-10-14 - 1.0.09 - standardJS
implement standardJS
- Implemented standardJS support
## 2016-09-04 - 1.0.08 - typings
improve typings
- Improved TypeScript typings
## 2016-09-04 - 1.0.07 - ci
fix ci
- Fixed CI configuration
## 2016-09-04 - 1.0.06 - base
fix base image
- Fixed the base image used for builds
## 2016-09-04 - 1.0.05 - interaction
- add page stage
- improve typings and docs
- update smartcli
- Add new file
- start interaction module
## 2016-08-26 - 1.0.04 - intellisense
improve intellisense
- Improved editor intellisense
## 2016-06-22 - 1.0.03 - compile
compile fix
- Fixed compilation issues
## 2016-06-22 - 1.0.02 - updates
- fix
- add getCommandPromise
- update deps and transition from npmts to npmts-g
## 2016-06-16 - 1.0.01 - tasks
- standard tasks now returns argv
- some cosmetics
- introduce new classes
## 2016-06-10 - 1.0.00 - version
- fix version return
- return argv to command
## 2016-06-10 - 0.0.13 - smartcli
- first version with basic funtionality
- remove bulk and add some features to Smartcli class
- start restructuring to use a smarter Smartcli class that handles command evaluation for you
- update dependencies
- compile
- add gitlab ci
- start smartcli class
- add class smartcli
- Update README and include commander
- fixed type issue
- fixed test issue
- update deps
## 2016-04-04 - 0.0.12 - deps
updated deps
- Updated dependencies
## 2016-04-04 - 0.0.11 - interface
- updated deps
- work in progress (noted twice)
- small interface fix
## 2015-11-09 - 0.0.10 - travis
improve travis process
- Improved the Travis process
## 2015-11-09 - 0.0.09 - tests / CLI
- add tests and fix some errors
- add Tests and improve TypeScript organization
- start smarter CLI logic
- fix small comment error (applied twice)
## 2015-10-14 - 0.0.08 - readme
- improved readme
- updated readme
- added devStatus badge
## 2015-10-12 - 0.0.07 - various
- improved return objects
- (Minor dependency updates and CI tweaks for beautylog and travis were also applied in this version)
## 2015-10-06 - 0.0.05 - CLI
- small update
- now handling CLI options
## 2015-10-05 - 0.0.4 - tests
modified test
## 2015-10-05 - 0.0.02 - travis / tests
- added travis + tests
- package.json update
## 2015-10-04 - 0.0.01 - initial
added initial structure
## 2015-10-04 - unknown - initial
Initial commit
---
## Summary of Omitted Versions
The following versions contained no additional userfacing changes beyond version bumps and are summarized here: 1.0.12, 0.0.6, and 0.0.3.
Generated
+6244
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
export { Smartcli } from './smartcli.classes.smartcli';
-5
View File
@@ -1,5 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var smartcli_classes_smartcli_1 = require("./smartcli.classes.smartcli");
exports.Smartcli = smartcli_classes_smartcli_1.Smartcli;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlFQUFzRDtBQUE3QywrQ0FBQSxRQUFRLENBQUEifQ==
-70
View File
@@ -1,70 +0,0 @@
import * as smartq from 'smartq';
import { Subject } from 'rxjs';
import { Objectmap } from 'lik';
export interface ICommandPromiseObject {
commandName: string;
promise: Promise<void>;
}
export interface ITriggerObservableObject {
triggerName: string;
subject: Subject<any>;
}
export declare class Smartcli {
argv: any;
questionsDone: any;
parseStarted: smartq.Deferred<any>;
commands: any;
questions: any;
version: string;
private onlyOnProcessEnvCliCall;
/**
* map of all Command/Promise objects to keep track
*/
allCommandPromisesMap: Objectmap<ICommandPromiseObject>;
/**
* map of all Trigger/Observable objects to keep track
*/
allTriggerObservablesMap: Objectmap<ITriggerObservableObject>;
constructor();
onlyTriggerOnProcessEnvCliCall(): void;
/**
* adds an alias, meaning one equals the other in terms of command execution.
*/
addCommandAlias(keyArg: any, aliasArg: any): void;
/**
* adds a Command by returning a Promise that reacts to the specific commandString given.
* Note: in e.g. "npm install something" the "install" is considered the command.
*/
addCommand(commandNameArg: string): Promise<any>;
/**
* gets a Promise for a command word
*/
getCommandPromiseByName(commandNameArg: string): Promise<void>;
/**
* adds a Trigger. Like addCommand(), but returns an subscribable observable
*/
addTrigger(triggerNameArg: string): Subject<any>;
/**
* execute trigger by name
* @param commandNameArg - the name of the command to trigger
*/
trigger(triggerName: string): Subject<any>;
/**
* allows to specify help text to be printed above the rest of the help text
*/
addHelp(optionsArg: {
helpText: string;
}): void;
/**
* specify version to be printed for -v --version
*/
addVersion(versionArg: string): void;
/**
* returns promise that is resolved when no commands are specified
*/
standardTask(): Promise<any>;
/**
* start the process of evaluating commands
*/
startParse(): void;
}
-142
View File
@@ -1,142 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartq = require("smartq");
const rxjs_1 = require("rxjs");
const plugins = require("./smartcli.plugins");
// import classes
const lik_1 = require("lik");
class Smartcli {
constructor() {
this.onlyOnProcessEnvCliCall = false;
/**
* map of all Command/Promise objects to keep track
*/
this.allCommandPromisesMap = new lik_1.Objectmap();
/**
* map of all Trigger/Observable objects to keep track
*/
this.allTriggerObservablesMap = new lik_1.Objectmap();
this.argv = plugins.yargs;
this.questionsDone = smartq.defer();
this.parseStarted = smartq.defer();
}
onlyTriggerOnProcessEnvCliCall() {
this.onlyOnProcessEnvCliCall = true;
}
/**
* adds an alias, meaning one equals the other in terms of command execution.
*/
addCommandAlias(keyArg, aliasArg) {
this.argv = this.argv.alias(keyArg, aliasArg);
return;
}
/**
* adds a Command by returning a Promise that reacts to the specific commandString given.
* Note: in e.g. "npm install something" the "install" is considered the command.
*/
addCommand(commandNameArg) {
let done = smartq.defer();
this.allCommandPromisesMap.add({
commandName: commandNameArg,
promise: done.promise
});
this.parseStarted.promise
.then(() => {
if (this.argv._.indexOf(commandNameArg) === 0) {
done.resolve(this.argv);
}
});
return done.promise;
}
/**
* gets a Promise for a command word
*/
getCommandPromiseByName(commandNameArg) {
return this.allCommandPromisesMap.find(commandDeferredObjectArg => {
return commandDeferredObjectArg.commandName === commandNameArg;
}).promise;
}
/**
* adds a Trigger. Like addCommand(), but returns an subscribable observable
*/
addTrigger(triggerNameArg) {
let triggerSubject = new rxjs_1.Subject();
this.allTriggerObservablesMap.add({
triggerName: triggerNameArg,
subject: triggerSubject
});
this.addCommand(triggerNameArg).then(() => {
triggerSubject.next(this.argv);
});
return triggerSubject;
}
/**
* execute trigger by name
* @param commandNameArg - the name of the command to trigger
*/
trigger(triggerName) {
let triggerSubject = this.allTriggerObservablesMap.find(triggerObservableObjectArg => {
return triggerObservableObjectArg.triggerName === triggerName;
}).subject;
triggerSubject.next(this.argv);
return triggerSubject;
}
/**
* allows to specify help text to be printed above the rest of the help text
*/
addHelp(optionsArg) {
this.addCommand('help').then(argvArg => {
plugins.beautylog.log(optionsArg.helpText);
});
}
/**
* specify version to be printed for -v --version
*/
addVersion(versionArg) {
this.version = versionArg;
this.addCommandAlias('v', 'version');
this.parseStarted.promise
.then(() => {
if (this.argv.v) {
console.log(this.version);
}
});
}
/**
* returns promise that is resolved when no commands are specified
*/
standardTask() {
let done = smartq.defer();
this.allCommandPromisesMap.add({
commandName: 'standard',
promise: done.promise
});
this.parseStarted.promise
.then(() => {
if (this.argv._.length === 0 && !this.argv.v) {
if (this.onlyOnProcessEnvCliCall) {
if (process.env.CLI_CALL === 'true') {
done.resolve(this.argv);
}
else {
return;
}
}
else {
done.resolve(this.argv);
}
}
});
return done.promise;
}
/**
* start the process of evaluating commands
*/
startParse() {
this.argv = this.argv.argv;
this.parseStarted.resolve();
return;
}
}
exports.Smartcli = Smartcli;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkuY2xhc3Nlcy5zbWFydGNsaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLmNsYXNzZXMuc21hcnRjbGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpQ0FBZ0M7QUFDaEMsK0JBQThCO0FBRTlCLDhDQUE2QztBQUU3QyxpQkFBaUI7QUFDakIsNkJBQStCO0FBYS9CO0lBbUJFO1FBWlEsNEJBQXVCLEdBQUcsS0FBSyxDQUFBO1FBRXZDOztXQUVHO1FBQ0gsMEJBQXFCLEdBQUcsSUFBSSxlQUFTLEVBQXlCLENBQUE7UUFFOUQ7O1dBRUc7UUFDSCw2QkFBd0IsR0FBRyxJQUFJLGVBQVMsRUFBNEIsQ0FBQTtRQUdsRSxJQUFJLENBQUMsSUFBSSxHQUFHLE9BQU8sQ0FBQyxLQUFLLENBQUE7UUFDekIsSUFBSSxDQUFDLGFBQWEsR0FBRyxNQUFNLENBQUMsS0FBSyxFQUFFLENBQUE7UUFDbkMsSUFBSSxDQUFDLFlBQVksR0FBRyxNQUFNLENBQUMsS0FBSyxFQUFFLENBQUE7SUFDcEMsQ0FBQztJQUVELDhCQUE4QjtRQUM1QixJQUFJLENBQUMsdUJBQXVCLEdBQUcsSUFBSSxDQUFBO0lBQ3JDLENBQUM7SUFFRDs7T0FFRztJQUNILGVBQWUsQ0FBRSxNQUFNLEVBQUUsUUFBUTtRQUMvQixJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sRUFBRSxRQUFRLENBQUMsQ0FBQTtRQUM3QyxNQUFNLENBQUE7SUFDUixDQUFDO0lBRUQ7OztPQUdHO0lBQ0gsVUFBVSxDQUFFLGNBQXNCO1FBQ2hDLElBQUksSUFBSSxHQUFHLE1BQU0sQ0FBQyxLQUFLLEVBQU8sQ0FBQTtRQUM5QixJQUFJLENBQUMscUJBQXFCLENBQUMsR0FBRyxDQUFDO1lBQzdCLFdBQVcsRUFBRSxjQUFjO1lBQzNCLE9BQU8sRUFBRSxJQUFJLENBQUMsT0FBTztTQUN0QixDQUFDLENBQUE7UUFDRixJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU87YUFDdEIsSUFBSSxDQUFDLEdBQUcsRUFBRTtZQUNULEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUM5QyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtZQUN6QixDQUFDO1FBQ0gsQ0FBQyxDQUFDLENBQUE7UUFDSixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtJQUNyQixDQUFDO0lBRUQ7O09BRUc7SUFDSCx1QkFBdUIsQ0FBRSxjQUFzQjtRQUM3QyxNQUFNLENBQUMsSUFBSSxDQUFDLHFCQUFxQixDQUFDLElBQUksQ0FBQyx3QkFBd0IsQ0FBQyxFQUFFO1lBQ2hFLE1BQU0sQ0FBQyx3QkFBd0IsQ0FBQyxXQUFXLEtBQUssY0FBYyxDQUFBO1FBQ2hFLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQTtJQUNaLENBQUM7SUFFRDs7T0FFRztJQUNILFVBQVUsQ0FBRSxjQUFzQjtRQUNoQyxJQUFJLGNBQWMsR0FBRyxJQUFJLGNBQU8sRUFBTyxDQUFBO1FBQ3ZDLElBQUksQ0FBQyx3QkFBd0IsQ0FBQyxHQUFHLENBQUM7WUFDaEMsV0FBVyxFQUFFLGNBQWM7WUFDM0IsT0FBTyxFQUFFLGNBQWM7U0FDeEIsQ0FBQyxDQUFBO1FBQ0YsSUFBSSxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFO1lBQ3hDLGNBQWMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFBO1FBQ2hDLENBQUMsQ0FBQyxDQUFBO1FBQ0YsTUFBTSxDQUFDLGNBQWMsQ0FBQTtJQUN2QixDQUFDO0lBRUQ7OztPQUdHO0lBQ0gsT0FBTyxDQUFFLFdBQW1CO1FBQzFCLElBQUksY0FBYyxHQUFHLElBQUksQ0FBQyx3QkFBd0IsQ0FBQyxJQUFJLENBQUMsMEJBQTBCLENBQUMsRUFBRTtZQUNuRixNQUFNLENBQUMsMEJBQTBCLENBQUMsV0FBVyxLQUFLLFdBQVcsQ0FBQTtRQUMvRCxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUE7UUFDVixjQUFjLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUM5QixNQUFNLENBQUMsY0FBYyxDQUFBO0lBQ3ZCLENBQUM7SUFFRDs7T0FFRztJQUNILE9BQU8sQ0FBRSxVQUVSO1FBQ0MsSUFBSSxDQUFDLFVBQVUsQ0FBQyxNQUFNLENBQUMsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEVBQUU7WUFDckMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxDQUFBO1FBQzVDLENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQztJQUVEOztPQUVHO0lBQ0gsVUFBVSxDQUFFLFVBQWtCO1FBQzVCLElBQUksQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFBO1FBQ3pCLElBQUksQ0FBQyxlQUFlLENBQUMsR0FBRyxFQUFFLFNBQVMsQ0FBQyxDQUFBO1FBQ3BDLElBQUksQ0FBQyxZQUFZLENBQUMsT0FBTzthQUN0QixJQUFJLENBQUMsR0FBRyxFQUFFO1lBQ1QsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUNoQixPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQTtZQUMzQixDQUFDO1FBQ0gsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDO0lBRUQ7O09BRUc7SUFDSCxZQUFZO1FBQ1YsSUFBSSxJQUFJLEdBQUcsTUFBTSxDQUFDLEtBQUssRUFBTyxDQUFBO1FBQzlCLElBQUksQ0FBQyxxQkFBcUIsQ0FBQyxHQUFHLENBQUM7WUFDN0IsV0FBVyxFQUFFLFVBQVU7WUFDdkIsT0FBTyxFQUFFLElBQUksQ0FBQyxPQUFPO1NBQ3RCLENBQUMsQ0FBQTtRQUNGLElBQUksQ0FBQyxZQUFZLENBQUMsT0FBTzthQUN0QixJQUFJLENBQUMsR0FBRyxFQUFFO1lBQ1QsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsTUFBTSxLQUFLLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztnQkFDN0MsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLHVCQUF1QixDQUFDLENBQUMsQ0FBQztvQkFDakMsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLEtBQUssTUFBTSxDQUFDLENBQUMsQ0FBQzt3QkFDcEMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUE7b0JBQ3pCLENBQUM7b0JBQUMsSUFBSSxDQUFDLENBQUM7d0JBQ04sTUFBTSxDQUFBO29CQUNSLENBQUM7Z0JBQ0gsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDTixJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtnQkFDekIsQ0FBQztZQUNILENBQUM7UUFDSCxDQUFDLENBQUMsQ0FBQTtRQUNKLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3JCLENBQUM7SUFFRDs7T0FFRztJQUNILFVBQVU7UUFDUixJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFBO1FBQzFCLElBQUksQ0FBQyxZQUFZLENBQUMsT0FBTyxFQUFFLENBQUE7UUFDM0IsTUFBTSxDQUFBO0lBQ1IsQ0FBQztDQUVGO0FBeEpELDRCQXdKQyJ9
-7
View File
@@ -1,7 +0,0 @@
import 'typings-global';
import * as yargs from 'yargs';
import * as beautylog from 'beautylog';
import * as lik from 'lik';
import * as path from 'path';
import * as smartparam from 'smartparam';
export { yargs, beautylog, lik, path, smartparam };
-14
View File
@@ -1,14 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
const yargs = require("yargs");
exports.yargs = yargs;
const beautylog = require("beautylog");
exports.beautylog = beautylog;
const lik = require("lik");
exports.lik = lik;
const path = require("path");
exports.path = path;
const smartparam = require("smartparam");
exports.smartparam = smartparam;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFFdkIsK0JBQThCO0FBTzVCLHNCQUFLO0FBTlAsdUNBQXNDO0FBT3BDLDhCQUFTO0FBTlgsMkJBQTBCO0FBT3hCLGtCQUFHO0FBTkwsNkJBQTRCO0FBTzFCLG9CQUFJO0FBTk4seUNBQXdDO0FBT3RDLGdDQUFVIn0=
+5 -42
View File
@@ -1,13 +1,16 @@
# smartcli
nodejs wrapper for CLI related tasks
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartcli)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartcli)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartcli)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartcli/)
## Status for master
[![build status](https://GitLab.com/pushrocks/smartcli/badges/master/build.svg)](https://GitLab.com/pushrocks/smartcli/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartcli/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartcli/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartcli.svg)](https://www.npmjs.com/package/smartcli)
@@ -20,49 +23,9 @@ nodejs wrapper for CLI related tasks
## Usage
this plugin tries to establish some logic in which CLI tools work.
take the following commandline input:
```
mytool command argument1 argument2 --option1 -o2 option2Value
```
* `mytool` obviously is the tool (like git)
* `command` is the main thing the tool shall do (like commit)
* `argument1` and `argument2` are arguments
* `option1` is a longform option you can add (like --message for message)
* `optionValue` is the referenced option value (like a commit message)
When there is no command and no option specified the standardTask applied.
When there is a option specified but no command, standardTask applies,
except when of the options is -v, --version or --help.
```javascript
import {Smartcli} from "smartcli"
mySmartcli = new Smartcli();
mySmartcli.standardTask()
.then(argvArg => {
// do something if program is called without an command
});
mySmartcli.addCommand({commandname: 'install'})
.then(argvArg => {
// do something if program is called with command "install"
})
mySmartcli.addVersion('1.0.0') // -v and --version options will display the specified version in the terminal
mySmartCli.addHelp({ // is triggered by help command and --help option
helpText: 'some help text to print' // the helpText to display
})
mySmartcli.startParse() // starts the evaluation and fullfills or rejects promises.
```
For further information read the linked docs at the top of this README.
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
-7
View File
@@ -1,7 +0,0 @@
{
"npmci": {
"npmGlobalTools": [
"npmts"
]
}
}
-3
View File
@@ -1,3 +0,0 @@
{
"mode":"default"
}
+54 -28
View File
@@ -1,44 +1,70 @@
{
"name": "smartcli",
"version": "2.0.8",
"description": "nodejs wrapper for CLI related tasks",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"name": "@push.rocks/smartcli",
"private": false,
"version": "4.1.0",
"description": "A library that simplifies building reactive command-line applications using observables, with robust support for commands, arguments, options, aliases, and asynchronous operation management.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"scripts": {
"test": "(npmts)",
"testm": "(cd ts/compile && gulp) && (node test.js jazz jam --awesome)",
"devTest": "(npm test) && (node test.js --test true)",
"reinstall": "(rm -r node_modules && npm install)",
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
"startdev": "(git checkout master && git pull origin master)"
"test": "(tstest test/ --verbose)",
"build": "tsbuild --web",
"buildDocs": "tsdoc"
},
"repository": {
"type": "git",
"url": "https://gitlab.com/pushrocks/smartcli.git"
"url": "https://code.foss.global/push.rocks/smartcli.git"
},
"keywords": [
"cli",
"promise",
"task",
"push.rocks"
"CLI",
"command line",
"observable",
"reactive",
"asynchronous",
"commands",
"arguments",
"options",
"alias",
"typescript",
"node.js",
"development tool"
],
"author": "Lossless GmbH <office@lossless.com> (https://lossless.com)",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/pushrocks/smartcli/issues"
"url": "https://code.foss.global/push.rocks/smartcli/issues"
},
"homepage": "https://gitlab.com/pushrocks/smartcli",
"homepage": "https://code.foss.global/push.rocks/smartcli",
"dependencies": {
"@types/yargs": "8.x.x",
"beautylog": "^6.1.10",
"lik": "^1.0.42",
"rxjs": "^5.4.3",
"smartparam": "1.0.2",
"smartq": "^1.1.6",
"typings-global": "^1.0.20",
"yargs": "^9.0.1"
"@push.rocks/lik": "^6.4.1",
"@push.rocks/smartlog": "^3.2.2",
"@push.rocks/smartobject": "^1.0.12",
"@push.rocks/smartpromise": "^4.2.4",
"@push.rocks/smartrx": "^3.0.10",
"yargs-parser": "22.0.0"
},
"devDependencies": {
"tapbundle": "^1.1.8"
}
"@git.zone/tsbuild": "^4.4.1",
"@git.zone/tsrun": "^2.0.4",
"@git.zone/tstest": "^3.6.6",
"@types/node": "^25.7.0",
"@types/yargs-parser": "^21.0.3"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
".smartconfig.json",
"LICENSE",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
],
"packageManager": "pnpm@10.28.2"
}
+7665
View File
File diff suppressed because it is too large Load Diff
+42
View File
@@ -0,0 +1,42 @@
## Cross-Runtime Compatibility
### CLI Argument Parsing
The module uses a robust cross-runtime approach for parsing command-line arguments through the `getUserArgs()` utility in `ts/smartcli.helpers.ts`.
**Runtime-Specific Implementations:**
| Runtime | process.argv Structure | Preferred API | Reason |
|---------|------------------------|---------------|---------|
| **Node.js** | `["/path/to/node", "/path/to/script.js", ...userArgs]` | Manual parsing | No native user-args API |
| **Deno run** | `["deno", "/path/to/script.ts", ...userArgs]` | `Deno.args` ✅ | Pre-filtered by runtime |
| **Deno compiled** | `["/path/to/binary", "/tmp/deno-compile-.../mod.ts", ...userArgs]` | `Deno.args` ✅ | Filters internal bundle path |
| **Bun** | `["/path/to/bun", "/path/to/script.ts", ...userArgs]` | Manual parsing | Bun.argv not pre-filtered |
**Why Deno.args is Critical for Compiled Executables:**
Deno compiled executables insert an internal bundle path at `argv[1]`:
```javascript
process.argv = [
"/usr/local/bin/moxytool", // argv[0] - executable
"/tmp/deno-compile-moxytool/mod.ts", // argv[1] - INTERNAL bundle path
"scripts", // argv[2] - actual user command
"--option" // argv[3+] - user args
]
Deno.args = ["scripts", "--option"] // ✓ Correctly filtered by Deno runtime
```
**getUserArgs() Logic:**
1. **Prefer Deno.args** when available (unless process.argv appears manipulated for testing)
2. **Fallback to manual parsing** for Node.js and Bun:
- Check `process.execPath` basename
- Known launchers (node, deno, bun, tsx, ts-node) → skip 2 args
- Unknown (compiled executables) → skip 1 arg
3. **Test detection**: If `process.argv.length > 2` in Deno, use manual parsing (handles test manipulation)
**Key Benefits:**
- ✅ Works with custom-named compiled executables
- ✅ Handles Deno's internal bundle path automatically
- ✅ Compatible with test environments
- ✅ No heuristics needed for Deno (runtime does the work)
+447
View File
@@ -0,0 +1,447 @@
# @push.rocks/smartcli
Build small, reactive command-line tools in TypeScript without hand-rolling argument dispatch. `@push.rocks/smartcli` parses the current runtime's user arguments, dispatches the first positional command into an RxJS `Subject`, exposes the parsed `yargs-parser` result to your handler, and gives you a clean fallback path when no command is provided.
It is ESM-first, ships TypeScript declarations, and handles user argument slicing across Node.js, Deno, Deno-compiled executables, Bun, `tsx`, and `ts-node`.
## Issue Reporting and Security
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
## Install
```sh
pnpm add @push.rocks/smartcli
```
## Why Use Smartcli
- Reactive command handlers: every command is an RxJS `Subject`, so command execution fits naturally into observable-based code.
- Tiny API surface: register commands, subscribe handlers, and call `startParse()`.
- Runtime-aware argument handling: Node.js, Deno, Deno-compiled binaries, Bun, `tsx`, and `ts-node` get user-only arguments consistently.
- `yargs-parser` integration: flags and positional arguments arrive as a familiar parsed object.
- Built-in standard command, help command, version output, manual triggering, and parse completion hooks.
## Quick Start
Create a CLI entrypoint, for example `cli.ts`:
```ts
#!/usr/bin/env node
import { Smartcli } from '@push.rocks/smartcli';
const cli = new Smartcli();
cli.addVersion('1.0.0');
cli.addHelp({
helpText: `
Usage:
demo greet --name Ada
demo --version
demo help
Commands:
greet Print a greeting
help Print this help text
`,
});
cli.addCommand('greet').subscribe((argv) => {
const name = argv.name || 'World';
console.log(`Hello, ${name}!`);
});
cli.standardCommand().subscribe(() => {
console.log('Usage: demo greet --name Ada');
console.log('Run "demo help" for details.');
});
cli.startParse();
```
When exposed as a package `bin`, the CLI behaves like this:
```sh
demo greet --name Ada
# Hello, Ada!
demo --version
# 1.0.0
demo help
# prints the configured help text
```
## Terminal Task Rendering
Use `SmartcliTerminal` for long-running jobs that should render cleanly in both interactive and non-interactive environments. In a TTY, active tasks render below each other with a fixed row count. In CI, pipes, Docker logs, or `TERM=dumb`, the same calls become append-only log lines.
```ts
import { SmartcliTerminal } from '@push.rocks/smartcli';
const terminal = new SmartcliTerminal();
const buildTask = terminal.createTask({
job: 'Build package',
rows: 3,
});
buildTask.update('Installing dependencies');
buildTask.log('Running tsbuild');
buildTask.complete('Build finished');
const publishTask = terminal.createProcess({
job: 'Publish package',
rows: 4,
});
try {
await publishPackage();
publishTask.complete('Published');
} catch (error) {
publishTask.attachError(error);
}
```
Completed tasks collapse into a permanent `[ok]` line. Failed tasks collapse into a permanent `[err]` line with error details. If an error should remain visible inside the live task area, use `attachError(error, { keepOpen: true })`.
## Execution Model
1. Create a `Smartcli` instance.
2. Register all commands before parsing.
3. Subscribe handlers to the returned command subjects.
4. Call `startParse()` once to parse the current runtime arguments.
5. `startParse()` parses user args with `yargs-parser`.
6. The first positional argument, `argv._[0]`, is treated as the command name.
7. A matching command subject receives the parsed `argv` object through `.next(argv)`.
8. If no command is provided, the subject from `standardCommand()` is triggered when it exists.
9. After normal dispatch, `parseCompleted.promise` resolves with the parsed argument object.
`startParse()` dispatches synchronously. If a handler starts asynchronous work, manage that lifecycle in your application code.
## Commands and Options
Options are available directly on the parsed object handed to your subscription:
```ts
import { Smartcli } from '@push.rocks/smartcli';
const cli = new Smartcli();
cli.addCommand('deploy').subscribe((argv) => {
const environment = argv.env || 'development';
const force = Boolean(argv.force);
console.log(`Deploying to ${environment}`);
if (force) {
console.log('Force mode enabled');
}
});
cli.standardCommand().subscribe(() => {
console.log('Usage: deployer deploy --env production [--force]');
});
cli.startParse();
```
Run it with:
```sh
deployer deploy --env production --force
```
The handler receives a `yargs-parser` result similar to:
```ts
{
_: ['deploy'],
env: 'production',
force: true
}
```
## Positional Arguments
The first positional argument selects the command. Additional positional values remain in `argv._`:
```ts
import { Smartcli } from '@push.rocks/smartcli';
const cli = new Smartcli();
cli.addCommand('run').subscribe((argv) => {
const taskName = argv._[1];
if (!taskName) {
console.log('Usage: tool run <taskName>');
return;
}
console.log(`Running task: ${taskName}`);
});
cli.startParse();
```
```sh
tool run build
# Running task: build
```
## Standard Command
Use `standardCommand()` for the no-command case:
```ts
import { Smartcli } from '@push.rocks/smartcli';
const cli = new Smartcli();
cli.addCommand('status').subscribe(() => {
console.log('Everything is operational.');
});
cli.standardCommand().subscribe(() => {
console.log('Available commands: status');
});
cli.startParse();
```
If no standard command is registered and the user runs the CLI without a command, smartcli prints `no smartcli standard task was created or assigned.`.
## Help and Version Output
`addVersion()` enables `-v` and `--version` when no command is provided:
```ts
cli.addVersion('2.3.0');
```
```sh
tool --version
# 2.3.0
```
`addHelp()` registers a `help` command. It does not create a `--help` flag:
```ts
cli.addHelp({
helpText: `
Usage:
tool build --target app
tool status
`,
});
```
```sh
tool help
```
## Programmatic Dispatch
Use `triggerCommand()` when you want to invoke a registered command yourself, for example in orchestration code or focused tests:
```ts
import { Smartcli } from '@push.rocks/smartcli';
const cli = new Smartcli();
cli.addCommand('build').subscribe((argv) => {
console.log(`Building ${argv.target}`);
});
cli.triggerCommand('build', {
_: ['build'],
target: 'docs',
});
```
`triggerCommand()` throws if the command has not been registered.
## Testing CLIs
`startParse()` accepts an optional `argv` override. Pass a full runtime-style argument array for deterministic tests:
```ts
import { Smartcli } from '@push.rocks/smartcli';
const cli = new Smartcli();
const parsedPromise = cli.parseCompleted.promise;
cli.addCommand('publish').subscribe((argv) => {
console.log(`Publishing with tag ${argv.tag}`);
});
cli.startParse(['node', 'test-cli.js', 'publish', '--tag', 'next']);
const parsed = await parsedPromise;
console.log(parsed.tag);
// next
```
Create a fresh `Smartcli` instance per parse. `parseCompleted` is a single deferred value on the instance and resolves once.
## Cross-Runtime Argument Handling
smartcli uses `getUserArgs()` internally to remove runtime-specific executable and script entries before parsing:
| Runtime mode | Argument strategy |
| --- | --- |
| Deno without an explicit test argv | Uses `Deno.args`, which is already user-only. |
| Node.js | Uses `process.argv` and skips executable plus script path for known launchers. |
| Bun | Uses `process.argv` and skips executable plus script path for known launchers. |
| `tsx` and `ts-node` | Treated as known launchers and parsed like Node.js. |
| Unknown compiled executable | Skips only the executable path, keeping the first user argument intact. |
This matters for compiled CLIs where `process.argv[0]` is the binary itself and the first user argument should not be mistaken for a script path.
## Aliases
The class exposes `addCommandAlias(original, alias)` and the public `aliasObject` for keeping alias metadata:
```ts
cli.addCommandAlias('deploy', 'd');
console.log(cli.aliasObject.deploy);
// ['d']
```
Current command dispatch is exact-match based on `argv._[0]`. If you want executable aliases, register the alias as a command and subscribe it to the same handler:
```ts
import { Smartcli } from '@push.rocks/smartcli';
const cli = new Smartcli();
const deploy = (argv: any) => {
console.log(`Deploying ${argv.target || 'default target'}`);
};
cli.addCommand('deploy').subscribe(deploy);
cli.addCommand('d').subscribe(deploy);
cli.addCommandAlias('deploy', 'd');
cli.startParse();
```
## API Reference
| API | Purpose |
| --- | --- |
| `new Smartcli()` | Creates an isolated CLI parser and command registry. |
| `addCommand(commandName)` | Registers a command and returns its RxJS `Subject`. If the command already exists, the existing subject is reused. |
| `standardCommand()` | Registers and returns the fallback subject for runs without a command. |
| `startParse(testArgv?)` | Parses current user args, or the provided full argv array, and dispatches to the matching command. |
| `triggerCommand(commandName, argvObject)` | Manually emits an argv object into a registered command subject. |
| `getCommandSubject(commandName)` | Returns the subject for a registered command or `null`. |
| `getOption(optionName)` | Parses current runtime args and returns one option by name. Inside command handlers, prefer the provided `argv` object. |
| `addHelp({ helpText })` | Registers a `help` command that logs the provided help text. |
| `addVersion(version)` | Stores the version printed by `-v` or `--version` when no command is selected. |
| `addCommandAlias(original, alias)` | Stores alias metadata in `aliasObject`. Register alias command names separately for direct dispatch. |
| `parseCompleted.promise` | Resolves with the parsed argv object after normal `startParse()` dispatch. |
## Practical Example
This example wires a tiny task runner with commands, options, help, version output, and a standard fallback:
```ts
#!/usr/bin/env node
import { Smartcli } from '@push.rocks/smartcli';
const cli = new Smartcli();
const tasks = new Map<string, () => Promise<void> | void>([
['build', () => console.log('Building project...')],
['test', () => console.log('Running tests...')],
['release', () => console.log('Preparing release...')],
]);
cli.addVersion('1.4.0');
cli.addHelp({
helpText: `
Task Runner
Usage:
tasker list
tasker run <taskName> [--dry]
tasker --version
Available tasks:
build
test
release
`,
});
cli.addCommand('list').subscribe(() => {
for (const taskName of tasks.keys()) {
console.log(taskName);
}
});
cli.addCommand('run').subscribe(async (argv) => {
const taskName = argv._[1];
const dryRun = Boolean(argv.dry);
if (!taskName) {
console.log('Usage: tasker run <taskName> [--dry]');
return;
}
const task = tasks.get(taskName);
if (!task) {
console.log(`Unknown task: ${taskName}`);
return;
}
if (dryRun) {
console.log(`Would run task: ${taskName}`);
return;
}
await task();
});
cli.standardCommand().subscribe(() => {
console.log('Usage: tasker <list|run|help>');
});
cli.startParse();
```
## Sharp Edges Worth Knowing
- Register commands before calling `startParse()`.
- `startParse()` dispatches once; create a new `Smartcli` instance for a second parse.
- `addHelp()` registers the `help` command, not a `--help` option.
- `addVersion()` prints only when no positional command is present.
- `getOption()` reads the current runtime args. In command subscriptions, use the `argv` object you receive for the most testable code.
- Alias metadata is stored, but aliases are not automatically dispatched unless you register the alias command name too.
- smartcli does not validate option schemas. Add validation in your own command handlers when inputs matter.
## License and Legal Information
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
### Company Information
Task Venture Capital GmbH
Registered at District Court Bremen HRB 35230 HB, Germany
For any legal inquiries or further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
+118
View File
@@ -0,0 +1,118 @@
import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as smartrx from '@push.rocks/smartrx';
import * as smartcli from '../ts/index.js';
class TestWritable implements smartcli.ISmartcliWritable {
public chunks: string[] = [];
public isTTY: boolean;
public columns = 80;
constructor(isTTYArg: boolean) {
this.isTTY = isTTYArg;
}
public write(chunkArg: string): boolean {
this.chunks.push(chunkArg);
return true;
}
public toString(): string {
return this.chunks.join('');
}
}
tap.test('should create a new Smartcli', async () => {
const smartCliTestObject = new smartcli.Smartcli();
expect(smartCliTestObject).toBeInstanceOf(smartcli.Smartcli);
});
tap.test('should add an command', async (toolsArg) => {
const done = toolsArg.defer();
const smartCliTestObject = new smartcli.Smartcli();
const awesomeCommandSubject = smartCliTestObject.addCommand('awesome');
expect(awesomeCommandSubject).toBeInstanceOf(smartrx.rxjs.Subject);
awesomeCommandSubject.subscribe(() => {
done.resolve();
});
smartCliTestObject.startParse(['node', 'test.js', 'awesome']);
await done.promise;
});
tap.test('should start parsing a standardTask', async () => {
const smartCliTestObject = new smartcli.Smartcli();
expect(smartCliTestObject.standardCommand()).toBeInstanceOf(smartrx.rxjs.Subject);
});
let hasExecuted: boolean = false;
tap.test('should accept a command', async () => {
const smartCliTestObject = new smartcli.Smartcli();
smartCliTestObject.addCommand('triggerme').subscribe(() => {
hasExecuted = true;
});
smartCliTestObject.triggerCommand('triggerme', {});
expect(hasExecuted).toBeTrue();
});
tap.test('should render terminal tasks in non-interactive mode', async () => {
const stream = new TestWritable(false);
const terminal = new smartcli.SmartcliTerminal({ stream, interactive: false, colors: false });
const task = terminal.createTask({ job: 'build package', rows: 2 });
task.update('running tsbuild');
task.complete('done');
const output = stream.toString();
expect(output).toInclude('[start] build package');
expect(output).toInclude('[build package] running tsbuild');
expect(output).toInclude('[ok] build package - done');
expect(terminal.getTasks()).toHaveLength(0);
});
tap.test('should render fixed rows in interactive mode', async () => {
const stream = new TestWritable(true);
const terminal = new smartcli.SmartcliTerminal({ stream, interactive: true, colors: false });
const task = terminal.createTask({ job: 'install dependencies', rows: 2 });
task.update('fetching packages');
const renderedRows = task.renderPlainRows(80);
expect(renderedRows).toHaveLength(2);
expect(renderedRows[0]).toInclude('[run] install dependencies');
expect(stream.toString()).toInclude('\u001B[2K');
task.complete('installed');
expect(stream.toString()).toInclude('[ok] install dependencies - installed');
expect(terminal.getTasks()).toHaveLength(0);
});
tap.test('should attach persistent terminal task errors', async () => {
const stream = new TestWritable(true);
const terminal = new smartcli.SmartcliTerminal({ stream, interactive: true, colors: false });
const task = terminal.createTask({ job: 'deploy release', rows: 3 });
task.attachError('deployment failed', { keepOpen: true });
expect(task.status).toEqual('failed');
expect(task.getErrorLines()).toContain('deployment failed');
expect(task.renderPlainRows(80)[0]).toInclude('[err] deploy release');
expect(terminal.getTasks()).toHaveLength(1);
terminal.clear();
});
tap.test('should collapse failed terminal tasks into permanent output', async () => {
const stream = new TestWritable(false);
const terminal = new smartcli.SmartcliTerminal({ stream, interactive: false, colors: false });
const task = terminal.createTask({ job: 'publish package' });
task.attachError('registry rejected package');
const output = stream.toString();
expect(output).toInclude('[err] publish package - registry rejected package');
expect(terminal.getTasks()).toHaveLength(0);
});
export default tap.start();
-45
View File
@@ -1,45 +0,0 @@
import { tap, expect } from 'tapbundle'
import { Subject } from 'rxjs'
import smartcli = require('../ts/index')
let smartCliTestObject: smartcli.Smartcli
tap.test('should create a new Smartcli', async () => {
smartCliTestObject = new smartcli.Smartcli()
expect(smartCliTestObject).to.be.instanceof(smartcli.Smartcli)
})
tap.test('should add an command', async () => {
expect(smartCliTestObject.addCommand('awesome')).to.not.throw()
})
tap.test('should start parsing a standardTask', async () => {
expect(smartCliTestObject.standardTask()).to.be.instanceOf(Promise)
})
let hasExecuted: boolean = false
tap.test('should accept a command', async () => {
smartCliTestObject.addTrigger('triggerme')
.subscribe(() => {
hasExecuted = true
})
expect(smartCliTestObject.addTrigger('triggerme')).to.be.instanceof(Subject)
})
tap.test('should not have executed yet', async () => {
expect(hasExecuted).to.be.false()
})
tap.test('should execute when triggered', async () => {
smartCliTestObject.trigger('triggerme')
expect(hasExecuted).be.true()
})
tap.test('should start parsing the CLI input', async () => {
smartCliTestObject.startParse()
expect(await smartCliTestObject.parseStarted.promise).to.not.throw()
})
tap.start()
+8
View File
@@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartcli',
version: '4.1.0',
description: 'A library that simplifies building reactive command-line applications using observables, with robust support for commands, arguments, options, aliases, and asynchronous operation management.'
}
+9 -1
View File
@@ -1 +1,9 @@
export { Smartcli } from './smartcli.classes.smartcli'
export { Smartcli } from './smartcli.classes.smartcli.js';
export { SmartcliTerminal, SmartcliTerminalTask } from './smartcli.classes.terminal.js';
export type {
ISmartcliTerminalAttachErrorOptions,
ISmartcliTerminalOptions,
ISmartcliTerminalTaskOptions,
ISmartcliWritable,
TSmartcliTerminalTaskStatus,
} from './smartcli.classes.terminal.js';
+112 -120
View File
@@ -1,172 +1,164 @@
import * as smartq from 'smartq'
import { Subject } from 'rxjs'
import * as plugins from './smartcli.plugins'
// import classes
import { Objectmap } from 'lik'
import * as plugins from './smartcli.plugins.js';
import { getUserArgs } from './smartcli.helpers.js';
// interfaces
export interface ICommandPromiseObject {
commandName: string,
promise: Promise<void>
export interface ICommandObservableObject {
commandName: string;
subject: plugins.smartrx.rxjs.Subject<any>;
}
export interface ITriggerObservableObject {
triggerName: string
subject: Subject<any>
}
const logger = new plugins.smartlog.ConsoleLog();
/**
* class to create a new instance of Smartcli. Handles parsing of command line arguments.
*/
export class Smartcli {
argv: any
questionsDone
parseStarted: smartq.Deferred<any>
commands
questions
version: string
private onlyOnProcessEnvCliCall = false
/**
* map of all Command/Promise objects to keep track
* this Deferred contains the parsed result in the end
*/
allCommandPromisesMap = new Objectmap<ICommandPromiseObject>()
public parseCompleted = plugins.smartpromise.defer<any>();
public version?: string;
/**
* map of all Trigger/Observable objects to keep track
*/
allTriggerObservablesMap = new Objectmap<ITriggerObservableObject>()
private commandObservableMap = new plugins.lik.ObjectMap<ICommandObservableObject>();
constructor () {
this.argv = plugins.yargs
this.questionsDone = smartq.defer()
this.parseStarted = smartq.defer()
}
/**
* maps alias
*/
public aliasObject: { [key: string]: string[] } = {};
onlyTriggerOnProcessEnvCliCall () {
this.onlyOnProcessEnvCliCall = true
}
/**
* The constructor of Smartcli
*/
constructor() {}
/**
* adds an alias, meaning one equals the other in terms of command execution.
*/
addCommandAlias (keyArg, aliasArg): void {
this.argv = this.argv.alias(keyArg, aliasArg)
return
public addCommandAlias(originalArg: string, aliasArg: string): void {
this.aliasObject[originalArg] = this.aliasObject[originalArg] || [];
this.aliasObject[originalArg].push(aliasArg);
}
/**
* adds a Command by returning a Promise that reacts to the specific commandString given.
* Note: in e.g. "npm install something" the "install" is considered the command.
*/
addCommand (commandNameArg: string): Promise<any> {
let done = smartq.defer<any>()
this.allCommandPromisesMap.add({
public addCommand(commandNameArg: string): plugins.smartrx.rxjs.Subject<any> {
let commandSubject: plugins.smartrx.rxjs.Subject<any>;
const existingCommandSubject = this.getCommandSubject(commandNameArg);
commandSubject = existingCommandSubject || new plugins.smartrx.rxjs.Subject<any>();
this.commandObservableMap.add({
commandName: commandNameArg,
promise: done.promise
})
this.parseStarted.promise
.then(() => {
if (this.argv._.indexOf(commandNameArg) === 0) {
done.resolve(this.argv)
}
})
return done.promise
}
/**
* gets a Promise for a command word
*/
getCommandPromiseByName (commandNameArg: string): Promise<void> {
return this.allCommandPromisesMap.find(commandDeferredObjectArg => {
return commandDeferredObjectArg.commandName === commandNameArg
}).promise
}
/**
* adds a Trigger. Like addCommand(), but returns an subscribable observable
*/
addTrigger (triggerNameArg: string) {
let triggerSubject = new Subject<any>()
this.allTriggerObservablesMap.add({
triggerName: triggerNameArg,
subject: triggerSubject
})
this.addCommand(triggerNameArg).then(() => {
triggerSubject.next(this.argv)
})
return triggerSubject
subject: commandSubject,
});
return commandSubject;
}
/**
* execute trigger by name
* @param commandNameArg - the name of the command to trigger
*/
trigger (triggerName: string) {
let triggerSubject = this.allTriggerObservablesMap.find(triggerObservableObjectArg => {
return triggerObservableObjectArg.triggerName === triggerName
}).subject
triggerSubject.next(this.argv)
return triggerSubject
public triggerCommand(commandNameArg: string, argvObject: any) {
const triggerSubject = this.getCommandSubject(commandNameArg);
if (!triggerSubject) {
throw new Error(`No smartcli command registered for ${commandNameArg}`);
}
triggerSubject.next(argvObject);
return triggerSubject;
}
/**
* gets the command subject for the specified name.
* call this before calling .parse()
* @param commandNameArg
* @returns
*/
public getCommandSubject(commandNameArg: string) {
const triggerObservableObject = this.commandObservableMap.findSync(
(triggerObservableObjectArg) => {
return triggerObservableObjectArg.commandName === commandNameArg;
}
);
if (triggerObservableObject) {
return triggerObservableObject.subject;
} else {
return null;
}
}
/**
* getOption
*/
public getOption(optionNameArg: string) {
const userArgs = getUserArgs();
const parsedYargs = plugins.yargsParser(userArgs);
return parsedYargs[optionNameArg];
}
/**
* allows to specify help text to be printed above the rest of the help text
*/
addHelp (optionsArg: {
helpText: string
}) {
this.addCommand('help').then(argvArg => {
plugins.beautylog.log(optionsArg.helpText)
})
public addHelp(optionsArg: { helpText: string }) {
this.addCommand('help').subscribe((argvArg) => {
logger.log('info', optionsArg.helpText);
});
}
/**
* specify version to be printed for -v --version
*/
addVersion (versionArg: string) {
this.version = versionArg
this.addCommandAlias('v', 'version')
this.parseStarted.promise
.then(() => {
if (this.argv.v) {
console.log(this.version)
}
})
public addVersion(versionArg: string) {
this.version = versionArg;
}
/**
* returns promise that is resolved when no commands are specified
* adds a trigger that is called when no command is specified
*/
standardTask (): Promise<any> {
let done = smartq.defer<any>()
this.allCommandPromisesMap.add({
commandName: 'standard',
promise: done.promise
})
this.parseStarted.promise
.then(() => {
if (this.argv._.length === 0 && !this.argv.v) {
if (this.onlyOnProcessEnvCliCall) {
if (process.env.CLI_CALL === 'true') {
done.resolve(this.argv)
} else {
return
}
} else {
done.resolve(this.argv)
}
}
})
return done.promise
public standardCommand(): plugins.smartrx.rxjs.Subject<any> {
const standardSubject = this.addCommand('standardCommand');
return standardSubject;
}
/**
* start the process of evaluating commands
* @param testArgv - Optional argv override for testing (bypasses automatic runtime detection)
*/
startParse (): void {
this.argv = this.argv.argv
this.parseStarted.resolve()
return
}
public startParse(testArgv?: string[]): void {
// Get user arguments, properly handling Node.js, Deno (run/compiled), and Bun
const userArgs = testArgv ? getUserArgs(testArgv) : getUserArgs();
const parsedYArgs = plugins.yargsParser(userArgs);
const wantedCommand = parsedYArgs._[0];
// lets handle some standards
if (!wantedCommand && (parsedYArgs.v || parsedYArgs.version)) {
console.log(this.version || 'unknown version');
return;
}
for (const command of this.commandObservableMap.getArray()) {
if (!wantedCommand) {
const standardCommand = this.commandObservableMap.findSync((commandArg) => {
return commandArg.commandName === 'standardCommand';
});
if (standardCommand) {
standardCommand.subject.next(parsedYArgs);
} else {
console.log('no smartcli standard task was created or assigned.');
}
break;
}
if (command.commandName === parsedYArgs._[0]) {
command.subject.next(parsedYArgs);
break;
}
if (this.aliasObject[parsedYArgs[0]]) {
}
}
this.parseCompleted.resolve(parsedYArgs);
return;
}
}
+384
View File
@@ -0,0 +1,384 @@
export type TSmartcliTerminalTaskStatus = 'running' | 'completed' | 'failed';
export interface ISmartcliWritable {
isTTY?: boolean;
columns?: number;
write(chunk: string): void | boolean;
}
export interface ISmartcliTerminalOptions {
stream?: ISmartcliWritable;
interactive?: boolean;
colors?: boolean;
}
export interface ISmartcliTerminalTaskOptions {
job: string;
rows?: number;
logLimit?: number;
}
export interface ISmartcliTerminalAttachErrorOptions {
keepOpen?: boolean;
}
const ansiCodes = {
reset: '\u001B[0m',
red: '\u001B[31m',
green: '\u001B[32m',
cyan: '\u001B[36m',
gray: '\u001B[90m',
};
/**
* A live terminal renderer for multiple fixed-row tasks.
* It automatically falls back to append-only logs in non-interactive environments.
*/
export class SmartcliTerminal {
private stream: ISmartcliWritable;
private interactive: boolean;
private colors: boolean;
private tasks: SmartcliTerminalTask[] = [];
private renderedLineCount = 0;
constructor(optionsArg: ISmartcliTerminalOptions = {}) {
this.stream = optionsArg.stream || getDefaultStream();
this.interactive = getInteractiveState(this.stream, optionsArg.interactive);
this.colors = optionsArg.colors ?? (this.interactive && !hasEnvFlag('NO_COLOR'));
}
public createTask(optionsArg: ISmartcliTerminalTaskOptions): SmartcliTerminalTask {
const task = new SmartcliTerminalTask(this, optionsArg);
this.tasks.push(task);
if (this.interactive) {
this.render();
} else {
this.writePermanentLine(`[start] ${task.job}`);
}
return task;
}
public createProcess(optionsArg: ISmartcliTerminalTaskOptions): SmartcliTerminalTask {
return this.createTask(optionsArg);
}
public isInteractive(): boolean {
return this.interactive;
}
public getTasks(): SmartcliTerminalTask[] {
return [...this.tasks];
}
/** @internal */
public updateTask(taskArg: SmartcliTerminalTask, messageArg?: string): void {
if (!this.tasks.includes(taskArg)) {
return;
}
if (this.interactive) {
this.render();
} else if (messageArg) {
this.writePermanentLine(`[${taskArg.job}] ${messageArg}`);
}
}
/** @internal */
public completeTask(taskArg: SmartcliTerminalTask, messageArg?: string): void {
const message = messageArg || taskArg.getLastLogLine();
const summary = `[ok] ${taskArg.job}${message ? ` - ${message}` : ''}`;
this.finalizeTask(taskArg, [summary]);
}
/** @internal */
public failTask(taskArg: SmartcliTerminalTask, errorLinesArg: string[]): void {
const summary = `[err] ${taskArg.job}${errorLinesArg[0] ? ` - ${errorLinesArg[0]}` : ''}`;
const detailLines = errorLinesArg.slice(1).map((lineArg) => ` ${lineArg}`);
this.finalizeTask(taskArg, [summary, ...detailLines]);
}
public clear(): void {
if (this.interactive) {
this.clearRenderedBlock();
}
this.tasks = [];
}
private finalizeTask(taskArg: SmartcliTerminalTask, linesArg: string[]): void {
this.tasks = this.tasks.filter((task) => task !== taskArg);
if (this.interactive) {
this.clearRenderedBlock();
this.writePermanentLines(linesArg);
this.render();
} else {
this.writePermanentLines(linesArg);
}
}
private render(): void {
if (!this.interactive) {
return;
}
const width = this.getLineWidth();
const lines = this.tasks.flatMap((taskArg) => {
return taskArg.renderPlainRows(width).map((lineArg, indexArg) => {
const truncatedLine = truncateLine(lineArg, width);
return indexArg === 0 ? this.colorizeStatusLabel(truncatedLine) : truncatedLine;
});
});
if (this.renderedLineCount > 0) {
this.stream.write(`\u001B[${this.renderedLineCount}F`);
}
const lineCount = Math.max(this.renderedLineCount, lines.length);
for (let index = 0; index < lineCount; index++) {
this.stream.write('\u001B[2K\r');
if (index < lines.length) {
this.stream.write(lines[index]);
}
this.stream.write('\n');
}
this.renderedLineCount = lines.length;
}
private clearRenderedBlock(): void {
if (this.renderedLineCount === 0) {
return;
}
this.stream.write(`\u001B[${this.renderedLineCount}F`);
this.stream.write(`\u001B[${this.renderedLineCount}M`);
this.renderedLineCount = 0;
}
private writePermanentLines(linesArg: string[]): void {
for (const line of linesArg) {
this.writePermanentLine(line);
}
}
private writePermanentLine(lineArg: string): void {
const line = this.colors ? this.colorizeStatusLabel(lineArg) : lineArg;
this.stream.write(`${line}\n`);
}
private colorizeStatusLabel(lineArg: string): string {
if (!this.colors) {
return lineArg;
}
if (lineArg.startsWith('[ok]')) {
return `${ansiCodes.green}[ok]${ansiCodes.reset}${lineArg.slice(4)}`;
}
if (lineArg.startsWith('[err]')) {
return `${ansiCodes.red}[err]${ansiCodes.reset}${lineArg.slice(5)}`;
}
if (lineArg.startsWith('[run]')) {
return `${ansiCodes.cyan}[run]${ansiCodes.reset}${lineArg.slice(5)}`;
}
if (lineArg.startsWith('[start]')) {
return `${ansiCodes.gray}[start]${ansiCodes.reset}${lineArg.slice(7)}`;
}
return lineArg;
}
private getLineWidth(): number {
return Math.max(20, (this.stream.columns || 80) - 1);
}
}
export class SmartcliTerminalTask {
public readonly job: string;
public readonly rows: number;
public status: TSmartcliTerminalTaskStatus = 'running';
private terminal: SmartcliTerminal;
private logLimit: number;
private logLines: string[] = [];
private errorLines: string[] = [];
constructor(terminalArg: SmartcliTerminal, optionsArg: ISmartcliTerminalTaskOptions) {
this.terminal = terminalArg;
this.job = optionsArg.job;
this.rows = Math.max(1, Math.floor(optionsArg.rows || 3));
this.logLimit = Math.max(this.rows, Math.floor(optionsArg.logLimit || 100));
}
public log(messageArg: string): this {
if (this.status !== 'running') {
return this;
}
const newLines = normalizeLines(messageArg);
this.logLines.push(...newLines);
if (this.logLines.length > this.logLimit) {
this.logLines.splice(0, this.logLines.length - this.logLimit);
}
this.terminal.updateTask(this, newLines.join('\n'));
return this;
}
public update(messageArg: string): this {
return this.log(messageArg);
}
public complete(messageArg?: string): this {
if (this.status !== 'running') {
return this;
}
this.status = 'completed';
this.terminal.completeTask(this, messageArg);
return this;
}
public attachError(
errorArg: unknown,
optionsArg: ISmartcliTerminalAttachErrorOptions = {}
): this {
if (this.status !== 'running') {
return this;
}
this.status = 'failed';
this.errorLines = formatError(errorArg);
if (optionsArg.keepOpen) {
this.terminal.updateTask(this, this.errorLines.join('\n'));
} else {
this.terminal.failTask(this, this.errorLines);
}
return this;
}
public fail(errorArg: unknown): this {
return this.attachError(errorArg);
}
public getLastLogLine(): string | undefined {
return this.logLines[this.logLines.length - 1];
}
public getLogLines(): string[] {
return [...this.logLines];
}
public getErrorLines(): string[] {
return [...this.errorLines];
}
/** @internal */
public renderPlainRows(widthArg: number): string[] {
const statusLabel = this.status === 'failed' ? '[err]' : '[run]';
const lines: string[] = [];
const detailLines = this.errorLines.length > 0 ? this.errorLines : this.logLines;
if (this.rows === 1) {
const lastDetail = detailLines[detailLines.length - 1];
lines.push(`${statusLabel} ${this.job}${lastDetail ? ` - ${lastDetail}` : ''}`);
return lines;
}
lines.push(`${statusLabel} ${this.job}`);
const visibleDetailLineCount = this.rows - 1;
const visibleDetailLines = detailLines.slice(-visibleDetailLineCount);
for (const line of visibleDetailLines) {
lines.push(` ${line}`);
}
while (lines.length < this.rows) {
lines.push('');
}
return lines.map((lineArg) => truncateLine(lineArg, widthArg));
}
}
function getDefaultStream(): ISmartcliWritable {
const globalObject: any = globalThis as any;
if (globalObject.process?.stdout?.write) {
return globalObject.process.stdout;
}
return {
isTTY: false,
write: (chunkArg: string) => {
if (typeof console !== 'undefined') {
console.log(chunkArg.replace(/\n$/, ''));
}
},
};
}
function getInteractiveState(streamArg: ISmartcliWritable, overrideArg?: boolean): boolean {
if (typeof overrideArg === 'boolean') {
return overrideArg;
}
if (!streamArg.isTTY) {
return false;
}
return !(
hasEnvFlag('CI') ||
hasEnvFlag('GITHUB_ACTIONS') ||
hasEnvFlag('JENKINS_URL') ||
hasEnvFlag('GITLAB_CI') ||
hasEnvFlag('TRAVIS') ||
hasEnvFlag('CIRCLECI') ||
getEnvValue('TERM') === 'dumb'
);
}
function hasEnvFlag(nameArg: string): boolean {
const value = getEnvValue(nameArg);
return Boolean(value && value !== '0' && value.toLowerCase() !== 'false');
}
function getEnvValue(nameArg: string): string | undefined {
const globalObject: any = globalThis as any;
return globalObject.process?.env?.[nameArg];
}
function normalizeLines(messageArg: string): string[] {
return String(messageArg)
.split(/\r?\n/)
.map((lineArg) => lineArg.trimEnd())
.filter((lineArg) => lineArg.length > 0);
}
function formatError(errorArg: unknown): string[] {
if (errorArg instanceof Error) {
return normalizeLines(errorArg.stack || errorArg.message || errorArg.name);
}
if (typeof errorArg === 'string') {
return normalizeLines(errorArg);
}
try {
const jsonString = JSON.stringify(errorArg);
return normalizeLines(jsonString === undefined ? String(errorArg) : jsonString);
} catch {
return [String(errorArg)];
}
}
function truncateLine(lineArg: string, widthArg: number): string {
if (lineArg.length <= widthArg) {
return lineArg;
}
if (widthArg <= 3) {
return lineArg.slice(0, widthArg);
}
return `${lineArg.slice(0, widthArg - 3)}...`;
}
+76
View File
@@ -0,0 +1,76 @@
/**
* Return only the user arguments (excluding runtime executable and script path),
* across Node.js, Deno (run/compiled), and Bun.
*
* - Deno: uses Deno.args directly (already user-only in both run and compile).
* - Node/Bun: uses process.execPath's basename to decide if there is a script arg.
* If execPath basename is a known launcher (node/nodejs/bun/deno), skip 2; else skip 1.
*/
export function getUserArgs(argv?: string[]): string[] {
// If argv is explicitly provided, use it instead of Deno.args
// This handles test scenarios where process.argv is manually modified
const useProvidedArgv = argv !== undefined;
// Prefer Deno.args when available and no custom argv provided;
// it's the most reliable for Deno run and compiled.
// Deno.args is ALWAYS correct in Deno environments - it handles the internal bundle path automatically.
// deno-lint-ignore no-explicit-any
const g: any = typeof globalThis !== 'undefined' ? globalThis : {};
if (!useProvidedArgv && g.Deno && g.Deno.args && Array.isArray(g.Deno.args)) {
return g.Deno.args.slice();
}
const a = argv ?? (typeof process !== 'undefined' && Array.isArray(process.argv) ? process.argv : []);
if (!Array.isArray(a) || a.length === 0) return [];
// Determine execPath in Node/Bun (or compat shims)
let execPath = '';
if (typeof process !== 'undefined' && typeof process.execPath === 'string') {
execPath = process.execPath;
} else if (g.Deno && typeof g.Deno.execPath === 'function') {
// Fallback for unusual shims: try Deno.execPath() if present.
try {
execPath = g.Deno.execPath();
} catch {
/* ignore */
}
}
const base = basename(execPath).toLowerCase();
const knownLaunchers = new Set([
'node',
'node.exe',
'nodejs',
'nodejs.exe',
'bun',
'bun.exe',
'deno',
'deno.exe',
'tsx',
'tsx.exe',
'ts-node',
'ts-node.exe',
]);
// Always skip the executable (argv[0]).
let offset = Math.min(1, a.length);
// If the executable is a known runtime launcher, there's almost always a script path in argv[1].
// This handles Node, Bun, and "deno run" (but NOT "deno compile" which won't match 'deno').
if (knownLaunchers.has(base)) {
offset = Math.min(2, a.length);
}
// Note: we intentionally avoid path/URL heuristics on argv[1] so we don't
// accidentally drop the first user arg when it's a path-like value in compiled mode.
// When offset >= a.length, this correctly returns an empty array (no user args).
return a.slice(offset);
}
function basename(p: string): string {
if (!p) return '';
const parts = p.split(/[/\\]/);
return parts[parts.length - 1] || '';
}
+12 -13
View File
@@ -1,15 +1,14 @@
import 'typings-global'
// @pushrocks scope
import * as smartlog from '@push.rocks/smartlog';
import * as lik from '@push.rocks/lik';
import * as path from 'node:path';
import * as smartparam from '@push.rocks/smartobject';
import * as smartpromise from '@push.rocks/smartpromise';
import * as smartrx from '@push.rocks/smartrx';
import * as yargs from 'yargs'
import * as beautylog from 'beautylog'
import * as lik from 'lik'
import * as path from 'path'
import * as smartparam from 'smartparam'
export { smartlog, lik, path, smartparam, smartpromise, smartrx };
export {
yargs,
beautylog,
lik,
path,
smartparam
}
// thirdparty scope
import yargsParser from 'yargs-parser';
export { yargsParser };
+14
View File
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noImplicitAny": true,
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"types": ["node"]
},
"exclude": ["dist_*/**/*.d.ts"]
}
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "tslint-config-standard"
}
-838
View File
@@ -1,838 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/code@^4.0.3":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@types/code/-/code-4.0.3.tgz#9c4de39f86eb3eba070146d2dab7dbc3f8eac35f"
"@types/glob@*":
version "5.0.33"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.33.tgz#3dff7c6ce09d65abe919c7961dc3dee016f36ad7"
dependencies:
"@types/minimatch" "*"
"@types/node" "*"
"@types/lodash@^4.14.55", "@types/lodash@^4.14.74":
version "4.14.77"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.77.tgz#0bc699413e84d6ed5d927ca30ea0f0a890b42d75"
"@types/minimatch@*", "@types/minimatch@3.x.x":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.1.tgz#b683eb60be358304ef146f5775db4c0e3696a550"
"@types/node@*", "@types/node@^8.0.33":
version "8.0.34"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.34.tgz#55f801fa2ddb2a40dd6dfc15ecfe1dde9c129fe9"
"@types/q@1.x.x":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.0.5.tgz#02b9d43a1a8e7503d15ed2fecb15ebb18c519b1d"
"@types/shelljs@^0.7.4":
version "0.7.4"
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc"
dependencies:
"@types/glob" "*"
"@types/node" "*"
"@types/which@^1.0.28":
version "1.0.28"
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
"@types/yargs@8.x.x":
version "8.0.2"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-8.0.2.tgz#0f9c7b236e2d78cd8f4b6502de15d0728aa29385"
ansi-256-colors@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
ansi-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
beautycolor@^1.0.7:
version "1.0.11"
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5"
dependencies:
ansi-256-colors "^1.1.0"
typings-global "^1.0.14"
beautylog@6.1.10, beautylog@^6.1.10:
version "6.1.10"
resolved "https://registry.yarnpkg.com/beautylog/-/beautylog-6.1.10.tgz#9c27e566937684cb689f9372d98cfa5415d50b72"
dependencies:
"@types/lodash" "^4.14.55"
beautycolor "^1.0.7"
figlet "^1.2.0"
lodash "^4.17.4"
ora "^1.1.0"
smartenv "^2.0.0"
smartq "^1.1.1"
typings-global "^1.0.14"
bindings@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"
brace-expansion@^1.1.7:
version "1.1.8"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
builtin-modules@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
camelcase@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"
chalk@^1.0.0, chalk@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
cli-cursor@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
dependencies:
restore-cursor "^2.0.0"
cli-spinners@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.1.0.tgz#f1847b168844d917a671eb9d147e3df497c90d06"
cliui@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
dependencies:
string-width "^1.0.1"
strip-ansi "^3.0.1"
wrap-ansi "^2.0.0"
code-point-at@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
code@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/code/-/code-5.1.0.tgz#205e4213536c3cf21b12194384901fadcd81bc1a"
dependencies:
hoek "4.x.x"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
cross-spawn@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
dependencies:
lru-cache "^4.0.1"
shebang-command "^1.2.0"
which "^1.2.9"
decamelize@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
dependencies:
foreach "^2.0.5"
object-keys "^1.0.8"
early@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
dependencies:
beautycolor "^1.0.7"
smartq "^1.1.1"
typings-global "^1.0.16"
error-ex@^1.2.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc"
dependencies:
is-arrayish "^0.2.1"
es-abstract@^1.5.1:
version "1.9.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.9.0.tgz#690829a07cae36b222e7fd9b75c0d0573eb25227"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.1"
has "^1.0.1"
is-callable "^1.1.3"
is-regex "^1.0.4"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.1"
is-symbol "^1.0.1"
es6-error@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98"
escape-string-regexp@^1.0.2:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
execa@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777"
dependencies:
cross-spawn "^5.0.1"
get-stream "^3.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"
figlet@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.2.0.tgz#6c46537378fab649146b5a6143dda019b430b410"
find-up@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
dependencies:
locate-path "^2.0.0"
foreach@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
function-bind@^1.0.2, function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
get-caller-file@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5"
get-stream@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
glob@^7.0.0:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
graceful-fs@^4.1.2:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
dependencies:
ansi-regex "^2.0.0"
has@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
dependencies:
function-bind "^1.0.2"
hoek@4.x.x:
version "4.2.0"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d"
hosted-git-info@^2.1.4:
version "2.5.0"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c"
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
interpret@^1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0"
invert-kv@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
is-arrayish@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
is-builtin-module@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe"
dependencies:
builtin-modules "^1.0.0"
is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-fullwidth-code-point@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb"
dependencies:
number-is-nan "^1.0.0"
is-fullwidth-code-point@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
is-promise@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
is-regex@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
dependencies:
has "^1.0.1"
is-stream@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
is-symbol@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
lcid@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835"
dependencies:
invert-kv "^1.0.0"
leakage@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
dependencies:
es6-error "^4.0.2"
left-pad "^1.1.3"
memwatch-next "^0.3.0"
minimist "^1.2.0"
pretty-bytes "^4.0.2"
left-pad@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
lik@^1.0.42:
version "1.0.42"
resolved "https://registry.yarnpkg.com/lik/-/lik-1.0.42.tgz#e77604fac257c1b3552779c443de08c09b6e5332"
dependencies:
"@types/lodash" "^4.14.74"
"@types/minimatch" "3.x.x"
"@types/q" "1.x.x"
lodash "^4.17.4"
minimatch "^3.0.4"
q "^1.5.0"
rxjs "^5.4.3"
smartq "^1.1.6"
typings-global "^1.0.20"
load-json-file@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8"
dependencies:
graceful-fs "^4.1.2"
parse-json "^2.2.0"
pify "^2.0.0"
strip-bom "^3.0.0"
locate-path@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
dependencies:
p-locate "^2.0.0"
path-exists "^3.0.0"
lodash@^4.17.4:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
log-symbols@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18"
dependencies:
chalk "^1.0.0"
lru-cache@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55"
dependencies:
pseudomap "^1.0.2"
yallist "^2.1.2"
mem@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76"
dependencies:
mimic-fn "^1.0.0"
memwatch-next@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
dependencies:
bindings "^1.2.1"
nan "^2.3.2"
mimic-fn@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
brace-expansion "^1.1.7"
minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
nan@^2.3.2:
version "2.7.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46"
normalize-package-data@^2.3.2:
version "2.4.0"
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f"
dependencies:
hosted-git-info "^2.1.4"
is-builtin-module "^1.0.0"
semver "2 || 3 || 4 || 5"
validate-npm-package-license "^3.0.1"
npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
dependencies:
path-key "^2.0.0"
number-is-nan@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
object-keys@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
object.getownpropertydescriptors@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.5.1"
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
dependencies:
wrappy "1"
onetime@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
dependencies:
mimic-fn "^1.0.0"
ora@^1.1.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-1.3.0.tgz#80078dd2b92a934af66a3ad72a5b910694ede51a"
dependencies:
chalk "^1.1.1"
cli-cursor "^2.1.0"
cli-spinners "^1.0.0"
log-symbols "^1.0.2"
os-locale@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2"
dependencies:
execa "^0.7.0"
lcid "^1.0.0"
mem "^1.1.0"
p-finally@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
p-limit@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc"
p-locate@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
dependencies:
p-limit "^1.1.0"
parse-json@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9"
dependencies:
error-ex "^1.2.0"
path-exists@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
path-key@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
path-parse@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
path-type@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73"
dependencies:
pify "^2.0.0"
pify@^2.0.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
pretty-bytes@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
q@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
read-pkg-up@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be"
dependencies:
find-up "^2.0.0"
read-pkg "^2.0.0"
read-pkg@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8"
dependencies:
load-json-file "^2.0.0"
normalize-package-data "^2.3.2"
path-type "^2.0.0"
rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
dependencies:
resolve "^1.1.6"
require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
require-main-filename@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"
resolve@^1.1.6:
version "1.4.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86"
dependencies:
path-parse "^1.0.5"
restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
dependencies:
onetime "^2.0.0"
signal-exit "^3.0.2"
rxjs@^5.4.3:
version "5.4.3"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.3.tgz#0758cddee6033d68e0fd53676f0f3596ce3d483f"
dependencies:
symbol-observable "^1.0.1"
"semver@2 || 3 || 4 || 5", semver@^5.3.0:
version "5.4.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
set-blocking@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
dependencies:
shebang-regex "^1.0.0"
shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
shelljs@^0.7.8:
version "0.7.8"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
dependencies:
glob "^7.0.0"
interpret "^1.0.0"
rechoir "^0.6.2"
signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
smartchai@^1.0.3:
version "1.0.8"
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.8.tgz#a074836f4ddd4b98c50f1e7ae9e8e8ad9f6f1902"
dependencies:
"@types/code" "^4.0.3"
code "^5.1.0"
typings-global "^1.0.20"
smartdelay@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.4.tgz#791c1a4ee6770494064c10b1d2d2b8e6f3105b82"
dependencies:
smartq "^1.1.1"
typings-global "^1.0.16"
smartenv@^2.0.0:
version "2.0.6"
resolved "https://registry.yarnpkg.com/smartenv/-/smartenv-2.0.6.tgz#b38c679b0c151b9af548f68c3a072c29d1417e8d"
dependencies:
lodash "^4.17.4"
smartq "^1.1.1"
typings-global "^1.0.14"
smartparam@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/smartparam/-/smartparam-1.0.2.tgz#6b6a50353b81dbe3353c0d353fbccd02e8963f2c"
dependencies:
beautylog "6.1.10"
is-promise "^2.1.0"
minimatch "^3.0.4"
smartq "^1.1.6"
typings-global "^1.0.20"
smartq@^1.1.1, smartq@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
dependencies:
typings-global "^1.0.19"
util.promisify "^1.0.0"
smartshell@^1.0.6:
version "1.0.18"
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.18.tgz#b84ccc65cedf3a875bf676cec78ee07f4b4aa9e5"
dependencies:
"@types/shelljs" "^0.7.4"
"@types/which" "^1.0.28"
shelljs "^0.7.8"
smartq "^1.1.6"
typings-global "^1.0.20"
which "^1.3.0"
spdx-correct@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"
dependencies:
spdx-license-ids "^1.0.2"
spdx-expression-parse@~1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c"
spdx-license-ids@^1.0.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57"
string-width@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
dependencies:
code-point-at "^1.0.0"
is-fullwidth-code-point "^1.0.0"
strip-ansi "^3.0.0"
string-width@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
dependencies:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"
strip-ansi@^3.0.0, strip-ansi@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
dependencies:
ansi-regex "^2.0.0"
strip-ansi@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
dependencies:
ansi-regex "^3.0.0"
strip-bom@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
strip-eof@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
symbol-observable@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
tapbundle@^1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.8.tgz#e08aee0e100a830d8a26a583a85d37ce53312e02"
dependencies:
"@types/node" "^8.0.33"
early "^2.1.1"
leakage "^0.3.0"
smartchai "^1.0.3"
smartdelay "^1.0.3"
smartq "^1.1.1"
typings-global "^1.0.19"
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20:
version "1.0.20"
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.20.tgz#3da769c54db538247c5d877d1d9e97eb2ec981ff"
dependencies:
semver "^5.3.0"
smartshell "^1.0.6"
util.promisify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
dependencies:
define-properties "^1.1.2"
object.getownpropertydescriptors "^2.0.3"
validate-npm-package-license@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc"
dependencies:
spdx-correct "~1.0.0"
spdx-expression-parse "~1.0.0"
which-module@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
which@^1.2.9, which@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"
dependencies:
isexe "^2.0.0"
wrap-ansi@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
dependencies:
string-width "^1.0.1"
strip-ansi "^3.0.1"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
y18n@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
yargs-parser@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9"
dependencies:
camelcase "^4.1.0"
yargs@^9.0.1:
version "9.0.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c"
dependencies:
camelcase "^4.1.0"
cliui "^3.2.0"
decamelize "^1.1.1"
get-caller-file "^1.0.1"
os-locale "^2.0.0"
read-pkg-up "^2.0.0"
require-directory "^2.1.1"
require-main-filename "^1.0.1"
set-blocking "^2.0.0"
string-width "^2.0.0"
which-module "^2.0.0"
y18n "^3.2.1"
yargs-parser "^7.0.0"