Align wording with the shared standard used across all four repos in this project family. No behavioral change — same rules, consistent text. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9.0 KiB
Repo Working Notes
Test And Debugging Baseline
- Use Docker/Linux for installs, builds, and tests by default.
- Treat the CI environment as the source of truth:
- Ubuntu/Linux
- Node 24
npm cinpm test
- Before committing any JS/MJS change, run the full lint suite in Docker:
This runs all five targets:npx grunt eslinteslint:configs,eslint:core,eslint:web,eslint:node,eslint:tests. Running onlyeslint:coremisses errors in test files and other targets. Do not push without a clean lint run. - Dev server with auto-rebuild:
npm start(port 8080). Production build:npm run build(output inbuild/prod/). If the production build OOMs, setNODE_OPTIONS=--max_old_space_size=2048. - Do not run
npm run buildornpm starton Windows. The local Node version is not guaranteed to match CI and webpack builds will silently fail or produce wrong output. Build verification belongs in Docker/Linux CI only. - Do not spend time fixing Windows-only runtime or dependency issues unless explicitly requested.
- Do not commit repo changes whose only purpose is to make local Windows execution work.
- If a failure appears only in the local Windows shell, do not treat it as a code regression until it reproduces in Docker/Linux.
- When Docker is unavailable, restore Docker availability first rather than switching to Windows-specific debugging.
Session Start
- At the start of a session, sync with
origin/masterbefore doing substantive work. - Preferred command:
git pull --rebase origin master - Only do this automatically when the worktree is clean. If local changes are already present, inspect before rebasing.
Code Style
Follow CONTRIBUTING.md coding conventions: 4-space indentation, CamelCase class identifiers, camelCase function/variable names, UNDERSCORE_UPPER_CASE constants, UTF-8 source encoding, UNIX line endings, all files end with a newline.
Commit Scope
- Keep commits small and reviewable by default.
- Prefer one commit per logical change — a single coherent unit a reviewer can evaluate independently.
- Group related changes (e.g., a new feature + its test + the knowledge-base entry it required) into one commit when they can't be evaluated independently.
- Prefer squash or amend for iterative follow-ups — if a second commit only fixes or extends the immediately preceding one, squash rather than leaving noise in the log.
- Do not split a change just to make it look smaller; split when a reviewer would genuinely benefit from evaluating the pieces independently.
- When CI flags a lint or test failure after a push, fix locally and amend or squash into the failing commit (using
git push --force-with-lease) rather than adding a new fix commit on top.
APC Cross-Reference (Standing Instruction)
Whenever a payment cryptography question arises — algorithm behavior, key types, format support, operation design, test vector validation — first query the APC-agent MCP tools to check what AWS Payment Cryptography exposes for that operation. Use ToolSearch to load the relevant tool before calling it.
If the data is not available via APC-agent (endpoint doesn't exist, key-mode constraint, API gap), treat that as a documented gap — file a GitHub issue at J8k3/CyberChef capturing the operation, what was tried, and what's needed to close it. Do not guess APC behavior from training data; use the live tools.
Knowledge contribution (reciprocal): When this session surfaces new payment domain knowledge — a PCI rule, an algorithm edge case, an APC API constraint, an HSM command mapping — write it back into the MCP server in the same session: payment-knowledge-base.md for domain facts, hsm_analysis.py for HSM commands, compliance.py for enforcement rules. Do not defer. The two repos are a knowledge loop: CyberChef proves behavior in tests; the MCP server codifies it for LLM consumption.
This check is for internal development and validation only. APC must never appear in CyberChef UI text (operation names, descriptions, inline help, arg labels).
Security Constraint
Never mention AWS, APC, or AWS Payment Cryptography in any CyberChef UI-facing text. This includes operation names, descriptions, arg labels, inline help text, and output strings. Internal code comments and test file comments are fine.
ESLint
- Continuation lines inside
args: [must be aligned to 23 spaces - All module-level functions require JSDoc (
jsdoc/require-jsdoc). Constructors must have their own JSDoc — either/** @inheritdoc */or a named comment block. The class-level JSDoc does not satisfy this. - No unused imports
- No inline single-line blocks:
try { x; } catchorif (x) { y; }— statement and closing brace must each be on their own line (brace-stylerule) - Ternary
?and:must be at the end of the line, not the start (operator-linebreakrule). Writecondition ?\n a :\n bnotcondition\n ? a\n : b.
Payment Operation Maintenance
After completing any substantive payment operation work, ask: "Did I learn anything in this session that isn't captured in AGENTS.md?" If yes, add it before committing.
Before committing any new or changed payment operation, verify all of the following are in the same commit:
PAYMENT_RECIPES.mdOperation Registry updated (add/rename/remove the op name)J8k3/CyberChef-PaymentsREADME updated if the op appears in the recipe catalog or validation table- APC-agent queried for the relevant endpoint and any gap documented
- Tests passing
Do not commit the operation first and defer docs or APC check to a follow-up. If the user has to ask whether the docs were updated, the process was not followed.
PAYMENT_RECIPES.md is the developer reference for this repo: naming conventions, operation registry, and raw APC test vectors. The user-facing recipe catalog, chaining patterns, and validation status live in J8k3/CyberChef-Payments. Do not duplicate catalog content in PAYMENT_RECIPES.md.
When adding, renaming, or removing a payment operation:
- Update
PAYMENT_RECIPES.mdOperation Registry — add, rename, or remove the operation name from the relevant domain group. Remove or mark deprecated any operations that are replaced. - Follow the naming convention — all payment operation display names use Title Case. Acronyms (DUKPT, AES, EMV, MAC, PAN, TR-31, TR-34, KCV) stay upper-case. Brand names keep their canonical form (
payShield). Pattern:[Domain Prefix] [Verb] [Qualifier]— the domain/protocol prefix comes first so operations sort and scan by topic in the UI list. Example:EMV Verify MAC,DUKPT Derive TDES Key,PIN Block Parse. When a vendor name is a sub-specifier of a PIN method, embed it after the PIN domain prefix:PIN IBM 3624 Offset Generate,PIN IBM 3624 Verify. See the Naming Convention section inPAYMENT_RECIPES.md. Also update theJ8k3/CyberChef-PaymentsREADME if the op appears in the recipe catalog. - Only operations written for this fork belong in the Payments category — do not add upstream CyberChef ops (AES Encrypt, HMAC, CMAC, Triple DES Encrypt, AES Key Wrap, etc.) even as convenience shortcuts. If an op wasn't authored here, it stays in its own upstream category only.
- Keep
this.nameand file name consistent — the CyberChef UI showsthis.name; the file name is the class name in PascalCase. Both should reflect the same intent. - Do not rename
this.namewithout updatingPAYMENT_RECIPES.md— stale names in the doc are confusing and break recipe search. - Review and update
this.description,this.inlineHelp, andthis.testDataSampleswhenever changing a recipe — operation descriptions, inline help text, and sample args must stay consistent with the current arg list and behavior. A renamed arg, added arg, or changed default silently breaks the tooltip if the description still references the old shape. - Regenerate the build config after any add, rename, or delete — three files are gitignored and auto-generated; editing
this.nameorCategories.jsonalone is not enough:src/core/operations/index.mjs— full op list; built bygenerateOpsIndex.mjssrc/core/config/modules/Payment.mjs— mapsthis.name→ constructor for the Payment module chunk; built bygenerateConfig.mjssrc/core/config/OperationConfig.json— op metadata for the UI Run from the project root after any op change:
Ornode src/core/config/scripts/generateOpsIndex.mjs && node src/core/config/scripts/generateConfig.mjsnpx grunt dev/npx grunt prod, which runs both steps automatically. CI runs them on every build. Symptom of a stale registry:TypeError: f[e.module][e.name] is not a constructorat runtime. Grunt alias: if using grunt tasks directly, the correct task isnpx grunt exec:generateConfig.npx grunt exec:generateNodeIndexis a different task — it only regenerates the Node API wrapper (src/node/index.mjs) and does NOT updateOperationConfig.jsonormodules/Payment.mjs.