Brought to you by Allons-y Studio

@allons-y/opx

Type Aliases

Type Alias Description
CleanupSuggestion Something a plugin says the project no longer needs now that the plugin is enabled.
Detector The contract every opx plugin implements: decide when it applies, then run.
DetectorContext What a detector is given: the project, its settings, and how to report.
DetectorDescription A human-readable description of what a detector does.
DetectorId A detector's package id, such as @allons-y/opx-lint-js.
DiffEntry How one detector relates to the project, config, and state.
DiffResult The outcome of diff.
DynamicTask A task whose plugins are chosen per project, so config lists them by short name.
DynamicTaskConfig The config keys for dynamic tasks: each maps a plugin short name to true, false, or that plugin's settings.
Environment Environment variables by name, without depending on the NodeJS global from @types/node.
HookInstallResult The outcome of installPostCommitHook.
InstallOptions Options for installCommand.
LoadedPlugin A plugin package that loaded successfully.
LoadOptions Options for loadPlugins.
Logger Leveled logging that detectors write through instead of using console directly.
OpxConfig The contents of .opx/config.json.
OpxState The contents of .opx/state.json, a local cache that opx can rebuild.
OpxStateDeferral A "later" answer to a plugin suggestion, remembered for one branch.
PackageJson The parts of a package.json that opx reads. Other fields pass through untyped.
PackageManager The package managers opx can detect and install with.
PackageManagerInfo What inspectPackageManager found.
ResolvedTool Where a tool was found.
StaticTask A task with no plugin choice, so config turns it on or off with a boolean.
StaticTaskConfig The config keys for static tasks, each a boolean.
SuggestionCommand A command a person can run to act on a suggestion. opx prints it and never runs it.

Functions

Function Description
applyDeferral Record a "later" answer for a plugin on a branch.
configPath Locate .opx/config.json.
createConsoleLogger Create a Logger that writes to the console.
defaultConfig Create the starter config: no plugins enabled, and release and test off.
defaultSkipUntilDate Compute a default skipUntilDate for a "later" choice: today (the deferral expires when the calendar day rolls over). The diff function treats a deferral as active while skipUntilDate >= today, so storing today suppresses for the rest of the day on the current branch.
defaultState Create an empty state with no deferrals.
detectPackageManager Detect the host project's package manager. See inspectPackageManager for the order and for how sure the answer is.
diff Reconcile detector matches against config + state. - enabled: the detector's short name is present in config.lint. - deferred: state has a deferral whose branch matches AND date hasn't expired. - needsPrompt: detector matches files, is not enabled, and not currently deferred.
enabledNames Names of the plugins switched on in a task map. A plugin set to false is present in the config but disabled, so it is excluded.
ensureGitignored Add an entry to .gitignore unless it is already listed.
ensureOpxIgnored Ignore opx's local files while keeping .opx/config.json committable.
filterPathsByExtension Filter CLI path arguments to those a detector should handle, given the file extensions it owns.
inspectPackageManager Work out the host project's package manager, and how sure that is.
installCommand Build the command that installs packages with a package manager.
installPostCommitHook Install the husky post-commit hook that nudges the user about new file types after each commit. Runs in a backgrounded subshell and always exits 0, so it never blocks the commit.
isDeferred Whether a plugin's suggestion is currently deferred: a "later" answer recorded for this branch that has not yet expired. A deferral stays active through skipUntilDate inclusive, and never applies on another branch.
isValidPluginName Whether a package name follows the opx plugin naming convention: @allons-y/opx-*, opx-plugin-*, or @scope/opx-plugin-*.
loadPlugins Dynamically load plugin packages declared in the concern array. Enforces: 1. The fully-qualified package id matches the official/community naming pattern. 2. The package is present in the host's deps/devDeps (warn + skip otherwise).
normalizeDetectorId Normalize a detector reference (short or full) to a canonical package id by checking the host's dependencies. Returns null if no candidate is installed.
readConfig Read .opx/config.json, filling gaps with defaults.
readState Read .opx/state.json. The file is a disposable cache, so a missing or unreadable file gives an empty state rather than an error.
resolvePluginPackageName Resolve a short slug or fully-qualified package name to a candidate ordered list of package ids to try. The first one that exists in the host's deps wins.
resolveTool Try to resolve a tool (e.g. "eslint") from the host project first; fall back to the bundled copy that ships with the calling detector package.
statePath Locate .opx/state.json.
uninstallCommand Build the command that removes packages with a package manager.
writeConfig Write .opx/config.json, creating the folder if needed. Empty task maps are left out.
writeState Write .opx/state.json, creating the folder if needed.