Skip to content

Commit 6d411ef

Browse files
authored
Merge branch 'main' into W-20893569-b2c-cli-unit-tests
2 parents 736994a + b4d62be commit 6d411ef

80 files changed

Lines changed: 7160 additions & 182 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "SalesforceCommerceCloud/b2c-developer-tooling" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [
10+
["@salesforce/b2c-cli", "@salesforce/b2c-tooling-sdk", "@salesforce/b2c-dx-mcp"]
11+
],
12+
"access": "public",
13+
"baseBranch": "main",
14+
"updateInternalDependencies": "patch",
15+
"ignore": ["@salesforce/b2c-plugin-example-config"]
16+
}

.changeset/setup-skills-command.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@salesforce/b2c-cli': minor
3+
'@salesforce/b2c-tooling-sdk': minor
4+
---
5+
6+
Add `b2c setup skills` command for installing agent skills to AI-powered IDEs (Claude Code, Cursor, Windsurf, VS Code/Copilot, Codex, OpenCode)

.changeset/sour-months-post.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@salesforce/b2c-cli': minor
3+
'@salesforce/b2c-tooling-sdk': minor
4+
---
5+
6+
adds package.json config source for project level shared config

.github/workflows/changesets.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Changesets
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
version:
12+
name: Create Version PR
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
26+
with:
27+
node-version: 22
28+
cache: 'pnpm'
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Create Release PR
34+
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
35+
with:
36+
version: pnpm changeset version
37+
title: 'Next Release: changelog and version packages'
38+
commit: 'chore: version packages'
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+' # Stable releases: v1.0.0, v2.1.3
7+
- 'v[0-9]+.[0-9]+.[0-9]+-*' # Pre-releases: v1.0.0-beta.1, v1.0.0-rc.1
8+
schedule:
9+
- cron: '0 2 * * 1-5' # Weekdays at 2 AM UTC (Mon-Fri)
10+
workflow_dispatch:
11+
inputs:
12+
release_type:
13+
description: 'Release type'
14+
required: true
15+
default: 'nightly'
16+
type: choice
17+
options:
18+
- nightly
19+
20+
jobs:
21+
publish:
22+
name: Publish
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: write # For creating GitHub releases
26+
id-token: write # Required for npm OIDC trusted publishers
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
30+
31+
- name: Determine release type
32+
id: release-type
33+
run: |
34+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
35+
echo "type=stable" >> $GITHUB_OUTPUT
36+
# Pre-release versions (v1.0.0-beta.1) publish to @next, stable to @latest
37+
if [[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-.+ ]]; then
38+
echo "tag=next" >> $GITHUB_OUTPUT
39+
echo "prerelease=true" >> $GITHUB_OUTPUT
40+
else
41+
echo "tag=latest" >> $GITHUB_OUTPUT
42+
echo "prerelease=false" >> $GITHUB_OUTPUT
43+
fi
44+
else
45+
echo "type=nightly" >> $GITHUB_OUTPUT
46+
echo "tag=nightly" >> $GITHUB_OUTPUT
47+
echo "prerelease=false" >> $GITHUB_OUTPUT
48+
fi
49+
50+
- name: Validate tag matches package version
51+
if: steps.release-type.outputs.type == 'stable'
52+
run: |
53+
TAG_VERSION="${GITHUB_REF_NAME#v}"
54+
PKG_VERSION=$(node -p "require('./packages/b2c-tooling-sdk/package.json').version")
55+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
56+
echo "Error: Tag version ($TAG_VERSION) does not match package version ($PKG_VERSION)"
57+
exit 1
58+
fi
59+
60+
- name: Setup pnpm
61+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
62+
63+
- name: Setup Node.js
64+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
65+
with:
66+
node-version: 22
67+
cache: 'pnpm'
68+
registry-url: 'https://registry.npmjs.org'
69+
70+
- name: Upgrade npm for trusted publishing
71+
run: npm install -g npm@latest
72+
73+
- name: Install dependencies
74+
run: pnpm install --frozen-lockfile
75+
76+
- name: Create snapshot versions
77+
if: steps.release-type.outputs.type == 'nightly'
78+
run: |
79+
SNAPSHOT="0.0.0-nightly.$(date +%Y%m%d%H%M%S)"
80+
for pkg in packages/b2c-tooling-sdk packages/b2c-cli packages/b2c-dx-mcp; do
81+
node -e "
82+
const fs = require('fs');
83+
const path = '$pkg/package.json';
84+
const pkg = JSON.parse(fs.readFileSync(path));
85+
pkg.version = '$SNAPSHOT';
86+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
87+
"
88+
done
89+
echo "Set snapshot version: $SNAPSHOT"
90+
91+
- name: Build packages
92+
run: pnpm run build
93+
94+
- name: Run tests
95+
run: pnpm run test
96+
97+
- name: Publish to npm
98+
run: |
99+
pnpm --filter @salesforce/b2c-tooling-sdk publish --provenance --no-git-checks --tag ${{ steps.release-type.outputs.tag }}
100+
pnpm --filter @salesforce/b2c-cli publish --provenance --no-git-checks --tag ${{ steps.release-type.outputs.tag }}
101+
# pnpm --filter @salesforce/b2c-dx-mcp publish --provenance --no-git-checks --tag ${{ steps.release-type.outputs.tag }}
102+
103+
- name: Extract changelog for release
104+
if: steps.release-type.outputs.type == 'stable'
105+
run: |
106+
VERSION="${GITHUB_REF_NAME#v}"
107+
108+
# Function to extract version section from a changelog
109+
extract_version() {
110+
awk -v ver="$1" '
111+
/^## / { if (found) exit; if ($2 == ver) found=1; next }
112+
found { print }
113+
' "$2"
114+
}
115+
116+
# Build combined release notes
117+
{
118+
echo "## @salesforce/b2c-cli"
119+
echo ""
120+
extract_version "$VERSION" packages/b2c-cli/CHANGELOG.md
121+
echo ""
122+
echo "## @salesforce/b2c-dx-mcp"
123+
echo ""
124+
extract_version "$VERSION" packages/b2c-dx-mcp/CHANGELOG.md
125+
echo ""
126+
echo "## @salesforce/b2c-tooling-sdk"
127+
echo ""
128+
extract_version "$VERSION" packages/b2c-tooling-sdk/CHANGELOG.md
129+
} > /tmp/release-notes.md
130+
131+
- name: Create GitHub Release
132+
if: steps.release-type.outputs.type == 'stable'
133+
run: |
134+
PRERELEASE_FLAG=""
135+
if [[ "${{ steps.release-type.outputs.prerelease }}" == "true" ]]; then
136+
PRERELEASE_FLAG="--prerelease"
137+
fi
138+
gh release create "$GITHUB_REF_NAME" --notes-file /tmp/release-notes.md $PRERELEASE_FLAG
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
142+
- name: Package skills artifacts
143+
if: steps.release-type.outputs.type == 'stable'
144+
run: |
145+
# Create b2c-skills.zip containing plugins/b2c/skills/
146+
cd plugins/b2c && zip -r ../../b2c-skills.zip skills/
147+
cd ../..
148+
# Create b2c-cli-skills.zip containing plugins/b2c-cli/skills/
149+
cd plugins/b2c-cli && zip -r ../../b2c-cli-skills.zip skills/
150+
cd ../..
151+
echo "Created skills artifacts:"
152+
ls -la *.zip
153+
154+
- name: Upload skills to release
155+
if: steps.release-type.outputs.type == 'stable'
156+
run: |
157+
gh release upload "$GITHUB_REF_NAME" b2c-skills.zip b2c-cli-skills.zip
158+
env:
159+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

AGENTS.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,32 @@ pnpm run test # Run all tests
101101
pnpm --filter @salesforce/b2c-tooling-sdk run test # Test specific package
102102
pnpm mocha "test/clients/webdav.test.ts" # Single file (no coverage)
103103
```
104+
105+
## Changesets
106+
107+
This project uses [Changesets](https://github.com/changesets/changesets) for version management. When making changes that affect users, create a changeset:
108+
109+
Changeset guidelines:
110+
- Create a changeset for any user-facing changes (features, bug fixes); typically in new pull requests;
111+
- a pull request can have multiple changesets
112+
- Select the appropriate semver bump: `patch` (bug fixes) or `minor` (new features)
113+
- This is a pre-1.0 preview release, so there are no `major` breaking change bumps
114+
- Good changesets explain:
115+
- WHAT the change is
116+
- WHY the change was made
117+
- HOW a consumer should update their code
118+
- Good changesets are brief and user-focused (not contributor); they are generally 1 line or a short paragraph for detailed changes
119+
120+
create a changeset file directly in `.changeset/` with a unique filename (e.g., `descriptive-change-name.md`):
121+
122+
```md
123+
---
124+
'@salesforce/b2c-cli': patch
125+
'@salesforce/b2c-tooling-sdk': patch
126+
---
127+
128+
Description of the change explaining WHAT, WHY, and HOW to update
129+
```
130+
131+
- Include only the packages that were modified
132+
- Use `patch` for bug fixes, `minor` for new features

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,48 @@ Issues labelled `good first contribution`.
5858
- [x] Reviews
5959
- Changes must be approved via peer code review
6060

61+
# Changesets
62+
63+
This project uses [Changesets](https://github.com/changesets/changesets) to manage versions and changelogs.
64+
65+
## When to Add a Changeset
66+
67+
Add a changeset when your PR includes changes that users should know about:
68+
- Bug fixes
69+
- New features
70+
- Breaking changes
71+
- Significant improvements
72+
73+
You **don't need** a changeset for:
74+
- Documentation-only changes
75+
- Internal refactoring
76+
- Test improvements
77+
- CI/build changes
78+
79+
## How to Add a Changeset
80+
81+
1. Run the changeset command:
82+
```bash
83+
pnpm changeset
84+
```
85+
86+
2. Select the packages affected by your change (usually all three are linked)
87+
88+
3. Choose the change type:
89+
- `patch` - Bug fixes, minor improvements
90+
- `minor` - New features, non-breaking changes
91+
- `major` - Breaking changes
92+
93+
4. Write a brief summary of your change (this appears in the changelog)
94+
95+
5. Commit the generated `.changeset/*.md` file with your PR
96+
97+
## Notes
98+
99+
- Changesets are optional - maintainers can add them later if needed
100+
- Multiple changesets can exist for separate changes
101+
- See [PUBLISHING.md](./PUBLISHING.md) for full release process details
102+
61103
# Creating a Pull Request
62104

63105
1. **Ensure the bug/feature was not already reported** by searching on GitHub under Issues. If none exists, create a new issue so that other contributors can keep track of what you are trying to add/fix and offer suggestions (or let you know if there is already an effort in progress).

0 commit comments

Comments
 (0)