@contractspec/action.drift 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +121 -0
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/action.yml +222 -0
- package/package.json +34 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fix: publish with bun
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @contractspec/bundle.workspace@1.60.0
|
|
13
|
+
- @contractspec/lib.contracts@1.60.0
|
|
14
|
+
|
|
15
|
+
## 0.8.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 1a0cf44: fix: publishConfig not supported by bun
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [1a0cf44]
|
|
24
|
+
- @contractspec/bundle.workspace@1.59.0
|
|
25
|
+
- @contractspec/lib.contracts@1.59.0
|
|
26
|
+
|
|
27
|
+
## 0.7.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- d1f0fd0: chore: Migrate non-app package builds from tsdown to shared Bun tooling, add `@contractspec/tool.bun`, and standardize `prebuild`/`build`/`typecheck` with platform-aware exports and `tsc` declaration emission into `dist`.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [d1f0fd0]
|
|
36
|
+
- Updated dependencies [4355a9e]
|
|
37
|
+
- @contractspec/bundle.workspace@1.58.0
|
|
38
|
+
- @contractspec/lib.contracts@1.58.0
|
|
39
|
+
|
|
40
|
+
## 0.6.0
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- 4651e06: Add Supabase and voice provider integrations with new runnable examples, and expose these providers across contracts, workspace tooling, and provider factory wiring.
|
|
45
|
+
- 11a5a05: feat: improve product intent
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [8ecf3c1]
|
|
50
|
+
- Updated dependencies [47c48c2]
|
|
51
|
+
- Updated dependencies [a119963]
|
|
52
|
+
- Updated dependencies [4651e06]
|
|
53
|
+
- Updated dependencies [ad9d10a]
|
|
54
|
+
- Updated dependencies [11a5a05]
|
|
55
|
+
- @contractspec/lib.contracts@1.57.0
|
|
56
|
+
- @contractspec/bundle.workspace@1.57.0
|
|
57
|
+
|
|
58
|
+
## 0.5.1
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- fix: improve publish config
|
|
63
|
+
- Updated dependencies
|
|
64
|
+
- @contractspec/bundle.workspace@1.56.1
|
|
65
|
+
- @contractspec/lib.contracts@1.56.1
|
|
66
|
+
|
|
67
|
+
## 0.5.0
|
|
68
|
+
|
|
69
|
+
### Minor Changes
|
|
70
|
+
|
|
71
|
+
- fix: release
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies
|
|
76
|
+
- @contractspec/bundle.workspace@1.56.0
|
|
77
|
+
- @contractspec/lib.contracts@1.56.0
|
|
78
|
+
|
|
79
|
+
## 0.4.0
|
|
80
|
+
|
|
81
|
+
### Minor Changes
|
|
82
|
+
|
|
83
|
+
- fix: unpublished packages
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- Updated dependencies
|
|
88
|
+
- @contractspec/bundle.workspace@1.55.0
|
|
89
|
+
- @contractspec/lib.contracts@1.55.0
|
|
90
|
+
|
|
91
|
+
## 0.3.0
|
|
92
|
+
|
|
93
|
+
### Minor Changes
|
|
94
|
+
|
|
95
|
+
- ec5e95c: chore: upgrade dependencies
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- Updated dependencies [ec5e95c]
|
|
100
|
+
- @contractspec/lib.contracts@1.54.0
|
|
101
|
+
- @contractspec/bundle.workspace@1.54.0
|
|
102
|
+
|
|
103
|
+
## 0.2.0
|
|
104
|
+
|
|
105
|
+
### Minor Changes
|
|
106
|
+
|
|
107
|
+
- 89d3402: Add new ContractSpec PR and drift actions as the primary automation entrypoints.
|
|
108
|
+
- f4180d4: fix: performance improvement
|
|
109
|
+
- 64d84e1: Add contract-level verification table to impact reports. Defines query and data view contracts for per-contract drift status, surfaces covered, and last verified commit. Reports render the table when contracts data is present; backward compatible when absent.
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Updated dependencies [5b371b1]
|
|
114
|
+
- Updated dependencies [f4180d4]
|
|
115
|
+
- Updated dependencies [64d84e1]
|
|
116
|
+
- @contractspec/lib.contracts@1.53.0
|
|
117
|
+
- @contractspec/bundle.workspace@1.53.0
|
|
118
|
+
|
|
119
|
+
## 0.1.0
|
|
120
|
+
|
|
121
|
+
- Initial release.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chaman Ventures, SASU
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# ContractSpec Drift Action
|
|
2
|
+
|
|
3
|
+
Detect drift between generated artifacts and committed sources.
|
|
4
|
+
|
|
5
|
+
Website: https://contractspec.io/
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
name: ContractSpec Drift
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
push:
|
|
14
|
+
branches: [main]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
contractspec:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: ContractSpec drift check
|
|
25
|
+
uses: lssm-tech/contractspec/packages/apps/action-drift@main
|
|
26
|
+
with:
|
|
27
|
+
generate-command: 'bun contractspec generate'
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Inputs
|
|
31
|
+
|
|
32
|
+
| Input | Description | Default |
|
|
33
|
+
| ----------------------- | ------------------------------- | --------------------- |
|
|
34
|
+
| `package-manager` | `bun`, `npm`, `pnpm`, `yarn` | `bun` |
|
|
35
|
+
| `working-directory` | Repo root or package path | `.` |
|
|
36
|
+
| `generate-command` | Command to regenerate artifacts | required |
|
|
37
|
+
| `on-drift` | `fail`, `issue`, `pr` | `fail` |
|
|
38
|
+
| `drift-paths-allowlist` | Comma-separated glob patterns | empty |
|
|
39
|
+
| `token` | GitHub token for issues/PRs | `${{ github.token }}` |
|
|
40
|
+
|
|
41
|
+
## Outputs
|
|
42
|
+
|
|
43
|
+
| Output | Description |
|
|
44
|
+
| ---------------- | -------------------------- |
|
|
45
|
+
| `drift-detected` | Whether drift was detected |
|
package/action.yml
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
name: 'ContractSpec Drift'
|
|
2
|
+
description: 'Detect ContractSpec drift on main or scheduled runs'
|
|
3
|
+
author: 'LSSM'
|
|
4
|
+
branding:
|
|
5
|
+
icon: 'alert-triangle'
|
|
6
|
+
color: 'blue'
|
|
7
|
+
|
|
8
|
+
inputs:
|
|
9
|
+
package-manager:
|
|
10
|
+
description: 'Package manager to use (bun|npm|pnpm|yarn)'
|
|
11
|
+
required: false
|
|
12
|
+
default: 'bun'
|
|
13
|
+
working-directory:
|
|
14
|
+
description: 'Working directory for running commands'
|
|
15
|
+
required: false
|
|
16
|
+
default: '.'
|
|
17
|
+
generate-command:
|
|
18
|
+
description: 'Command to regenerate artifacts'
|
|
19
|
+
required: true
|
|
20
|
+
default: 'bun contractspec generate'
|
|
21
|
+
on-drift:
|
|
22
|
+
description: 'Behavior when drift is detected (fail|issue|pr)'
|
|
23
|
+
required: false
|
|
24
|
+
default: 'fail'
|
|
25
|
+
drift-paths-allowlist:
|
|
26
|
+
description: 'Comma-separated glob patterns to check for drift'
|
|
27
|
+
required: false
|
|
28
|
+
default: ''
|
|
29
|
+
token:
|
|
30
|
+
description: 'GitHub token for issues/PRs'
|
|
31
|
+
required: false
|
|
32
|
+
default: '${{ github.token }}'
|
|
33
|
+
|
|
34
|
+
outputs:
|
|
35
|
+
drift-detected:
|
|
36
|
+
description: 'Whether drift was detected'
|
|
37
|
+
value: ${{ steps.result.outputs.drift_detected }}
|
|
38
|
+
|
|
39
|
+
runs:
|
|
40
|
+
using: 'composite'
|
|
41
|
+
steps:
|
|
42
|
+
- name: Set action defaults
|
|
43
|
+
shell: bash
|
|
44
|
+
run: |
|
|
45
|
+
echo "PACKAGE_MANAGER=${{ inputs.package-manager }}" >> $GITHUB_ENV
|
|
46
|
+
echo "WORKING_DIRECTORY=${{ inputs.working-directory }}" >> $GITHUB_ENV
|
|
47
|
+
echo "GENERATE_COMMAND=${{ inputs.generate-command }}" >> $GITHUB_ENV
|
|
48
|
+
echo "ON_DRIFT=${{ inputs.on-drift }}" >> $GITHUB_ENV
|
|
49
|
+
echo "DRIFT_ALLOWLIST=${{ inputs.drift-paths-allowlist }}" >> $GITHUB_ENV
|
|
50
|
+
echo "COMMENT_TOKEN=${{ inputs.token }}" >> $GITHUB_ENV
|
|
51
|
+
echo "TURBO_TELEMETRY_DISABLED=1" >> $GITHUB_ENV
|
|
52
|
+
echo "DO_NOT_TRACK=1" >> $GITHUB_ENV
|
|
53
|
+
|
|
54
|
+
echo "TURBO_TOKEN=${{ env.TURBO_TOKEN }}" >> $GITHUB_ENV
|
|
55
|
+
echo "TURBO_TEAM=${{ env.TURBO_TEAM }}" >> $GITHUB_ENV
|
|
56
|
+
|
|
57
|
+
- name: Setup Bun
|
|
58
|
+
if: env.PACKAGE_MANAGER == 'bun'
|
|
59
|
+
uses: oven-sh/setup-bun@v2
|
|
60
|
+
with:
|
|
61
|
+
bun-version: 'latest'
|
|
62
|
+
|
|
63
|
+
- name: Setup Node
|
|
64
|
+
if: env.PACKAGE_MANAGER != 'bun'
|
|
65
|
+
uses: actions/setup-node@v4
|
|
66
|
+
with:
|
|
67
|
+
node-version: '20'
|
|
68
|
+
|
|
69
|
+
- name: Configure ContractSpec command
|
|
70
|
+
shell: bash
|
|
71
|
+
run: |
|
|
72
|
+
case "$PACKAGE_MANAGER" in
|
|
73
|
+
bun)
|
|
74
|
+
echo "CONTRACTSPEC_CMD=bunx contractspec" >> $GITHUB_ENV
|
|
75
|
+
;;
|
|
76
|
+
npm)
|
|
77
|
+
echo "CONTRACTSPEC_CMD=npx contractspec" >> $GITHUB_ENV
|
|
78
|
+
;;
|
|
79
|
+
pnpm)
|
|
80
|
+
echo "CONTRACTSPEC_CMD=pnpm dlx contractspec" >> $GITHUB_ENV
|
|
81
|
+
;;
|
|
82
|
+
yarn)
|
|
83
|
+
echo "CONTRACTSPEC_CMD=yarn dlx contractspec" >> $GITHUB_ENV
|
|
84
|
+
;;
|
|
85
|
+
*)
|
|
86
|
+
echo "::error::Unsupported package-manager: $PACKAGE_MANAGER"
|
|
87
|
+
exit 1
|
|
88
|
+
;;
|
|
89
|
+
esac
|
|
90
|
+
|
|
91
|
+
- name: Install dependencies
|
|
92
|
+
shell: bash
|
|
93
|
+
working-directory: ${{ env.WORKING_DIRECTORY }}
|
|
94
|
+
run: |
|
|
95
|
+
case "$PACKAGE_MANAGER" in
|
|
96
|
+
bun)
|
|
97
|
+
if [ -f "bun.lock" ] || [ -f "bun.lockb" ]; then
|
|
98
|
+
bun install --frozen-lockfile
|
|
99
|
+
else
|
|
100
|
+
bun install
|
|
101
|
+
fi
|
|
102
|
+
;;
|
|
103
|
+
npm)
|
|
104
|
+
if [ -f "package-lock.json" ]; then
|
|
105
|
+
npm ci
|
|
106
|
+
else
|
|
107
|
+
npm install
|
|
108
|
+
fi
|
|
109
|
+
;;
|
|
110
|
+
pnpm)
|
|
111
|
+
corepack enable
|
|
112
|
+
pnpm install --frozen-lockfile
|
|
113
|
+
;;
|
|
114
|
+
yarn)
|
|
115
|
+
corepack enable
|
|
116
|
+
yarn install --frozen-lockfile
|
|
117
|
+
;;
|
|
118
|
+
esac
|
|
119
|
+
|
|
120
|
+
- name: Build local ContractSpec CLI (if present)
|
|
121
|
+
if: env.PACKAGE_MANAGER == 'bun'
|
|
122
|
+
shell: bash
|
|
123
|
+
working-directory: ${{ env.WORKING_DIRECTORY }}
|
|
124
|
+
run: |
|
|
125
|
+
if [ -f "packages/apps/cli-contractspec/package.json" ]; then
|
|
126
|
+
bun run build --filter=@contractspec/app.cli-contractspec
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
- name: Run generate command
|
|
130
|
+
shell: bash
|
|
131
|
+
working-directory: ${{ env.WORKING_DIRECTORY }}
|
|
132
|
+
run: |
|
|
133
|
+
if [ -z "$GENERATE_COMMAND" ]; then
|
|
134
|
+
echo "::error::generate-command is required for drift checks"
|
|
135
|
+
exit 1
|
|
136
|
+
fi
|
|
137
|
+
bash -lc "$GENERATE_COMMAND"
|
|
138
|
+
|
|
139
|
+
- name: Check drift
|
|
140
|
+
shell: bash
|
|
141
|
+
working-directory: ${{ env.WORKING_DIRECTORY }}
|
|
142
|
+
run: |
|
|
143
|
+
mkdir -p .contractspec-ci
|
|
144
|
+
git status --porcelain > .contractspec-ci/drift-status.txt
|
|
145
|
+
$CONTRACTSPEC_CMD action-drift check-drift
|
|
146
|
+
|
|
147
|
+
- name: Build report data
|
|
148
|
+
shell: bash
|
|
149
|
+
working-directory: ${{ env.WORKING_DIRECTORY }}
|
|
150
|
+
run: |
|
|
151
|
+
# Collect contract verification status
|
|
152
|
+
echo "Collecting contract verification status..."
|
|
153
|
+
$CONTRACTSPEC_CMD action-pr get-contract-status
|
|
154
|
+
|
|
155
|
+
# Build report data
|
|
156
|
+
$CONTRACTSPEC_CMD action-drift build-report-data
|
|
157
|
+
|
|
158
|
+
- name: Generate report
|
|
159
|
+
shell: bash
|
|
160
|
+
working-directory: ${{ env.WORKING_DIRECTORY }}
|
|
161
|
+
run: |
|
|
162
|
+
$CONTRACTSPEC_CMD action-pr generate-report
|
|
163
|
+
|
|
164
|
+
- name: Create issue
|
|
165
|
+
if: env.DRIFT_DETECTED == 'true' && env.ON_DRIFT == 'issue'
|
|
166
|
+
uses: actions/github-script@v7
|
|
167
|
+
with:
|
|
168
|
+
github-token: ${{ env.COMMENT_TOKEN }}
|
|
169
|
+
script: |
|
|
170
|
+
const fs = require("fs");
|
|
171
|
+
const body = fs.readFileSync(
|
|
172
|
+
`${process.env.WORKING_DIRECTORY}/.contractspec-ci/report.md`,
|
|
173
|
+
"utf8",
|
|
174
|
+
);
|
|
175
|
+
const title = "ContractSpec drift detected";
|
|
176
|
+
|
|
177
|
+
const { data: issues } = await github.rest.issues.listForRepo({
|
|
178
|
+
owner: context.repo.owner,
|
|
179
|
+
repo: context.repo.repo,
|
|
180
|
+
state: "open",
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const existing = issues.find((issue) => issue.title === title);
|
|
184
|
+
if (existing) {
|
|
185
|
+
await github.rest.issues.createComment({
|
|
186
|
+
owner: context.repo.owner,
|
|
187
|
+
repo: context.repo.repo,
|
|
188
|
+
issue_number: existing.number,
|
|
189
|
+
body,
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
await github.rest.issues.create({
|
|
193
|
+
owner: context.repo.owner,
|
|
194
|
+
repo: context.repo.repo,
|
|
195
|
+
title,
|
|
196
|
+
body,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
- name: Create drift PR
|
|
201
|
+
if: env.DRIFT_DETECTED == 'true' && env.ON_DRIFT == 'pr'
|
|
202
|
+
shell: bash
|
|
203
|
+
working-directory: ${{ env.WORKING_DIRECTORY }}
|
|
204
|
+
env:
|
|
205
|
+
GH_TOKEN: ${{ env.COMMENT_TOKEN }}
|
|
206
|
+
run: |
|
|
207
|
+
BRANCH="contractspec/drift-$(date +%Y%m%d%H%M%S)"
|
|
208
|
+
git checkout -b "$BRANCH"
|
|
209
|
+
git add -A
|
|
210
|
+
git commit -m "chore(contractspec): fix drift"
|
|
211
|
+
git push origin "$BRANCH"
|
|
212
|
+
gh pr create \
|
|
213
|
+
--title "chore(contractspec): fix drift" \
|
|
214
|
+
--body-file .contractspec-ci/report.md \
|
|
215
|
+
--base "${{ github.event.repository.default_branch }}" \
|
|
216
|
+
--head "$BRANCH"
|
|
217
|
+
|
|
218
|
+
- name: Finalize results
|
|
219
|
+
id: result
|
|
220
|
+
shell: bash
|
|
221
|
+
run: |
|
|
222
|
+
$CONTRACTSPEC_CMD action-drift finalize
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contractspec/action.drift",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "GitHub Action for ContractSpec drift detection",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/lssm-tech/contractspec.git",
|
|
8
|
+
"directory": "packages/apps/action-drift"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"github-action",
|
|
12
|
+
"contractspec",
|
|
13
|
+
"drift",
|
|
14
|
+
"generate"
|
|
15
|
+
],
|
|
16
|
+
"author": "LSSM",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@contractspec/lib.contracts": "1.60.0",
|
|
20
|
+
"@contractspec/bundle.workspace": "1.60.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@contractspec/tool.typescript": "1.60.0",
|
|
24
|
+
"@types/bun": "^1.3.8",
|
|
25
|
+
"@types/node": "^25.2.1",
|
|
26
|
+
"eslint": "^9.39.2",
|
|
27
|
+
"typescript": "^5.9.3"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"registry": "https://registry.npmjs.org/",
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://contractspec.io"
|
|
34
|
+
}
|