gunshi 0.23.0 → 0.24.0

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.
package/README.md CHANGED
@@ -100,6 +100,7 @@ About more details and usage, see [documentations](https://gunshi.dev)
100
100
 
101
101
  - [pnpmc](https://github.com/kazupon/pnpmc): PNPM Catalogs Tooling
102
102
  - [sourcemap-publisher](https://github.com/es-tooling/sourcemap-publisher): A tool to publish sourcemaps externally and rewrite sourcemap URLs at pre-publish time
103
+ - [curxy](https://github.com/ryoppippi/curxy): An proxy worker for using ollama in cursor
103
104
 
104
105
  ## 🙌 Contributing guidelines
105
106
 
@@ -117,7 +118,7 @@ Thank you!
117
118
 
118
119
  ## 🤝 Sponsors
119
120
 
120
- The development of Gunish is supported by my OSS sponsors!
121
+ The development of Gunshi is supported by my OSS sponsors!
121
122
 
122
123
  <p align="center">
123
124
  <a href="https://cdn.jsdelivr.net/gh/kazupon/sponsors/sponsors.svg">
@@ -1,6 +1,6 @@
1
- import { COMMAND_OPTIONS_DEFAULT, COMMON_ARGS, create, isLazyCommand, resolveLazyCommand } from "./utils-GlOAgmx0.js";
2
- import { createCommandContext } from "./context-B_pkfbdk.js";
3
- import { renderHeader, renderUsage, renderValidationErrors } from "./renderer-8HgcYJqp.js";
1
+ import { ANONYMOUS_COMMAND_NAME, COMMAND_OPTIONS_DEFAULT, COMMON_ARGS, create, isLazyCommand, resolveLazyCommand } from "./utils-D41C8Abf.js";
2
+ import { createCommandContext } from "./context-COFfMm-R.js";
3
+ import { renderHeader, renderUsage, renderValidationErrors } from "./renderer-kzo45gaB.js";
4
4
  import { parseArgs, resolveArgs } from "args-tokens";
5
5
 
6
6
  //#region src/cli.ts
@@ -134,7 +134,7 @@ async function resolveCommand(sub, entry, options) {
134
134
  };
135
135
  }
136
136
  function resolveEntryName(entry) {
137
- return entry.name || "(anonymous)";
137
+ return entry.name || ANONYMOUS_COMMAND_NAME;
138
138
  }
139
139
  async function executeCommand(cmd, ctx, name) {
140
140
  const resolved = isLazyCommand(cmd) ? await resolveLazyCommand(cmd, name, true) : cmd;
@@ -1,4 +1,4 @@
1
- import { BUILT_IN_PREFIX, COMMAND_OPTIONS_DEFAULT, DEFAULT_LOCALE$1 as DEFAULT_LOCALE, NOOP, create, deepFreeze, log, mapResourceWithBuiltinKey, resolveArgKey, resolveExamples, resolveLazyCommand } from "./utils-GlOAgmx0.js";
1
+ import { ANONYMOUS_COMMAND_NAME, BUILT_IN_PREFIX, COMMAND_OPTIONS_DEFAULT, DEFAULT_LOCALE$1 as DEFAULT_LOCALE, NOOP, create, deepFreeze, isLazyCommand, log, mapResourceWithBuiltinKey, resolveArgKey, resolveExamples, resolveLazyCommand } from "./utils-D41C8Abf.js";
2
2
 
3
3
  //#region src/locales/en-US.json
4
4
  var COMMAND = "COMMAND";
@@ -125,7 +125,7 @@ async function createCommandContext({ args, values, positionals, rest, argv, tok
125
125
  * create the context
126
126
  */
127
127
  const ctx = deepFreeze(Object.assign(create(), {
128
- name: command.name,
128
+ name: getCommandName(command),
129
129
  description: command.description,
130
130
  omitted,
131
131
  callMode,
@@ -166,6 +166,11 @@ async function createCommandContext({ args, values, positionals, rest, argv, tok
166
166
  }
167
167
  return ctx;
168
168
  }
169
+ function getCommandName(cmd) {
170
+ if (isLazyCommand(cmd)) return cmd.commandName || cmd.name || ANONYMOUS_COMMAND_NAME;
171
+ else if (typeof cmd === "object") return cmd.name || ANONYMOUS_COMMAND_NAME;
172
+ else return ANONYMOUS_COMMAND_NAME;
173
+ }
169
174
  function resolveLocale(locale) {
170
175
  return locale instanceof Intl.Locale ? locale : typeof locale === "string" ? new Intl.Locale(locale) : new Intl.Locale(DEFAULT_LOCALE);
171
176
  }
package/lib/context.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CliOptions, Command, CommandCallMode, CommandContext } from "./types-ZXqvU8Ti.js";
1
+ import { CliOptions, Command, CommandCallMode, CommandContext, LazyCommand } from "./types-BDWiiycu.js";
2
2
  import { ArgToken, ArgValues, Args } from "args-tokens";
3
3
 
4
4
  //#region src/context.d.ts
@@ -43,9 +43,9 @@ interface CommandContextParams<A extends Args, V> {
43
43
  */
44
44
  callMode: CommandCallMode;
45
45
  /**
46
- * A target {@link Command | command}
46
+ * A target command
47
47
  */
48
- command: Command<A>;
48
+ command: Command<A> | LazyCommand<A>;
49
49
  /**
50
50
  * A command options, which is spicialized from `cli` function
51
51
  */
package/lib/context.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./utils-GlOAgmx0.js";
2
- import { createCommandContext } from "./context-B_pkfbdk.js";
1
+ import "./utils-D41C8Abf.js";
2
+ import { createCommandContext } from "./context-COFfMm-R.js";
3
3
 
4
4
  export { createCommandContext };
@@ -1,4 +1,4 @@
1
- import { Command, CommandLoader, LazyCommand } from "./types-ZXqvU8Ti.js";
1
+ import { Command, CommandLoader, LazyCommand } from "./types-BDWiiycu.js";
2
2
  import { ArgSchema, ArgValues as ArgValues$1, Args, Args as Args$1 } from "args-tokens";
3
3
 
4
4
  //#region src/definition.d.ts
@@ -1,3 +1,3 @@
1
- import "./types-ZXqvU8Ti.js";
2
- import { ArgSchema, ArgValues, Args, define$1 as define, lazy$1 as lazy } from "./definition-BFYUOPMR.js";
1
+ import "./types-BDWiiycu.js";
2
+ import { ArgSchema, ArgValues, Args, define$1 as define, lazy$1 as lazy } from "./definition-zTfMFgKw.js";
3
3
  export { ArgSchema, ArgValues, Args, define, lazy };
@@ -1,4 +1,4 @@
1
- import { CliOptions, Command, LazyCommand } from "./types-ZXqvU8Ti.js";
1
+ import { CliOptions, Command, LazyCommand } from "./types-BDWiiycu.js";
2
2
  import { Args } from "args-tokens";
3
3
 
4
4
  //#region src/generator.d.ts
package/lib/generator.js CHANGED
@@ -1,7 +1,7 @@
1
- import { create } from "./utils-GlOAgmx0.js";
2
- import "./context-B_pkfbdk.js";
3
- import "./renderer-8HgcYJqp.js";
4
- import { cli } from "./cli-DBIMF97F.js";
1
+ import { create } from "./utils-D41C8Abf.js";
2
+ import "./context-COFfMm-R.js";
3
+ import "./renderer-kzo45gaB.js";
4
+ import { cli } from "./cli-BVD3QITm.js";
5
5
 
6
6
  //#region src/generator.ts
7
7
  /**
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { CliOptions, Command, CommandArgKeys, CommandBuiltinArgsKeys, CommandBuiltinKeys, CommandBuiltinResourceKeys, CommandCallMode, CommandContext, CommandEnvironment, CommandExamplesFetcher, CommandLoader, CommandResource, CommandResourceFetcher, CommandRunner, Commandable, DEFAULT_LOCALE, GenerateNamespacedKey, KeyOfArgs, LazyCommand, RemovedIndex, TranslationAdapter, TranslationAdapterFactory, TranslationAdapterFactoryOptions } from "./types-ZXqvU8Ti.js";
2
- import { define$1 as define, lazy$1 as lazy } from "./definition-BFYUOPMR.js";
1
+ import { CliOptions, Command, CommandArgKeys, CommandBuiltinArgsKeys, CommandBuiltinKeys, CommandBuiltinResourceKeys, CommandCallMode, CommandContext, CommandEnvironment, CommandExamplesFetcher, CommandLoader, CommandResource, CommandResourceFetcher, CommandRunner, Commandable, DEFAULT_LOCALE, GenerateNamespacedKey, KeyOfArgs, LazyCommand, RemovedIndex, TranslationAdapter, TranslationAdapterFactory, TranslationAdapterFactoryOptions } from "./types-BDWiiycu.js";
2
+ import { define$1 as define, lazy$1 as lazy } from "./definition-zTfMFgKw.js";
3
3
  import { ArgSchema, ArgValues, Args, Args as Args$1, parseArgs, resolveArgs } from "args-tokens";
4
4
 
5
5
  //#region src/cli.d.ts
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { DEFAULT_LOCALE$1 as DEFAULT_LOCALE } from "./utils-GlOAgmx0.js";
2
- import { DefaultTranslation } from "./context-B_pkfbdk.js";
1
+ import { DEFAULT_LOCALE$1 as DEFAULT_LOCALE } from "./utils-D41C8Abf.js";
2
+ import { DefaultTranslation } from "./context-COFfMm-R.js";
3
3
  import { define, lazy } from "./definition-DyVBFqB7.js";
4
- import "./renderer-8HgcYJqp.js";
5
- import { cli } from "./cli-DBIMF97F.js";
4
+ import "./renderer-kzo45gaB.js";
5
+ import { cli } from "./cli-BVD3QITm.js";
6
6
  import { parseArgs, resolveArgs } from "args-tokens";
7
7
 
8
8
  export { DEFAULT_LOCALE, DefaultTranslation, cli, define, lazy, parseArgs, resolveArgs };
@@ -1,4 +1,4 @@
1
- import { COMMON_ARGS, create, resolveArgKey, resolveBuiltInKey, resolveExamples } from "./utils-GlOAgmx0.js";
1
+ import { COMMON_ARGS, create, resolveArgKey, resolveBuiltInKey, resolveExamples } from "./utils-D41C8Abf.js";
2
2
 
3
3
  //#region src/renderer/header.ts
4
4
  /**
package/lib/renderer.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommandContext } from "./types-ZXqvU8Ti.js";
1
+ import { CommandContext } from "./types-BDWiiycu.js";
2
2
  import { Args } from "args-tokens";
3
3
 
4
4
  //#region src/renderer/header.d.ts
package/lib/renderer.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./utils-GlOAgmx0.js";
2
- import { renderHeader, renderUsage, renderValidationErrors } from "./renderer-8HgcYJqp.js";
1
+ import "./utils-D41C8Abf.js";
2
+ import { renderHeader, renderUsage, renderValidationErrors } from "./renderer-kzo45gaB.js";
3
3
 
4
4
  export { renderHeader, renderUsage, renderValidationErrors };
@@ -2,7 +2,7 @@ import { ArgToken, ArgValues, Args } from "args-tokens";
2
2
 
3
3
  //#region rolldown:runtime
4
4
  declare namespace constants_d_exports {
5
- export { ARG_PREFIX, BUILT_IN_KEY_SEPARATOR, BUILT_IN_PREFIX, COMMAND_BUILTIN_RESOURCE_KEYS, COMMAND_OPTIONS_DEFAULT, COMMON_ARGS, DEFAULT_LOCALE, NOOP };
5
+ export { ANONYMOUS_COMMAND_NAME, ARG_PREFIX, BUILT_IN_KEY_SEPARATOR, BUILT_IN_PREFIX, COMMAND_BUILTIN_RESOURCE_KEYS, COMMAND_OPTIONS_DEFAULT, COMMON_ARGS, DEFAULT_LOCALE, NOOP };
6
6
  }
7
7
  /**
8
8
  * The default locale string, which format is BCP 47 language tag.
@@ -11,6 +11,7 @@ declare const DEFAULT_LOCALE = "en-US";
11
11
  declare const BUILT_IN_PREFIX = "_";
12
12
  declare const ARG_PREFIX = "arg";
13
13
  declare const BUILT_IN_KEY_SEPARATOR = ":";
14
+ declare const ANONYMOUS_COMMAND_NAME = "(anonymous)";
14
15
  declare const NOOP: () => void;
15
16
  type CommonArgType = {
16
17
  readonly help: {
@@ -6,6 +6,7 @@ const DEFAULT_LOCALE = "en-US";
6
6
  const BUILT_IN_PREFIX = "_";
7
7
  const ARG_PREFIX = "arg";
8
8
  const BUILT_IN_KEY_SEPARATOR = ":";
9
+ const ANONYMOUS_COMMAND_NAME = "(anonymous)";
9
10
  const NOOP = () => {};
10
11
  const COMMON_ARGS = {
11
12
  help: {
@@ -99,4 +100,4 @@ function deepFreeze(obj) {
99
100
  }
100
101
 
101
102
  //#endregion
102
- export { BUILT_IN_PREFIX, COMMAND_OPTIONS_DEFAULT, COMMON_ARGS, DEFAULT_LOCALE as DEFAULT_LOCALE$1, NOOP, create, deepFreeze, isLazyCommand, log, mapResourceWithBuiltinKey, resolveArgKey, resolveBuiltInKey, resolveExamples, resolveLazyCommand };
103
+ export { ANONYMOUS_COMMAND_NAME, BUILT_IN_PREFIX, COMMAND_OPTIONS_DEFAULT, COMMON_ARGS, DEFAULT_LOCALE as DEFAULT_LOCALE$1, NOOP, create, deepFreeze, isLazyCommand, log, mapResourceWithBuiltinKey, resolveArgKey, resolveBuiltInKey, resolveExamples, resolveLazyCommand };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gunshi",
3
3
  "description": "Modern javascript command-line library",
4
- "version": "0.23.0",
4
+ "version": "0.24.0",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -78,22 +78,23 @@
78
78
  }
79
79
  },
80
80
  "dependencies": {
81
- "args-tokens": "^0.17.1"
81
+ "args-tokens": "^0.18.0"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@eslint/markdown": "^6.4.0",
85
85
  "@intlify/core": "next",
86
86
  "@kazupon/eslint-config": "^0.29.0",
87
87
  "@kazupon/prettier-config": "^0.1.1",
88
- "@types/node": "^22.15.3",
89
- "@vitest/eslint-plugin": "^1.1.44",
90
- "bumpp": "^10.1.0",
91
- "deno": "^2.3.1",
92
- "eslint": "^9.26.0",
93
- "eslint-config-prettier": "^10.1.2",
94
- "eslint-import-resolver-typescript": "^4.3.4",
88
+ "@types/node": "^22.15.21",
89
+ "@typescript/native-preview": "7.0.0-dev.20250522.2",
90
+ "@vitest/eslint-plugin": "^1.2.0",
91
+ "bumpp": "^10.1.1",
92
+ "deno": "^2.3.3",
93
+ "eslint": "^9.27.0",
94
+ "eslint-config-prettier": "^10.1.5",
95
+ "eslint-import-resolver-typescript": "^4.3.5",
95
96
  "eslint-plugin-import": "^2.31.0",
96
- "eslint-plugin-jsonc": "^2.20.0",
97
+ "eslint-plugin-jsonc": "^2.20.1",
97
98
  "eslint-plugin-module-interop": "^0.3.1",
98
99
  "eslint-plugin-promise": "^7.2.1",
99
100
  "eslint-plugin-regexp": "^2.7.0",
@@ -103,27 +104,26 @@
103
104
  "eslint-plugin-vue-composable": "^1.0.0",
104
105
  "eslint-plugin-yml": "^1.18.0",
105
106
  "gh-changelogen": "^0.2.8",
106
- "gunshi019": "npm:gunshi@0.22.0",
107
+ "gunshi019": "npm:gunshi@0.23.1",
107
108
  "jsr": "^0.13.4",
108
- "jsr-exports-lint": "^0.2.0",
109
- "knip": "^5.53.0",
109
+ "jsr-exports-lint": "^0.4.0",
110
+ "knip": "^5.57.2",
110
111
  "lint-staged": "^16.0.0",
111
- "messageformat": "4.0.0-11",
112
+ "messageformat": "4.0.0-12",
112
113
  "mitata": "^1.0.34",
113
- "pkg-pr-new": "^0.0.43",
114
+ "pkg-pr-new": "^0.0.50",
114
115
  "prettier": "^3.5.3",
115
116
  "publint": "^0.3.12",
116
- "tsdown": "^0.10.2",
117
+ "tsdown": "^0.12.2",
117
118
  "typedoc": "^0.28.4",
118
119
  "typedoc-plugin-markdown": "^4.6.3",
119
120
  "typedoc-vitepress-theme": "^1.1.2",
120
- "typescript": "^5.8.3",
121
- "typescript-eslint": "^8.31.1",
121
+ "typescript-eslint": "^8.32.1",
122
122
  "vitepress": "^1.6.3",
123
- "vitepress-plugin-group-icons": "^1.5.2",
124
- "vitepress-plugin-llms": "^1.1.3",
125
- "vitest": "^3.1.2",
126
- "vue": "^3.5.13"
123
+ "vitepress-plugin-group-icons": "^1.5.5",
124
+ "vitepress-plugin-llms": "^1.3.3",
125
+ "vitest": "^3.1.4",
126
+ "vue": "^3.5.14"
127
127
  },
128
128
  "prettier": "@kazupon/prettier-config",
129
129
  "lint-staged": {
@@ -167,6 +167,6 @@
167
167
  "test": "vitest --typecheck run",
168
168
  "typecheck": "pnpm run --stream --color \"/^typecheck:/\"",
169
169
  "typecheck:deno": "deno check --all ./src",
170
- "typecheck:tsc": "tsc --noEmit"
170
+ "typecheck:tsc": "tsgo --noEmit"
171
171
  }
172
172
  }