Skip to content

Commit 652256b

Browse files
authored
Merge pull request #132 from contentstack/update/DX-5353
update: added unit tests and skills
2 parents 35bb3b1 + ca9e9e6 commit 652256b

File tree

32 files changed

+2986
-620
lines changed

32 files changed

+2986
-620
lines changed

.cursor/rules/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Cursor (optional)
2+
3+
**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
4+
5+
This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.

AGENTS.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# contentstack-cli-content-type – Agent guide
2+
3+
**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.
4+
5+
## What this repo is
6+
7+
| Field | Detail |
8+
|-------|--------|
9+
| **Name:** | [contentstack/contentstack-cli-content-type](https://github.com/contentstack/contentstack-cli-content-type) (`contentstack-cli-content-type` on npm) |
10+
| **Purpose:** | Contentstack CLI (`csdx`) plugin that reads Content Type metadata from a stack: list, details, audit logs, same-stack or cross-stack JSON compare (HTML diff), and stack content-model diagrams. |
11+
| **Out of scope (if any):** | Bulk entry/asset mutations, Delivery API consumption, and unrelated HTTP clients—this package focuses on content-type introspection via the Management API patterns documented in the plugin skill. |
12+
13+
## Tech stack (at a glance)
14+
15+
| Area | Details |
16+
|------|---------|
17+
| Language | TypeScript, **`strict`** ([tsconfig.json](tsconfig.json)), target ES2017, CommonJS |
18+
| Build | `tsc -b`; output **`lib/`**; **`npm run prepack`** runs compile + `oclif manifest` + `oclif readme` |
19+
| Tests | Jest + ts-jest; tests under **`tests/`** ([jest.config.js](jest.config.js)) |
20+
| Lint / coverage | ESLint via **`npm run posttest`** ([.eslintrc](.eslintrc)); Jest coverage **`npm run test:coverage`**, global thresholds in [jest.config.js](jest.config.js) |
21+
| CLI / runtime | oclif; Node engines per [package.json](package.json); `bin` is `csdx` when installed as a CLI plugin |
22+
23+
## Commands (quick reference)
24+
25+
| Command type | Command |
26+
|--------------|---------|
27+
| Build (publishable) | `npm run prepack` |
28+
| Test | `npm test` |
29+
| Test + coverage | `npm run test:coverage` |
30+
| Lint | `npm run posttest` (or `eslint . --ext .ts --config .eslintrc`) |
31+
32+
CI: [.github/workflows](.github/workflows) includes policy/SCA/release/issue automation—there is no single `ci.yml` that only runs `npm test`; follow team merge requirements.
33+
34+
## Where the documentation lives: skills
35+
36+
| Skill | Path | What it covers |
37+
|-------|------|----------------|
38+
| Dev workflow | [skills/dev-workflow/SKILL.md](skills/dev-workflow/SKILL.md) | Scripts, `tsconfig`, ESLint, Jest/coverage, oclif README/manifest, PR checks |
39+
| Content Type plugin | [skills/contentstack-cli-content-type/SKILL.md](skills/contentstack-cli-content-type/SKILL.md) | `ContentTypeCommand`, CMA vs SDK, auth, commands, compare/diagram |
40+
| Testing | [skills/testing/SKILL.md](skills/testing/SKILL.md) | Jest layout, mocks, conventions, coverage |
41+
| Code review | [skills/code-review/SKILL.md](skills/code-review/SKILL.md) | PR checklist, security and dependency review |
42+
43+
An index with “when to use” hints is in [skills/README.md](skills/README.md).
44+
45+
## Security
46+
47+
See [SECURITY.md](SECURITY.md) for reporting issues.
48+
49+
## Using Cursor (optional)
50+
51+
If you use **Cursor**, [.cursor/rules/README.md](.cursor/rules/README.md) only points to **[AGENTS.md](AGENTS.md)**—same docs as everyone else.

jest.config.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
module.exports = {
2-
"roots": [
3-
"<rootDir>"
2+
roots: [
3+
'<rootDir>',
44
],
5-
"testMatch": [
6-
"**/tests/**/*.+(ts|tsx)",
7-
"**/?(*.)+(spec|test).+(ts|tsx)"
5+
testMatch: [
6+
'**/tests/**/*.+(ts|tsx)',
7+
'**/?(*.)+(spec|test).+(ts|tsx)',
88
],
9-
"transform": {
10-
"^.+\\.(ts|tsx)$": "ts-jest"
9+
transform: {
10+
'^.+\\.(ts|tsx)$': 'ts-jest',
1111
},
12-
}
12+
// Coverage: raise thresholds toward ~80% lines/branches/functions as the suite grows (see AGENTS.md).
13+
collectCoverageFrom: [
14+
'src/**/*.ts',
15+
'!src/**/*.d.ts',
16+
],
17+
coverageReporters: ['text', 'text-summary', 'lcov', 'html'],
18+
coverageThreshold: {
19+
global: {
20+
branches: 80,
21+
functions: 80,
22+
lines: 80,
23+
statements: 80,
24+
},
25+
},
26+
}

0 commit comments

Comments
 (0)