Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
97a5ff8
chore: base logic & mechanism implemented
carloscortonc Jan 17, 2026
d4f9de4
feat: add help-cmd & clean
carloscortonc Jan 17, 2026
410dfa5
feat: wf to publish github-pages
carloscortonc Jan 17, 2026
791a2b5
chore: force wf run
carloscortonc Jan 17, 2026
cb91a14
chore: ci on root
carloscortonc Jan 17, 2026
d4f6898
chore: fix root script
carloscortonc Jan 17, 2026
40370bb
chore: update node version
carloscortonc Jan 17, 2026
edb20d7
chore: use i instead of ci
carloscortonc Jan 17, 2026
81b32fe
chore: update root package-lock
carloscortonc Jan 17, 2026
62ca73b
chore: try ci again
carloscortonc Jan 17, 2026
f645276
chore: re-update package-lock
carloscortonc Jan 17, 2026
f1dd37f
chore: rename src to public & add favicon
carloscortonc Jan 17, 2026
7eb5a62
chore: fix favicon path and position
carloscortonc Jan 17, 2026
69aa558
feat: keep output
carloscortonc Jan 17, 2026
e4b03f9
feat: history
carloscortonc Jan 18, 2026
22c74ea
feat: tab
carloscortonc Jan 18, 2026
1903549
feat: clear spec
carloscortonc Jan 18, 2026
d5c32ec
Merge branch 'develop' into feature/site
carloscortonc Jan 18, 2026
1a2bbd7
fix: clear output-after
carloscortonc Jan 18, 2026
f3c8280
chore: omit help on simple commands
carloscortonc Jan 18, 2026
2e435bf
feat: styles
carloscortonc Jan 21, 2026
d0b8f83
feat: switch to vite
carloscortonc Jan 21, 2026
e8812f1
chore: organize content
carloscortonc Jan 21, 2026
0bc756a
chore: fix bundle script
carloscortonc Jan 21, 2026
ed02a7b
chore: missing vite dep
carloscortonc Jan 21, 2026
3a92385
fix: type module
carloscortonc Jan 21, 2026
d6142f8
chore: fix bundle script
carloscortonc Jan 21, 2026
b97e4c8
chore: move cli.web.js to /src folder
carloscortonc Jan 21, 2026
f58cad1
feat: bash interpreter (base)
carloscortonc Jan 22, 2026
51995c2
chore: missing package-json changes
carloscortonc Jan 22, 2026
b6c2f29
feat: handle bash logic operations
carloscortonc Jan 23, 2026
e928562
feat: improve process.exitCode && ouput
carloscortonc Jan 24, 2026
82dd0ec
chore: switch command definition to object
carloscortonc Jan 24, 2026
9d23b38
feat: separate examples/docker def & allow remotes
carloscortonc Jan 24, 2026
fcfc1a9
feat: lightmode
carloscortonc Jan 24, 2026
e7df4e3
fix: wrong command paths
carloscortonc Jan 24, 2026
f539f1e
feat: move cli execution to web-worker
carloscortonc Jan 26, 2026
091d127
feat(bash): quoted strings
carloscortonc Jan 27, 2026
c619284
feat(bash): expressions inside quotes & sleep cmd
carloscortonc Jan 28, 2026
58a6d8b
chore: basic responsive for mobile
carloscortonc Jan 28, 2026
c998de8
feat(bash): environment variables
carloscortonc Jan 28, 2026
884f81d
build: update actions/cache version
carloscortonc Jan 28, 2026
bbeb02f
fix: avoid `process.env` being processed by vite
carloscortonc Jan 28, 2026
ea6b4ce
feat(bash): allow inner-expr without quotes
carloscortonc Jan 28, 2026
16aa69c
feat(bash): basic expansion
carloscortonc Jan 28, 2026
04e373c
feat(bash): special param expansion
carloscortonc Jan 29, 2026
b484d87
chore: move single "$" to quoted-text
carloscortonc Jan 29, 2026
33c4037
feat: printenv cmd
carloscortonc Jan 29, 2026
1ed583c
feat: basic fs module
carloscortonc Jan 29, 2026
39d2125
chore: refactor fs module into a class
carloscortonc Jan 29, 2026
c6bca44
feat: enable stdin reading from worker
carloscortonc Jan 29, 2026
c038a88
fix: configure worker as esmodule
carloscortonc Jan 29, 2026
1bcbb9f
chore: update releaserc to include docs/site
carloscortonc Jan 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
node-version: 20

- name: Setup cache for dist
uses: actions/cache@v3
uses: actions/cache@v5
with:
path: dist
key: dist-${{ github.run_id }}
Expand All @@ -41,7 +41,7 @@ jobs:
fetch-depth: 0

- name: Restore dist cache
uses: actions/cache@v3
uses: actions/cache@v5
with:
path: dist
key: dist-${{ github.run_id }}
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Deploy Docs

on:
push:
branches: [develop]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
working-directory: site
run: npm ci

- name: Bundle docs
working-directory: site
run: npm run bundle

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
32 changes: 30 additions & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
["@semantic-release/release-notes-generator", { "writerOpts": { "commitGroupsSort": ["feat", "fix"] } }],
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{ "breaking": true, "release": "major" },
{ "type": "feat", "release": "minor" },
{ "type": "fix", "release": "patch" },
{ "type": "docs", "release": false },
{ "type": "site", "release": false },
{ "type": "perf", "release": "patch" },
{ "type": "refactor", "release": "patch" }
]
}
],
[
"@semantic-release/release-notes-generator",
{
"writerOpts": {
"types": [
{ "type": "feat", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "docs", "section": "Documentation" },
{ "type": "site", "section": "Site Changes" },
{ "type": "perf", "section": "Performance Improvements" },
{ "type": "refactor", "section": "Code Refactoring" }
],
"commitGroupsSort": ["feat", "fix", "perf", "docs", "site"]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
["@semantic-release/git", { "message": "chore(release): ${nextRelease.version}" }],
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<a href="./docs/definition.md">Definition</a>
<span>&nbsp;·&nbsp;</span>
<a href="./docs/cli-options.md">Options</a>
<span>&nbsp;·&nbsp;</span>
<a href="https://carloscortonc.github.io/cli-er/">Live demo</a>
</h4>

_cli.js_:
Expand Down
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This method has three main behaviours: print version, print help and execute a c
- **print help**: if [autoincluded help](/docs/cli-options.md#helpautoinclude) is enabled and help option is provided, or a cli without `rootCommand` is invoked without location, or a namespace is invoked, help will be generated. If any errors configured in [`CliOptions.errors.onGenerateHelp`](/docs/cli-options.md#errorsongeneratehelp) are generated, they will be outputted before the help.
- **execute command**: if any errors configured in [`CliOptions.errors.onExecuteCommand`](/docs/cli-options.md#errorsonexecutecommand) are generated, they will be printed and execution will end with status `1`. Otherwise, the script location will be calculated, and the corresponding script executed.

If a cli application does not have registered a root command (logic executed without any supplied namespace/command), it should be configured with [`CliOptions.rootCommand: false`](/docs/cli-options.md#rootcommand). By doing this, when the cli application is invoked with no arguments, full help will be shown (see this [docker example](/examples/docker/docker.js#L128)).
If a cli application does not have registered a root command (logic executed without any supplied namespace/command), it should be configured with [`CliOptions.rootCommand: false`](/docs/cli-options.md#rootcommand). By doing this, when the cli application is invoked with no arguments, full help will be shown (see this [docker example](/examples/docker/definition.js#L130)).

You also use `CliOptions.rootCommand` to define a default command to execute, when no command/namespace is supplied (check this [webpack-cli example](/examples/webpack-cli)).

Expand Down
4 changes: 2 additions & 2 deletions docs/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Aliases to be used for help option</br>
##### `help.description`
Description for the option
##### `help.template`
Template to be used when generating help. There are five distinct sections: **usage**, **description**, **namespaces**, **commands** and **options**. This can be used to include a header/footer, change the order of the sections, or remove a section altogether. If a section has no content, it will be removed along with any line-breaks that follow. You can see a use-case for this in the [docker example](/examples/docker/docker.js#L130)</br>
Template to be used when generating help. There are five distinct sections: **usage**, **description**, **namespaces**, **commands** and **options**. This can be used to include a header/footer, change the order of the sections, or remove a section altogether. If a section has no content, it will be removed along with any line-breaks that follow. You can see a use-case for this in the [docker example](/examples/docker/definition.js#L133)</br>
**Default**: `\n{usage}\n{description}\n{namespaces}\n{commands}\n{options}\n`

#### `version`
Expand All @@ -64,7 +64,7 @@ If a string is provided, it will be used as the default command to execute </br>
**Default**: `true`

#### `logger`
Logger to be used by the cli. It contains two methods, `log` and `error`, that can be used to add a prefix to the log (e.g. "error ") or change the output color, as demonstrated in this [docker example](/examples/docker/docker.js#L133).</br>
Logger to be used by the cli. It contains two methods, `log` and `error`, that can be used to add a prefix to the log (e.g. "error ") or change the output color, as demonstrated in this [docker example](/examples/docker/docker.js#L8).</br>
**Default**: [/src/cli-logger.ts](/src/cli-logger.ts)

#### `cliName`
Expand Down
136 changes: 136 additions & 0 deletions examples/docker/definition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
export default {
definition: {
builder: {
description: "Manage builds",
options: {
build: {
description: "Build an image from a Dockerfile",
usage: Cli.formatMessage("generate-help.has-options").concat(" PATH | URL | -"),
options: {
source: {
positional: 0,
required: true,
description: "Path or Url to the Dockerfile",
},
addHost: {
aliases: ["add-host"],
type: "list",
description: "Add a custom host-to-IP mapping (host:ip)",
},
buildArg: {
aliases: ["build-arg"],
type: "list",
description: "Set build-time variables",
},
cacheFrom: {
aliases: ["cache-from"],
type: "list",
description: "Images to consider as cache sources",
},
disableContentTrust: {
aliases: ["disable-content-trust"],
type: "boolean",
default: true,
description: "Skip image verification",
},
file: {
aliases: ["f", "file"],
description: "Name of the Dockerfile (Default is 'PATH/Dockerfile')",
},
iidfile: {
description: "Write the image ID to the file",
},
isolation: {
description: "Container isolation technology",
},
label: {
type: "list",
description: "Set metadata for an image",
},
network: {
default: "default",
description: "Set the networking mode for the RUN instructions during build",
},
noCache: {
aliases: ["no-cache"],
type: "boolean",
description: "Do not use cache when building the image",
},
output: {
aliases: ["o", "output"],
description: "Output destination (format: type=local,dest=path)",
},
platform: {
description: "Set platform if server is multi-platform capable",
},
progress: {
default: "auto",
description: "Set type of progress output (auto, plain, tty). Use plain to show container output",
},
pull: {
type: "boolean",
description: "Always attempt to pull a newer version of the image",
},
quiet: {
aliases: ["q", "quiet"],
type: "boolean",
description: "Suppress the build output and print image ID on success",
},
secret: {
description: "Secret file to expose to the build (only if BuildKit enabled)",
},
ssh: {
description: "SSH agent socket or keys to expose to the build (only if BuildKit enabled)",
},
tag: {
aliases: ["t", "tag"],
type: "list",
description: "Name and optionally a tag in the 'name:tag' format",
},
target: {
description: "Set the target build stage to build",
},
},
},
prune: {
description: "Remove build cache",
options: {
all: {
aliases: ["a", "all"],
type: "boolean",
description: "Remove all unused build cache, not just dangling ones",
},
filter: {
description: "Provide filter values (e.g. 'until=24h')",
},
force: {
aliases: ["f", "force"],
type: "boolean",
description: "Do not prompt for confirmation",
},
keepStorage: {
aliases: ["keep-storage"],
type: "number",
description: "Amount of disk space to keep for cache",
},
},
},
},
},
debug: {
description: "Enable debug mode",
aliases: ["D", "debug"],
type: "boolean",
negatable: true,
default: false,
},
},
cliOptions: {
cliName: "docker",
rootCommand: false,
help: {
template:
"\n{usage}\n{description}\n{namespaces}\n{commands}\n{options}\nRun 'docker COMMAND --help' for more information on a command.\n",
},
},
};
Loading