Imported from AliSafari-IT/password-checklist (
AGENTS.md). Install upstream withnpx skills add AliSafari-IT/password-checklist. Copyright stays with the author.
Agent Guide — @asafarim/password-checklist
React + TypeScript package: a PasswordChecklist component plus a headless
usePasswordValidation hook for real-time password-strength rules. pnpm workspace:
library at root, Next.js 16 + Tailwind demo in demo/ (consumes the lib via workspace:*).
Layout
src/is flat (notsrc/components/<Name>/):PasswordChecklist.tsx— the componentusePasswordValidation.ts— headless validation hookrules.ts,common-passwords.ts,types.ts— rule engine, data, typesstyles.css,default.css— shipped stylesheets (exported as./styles.css,./default.css)index.ts— public API barrel; new exports go here
demo/— Next.js app router demo, static export (output: "export"→demo/out)
Commands
pnpm run build— tsup →dist/(ESM + CJS + d.ts + sourcemaps; copiesstyles.css/default.cssinto dist viaonSuccesshook)pnpm run typecheck—tsc --noEmitcd demo && pnpm build— Next.js static export build (build the lib first)
Conventions
- React 18+ is a peer dep; keep the package dependency-light
- Fully typed public API — export prop/config/result types from
types.tsviaindex.ts - Dual stylesheets:
default.css(minimal) andstyles.css(themed); keep both in sync - Don't hardcode README image URLs — the publish workflow rewrites
demo/public/image paths to raw.githubusercontent.com URLs pinned to the release commit SHA
Release
Publish trigger is push to main/master with a version bump — NOT tags:
- Bump
versioninpackage.json(semver) - Add a
CHANGELOG.mdentry (Keep a Changelog) pnpm run buildandcd demo && pnpm buildgreen- Commit → push
main .github/workflows/publish.ymlcomparespackage.jsonversion to npm and publishes only if it differs;.github/workflows/deploy-gh-pages.ymldeploysdemo/outviaactions/deploy-pageson every main push- Optionally
gh release create v{x.y.z} -R AliSafari-IT/password-checklist --latest(no git tags exist yet — creating them going forward improves the releases page)
Gotchas
- gh CLI authenticated as
AliSafari-IT— pass-R AliSafari-IT/password-checklist - npm website lags the registry — verify with
npm view @asafarim/password-checklist dist-tags, not npmjs.com - npm scheduled maintenance can fail publishes with 503; re-push or rerun the failed
workflow job after the window ends (
gh run rerun <id> --failed) demo/next-env.d.tsis Next.js-generated and shows as modified locally — don't commit it- Unlike progress-bars, this repo has no git ownership issue — plain
gitworks