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
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist/
coverage/
pnpm-lock.yaml
bin/a8c-integration
bin/vip-integration
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# a8c-integration
# vip-integration

A CLI for building **WordPress VIP Integration Center** add-ons. It does two things:

- **`a8c-integration init`** — scaffold a new integration from the [VIP Integrations Starter Kit](https://github.com/Automattic/vip-integrations-starter-kit), with the example prefix set already rewritten to your names.
- **`a8c-integration validate`** — run the integration conformance checker locally and in CI, so you get an objective _conformant / not-conformant_ answer before you submit.
- **`vip-integration init`** — scaffold a new integration from the [VIP Integrations Starter Kit](https://github.com/Automattic/vip-integrations-starter-kit), with the example prefix set already rewritten to your names.
- **`vip-integration validate`** — run the integration conformance checker locally and in CI, so you get an objective _conformant / not-conformant_ answer before you submit.

It is a standalone home for the checker that used to live in `vip-cli`, decoupled so the Integration Center can extend to other parts of Automattic (.com / a4a).

## Install

```bash
npm install -g @automattic/a8c-integration
npm install -g @automattic/vip-integration
```

Or run without installing:

```bash
npx @automattic/a8c-integration validate
npx @automattic/vip-integration validate
```

Requires Node.js 20+.
Expand All @@ -26,13 +26,13 @@ Requires Node.js 20+.
### Start a new integration

```bash
a8c-integration init
vip-integration init
```

Interactive — it asks for your **vendor name** and **integration name**, always builds from the canonical [VIP Integrations Starter Kit](https://github.com/Automattic/vip-integrations-starter-kit) (its default branch, no git history pulled), rewrites the example prefix set to your names, renames the entry file, and starts a fresh git history. You can also pass the answers as flags:
Interactive — it asks for your **vendor name** and **integration name**, always builds from the canonical [VIP Integrations Starter Kit](https://github.com/Automattic/vip-integrations-starter-kit) (its default branch, no git history pulled), rewrites the example prefix set to your names, and renames the entry file. You can also pass the answers as flags:

```bash
a8c-integration init --vendor "WordPress" --name "Content Sync"
vip-integration init --vendor "WordPress" --name "Content Sync"
```

| Flag | Description |
Expand All @@ -49,15 +49,15 @@ When it finishes:
cd content-sync
composer install && npm install
# edit your integration, then:
a8c-integration validate
vip-integration validate
```

### Validate an integration

```bash
a8c-integration validate # checks the current directory
a8c-integration validate ./my-plugin # checks a given directory
a8c-integration validate --format json # machine-readable output for CI
vip-integration validate # checks the current directory
vip-integration validate ./my-plugin # checks a given directory
vip-integration validate --format json # machine-readable output for CI
```

The checker runs nine static conformance rules and prints a per-rule report. It exits `1` when the integration is **not conformant** (any rule failed), so it gates CI. Warnings do not break conformance. Two items — the plugin/platform config-schema match and the security review — are surfaced as _human review required_ rather than automated pass/fail, because they cannot be checked statically.
Expand Down
37 changes: 37 additions & 0 deletions __tests__/scaffold.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,43 @@ describe( 'scaffoldTree', () => {
expect( result.changed ).toBeGreaterThanOrEqual( 3 );
} );

it( 'personalizes derivable manifest fields and placeholders the rest', () => {
const root = join( dir, 'manifest' );
mkdirSync( root, { recursive: true } );
writeFileSync(
join( root, 'vip-manifest.yaml' ),
[
'# yaml-language-server: $schema=./vip-manifest.schema.json',
'integration:',
' slug: example-integration',
' summary: Reference integration built from the VIP Integrations Starter Kit.',
' partner:',
' support_contact: support@example.com',
'documentation:',
' public_url: https://example.com/docs/example-integration',
' support_url: https://example.com/docs/example-integration/support',
'release:',
' changelog: Initial VIP integration starter kit example.',
'',
].join( '\n' )
);

scaffoldTree( root, 'Acme', 'Content Sync' );

const manifest = readFileSync( join( root, 'vip-manifest.yaml' ), 'utf8' );
// Derivable fields get real values.
expect( manifest ).toContain( 'summary: Content Sync integration for WordPress VIP.' );
expect( manifest ).toContain( 'changelog: Initial release.' );
// Partner-only fields become placeholders so validate fails until filled.
expect( manifest ).toContain( 'support_contact: REPLACE_ME' );
expect( manifest ).toContain( 'public_url: https://REPLACE_ME' );
expect( manifest ).toContain( 'support_url: https://REPLACE_ME' );
// The schema modeline comment survives the edit.
expect( manifest ).toContain( '# yaml-language-server: $schema=./vip-manifest.schema.json' );
// The token pass still ran: the example slug was rewritten.
expect( manifest ).toContain( 'slug: content-sync' );
} );

it( 'leaves a binary file untouched even when it contains a token', () => {
const root = join( dir, 'binary' );
mkdirSync( root, { recursive: true } );
Expand Down
Loading
Loading