CLI
Run a dependency check, choose which files to update, and configure the CLI.
Run a check
Install Codependence in the project and run it from the directory that contains your policy.
npm install --save-dev codependence
npx codependence init config
npx codependence
Info
A check exits with status 1 when a dependency needs an update. Run --update --dryRun to see the proposed edits.
npx codependence --update --dryRun
npx codependence --update
Configuration options
Put a .codependencerc at the repository root. In this example, the CLI checks the lodash declaration in the web app’s manifest against 4.17.21.
{
"config": {
"web": {
"path": "packages/web/package.json",
"manager": "npm",
"codependencies": [{ "lodash": "4.17.21" }]
}
}
}
| Field | What it controls |
|---|
path, manager | The manifest path relative to the config file and the tool that owns it. Give each manifest a separate entry under config. |
codependencies | A name such as "lodash" looks up a version. An object such as { "lodash": "4.17.21" } sets the required declaration. Node policies also accept ranges and trailing wildcards such as "@team/*". |
mode | verbose checks the listed packages. precise holds them back and checks the rest. Existing configs can use permissive: true for precise mode. |
level | Allow patch, minor, or major updates. The default is major. |
lockfile | Set true to require a standard lockfile, or supply a relative path or list of paths. Each target can override the root setting. |
rootDir, ignore | Set the search directory and exclude files that match the listed globs. |
For glob-based selection, use a targets array with a manager and files on each target. Choose one root form per config file. Existing projects can also keep a policy under codependence in package.json.
Supported managers
Use npm, pnpm, yarn, or bun for Node manifests. Experimental managers include pip, pipenv, poetry, uv, conda, go, rust, docker, github-actions, circleci, helm, kubernetes, kustomize, and terraform. For CircleCI, Helm, Kubernetes, Kustomize, and Terraform, give each dependency an explicit version in verbose mode.
Commands and arguments
codependence
npx codependence
- "lodash": "4.17.20"
+ "lodash": "4.17.21"
- Lodash version — The policy requires 4.17.21. Running the check leaves this edit for you to apply.
With no command, check each configured target. A mismatch makes the check exit with status 1.
init [directory]
npx codependence init packages/web
+ "codependencies": [
+ "lodash"
+ ]
- Changed line — Choosing lodash during local setup adds it to the project policy.
Run guided setup in the current directory or the project directory you pass. Place positional arguments before flags.
init config [directory]
npx codependence init config packages/web
+ "codependencies": [
+ "lodash"
+ ]
- Changed line — Choosing lodash during local setup adds it to the project policy.
Create or update configuration in the selected directory. This form skips installation and workflow generation.
init actions [managers...]
npx codependence init actions npm go
+.github/workflows/codependence-node.yml
+.github/workflows/codependence-go.yml
- Changed line — The Go target gets its own update workflow.
Generate GitHub Actions workflows for configured managers. Pass manager names to limit the generated workflows.
init rc [packages...]
npx codependence init rc react lodash
+{
+ "codependencies": [
+ "react",
+ "lodash"
+ ]
+}
- Changed line — Both package names become entries in the new policy.
Legacy setup. Write the named dependencies to a flat .codependencerc. Omit the names to include dependencies discovered in package.json.
init package [packages...]
npx codependence init package react lodash
+ "codependence": {
+ "codependencies": [
+ "react",
+ "lodash"
+ ]
+ }
- Changed line — The policy lives inside package.json.
Legacy setup. Embed the dependency list under codependence in package.json.
init default [packages...]
npx codependence init default lodash
+{
+ "codependencies": [
+ "lodash"
+ ]
+}
- Changed line — This list tells Codependence which dependencies to check.
Legacy spelling for writing a flat .codependencerc in the current directory.
Select files and policy
--config <path>
npx codependence --config ./config/.codependencerc
- "lodash": "4.17.20"
+ "lodash": "4.17.21"
- Lodash version — The config file passed on the command line supplies this pin.
Read policy from a specific configuration file. Alias -c.
--searchPath <directory>
npx codependence --searchPath ./packages/web
-./
+./packages/web/
- Changed line — Discovery starts in the web workspace.
Start config discovery in the supplied directory. Alias -s.
--target <managers...>
npx codependence --target npm go
npm
go
-docker
- Changed line — Leaving Docker out of the target list skips its check.
Run only the named managers from the repository policy.
--rootDir <directory>
npx codependence --rootDir ./packages/web --files package.json
-./
+./packages/web/
- Changed line — File patterns now resolve from the web project.
Resolve manifest globs from this directory. Alias -r.
--files <patterns...>
npx codependence --files 'packages/*/package.json'
-package.json
packages/web/package.json
packages/api/package.json
- Changed line — The glob selects the two workspace manifests and skips the root manifest.
Check files matching these globs. Quote wildcards to pass them through the shell. Alias -f.
--ignore <patterns...>
npx codependence --files '**/package.json' --ignore '**/fixtures/**' '**/node_modules/**'
packages/web/package.json
-tests/fixtures/package.json
- Changed line — The ignore pattern drops this fixture from the check.
Exclude matching paths from the file search. Alias -i.
--language <language>
npx codependence --language docker --files Dockerfile --codependencies alpine
-package.json
+Dockerfile
- Changed line — This command checks Alpine in the Dockerfile.
Select a provider for a one-off run. Accepted values are nodejs, python, go, rust, docker, github-actions, circleci, helm, kubernetes, kustomize, and terraform. Alias -l.
--codependencies <rules...>
npx codependence --codependencies lodash react
lodash
react
-eslint
- Changed line — Only lodash and react are listed for this check.
Pass one or more dependency names. Store an exact version or range in .codependencerc. Aliases -cds and --cds.
--yarnConfig
npx codependence --yarnConfig --codependencies lodash
-npx codependence --codependencies lodash
+npx codependence --yarnConfig --codependencies lodash
- Changed line — Uses Yarn for the lodash version lookup.
Use Yarn for Node dependency lookups. Alias -y.
--lockfile [policy]
npx codependence --lockfile pnpm-lock.yaml
+pnpm-lock.yaml
- Changed line — A missing pnpm lockfile stops the check before any edit.
Require a standard lockfile with true, supply a repository-relative lockfile path, or allow manifest-only changes with false.
Check and update
--mode <mode>
npx codependence --mode precise --codependencies react
-react
+lodash
- Changed line — In this two-package example, precise mode holds back the listed react dependency and checks lodash.
verbose checks the listed packages. precise holds those packages back while checking the rest. Alias -m.
--permissive
npx codependence --permissive --codependencies react
-react
+lodash
- Changed line — In this two-package example, precise mode holds back the listed react dependency and checks lodash.
Hold the listed packages back and check the rest. This is the compatibility flag for precise mode.
--level <level>
npx codependence --level patch --update --dryRun
- "lodash": "4.17.20"
+ "lodash": "4.17.21"
- Lodash version — The last version number changes. This update qualifies for the patch policy.
Limit eligible updates to patch, minor, or major. The default is major.
--update
npx codependence --update
{
"config": {
"app": {
"path": "package.json",
"manager": "npm",
"codependencies": [{ "lodash": "4.17.21" }]
}
}
}
- "lodash": "4.17.20"
+ "lodash": "4.17.21"
- Lodash version — Writes the pinned patch version to package.json.
Write eligible changes to the selected manifests. Alias -u.
--dryRun
npx codependence --update --dryRun
{
"config": {
"app": {
"path": "package.json",
"manager": "npm",
"codependencies": [{ "lodash": "4.17.21" }]
}
}
}
- "lodash": "4.17.20"
+ "lodash": "4.17.21"
- Lodash version — Proposed edit only. The file still declares 4.17.20.
Preview the edit. A pending update gives exit status 1. Alias --dry-run.
--interactive
npx codependence --update --interactive
- "lodash": "4.17.20"
+ "lodash": "4.17.21"
- Lodash version — Selecting lodash applies this edit.
Choose which eligible updates to apply in the terminal.
--watch
npx codependence --watch
- "lodash": "4.17.21"
+ "lodash": "4.17.20"
- Lodash version — Saving this edit puts lodash below its pin. The next check reports it.
Check immediately, then repeat every 30 seconds until interrupted.
--noCache
npx codependence --noCache --codependencies lodash
-npx codependence --codependencies lodash
+npx codependence --noCache --codependencies lodash
- Changed line — Requests fresh version metadata for lodash.
Fetch version metadata again for packages that need a lookup. Alias --no-cache.
Output and diagnostics
npx codependence --format json
- "status": "up-to-date",
- "exitCode": 0,
+ "status": "outdated",
+ "exitCode": 1,
- Changed line — The CLI reports a mismatch with exit status 1.
Select json, markdown, or table output.
--outputFile <path>
npx codependence --format markdown --outputFile dependencies.md
+# Dependency Status
- Changed line — The Markdown report is written to this file, including when the check finds an outdated dependency.
Save a formatted report to a file. Alias --output-file.
--verbose
npx codependence --verbose
-npx codependence
+npx codependence --verbose
- Changed line — Requests timing and cache statistics for this run.
Include additional details such as runtime and cache statistics. Alias -v.
--debug
npx codependence --debug
-npx codependence
+npx codependence --debug
- Changed line — Enables diagnostics while resolving and checking dependencies.
Enable diagnostic logging for troubleshooting a check.
--quiet
npx codependence --quiet
-npx codependence
+npx codependence --quiet
- Changed line — Suppresses routine output. A mismatch still exits with status 1.
Suppress normal output and show errors. Alias -q.
--silent
npx codependence --silent
-npx codependence
+npx codependence --silent
- Changed line — Runs the same check with routine messages suppressed.
Suppress routine status messages.
--help
npx codependence --help
+Usage: codependence [command] [options]
- Changed line — The help screen starts with the command syntax.
Print command syntax, flags, and examples. Alias -h.
--version [manager=version...]
npx codependence --version
npx codependence init actions go --version go=1.24.5
+ version: 1.24.5
- Changed line — The version assignment pins Go for the generated workflow.
Used alone, print the Codependence version. During setup, pass exact tool versions for generated workflows.
--legend
npx codependence --legend
+Dependency Risk Legend
- Changed line — The legend explains the risk indicators used in the dependency report.
Print the key for dependency risk indicators.
--styleguide
npx codependence --styleguide
+Dependency tables
- Changed line — Choose this entry to preview the dependency table.
Browse the CLI’s terminal components and sample output. Alias -sg.
Setup and workflow options
--enforcement <local|github|both>
npx codependence init --enforcement local
+ "codependencies": [
+ "lodash"
+ ]
- Changed line — Choosing lodash during local setup adds it to the project policy.
Choose where guided setup will enforce the policy.
--repository <owner/name>
npx codependence init --enforcement github --repository example/web
+--repository example/web
- Changed line — Setup uses this repository when it prints token instructions.
Use this GitHub repository when setting up GitHub enforcement and token instructions.
--non-interactive
npx codependence init config --non-interactive --mode verbose --codependencies lodash
+ "codependencies": [
+ "lodash"
+ ]
- Changed line — The command supplies lodash, so setup can write the policy without prompting.
Supply setup choices as flags. This example writes a config that checks lodash without prompting.
--skip-install
npx codependence init --enforcement local --skip-install
+ "codependencies": [
+ "lodash"
+ ]
- Changed line — Setup writes the local policy and skips installing the CLI.
Skip installing the local CLI during guided setup.
--post-update-command <name=command...>
npx codependence init actions go --post-update-command 'go=go mod tidy'
+ post-update-command: 'go mod tidy'
- Changed line — The generated workflow runs go mod tidy after applying updates.
Set the command that refreshes a manager’s lockfile in a generated workflow.
--schedule <area=cron...>
npx codependence init actions go --schedule 'go=30 7 * * 5'
- - cron: "0 9 * * 1"
+ - cron: "30 7 * * 5"
- Changed line — The workflow now runs on Fridays at 07:30 UTC.
Set a UTC cron schedule for node, python, go, rust, docker, or infrastructure. This schedules Go updates for Fridays at 07:30 UTC.
--token-secret <name>
npx codependence init actions --token-secret DEPENDENCY_PR_TOKEN
- token: ${{ secrets.CODEPENDENCE_TOKEN }}
+ token: ${{ secrets.DEPENDENCY_PR_TOKEN }}
- Changed line — The workflow reads the token from this repository secret.
Reference a repository secret by name in generated workflows.
--force
npx codependence init actions go --force
- - cron: "30 7 * * 5"
+ - cron: "0 9 * * 1"
- Changed line — Regeneration replaces a locally edited schedule with the generator default.
Warning
--force replaces existing generated workflow files. Review any local edits before regenerating them.
Test options
--isTestingCLI
npx codependence --files package.json --isTestingCLI
+ files: [ 'package.json' ]
- Changed line — Prints the parsed file selection and exits before running a check.
Print the merged CLI options and return before running the check. Alias -t.
--isTesting
npx codependence --update --isTesting --codependencies lodash
-npx codependence --update
+npx codependence --update --isTesting
- Changed line — Runs the writer in test mode. The fixture stays on its original version.
Use the test execution path, which suppresses manifest writes and changes version lookup behavior. For a normal preview, use --dryRun.