|
1 | | -# cli-cm-regex-validate |
| 1 | +# cli-cm-regex-validate – Agent guide |
2 | 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`. |
| 3 | +**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**. |
4 | 4 |
|
5 | | -## Layout |
| 5 | +## What this repo is |
6 | 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` | |
| 7 | +| Field | Detail | |
| 8 | +|-------|--------| |
| 9 | +| **Name:** | [contentstack/cli-cm-regex-validate](https://github.com/contentstack/cli-cm-regex-validate) (`@contentstack/cli-cm-regex-validate` on npm) | |
| 10 | +| **Purpose:** | 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`. | |
| 11 | +| **Out of scope (if any):** | Not a general-purpose Contentstack SDK — only this plugin’s command, utils, and tests. | |
14 | 12 |
|
15 | | -## Workflow |
| 13 | +## Tech stack (at a glance) |
16 | 14 |
|
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`). |
| 15 | +| Area | Details | |
| 16 | +|------|---------| |
| 17 | +| Language | TypeScript (`strict`), Node `>=14.0.0` per `package.json` engines | |
| 18 | +| Build | npm; `prepack` runs `tsc -b`, oclif manifest, oclif readme — see `package.json` | |
| 19 | +| Tests | Jest + ts-jest (`jest.config.ts`), `npm test`; suites under `test/utils/`, fixtures `test/data/*.json` | |
| 20 | +| Lint / coverage | ESLint (`.eslintrc`), `npm run posttest` | |
| 21 | +| Other | oclif v3, `@contentstack/cli-command`; CI: Node 22.x — [`.github/workflows/unit-tests.yml`](.github/workflows/unit-tests.yml). **CI runs Jest only** (`npm run test`); **ESLint is not run in CI** — run `npm run posttest` locally before merge. | |
19 | 22 |
|
20 | | -## Naming |
| 23 | +## Commands (quick reference) |
21 | 24 |
|
22 | | -- Source files: kebab-case. |
23 | | -- Tests: describe behavior clearly (what should happen under which condition). |
| 25 | +| Command type | Command | |
| 26 | +|--------------|---------| |
| 27 | +| Build (release prep) | `npm run prepack` — cleans `lib`, compiles, generates oclif manifest and readme | |
| 28 | +| Test | `npm test` | |
| 29 | +| Lint | `npm run posttest` | |
24 | 30 |
|
25 | | -## Universal skills (any agent) |
| 31 | +CI runs `npm i` and `npm run test` on pull requests — see [`.github/workflows/unit-tests.yml`](.github/workflows/unit-tests.yml). It does **not** run `npm run posttest` (ESLint); run lint locally before merging. |
26 | 32 |
|
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) |
| 33 | +## Where the documentation lives: skills |
30 | 34 |
|
31 | | -## Cursor rules (IDE) |
| 35 | +| Skill | Path | What it covers | |
| 36 | +|-------|------|----------------| |
| 37 | +| Development workflow | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Commands, repo layout, naming, hooks, TDD, before merge | |
| 38 | +| Testing | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Jest, mocks, fixtures, no live API calls | |
| 39 | +| Contentstack CLI | [`skills/contentstack-cli/SKILL.md`](skills/contentstack-cli/SKILL.md) | Command flow, SDK, schema walk, `safe-regex`, CSV/table output | |
| 40 | +| Code review | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR and release checklist | |
32 | 41 |
|
33 | | -For file-scoped guidance, Cursor loads rules under `.cursor/rules/`. You can reference them in chat by intent, for example: |
| 42 | +An index with “when to use” hints is in [`skills/README.md`](skills/README.md). |
34 | 43 |
|
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) |
| 44 | +## Using Cursor (optional) |
40 | 45 |
|
41 | | -See `.cursor/rules/README.md` for the full index. |
| 46 | +If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **[`AGENTS.md`](AGENTS.md)** — same docs as everyone else. |
0 commit comments