
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
process-type
Advanced tools
process-type
analyzes the process.argv
array and provides support for:
• flags (eg: -g
or --global
)
• arguments (eg: the arvgsus
in npm install process-type
)
• actions (eg: the install
in npm install process-type
)
• documentation (eg: the special --help
flag displays examples and descriptions)
The exported types are Process
, Process.Action
, and Process.Flag
.
var Process = require("process-type")
Types
This is the terminal input:
$ node path/to/npm/bin.js install --global --nodedir path/to/node --force process-type
This is what path/to/npm/bin.js
looks like:
process.help = ["The package manager for Node."]
process.flags = {
version: {
short: "v",
args: 0,
help: "Echoes the current version of NPM."
}
}
process.actions = {
install: {
short: "i",
help: "Install the dependencies in the local node_modules folder.",
flag: {
global: {
short: "g",
args: 0,
help: "Installs the given dependencies into the global node_modules folder."
}
}
}
}
Process = require("process-type")
Process(process).parse()
These are the new properties available after parse()
is called:
process.script = [
"node",
"path/to/npm/bin.js"
]
process.actions = [
"npm",
"install"
]
process.flags = {
global: true,
nodedir: "path/to/node",
force: true
}
process.args = [
"process-type"
]
npm i --save process-type
To run the tests:
grunt test
Arguments: (ArrayOf(String)
or Undefined
)
Once you wrap your process
object with Process()
, call process.parse()
and you'll have full access to the properties listed here.
Normally, you won't pass an array of strings to this. Instead, the process.argv
array will be used.
Before you call this, make sure you have process.flags
, process.actions
, process.action
, and process.help
all set to your liking.
Type: String
or ArrayOf(String)
A description of your script.
This is shown when the --help
flag is passed.
If an array of strings is passed, it is joined with "\n"
.
Type: Object
Before process.parse()
:
The valid flag names and their option objects.
After process.parse()
:
The passed flag names and their arguments.
Learn more about Process.Flag.
Type: Object
Before process.parse()
:
The valid action names and their option objects.
After process.parse()
:
No value.
Learn more about Process.Action.
Type: Object
Contains the values of process.flags
and process.actions
before process.parse()
was called.
Type: ArrayOf(String)
Type: ArrayOf(String)
The command used to run this script. (eg: node path/to/my-module/index.js
)
Note: You'll never have to construct one of these on your own. Instead, use process.options.addAction
or define process.actions
before process.parse()
.
Type: String
The ID that must be specified to use this Action
.
Type: ArrayOf(String)
Describes what this Action
is used for.
Type: String
Describes how to use this Action
.
Type: Function
Called when the Action
is specified in the command.
This option is essential when separating Action
s into their own modules.
Type: Object
The actions that can be specified after this Action
.
Type: Object
The flags that can be specified with this Action
.
Note: This is implemented, but not yet documented.
Note: This is not yet implemented.
Note: This is not yet implemented.
Note: You'll never have to construct one of these on your own. Instead, use process.options.addFlag
or define process.flags
before process.parse()
.
Type: String
The ID that must be specified to use this Flag
.
Type: String
Maps a single-letter flag (eg: -f
) to a many-letter flag (eg: --force
).
Type: ArrayOf(String)
Describes what this Flag
is used for.
Type: String
Describes how to use this Flag
.
Type: Function
Returns the default arguments for this Flag
.
Called when this Flag
has no specified arguments.
Can be undefined
.
Type: Function
Verifies whether this Flag
's arguments are valid by returning true
or false
.
Can be undefined
.
Note: Called before the default value is applied to the Flag
.
Type: Function
Mutates this Flag
's arguments and returns a new value.
Can be undefined
.
Note: Called after the default value is applied to this Flag
.
Type: Number
The maximum number of arguments possibly associated with this Flag
.
FAQs
A simple, configurable Process type
We found that process-type demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.