Description
Extract a command name and path from restricted package-name shorthand.
Development metadata distinguishes source-map deltas, package-person formatting, executable shorthand and Git object modes. A string with package-like syntax need not satisfy the complete registry or package contract. Formatting a person, extracting a command name or mapping a mode does not inspect files or modify a repository.
Extract a command name and path from restricted package-name shorthand.
When to use this tool
Use Package JSON Bin Shorthand Normalizer when you already have packageName, binPath and need to extract a command name and path from restricted package-name shorthand.
How to use the tool and how it works
- Enter packageName, binPath. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read commandName, binPath. Use the output convention below.
Require a lowercase ASCII alphanumeric-leading name with allowed letters/digits/dot/underscore/hyphen, optionally @scope/name, and nonempty binPath. Command is the unscoped final name; preserve the path.1
A single executable can use bin shorthand associated with the package name. Extracting a command and path does not install that executable or validate the full package contract.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| packageName | Package Name | Required. Text; maximum UTF-16 length 8192. |
| binPath | Bin Path | Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| commandName | Unscoped package-name component under the restricted grammar; no executable is created. | Required. Text; maximum UTF-16 length 8192. |
| binPath | Bin Path | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"packageName": "@scope/cli-tool",
"binPath": "./cli.js"
},
"output": {
"commandName": "cli-tool",
"binPath": "./cli.js"
}
} Limitations and assumptions
- The grammar is not full npm package-name validation. No path, executable, file, bin object, installation or command collision is checked.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Validate the full source map, package metadata or Git object when conformance matters. Use the relevant complete format and actual file/object information; a local delta or grammar check does not establish a valid package, executable, source mapping or tree entry.
References
Similar or alternative tools
- Package JSON Person String Fields
Format supplied package-person fields as a name, email and URL string.
- Git Tree Mode Object Kind
Map one recognized Git tree mode to its object kind.