Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.
JavaScript agent-skillsai-agentsai-seoclaudeclaude-codeclaude-code-pluginclaude-skillscodexcontent-marketingconversion-rate-optimizationcopywritingcursoremail-marketinggenerative-engine-optimizationgrowth-marketingmarketingmarketing-automationsaas-marketingseoskill-md
test: consolidate CLI contract tests under tests/clis and run them in CI
Corey Haines2ec60613cecb
diff --git a/.github/workflows/regression-tests.yml b/.github/workflows/regression-tests.ymlindex af79677..e1f5181 100644--- a/.github/workflows/regression-tests.yml+++ b/.github/workflows/regression-tests.yml@@ -6,12 +6,14 @@ on:paths:- "validate-skills.sh"- "tests/**"+ - "tools/clis/**"- ".github/workflows/regression-tests.yml"pull_request:branches: [main]paths:- "validate-skills.sh"- "tests/**"+ - "tools/clis/**"- ".github/workflows/regression-tests.yml"concurrency:@@ -27,3 +29,20 @@ jobs:- name: Run validate-skills.sh regression testsrun: bash tests/run-regression.sh++ cli-contract-tests:+ runs-on: ubuntu-latest+ steps:+ - name: Checkout repository+ uses: actions/checkout@v6++ - name: Set up Node+ uses: actions/setup-node@v4+ with:+ node-version: 20++ - name: Check CLI syntax+ run: for f in tools/clis/*.js; do node --check "$f"; done++ - name: Run CLI contract tests+ run: node --test tests/clis/*.test.cjsdiff --git a/AGENTS.md b/AGENTS.mdindex 87a0795..0d5e1f8 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -43,6 +43,7 @@ marketingskills/node --check tools/clis/<name>.js # Syntax checknode tools/clis/<name>.js # Show usage (no args = help)node tools/clis/<name>.js <cmd> --dry-run # Preview request without sending+node --test tests/clis/*.test.cjs # Contract tests (mocked fetch, no live calls)```## Versioningdiff --git a/tests/calendly-webhooks.test.cjs b/tests/clis/calendly-webhooks.test.cjssimilarity index 97%rename from tests/calendly-webhooks.test.cjsrename to tests/clis/calendly-webhooks.test.cjsindex 9e14aa2..bd8c8ce 100644--- a/tests/calendly-webhooks.test.cjs+++ b/tests/clis/calendly-webhooks.test.cjs@@ -2,7 +2,7 @@ const {test} = require('node:test')const assert = require('node:assert/strict')const {spawnSync} = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/calendly.js')+const cli = path.resolve(__dirname, '../../tools/clis/calendly.js')const org = 'https://api.calendly.com/organizations/org'const user = 'https://api.calendly.com/users/user'const group = 'https://api.calendly.com/groups/group'diff --git a/tests/dataforseo-market.test.cjs b/tests/clis/dataforseo-market.test.cjssimilarity index 97%rename from tests/dataforseo-market.test.cjsrename to tests/clis/dataforseo-market.test.cjsindex c57b52d..f4ce27d 100644--- a/tests/dataforseo-market.test.cjs+++ b/tests/clis/dataforseo-market.test.cjs@@ -3,7 +3,7 @@ const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/dataforseo.js')+const cli = path.resolve(__dirname, '../../tools/clis/dataforseo.js')function run(args, dry = false) {const source = `global.fetch = async (url, options) => ({ status: 200, text: async () => JSON.stringify({ url, method: options.method, body: JSON.parse(options.body) }) }); process.argv = ['node', ${JSON.stringify(cli)}, ...${JSON.stringify(args)}, ...( ${dry} ? ['--dry-run'] : [])]; require(${JSON.stringify(cli)});`const result = spawnSync(process.execPath, ['-e', source], {encoding: 'utf8', env: {...process.env, DATAFORSEO_LOGIN: 'fixture-login', DATAFORSEO_PASSWORD: 'fixture-password'}})diff --git a/tests/email-boolean-states.test.cjs b/tests/clis/email-boolean-states.test.cjssimilarity index 97%rename from tests/email-boolean-states.test.cjsrename to tests/clis/email-boolean-states.test.cjsindex 0dc8d0b..7c9b4e1 100644--- a/tests/email-boolean-states.test.cjs+++ b/tests/clis/email-boolean-states.test.cjs@@ -3,7 +3,7 @@ const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')function run(vendor, args, fetch = true) {- const cli = path.resolve(__dirname, `../tools/clis/${vendor}.js`)+ const cli = path.resolve(__dirname, `../../tools/clis/${vendor}.js`)const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');return { status: 200, text: async () => JSON.stringify({ url, method: options.method, body: options.body ? JSON.parse(options.body) : null }) };diff --git a/tests/email-colon-values.test.cjs b/tests/clis/email-colon-values.test.cjssimilarity index 97%rename from tests/email-colon-values.test.cjsrename to tests/clis/email-colon-values.test.cjsindex be58569..d6b2850 100644--- a/tests/email-colon-values.test.cjs+++ b/tests/clis/email-colon-values.test.cjs@@ -3,7 +3,7 @@ const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')function run(vendor, args, fetch = true) {- const cli = path.resolve(__dirname, `../tools/clis/${vendor}.js`)+ const cli = path.resolve(__dirname, `../../tools/clis/${vendor}.js`)const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');return { status: 200, text: async () => JSON.stringify({ url, method: options.method, body: options.body ? JSON.parse(options.body) : null }) };diff --git a/tests/github-enrichment.test.cjs b/tests/clis/github-enrichment.test.cjssimilarity index 96%rename from tests/github-enrichment.test.cjsrename to tests/clis/github-enrichment.test.cjsindex 706104c..51a5b82 100644--- a/tests/github-enrichment.test.cjs+++ b/tests/clis/github-enrichment.test.cjs@@ -3,7 +3,7 @@ const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/github-prospects.js')+const cli = path.resolve(__dirname, '../../tools/clis/github-prospects.js')function run(command, status, args = []) {const source = `global.fetch = async url => {const profile = String(url).includes('/users/');diff --git a/tests/klaviyo-event-value.test.cjs b/tests/clis/klaviyo-event-value.test.cjssimilarity index 97%rename from tests/klaviyo-event-value.test.cjsrename to tests/clis/klaviyo-event-value.test.cjsindex 26a8342..654743e 100644--- a/tests/klaviyo-event-value.test.cjs+++ b/tests/clis/klaviyo-event-value.test.cjs@@ -2,7 +2,7 @@ const { test } = require('node:test')const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/klaviyo.js')+const cli = path.resolve(__dirname, '../../tools/clis/klaviyo.js')function run(args, fetch = false) {const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');diff --git a/tests/mailchimp-members.test.cjs b/tests/clis/mailchimp-members.test.cjssimilarity index 97%rename from tests/mailchimp-members.test.cjsrename to tests/clis/mailchimp-members.test.cjsindex 14d34ba..cd8dbd5 100644--- a/tests/mailchimp-members.test.cjs+++ b/tests/clis/mailchimp-members.test.cjs@@ -2,7 +2,7 @@ const { test } = require('node:test')const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/mailchimp.js')+const cli = path.resolve(__dirname, '../../tools/clis/mailchimp.js')function run(args, fetch = false) {const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');diff --git a/tests/onesignal-users.test.cjs b/tests/clis/onesignal-users.test.cjssimilarity index 97%rename from tests/onesignal-users.test.cjsrename to tests/clis/onesignal-users.test.cjsindex 7c749d7..17466e4 100644--- a/tests/onesignal-users.test.cjs+++ b/tests/clis/onesignal-users.test.cjs@@ -2,7 +2,7 @@ const { test } = require('node:test')const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/onesignal.js')+const cli = path.resolve(__dirname, '../../tools/clis/onesignal.js')function run(args, network = false) {const code = `global.fetch = async (url, options) => {if (!${network}) throw new Error('Unexpected network request');diff --git a/tests/paddle-discount-limit.test.cjs b/tests/clis/paddle-discount-limit.test.cjssimilarity index 97%rename from tests/paddle-discount-limit.test.cjsrename to tests/clis/paddle-discount-limit.test.cjsindex 88d375e..8f39d3c 100644--- a/tests/paddle-discount-limit.test.cjs+++ b/tests/clis/paddle-discount-limit.test.cjs@@ -2,7 +2,7 @@ const { test } = require('node:test')const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/paddle.js')+const cli = path.resolve(__dirname, '../../tools/clis/paddle.js')function run(args, fetch = false) {const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');diff --git a/tests/plausible-dates.test.cjs b/tests/clis/plausible-dates.test.cjssimilarity index 97%rename from tests/plausible-dates.test.cjsrename to tests/clis/plausible-dates.test.cjsindex f454809..7db18b7 100644--- a/tests/plausible-dates.test.cjs+++ b/tests/clis/plausible-dates.test.cjs@@ -2,7 +2,7 @@ const {test} = require('node:test')const assert = require('node:assert/strict')const {spawnSync} = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/plausible.js')+const cli = path.resolve(__dirname, '../../tools/clis/plausible.js')function run(args, oracle='') {const code = `global.fetch = async (url, options) => {const assert = require('node:assert/strict'); const parsed = new URL(url);diff --git a/tests/postmark-layout-template.test.cjs b/tests/clis/postmark-layout-template.test.cjssimilarity index 97%rename from tests/postmark-layout-template.test.cjsrename to tests/clis/postmark-layout-template.test.cjsindex f31272d..9586f12 100644--- a/tests/postmark-layout-template.test.cjs+++ b/tests/clis/postmark-layout-template.test.cjs@@ -3,7 +3,7 @@ const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')function run(vendor, args, fetch = true) {- const cli = path.resolve(__dirname, `../tools/clis/${vendor}.js`)+ const cli = path.resolve(__dirname, `../../tools/clis/${vendor}.js`)const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');return { status: 200, text: async () => JSON.stringify({ url, method: options.method, body: options.body ? JSON.parse(options.body) : null }) };diff --git a/tests/prospect-csv.test.cjs b/tests/clis/prospect-csv.test.cjssimilarity index 96%rename from tests/prospect-csv.test.cjsrename to tests/clis/prospect-csv.test.cjsindex 8d6f135..e5c5262 100644--- a/tests/prospect-csv.test.cjs+++ b/tests/clis/prospect-csv.test.cjs@@ -2,7 +2,7 @@ const { test } = require('node:test')const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/github-prospects.js')+const cli = path.resolve(__dirname, '../../tools/clis/github-prospects.js')function exportUsers(users, format) {const source = `global.fetch = async () => ({ ok: true, status: 200, headers: new Headers(), json: async () => ${JSON.stringify(users)} }); process.argv = ['node', ${JSON.stringify(cli)}, 'stargazers', 'example/repo', '--format', ${JSON.stringify(format)}]; require(${JSON.stringify(cli)});`const result = spawnSync(process.execPath, ['-e', source], { encoding: 'utf8' })diff --git a/tests/resend-webhook-endpoint.test.cjs b/tests/clis/resend-webhook-endpoint.test.cjssimilarity index 97%rename from tests/resend-webhook-endpoint.test.cjsrename to tests/clis/resend-webhook-endpoint.test.cjsindex b9710f9..3f3a350 100644--- a/tests/resend-webhook-endpoint.test.cjs+++ b/tests/clis/resend-webhook-endpoint.test.cjs@@ -3,7 +3,7 @@ const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')function run(vendor, args, fetch = true) {- const cli = path.resolve(__dirname, `../tools/clis/${vendor}.js`)+ const cli = path.resolve(__dirname, `../../tools/clis/${vendor}.js`)const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');return { status: 200, text: async () => JSON.stringify({ url, method: options.method, body: options.body ? JSON.parse(options.body) : null }) };diff --git a/tests/rewardful-update-id.test.cjs b/tests/clis/rewardful-update-id.test.cjssimilarity index 97%rename from tests/rewardful-update-id.test.cjsrename to tests/clis/rewardful-update-id.test.cjsindex 17bd52f..49dcf93 100644--- a/tests/rewardful-update-id.test.cjs+++ b/tests/clis/rewardful-update-id.test.cjs@@ -3,7 +3,7 @@ const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')function run(vendor, args, fetch = true) {- const cli = path.resolve(__dirname, `../tools/clis/${vendor}.js`)+ const cli = path.resolve(__dirname, `../../tools/clis/${vendor}.js`)const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');return { status: 200, text: async () => JSON.stringify({ url, method: options.method, body: options.body ? JSON.parse(options.body) : null }) };diff --git a/tests/semrush-csv.test.cjs b/tests/clis/semrush-csv.test.cjssimilarity index 96%rename from tests/semrush-csv.test.cjsrename to tests/clis/semrush-csv.test.cjsindex a0b1a83..989c8e7 100644--- a/tests/semrush-csv.test.cjs+++ b/tests/clis/semrush-csv.test.cjs@@ -3,7 +3,7 @@ const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/semrush.js')+const cli = path.resolve(__dirname, '../../tools/clis/semrush.js')function run(csv, options = {}) {const source = `global.fetch = async () => ({ok: ${options.ok !== false}, status: ${options.status || 200}, text: async () => ${JSON.stringify(csv)}}); process.argv = ['node', ${JSON.stringify(cli)}, 'domain', 'organic', '--domain', 'example.com']; require(${JSON.stringify(cli)});`const result = spawnSync(process.execPath, ['-e', source], {encoding: 'utf8', env: {...process.env, SEMRUSH_API_KEY: 'fixture-key'}})diff --git a/tests/sendgrid-dynamic-template.test.cjs b/tests/clis/sendgrid-dynamic-template.test.cjssimilarity index 97%rename from tests/sendgrid-dynamic-template.test.cjsrename to tests/clis/sendgrid-dynamic-template.test.cjsindex 8f94b48..5f2b1c7 100644--- a/tests/sendgrid-dynamic-template.test.cjs+++ b/tests/clis/sendgrid-dynamic-template.test.cjs@@ -2,7 +2,7 @@ const { test } = require('node:test')const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/sendgrid.js')+const cli = path.resolve(__dirname, '../../tools/clis/sendgrid.js')function run(args, fetch = false) {const source = `global.fetch = async (url, options) => {if (!${fetch}) throw new Error('Unexpected network request');diff --git a/tests/typeform-update.test.cjs b/tests/clis/typeform-update.test.cjssimilarity index 97%rename from tests/typeform-update.test.cjsrename to tests/clis/typeform-update.test.cjsindex 772a148..50c4d63 100644--- a/tests/typeform-update.test.cjs+++ b/tests/clis/typeform-update.test.cjs@@ -2,7 +2,7 @@ const { test } = require('node:test')const assert = require('node:assert/strict')const { spawnSync } = require('node:child_process')const path = require('node:path')-const cli = path.resolve(__dirname, '../tools/clis/typeform.js')+const cli = path.resolve(__dirname, '../../tools/clis/typeform.js')function run(args, fetchSource = "throw new Error('Unexpected network request')") {const source = `global.fetch = async (url, options) => { ${fetchSource} }; process.argv = ['node', ${JSON.stringify(cli)}, ...${JSON.stringify(args)}]; require(${JSON.stringify(cli)});`return spawnSync(process.execPath, ['-e', source], {