From 97a5ff84c59b4732d2ffb9123cb85b4ceb4c9bbd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20Cort=C3=B3n=20Cobas?=
<104267232+carloscortonc@users.noreply.github.com>
Date: Sat, 17 Jan 2026 10:52:40 +0100
Subject: [PATCH 01/52] chore: base logic & mechanism implemented
---
examples/web/cli.js | 4 -
examples/web/index.html | 70 ---------------
{examples/web => site}/.gitignore | 0
{examples/web => site}/README.md | 3 +-
site/cli.js | 4 +
site/commands/commands.js | 7 ++
{examples/web => site}/definition.json | 0
site/index.html | 103 +++++++++++++++++++++++
{examples/web => site}/package-lock.json | 0
{examples/web => site}/package.json | 2 +-
{examples/web => site/shims}/fs.js | 5 +-
{examples/web => site/shims}/shims.js | 0
site/shims/url.js | 3 +
13 files changed, 124 insertions(+), 77 deletions(-)
delete mode 100644 examples/web/cli.js
delete mode 100644 examples/web/index.html
rename {examples/web => site}/.gitignore (100%)
rename {examples/web => site}/README.md (97%)
create mode 100644 site/cli.js
create mode 100644 site/commands/commands.js
rename {examples/web => site}/definition.json (100%)
create mode 100644 site/index.html
rename {examples/web => site}/package-lock.json (100%)
rename {examples/web => site}/package.json (72%)
rename {examples/web => site/shims}/fs.js (50%)
rename {examples/web => site/shims}/shims.js (100%)
create mode 100644 site/shims/url.js
diff --git a/examples/web/cli.js b/examples/web/cli.js
deleted file mode 100644
index e15904c..0000000
--- a/examples/web/cli.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import "./shims.js";
-import Cli from "../../dist/index.js";
-
-window.Cli = Cli;
diff --git a/examples/web/index.html b/examples/web/index.html
deleted file mode 100644
index 3288ce9..0000000
--- a/examples/web/index.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
- Cli on the Web
-
-
- $
-
-
-
-
diff --git a/examples/web/.gitignore b/site/.gitignore
similarity index 100%
rename from examples/web/.gitignore
rename to site/.gitignore
diff --git a/examples/web/README.md b/site/README.md
similarity index 97%
rename from examples/web/README.md
rename to site/README.md
index 11410db..f92514e 100644
--- a/examples/web/README.md
+++ b/site/README.md
@@ -8,4 +8,5 @@ $ npm run bundle
# start the application (replace "bunx" with "npx" if not installed )
$ npm run start
-```
\ No newline at end of file
+```
+
diff --git a/site/cli.js b/site/cli.js
new file mode 100644
index 0000000..48360b3
--- /dev/null
+++ b/site/cli.js
@@ -0,0 +1,4 @@
+import "./shims/shims.js";
+import Cli from "../dist/index.js";
+
+window.Cli = Cli;
diff --git a/site/commands/commands.js b/site/commands/commands.js
new file mode 100644
index 0000000..b80c4ac
--- /dev/null
+++ b/site/commands/commands.js
@@ -0,0 +1,7 @@
+export default [
+ {},
+ { cliDescription: "List available commands" },
+ (p) => {
+ Cli.logger.log("[Command::action]", p);
+ },
+];
diff --git a/examples/web/definition.json b/site/definition.json
similarity index 100%
rename from examples/web/definition.json
rename to site/definition.json
diff --git a/site/index.html b/site/index.html
new file mode 100644
index 0000000..1fbfe08
--- /dev/null
+++ b/site/index.html
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+ Cli on the Web
+
+
+
+ $
+
+
+
+
diff --git a/examples/web/package-lock.json b/site/package-lock.json
similarity index 100%
rename from examples/web/package-lock.json
rename to site/package-lock.json
diff --git a/examples/web/package.json b/site/package.json
similarity index 72%
rename from examples/web/package.json
rename to site/package.json
index b3b3cfe..d24edc9 100644
--- a/examples/web/package.json
+++ b/site/package.json
@@ -4,7 +4,7 @@
"main": "cli.js",
"type": "module",
"scripts": {
- "bundle": "browserify cli.js -p esmify --require ./fs.js:fs --igv=__filename,__dirname,Buffer,global > cli.web.js",
+ "bundle": "browserify cli.js -p esmify --require ./shims/fs.js:fs --require ./shims/url.js:url --igv=__filename,__dirname,Buffer,global > cli.web.js",
"start": "bunx http-server . -p 3000",
"test": "echo \"Error: no test specified\" && exit 1"
},
diff --git a/examples/web/fs.js b/site/shims/fs.js
similarity index 50%
rename from examples/web/fs.js
rename to site/shims/fs.js
index 7c42cb6..970c42c 100644
--- a/examples/web/fs.js
+++ b/site/shims/fs.js
@@ -1,5 +1,8 @@
module.exports = {
readFileSync: () => undefined,
- existsSync: () => false,
+ existsSync: (p) => {
+ console.log("[existsSync]", p);
+ return true;
+ },
realpathSync: () => "",
};
diff --git a/examples/web/shims.js b/site/shims/shims.js
similarity index 100%
rename from examples/web/shims.js
rename to site/shims/shims.js
diff --git a/site/shims/url.js b/site/shims/url.js
new file mode 100644
index 0000000..6eef58f
--- /dev/null
+++ b/site/shims/url.js
@@ -0,0 +1,3 @@
+module.exports = {
+ pathToFileURL: () => ({ href: "" }),
+};
From d4f9de427ac8503aa3d4213fb12d65cd7abfea0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20Cort=C3=B3n=20Cobas?=
<104267232+carloscortonc@users.noreply.github.com>
Date: Sat, 17 Jan 2026 10:54:36 +0100
Subject: [PATCH 02/52] feat: add help-cmd & clean
---
site/browserify.js | 23 ++++++++++++++++
site/commands/commands.js | 4 +--
site/commands/help.js | 5 ++++
site/index.html | 58 +++++++++++++++++++++++----------------
site/package.json | 2 +-
site/shims/shims.js | 3 --
6 files changed, 65 insertions(+), 30 deletions(-)
create mode 100644 site/browserify.js
create mode 100644 site/commands/help.js
diff --git a/site/browserify.js b/site/browserify.js
new file mode 100644
index 0000000..d28860c
--- /dev/null
+++ b/site/browserify.js
@@ -0,0 +1,23 @@
+import browserify from "browserify";
+import fs from "fs";
+
+const b = browserify({
+ entries: ["cli.js"],
+ insertGlobalVars: {
+ __filename: undefined,
+ __dirname: undefined,
+ Buffer: undefined,
+ global: undefined,
+ process: undefined,
+ },
+});
+
+// plugin: esmify
+b.plugin("esmify");
+
+// requires with aliases
+b.require("./shims/fs.js", { expose: "fs" });
+b.require("./shims/url.js", { expose: "url" });
+
+// bundle output
+b.bundle().pipe(fs.createWriteStream("cli.web.js"));
diff --git a/site/commands/commands.js b/site/commands/commands.js
index b80c4ac..b963765 100644
--- a/site/commands/commands.js
+++ b/site/commands/commands.js
@@ -1,7 +1,7 @@
export default [
{},
{ cliDescription: "List available commands" },
- (p) => {
- Cli.logger.log("[Command::action]", p);
+ () => {
+ Cli.logger.log("Available commands: ", Object.keys(CLI_COMMANDS).join(", "));
},
];
diff --git a/site/commands/help.js b/site/commands/help.js
new file mode 100644
index 0000000..cf92bf4
--- /dev/null
+++ b/site/commands/help.js
@@ -0,0 +1,5 @@
+export default [
+ {},
+ { cliDescription: "Display help" },
+ () => Cli.logger.log("This is a sandboxed environment to test cli-definitions"),
+];
diff --git a/site/index.html b/site/index.html
index 1fbfe08..cd39be6 100644
--- a/site/index.html
+++ b/site/index.html
@@ -6,7 +6,7 @@
@@ -74,9 +78,10 @@
cli-er - Modular Command-Line Interface Builder
Type commands to get a list of available commands
+
$
-
@@ -119,70 +32,6 @@
-
-
+