-
Notifications
You must be signed in to change notification settings - Fork 1
012 visual builder update #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2d92fc3
d8e33a2
dba1ffd
64e0917
3d969ff
e060ade
1267062
a1490f0
d9f0ef2
81f13bf
c12e9ce
16019b7
f21b3fb
909afee
cec88ac
b8bf1e4
032b713
d3b41d5
8306aae
86250e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| name: Setup GitHub Project Automations | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| schedule: | ||
| - cron: "0 0 * * 0" # Every Sunday at midnight UTC | ||
| issues: | ||
| types: [opened, reopened] | ||
| pull_request: | ||
| types: [opened, reopened] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| setup-project: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up GitHub CLI | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gh | ||
| # Verify gh CLI version is compatible (>=2.21.0) for native 'gh project' commands | ||
| version=$(gh --version | head -n1 | awk '{print $3}' 2>/dev/null || echo "0.0.0") | ||
| major=$(echo "$version" | cut -d. -f1) | ||
| minor=$(echo "$version" | cut -d. -f2) | ||
| if [ "$major" -lt 2 ] || { [ "$major" -eq 2 ] && [ "$minor" -lt 21 ]; }; then | ||
| echo "gh CLI >= 2.21.0 required. Current: $version" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Authenticate GH CLI | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: gh auth login --with-token <<< "${GH_TOKEN}" | ||
|
|
||
| - name: Create Project with description | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| PROJECT_NAME="Auto Project" | ||
| PROJECT_DESC="Automated project for task management with weekly iterations" | ||
|
|
||
| # Check if project exists | ||
| proj_list=$(gh project list --owner ${{ github.repository_owner }} --format json 2>&1) | ||
| rc=$? | ||
| if [ $rc -ne 0 ]; then | ||
| echo "gh project list failed: $proj_list" >&2 | ||
| exit $rc | ||
| fi | ||
| PROJECT_ID=$(echo "$proj_list" | jq -r "[.[] | select(.title == \"$PROJECT_NAME\") | .number] | first // empty") | ||
|
|
||
| if [ -z "$PROJECT_ID" ]; then | ||
| echo "Creating new project..." | ||
| gh project create "$PROJECT_NAME" --owner ${{ github.repository_owner }} --body "$PROJECT_DESC" | ||
|
|
||
| # Re-check to ensure we obtained an ID, fail explicitly if not found | ||
| proj_list=$(gh project list --owner ${{ github.repository_owner }} --format json 2>&1) | ||
| rc=$? | ||
| if [ $rc -ne 0 ]; then | ||
| echo "gh project list failed after create: $proj_list" >&2 | ||
| exit $rc | ||
| fi | ||
| PROJECT_ID=$(echo "$proj_list" | jq -r "[.[] | select(.title == \"$PROJECT_NAME\") | .number] | first // empty") | ||
| if [ -z "$PROJECT_ID" ]; then | ||
| echo "Failed to obtain PROJECT_ID for $PROJECT_NAME" >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| echo "PROJECT_ID=$PROJECT_ID" >> $GITHUB_ENV | ||
|
|
||
| - name: Reminder - Create views manually | ||
| run: | | ||
| echo "NOTE: GitHub Projects v2 views cannot be created via the gh CLI." | ||
| echo "Please create the following views manually in the GitHub web UI:" | ||
| echo " 1. 'Tasks Table' (Table view)" | ||
| echo " 2. 'Kanban Board' (Board view)" | ||
| echo " 3. 'Schedule Timeline' (Timeline view)" | ||
|
|
||
| - name: Backfill existing open issues | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| PROJECT_ID=${{ env.PROJECT_ID }} | ||
| REPO="${{ github.repository }}" | ||
|
|
||
| # Fetch all open issues via paginated API | ||
| failures=0 | ||
| issues_json=$(gh api --paginate "repos/$REPO/issues?state=open&per_page=100" --jq '.[].number' 2>&1) | ||
| rc=$? | ||
| if [ $rc -ne 0 ]; then | ||
| echo "Error listing issues for $REPO: $issues_json" >&2 | ||
| exit $rc | ||
| fi | ||
|
|
||
| while read -r issue_num; do | ||
| [ -z "$issue_num" ] && continue | ||
| ISSUE_URL="https://github.com/$REPO/issues/$issue_num" | ||
| err=$(gh project item-add "$PROJECT_ID" --url "$ISSUE_URL" 2>&1) || { | ||
| echo "Error adding issue $issue_num to project $PROJECT_ID: $err" >&2 | ||
| failures=$((failures+1)) | ||
| } | ||
| done <<< "$issues_json" | ||
|
|
||
| if [ "$failures" -gt 0 ]; then | ||
| echo "Summary: $failures issue(s) failed to add to project $PROJECT_ID" >&2 | ||
| fi | ||
|
|
||
| - name: Add new issues/PRs to project | ||
| if: github.event_name == 'issues' || github.event_name == 'pull_request' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| PROJECT_ID=${{ env.PROJECT_ID }} | ||
| REPO="${{ github.repository }}" | ||
|
|
||
| if [ "${{ github.event_name }}" = "issues" ]; then | ||
| ISSUE_URL="https://github.com/${REPO}/issues/${{ github.event.issue.number }}" | ||
| out=$(gh project item-add "$PROJECT_ID" --url "$ISSUE_URL" 2>&1) || { echo "Error adding issue $ISSUE_URL to project: $out" >&2; exit 1; } | ||
| elif [ "${{ github.event_name }}" = "pull_request" ]; then | ||
| URL="https://github.com/${REPO}/pull/${{ github.event.pull_request.number }}" | ||
| out=$(gh project item-add "$PROJECT_ID" --url "$URL" 2>&1) || { echo "Error adding PR $URL to project: $out" >&2; exit 1; } | ||
| else | ||
| echo "Unsupported event: ${{ github.event_name }}" >&2 | ||
| exit 1 | ||
| fi | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,3 @@ | ||||||||||||
| from strands import Agent, tool | ||||||||||||
| from strands_tools import LocalChromiumBrowser | ||||||||||||
| from strands_tools import think, readfile | ||||||||||||
|
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File contains only unused imports with no implementation. This file imports Additionally, the two ♻️ Merge imports (if file is kept) from strands import Agent, tool
-from strands_tools import LocalChromiumBrowser
-from strands_tools import think, readfile
+from strands_tools import LocalChromiumBrowser, think, readfile, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,7 @@ | |
|
|
||
| # AWS Bedrock configuration | ||
| AWS_REGION = os.getenv("AWS_REGION", "us-east-1") | ||
| CLAUDE_HAIKU_MODEL = "us.anthropic.claude-haiku-4-5-20250514-v1:0" | ||
| CLAUDE_HAIKU_MODEL = "anthropic.claude-haiku-4-5-20251001-v1:0" | ||
|
|
||
| bedrock_config = Config( | ||
| region_name=AWS_REGION, | ||
|
|
@@ -99,13 +99,13 @@ async def chat_with_assistant(request: AssistantRequest): | |
| try: | ||
| # Build messages for Claude | ||
| messages = [{"role": msg.role, "content": msg.content} for msg in request.messages] | ||
|
|
||
| # Add context if provided | ||
| if request.context: | ||
| context_str = f"\n\nCurrent Context:\n{json.dumps(request.context, indent=2)}" | ||
| if messages: | ||
| messages[-1]["content"] += context_str | ||
|
|
||
| # Prepare request body | ||
| body = { | ||
| "anthropic_version": "bedrock-2023-05-31", | ||
|
|
@@ -114,28 +114,28 @@ async def chat_with_assistant(request: AssistantRequest): | |
| "system": SYSTEM_PROMPT, | ||
| "messages": messages | ||
| } | ||
|
|
||
| # Invoke Bedrock model (serverless - pay per token) | ||
| logger.info(f"Invoking {CLAUDE_HAIKU_MODEL}") | ||
| response = bedrock_runtime.invoke_model( | ||
| modelId=CLAUDE_HAIKU_MODEL, | ||
| body=json.dumps(body) | ||
| ) | ||
|
|
||
| # Parse response | ||
| response_body = json.loads(response['body'].read()) | ||
| assistant_message = response_body['content'][0]['text'] | ||
|
|
||
| # Extract suggestions and code snippets if present | ||
| suggestions = extract_suggestions(assistant_message) | ||
| code_snippet = extract_code_snippet(assistant_message) | ||
|
|
||
| return AssistantResponse( | ||
| message=assistant_message, | ||
| suggestions=suggestions, | ||
| code_snippet=code_snippet | ||
| ) | ||
|
|
||
| except Exception as e: | ||
| logger.error(f"Error invoking assistant: {str(e)}") | ||
| raise HTTPException(status_code=500, detail=str(e)) | ||
|
Comment on lines
139
to
141
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raw exception detail forwarded to the client may leak internals.
Suggested fix except Exception as e:
logger.error(f"Error invoking assistant: {str(e)}")
- raise HTTPException(status_code=500, detail=str(e))
+ raise HTTPException(status_code=500, detail="Internal error processing request")🧰 Tools🪛 Ruff (0.15.0)[warning] 139-139: Do not catch blind exception: (BLE001) [warning] 140-140: Use Replace with (TRY400) [warning] 140-140: Use explicit conversion flag Replace with conversion flag (RUF010) [warning] 141-141: Within an (B904) 🤖 Prompt for AI Agents |
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.