Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cursor/rules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Cursor (optional)

**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.

This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.
41 changes: 41 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# CLI: Migrate HTML RTE to JSON RTE – Agent guide

**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.

## What this repo is

| Field | Detail |
|--------|--------|
| **Name:** | [cli-cm-migrate-rte](https://github.com/contentstack/cli-cm-migrate-rte) (`@contentstack/cli-cm-migrate-rte`) |
| **Purpose:** | **oClif** plugin for **Contentstack CLI** (`csdx`) to migrate HTML RTE fields to JSON RTE using serializers and DOM parsing. |
| **Out of scope:** | Not a general-purpose CLI—extends the Contentstack CLI command set only. |

## Tech stack (at a glance)

| Area | Details |
|------|---------|
| Language | JavaScript (Node **≥ 18**); commands under **`src/commands/`** |
| Build | oClif manifest (`oclif manifest` in `prepack`); no separate compile step for app code |
| Tests | **Mocha** + **nyc** — `npm test` → `test/**/*.test.js` with `test/setup.js` |
| Lint / coverage | **ESLint** with `eslint-config-oclif` (run `npx eslint .` if no script) |
| CI | `.github/workflows/unit-test.yml`, `check-version-bump.yml`, `sca-scan.yml`, `policy-scan.yml`, `issues-jira.yml` |

## Commands (quick reference)

| Command type | Command |
|--------------|---------|
| Test | `npm test` |
| Lint (manual) | `npx eslint .` (project uses ESLint 8 + oClif config) |

## Where the documentation lives: skills

| Skill | Path | What it covers |
|-------|------|----------------|
| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | oClif, Husky, versioning, CLI release |
| **Migrate RTE plugin** | [`skills/cli-migrate-rte/SKILL.md`](skills/cli-migrate-rte/SKILL.md) | Commands, serializers, jsdom usage |
| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Mocha, nock, fixtures |
| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist for CLI behavior |

## Using Cursor (optional)

If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else.
25 changes: 25 additions & 0 deletions skills/cli-migrate-rte/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: cli-migrate-rte
description: Use for migrate-html-rte command behavior, JSON RTE serializer, and DOM parsing in cli-cm-migrate-rte.
---

# Migrate RTE plugin – cli-cm-migrate-rte

## When to use

- Changing migration logic, stack entry updates, or `@contentstack/json-rte-serializer` usage
- Debugging jsdom-based HTML transforms

## Instructions

### Dependencies

- Relies on **`@contentstack/cli-command`**, **`@contentstack/cli-utilities`**, and **`@contentstack/json-rte-serializer`**—pin versions per Contentstack CLI compatibility matrix.

### Command UX

- Short name **`MGRTRTE`** is configured under `csdxConfig`—keep help text and flags aligned with Contentstack CLI standards.

### Safety

- Migrations mutate content—prefer dry-run or backup guidance in docs when adding destructive paths; validate on copies first.
25 changes: 25 additions & 0 deletions skills/code-review/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: code-review
description: Use when reviewing PRs for cli-cm-migrate-rte—command safety, tests, and CLI dependency alignment.
---

# Code review – cli-cm-migrate-rte

## When to use

- Reviewing migration logic or dependency bumps on `@contentstack/*` packages

## Instructions

### Checklist

- **Safety**: Migration cannot silently corrupt entries; edge cases covered by tests.
- **CLI contract**: Flags, prompts, and exit codes match oClif expectations and docs.
- **Deps**: `@contentstack/cli-*` versions aligned with the CLI release train.
- **Tests**: `npm test` green; new behavior has Mocha coverage.

### Severity hints

- **Blocker**: Data loss risk, failing tests, or broken manifest/readme generation.
- **Major**: Missing tests for HTML edge cases or serializer upgrades.
- **Minor**: Logging, messages, internal structure.
30 changes: 30 additions & 0 deletions skills/dev-workflow/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: dev-workflow
description: Use for oClif plugin lifecycle, npm scripts, Husky, and Contentstack CLI integration for cli-cm-migrate-rte.
---

# Development workflow – cli-cm-migrate-rte

## When to use

- Adding or renaming commands under `src/commands/`
- Preparing `npm pack` / publish with oClif manifest

## Instructions

### oClif

- Commands are discovered from **`./src/commands`** (`package.json` `oclif.commands`).
- **`prepack`** runs `oclif manifest` and `oclif readme`—ensure generated files stay consistent with git.

### Versioning

- **`npm version`** hook updates README via oClif—follow semver for CLI consumers.

### Node

- **`engines.node`** is **≥ 18**—test on supported Node LTS.

### Husky

- **`prepare`** sets up Husky—hooks run in dev after install.
25 changes: 25 additions & 0 deletions skills/testing/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: testing
description: Use for Mocha tests, nyc coverage, and test/setup.js patterns in cli-cm-migrate-rte.
---

# Testing – cli-cm-migrate-rte

## When to use

- Adding tests under `test/**/*.test.js`
- Mocking HTTP with **nock** for CLI flows

## Instructions

### Runner

- **`npm test`** runs Mocha with `test/setup.js` and **nyc** (coverage check relaxed via `--check-coverage=false` in script—still collect locally).

### Structure

- Keep one concern per test file; use fixtures for HTML/RTE samples instead of huge inline strings when possible.

### Integration

- Heavy integration tests may need CLI auth mocks—never commit API keys; use nock or env stubs.
Loading