Skip to content

Commit 1e8ec00

Browse files
authored
claude marketplace skeleton and preview release build (#22)
1 parent 0659d4c commit 1e8ec00

4 files changed

Lines changed: 216 additions & 0 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "b2c-developer-tooling",
3+
"description": "B2C Developer Tooling plugins for enhanced development workflows.",
4+
"version": "0.0.1",
5+
"owner": {
6+
"name": "Salesforce Agentforce Commerce",
7+
"email": "clavery@salesforce.com"
8+
},
9+
"plugins": [
10+
{
11+
"name": "b2c-cli",
12+
"description": "B2C CLI Skills for Salesforce Commerce Cloud development.",
13+
"author": {
14+
"name": "Salesforce"
15+
},
16+
"license": "Apache-2.0",
17+
"source": "./plugins/b2c-cli",
18+
"category": "productivity",
19+
"strict": false
20+
}
21+
]
22+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// @ts-check
2+
3+
/**
4+
* Creates a GitHub preview release and uploads tgz assets.
5+
*
6+
* @param {Object} params
7+
* @param {import('@octokit/rest').Octokit} params.github - Octokit instance
8+
* @param {Object} params.context - GitHub Actions context
9+
* @param {string} params.version - Version string (e.g., "0.0.1-preview.1")
10+
* @param {string} params.distDir - Directory containing tgz files
11+
*/
12+
export async function createPreviewRelease({ github, context, version, distDir }) {
13+
const fs = await import('fs');
14+
const path = await import('path');
15+
16+
const tagName = `v${version}`;
17+
18+
const releaseBody = `## Preview Release ${tagName}
19+
20+
### Installation
21+
22+
Download both tgz files and install them together:
23+
24+
\`\`\`bash
25+
npm install ./salesforce-b2c-tooling-sdk-${version}.tgz \\
26+
./salesforce-b2c-cli-${version}.tgz
27+
\`\`\`
28+
29+
Or install globally:
30+
31+
\`\`\`bash
32+
npm install -g ./salesforce-b2c-tooling-sdk-${version}.tgz \\
33+
./salesforce-b2c-cli-${version}.tgz
34+
\`\`\`
35+
36+
> **Note:** Both packages must be installed together since the CLI depends on the SDK.
37+
`;
38+
39+
// Create the release
40+
const release = await github.rest.repos.createRelease({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
tag_name: tagName,
44+
name: tagName,
45+
prerelease: true,
46+
generate_release_notes: true,
47+
body: releaseBody,
48+
});
49+
50+
console.log(`Created release: ${release.data.html_url}`);
51+
52+
// Upload all tgz files from dist/
53+
const files = fs.readdirSync(distDir).filter((f) => f.endsWith('.tgz'));
54+
55+
for (const file of files) {
56+
const filePath = path.join(distDir, file);
57+
const fileData = fs.readFileSync(filePath);
58+
59+
console.log(`Uploading ${file}...`);
60+
61+
await github.rest.repos.uploadReleaseAsset({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
release_id: release.data.id,
65+
name: file,
66+
data: fileData,
67+
});
68+
69+
console.log(`Uploaded ${file}`);
70+
}
71+
72+
console.log(`Release complete: ${release.data.html_url}`);
73+
return release.data.html_url;
74+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Preview Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*-preview*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22.x
23+
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: 10.17.1
28+
29+
- name: Get pnpm store directory
30+
shell: bash
31+
run: |
32+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
33+
34+
- name: Setup pnpm cache
35+
uses: actions/cache@v4
36+
with:
37+
path: ${{ env.STORE_PATH }}
38+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39+
restore-keys: |
40+
${{ runner.os }}-pnpm-store-
41+
42+
- name: Extract version from tag
43+
run: |
44+
VERSION=${GITHUB_REF#refs/tags/v}
45+
echo "VERSION=$VERSION" >> $GITHUB_ENV
46+
echo "Releasing version: $VERSION"
47+
48+
- name: Update package versions
49+
run: |
50+
pnpm -r exec -- npm pkg set version=${{ env.VERSION }}
51+
52+
- name: Install dependencies
53+
run: pnpm install --frozen-lockfile
54+
55+
- name: Build packages
56+
run: pnpm -r run build
57+
58+
- name: Run tests
59+
run: pnpm -r run test:unit
60+
61+
- name: Pack all packages
62+
run: |
63+
mkdir -p dist
64+
pnpm pack -r --pack-destination ./dist
65+
66+
- name: List packed files
67+
run: ls -la dist/
68+
69+
- name: Create Release and Upload Assets
70+
uses: actions/github-script@v7
71+
with:
72+
script: |
73+
const { createPreviewRelease } = await import('${{ github.workspace }}/.github/scripts/create-preview-release.js');
74+
await createPreviewRelease({
75+
github,
76+
context,
77+
version: process.env.VERSION,
78+
distDir: './dist'
79+
});
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: b2c-ods
3+
description: Salesforce B2C Commerce On-demand sandbox (ODS) management Skill
4+
---
5+
6+
# B2C ODS Skill
7+
8+
Use the `b2c` CLI plugin to manage Salesforce B2C Commerce On-demand sandboxes (ODS). Only create or delete a sandbox if explicitly asked as this may be a billable or destructible action.
9+
10+
## Examples
11+
12+
### List ODS Sandboxes
13+
14+
```bash
15+
b2c ods list
16+
17+
# for realm zzpq with JSON output
18+
b2c ods list --realm zzpq --output json
19+
20+
# filter by status and those created by a specific user, only print the columns id,state,hostname
21+
b2c ods list --filter-params 'state=started,creating&createdBy=clavery@salesforce.com' --realm zzpq --columns id,state,hostname
22+
```
23+
24+
### Create ODS Sandbox
25+
26+
Only create a sandbox if explicitly asked as this may be a billable action.
27+
28+
```bash
29+
# create in realm zzpq with 4 hour TTL (0 = infinite); json output and wait for completion (this may take 5-10 minutes; timeout is 10 minutes)
30+
b2c ods create --realm zzpq --ttl 4 --json --wait
31+
32+
# create in realm zzpq with large profile (medium is default)
33+
b2c ods create --realm zzpq --profile large
34+
35+
# get full log trace output to debug
36+
b2c ods create --realm zzpq --log-level trace
37+
```
38+
39+
### More Commands
40+
41+
See `b2c ods --help` for a full list of available commands and options in the `ods` topic.

0 commit comments

Comments
 (0)