flow2skill 0.1.0__tar.gz
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.
- flow2skill-0.1.0/CHANGELOG.md +37 -0
- flow2skill-0.1.0/CODE_OF_CONDUCT.md +17 -0
- flow2skill-0.1.0/CONTRIBUTING.md +39 -0
- flow2skill-0.1.0/LICENSE +21 -0
- flow2skill-0.1.0/MANIFEST.in +11 -0
- flow2skill-0.1.0/PKG-INFO +233 -0
- flow2skill-0.1.0/README.md +204 -0
- flow2skill-0.1.0/SECURITY.md +52 -0
- flow2skill-0.1.0/docs/release-gate.png +0 -0
- flow2skill-0.1.0/docs/replay-evidence.png +0 -0
- flow2skill-0.1.0/docs/studio.png +0 -0
- flow2skill-0.1.0/docs/verification-ledger.png +0 -0
- flow2skill-0.1.0/launch-flow2skill.bat +14 -0
- flow2skill-0.1.0/pyproject.toml +58 -0
- flow2skill-0.1.0/scripts/capture_demo.py +282 -0
- flow2skill-0.1.0/setup.cfg +4 -0
- flow2skill-0.1.0/src/flow2skill/__init__.py +6 -0
- flow2skill-0.1.0/src/flow2skill/__main__.py +3 -0
- flow2skill-0.1.0/src/flow2skill/cli.py +212 -0
- flow2skill-0.1.0/src/flow2skill/exporter.py +359 -0
- flow2skill-0.1.0/src/flow2skill/model.py +398 -0
- flow2skill-0.1.0/src/flow2skill/parser.py +407 -0
- flow2skill-0.1.0/src/flow2skill/recorder.py +298 -0
- flow2skill-0.1.0/src/flow2skill/replay.py +153 -0
- flow2skill-0.1.0/src/flow2skill/server.py +335 -0
- flow2skill-0.1.0/src/flow2skill/ui/demo_form.html +36 -0
- flow2skill-0.1.0/src/flow2skill/ui/index.html +274 -0
- flow2skill-0.1.0/src/flow2skill.egg-info/PKG-INFO +233 -0
- flow2skill-0.1.0/src/flow2skill.egg-info/SOURCES.txt +35 -0
- flow2skill-0.1.0/src/flow2skill.egg-info/dependency_links.txt +1 -0
- flow2skill-0.1.0/src/flow2skill.egg-info/entry_points.txt +2 -0
- flow2skill-0.1.0/src/flow2skill.egg-info/requires.txt +7 -0
- flow2skill-0.1.0/src/flow2skill.egg-info/top_level.txt +1 -0
- flow2skill-0.1.0/tests/fixtures/demo_form.html +21 -0
- flow2skill-0.1.0/tests/test_cli_and_server.py +69 -0
- flow2skill-0.1.0/tests/test_parser_and_exporter.py +403 -0
- flow2skill-0.1.0/tests/test_safety_and_recorder.py +176 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Flow2Skill are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and releases follow semantic versioning.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-07-30
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Local Studio for recording, compiling, inspecting, and previewing workflows.
|
|
12
|
+
- Strict AST compiler for synchronous Playwright Python pytest recordings.
|
|
13
|
+
- Fingerprinted JSON and YAML workflow contracts.
|
|
14
|
+
- Portable `SKILL.md` generation.
|
|
15
|
+
- Standalone Playwright/pytest proof generation.
|
|
16
|
+
- Default environment protection for typed and asserted values.
|
|
17
|
+
- Echo-aware protection for captured values repeated in selector and result text.
|
|
18
|
+
- URL credential, secret-query, and secret-fragment redaction.
|
|
19
|
+
- Review and approval classification for mutating browser actions.
|
|
20
|
+
- Recorder cancellation and stale-capture cleanup.
|
|
21
|
+
- Loopback, Host, Origin, token, body-size, and path-containment protections.
|
|
22
|
+
- Executable packaged local demo and Windows launcher for source checkouts.
|
|
23
|
+
- `flow2skill doctor` prerequisite validation.
|
|
24
|
+
|
|
25
|
+
### Security
|
|
26
|
+
|
|
27
|
+
- Recorded Python is parsed but never imported or executed.
|
|
28
|
+
- Dynamic expressions, control flow, multiple tests, unsupported calls, malformed manifests, fingerprint changes, and risk downgrades fail closed.
|
|
29
|
+
- Unknown call arguments, foreign environment placeholders, and templated navigation without approval fail closed.
|
|
30
|
+
- Overlapping protected values are replaced longest-first so credential suffixes cannot leak.
|
|
31
|
+
- Nested locator scopes, unknown selector modifiers, and untrusted source metadata fail closed.
|
|
32
|
+
- JWT-bearing URL parameters are protected and obsolete generated tests are removed on bundle refresh.
|
|
33
|
+
- Workflow compilation requires at least one executable assertion.
|
|
34
|
+
- Live generated proofs fail nonzero rather than false-green skipping when review permission is missing.
|
|
35
|
+
|
|
36
|
+
[Unreleased]: https://github.com/godhiraj-code/flow2skill/compare/v0.1.0...HEAD
|
|
37
|
+
[0.1.0]: https://github.com/godhiraj-code/flow2skill/releases/tag/v0.1.0
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our standard
|
|
4
|
+
|
|
5
|
+
Be respectful, specific, and technically honest. Give feedback about the work, not the person. Assume good intent while holding security, privacy, and evidence claims to a high standard.
|
|
6
|
+
|
|
7
|
+
Unacceptable behavior includes harassment, discrimination, threats, publishing another person's private information, deliberately introducing insecure behavior, or using project spaces for spam.
|
|
8
|
+
|
|
9
|
+
## Enforcement
|
|
10
|
+
|
|
11
|
+
Project maintainers may edit or remove contributions, comments, issues, or other participation that violates this standard. Serious or repeated violations may result in a temporary or permanent ban from project spaces.
|
|
12
|
+
|
|
13
|
+
Report conduct concerns privately to the project maintainer through the repository's available private contact route. Reports will be reviewed promptly and handled with appropriate confidentiality.
|
|
14
|
+
|
|
15
|
+
## Scope
|
|
16
|
+
|
|
17
|
+
This code applies in project spaces and when representing the project in public spaces.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing to Flow2Skill
|
|
2
|
+
|
|
3
|
+
Flow2Skill is intentionally narrow: compile one successful Playwright demonstration into a protected workflow, a portable skill, and executable proof. Changes should strengthen that contract rather than add autonomous planning or cloud dependencies.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m venv .venv
|
|
9
|
+
python -m pip install -e ".[dev]"
|
|
10
|
+
python -m playwright install chromium
|
|
11
|
+
flow2skill doctor
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
On Windows, use `.venv\Scripts\python.exe` and `.venv\Scripts\flow2skill.exe`.
|
|
15
|
+
|
|
16
|
+
## Before opening a pull request
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
ruff format --check src tests
|
|
20
|
+
ruff check src tests
|
|
21
|
+
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q
|
|
22
|
+
python -m build
|
|
23
|
+
python -m twine check dist/*
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Add regression tests for every parser, redaction, manifest, replay, recorder, or Studio security change. A parser change must state whether unsupported input is rejected or preserved. Silent omission is not acceptable.
|
|
27
|
+
|
|
28
|
+
## Pull request rules
|
|
29
|
+
|
|
30
|
+
- Keep recordings synthetic. Never commit real credentials, cookies, storage state, private URLs, or generated raw captures.
|
|
31
|
+
- Preserve Python 3.10–3.13 and Windows/Linux/macOS behavior.
|
|
32
|
+
- Do not add shell execution around user-controlled recorder arguments.
|
|
33
|
+
- Do not weaken default input protection or action gates.
|
|
34
|
+
- Do not claim a workflow is proven without an executable assertion.
|
|
35
|
+
- Update `CHANGELOG.md` for user-visible changes.
|
|
36
|
+
|
|
37
|
+
## Reporting security issues
|
|
38
|
+
|
|
39
|
+
Follow [SECURITY.md](SECURITY.md). Do not disclose vulnerabilities or sensitive recordings in public issues.
|
flow2skill-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dhiraj Das
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include CODE_OF_CONDUCT.md
|
|
5
|
+
include CONTRIBUTING.md
|
|
6
|
+
include SECURITY.md
|
|
7
|
+
include launch-flow2skill.bat
|
|
8
|
+
recursive-include tests *.py *.html
|
|
9
|
+
recursive-include scripts *.py
|
|
10
|
+
recursive-include src/flow2skill/ui *.html
|
|
11
|
+
recursive-include docs *.png
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flow2skill
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Record a browser workflow once, export a portable agent skill and deterministic Playwright regression test.
|
|
5
|
+
Author: Dhiraj Das
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/godhiraj-code/flow2skill
|
|
8
|
+
Project-URL: Repository, https://github.com/godhiraj-code/flow2skill
|
|
9
|
+
Project-URL: Issues, https://github.com/godhiraj-code/flow2skill/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/godhiraj-code/flow2skill/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: playwright,browser-automation,ai-agents,agent-skills,testing
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: playwright==1.61.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
26
|
+
Requires-Dist: ruff>=0.9; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=6; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Flow2Skill
|
|
31
|
+
|
|
32
|
+
[](https://github.com/godhiraj-code/flow2skill/raw/refs/heads/main/docs/flow2skill-demo-narrated.mp4)
|
|
33
|
+
|
|
34
|
+
**[Watch the 50-second narrated proof](https://github.com/godhiraj-code/flow2skill/raw/refs/heads/main/docs/flow2skill-demo-narrated.mp4)** · [Studio screenshot](https://raw.githubusercontent.com/godhiraj-code/flow2skill/main/docs/studio.png) · [Replay evidence](https://raw.githubusercontent.com/godhiraj-code/flow2skill/main/docs/replay-evidence.png)
|
|
35
|
+
|
|
36
|
+
> **Browser agents improvise. Flow2Skill preserves what already worked.**
|
|
37
|
+
|
|
38
|
+
Flow2Skill is a local-first compiler for demonstrated browser workflows. Record a successful flow with Playwright codegen. Flow2Skill turns it into an inspectable contract, a portable agent skill, and an executable regression test.
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
human demonstration → strict AST compiler → protected workflow → agent skill + pytest proof
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
It exports:
|
|
45
|
+
|
|
46
|
+
- `flow.json` and `flow.yaml`: fingerprinted workflow contracts;
|
|
47
|
+
- `SKILL.md`: reviewable instructions for Hermes, Codex, Claude Code, Cursor, and other agents;
|
|
48
|
+
- `test_<workflow>.py`: a standalone Playwright/pytest proof;
|
|
49
|
+
- `README.md`: run instructions for the generated bundle.
|
|
50
|
+
|
|
51
|
+
Flow2Skill is not an autonomous browser agent. It preserves a workflow that already worked.
|
|
52
|
+
|
|
53
|
+
## Why use it
|
|
54
|
+
|
|
55
|
+
Browser agents are useful when the path is unknown. They are expensive and inconsistent when the path is already known. Flow2Skill converts a successful run into a reusable asset with stable selectors, protected inputs, explicit review gates, and mechanical success criteria.
|
|
56
|
+
|
|
57
|
+
- **Local-first:** Studio only binds to loopback.
|
|
58
|
+
- **Parse, never execute:** recordings are inspected through Python's AST and are never imported or run.
|
|
59
|
+
- **Protected by default:** typed values and text/value assertions become environment variables.
|
|
60
|
+
- **Echo-aware:** a protected input repeated in later selector or result text is replaced with the same runtime variable.
|
|
61
|
+
- **Fail closed:** dynamic values, nested locator scopes, control flow, multiple tests, missing assertions, unknown selector modifiers, and unsupported calls stop compilation.
|
|
62
|
+
- **Review before mutation:** all clicks, key presses, fills, selections, and check operations are review-gated. Publish, send, buy, submit, delete, and similar actions are approval-gated.
|
|
63
|
+
- **Proof required:** a workflow without an executable assertion is rejected.
|
|
64
|
+
- **Portable:** the generated pytest does not depend on Flow2Skill at runtime.
|
|
65
|
+
|
|
66
|
+
## Install
|
|
67
|
+
|
|
68
|
+
Prerequisites:
|
|
69
|
+
|
|
70
|
+
- Python 3.10–3.13;
|
|
71
|
+
- Node.js with `npx`, required only for recording;
|
|
72
|
+
- Chromium installed through Playwright, required for default replay.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python -m pip install flow2skill
|
|
76
|
+
python -m playwright install chromium
|
|
77
|
+
flow2skill doctor
|
|
78
|
+
flow2skill studio
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
From a source checkout:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python -m venv .venv
|
|
85
|
+
# Windows
|
|
86
|
+
.venv\Scripts\python.exe -m pip install -e ".[dev]"
|
|
87
|
+
.venv\Scripts\python.exe -m playwright install chromium
|
|
88
|
+
.venv\Scripts\flow2skill.exe doctor
|
|
89
|
+
.venv\Scripts\flow2skill.exe studio
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Windows source checkouts also include `launch-flow2skill.bat`. Installed wheels use the `flow2skill` console command; the batch launcher is not installed by the wheel.
|
|
93
|
+
|
|
94
|
+
Studio opens at `http://127.0.0.1:8765` and writes bundles to `~/Flow2SkillWorkspaces` unless another root is supplied.
|
|
95
|
+
|
|
96
|
+
## Thirty-second proof
|
|
97
|
+
|
|
98
|
+
Generate an entirely local sample bundle:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
flow2skill demo --out ./flow2skill-demo
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Run it against Flow2Skill's packaged local fixture:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# macOS/Linux
|
|
108
|
+
F2S_LABEL_API_TOKEN_1="runtime-demo-token" \
|
|
109
|
+
FLOW2SKILL_LIVE=1 \
|
|
110
|
+
FLOW2SKILL_ALLOW_SIDE_EFFECTS=1 \
|
|
111
|
+
pytest -q ./flow2skill-demo/test_agent_release_gate.py
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Windows Command Prompt:
|
|
115
|
+
|
|
116
|
+
```cmd
|
|
117
|
+
set F2S_LABEL_API_TOKEN_1=runtime-demo-token
|
|
118
|
+
set FLOW2SKILL_LIVE=1
|
|
119
|
+
set FLOW2SKILL_ALLOW_SIDE_EFFECTS=1
|
|
120
|
+
pytest -q flow2skill-demo\test_agent_release_gate.py
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The side-effect flag is required because the proof fills a synthetic API-token field and clicks a validation button, even though the packaged fixture is local and harmless. The captured synthetic value is absent from the generated bundle.
|
|
124
|
+
|
|
125
|
+
## Record a workflow
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
flow2skill record https://example.com ^
|
|
129
|
+
--name "Documentation search" ^
|
|
130
|
+
--success-text "Results"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Complete the flow in Playwright Inspector, capture an assertion or provide `--success-text`, and close the recorder window. Flow2Skill compiles the capture and deletes its temporary raw codegen and recorder log.
|
|
134
|
+
|
|
135
|
+
Recording uses the pinned Playwright codegen version declared by this package. `flow2skill doctor` verifies version alignment and prerequisites.
|
|
136
|
+
|
|
137
|
+
## Compile existing codegen
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
flow2skill compile recording.py \
|
|
141
|
+
--name "Documentation search" \
|
|
142
|
+
--intent "Search the docs and prove results appear." \
|
|
143
|
+
--out ./compiled-flow
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Protection is enabled by default. `--no-protect-inputs` preserves non-sensitive literal values and should only be used for known-public test data. Sensitive fields remain protected.
|
|
147
|
+
|
|
148
|
+
**Input-file contract:** `flow2skill compile` never deletes the file you explicitly provide. Playwright codegen files can contain credentials or typed data; store and remove that source according to your own retention policy.
|
|
149
|
+
|
|
150
|
+
## Inspect and replay
|
|
151
|
+
|
|
152
|
+
Dry-run without opening a browser:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
flow2skill inspect ./compiled-flow/flow.json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Run the generated standalone proof:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
FLOW2SKILL_LIVE=1 pytest -q ./compiled-flow/test_documentation_search.py
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Use `FLOW2SKILL_HEADED=1` to watch. Any workflow containing review or approval actions also requires `FLOW2SKILL_ALLOW_SIDE_EFFECTS=1`. Set it only after reviewing the exact generated plan. Use `FLOW2SKILL_CHANNEL=chrome` to replay with an installed Chrome channel instead of Playwright's managed Chromium.
|
|
165
|
+
|
|
166
|
+
## Supported capture surface
|
|
167
|
+
|
|
168
|
+
- one synchronous pytest-style test function;
|
|
169
|
+
- direct Playwright call statements only;
|
|
170
|
+
- `page.goto`;
|
|
171
|
+
- role, label, placeholder, text, test-id, title, alt-text, and CSS selectors;
|
|
172
|
+
- `.first` and literal `.nth(...)` modifiers;
|
|
173
|
+
- `click`, `fill`, `press`, `select_option`, `check`, `uncheck`, and `hover`;
|
|
174
|
+
- `expect(...).to_be_visible()`;
|
|
175
|
+
- exact `to_have_text()` and substring `to_contain_text()` assertions;
|
|
176
|
+
- `expect(page).to_have_url()`;
|
|
177
|
+
- `expect(...).to_have_value()`.
|
|
178
|
+
|
|
179
|
+
Unsupported calls, dynamic expressions, assignments, loops, branches, context managers, nested functions, and multiple tests are rejected. They are never flattened or silently omitted.
|
|
180
|
+
|
|
181
|
+
## Security and privacy model
|
|
182
|
+
|
|
183
|
+
### Recording boundary
|
|
184
|
+
|
|
185
|
+
During live recording, Playwright briefly writes raw Python to a hidden workspace file. Flow2Skill deletes this file and the recorder log on completion, cancellation, launch failure, or compile failure. On startup it removes abandoned raw captures older than one hour. A hard power loss can therefore leave a temporary file until the next cleanup window. Do not record real production credentials when synthetic test credentials are available.
|
|
186
|
+
|
|
187
|
+
### Manifest integrity
|
|
188
|
+
|
|
189
|
+
`flow.json` carries a SHA-256 fingerprint. Loading rejects unknown fields, malformed selector types, missing fingerprints, content tampering, stale slugs, and risk-classification downgrades. The fingerprint detects accidental or local modification; it is not a cryptographic signature from a trusted publisher.
|
|
190
|
+
|
|
191
|
+
Runtime variables are restricted to the compiler-owned `F2S_*` namespace. Captured `${VARIABLE}` syntax is rejected instead of being allowed to read arbitrary host environment variables. Navigation containing protected values is approval-gated because it can transmit the value to the destination.
|
|
192
|
+
|
|
193
|
+
Common credential-bearing URL parameters, including JWT, token, signature, session, authentication, and password fields, are replaced with runtime variables. Recompiling into an existing managed bundle directory removes obsolete generated `test_*.py` files so stale executable proofs cannot survive unnoticed.
|
|
194
|
+
|
|
195
|
+
### Studio boundary
|
|
196
|
+
|
|
197
|
+
Studio enforces:
|
|
198
|
+
|
|
199
|
+
- loopback-only binding;
|
|
200
|
+
- strict local `Host` validation against DNS rebinding;
|
|
201
|
+
- same-origin checks;
|
|
202
|
+
- a random per-process request token;
|
|
203
|
+
- a one-megabyte JSON body limit;
|
|
204
|
+
- strict request field types;
|
|
205
|
+
- workspace and artifact path containment;
|
|
206
|
+
- no-store and browser hardening headers.
|
|
207
|
+
|
|
208
|
+
### Approval boundary
|
|
209
|
+
|
|
210
|
+
Flow2Skill compiles instructions; it does not grant permission. Generated skills call out approval-gated actions. Generated tests are disabled unless `FLOW2SKILL_LIVE=1` is present. Once live execution is requested, a missing side-effect flag fails the test rather than reporting a successful skip.
|
|
211
|
+
|
|
212
|
+
See [SECURITY.md](SECURITY.md) for the threat model and reporting process.
|
|
213
|
+
|
|
214
|
+
## Development
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
python -m pip install -e ".[dev]"
|
|
218
|
+
ruff format --check src tests scripts
|
|
219
|
+
ruff check src tests scripts
|
|
220
|
+
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q
|
|
221
|
+
python -m build
|
|
222
|
+
python -m twine check dist/*
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
The release gate also installs the wheel into a clean environment, runs the packaged demo against a real browser, checks source/wheel contents, and scans tracked files for high-confidence secrets and private paths.
|
|
226
|
+
|
|
227
|
+
## Intentional boundaries
|
|
228
|
+
|
|
229
|
+
Flow2Skill does not include cloud sync, a browser extension, shared secret storage, autonomous planning, or LLM selector healing. Those features create a platform before the deterministic compiler has earned it. The current product does one job: preserve a successful browser workflow as a reviewable procedure and executable proof.
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
MIT
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Flow2Skill
|
|
2
|
+
|
|
3
|
+
[](https://github.com/godhiraj-code/flow2skill/raw/refs/heads/main/docs/flow2skill-demo-narrated.mp4)
|
|
4
|
+
|
|
5
|
+
**[Watch the 50-second narrated proof](https://github.com/godhiraj-code/flow2skill/raw/refs/heads/main/docs/flow2skill-demo-narrated.mp4)** · [Studio screenshot](https://raw.githubusercontent.com/godhiraj-code/flow2skill/main/docs/studio.png) · [Replay evidence](https://raw.githubusercontent.com/godhiraj-code/flow2skill/main/docs/replay-evidence.png)
|
|
6
|
+
|
|
7
|
+
> **Browser agents improvise. Flow2Skill preserves what already worked.**
|
|
8
|
+
|
|
9
|
+
Flow2Skill is a local-first compiler for demonstrated browser workflows. Record a successful flow with Playwright codegen. Flow2Skill turns it into an inspectable contract, a portable agent skill, and an executable regression test.
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
human demonstration → strict AST compiler → protected workflow → agent skill + pytest proof
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
It exports:
|
|
16
|
+
|
|
17
|
+
- `flow.json` and `flow.yaml`: fingerprinted workflow contracts;
|
|
18
|
+
- `SKILL.md`: reviewable instructions for Hermes, Codex, Claude Code, Cursor, and other agents;
|
|
19
|
+
- `test_<workflow>.py`: a standalone Playwright/pytest proof;
|
|
20
|
+
- `README.md`: run instructions for the generated bundle.
|
|
21
|
+
|
|
22
|
+
Flow2Skill is not an autonomous browser agent. It preserves a workflow that already worked.
|
|
23
|
+
|
|
24
|
+
## Why use it
|
|
25
|
+
|
|
26
|
+
Browser agents are useful when the path is unknown. They are expensive and inconsistent when the path is already known. Flow2Skill converts a successful run into a reusable asset with stable selectors, protected inputs, explicit review gates, and mechanical success criteria.
|
|
27
|
+
|
|
28
|
+
- **Local-first:** Studio only binds to loopback.
|
|
29
|
+
- **Parse, never execute:** recordings are inspected through Python's AST and are never imported or run.
|
|
30
|
+
- **Protected by default:** typed values and text/value assertions become environment variables.
|
|
31
|
+
- **Echo-aware:** a protected input repeated in later selector or result text is replaced with the same runtime variable.
|
|
32
|
+
- **Fail closed:** dynamic values, nested locator scopes, control flow, multiple tests, missing assertions, unknown selector modifiers, and unsupported calls stop compilation.
|
|
33
|
+
- **Review before mutation:** all clicks, key presses, fills, selections, and check operations are review-gated. Publish, send, buy, submit, delete, and similar actions are approval-gated.
|
|
34
|
+
- **Proof required:** a workflow without an executable assertion is rejected.
|
|
35
|
+
- **Portable:** the generated pytest does not depend on Flow2Skill at runtime.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
Prerequisites:
|
|
40
|
+
|
|
41
|
+
- Python 3.10–3.13;
|
|
42
|
+
- Node.js with `npx`, required only for recording;
|
|
43
|
+
- Chromium installed through Playwright, required for default replay.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python -m pip install flow2skill
|
|
47
|
+
python -m playwright install chromium
|
|
48
|
+
flow2skill doctor
|
|
49
|
+
flow2skill studio
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
From a source checkout:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python -m venv .venv
|
|
56
|
+
# Windows
|
|
57
|
+
.venv\Scripts\python.exe -m pip install -e ".[dev]"
|
|
58
|
+
.venv\Scripts\python.exe -m playwright install chromium
|
|
59
|
+
.venv\Scripts\flow2skill.exe doctor
|
|
60
|
+
.venv\Scripts\flow2skill.exe studio
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Windows source checkouts also include `launch-flow2skill.bat`. Installed wheels use the `flow2skill` console command; the batch launcher is not installed by the wheel.
|
|
64
|
+
|
|
65
|
+
Studio opens at `http://127.0.0.1:8765` and writes bundles to `~/Flow2SkillWorkspaces` unless another root is supplied.
|
|
66
|
+
|
|
67
|
+
## Thirty-second proof
|
|
68
|
+
|
|
69
|
+
Generate an entirely local sample bundle:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
flow2skill demo --out ./flow2skill-demo
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Run it against Flow2Skill's packaged local fixture:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# macOS/Linux
|
|
79
|
+
F2S_LABEL_API_TOKEN_1="runtime-demo-token" \
|
|
80
|
+
FLOW2SKILL_LIVE=1 \
|
|
81
|
+
FLOW2SKILL_ALLOW_SIDE_EFFECTS=1 \
|
|
82
|
+
pytest -q ./flow2skill-demo/test_agent_release_gate.py
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Windows Command Prompt:
|
|
86
|
+
|
|
87
|
+
```cmd
|
|
88
|
+
set F2S_LABEL_API_TOKEN_1=runtime-demo-token
|
|
89
|
+
set FLOW2SKILL_LIVE=1
|
|
90
|
+
set FLOW2SKILL_ALLOW_SIDE_EFFECTS=1
|
|
91
|
+
pytest -q flow2skill-demo\test_agent_release_gate.py
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The side-effect flag is required because the proof fills a synthetic API-token field and clicks a validation button, even though the packaged fixture is local and harmless. The captured synthetic value is absent from the generated bundle.
|
|
95
|
+
|
|
96
|
+
## Record a workflow
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
flow2skill record https://example.com ^
|
|
100
|
+
--name "Documentation search" ^
|
|
101
|
+
--success-text "Results"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Complete the flow in Playwright Inspector, capture an assertion or provide `--success-text`, and close the recorder window. Flow2Skill compiles the capture and deletes its temporary raw codegen and recorder log.
|
|
105
|
+
|
|
106
|
+
Recording uses the pinned Playwright codegen version declared by this package. `flow2skill doctor` verifies version alignment and prerequisites.
|
|
107
|
+
|
|
108
|
+
## Compile existing codegen
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
flow2skill compile recording.py \
|
|
112
|
+
--name "Documentation search" \
|
|
113
|
+
--intent "Search the docs and prove results appear." \
|
|
114
|
+
--out ./compiled-flow
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Protection is enabled by default. `--no-protect-inputs` preserves non-sensitive literal values and should only be used for known-public test data. Sensitive fields remain protected.
|
|
118
|
+
|
|
119
|
+
**Input-file contract:** `flow2skill compile` never deletes the file you explicitly provide. Playwright codegen files can contain credentials or typed data; store and remove that source according to your own retention policy.
|
|
120
|
+
|
|
121
|
+
## Inspect and replay
|
|
122
|
+
|
|
123
|
+
Dry-run without opening a browser:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
flow2skill inspect ./compiled-flow/flow.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Run the generated standalone proof:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
FLOW2SKILL_LIVE=1 pytest -q ./compiled-flow/test_documentation_search.py
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Use `FLOW2SKILL_HEADED=1` to watch. Any workflow containing review or approval actions also requires `FLOW2SKILL_ALLOW_SIDE_EFFECTS=1`. Set it only after reviewing the exact generated plan. Use `FLOW2SKILL_CHANNEL=chrome` to replay with an installed Chrome channel instead of Playwright's managed Chromium.
|
|
136
|
+
|
|
137
|
+
## Supported capture surface
|
|
138
|
+
|
|
139
|
+
- one synchronous pytest-style test function;
|
|
140
|
+
- direct Playwright call statements only;
|
|
141
|
+
- `page.goto`;
|
|
142
|
+
- role, label, placeholder, text, test-id, title, alt-text, and CSS selectors;
|
|
143
|
+
- `.first` and literal `.nth(...)` modifiers;
|
|
144
|
+
- `click`, `fill`, `press`, `select_option`, `check`, `uncheck`, and `hover`;
|
|
145
|
+
- `expect(...).to_be_visible()`;
|
|
146
|
+
- exact `to_have_text()` and substring `to_contain_text()` assertions;
|
|
147
|
+
- `expect(page).to_have_url()`;
|
|
148
|
+
- `expect(...).to_have_value()`.
|
|
149
|
+
|
|
150
|
+
Unsupported calls, dynamic expressions, assignments, loops, branches, context managers, nested functions, and multiple tests are rejected. They are never flattened or silently omitted.
|
|
151
|
+
|
|
152
|
+
## Security and privacy model
|
|
153
|
+
|
|
154
|
+
### Recording boundary
|
|
155
|
+
|
|
156
|
+
During live recording, Playwright briefly writes raw Python to a hidden workspace file. Flow2Skill deletes this file and the recorder log on completion, cancellation, launch failure, or compile failure. On startup it removes abandoned raw captures older than one hour. A hard power loss can therefore leave a temporary file until the next cleanup window. Do not record real production credentials when synthetic test credentials are available.
|
|
157
|
+
|
|
158
|
+
### Manifest integrity
|
|
159
|
+
|
|
160
|
+
`flow.json` carries a SHA-256 fingerprint. Loading rejects unknown fields, malformed selector types, missing fingerprints, content tampering, stale slugs, and risk-classification downgrades. The fingerprint detects accidental or local modification; it is not a cryptographic signature from a trusted publisher.
|
|
161
|
+
|
|
162
|
+
Runtime variables are restricted to the compiler-owned `F2S_*` namespace. Captured `${VARIABLE}` syntax is rejected instead of being allowed to read arbitrary host environment variables. Navigation containing protected values is approval-gated because it can transmit the value to the destination.
|
|
163
|
+
|
|
164
|
+
Common credential-bearing URL parameters, including JWT, token, signature, session, authentication, and password fields, are replaced with runtime variables. Recompiling into an existing managed bundle directory removes obsolete generated `test_*.py` files so stale executable proofs cannot survive unnoticed.
|
|
165
|
+
|
|
166
|
+
### Studio boundary
|
|
167
|
+
|
|
168
|
+
Studio enforces:
|
|
169
|
+
|
|
170
|
+
- loopback-only binding;
|
|
171
|
+
- strict local `Host` validation against DNS rebinding;
|
|
172
|
+
- same-origin checks;
|
|
173
|
+
- a random per-process request token;
|
|
174
|
+
- a one-megabyte JSON body limit;
|
|
175
|
+
- strict request field types;
|
|
176
|
+
- workspace and artifact path containment;
|
|
177
|
+
- no-store and browser hardening headers.
|
|
178
|
+
|
|
179
|
+
### Approval boundary
|
|
180
|
+
|
|
181
|
+
Flow2Skill compiles instructions; it does not grant permission. Generated skills call out approval-gated actions. Generated tests are disabled unless `FLOW2SKILL_LIVE=1` is present. Once live execution is requested, a missing side-effect flag fails the test rather than reporting a successful skip.
|
|
182
|
+
|
|
183
|
+
See [SECURITY.md](SECURITY.md) for the threat model and reporting process.
|
|
184
|
+
|
|
185
|
+
## Development
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
python -m pip install -e ".[dev]"
|
|
189
|
+
ruff format --check src tests scripts
|
|
190
|
+
ruff check src tests scripts
|
|
191
|
+
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q
|
|
192
|
+
python -m build
|
|
193
|
+
python -m twine check dist/*
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The release gate also installs the wheel into a clean environment, runs the packaged demo against a real browser, checks source/wheel contents, and scans tracked files for high-confidence secrets and private paths.
|
|
197
|
+
|
|
198
|
+
## Intentional boundaries
|
|
199
|
+
|
|
200
|
+
Flow2Skill does not include cloud sync, a browser extension, shared secret storage, autonomous planning, or LLM selector healing. Those features create a platform before the deterministic compiler has earned it. The current product does one job: preserve a successful browser workflow as a reviewable procedure and executable proof.
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
MIT
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are applied to the latest released minor version of Flow2Skill.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| 0.1.x | Yes |
|
|
10
|
+
| Earlier | No |
|
|
11
|
+
|
|
12
|
+
## Report a vulnerability
|
|
13
|
+
|
|
14
|
+
Use GitHub's **Private vulnerability reporting** for this repository. Do not open a public issue containing credentials, raw Playwright recordings, private URLs, or an exploit that has not been fixed.
|
|
15
|
+
|
|
16
|
+
Include:
|
|
17
|
+
|
|
18
|
+
- affected Flow2Skill version and operating system;
|
|
19
|
+
- the smallest safe reproduction;
|
|
20
|
+
- expected and observed behavior;
|
|
21
|
+
- whether a raw recording, generated artifact, Studio endpoint, or replay boundary is involved.
|
|
22
|
+
|
|
23
|
+
You should receive an acknowledgement within seven days. A fix and disclosure timeline will be coordinated based on severity.
|
|
24
|
+
|
|
25
|
+
## Threat model
|
|
26
|
+
|
|
27
|
+
Flow2Skill treats all recordings and workflow manifests as untrusted input.
|
|
28
|
+
|
|
29
|
+
Security boundaries include:
|
|
30
|
+
|
|
31
|
+
- AST parsing without importing or executing recorded Python;
|
|
32
|
+
- a strict allowlist of portable Playwright calls;
|
|
33
|
+
- fail-closed rejection of nested locator scopes and unknown selector modifiers;
|
|
34
|
+
- default protection of typed and asserted values;
|
|
35
|
+
- correlation and replacement of protected values echoed in later selector text;
|
|
36
|
+
- URL credential, query-secret, and fragment-secret redaction;
|
|
37
|
+
- compiler-owned `F2S_*` runtime variables; captured placeholder syntax is rejected;
|
|
38
|
+
- fingerprint and schema validation for manifests;
|
|
39
|
+
- review or approval gates for mutating browser actions;
|
|
40
|
+
- loopback-only Studio binding, local Host validation, same-origin enforcement, and request tokens;
|
|
41
|
+
- deletion of recorder-owned raw captures and logs.
|
|
42
|
+
|
|
43
|
+
## Non-goals and residual risks
|
|
44
|
+
|
|
45
|
+
- A SHA-256 manifest fingerprint detects modification but does not authenticate an author.
|
|
46
|
+
- Selector text and public page labels are preserved and may reveal application structure.
|
|
47
|
+
- A hard crash can leave a temporary raw recording until startup cleanup removes files older than one hour.
|
|
48
|
+
- `flow2skill compile recording.py` does not delete the user-supplied source file.
|
|
49
|
+
- Environment variables can be exposed by the host process, shell history, CI logs, or malicious test code. Flow2Skill does not provide a secret store.
|
|
50
|
+
- Navigation containing a runtime value is approval-gated because replay sends that value to the destination.
|
|
51
|
+
- Bundle output directories are Flow2Skill-managed: refreshing a bundle removes obsolete generated `test_*.py` files but preserves unrelated filenames.
|
|
52
|
+
- Generated tests drive a real browser. Review the plan and target environment before enabling live replay.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal
|
|
3
|
+
cd /d "%~dp0"
|
|
4
|
+
if exist ".venv\Scripts\flow2skill.exe" (
|
|
5
|
+
".venv\Scripts\flow2skill.exe" studio
|
|
6
|
+
) else (
|
|
7
|
+
python -m flow2skill studio
|
|
8
|
+
)
|
|
9
|
+
if errorlevel 1 (
|
|
10
|
+
echo.
|
|
11
|
+
echo Flow2Skill could not start. Install it once with:
|
|
12
|
+
echo python -m pip install -e ".[dev]"
|
|
13
|
+
pause
|
|
14
|
+
)
|