Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Delay Action"
description: "Documentation for Delay Action"
---

# Delay Action

The `StacDelayAction` allows you to do nothing for a specified duration.
Expand All @@ -16,4 +21,4 @@ The `StacDelayAction` allows you to do nothing for a specified duration.
"milliseconds": 1000
},

```
```
7 changes: 6 additions & 1 deletion website/docs/actions/dialog..md → docs/actions/dialog.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Dialog Action"
description: "Documentation for Dialog Action"
---

# Dialog Action

The `StacDialogAction` class is used to display a dialog in Stac applications.
Expand Down Expand Up @@ -48,4 +53,4 @@ The `StacDialogAction` class is used to display a dialog in Stac applications.
"actionType": "showDialog",
"assetPath": "assets/dialog.json"
}
```
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Form Validate Action"
description: "Documentation for Form Validate Action"
---

# Form Validate Action

The `StacFormValidateAction` class is used to validate a form in Stac applications.
Expand Down Expand Up @@ -31,4 +36,4 @@ The `StacFormValidateAction` class is used to validate a form in Stac applicatio
}
}
}
```
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Get Form Value Action"
description: "Documentation for Get Form Value Action"
---

# Get Form Value Action

The `StacGetFormValueAction` class is used to retrieve a form value in Stac applications.
Expand All @@ -17,4 +22,4 @@ The `StacGetFormValueAction` class is used to retrieve a form value in Stac appl
"actionType": "getFormValue",
"id": "username"
}
```
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Modal Bottom Sheet Action"
description: "Documentation for Modal Bottom Sheet Action"
---

# Modal Bottom Sheet Action

The `StacModalBottomSheetAction` class is used to display a modal bottom sheet in Stac applications.
Expand Down Expand Up @@ -80,4 +85,4 @@ The `StacModalBottomSheetAction` class is used to display a modal bottom sheet i
"method": "get"
}
}
```
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Multi Action"
description: "Documentation for Multi Action"
---

# Multi Action

The `StacMultiAction` allows you to execute multiple actions with ease.
Expand Down Expand Up @@ -75,4 +80,4 @@ This example will allow you to show a snackbar through `StacShowSnackBarAction`,
}
]
}
```
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Navigate Action"
description: "Documentation for Navigate Action"
---

# Navigate Action

The Stac Navigate Action allows you to perform navigation actions in a Flutter application using JSON.
Expand Down Expand Up @@ -90,4 +95,4 @@ The `NavigationStyle` enum defines the different styles of navigation that can b
"routeName": "/home",
"navigationStyle": "pushNamed"
}
```
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Network Request Action"
description: "Documentation for Network Request Action"
---

# Network Request Action

The `NetworkRequestAction` class is used to make network requests in Stac applications.
Expand Down Expand Up @@ -67,3 +72,4 @@ The `StacNetworkResult` class is used to handle different status codes in the St
]
}
```

6 changes: 6 additions & 0 deletions website/docs/actions/none.md → docs/actions/none.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "None Action"
description: "Documentation for None Action"
---

# None Action

A default action that does nothing.
Expand All @@ -9,3 +14,4 @@ A default action that does nothing.
"actionType": "none"
}
```

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "SnackBar"
description: "Documentation for SnackBar"
---

# SnackBar

Stac snackBar allows you to show the Flutter SnackBar using JSON.
Expand Down Expand Up @@ -52,4 +57,4 @@ To know more about the SnackBar widget in Flutter, refer to the [official docume
},
"behavior": "floating"
}
```
```
Binary file added docs/assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/hello_world.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
222 changes: 222 additions & 0 deletions docs/cli.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
---
title: "Stac CLI"
description: "Build, deploy, and manage Server-Driven UI projects with the Stac CLI."
---

## Installation

<Tabs>
<Tab title="macOS / Linux">

```bash
# Install Stac CLI
curl -fsSL https://raw.githubusercontent.com/StacDev/install/main/install.sh | bash

# Verify installation
stac --version
```

</Tab>
<Tab title="Windows">

```bash
# Install Stac CLI
irm https://raw.githubusercontent.com/StacDev/install/main/install.ps1 | iex

# Verify installation
stac --version
```

</Tab>
</Tabs>


## Available Commands

| Command | Description | Requires Auth |
|---------|-------------|---------------|
| `login` | Authenticate with Google OAuth | No |
| `logout` | Clear stored authentication tokens | No |
| `status` | Show authentication status | No |
| `init` | Initialize Stac in project | Yes |
| `build` | Convert Dart widgets to JSON | No |
| `deploy` | Build and deploy to Stac Cloud | Yes |
| `project list` | List all cloud projects | Yes |
| `project create` | Create new cloud project | Yes |

## Authentication

Before using most CLI commands, you'll need to authenticate with Stac Cloud.

### Login

```bash
# Authenticate with Google OAuth
stac login

# This opens your browser for OAuth authentication
# Your credentials are securely stored locally
```

### Check Status

```bash
# Check your authentication status
stac status
```

### Logout

```bash
# Clear stored authentication tokens
stac logout
```

## Initialize Stac

Use this to set up Stac in an existing Flutter/Dart project. It links your local app to a Stac Cloud project and scaffolds required files.


```bash
# Initialize Stac in the current project
stac init
```

#### What it does

- Creates `stac/` folder for Stac DSL widgets
- Adds `lib/default_stac_options.dart` with your `StacOptions` (e.g., `projectId`)
- Updates `pubspec.yaml` with `stac` and related dependencies
- Optionally links to an existing Stac Cloud project

#### Generated files

```bash
|- Flutter project
├── lib/
│ ├── default_stac_options.dart
│ └── main.dart
├── stac/
│ └── stac_widget.dart
└── pubspec.yaml
```

## Building Widgets

### Convert Dart to JSON

```bash
# Build all widgets in current project
stac build

# Build specific project directory
stac build --project /path/to/project

# Build with validation (enabled by default)
stac build --validate

# Build with verbose output
stac build --verbose
```

#### Build Options

| Option | Description | Default |
|--------|-------------|---------|
| `-p, --project` | Project directory path | Current directory |
| `--validate` | Validate generated JSON | `true` |
| `-v, --verbose` | Show detailed build output | `false` |

The build command converts Stac widget definitions from the `stac/` folder into JSON format in the `build/` folder.

## Deployment

### Deploy to Stac Cloud

```bash
# Build and deploy to Stac Cloud
stac deploy

# Deploy specific project directory
stac deploy --project /path/to/project

# Skip build and deploy existing files
stac deploy --skip-build

# Deploy with verbose output
stac deploy --verbose
```

### Deployment Options

| Option | Description | Default |
|--------|-------------|---------|
| `-p, --project` | Project directory path | Current directory |
| `--skip-build` | Skip building before deployment | `false` |
| `-v, --verbose` | Show detailed deployment output | `false` |

<Note>
By default, `stac deploy` automatically runs `stac build` before deploying. Use `--skip-build` to deploy existing build files without rebuilding.
</Note>

## Cloud Project Management

### List Projects

```bash
# List all your Stac Cloud projects
stac project list

# Output as JSON format
stac project list --json
```

The list command shows:
- Project name and ID
- Project description
- Created and updated timestamps

### Create New Project

```bash
# Create a new project on Stac Cloud
stac project create --name "My App" --description "My SDUI app"

# Short form
stac project create -n "My App" -d "My SDUI app"
```

After creating a project, run `stac init` to initialize it locally.

## Development Workflow

### Typical Workflow

```bash
# 1. Authenticate with Stac Cloud (one-time)
stac login

# 2. List available projects
stac project list

# 3. Initialize a project in your Flutter/Dart app
cd your-flutter-project
stac init

# 4. Create your widget definitions in stac/ folder
# Edit stac/your_screen.dart

# 6. Deploy to Stac Cloud
stac deploy
```
Comment on lines +209 to +211
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify CLI commands match actual implementation.

The development workflow section (lines 195-211) lists several commands. Confirm that the command sequence and options documented here match the actual CLI implementation, especially around the build-before-deploy behavior mentioned in the Deployment section.


🏁 Script executed:

#!/bin/bash
# Verify that the documented commands exist in the codebase

echo "=== Searching for CLI command implementations ==="
find . -type f \( -name "*.dart" -o -name "*.ts" -o -name "*.js" \) | xargs grep -l "stac.*login\|stac.*build\|stac.*deploy" | head -10

Length of output: 97



---

🏁 Script executed:

```shell
#!/bin/bash
# Step 1: View the documentation to see what commands are documented
echo "=== Examining docs/cli.mdx around lines 195-211 ==="
head -211 docs/cli.mdx | tail -25

echo ""
echo "=== Looking for CLI package/entry point ==="
find . -type f \( -name "*.dart" -o -name "*.ts" -o -name "*.js" \) -path "*/bin/*" -o -path "*/cli/*" | grep -E "(main|cli|bin)" | head -10

echo ""
echo "=== Searching for command definitions (broader pattern) ==="
rg -n "deploy|login|build" -A 2 ./packages/stac_core/lib/core/stac_options.dart | head -30

Length of output: 850



---

🏁 Script executed:

```shell
#!/bin/bash
# Step 2: Find project structure and CLI package location
echo "=== Project structure ==="
ls -la

echo ""
echo "=== Search for pubspec.yaml files ==="
find . -name "pubspec.yaml" -type f | head -10

echo ""
echo "=== Look for CLI executable or bin directory ==="
find . -type d \( -name "bin" -o -name "cli" \) | head -10

echo ""
echo "=== Check full docs/cli.mdx for Deployment section with build behavior ==="
grep -n "Deployment\|build-before-deploy\|stac build" docs/cli.mdx | head -20

echo ""
echo "=== Verify step numbering in workflow section ==="
sed -n '195,211p' docs/cli.mdx | grep -E "^# [0-9]"

Length of output: 2365



---

🏁 Script executed:

```shell
#!/bin/bash
# Step 3: Examine the stac package for CLI implementation
echo "=== Examining packages/stac/ structure ==="
find ./packages/stac -type f -name "*.dart" | head -20

echo ""
echo "=== Check packages/stac/pubspec.yaml for CLI executable definition ==="
cat ./packages/stac/pubspec.yaml | grep -A 10 -B 5 "executables\|bin"

echo ""
echo "=== Search for command implementations in stac package ==="
grep -r "stac build\|stac deploy\|stac login" ./packages/stac/lib/ 2>/dev/null | head -10

echo ""
echo "=== Verify step 5 content is truly missing ==="
sed -n '195,211p' docs/cli.mdx

Length of output: 2041


Fix step numbering in workflow—step 5 is missing.

The development workflow section (lines 195-211) has a critical formatting error: the steps jump from # 4. Create your widget definitions directly to # 6. Deploy to Stac Cloud, with no step 5. This should be corrected to sequential numbering (either restore step 5 with relevant content like stac build, or renumber step 6 to step 5).

The build-before-deploy behavior mentioned in the Deployment section (line 159: "By default, stac deploy automatically runs stac build before deploying") is consistent with the workflow not showing an explicit build step. However, verify whether step 5 should document the stac build command or if the numbering was simply edited incorrectly.

🤖 Prompt for AI Agents
In docs/cli.mdx around lines 195 to 211, the numbered workflow steps jump from
"# 4. Create your widget definitions" to "# 6. Deploy to Stac Cloud", leaving
out step 5; restore proper sequencing by either inserting a step 5 that
documents "stac build" (brief usage and note that deploy runs build by default)
or renumber the current "# 6" heading to "# 5" if no build step is needed—also
verify consistency with the note at line 159 about deploy running build and
update that line if you choose to explicitly add the build step.


## Command Reference

### Global Options

| Option | Description |
|--------|-------------|
| `-v, --verbose` | Show additional command output |
| `--version` | Print tool version |
| `--help` | Print usage information |

Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
sidebar_position: 2
title: "Action Parsers"
description: "Documentation for Action Parsers"
---

# Action Parsers

Stac supports a variety of built-in action parsers to handle different types of actions. However, you can also create custom action parsers to handle custom actions or actions that are not supported by Stac out of the box. This guide will walk you through the basics of creating and using action parsers in Stac.

## What is a Stac Action Parser?
Expand Down Expand Up @@ -108,4 +107,4 @@ StacRegistry.instance.registerAllActions([

## Conclusion

Creating custom action parsers in Stac not only allows you to extend the functionality of the library but also enables you to define highly customizable behaviors within your application. By defining custom parsers for actions, you can leverage the full power of server-driven UI in your Flutter application, ensuring dynamic and responsive user interactions.
Creating custom action parsers in Stac not only allows you to extend the functionality of the library but also enables you to define highly customizable behaviors within your application. By defining custom parsers for actions, you can leverage the full power of server-driven UI in your Flutter application, ensuring dynamic and responsive user interactions.
Loading