@carecard/auth-util 3.1.12 → 3.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.agents/config.toml +2 -0
  2. package/.agents/skills/carecard-workspace-standards/SKILL.md +388 -0
  3. package/.agents/skills/carecard-workspace-standards/agents/openai.yaml +4 -0
  4. package/.agents/skills/github-pr-create-update/SKILL.md +188 -0
  5. package/.agents/skills/github-pr-create-update/agents/openai.yaml +5 -0
  6. package/.agents/skills/github-pr-merge-cleanup/SKILL.md +175 -0
  7. package/.agents/skills/github-pr-merge-cleanup/agents/openai.yaml +5 -0
  8. package/.agents/skills/pkg-auth-util-auth-crypto-library/SKILL.md +236 -0
  9. package/.agents/skills/pkg-auth-util-auth-crypto-library/agents/openai.yaml +4 -0
  10. package/.agents/skills/software-design-patterns-and-clean-code/SKILL.md +73 -0
  11. package/.codex/config.toml +2 -0
  12. package/.prettierignore +17 -0
  13. package/.prettierrc.cjs +32 -0
  14. package/.prettierrc.js +12 -0
  15. package/eslint.config.mjs +14 -0
  16. package/index.d.ts +197 -151
  17. package/index.js +29 -28
  18. package/jest.config.js +16 -0
  19. package/lib/jwtUtilAuth.js +152 -86
  20. package/lib/keyGen.js +18 -22
  21. package/lib/pwdUtilAuth.js +25 -25
  22. package/lib/stringUtilAuth.js +43 -49
  23. package/package.json +24 -12
  24. package/readme.md +24 -5
  25. package/scripts/rename-cjs.js +13 -0
  26. package/src/cryptoUtilAuth.ts +111 -0
  27. package/src/index.ts +6 -0
  28. package/src/jwtUtilAuth.ts +85 -0
  29. package/src/keyGen.ts +14 -0
  30. package/src/pwdUtilAuth.ts +78 -0
  31. package/src/strEncryptUtil.ts +159 -0
  32. package/src/stringUtilAuth.ts +102 -0
  33. package/tests/cryptoUtilAuth.test.ts +97 -0
  34. package/tests/index.test.ts +157 -0
  35. package/tests/indexStringUtilAuth.test.ts +95 -0
  36. package/tests/jwtUtilAuth.test.ts +33 -0
  37. package/tests/keyGen.test.ts +26 -0
  38. package/tests/keys/keys.ts +24 -0
  39. package/tests/pwdUtilAuth.test.ts +40 -0
  40. package/tsconfig.base.json +14 -0
  41. package/tsconfig.cjs.json +7 -0
  42. package/tsconfig.esm.json +7 -0
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: github-pr-merge-cleanup
3
+ description: Use only when the user explicitly asks for remote Git or GitHub PR work: reviewing remote mergeability, validating, merging, closing, deleting, or cleaning up a pull request branch.
4
+ ---
5
+
6
+ # Pull Request Merge Close
7
+
8
+ ## Purpose
9
+
10
+ Only after the user explicitly asks for remote Git or GitHub PR work, review, validate, merge, close, delete branch, and clean local state for a GitHub pull request targeting origin/development.
11
+
12
+ ## When To Use
13
+
14
+ - Use only when the user explicitly asks to review mergeability, validate, merge, close, or clean up a GitHub pull request branch.
15
+
16
+ ## When Not To Use
17
+
18
+ - Do not use for creating a new pull request; use the PR create/update skill.
19
+ - Do not use when the user only asks for local code changes without PR merge work.
20
+
21
+ ## Remote Git Operations Guardrail
22
+
23
+ Do not run remote Git or GitHub operations unless the current user request explicitly asks for that remote operation. This includes `git fetch`, `git pull`, `git push`, `git push --delete`, remote branch cleanup, GitHub API calls, and any `gh pr` command that creates, updates, readies, merges, closes, or cleans up a pull request. Do not infer permission from branch names, validation needs, prior workflow habits, or convenience; ask first when remote state would be useful but was not requested.
24
+
25
+ ## Relevant Files And Directories
26
+
27
+ - Git branch state in this repository
28
+ - GitHub pull requests viewed with `gh`
29
+ - repository validation commands and `.husky` scripts
30
+
31
+ ## Coding Principles
32
+
33
+ - Preserve the repository structure, naming style, module system, and local helper patterns.
34
+ - Prefer readable, maintainable code with meaningful function, variable, file, and test names.
35
+ - Avoid new dependencies unless the existing stack cannot reasonably solve the task and the user confirms the tradeoff.
36
+
37
+ ## Testing Expectations
38
+
39
+ - Run repository validation before PR creation or merge when code behavior changed.
40
+ - Confirm the branch is clean except intended changes before finishing.
41
+
42
+ ## Safety Constraints
43
+
44
+ - Do not edit generated output, dependency folders, logs, coverage, dist, or build artifacts unless the task explicitly requires it.
45
+ - Do not revert or overwrite user changes; stage only files related to the requested skill or instruction update.
46
+ - Never suppress errors, lint failures, type failures, security failures, or failing tests; fix the underlying issue or report the blocker.
47
+
48
+ ## Commit Continuation Rule
49
+
50
+ Do not amend existing commits unless the user explicitly asks for an amend. If
51
+ hook, formatter, documentation, skill, validation, or review follow-up changes
52
+ appear after a commit, stage only the intended files and make a new commit with
53
+ a clear message.
54
+
55
+ ## Scope
56
+
57
+ Use this skill from the root of the repository that owns the pull request. The
58
+ repository must use GitHub CLI, have a remote base branch, and have the target
59
+ branch available locally or on `origin`.
60
+
61
+ Default terms:
62
+
63
+ - Base branch: `development` when `origin/development` exists, otherwise the
64
+ repository default branch.
65
+ - Target branch: the current branch unless the user names another branch.
66
+ - Pull request: the open PR whose head is the target branch and whose base is
67
+ the base branch.
68
+
69
+ Do not continue automatically when:
70
+
71
+ - `gh auth status` fails.
72
+ - The target branch is detached or is the base branch.
73
+ - The working tree has uncommitted changes that are not part of the requested
74
+ PR cleanup.
75
+ - No open PR exists for the target branch.
76
+ - A rebase or validation fix would require behavior changes instead of coding
77
+ criteria cleanup.
78
+
79
+ ## Workflow
80
+
81
+ 1. Capture the base branch, target branch, PR number, and protection state:
82
+
83
+ ```sh
84
+ gh auth status
85
+ base="development"
86
+ git ls-remote --exit-code --heads origin development >/dev/null 2>&1 || \
87
+ base="$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')"
88
+ target_branch="$(git branch --show-current)"
89
+ test -n "$target_branch"
90
+ test "$target_branch" != "$base"
91
+ git status --short
92
+ git fetch origin "$base" --prune
93
+ pr_number="$(gh pr list --head "$target_branch" --base "$base" --state open --json number --jq '.[0].number // empty')"
94
+ test -n "$pr_number"
95
+ protected="$(gh api "repos/{owner}/{repo}/branches/$target_branch" --jq '.protected' 2>/dev/null || echo false)"
96
+ ```
97
+
98
+ If the PR head branch is not local, create a local branch from the remote
99
+ head before continuing.
100
+
101
+ 2. Check mergeability before changing history:
102
+
103
+ ```sh
104
+ gh pr view "$pr_number" --json mergeStateStatus,mergeable,headRefName,baseRefName
105
+ if git merge-tree --write-tree HEAD "origin/$base" >/tmp/pull-request-merge-close-merge-tree.out
106
+ then
107
+ merge_conflict_detected=false
108
+ else
109
+ merge_conflict_detected=true
110
+ fi
111
+ ```
112
+
113
+ 3. If a merge conflict is detected, rebase the target branch on the fresh base
114
+ branch. Abort and stop if the rebase conflicts:
115
+
116
+ ```sh
117
+ if [ "$merge_conflict_detected" = true ]; then
118
+ if git rebase "origin/$base"; then
119
+ git push --force-with-lease -u origin "$target_branch"
120
+ else
121
+ git rebase --abort
122
+ echo "Rebase conflicted; aborted without merging."
123
+ exit 1
124
+ fi
125
+ fi
126
+ ```
127
+
128
+ Do not resolve rebase conflicts unless the user explicitly asks.
129
+
130
+ 4. Load and apply all relevant repository skills before merging:
131
+ - Read the repository's `.agents/skills/**/SKILL.md` files that apply to the
132
+ changed code, plus shared workspace standards when present.
133
+ - Compare the target branch against the base with
134
+ `git diff --stat "origin/$base...HEAD"` and inspect changed files.
135
+ - Check whether the target branch satisfies the applicable coding,
136
+ architecture, validation, security, and style criteria from those skills.
137
+ - Run the validation commands required by the skills and repository hooks.
138
+ - If criteria are not met and the fix does not change functionality, make the
139
+ minimal cleanup, stage only intended files, commit to the target branch,
140
+ and push the target branch.
141
+ - If meeting the criteria would change behavior, stop and report the gap.
142
+
143
+ 5. Confirm the PR is still mergeable after validation changes:
144
+
145
+ ```sh
146
+ git fetch origin "$base" --prune
147
+ git merge-tree --write-tree HEAD "origin/$base" >/tmp/pull-request-merge-close-final-merge-tree.out
148
+ gh pr checks "$pr_number"
149
+ ```
150
+
151
+ 6. Merge the PR with GitHub CLI. Delete the remote target branch only when it is
152
+ not protected:
153
+
154
+ ```sh
155
+ if [ "$protected" = true ]; then
156
+ gh pr merge "$pr_number" --squash --admin
157
+ else
158
+ gh pr merge "$pr_number" --squash --admin --delete-branch
159
+ fi
160
+ ```
161
+
162
+ 7. Clean up the local repository after merge:
163
+
164
+ ```sh
165
+ git fetch origin "$base" --prune
166
+ git switch "$base"
167
+ git pull --ff-only origin "$base"
168
+ git branch -d "$target_branch" || git branch -D "$target_branch"
169
+ git ls-remote --heads origin "$target_branch"
170
+ ```
171
+
172
+ 8. Final response should include the PR URL, whether a rebase was performed,
173
+ what validation and skill checks ran, whether any cleanup commit was added,
174
+ whether the remote target branch was deleted or protected, and whether local
175
+ development is up to date.
@@ -0,0 +1,5 @@
1
+ interface:
2
+ display_name: 'GitHub PR Merge And Cleanup'
3
+ short_description: 'Use only when the user explicitly asks for remote Git or GitHub PR work: merge, close, delete, or clean up a PR branch.'
4
+ brand_color: '#0F766E'
5
+ default_prompt: 'Use $github-pr-merge-cleanup when this task matches the skill scope.'
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: pkg-auth-util-auth-crypto-library
3
+ description: Use when changing pkg-auth-util auth, password, JWT, crypto, key, exported API, types, or package validation behavior.
4
+ ---
5
+
6
+ # Package Auth Util
7
+
8
+ ## Purpose
9
+
10
+ CareCard auth utility package for JWT creation/verification primitives, password hashing, crypto helpers, key generation, and tests.
11
+
12
+ ## When To Use
13
+
14
+ - Use when changing pkg-auth-util auth, password, JWT, crypto, key, exported API, types, or package validation behavior.
15
+ - Pair with `carecard-workspace-standards` when the task affects shared CareCard conventions or cross-repository contracts.
16
+
17
+ ## When Not To Use
18
+
19
+ - Do not use for service-local behavior that should remain inside one API or app.
20
+ - Do not change package public APIs without updating consumers and compatibility tests.
21
+
22
+ ## Relevant Files And Directories
23
+
24
+ - package entry files
25
+ - `src` when present
26
+ - `test`
27
+ - `package.json`
28
+ - `package-lock.json`
29
+ - `.husky`
30
+
31
+ ## Coding Principles
32
+
33
+ - Preserve the repository structure, naming style, module system, and local helper patterns.
34
+ - Prefer readable, maintainable code with meaningful function, variable, file, and test names.
35
+ - Avoid new dependencies unless the existing stack cannot reasonably solve the task and the user confirms the tradeoff.
36
+ - Keep public exports stable and update CommonJS, ESM, TypeScript declaration, and compatibility surfaces together when present.
37
+
38
+ ## Testing Expectations
39
+
40
+ - Write or update package tests before behavior or public API changes.
41
+ - Include type/export compatibility tests where the package already has them.
42
+ - Run package test, lint, type, and Husky validation commands required by the changed area.
43
+
44
+ ## Safety Constraints
45
+
46
+ - Do not edit generated output, dependency folders, logs, coverage, dist, or build artifacts unless the task explicitly requires it.
47
+ - Do not revert or overwrite user changes; stage only files related to the requested skill or instruction update.
48
+ - Never suppress errors, lint failures, type failures, security failures, or failing tests; fix the underlying issue or report the blocker.
49
+ - Do not log or expose secrets, JWTs, passwords, credentials, private keys, sensitive personal data, SQL internals, or stack traces.
50
+
51
+ ## Overview
52
+
53
+ Use this skill when working inside `pkg-auth-util`, the `@carecard/auth-util`
54
+ package. It provides core authentication and authorization utilities for the
55
+ CareCard ecosystem.
56
+
57
+ Use `$carecard-workspace-standards` for shared workspace, dependency, package,
58
+ testing, and security rules. Legacy `pkg-auth-util/.codex` and
59
+ `pkg-auth-util/.junie` guidance has been migrated into these skills; do not
60
+ depend on those folders being present.
61
+
62
+ ## Non-Negotiable Rules
63
+
64
+ - Never use TypeScript type `any`. Use precise exported interfaces, index
65
+ signatures with `unknown`, generics, explicit unions, or explicit narrowing.
66
+ - Follow the existing CommonJS utility-package style, Mocha tests, TypeScript
67
+ declaration tests, and CareCard package conventions.
68
+ - Follow existing naming conventions:
69
+ - Public functions use camelCase.
70
+ - Internal helpers use the established underscore prefix.
71
+ - Keep public exports in `index.js`, declarations in `index.d.ts`,
72
+ implementation modules in `lib`, and tests in `test`.
73
+ - Use Test-Driven Development. Add or update Mocha and type tests before
74
+ changing behavior or exported API.
75
+ - Never suppress errors, type errors, linter warnings, crypto failures, or
76
+ failing tests. Fix the cause.
77
+ - Do not add dependencies unless absolutely required. Ask for confirmation first
78
+ with the reason and tradeoff.
79
+ - Before finalizing work, run every direct script in `.husky`. Do not bypass
80
+ Husky.
81
+
82
+ ## Package Scope
83
+
84
+ - `index.js` is the centralized public export surface.
85
+ - `index.d.ts` must stay aligned with every public export in `index.js`.
86
+ - `lib/jwtUtilAuth.js` owns JWT creation, service-to-service JWT creation,
87
+ verification, and decomposition.
88
+ - `lib/pwdUtilAuth.js` owns password hashing and saved-hash verification.
89
+ - `lib/cryptoUtilAuth.js` wraps Node.js `crypto` primitives for signing,
90
+ verifying, generating HMACs, and salts.
91
+ - `lib/keyGen.js` owns Ed25519 and RSA key generation.
92
+ - `lib/stringUtilAuth.js` owns legacy base64, base64-url-safe, JWT, and
93
+ password-hash string parsing helpers.
94
+ - Keep direct exports preferred and deprecated nested exports backward
95
+ compatible unless a breaking change is explicitly requested.
96
+ - Preserve CommonJS exports unless the repository intentionally migrates module
97
+ systems.
98
+
99
+ ## JWT Layer
100
+
101
+ - Use EdDSA/Ed25519 as the default JWT algorithm unless a task explicitly
102
+ changes crypto behavior.
103
+ - Preserve standardized headers and payload behavior, including automatic `iat`
104
+ and `exp` population where the existing API does that.
105
+ - Keep service-to-service JWT creation here, not in `@carecard/jwt-read`.
106
+ Public service-token creation exports are `jwtCreateServiceToken` and
107
+ `jwtCreateServiceAuthorizationHeader`.
108
+ - Do not silently change token timing behavior, token formats, JWT string
109
+ assembly, signature verification semantics, or decomposition return shapes.
110
+ - Expected parse and verify failures should return `null` or `false` where the
111
+ current public API does so.
112
+
113
+ ## Password And Crypto Layer
114
+
115
+ - Preserve the HMAC-based password hashing behavior.
116
+ - Preserve the saved password hash string format:
117
+
118
+ ```text
119
+ $1$base64(algorithm)$base64(hash)$base64(salt)$
120
+ ```
121
+
122
+ - Always handle salt automatically when creating new password hashes.
123
+ - Do not silently change cryptographic defaults, password hash string format,
124
+ salt behavior, or key output format.
125
+ - Prefer Node.js `crypto` primitives already used by the package over new
126
+ dependencies.
127
+
128
+ ## String Utilities
129
+
130
+ - Use `stringUtilAuth` for base64 and URL-safe string transformations to keep
131
+ parsing and serialization consistent.
132
+ - Keep legacy formatted string parsing behavior backward-compatible.
133
+ - Cover edge cases for malformed JWT strings, malformed password hashes, bad
134
+ base64 input, missing segments, and unsupported algorithms when these paths
135
+ change.
136
+
137
+ ## Security And Error Handling
138
+
139
+ - Treat JWT signing, verification, password hashing, salts, secrets, private
140
+ keys, public keys, reset tokens, and key generation as security-sensitive.
141
+ - Do not log secrets, private keys, tokens, password hashes, salts, raw
142
+ payloads, full JWT payloads, or credentials.
143
+ - Preserve the current utility style: expected parse, verify, and hash failures
144
+ should fail gracefully by returning `null` or `false` where the existing API
145
+ does so.
146
+ - Use `try/catch` inside utility functions where existing functions fail
147
+ gracefully instead of throwing uncaught exceptions.
148
+ - Do not broaden catch blocks in a way that hides unexpected implementation
149
+ errors in callers that currently expect throws.
150
+
151
+ ## Types And Exports
152
+
153
+ - Keep `index.d.ts` in sync with every public export in `index.js`.
154
+ - Avoid new loose index signatures. If payloads need custom claims, type them as
155
+ `Record<string, unknown>` or a named claim interface.
156
+ - Keep deprecated APIs marked as deprecated and prefer direct export examples in
157
+ docs and tests.
158
+ - Update type tests whenever public exports, overloads, return values, payload
159
+ shapes, or declaration behavior changes.
160
+
161
+ ## Tests
162
+
163
+ - Use Mocha for runtime tests under `test`.
164
+ - Every implementation module in `lib` should have matching tests under `test`.
165
+ For example, `lib/jwtUtilAuth.js` should be covered by
166
+ `test/jwtUtilAuth.test.js`.
167
+ - `test/index.test.js` should cover scenarios through the public exports from
168
+ `index.js`.
169
+ - `test/types.test.ts` verifies TypeScript declarations with `tsc`.
170
+ - Cover success and failure cases for JWT parsing, signature verification,
171
+ password hashing, saved-hash verification, key generation, base64 conversion,
172
+ URL-safe conversion, and string parsing.
173
+ - Keep tests deterministic and avoid external services.
174
+
175
+ ## Validation
176
+
177
+ Useful commands:
178
+
179
+ - `npm run lint`
180
+ - `npm run lint:fix`
181
+ - `npm run format`
182
+ - `npm run format:check`
183
+ - `npm run test`
184
+ - `npm run test:types`
185
+ - `npm run test:coverage`
186
+ - `npm run test:All`
187
+
188
+ Before pushing or finalizing, run every direct `.husky` script. The current
189
+ `.husky/pre-commit` runs:
190
+
191
+ ```bash
192
+ npm run lint:fix
193
+ npm run format
194
+ npm run test:All
195
+ ```
196
+
197
+ If any validation command cannot run, report the exact command, failure reason,
198
+ and remaining risk.
199
+
200
+ ## Remote Git Operations Guardrail
201
+
202
+ Do not run remote Git or GitHub operations unless the current user request explicitly asks for that remote operation. This includes `git fetch`, `git pull`, `git push`, `git push --delete`, remote branch cleanup, GitHub API calls, and any `gh pr` command that creates, updates, readies, merges, closes, or cleans up a pull request. Do not infer permission from branch names, validation needs, prior workflow habits, or convenience; ask first when remote state would be useful but was not requested.
203
+
204
+ ## Agent Guidance Git Workflow
205
+
206
+ When this skill or any repository-owned `.agents` guidance changes, use the
207
+ repository's agents-only Git workflow:
208
+
209
+ 1. Work from the affected repository root and confirm only intended `.agents`
210
+ files changed.
211
+ 2. Use `development` as the base branch when `origin/development` exists;
212
+ otherwise use the repository's default base branch, usually `main`.
213
+ 3. Create or update `feature/codex` from the updated remote base branch and
214
+ commit all the changed `.agents` guidance files there.
215
+ 4. Push `feature/codex`, create or reuse a pull request into the base branch,
216
+ and mark the pull request ready for review with `gh pr ready <number>`.
217
+ 5. Squash-merge with administrator privileges and delete the remote branch:
218
+
219
+ ```sh
220
+ gh pr merge <number> --squash --admin --delete-branch
221
+ ```
222
+
223
+ 6. After merge, update the local base branch and remove the local feature
224
+ branch:
225
+
226
+ ```sh
227
+ git fetch origin <base> --prune
228
+ git switch <base>
229
+ git pull --ff-only origin <base>
230
+ git branch -d feature/codex
231
+ git ls-remote --heads origin feature/codex
232
+ ```
233
+
234
+ Do not commit or push `.agents` guidance changes directly from `development`
235
+ or `main`. Do not stage unrelated files, generated output, dependency folders,
236
+ build artifacts, logs, or `.DS_Store`.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: 'Package Auth Util Auth Crypto Library'
3
+ short_description: 'Use when changing pkg-auth-util auth, password, JWT, crypto, key, exported API, types, or package validation behavior.'
4
+ default_prompt: 'Use $pkg-auth-util-auth-crypto-library when this task matches the skill scope.'
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: software-design-patterns-and-clean-code
3
+ description: Use every time before coding, refactoring, debugging, or reviewing in this repository, alongside all other applicable skills, to apply pragmatic software design patterns, SOLID, Clean Code, and testable architecture.
4
+ ---
5
+
6
+ # Software Design Patterns And Clean Code
7
+
8
+ ## Purpose
9
+
10
+ Use this skill with every coding, refactoring, debugging, or review task in
11
+ this repository. It supplements repository-specific skills; follow both, and
12
+ let the more specific skill decide file locations, framework conventions,
13
+ validation commands, and API contracts.
14
+
15
+ ## Core Principles
16
+
17
+ - Prefer simple, maintainable, readable implementation over clever abstraction.
18
+ - Use Gang of Four design patterns only when they reduce real complexity,
19
+ improve clarity, or make behavior easier to test.
20
+ - Follow SOLID principles, especially Single Responsibility and Dependency
21
+ Inversion where they improve maintainability.
22
+ - Keep clear separation of concerns between routing, orchestration, domain
23
+ logic, persistence, validation, formatting, and side effects.
24
+ - Apply DRY, KISS, and YAGNI. Remove meaningful duplication, keep solutions
25
+ direct, and avoid speculative generalization.
26
+ - Favor small, composable functions with meaningful names and explicit inputs.
27
+ - Prefer pure functions for calculations, mapping, validation, and transforms
28
+ when practical.
29
+ - Keep side effects minimal, localized, and easy to identify.
30
+ - Use explicit error handling. Do not swallow failures or hide actionable
31
+ error context.
32
+ - Design code so behavior can be tested through focused unit, integration, or
33
+ service tests without fragile setup.
34
+ - Avoid unnecessary dependencies. Use existing language, framework, and local
35
+ helper capabilities before adding packages.
36
+
37
+ ## Function Comments
38
+
39
+ For every new or modified function, method, or exported callback, add a short
40
+ comment immediately above it explaining the main pattern or principle being
41
+ applied. Keep the comment accurate and specific to the function.
42
+
43
+ Use the host language's normal comment syntax. Examples:
44
+
45
+ ```ts
46
+ // Pattern: Single Responsibility - validates user input only.
47
+ function validateUserInput(...) { ... }
48
+
49
+ // Pattern: Pure Function - deterministic output with no side effects.
50
+ function calculateTotal(...) { ... }
51
+
52
+ // Pattern: Dependency Inversion - depends on an injected repository contract.
53
+ async function loadProfile(...) { ... }
54
+ ```
55
+
56
+ ## Working Rules
57
+
58
+ - Do not violate these coding principles unless there is no reasonable
59
+ alternative.
60
+ - If a principle must be violated, include a short explanation in the code
61
+ review or final summary.
62
+ - Refactor touched existing code to follow these patterns and principles when
63
+ doing so is safe and related to the requested change.
64
+ - Do not use this skill as a reason for broad unrelated rewrites.
65
+ - Before introducing an abstraction or design pattern, confirm it removes real
66
+ complexity compared with a straightforward function or module.
67
+ - Prefer dependency inversion at boundaries such as databases, external
68
+ services, clocks, file systems, queues, and network calls when it improves
69
+ testability or substitution.
70
+ - Keep interfaces and abstractions narrow. Do not create generic layers that
71
+ only have one trivial implementation unless they clarify a boundary.
72
+ - Preserve the repository's existing style, naming, module system, and testing
73
+ approach.
@@ -0,0 +1,2 @@
1
+ approval_policy = "never"
2
+ sandbox_mode = "danger-full-access"
@@ -0,0 +1,17 @@
1
+ dist/
2
+ coverage/
3
+ node_modules/
4
+ build/
5
+ *.min.js
6
+ .github
7
+ .husky
8
+ dist
9
+ .gitignore
10
+ .npmignore
11
+ .prettierignore
12
+ .prettierrc.js
13
+ eslint.config.mjs
14
+ jest.config.js
15
+ package.json
16
+ readme.md
17
+ rename-cjs.js
@@ -0,0 +1,32 @@
1
+ /** @type {import('prettier').Config} */
2
+ module.exports = {
3
+ // Core formatting
4
+ printWidth: 100,
5
+ tabWidth: 2,
6
+ useTabs: false,
7
+ semi: true,
8
+ singleQuote: true,
9
+ trailingComma: 'all',
10
+ bracketSpacing: true,
11
+ bracketSameLine: true,
12
+ arrowParens: 'avoid',
13
+
14
+ // Line endings (important for cross-platform + CI)
15
+ endOfLine: 'auto',
16
+
17
+ // Language-specific overrides
18
+ overrides: [
19
+ {
20
+ files: '*.json',
21
+ options: {
22
+ printWidth: 80,
23
+ },
24
+ },
25
+ {
26
+ files: '*.md',
27
+ options: {
28
+ proseWrap: 'preserve',
29
+ },
30
+ },
31
+ ],
32
+ };
package/.prettierrc.js ADDED
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ arrowParens: 'avoid',
3
+ bracketSameLine: true,
4
+ bracketSpacing: true,
5
+ singleQuote: true,
6
+ trailingComma: 'all',
7
+ printWidth: 140,
8
+ useTabs: false,
9
+ endOfLine: 'auto',
10
+ importOrderSeparation: true,
11
+ importOrderSortSpecifiers: true,
12
+ };
@@ -0,0 +1,14 @@
1
+ import { defineConfig, globalIgnores } from 'eslint/config';
2
+
3
+ const eslintConfig = defineConfig([
4
+ globalIgnores([
5
+ // Default ignores of eslint-config-next:
6
+ '.next/**',
7
+ 'out/**',
8
+ 'build/**',
9
+ 'next-env.d.ts',
10
+ 'node_modules/**',
11
+ ]),
12
+ ]);
13
+
14
+ export default eslintConfig;