Skip to content

Commit 4fc5f2f

Browse files
committed
Removed the references file
1 parent 7e66101 commit 4fc5f2f

7 files changed

Lines changed: 114 additions & 111 deletions

File tree

.talismanrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
fileignoreconfig:
22
- filename: skills/dev-workflow/SKILL.md
33
checksum: bbe23955b8865b7b44e8adaf414dce2b0127921ed1e35488adf470fdd833270f
4-
- filename: skills/code-review/references/code-review-checklist.md
5-
checksum: 7b5132bc27e2328f32ecf38941bb117a77be0d83502f15c3a5d1933f3220b6fc
64
- filename: package-lock.json
75
checksum: 31cf2fecced45ffd2db8b1f7c5258d1c98c2d0be7dd443460cfc070558a85c82
6+
- filename: skills/contentstack-cli/SKILL.md
7+
checksum: cd7046bfdace6bb82ff6168663f05b0a641e615d61167412d0a4c724c3d18209
8+
- filename: skills/code-review/SKILL.md
9+
checksum: f4fb9f63b97acf35845f31577840050af6c4f960dc6522477e31decc0b866313
10+
811
version: ""

skills/code-review/SKILL.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,40 @@ description: PR and release checklist for cli-cm-regex-validate (security, packa
1616

1717
Open [`skills/code-review/`](.) when reviewing PRs or before release (or point your agent at this folder if supported).
1818

19+
## Checklist
20+
21+
### Correctness and safety
22+
23+
- [ ] Changes match the intended behavior for `cm:stacks:validate-regex` (flags, prompts, stack connection, CT/GF selection).
24+
- [ ] No API keys, management tokens, or secrets in code or tests; Talisman/Snyk hooks still make sense for local workflow.
25+
- [ ] New user-visible strings added to `messages/index.json` under `validateRegex` (avoid hard-coded copy in production paths).
26+
27+
### Tests
28+
29+
- [ ] `npm test` passes locally.
30+
- [ ] New behavior covered by `test/utils/` tests and/or `test/data/` fixtures where appropriate.
31+
- [ ] Mocks used for Management SDK and filesystem; no accidental live stack calls in unit tests.
32+
33+
### Lint and types
34+
35+
- [ ] ESLint passes (`posttest` or project eslint script). **Note:** CI does not run ESLint — only `npm test` in [`.github/workflows/unit-tests.yml`](../../.github/workflows/unit-tests.yml); lint must pass locally before merge.
36+
- [ ] TypeScript changes respect `strict` and project conventions (see `tsconfig.json`, `.eslintrc`, and [`AGENTS.md`](../../AGENTS.md)).
37+
38+
### Packaging and release
39+
40+
- [ ] `package.json` `files` includes what ships (`lib`, `bin`, `oclif.manifest.json`, `messages`, etc.).
41+
- [ ] `prepack` still runs `tsc`, `oclif manifest`, and `oclif readme` as needed for the plugin.
42+
- [ ] Version bumps follow team process; release workflow (e.g. push to `main`) matches `.github/workflows/release.yml` expectations.
43+
44+
### CI / security workflows
45+
46+
- [ ] Unit test workflow exercises `npm test` on a supported Node version (see `.github/workflows/unit-tests.yml`). Expect Jest only there — not `posttest`/ESLint unless you add a separate workflow.
47+
- [ ] SCA / policy workflows unchanged or intentionally updated; no silent downgrade of security checks.
48+
49+
### Documentation
50+
51+
- [ ] README or command examples updated if flags or behavior changed.
52+
1953
## References
2054

21-
- [references/code-review-checklist.md](references/code-review-checklist.md)
2255
- [Development workflow](../dev-workflow/SKILL.md)

skills/code-review/references/code-review-checklist.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

skills/contentstack-cli/SKILL.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,40 @@ description: Contentstack CLI plugin patterns for cm:stacks:validate-regex (SDK,
1818

1919
Open [`skills/contentstack-cli/`](.) when changing commands, utils, or `messages/index.json` (or point your agent at this folder if supported).
2020

21+
## Patterns (regex validation plugin)
22+
23+
### Plugin identity
24+
25+
- Package: `@contentstack/cli-cm-regex-validate`
26+
- Command id: `cm:stacks:validate-regex` (short name `RGXVLD` in `package.json` `csdxConfig` when present)
27+
- Entry: `src/commands/cm/stacks/validate-regex.ts`
28+
29+
### End-to-end flow
30+
31+
1. **Parse**`this.parse(ValidateRegex)`; flags: `alias`, `contentType`, `globalField`, `filePath`, `help`.
32+
2. **Prompts** — If alias or module flags are missing, `inquireAlias` / `inquireModule` (`src/utils/interactive.ts`, Inquirer).
33+
3. **Token**`this.getToken(alias)` from Contentstack CLI; errors use `messages.validateRegex.errors.tokenNotFound` and `ref` to docs.
34+
4. **Connect**`connect-stack.ts`: `contentstackSdk.client({ host })`, optional `early_access` headers, `client.stack({ api_key, management_token })`.
35+
5. **Process**`process-stack.ts`: for each selected module, `stack.contentType()` / `stack.globalField()``.query({}).find()`, then `safe-regex.ts` on each item.
36+
6. **Output**`generate-output.ts`: `results.csv` via `jsonexport`, table via `cli-table3`, paths via `sanitizePath`; user copy from `messages/index.json`.
37+
38+
### Schema traversal
39+
40+
- Recurse into `schema` for `group` and `global_field`.
41+
- For `blocks`, iterate `blocks` and each block’s `schema`.
42+
- For each field with `format`, call `safe-regex`; collect module, title, UID, field metadata, and pattern for invalid rows.
43+
44+
### User-facing strings
45+
46+
- All strings live under `messages/index.json``validateRegex` (command, interactive, cliAction, errors, output).
47+
- Docs link in output points to Contentstack guidance on catastrophic backtracking / validation regex.
48+
49+
### Related packages
50+
51+
- `@contentstack/cli-command`, `@contentstack/cli-utilities`, `@contentstack/management`
52+
- `cli-ux` (spinner), `inquirer` (prompts), `safe-regex`, `jsonexport`, `cli-table3`
53+
2154
## References
2255

23-
- [references/contentstack-patterns.md](references/contentstack-patterns.md)
2456
- [Development workflow](../dev-workflow/SKILL.md)
2557
- [Testing](../testing/SKILL.md)

skills/contentstack-cli/references/contentstack-patterns.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

skills/testing/SKILL.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,48 @@ description: Jest testing patterns for cli-cm-regex-validate (mocks, fixtures, n
1919

2020
When using an agent or IDE that supports folder context, open [`skills/testing/`](.) for test-focused guidance.
2121

22+
## Patterns (Jest)
23+
24+
This project uses **Jest** and **ts-jest**. **`npm test`** (Jest) is the canonical test command; CI runs `npm test` from `.github/workflows/unit-tests.yml`. The `mocha` script in `package.json` is **not** what CI runs—do not use `npm run mocha` as the project test entry point.
25+
26+
### File layout
27+
28+
| Area | Path |
29+
|------|------|
30+
| Tests | `test/utils/*.test.ts` |
31+
| Fixtures | `test/data/*.json` |
32+
33+
Mirror utility names where it helps (`connect-stack.test.ts` vs `connect-stack.ts`).
34+
35+
### Commands
36+
37+
- `npm test` — runs Jest with `jest.config.ts` (roots, `testMatch`, ts-jest transform, coverage).
38+
39+
### Mocking
40+
41+
- **Management SDK:** `jest.mock('@contentstack/management')` and stub `client`, `stack`, and query chains as in `connect-stack.test.ts`.
42+
- **Filesystem:** `jest.mock('fs')` when testing CSV path creation and `writeFileSync` / `mkdirSync`.
43+
- **cli-ux:** mock `cli.action.start` / `stop` when asserting spinner behavior; avoid reassigning imported bindings with `@ts-ignore`—prefer `jest.mock('cli-ux', () => ({ ... }))` when needed.
44+
- **cli-utilities:** mock `cliux.print` and `sanitizePath` in output tests when asserting printed messages and paths.
45+
46+
### Fixtures
47+
48+
- Load JSON with `require('../data/...')` for content type / global field documents and expected invalid-regex rows.
49+
- Keeps tests readable and matches real API shape (schema, `data_type`, `format`, nested `group` / `blocks`).
50+
51+
### Assertions
52+
53+
- Use `toHaveBeenCalled`, `toHaveBeenCalledWith`, `toStrictEqual` for objects and arrays.
54+
- Avoid deprecated matchers removed in newer Jest (e.g. prefer `toHaveBeenCalled` over legacy aliases).
55+
56+
### Async tests
57+
58+
- Use `async`/`await` for utilities that return promises; await `inquireAlias` / `inquireModule` when testing interactive flows with mocked `inquirer`.
59+
60+
### Note on `package.json`
61+
62+
- This repo lists **`jest`** under **`dependencies`** in `package.json`. Run tests via **`npm test`** and describe the framework as Jest in documentation and for agents.
63+
2264
## References
2365

24-
- [references/testing-patterns.md](references/testing-patterns.md)
2566
- [Development workflow](../dev-workflow/SKILL.md)

skills/testing/references/testing-patterns.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)