|
| 1 | +# cli-cm-regex-validate |
| 2 | + |
| 3 | +`@contentstack/cli-cm-regex-validate` is a **Contentstack CLI** oclif plugin with a single command, **`csdx cm:stacks:validate-regex`**, which scans content types and/or global fields in a stack for regex `format` values that fail the `safe-regex` check, then writes results to CSV and prints a summary table. User-facing copy lives in `messages/index.json`. |
| 4 | + |
| 5 | +## Layout |
| 6 | + |
| 7 | +| Area | Path | |
| 8 | +|------|------| |
| 9 | +| Command | `src/commands/cm/stacks/validate-regex.ts` | |
| 10 | +| Utils | `src/utils/` (`connect-stack`, `process-stack`, `safe-regex`, `generate-output`, `interactive`) | |
| 11 | +| Messages | `messages/index.json` | |
| 12 | +| Tests | `test/utils/*.test.ts` | |
| 13 | +| Fixtures | `test/data/*.json` | |
| 14 | + |
| 15 | +## Workflow |
| 16 | + |
| 17 | +- Run **`npm test`** (Jest + ts-jest) before pushing; CI uses the same in `.github/workflows/unit-tests.yml`. |
| 18 | +- Run ESLint after tests via **`npm run posttest`** (or your team’s eslint invocation from `package.json`). |
| 19 | + |
| 20 | +## Naming |
| 21 | + |
| 22 | +- Source files: kebab-case. |
| 23 | +- Tests: describe behavior clearly (what should happen under which condition). |
| 24 | + |
| 25 | +## Universal skills (any agent) |
| 26 | + |
| 27 | +- `@skills/testing` — Jest mocks, fixtures, no live API calls |
| 28 | +- `@skills/contentstack-cli` — SDK flow, schema recursion, `safe-regex`, output |
| 29 | +- `@skills/code-review` — PR checklist (security, packaging, CI, messages) |
| 30 | + |
| 31 | +## Cursor rules (IDE) |
| 32 | + |
| 33 | +For file-scoped guidance, Cursor loads rules under `.cursor/rules/`. You can reference them in chat by intent, for example: |
| 34 | + |
| 35 | +- TypeScript and ESLint conventions — `typescript.mdc` |
| 36 | +- Jest tests — `testing.mdc` |
| 37 | +- Command class — `oclif-commands.mdc` |
| 38 | +- Utils (SDK, safe-regex, output) — `contentstack-cli.mdc` |
| 39 | +- Dev workflow — `dev-workflow.md` (always applied) |
| 40 | + |
| 41 | +See `.cursor/rules/README.md` for the full index. |
0 commit comments