@twin.org/cli-core 0.0.2-next.4 → 0.0.2-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,6 +139,15 @@ class CLIDisplay {
139
139
  CLIDisplay.write(node_util.inspect(obj, false, undefined, true));
140
140
  CLIDisplay.write("\n");
141
141
  }
142
+ /**
143
+ * Display a warning.
144
+ * @param label The label for the warning.
145
+ */
146
+ static warning(label) {
147
+ CLIDisplay.write("⚠️ ");
148
+ CLIDisplay.write(chalk.hex("#FFA500").bold(label));
149
+ CLIDisplay.write("\n\n");
150
+ }
142
151
  /**
143
152
  * Display the processing is done.
144
153
  */
@@ -443,7 +452,7 @@ function handleGlobalOptions(command) {
443
452
  const resolvedEnv = loadEnv.map(e => path.resolve(e));
444
453
  CLIDisplay.task(core.I18n.formatMessage("cli.progress.loadingEnvFiles"), resolvedEnv.join(", "));
445
454
  CLIDisplay.break();
446
- dotenv__namespace.config({ path: resolvedEnv });
455
+ dotenv__namespace.config({ path: resolvedEnv, quiet: true });
447
456
  }
448
457
  }
449
458
  /**
@@ -510,6 +519,9 @@ class CLIBase {
510
519
  // eslint-disable-next-line no-restricted-syntax
511
520
  throw new Error(err.code === "commander.help" ? "0" : err.exitCode.toString());
512
521
  });
522
+ if (options.showDevToolWarning ?? false) {
523
+ program.hook("preAction", () => CLIDisplay.warning(core.I18n.formatMessage("warn.common.devOnlyTool")));
524
+ }
513
525
  this.configureRoot(program);
514
526
  addGlobalOptions(program, options.supportsLang ?? true, options.supportsEnvFiles ?? false);
515
527
  // We parse the options before building the command
@@ -118,6 +118,15 @@ class CLIDisplay {
118
118
  CLIDisplay.write(inspect(obj, false, undefined, true));
119
119
  CLIDisplay.write("\n");
120
120
  }
121
+ /**
122
+ * Display a warning.
123
+ * @param label The label for the warning.
124
+ */
125
+ static warning(label) {
126
+ CLIDisplay.write("⚠️ ");
127
+ CLIDisplay.write(chalk.hex("#FFA500").bold(label));
128
+ CLIDisplay.write("\n\n");
129
+ }
121
130
  /**
122
131
  * Display the processing is done.
123
132
  */
@@ -422,7 +431,7 @@ function handleGlobalOptions(command) {
422
431
  const resolvedEnv = loadEnv.map(e => path.resolve(e));
423
432
  CLIDisplay.task(I18n.formatMessage("cli.progress.loadingEnvFiles"), resolvedEnv.join(", "));
424
433
  CLIDisplay.break();
425
- dotenv.config({ path: resolvedEnv });
434
+ dotenv.config({ path: resolvedEnv, quiet: true });
426
435
  }
427
436
  }
428
437
  /**
@@ -489,6 +498,9 @@ class CLIBase {
489
498
  // eslint-disable-next-line no-restricted-syntax
490
499
  throw new Error(err.code === "commander.help" ? "0" : err.exitCode.toString());
491
500
  });
501
+ if (options.showDevToolWarning ?? false) {
502
+ program.hook("preAction", () => CLIDisplay.warning(I18n.formatMessage("warn.common.devOnlyTool")));
503
+ }
492
504
  this.configureRoot(program);
493
505
  addGlobalOptions(program, options.supportsLang ?? true, options.supportsEnvFiles ?? false);
494
506
  // We parse the options before building the command
@@ -56,6 +56,11 @@ export declare class CLIDisplay {
56
56
  * @param obj The object to display.
57
57
  */
58
58
  static json(obj: unknown): void;
59
+ /**
60
+ * Display a warning.
61
+ * @param label The label for the warning.
62
+ */
63
+ static warning(label: string): void;
59
64
  /**
60
65
  * Display the processing is done.
61
66
  */
@@ -30,4 +30,8 @@ export interface ICliOptions {
30
30
  * Override the default output width.
31
31
  */
32
32
  overrideOutputWidth?: number;
33
+ /**
34
+ * Show a warning that this is a dev tool and not for production use.
35
+ */
36
+ showDevToolWarning?: boolean;
33
37
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @twin.org/cli-core - Changelog
2
2
 
3
+ ## [0.0.2-next.5](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.2-next.4...cli-core-v0.0.2-next.5) (2025-08-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * use cause instead of inner for errors ([1f4acc4](https://github.com/twinfoundation/framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/core bumped from 0.0.2-next.4 to 0.0.2-next.5
16
+ * @twin.org/crypto bumped from 0.0.2-next.4 to 0.0.2-next.5
17
+ * @twin.org/nameof bumped from 0.0.2-next.4 to 0.0.2-next.5
18
+ * devDependencies
19
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.4 to 0.0.2-next.5
20
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.4 to 0.0.2-next.5
21
+
3
22
  ## [0.0.2-next.4](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.2-next.3...cli-core-v0.0.2-next.4) (2025-08-15)
4
23
 
5
24
 
@@ -1,4 +1,4 @@
1
- # Class: `abstract` CLIBase
1
+ # Abstract Class: CLIBase
2
2
 
3
3
  The main entry point for the CLI.
4
4
 
@@ -234,6 +234,26 @@ The object to display.
234
234
 
235
235
  ***
236
236
 
237
+ ### warning()
238
+
239
+ > `static` **warning**(`label`): `void`
240
+
241
+ Display a warning.
242
+
243
+ #### Parameters
244
+
245
+ ##### label
246
+
247
+ `string`
248
+
249
+ The label for the warning.
250
+
251
+ #### Returns
252
+
253
+ `void`
254
+
255
+ ***
256
+
237
257
  ### done()
238
258
 
239
259
  > `static` **done**(): `void`
@@ -57,3 +57,11 @@ Supports the loading of env files.
57
57
  > `optional` **overrideOutputWidth**: `number`
58
58
 
59
59
  Override the default output width.
60
+
61
+ ***
62
+
63
+ ### showDevToolWarning?
64
+
65
+ > `optional` **showDevToolWarning**: `boolean`
66
+
67
+ Show a warning that this is a dev tool and not for production use.
package/locales/en.json CHANGED
@@ -12,6 +12,11 @@
12
12
  }
13
13
  }
14
14
  },
15
+ "warn": {
16
+ "common": {
17
+ "devOnlyTool": "This tool is intended to be used for development purposes, it is not recommended for use in production scenarios."
18
+ }
19
+ },
15
20
  "cli": {
16
21
  "progress": {
17
22
  "done": "Done.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/cli-core",
3
- "version": "0.0.2-next.4",
3
+ "version": "0.0.2-next.5",
4
4
  "description": "Core classes for building a CLI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,12 +14,12 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "0.0.2-next.4",
18
- "@twin.org/crypto": "0.0.2-next.4",
19
- "@twin.org/nameof": "0.0.2-next.4",
20
- "chalk": "5.4.1",
17
+ "@twin.org/core": "0.0.2-next.5",
18
+ "@twin.org/crypto": "0.0.2-next.5",
19
+ "@twin.org/nameof": "0.0.2-next.5",
20
+ "chalk": "5.6.0",
21
21
  "commander": "14.0.0",
22
- "dotenv": "17.2.0"
22
+ "dotenv": "17.2.1"
23
23
  },
24
24
  "main": "./dist/cjs/index.cjs",
25
25
  "module": "./dist/esm/index.mjs",