@produck/agent-toolkit
v0.9.2
Published
Central CLI toolkit for organization AI execution workflows
Readme
@produck/agent-toolkit
Central CLI toolkit for organization-level AI execution workflows.
First-time bootstrap (downstream repositories)
For a new or existing downstream repository that has not yet applied the organization baseline, run:
npm create @produck/agent-toolkit@latestThis command installs @produck/create-agent-toolkit and runs
enforce-node-baseline in the current directory. No prior installation is
required — npm handles the download automatically.
What it does (in order):
- Syncs organization AI instruction files into
.github/instructions/produck/ - Runs preflight to verify required files and directories
- Syncs root
produck:formatscript and initializes.prettierrc - Syncs root
produck:lintscript, initializes/patcheseslint.config.mjs, and ensures@produck/eslint-rules - Syncs root shared governance (
produck:baseline,produck:coverage,produck:commit:check) and syncs shared pinned devDependencies (husky,lerna,@produck/agent-toolkit) - Deploys root
.c8rc.jsonand rootc8devDependency Note: Theproduck:coveragescript in subpackages is for local and AI development use only. It is NOT enforced by organization CI or.c8rc.json. Only the root workspace (monorepo root) is subject to org-level coverage enforcement and.c8rc.json. - Deploys root
.gitattributes - Deploys the pinned
produck:coveragescript andc8devDependency to each workspace package, and enforcesscripts.test(generates a defaulttestscript when missing). - Deploys
.husky/pre-commitand.husky/commit-msg
After running, add the persistent enforcement entry to the repository
package.json:
"produck:baseline": "npm exec --package=@produck/agent-toolkit@latest -- agent-toolkit enforce-node-baseline --cwd ."Then future enforcement runs via:
npm run produck:baselineCommands
- agent-toolkit enforce-node-baseline
- agent-toolkit preflight
- agent-toolkit run-capture
- agent-toolkit summarize-log
- agent-toolkit sync-coverage
- agent-toolkit sync-git
- agent-toolkit sync-format
- agent-toolkit sync-install
- agent-toolkit sync-lint
- agent-toolkit sync-publish
- agent-toolkit validate-commit-msg
- agent-toolkit sync-instructions
Examples
Run default mandatory baseline flow in downstream repository root:
npm exec -- agent-toolkitEquivalent explicit form:
npm exec -- agent-toolkit enforce-node-baseline --cwd .enforce-node-baseline runs nine steps in fixed order and stops at the first
failure:
preflight— verify required files and directories existsync-instructions— distribute organization AI instruction files into.github/instructions/produck/sync-editorconfig— deploy organization.editorconfigsync-format— deploy organization format gate script (produck:format) and initialize.prettierrcsync-lint— deploy organization lint gate script (produck:lint), initialize/patcheslint.config.mjs, and ensure@produck/eslint-rulesintegrationsync-install— deploy rootscripts.produck:install(npm -v && npm install) and remove legacyscripts.deps:installsync-git— deploy root.gitattributes, sync.husky/pre-commit/.husky/commit-msg, and enforce shared root scripts (produck:baseline,produck:commit:check) plus shared pinned root devDependencies (husky,lerna,@produck/agent-toolkit)sync-coverage— deploy rootscripts.produck:coverage,.c8rc.json, and rootc8devDependency, then deploy pinnedproduck:coveragescript andc8devDependency into each workspace package, and ensure each workspace package hasscripts.test(auto-generate a default value when missing)sync-publish— create defaultlerna.jsonwhen missing and deploy rootscripts.produck:publish:checkplusscripts.produck:publish
Add to downstream repository root package.json for one-command enforcement:
"produck:baseline": "npm exec --package=@produck/agent-toolkit@latest -- agent-toolkit enforce-node-baseline --cwd ."Then run:
npm run produck:baselineDry-run to preview changes without writing files:
npm exec -- agent-toolkit enforce-node-baseline --cwd . --dry-runCheck-only mode to validate without writing:
npm exec -- agent-toolkit enforce-node-baseline --cwd . --checkValidate monorepo root package.json scripts and workspace structure:
npm exec -- agent-toolkit preflight --cwd . --check-workspace-package-json package.jsonRun preflight with required-file and directory guards:
npm exec -- agent-toolkit preflight --cwd . --require package.json --ensure-dir logsCapture long output safely:
npm exec -- agent-toolkit run-capture --cwd . --cmd "npm run test" --out logs/test.logSummarize captured output:
npm exec -- agent-toolkit summarize-log --file logs/test.log --match "FAIL|ERROR"Deploy organization coverage script and pinned local c8 devDependency to workspace packages:
npm exec -- agent-toolkit sync-coverage --cwd .This command also enforces scripts.test in each workspace package.
If missing, it generates:
node -e "console.log('No tests configured')"Note: The produck:coverage script in subpackages is for local and AI development use only. It is NOT enforced by organization CI or .c8rc.json. Only the root workspace (monorepo root) is subject to org-level coverage enforcement and .c8rc.json.
Deploy organization format config and script baseline to repository root:
npm exec -- agent-toolkit sync-format --cwd .This command manages scripts.produck:format and .prettierrc only.
The managed produck:format script always writes formatting fixes via
Prettier, so a separate root format script is not required.
Deploy organization lint config and script baseline to repository root:
npm exec -- agent-toolkit sync-lint --cwd .This command manages scripts.produck:lint, eslint.config.mjs, and
devDependencies.@produck/eslint-rules. If eslint.config.mjs exists without
@produck/eslint-rules, it appends Produck integration to the exported config
array.
Deploy root and workspace coverage config plus root c8 devDependency:
npm exec -- agent-toolkit sync-coverage --cwd .This command manages root scripts.produck:coverage, root .c8rc.json, pins
root devDependencies.c8, and updates workspace package produck:coverage,
test, and devDependencies.c8. The generated .c8rc.json uses src/** and
extension/** as the default include scope, excludes common build and
dependency directories, and enables check-coverage with 99.5 thresholds for
branches, functions, lines, and statements.
Deploy root git attributes baseline:
npm exec -- agent-toolkit sync-git --cwd .This command manages root .gitattributes, .husky/pre-commit,
.husky/commit-msg, scripts.produck:baseline,
scripts.produck:commit:check, and shared pinned root devDependencies
husky, lerna, and @produck/agent-toolkit.
Deploy root install script baseline:
npm exec -- agent-toolkit sync-install --cwd .This command manages scripts.produck:install with value
npm -v && npm install and removes legacy scripts.deps:install.
Deploy root publish script baseline:
npm exec -- agent-toolkit sync-publish --cwd .This command manages scripts.produck:publish:check and
scripts.produck:publish. If lerna.json is absent, sync mode creates a
default file before writing the scripts. When scripts.publish already
exists, scripts.produck:publish delegates to it after the shared checks;
otherwise it falls back to lerna publish.
Validate commit message format:
npm exec -- agent-toolkit validate-commit-msg --file .git/COMMIT_EDITMSGManual per-repository instruction distribution (write .github/instructions/produck/*.instructions.md):
npm exec -- agent-toolkit sync-instructions --cwd .Legacy repository bootstrap behavior:
- If
.github/copilot-instructions.mdis missing, sync-instructions initializes it. - The initialized file guides repository owners to keep organization baseline in
.github/instructions/produck/*.instructions.mdand put local-only rules in.github/copilot-instructions.md.
Use organization source directory instead of built-in assets:
npm exec -- agent-toolkit sync-instructions --cwd . --source path/to/org/.github/distribution/produck --force --pruneBuilt-in command-local resource locations (for review and updates):
bin/command/*/help.txtbin/command/sync-instructions/user-space-bootstrap.md
Publish-time generated instruction assets:
publish-assets/instructions/produck/*.instructions.md- Generated from
.github/distribution/produck/*.instructions.mdviaprepack - Included in npm package, ignored in git working tree
Downstream source maintenance in policy repository:
- Maintain source files directly under
.github/distribution/produck/*.instructions.md
Organization-only instruction source (not published):
.github/instructions/produck/*.instructions.md
Local verification
verify is an optional package-level health check and is not a commit gate.
Use repository style gates first, then run package checks when needed.
From repository root:
npm run produck:format
npm run produck:lint
npm --workspace @produck/agent-toolkit run test
npm --workspace @produck/agent-toolkit run pack:check
# optional health check
npm --workspace @produck/agent-toolkit run verifyPublishing
Publishing is centralized at workspace root via lerna, not via package-level release scripts.
From monorepo root (produck/.github):
npm run produck:publish:check
npm run publish:dry-run
npm run publishNotes:
publish:dry-runvalidates package contents by runningnpm pack --dry-runacross non-private workspace packages.publishruns lerna publish flow from workspace root.
GitHub workflow
Repository includes manual workflow:
- .github/workflows/publish-agent-toolkit.yml
Workflow behavior:
- Runs test and pack:check for
@produck/agent-toolkit. - Does not publish to npm.
- Used as release gate before workspace-level publish.
Release policy:
- Central package is installed locally in downstream repositories at a fixed
version managed by
agent-toolkit sync-git. - Run
produck:publish:checkfirst. - Then run workspace
publish:dry-runbeforepublish. - Keep rollback option by republishing previous stable version if needed.
Rollback quick steps:
- Check latest published version:
npm view @produck/agent-toolkit version - Fix source and rerun workspace publish flow with a new version.
- Push commit and tags.
