Skip to content

Commit 4f73926

Browse files
committed
Events refactoring - prep for 2.0.0 release
1 parent 4942b65 commit 4f73926

File tree

1,034 files changed

+211770
-3405
lines changed

Some content is hidden

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

1,034 files changed

+211770
-3405
lines changed

.beads/issues.jsonl

Lines changed: 47 additions & 4 deletions
Large diffs are not rendered by default.

.github/workflows/php.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ jobs:
6565
- name: Regenerate Autoloader
6666
run: composer dump-autoload
6767

68+
- name: Events 2.0 completeness checks
69+
run: composer check-events-2.0
70+
6871
- name: Run test suite (all code local)
6972
run: composer test
7073

.github/workflows/split.yml

Lines changed: 133 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,42 @@ permissions:
1111
# GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
1212

1313
jobs:
14+
build-release-docs:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup PHP
20+
if: github.ref_type == 'tag'
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: '8.3'
24+
tools: composer
25+
26+
- name: Install PHP dependencies
27+
if: github.ref_type == 'tag'
28+
run: composer install --no-dev --optimize-autoloader --no-interaction
29+
30+
- name: Generate docs build directories
31+
if: github.ref_type == 'tag'
32+
run: |
33+
php bin/instructor-docs gen:mintlify
34+
php bin/instructor-docs gen:mkdocs
35+
36+
- name: Upload docs workspace artifact
37+
if: github.ref_type == 'tag'
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: release-docs-workspace
41+
path: |
42+
docs-build
43+
docs-mkdocs
44+
packages/*/docs
45+
if-no-files-found: error
46+
retention-days: 7
47+
1448
split:
49+
needs: build-release-docs
1550
runs-on: ubuntu-latest
1651
strategy:
1752
fail-fast: false
@@ -98,6 +133,13 @@ jobs:
98133
with:
99134
fetch-depth: 0 # Full history for proper splitting
100135

136+
- name: Download docs workspace artifact
137+
if: github.ref_type == 'tag'
138+
uses: actions/download-artifact@v4
139+
with:
140+
name: release-docs-workspace
141+
path: .
142+
101143
# Use centralized release notes from docs/release-notes
102144
- name: Prepare release notes
103145
if: github.ref_type == 'tag'
@@ -115,6 +157,82 @@ jobs:
115157
echo "NOTES_PATH=" >> $GITHUB_ENV
116158
fi
117159
160+
- name: Prepare docs bundles for release artifacts
161+
if: github.ref_type == 'tag'
162+
id: docs_bundle
163+
run: |
164+
set -euo pipefail
165+
166+
TAG_NAME="${{ github.ref_name }}"
167+
PKG_LOCAL="${{ matrix.package.local }}"
168+
PKG_NAME="${PKG_LOCAL#packages/}"
169+
DOC_SLUG=""
170+
BUNDLE_DIR=".release-docs"
171+
172+
mkdir -p "$BUNDLE_DIR"
173+
174+
CANDIDATES=("$PKG_NAME")
175+
case "$PKG_NAME" in
176+
http-client)
177+
CANDIDATES=("http-client" "http")
178+
;;
179+
instructor)
180+
CANDIDATES=("instructor" "instructor2")
181+
;;
182+
esac
183+
184+
for candidate in "${CANDIDATES[@]}"; do
185+
if [ -d "docs-build/packages/$candidate" ] || [ -d "docs-mkdocs/packages/$candidate" ]; then
186+
DOC_SLUG="$candidate"
187+
break
188+
fi
189+
done
190+
191+
if [ -n "$DOC_SLUG" ] && [ -d "docs-build/packages/$DOC_SLUG" ]; then
192+
tar -czf "$BUNDLE_DIR/${PKG_NAME}-docs-mintlify-${TAG_NAME}.tar.gz" -C docs-build/packages "$DOC_SLUG"
193+
fi
194+
195+
if [ -n "$DOC_SLUG" ] && [ -d "docs-mkdocs/packages/$DOC_SLUG" ]; then
196+
tar -czf "$BUNDLE_DIR/${PKG_NAME}-docs-mkdocs-${TAG_NAME}.tar.gz" -C docs-mkdocs/packages "$DOC_SLUG"
197+
fi
198+
199+
if [ -d "$PKG_LOCAL/docs" ]; then
200+
tar -czf "$BUNDLE_DIR/${PKG_NAME}-docs-raw-${TAG_NAME}.tar.gz" -C "$PKG_LOCAL" docs
201+
fi
202+
203+
if ! compgen -G "$BUNDLE_DIR/*.tar.gz" > /dev/null; then
204+
FALLBACK_DIR="$BUNDLE_DIR/${PKG_NAME}-markdown"
205+
mkdir -p "$FALLBACK_DIR"
206+
207+
for file in README.md CHEATSHEET.md; do
208+
if [ -f "$PKG_LOCAL/$file" ]; then
209+
cp "$PKG_LOCAL/$file" "$FALLBACK_DIR/$file"
210+
fi
211+
done
212+
213+
if [ -d "$PKG_LOCAL/docs" ]; then
214+
cp -R "$PKG_LOCAL/docs" "$FALLBACK_DIR/docs"
215+
fi
216+
217+
if find "$FALLBACK_DIR" -type f -name '*.md*' | grep -q .; then
218+
tar -czf "$BUNDLE_DIR/${PKG_NAME}-docs-markdown-${TAG_NAME}.tar.gz" -C "$BUNDLE_DIR" "${PKG_NAME}-markdown"
219+
rm -rf "$FALLBACK_DIR"
220+
fi
221+
fi
222+
223+
if compgen -G "$BUNDLE_DIR/*.tar.gz" > /dev/null; then
224+
echo "has_files=true" >> "$GITHUB_OUTPUT"
225+
{
226+
echo "files<<EOF"
227+
find "$BUNDLE_DIR" -type f -name '*.tar.gz' | sort
228+
echo "EOF"
229+
} >> "$GITHUB_OUTPUT"
230+
ls -la "$BUNDLE_DIR"
231+
else
232+
echo "has_files=false" >> "$GITHUB_OUTPUT"
233+
echo "files=" >> "$GITHUB_OUTPUT"
234+
fi
235+
118236
# ► push branch + tag
119237
- name: Split Monorepo
120238
uses: "danharrin/monorepo-split-github-action@v2.3.0"
@@ -130,9 +248,22 @@ jobs:
130248
user_name: 'ddebowczyk'
131249
user_email: 'ddebowczyk@gmail.com'
132250

133-
# ► create GitHub Release with notes
251+
# ► create GitHub Release with notes + docs bundles
252+
- uses: softprops/action-gh-release@v2
253+
if: github.ref_type == 'tag' && env.NOTES_PATH != '' && steps.docs_bundle.outputs.has_files == 'true'
254+
env:
255+
GITHUB_TOKEN: ${{ secrets.SPLIT_TOKEN_4 }}
256+
with:
257+
repository: ${{ matrix.package.repo }} # target repo
258+
tag_name: ${{ github.ref_name }} # v1.2.3
259+
body_path: ${{ env.NOTES_PATH }}
260+
files: ${{ steps.docs_bundle.outputs.files }}
261+
fail_on_unmatched_files: true
262+
token: ${{ secrets.SPLIT_TOKEN_4 }} # PAT here
263+
264+
# ► fallback release path (notes only)
134265
- uses: softprops/action-gh-release@v2
135-
if: github.ref_type == 'tag' && env.NOTES_PATH != ''
266+
if: github.ref_type == 'tag' && env.NOTES_PATH != '' && steps.docs_bundle.outputs.has_files != 'true'
136267
env:
137268
GITHUB_TOKEN: ${{ secrets.SPLIT_TOKEN_4 }}
138269
with:

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,8 @@ tasks.json
147147
.hub/
148148
.instructor-hub/
149149

150-
# bv (beads viewer) local config and caches
151-
.bv/
150+
# bv (beads viewer) local config and caches
151+
.bv/
152+
153+
# QA tooling local caches
154+
.qa/.semgrep/

.qa/semgrep/global.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
rules:
2+
- id: global-events-no-eventbusresolver
3+
message: "EventBusResolver is removed. Wire CanHandleEvents explicitly from composition roots."
4+
severity: ERROR
5+
languages: [php]
6+
paths:
7+
include:
8+
- "/packages/**/src/**/*.php"
9+
pattern-regex: "\\bEventBusResolver\\b"
10+
11+
- id: global-events-no-optional-canhandleevents-constructor
12+
message: "Constructor event dependencies should be explicit. Avoid nullable/optional CanHandleEvents in constructors."
13+
severity: ERROR
14+
languages: [php]
15+
paths:
16+
include:
17+
- "/packages/**/src/**/*.php"
18+
exclude:
19+
- "/packages/agents/src/Hook/HookStack.php"
20+
pattern-regex: "(?s)function\\s+__construct\\s*\\([^)]*(\\?CanHandleEvents\\s+\\$[A-Za-z_][A-Za-z0-9_]*\\s*=\\s*null|CanHandleEvents\\s*\\|\\s*null|null\\s*\\|\\s*CanHandleEvents)[^)]*\\)"

0 commit comments

Comments
 (0)