@assistkick/create 1.18.0 → 1.21.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/package.json +1 -1
- package/templates/assistkick-product-system/packages/backend/src/routes/mcp_config.ts +89 -0
- package/templates/assistkick-product-system/packages/backend/src/server.ts +8 -1
- package/templates/assistkick-product-system/packages/backend/src/services/chat_cli_bridge.ts +7 -0
- package/templates/assistkick-product-system/packages/backend/src/services/chat_ws_handler.ts +26 -1
- package/templates/assistkick-product-system/packages/backend/src/services/mcp_config_service.ts +134 -0
- package/templates/assistkick-product-system/packages/frontend/src/api/client.ts +34 -0
- package/templates/assistkick-product-system/packages/frontend/src/components/ChatView.tsx +14 -1
- package/templates/assistkick-product-system/packages/frontend/src/components/McpConfigModal.tsx +208 -0
- package/templates/assistkick-product-system/packages/shared/db/migrations/0001_superb_roxanne_simpson.sql +8 -0
- package/templates/assistkick-product-system/packages/shared/db/migrations/meta/0001_snapshot.json +1019 -23
- package/templates/assistkick-product-system/packages/shared/db/migrations/meta/_journal.json +7 -0
- package/templates/assistkick-product-system/packages/shared/db/schema.ts +10 -0
- package/templates/assistkick-product-system/packages/shared/lib/app_use_flow.ts +484 -0
- package/templates/assistkick-product-system/packages/shared/lib/openapi.ts +146 -0
- package/templates/assistkick-product-system/packages/shared/package.json +2 -1
- package/templates/assistkick-product-system/packages/shared/tools/agent_builder.ts +341 -0
- package/templates/assistkick-product-system/packages/shared/tools/app_use_record.ts +268 -0
- package/templates/assistkick-product-system/packages/shared/tools/app_use_run.ts +348 -0
- package/templates/assistkick-product-system/packages/shared/tools/app_use_validate.ts +67 -0
- package/templates/assistkick-product-system/packages/shared/tools/openapi_describe.ts +59 -0
- package/templates/assistkick-product-system/packages/shared/tools/openapi_list.ts +69 -0
- package/templates/assistkick-product-system/packages/shared/tools/openapi_schema.ts +67 -0
- package/templates/assistkick-product-system/packages/shared/tools/workflow_builder.ts +754 -0
- package/templates/skills/assistkick-agent-builder/SKILL.md +168 -0
- package/templates/skills/assistkick-app-use/SKILL.md +296 -0
- package/templates/skills/assistkick-app-use/references/agent-browser.md +1156 -0
- package/templates/skills/assistkick-openapi-explorer/SKILL.md +78 -0
- package/templates/skills/assistkick-openapi-explorer/cache/.gitignore +2 -0
- package/templates/skills/assistkick-workflow-builder/SKILL.md +234 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: assistkick-agent-builder
|
|
3
|
+
description: >
|
|
4
|
+
Create and edit AI agents stored in the database. Agents are used in workflow
|
|
5
|
+
runAgent nodes to execute AI tasks with specific models, skills, and grounding prompts.
|
|
6
|
+
Use when the user wants to create a new agent, edit agent grounding/skills/model,
|
|
7
|
+
list available agents, or configure agents for workflow pipelines.
|
|
8
|
+
Triggers: creating agents, editing agents, agent configuration, agent grounding,
|
|
9
|
+
agent skills, agent setup, agent management.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Agent Builder
|
|
13
|
+
|
|
14
|
+
You are an agent builder assistant. You create and edit AI agents that are stored in the database
|
|
15
|
+
and executed by `runAgent` nodes in the workflow engine. Each agent has a name, a model, a set of
|
|
16
|
+
skills, and a grounding prompt (system prompt template) that defines the agent's behavior.
|
|
17
|
+
|
|
18
|
+
All commands are run from the `assistkick-product-system/` directory.
|
|
19
|
+
|
|
20
|
+
## Core Concepts
|
|
21
|
+
|
|
22
|
+
### Agent Fields
|
|
23
|
+
- **name** — Display name for the agent
|
|
24
|
+
- **model** — Claude model to use (claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5-20251001)
|
|
25
|
+
- **skills** — JSON array of skill IDs whose SKILL.md contents are prepended to the agent's prompt at execution time
|
|
26
|
+
- **grounding** — The system prompt template. Supports `{{placeholder}}` variables resolved at runtime
|
|
27
|
+
- **defaultGrounding** — Original grounding for default agents (used by reset)
|
|
28
|
+
- **projectId** — Scope: `null` for global, or a project ID for project-specific agents
|
|
29
|
+
- **isDefault** — Flag for system default agents (cannot be deleted, can be reset)
|
|
30
|
+
|
|
31
|
+
### How Agents Execute in Workflows
|
|
32
|
+
1. A `runAgent` workflow node references an agent by `agentId`
|
|
33
|
+
2. The engine loads the agent, reads all skill SKILL.md files from disk
|
|
34
|
+
3. `{{placeholder}}` variables in the grounding are resolved using the execution context
|
|
35
|
+
4. The final prompt is composed: `[skill contents...] + resolved grounding`
|
|
36
|
+
5. A Claude process is spawned with the composed prompt and the agent's model
|
|
37
|
+
|
|
38
|
+
### Grounding Template Placeholders
|
|
39
|
+
These are replaced at execution time with runtime values:
|
|
40
|
+
|
|
41
|
+
| Placeholder | Description | Context |
|
|
42
|
+
|-------------|-------------|---------|
|
|
43
|
+
| `{{featureId}}` | The feature ID being worked on | All stages |
|
|
44
|
+
| `{{projectId}}` | Current project ID | All stages |
|
|
45
|
+
| `{{mainToolsDir}}` | Absolute path to tools directory | All stages |
|
|
46
|
+
| `{{mainSkillDir}}` | Absolute path to shared data directory | All stages |
|
|
47
|
+
| `{{pidFlag}}` | The `--project-id` flag string | All stages |
|
|
48
|
+
| `{{cycle}}` | Current development cycle number | Developer |
|
|
49
|
+
| `{{previousReviewNotes}}` | Review feedback from prior cycle | Developer |
|
|
50
|
+
| `{{debuggerFindings}}` | Root cause analysis from debugger | Developer |
|
|
51
|
+
| `{{unaddressedNotes}}` | QA rejection notes to investigate | Debugger |
|
|
52
|
+
|
|
53
|
+
Unresolved placeholders are left as-is (not removed).
|
|
54
|
+
|
|
55
|
+
## Workflow
|
|
56
|
+
|
|
57
|
+
1. **List existing agents** to see what's available
|
|
58
|
+
2. **List skills** and **models** for reference
|
|
59
|
+
3. **Create** or **get** the target agent
|
|
60
|
+
4. **Update** grounding, skills, or model as needed
|
|
61
|
+
5. **Check placeholders** if the grounding uses template variables
|
|
62
|
+
|
|
63
|
+
## Tool Reference
|
|
64
|
+
|
|
65
|
+
### List agents
|
|
66
|
+
```bash
|
|
67
|
+
pnpm tsx packages/shared/tools/agent_builder.ts list [--project-id <id>] [--scope global|project]
|
|
68
|
+
```
|
|
69
|
+
Lists agents with their ID, name, model, and skills. By default lists global agents.
|
|
70
|
+
Use `--project-id` to also include project-scoped agents.
|
|
71
|
+
|
|
72
|
+
### Get an agent
|
|
73
|
+
```bash
|
|
74
|
+
pnpm tsx packages/shared/tools/agent_builder.ts get <agent-id>
|
|
75
|
+
```
|
|
76
|
+
Shows full details including the complete grounding text.
|
|
77
|
+
|
|
78
|
+
### Create an agent
|
|
79
|
+
```bash
|
|
80
|
+
pnpm tsx packages/shared/tools/agent_builder.ts create --name "My Agent" --grounding "You are a helpful assistant..." [--model claude-opus-4-6] [--skills '["assistkick-developer"]'] [--project-id <id>]
|
|
81
|
+
```
|
|
82
|
+
Creates a new agent. The `--grounding` flag is required.
|
|
83
|
+
|
|
84
|
+
For multi-line grounding, use `--grounding-file` to read from a file:
|
|
85
|
+
```bash
|
|
86
|
+
pnpm tsx packages/shared/tools/agent_builder.ts create --name "My Agent" --grounding-file /path/to/grounding.md [--model claude-sonnet-4-6] [--skills '["assistkick-developer","assistkick-code-reviewer"]']
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Update an agent
|
|
90
|
+
```bash
|
|
91
|
+
pnpm tsx packages/shared/tools/agent_builder.ts update <agent-id> [--name "New Name"] [--model claude-sonnet-4-6] [--skills '["skill-a","skill-b"]'] [--grounding "New grounding..."] [--grounding-file /path/to/file]
|
|
92
|
+
```
|
|
93
|
+
Updates any combination of fields. Only provided fields are changed.
|
|
94
|
+
|
|
95
|
+
### Delete an agent
|
|
96
|
+
```bash
|
|
97
|
+
pnpm tsx packages/shared/tools/agent_builder.ts delete <agent-id>
|
|
98
|
+
```
|
|
99
|
+
Blocked if the agent is a default agent or is referenced in any workflow's graph.
|
|
100
|
+
|
|
101
|
+
### Reset a default agent
|
|
102
|
+
```bash
|
|
103
|
+
pnpm tsx packages/shared/tools/agent_builder.ts reset <agent-id>
|
|
104
|
+
```
|
|
105
|
+
Resets the grounding of a default agent back to its original `defaultGrounding`. Only works for default agents.
|
|
106
|
+
|
|
107
|
+
### List available skills
|
|
108
|
+
```bash
|
|
109
|
+
pnpm tsx packages/shared/tools/agent_builder.ts list-skills
|
|
110
|
+
```
|
|
111
|
+
Scans the `.claude/skills/` directory and lists all skills with their ID and description. Use these IDs in the `--skills` JSON array when creating/updating agents.
|
|
112
|
+
|
|
113
|
+
### List supported models
|
|
114
|
+
```bash
|
|
115
|
+
pnpm tsx packages/shared/tools/agent_builder.ts list-models
|
|
116
|
+
```
|
|
117
|
+
Shows Claude model IDs that can be used in the `--model` option.
|
|
118
|
+
|
|
119
|
+
### List grounding placeholders
|
|
120
|
+
```bash
|
|
121
|
+
pnpm tsx packages/shared/tools/agent_builder.ts list-placeholders
|
|
122
|
+
```
|
|
123
|
+
Shows all `{{placeholder}}` variables available for use in grounding templates, with descriptions and which workflow stage provides them.
|
|
124
|
+
|
|
125
|
+
## Supported Models
|
|
126
|
+
|
|
127
|
+
| Model ID | Label | Best For |
|
|
128
|
+
|----------|-------|----------|
|
|
129
|
+
| `claude-opus-4-6` | Claude Opus 4.6 | Complex reasoning, development, code review |
|
|
130
|
+
| `claude-sonnet-4-6` | Claude Sonnet 4.6 | Balanced performance and speed |
|
|
131
|
+
| `claude-haiku-4-5-20251001` | Claude Haiku 4.5 | Fast, simple tasks |
|
|
132
|
+
|
|
133
|
+
## Writing Good Grounding Prompts
|
|
134
|
+
|
|
135
|
+
A grounding prompt defines the agent's behavior when executed in a workflow. Tips:
|
|
136
|
+
|
|
137
|
+
1. **Start with a role statement**: "You are a [role] responsible for [task]..."
|
|
138
|
+
2. **Use placeholders** for runtime context: "You are working on feature `{{featureId}}` in project `{{projectId}}`"
|
|
139
|
+
3. **Reference tools**: "Use the tools at `{{mainToolsDir}}` with `{{pidFlag}}`"
|
|
140
|
+
4. **Be specific about outputs**: Define what the agent should produce
|
|
141
|
+
5. **Include constraints**: What the agent should NOT do
|
|
142
|
+
6. **Keep it focused**: Each agent should have a single clear responsibility
|
|
143
|
+
|
|
144
|
+
### Example Grounding
|
|
145
|
+
```
|
|
146
|
+
You are a code developer. Your task is to implement the feature specified by {{featureId}}.
|
|
147
|
+
|
|
148
|
+
Use `pnpm tsx {{mainToolsDir}}/get_node.ts {{featureId}} {{pidFlag}}` to read the feature spec.
|
|
149
|
+
|
|
150
|
+
Follow the coding standards defined in the project. Write tests using node:test.
|
|
151
|
+
Do not modify files outside the scope of this feature.
|
|
152
|
+
When done, leave the code in a committable state.
|
|
153
|
+
|
|
154
|
+
This is development cycle {{cycle}}.
|
|
155
|
+
{{previousReviewNotes}}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Rules
|
|
159
|
+
|
|
160
|
+
1. **Always list agents first** to understand what exists before creating
|
|
161
|
+
2. **Always use `list-skills`** to find valid skill IDs before assigning them
|
|
162
|
+
3. **Always use `list-models`** to confirm model IDs
|
|
163
|
+
4. **Use `--grounding-file`** for multi-line grounding — it's cleaner than inline
|
|
164
|
+
5. **Read before write** — always `get` an agent before modifying it
|
|
165
|
+
6. **Don't delete default agents** — use `reset` to restore original grounding instead
|
|
166
|
+
7. **Skills are read from disk** at execution time, not stored inline — only the skill ID is saved
|
|
167
|
+
8. **Test placeholders** by checking `list-placeholders` to ensure the variables you use are available
|
|
168
|
+
9. All tool commands must be run from the `assistkick-product-system/` directory
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: assistkick-app-use
|
|
3
|
+
description: >
|
|
4
|
+
Interact with web apps (and later iOS/Android) using browser automation and create
|
|
5
|
+
reproducible YAML flow files. Dual mode: explore apps interactively with agent-browser
|
|
6
|
+
commands, and record/replay flows programmatically for CI. Use when the user wants to
|
|
7
|
+
test an app, automate a user flow, create E2E test scripts, interact with a web app,
|
|
8
|
+
record test flows, or run automated UI tests.
|
|
9
|
+
Triggers: app testing, UI testing, E2E testing, browser automation, test recording,
|
|
10
|
+
flow creation, app interaction, web testing, user flow automation.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# App Use Skill
|
|
14
|
+
|
|
15
|
+
You are an app interaction and automation assistant. You can **explore apps interactively**
|
|
16
|
+
using `agent-browser` commands and **create reproducible YAML flow files** that can be
|
|
17
|
+
replayed programmatically without AI — perfect for CI pipelines.
|
|
18
|
+
|
|
19
|
+
All tool commands are run from the `assistkick-product-system/` directory.
|
|
20
|
+
The full `agent-browser` command reference is at `.claude/skills/assistkick-app-use/references/agent-browser.md`.
|
|
21
|
+
|
|
22
|
+
## Dual Mode Operation
|
|
23
|
+
|
|
24
|
+
### Mode 1: Interactive Exploration
|
|
25
|
+
You use `agent-browser` directly via bash to explore the app, understand its structure,
|
|
26
|
+
and decide what flow to create. You are free to roam, take snapshots, click around,
|
|
27
|
+
and investigate the UI at will.
|
|
28
|
+
|
|
29
|
+
**IMPORTANT:** Always use `--headed` when opening the browser during interactive exploration
|
|
30
|
+
so the user can see what you are doing in real time. Pass `--headed` on the `open` command.
|
|
31
|
+
|
|
32
|
+
### Mode 2: Flow Recording & Playback
|
|
33
|
+
While exploring, you record your actions into a YAML flow file using the recording tool.
|
|
34
|
+
This flow can then be replayed headlessly via the runner tool — no agent needed.
|
|
35
|
+
|
|
36
|
+
## Core Workflow
|
|
37
|
+
|
|
38
|
+
1. **Start a recording session** — `app_use_record.ts start`
|
|
39
|
+
2. **Explore the app interactively** — use `agent-browser` commands directly via Bash
|
|
40
|
+
3. **Record each meaningful action** — `app_use_record.ts add-step` after each action
|
|
41
|
+
4. **Add comments for snapshots/observations** — `app_use_record.ts add-comment`
|
|
42
|
+
5. **Add assertions** — `app_use_record.ts add-assert` to verify expected state
|
|
43
|
+
6. **Stop recording** — `app_use_record.ts stop` writes the YAML file
|
|
44
|
+
7. **Validate** — `app_use_validate.ts` checks for structural issues
|
|
45
|
+
8. **Replay** — `app_use_run.ts` runs the flow headlessly
|
|
46
|
+
|
|
47
|
+
## Tool Reference
|
|
48
|
+
|
|
49
|
+
### Interactive Exploration (agent-browser via Bash)
|
|
50
|
+
|
|
51
|
+
Use these `agent-browser` commands directly via the Bash tool to explore the app:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Navigate and observe (always use --headed so the user can watch)
|
|
55
|
+
agent-browser open http://localhost:5173 --headed
|
|
56
|
+
agent-browser snapshot -i # Get interactive elements with refs
|
|
57
|
+
agent-browser screenshot # Capture visual state
|
|
58
|
+
agent-browser screenshot --annotate # Annotated screenshot with numbered labels
|
|
59
|
+
|
|
60
|
+
# Interact
|
|
61
|
+
agent-browser click @e1 # Click by ref
|
|
62
|
+
agent-browser fill @e2 "test@example.com" # Fill input by ref
|
|
63
|
+
agent-browser type @e3 "search term" # Type into element
|
|
64
|
+
agent-browser press Enter # Press key
|
|
65
|
+
agent-browser select @e4 "option1" # Select dropdown
|
|
66
|
+
agent-browser hover @e5 # Hover element
|
|
67
|
+
agent-browser scroll down 500 # Scroll
|
|
68
|
+
|
|
69
|
+
# Wait and verify
|
|
70
|
+
agent-browser wait --text "Dashboard" # Wait for text
|
|
71
|
+
agent-browser wait --load networkidle # Wait for page load
|
|
72
|
+
agent-browser get text @e1 # Get element text
|
|
73
|
+
agent-browser get url # Get current URL
|
|
74
|
+
|
|
75
|
+
# Debug
|
|
76
|
+
agent-browser console # Browser console logs
|
|
77
|
+
agent-browser errors # JavaScript errors
|
|
78
|
+
|
|
79
|
+
# Session
|
|
80
|
+
agent-browser close # Close browser
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**AI-optimal workflow:** `open <url> --headed` → `snapshot -i` → interact using refs → re-snapshot after changes.
|
|
84
|
+
|
|
85
|
+
### Execute Single Steps (Granular Tool)
|
|
86
|
+
|
|
87
|
+
For programmatic single-step execution with structured output:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pnpm tsx packages/shared/tools/app_use_run.ts exec --type click --selector "@e1"
|
|
91
|
+
pnpm tsx packages/shared/tools/app_use_run.ts exec --type fill --selector "@e2" --value "hello"
|
|
92
|
+
pnpm tsx packages/shared/tools/app_use_run.ts exec --type snapshot --params '{"interactive":true}'
|
|
93
|
+
pnpm tsx packages/shared/tools/app_use_run.ts exec --type wait --params '{"text":"Dashboard"}'
|
|
94
|
+
pnpm tsx packages/shared/tools/app_use_run.ts exec --type open --value "http://localhost:5173"
|
|
95
|
+
pnpm tsx packages/shared/tools/app_use_run.ts exec --type screenshot --value "step1.png"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Returns JSON: `{"status":"ok","step":"click","output":"..."}`
|
|
99
|
+
|
|
100
|
+
### AI Assertion (Screenshot + Claude)
|
|
101
|
+
|
|
102
|
+
Pass a screenshot to Claude for vision-based assertions:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm tsx packages/shared/tools/app_use_run.ts assert-ai /path/to/screenshot.png --prompt "The login form shows username and password fields"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Returns: `{"passes": true/false, "details": "explanation"}`
|
|
109
|
+
|
|
110
|
+
### Recording Tool
|
|
111
|
+
|
|
112
|
+
#### Start a recording session
|
|
113
|
+
```bash
|
|
114
|
+
pnpm tsx packages/shared/tools/app_use_record.ts start --output flows/login.yaml --url http://localhost:5173 --name "Login Flow"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Options:
|
|
118
|
+
- `--output <path>` — Where to save the flow YAML (required)
|
|
119
|
+
- `--url <url>` — App URL (sets `appId` in flow config)
|
|
120
|
+
- `--name <name>` — Flow display name
|
|
121
|
+
- `--platform <platform>` — Platform: web (default), ios, android
|
|
122
|
+
- `--auto-session <bool>` — Auto-manage browser session (default: true)
|
|
123
|
+
|
|
124
|
+
#### Add a step to the recording
|
|
125
|
+
```bash
|
|
126
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-step --type click --selector "@e1" --label "Click login button"
|
|
127
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-step --type fill --selector "@e2" --value "user@test.com"
|
|
128
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-step --type open --value "http://localhost:5173/dashboard"
|
|
129
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-step --type press --value "Enter"
|
|
130
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-step --type wait --params '{"text":"Welcome"}'
|
|
131
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-step --type scroll --value "down" --params '{"pixels":500}'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### Add an assertion
|
|
135
|
+
```bash
|
|
136
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-assert --type assertVisible --value "Welcome back"
|
|
137
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-assert --type assertNotVisible --value "Error"
|
|
138
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-assert --type assertUrl --value "/dashboard"
|
|
139
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-assert --type assertText --selector "@e1" --value "Hello User"
|
|
140
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-assert --type assertWithAI --value "The dashboard shows a welcome message and navigation menu"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### Add a comment (for observations, snapshots)
|
|
144
|
+
```bash
|
|
145
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-comment "Snapshot taken — found login form with email and password fields"
|
|
146
|
+
pnpm tsx packages/shared/tools/app_use_record.ts add-comment "Page loaded with 3 items in the list"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Check recording status
|
|
150
|
+
```bash
|
|
151
|
+
pnpm tsx packages/shared/tools/app_use_record.ts status
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Stop and save the recording
|
|
155
|
+
```bash
|
|
156
|
+
pnpm tsx packages/shared/tools/app_use_record.ts stop
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Discard the recording
|
|
160
|
+
```bash
|
|
161
|
+
pnpm tsx packages/shared/tools/app_use_record.ts discard
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Flow Runner (CI-friendly)
|
|
165
|
+
|
|
166
|
+
#### Run a flow file
|
|
167
|
+
```bash
|
|
168
|
+
pnpm tsx packages/shared/tools/app_use_run.ts flows/login.yaml
|
|
169
|
+
pnpm tsx packages/shared/tools/app_use_run.ts flows/login.yaml --headed
|
|
170
|
+
pnpm tsx packages/shared/tools/app_use_run.ts flows/login.yaml --env USERNAME=testuser --env PASSWORD=secret123
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Reports pass/fail per step with timing. Exits with code 1 if any non-optional step fails.
|
|
174
|
+
|
|
175
|
+
### Flow Validator
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pnpm tsx packages/shared/tools/app_use_validate.ts flows/login.yaml
|
|
179
|
+
pnpm tsx packages/shared/tools/app_use_validate.ts flows/login.yaml --show-steps
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Checks syntax, valid step types, required fields, selector format.
|
|
183
|
+
|
|
184
|
+
## YAML Flow Format
|
|
185
|
+
|
|
186
|
+
Flows are saved in `flows/` at the workspace project root.
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
# Header (config)
|
|
190
|
+
appId: http://localhost:5173
|
|
191
|
+
platform: web
|
|
192
|
+
name: "Login Flow"
|
|
193
|
+
env:
|
|
194
|
+
USERNAME: "testuser"
|
|
195
|
+
PASSWORD: "secret123"
|
|
196
|
+
autoSession: true
|
|
197
|
+
---
|
|
198
|
+
# Steps
|
|
199
|
+
- open: "http://localhost:5173/login"
|
|
200
|
+
- wait: { load: networkidle }
|
|
201
|
+
- fill: { selector: "@e3", value: "${USERNAME}" }
|
|
202
|
+
- fill: { selector: "@e4", value: "${PASSWORD}" }
|
|
203
|
+
- click: "@e5"
|
|
204
|
+
- wait: { text: "Dashboard" }
|
|
205
|
+
- assertVisible: "Welcome back"
|
|
206
|
+
- assertUrl: "/dashboard"
|
|
207
|
+
- screenshot: "after-login.png"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Step Types
|
|
211
|
+
|
|
212
|
+
| Type | Shorthand | Full Form | Description |
|
|
213
|
+
|--------------------|-------------------------------------------|--------------------------------------------------------------------------------------------------------|----------------------------|
|
|
214
|
+
| `open` | `- open: "url"` | | Navigate to URL |
|
|
215
|
+
| `click` | `- click: "@e1"` | `- click: { selector: "#btn" }` | Click element |
|
|
216
|
+
| `dblclick` | `- dblclick: "@e1"` | | Double-click |
|
|
217
|
+
| `fill` | | `- fill: { selector: "@e2", value: "text" }` | Clear and fill input |
|
|
218
|
+
| `type` | | `- type: { selector: "@e2", value: "text" }` | Type into element |
|
|
219
|
+
| `press` | `- press: "Enter"` | | Press key |
|
|
220
|
+
| `hover` | `- hover: "@e3"` | | Hover element |
|
|
221
|
+
| `select` | | `- select: { selector: "@e5", value: "opt" }` | Select dropdown |
|
|
222
|
+
| `check` | `- check: "@e6"` | | Check checkbox |
|
|
223
|
+
| `uncheck` | `- uncheck: "@e6"` | | Uncheck checkbox |
|
|
224
|
+
| `scroll` | `- scroll: "down"` | `- scroll: { value: "down", pixels: 500 }` | Scroll |
|
|
225
|
+
| `scrollIntoView` | `- scrollIntoView: "@e7"` | | Scroll element into view |
|
|
226
|
+
| `wait` | `- wait: 2000` | `- wait: { text: "Done" }` / `{ load: "networkidle" }` / `{ url: "/page" }` / `{ fn: "window.ready" }` | Wait |
|
|
227
|
+
| `snapshot` | `- snapshot` | `- snapshot: { interactive: true, compact: true }` | Accessibility tree |
|
|
228
|
+
| `screenshot` | `- screenshot: "path.png"` | `- screenshot: { value: "path.png", full: true }` | Capture screenshot |
|
|
229
|
+
| `assertVisible` | `- assertVisible: "Text"` | | Assert text is visible |
|
|
230
|
+
| `assertNotVisible` | `- assertNotVisible: "Error"` | | Assert text is NOT visible |
|
|
231
|
+
| `assertUrl` | `- assertUrl: "/dashboard"` | | Assert URL contains value |
|
|
232
|
+
| `assertText` | | `- assertText: { selector: "@e1", value: "Hello" }` | Assert element text |
|
|
233
|
+
| `assertWithAI` | `- assertWithAI: "The form is visible"` | | Vision-based AI assertion |
|
|
234
|
+
| `back` | `- back` | | Navigate back |
|
|
235
|
+
| `forward` | `- forward` | | Navigate forward |
|
|
236
|
+
| `reload` | `- reload` | | Reload page |
|
|
237
|
+
| `eval` | `- eval: "document.title"` | | Run JavaScript |
|
|
238
|
+
| `setViewport` | | `- setViewport: { width: 1280, height: 720 }` | Set viewport |
|
|
239
|
+
| `setDevice` | `- setDevice: "iPhone 14"` | | Emulate device |
|
|
240
|
+
| `upload` | | `- upload: { selector: "@e8", value: "file.png" }` | Upload file |
|
|
241
|
+
| `tab` | | `- tab: { params: { action: "new" } }` | Tab management |
|
|
242
|
+
| `frame` | `- frame: "#iframe"` or `- frame: "main"` | | Switch frame |
|
|
243
|
+
| `sessionStart` | | `- sessionStart: "http://..."` | Open browser session |
|
|
244
|
+
| `sessionEnd` | `- sessionEnd` | | Close browser session |
|
|
245
|
+
|
|
246
|
+
### Step Options
|
|
247
|
+
|
|
248
|
+
Every step supports:
|
|
249
|
+
- `label: "description"` — Human-readable label
|
|
250
|
+
- `optional: true` — Failure won't abort the flow
|
|
251
|
+
- `params: { ... }` — Type-specific additional parameters
|
|
252
|
+
|
|
253
|
+
### Variable Interpolation
|
|
254
|
+
|
|
255
|
+
Use `${VAR}` in values. Variables are defined in the flow `env` section or passed via `--env KEY=VALUE` at runtime.
|
|
256
|
+
|
|
257
|
+
## Exploration Patterns
|
|
258
|
+
|
|
259
|
+
### Pattern: Discover → Record → Replay
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
1. agent-browser open http://localhost:5173 --headed # Explore (visible to user)
|
|
263
|
+
2. agent-browser snapshot -i # See what's there
|
|
264
|
+
3. app_use_record start --output flows/x.yaml # Start recording
|
|
265
|
+
4. agent-browser click @e2 # Interact
|
|
266
|
+
5. app_use_record add-step --type click --selector "@e2" # Record it
|
|
267
|
+
6. agent-browser snapshot -i # Observe result
|
|
268
|
+
7. app_use_record add-comment "Navigated to dashboard" # Note observation
|
|
269
|
+
8. app_use_record add-assert --type assertVisible --value "Dashboard" # Assert
|
|
270
|
+
9. app_use_record stop # Save flow
|
|
271
|
+
10. app_use_run flows/x.yaml # Replay headlessly
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Pattern: Screenshot + AI Assertion
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
1. agent-browser screenshot step3.png
|
|
278
|
+
2. app_use_run assert-ai step3.png --prompt "The checkout page shows a total of $42.99"
|
|
279
|
+
3. app_use_record add-assert --type assertWithAI --value "The checkout page shows a total"
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Rules
|
|
283
|
+
|
|
284
|
+
1. **Explore freely** — Use `agent-browser` commands via Bash to understand the app before recording
|
|
285
|
+
2. **Always use `--headed`** — Pass `--headed` on the `open` command so the user can see the browser in real time
|
|
286
|
+
3. **Always snapshot first** — Run `agent-browser snapshot -i` to discover interactive elements and their refs
|
|
287
|
+
4. **Record meaningful actions** — Don't record every snapshot; record the actions that matter for reproduction
|
|
288
|
+
5. **Add comments for context** — When you take a snapshot or make an observation, record it as a comment
|
|
289
|
+
6. **Use refs (@e1, @e2)** — Refs from snapshots are the most reliable selectors for web
|
|
290
|
+
7. **Add assertions** — Every flow should verify the expected outcome, not just perform actions
|
|
291
|
+
8. **Validate before committing** — Run `app_use_validate.ts` before considering a flow complete
|
|
292
|
+
9. **Test the replay** — Run `app_use_run.ts` to verify the flow works headlessly
|
|
293
|
+
10. **Save flows in `flows/`** — At the workspace project root, so they go into git
|
|
294
|
+
11. **Use `${VAR}` for credentials** — Never hardcode passwords in flow files; use env vars
|
|
295
|
+
12. All tool commands run from `assistkick-product-system/`
|
|
296
|
+
13. The app typically runs at `http://localhost:5173` (frontend) and `http://localhost:3000` (backend)
|