buildx-cli 1.0.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/.github/workflows/auto-publish.yml +242 -0
- package/.github/workflows/create-pr.yml +182 -0
- package/.prettierrc +8 -0
- package/README.md +179 -0
- package/dist/index.cjs +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +21 -0
- package/eslint.config.mjs +119 -0
- package/jest.config.js +16 -0
- package/package.json +69 -0
- package/rollup.config.mjs +64 -0
- package/src/__tests__/config.test.ts +102 -0
- package/src/commands/auth/login.ts +148 -0
- package/src/commands/auth/logout.ts +16 -0
- package/src/commands/auth/status.ts +52 -0
- package/src/commands/config/clear.ts +16 -0
- package/src/commands/config/index.ts +10 -0
- package/src/commands/config/setup.ts +75 -0
- package/src/commands/config/show.ts +70 -0
- package/src/commands/projects/current.ts +36 -0
- package/src/commands/projects/list.ts +61 -0
- package/src/commands/projects/set-default.ts +33 -0
- package/src/commands/sync.ts +64 -0
- package/src/config/index.ts +154 -0
- package/src/index.ts +49 -0
- package/src/services/api.ts +132 -0
- package/src/services/schema-generator.ts +132 -0
- package/src/types/index.ts +91 -0
- package/src/utils/logger.ts +29 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
name: Auto Publish and Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- '**.md'
|
|
9
|
+
- 'README.md'
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
packages: write
|
|
15
|
+
pages: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
19
|
+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
20
|
+
concurrency:
|
|
21
|
+
group: "pages"
|
|
22
|
+
cancel-in-progress: false
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
publish:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
environment: production
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout code
|
|
30
|
+
uses: actions/checkout@v4
|
|
31
|
+
with:
|
|
32
|
+
fetch-depth: 0
|
|
33
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
34
|
+
|
|
35
|
+
- name: Setup Node.js
|
|
36
|
+
uses: actions/setup-node@v4
|
|
37
|
+
with:
|
|
38
|
+
node-version: '22'
|
|
39
|
+
registry-url: 'https://registry.npmjs.org'
|
|
40
|
+
cache: 'yarn'
|
|
41
|
+
|
|
42
|
+
- name: Check if NPM_TOKEN is set
|
|
43
|
+
run: |
|
|
44
|
+
if [ -z "$NPM_TOKEN" ]; then
|
|
45
|
+
echo "NPM_TOKEN is not set"
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
echo "NPM_TOKEN is set"
|
|
49
|
+
echo "Token length: ${#NPM_TOKEN}"
|
|
50
|
+
env:
|
|
51
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
52
|
+
|
|
53
|
+
- name: Setup npm authentication
|
|
54
|
+
run: |
|
|
55
|
+
echo "Setting up npm authentication..."
|
|
56
|
+
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
|
57
|
+
echo "NPM authentication configured"
|
|
58
|
+
echo "Testing authentication..."
|
|
59
|
+
npm whoami
|
|
60
|
+
env:
|
|
61
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
62
|
+
|
|
63
|
+
- name: Install dependencies with dev dependencies
|
|
64
|
+
run: yarn install
|
|
65
|
+
|
|
66
|
+
- name: Run validate
|
|
67
|
+
run: yarn validate
|
|
68
|
+
|
|
69
|
+
- name: Determine version bump type
|
|
70
|
+
id: version-bump
|
|
71
|
+
run: |
|
|
72
|
+
# Get the last commit message
|
|
73
|
+
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
74
|
+
echo "Commit message: $COMMIT_MSG"
|
|
75
|
+
|
|
76
|
+
# Check for version bump indicators in commit message
|
|
77
|
+
if echo "$COMMIT_MSG" | grep -q "\[major\]\|\[breaking\]"; then
|
|
78
|
+
echo "bump_type=major" >> $GITHUB_OUTPUT
|
|
79
|
+
echo "Version bump: MAJOR (from commit message)"
|
|
80
|
+
elif echo "$COMMIT_MSG" | grep -q "\[minor\]\|\[feature\]"; then
|
|
81
|
+
echo "bump_type=minor" >> $GITHUB_OUTPUT
|
|
82
|
+
echo "Version bump: MINOR (from commit message)"
|
|
83
|
+
elif echo "$COMMIT_MSG" | grep -q "\[patch\]\|\[fix\]\|\[bug\]"; then
|
|
84
|
+
echo "bump_type=patch" >> $GITHUB_OUTPUT
|
|
85
|
+
echo "Version bump: PATCH (from commit message)"
|
|
86
|
+
else
|
|
87
|
+
echo "bump_type=patch" >> $GITHUB_OUTPUT
|
|
88
|
+
echo "Version bump: PATCH (automatic fallback)"
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
- name: Bump version and publish
|
|
92
|
+
run: |
|
|
93
|
+
# Configure git
|
|
94
|
+
git config --local user.email "action@github.com"
|
|
95
|
+
git config --local user.name "GitHub Action"
|
|
96
|
+
|
|
97
|
+
# Get bump type
|
|
98
|
+
BUMP_TYPE=${{ steps.version-bump.outputs.bump_type }}
|
|
99
|
+
|
|
100
|
+
# Show current version
|
|
101
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
102
|
+
echo "Current version: $CURRENT_VERSION"
|
|
103
|
+
|
|
104
|
+
# Show package info
|
|
105
|
+
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
106
|
+
echo "Package name: $PACKAGE_NAME"
|
|
107
|
+
|
|
108
|
+
# Check npm registry
|
|
109
|
+
echo "NPM registry: $(npm config get registry)"
|
|
110
|
+
|
|
111
|
+
# Check if logged in
|
|
112
|
+
echo "NPM whoami:"
|
|
113
|
+
npm whoami || echo "Not logged in to npm"
|
|
114
|
+
|
|
115
|
+
# Bump version using yarn (without git operations)
|
|
116
|
+
yarn version --$BUMP_TYPE --message "chore: bump version to $NEW_VERSION [skip ci]"
|
|
117
|
+
|
|
118
|
+
# Get new version
|
|
119
|
+
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
120
|
+
echo "New version: $NEW_VERSION"
|
|
121
|
+
|
|
122
|
+
# Build project
|
|
123
|
+
yarn build
|
|
124
|
+
|
|
125
|
+
# Push changes
|
|
126
|
+
git push origin HEAD:main
|
|
127
|
+
|
|
128
|
+
# Create and push tag
|
|
129
|
+
git push origin "v$NEW_VERSION"
|
|
130
|
+
|
|
131
|
+
# Publish to npm using yarn with public access
|
|
132
|
+
echo "Publishing to npm..."
|
|
133
|
+
echo "Package: $PACKAGE_NAME"
|
|
134
|
+
echo "Version: $NEW_VERSION"
|
|
135
|
+
|
|
136
|
+
npm publish ./build --access public
|
|
137
|
+
|
|
138
|
+
echo "✅ Published version $NEW_VERSION to npm"
|
|
139
|
+
env:
|
|
140
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
141
|
+
|
|
142
|
+
- name: Generate documentation
|
|
143
|
+
run: |
|
|
144
|
+
echo "Generating documentation..."
|
|
145
|
+
yarn docs:clean
|
|
146
|
+
yarn docs
|
|
147
|
+
echo "✅ Documentation generated"
|
|
148
|
+
|
|
149
|
+
- name: Commit and push documentation
|
|
150
|
+
run: |
|
|
151
|
+
# Configure git
|
|
152
|
+
git config --local user.email "action@github.com"
|
|
153
|
+
git config --local user.name "GitHub Action"
|
|
154
|
+
|
|
155
|
+
# Check if there are changes in docs
|
|
156
|
+
if git diff --quiet docs/; then
|
|
157
|
+
echo "No documentation changes to commit"
|
|
158
|
+
else
|
|
159
|
+
# Add documentation changes
|
|
160
|
+
git add docs/
|
|
161
|
+
|
|
162
|
+
# Get the new version
|
|
163
|
+
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
164
|
+
|
|
165
|
+
# Commit with [doc] tag
|
|
166
|
+
git commit -m "[doc] Update documentation for version $NEW_VERSION"
|
|
167
|
+
|
|
168
|
+
# Push documentation changes
|
|
169
|
+
git push origin HEAD:main
|
|
170
|
+
|
|
171
|
+
echo "✅ Documentation committed and pushed"
|
|
172
|
+
fi
|
|
173
|
+
|
|
174
|
+
- name: Update develop branch with new version
|
|
175
|
+
run: |
|
|
176
|
+
# Configure git
|
|
177
|
+
git config --local user.email "action@github.com"
|
|
178
|
+
git config --local user.name "GitHub Action"
|
|
179
|
+
|
|
180
|
+
# Get the new version that was just published
|
|
181
|
+
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
182
|
+
echo "Updating develop branch with version: $NEW_VERSION"
|
|
183
|
+
|
|
184
|
+
# Fetch all branches
|
|
185
|
+
git fetch origin
|
|
186
|
+
|
|
187
|
+
# Checkout develop branch
|
|
188
|
+
git checkout develop
|
|
189
|
+
|
|
190
|
+
# Now merge the documentation changes from main
|
|
191
|
+
echo "Merging documentation changes from main..."
|
|
192
|
+
|
|
193
|
+
# Try to merge with strategy to handle conflicts
|
|
194
|
+
if git merge origin/main --no-edit -m "chore: merge docs from main [skip ci]" --strategy=recursive -X theirs; then
|
|
195
|
+
echo "✅ Merge successful"
|
|
196
|
+
else
|
|
197
|
+
echo "⚠️ Merge conflict detected, resolving..."
|
|
198
|
+
|
|
199
|
+
# Check if there are conflicts
|
|
200
|
+
if git diff --name-only --diff-filter=U | grep -q .; then
|
|
201
|
+
echo "Resolving conflicts by keeping main version for docs..."
|
|
202
|
+
|
|
203
|
+
# For docs conflicts, keep the main version
|
|
204
|
+
git checkout --theirs docs/
|
|
205
|
+
git add docs/
|
|
206
|
+
|
|
207
|
+
# For package.json conflicts, keep the develop version (with updated version)
|
|
208
|
+
git checkout --ours package.json
|
|
209
|
+
git add package.json
|
|
210
|
+
|
|
211
|
+
# Complete the merge
|
|
212
|
+
git commit -m "chore: resolve merge conflicts, keep main docs and develop version [skip ci]"
|
|
213
|
+
else
|
|
214
|
+
echo "No conflicts to resolve"
|
|
215
|
+
fi
|
|
216
|
+
fi
|
|
217
|
+
|
|
218
|
+
# Push all changes to develop
|
|
219
|
+
git push origin develop
|
|
220
|
+
|
|
221
|
+
echo "✅ Updated develop branch with version $NEW_VERSION and documentation changes"
|
|
222
|
+
|
|
223
|
+
- name: Setup Pages
|
|
224
|
+
uses: actions/configure-pages@v5
|
|
225
|
+
|
|
226
|
+
- name: Build with Jekyll
|
|
227
|
+
uses: actions/jekyll-build-pages@v1
|
|
228
|
+
with:
|
|
229
|
+
source: ./docs/api/html
|
|
230
|
+
destination: ./_site
|
|
231
|
+
|
|
232
|
+
- name: Upload artifact
|
|
233
|
+
uses: actions/upload-pages-artifact@v3
|
|
234
|
+
|
|
235
|
+
- name: Deploy to GitHub Pages
|
|
236
|
+
id: deployment
|
|
237
|
+
uses: actions/deploy-pages@v4
|
|
238
|
+
|
|
239
|
+
- name: Cleanup uncommitted changes
|
|
240
|
+
run: |
|
|
241
|
+
git clean -f
|
|
242
|
+
echo "✅ Cleanup completed"
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
name: Create Pull Request for Deployment
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- develop
|
|
6
|
+
- staging
|
|
7
|
+
- feature/*
|
|
8
|
+
paths-ignore:
|
|
9
|
+
- '**.md'
|
|
10
|
+
- 'docs/**'
|
|
11
|
+
- 'README.md'
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
pull-requests: write
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
create-pr:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout code
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
with:
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
27
|
+
|
|
28
|
+
- name: Setup Node.js
|
|
29
|
+
uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: '22'
|
|
32
|
+
cache: 'yarn'
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: yarn install --frozen-lockfile
|
|
36
|
+
|
|
37
|
+
- name: Run validate
|
|
38
|
+
run: yarn validate
|
|
39
|
+
|
|
40
|
+
- name: Build project
|
|
41
|
+
run: yarn build
|
|
42
|
+
|
|
43
|
+
- name: Fetch main and develop
|
|
44
|
+
run: |
|
|
45
|
+
git fetch origin main
|
|
46
|
+
git fetch origin develop
|
|
47
|
+
|
|
48
|
+
- name: Check diff
|
|
49
|
+
id: diff
|
|
50
|
+
run: |
|
|
51
|
+
COUNT=$(git rev-list --right-only --count origin/main...origin/develop)
|
|
52
|
+
echo "commits_ahead=$COUNT"
|
|
53
|
+
echo "commits_ahead=$COUNT" >> "$GITHUB_OUTPUT"
|
|
54
|
+
|
|
55
|
+
- name: Get repository collaborators
|
|
56
|
+
id: collaborators
|
|
57
|
+
if: steps.diff.outputs.commits_ahead != '0'
|
|
58
|
+
run: |
|
|
59
|
+
# Get all collaborators with write/admin access
|
|
60
|
+
COLLABORATORS=$(gh api repos/${{ github.repository }}/collaborators --jq '.[] | select(.permissions.admin == true or .permissions.maintain == true or .permissions.push == true) | .login' | tr '\n' ',' | sed 's/,$//')
|
|
61
|
+
echo "collaborators=$COLLABORATORS" >> $GITHUB_OUTPUT
|
|
62
|
+
|
|
63
|
+
# Get team members using GraphQL (more efficient)
|
|
64
|
+
TEAM_MEMBERS=$(gh api graphql -F query='
|
|
65
|
+
query($org: String!) {
|
|
66
|
+
organization(login: $org) {
|
|
67
|
+
teams(first: 100) {
|
|
68
|
+
nodes {
|
|
69
|
+
members(first: 100) {
|
|
70
|
+
nodes {
|
|
71
|
+
login
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}' -F org="${{ github.repository_owner }}" --jq '.data.organization.teams.nodes[].members.nodes[].login' 2>/dev/null | tr '\n' ',' | sed 's/,$//' || echo "")
|
|
78
|
+
|
|
79
|
+
echo "team_members=$TEAM_MEMBERS" >> $GITHUB_OUTPUT
|
|
80
|
+
|
|
81
|
+
- name: Check if PR creator is the only eligible reviewer
|
|
82
|
+
id: check_eligibility
|
|
83
|
+
if: steps.diff.outputs.commits_ahead != '0'
|
|
84
|
+
env:
|
|
85
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
86
|
+
run: |
|
|
87
|
+
PR_CREATOR="${{ github.actor }}"
|
|
88
|
+
COLLABORATORS="${{ steps.collaborators.outputs.collaborators }}"
|
|
89
|
+
TEAM_MEMBERS="${{ steps.collaborators.outputs.team_members }}"
|
|
90
|
+
|
|
91
|
+
# Combine all eligible reviewers
|
|
92
|
+
ALL_REVIEWERS=""
|
|
93
|
+
if [ ! -z "$COLLABORATORS" ]; then
|
|
94
|
+
ALL_REVIEWERS="$COLLABORATORS"
|
|
95
|
+
fi
|
|
96
|
+
if [ ! -z "$TEAM_MEMBERS" ]; then
|
|
97
|
+
if [ ! -z "$ALL_REVIEWERS" ]; then
|
|
98
|
+
ALL_REVIEWERS="$ALL_REVIEWERS,$TEAM_MEMBERS"
|
|
99
|
+
else
|
|
100
|
+
ALL_REVIEWERS="$TEAM_MEMBERS"
|
|
101
|
+
fi
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
# Remove duplicates and the PR creator
|
|
105
|
+
UNIQUE_REVIEWERS=$(echo "$ALL_REVIEWERS" | tr ',' '\n' | grep -v "^$PR_CREATOR$" | sort -u | tr '\n' ',' | sed 's/,$//')
|
|
106
|
+
|
|
107
|
+
# Count unique reviewers (excluding PR creator)
|
|
108
|
+
REVIEWER_COUNT=$(echo "$UNIQUE_REVIEWERS" | tr ',' '\n' | grep -v "^$" | wc -l)
|
|
109
|
+
|
|
110
|
+
echo "reviewer_count=$REVIEWER_COUNT" >> $GITHUB_OUTPUT
|
|
111
|
+
echo "unique_reviewers=$UNIQUE_REVIEWERS" >> $GITHUB_OUTPUT
|
|
112
|
+
echo "pr_creator=$PR_CREATOR" >> $GITHUB_OUTPUT
|
|
113
|
+
|
|
114
|
+
# Check if PR creator is the only eligible reviewer
|
|
115
|
+
if [ "$REVIEWER_COUNT" -eq 0 ]; then
|
|
116
|
+
echo "is_only_reviewer=true" >> $GITHUB_OUTPUT
|
|
117
|
+
echo "Auto-assigning deployment PR to $PR_CREATOR (only eligible reviewer)"
|
|
118
|
+
else
|
|
119
|
+
echo "is_only_reviewer=false" >> $GITHUB_OUTPUT
|
|
120
|
+
echo "Deployment PR has $REVIEWER_COUNT other eligible reviewers: $UNIQUE_REVIEWERS"
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
- name: Create deployment PR
|
|
124
|
+
if: steps.diff.outputs.commits_ahead != '0'
|
|
125
|
+
env:
|
|
126
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
127
|
+
run: |
|
|
128
|
+
set -euo pipefail
|
|
129
|
+
|
|
130
|
+
BRANCH="deploy/${{ github.ref_name }}-${{ github.sha }}"
|
|
131
|
+
|
|
132
|
+
git config --global user.name "github-actions"
|
|
133
|
+
git config --global user.email "github-actions@github.com"
|
|
134
|
+
|
|
135
|
+
git checkout -b "$BRANCH" refs/remotes/origin/develop
|
|
136
|
+
git push -u origin "$BRANCH"
|
|
137
|
+
|
|
138
|
+
# Ensure labels exist
|
|
139
|
+
gh label create deployment --description "Deployment PR" --color "#1d76db" --force || true
|
|
140
|
+
gh label create auto-generated --description "Created by GitHub Action" --color "#ededed" --force || true
|
|
141
|
+
gh label create auto-assigned --description "Auto-assigned to author" --color "#0366d6" --force || true
|
|
142
|
+
|
|
143
|
+
# Determine assignee and reviewers based on eligibility check
|
|
144
|
+
if [ "${{ steps.check_eligibility.outputs.is_only_reviewer }}" == "true" ]; then
|
|
145
|
+
ASSIGNEE="${{ steps.check_eligibility.outputs.pr_creator }}"
|
|
146
|
+
LABELS="deployment,auto-generated,auto-assigned"
|
|
147
|
+
REVIEWERS=""
|
|
148
|
+
echo "Auto-assigning deployment PR to $ASSIGNEE (only eligible reviewer)"
|
|
149
|
+
else
|
|
150
|
+
ASSIGNEE="${{ github.actor }}"
|
|
151
|
+
LABELS="deployment,auto-generated"
|
|
152
|
+
REVIEWERS="${{ steps.check_eligibility.outputs.unique_reviewers }}"
|
|
153
|
+
echo "Assigning deployment PR to $ASSIGNEE with reviewers: $REVIEWERS"
|
|
154
|
+
fi
|
|
155
|
+
|
|
156
|
+
# Create PR with or without reviewers
|
|
157
|
+
if [ -z "$REVIEWERS" ]; then
|
|
158
|
+
gh pr create \
|
|
159
|
+
--base main \
|
|
160
|
+
--head "$BRANCH" \
|
|
161
|
+
--title "🚀 Deploy: ${BRANCH#deploy/} → main" \
|
|
162
|
+
--body "Auto-generated deployment PR for **${{ github.ref_name }}**
|
|
163
|
+
|
|
164
|
+
$([ "${{ steps.check_eligibility.outputs.is_only_reviewer }}" == "true" ] && echo "🤖 Auto-assigned to $ASSIGNEE (only eligible reviewer)" || echo "👥 Assigned to $ASSIGNEE (other reviewers available: ${{ steps.check_eligibility.outputs.unique_reviewers }})")" \
|
|
165
|
+
--label "$LABELS" \
|
|
166
|
+
--assignee "$ASSIGNEE"
|
|
167
|
+
else
|
|
168
|
+
gh pr create \
|
|
169
|
+
--base main \
|
|
170
|
+
--head "$BRANCH" \
|
|
171
|
+
--title "🚀 Deploy: ${BRANCH#deploy/} → main" \
|
|
172
|
+
--body "Auto-generated deployment PR for **${{ github.ref_name }}**
|
|
173
|
+
|
|
174
|
+
$([ "${{ steps.check_eligibility.outputs.is_only_reviewer }}" == "true" ] && echo "🤖 Auto-assigned to $ASSIGNEE (only eligible reviewer)" || echo "👥 Assigned to $ASSIGNEE with reviewers: $REVIEWERS")" \
|
|
175
|
+
--label "$LABELS" \
|
|
176
|
+
--assignee "$ASSIGNEE" \
|
|
177
|
+
--reviewer "$REVIEWERS"
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
- name: No diff – skip PR
|
|
181
|
+
if: steps.diff.outputs.commits_ahead == '0'
|
|
182
|
+
run: echo "develop is identical to main – no deployment PR needed."
|
package/.prettierrc
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# BuildX CLI
|
|
2
|
+
|
|
3
|
+
A command-line interface tool for BuildX API with authentication and schema synchronization capabilities.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Authentication Management**: Store and manage API tokens securely
|
|
8
|
+
- **Schema Synchronization**: Generate TypeScript types from API schema
|
|
9
|
+
- **Project Management**: Handle multiple project configurations
|
|
10
|
+
- **Interactive CLI**: User-friendly command-line interface
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### Global Installation
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g buildx-cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Local Development
|
|
20
|
+
```bash
|
|
21
|
+
git clone <repository-url>
|
|
22
|
+
cd buildx-cli
|
|
23
|
+
npm install
|
|
24
|
+
npm run build
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### Authentication
|
|
30
|
+
|
|
31
|
+
#### Login with token
|
|
32
|
+
```bash
|
|
33
|
+
buildx login --token <your-api-token>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### Interactive login
|
|
37
|
+
```bash
|
|
38
|
+
buildx login
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Logout
|
|
42
|
+
```bash
|
|
43
|
+
buildx logout
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### Check authentication status
|
|
47
|
+
```bash
|
|
48
|
+
buildx auth:status
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Schema Synchronization
|
|
52
|
+
|
|
53
|
+
#### Sync schema for a project
|
|
54
|
+
```bash
|
|
55
|
+
buildx sync --project-id <project-id>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Sync schema with custom output path
|
|
59
|
+
```bash
|
|
60
|
+
buildx sync --project-id <project-id> --output ./src/types/generated.ts
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Sync schema with custom API base URL
|
|
64
|
+
```bash
|
|
65
|
+
buildx sync --project-id <project-id> --api-url https://custom-api.example.com
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Project Management
|
|
69
|
+
|
|
70
|
+
#### List projects
|
|
71
|
+
```bash
|
|
72
|
+
buildx projects:list
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Set default project
|
|
76
|
+
```bash
|
|
77
|
+
buildx projects:set-default <project-id>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### Get current project
|
|
81
|
+
```bash
|
|
82
|
+
buildx projects:current
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Configuration
|
|
86
|
+
|
|
87
|
+
The CLI stores configuration in the following locations:
|
|
88
|
+
- **Global config**: `~/.config/buildx-cli/config.json`
|
|
89
|
+
- **Project config**: `./buildx.json` (optional)
|
|
90
|
+
|
|
91
|
+
### Configuration File Structure
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"auth": {
|
|
96
|
+
"token": "your-api-token",
|
|
97
|
+
"expiresAt": "2024-01-01T00:00:00.000Z"
|
|
98
|
+
},
|
|
99
|
+
"projects": {
|
|
100
|
+
"default": "project-id",
|
|
101
|
+
"list": [
|
|
102
|
+
{
|
|
103
|
+
"id": "project-id",
|
|
104
|
+
"name": "Project Name",
|
|
105
|
+
"apiUrl": "https://api.bbb.com"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"sync": {
|
|
110
|
+
"outputPath": "./generated/types.ts",
|
|
111
|
+
"apiBaseUrl": "https://api.bbb.com"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## API Endpoints
|
|
117
|
+
|
|
118
|
+
The CLI interacts with the following API endpoints:
|
|
119
|
+
|
|
120
|
+
- `GET /:project_id/collections/schema` - Fetch project schema
|
|
121
|
+
- `GET /projects` - List user projects
|
|
122
|
+
- `POST /auth/validate` - Validate authentication token
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
### Project Structure
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
src/
|
|
130
|
+
├── commands/ # CLI commands
|
|
131
|
+
├── services/ # Business logic services
|
|
132
|
+
├── types/ # TypeScript type definitions
|
|
133
|
+
├── utils/ # Utility functions
|
|
134
|
+
├── config/ # Configuration management
|
|
135
|
+
└── index.ts # Main entry point
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Building
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm run build
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Development Mode
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm run dev
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Testing
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm test
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Linting
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm run lint
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Formatting
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npm run format
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Contributing
|
|
169
|
+
|
|
170
|
+
1. Fork the repository
|
|
171
|
+
2. Create a feature branch
|
|
172
|
+
3. Make your changes
|
|
173
|
+
4. Add tests for new functionality
|
|
174
|
+
5. Run the test suite
|
|
175
|
+
6. Submit a pull request
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT License - see LICENSE file for details.
|