uiport 0.0.0-bootstrap.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/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ Notable changes are documented here. Versions follow Semantic Versioning.
4
+
5
+ ## [0.1.0] — 2026-09-30
6
+
7
+ ### Added
8
+ - CLI capture, serve, validate and explicit browser installation; JSON diagnostics.
9
+ - Original responsive and CSS motion examples and coding-agent skill.
10
+ - Bounded downloads, optional source runtime omission, staged output and confined preview server.
11
+ - CSS import/resource localization, srcset, SVG fragments and observed WAAPI replay.
12
+ - Visual and network comparison, behavior limitations, cross-platform CI and package consumer tests.
13
+ - English/Portuguese documentation, MIT license, contribution and governance guides.
14
+
15
+ ### Fixed
16
+ - Restore prototype migration parity: body/html captures, source scripts/handlers and recognized visual libraries, browser-response reuse, contextual CSS variables and pt-BR defaults.
17
+ - Validate existing prototype artifacts without rewriting them; restore WebAssembly MIME and case-insensitive preview extensions.
18
+ - Localize string candidates in CSS `image-set()` and `-webkit-image-set()`, including inline and imported styles.
19
+ - Apply operation deadlines and cancellation during browser startup and terminate the owned process tree.
20
+ - Redact URL credentials, queries and fragments from operational error output.
21
+
22
+ ### Changed
23
+ - Standardize the agent guide as `uiport.md` and browser configuration as `UIPORT_BROWSER_PATH` before the first release.
@@ -0,0 +1,83 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ * Trolling, insulting or derogatory comments, and personal or political attacks
23
+ * Public or private harassment
24
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [lorranhippolyte@gmail.com](mailto:lorranhippolyte@gmail.com). All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact**: A violation through a single incident or series of actions.
56
+
57
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62
+
63
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74
+
75
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
76
+
77
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
78
+
79
+ [homepage]: https://www.contributor-covenant.org
80
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
81
+ [Mozilla CoC]: https://github.com/mozilla/diversity
82
+ [FAQ]: https://www.contributor-covenant.org/faq
83
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,30 @@
1
+ # Contributing to UIport
2
+
3
+ Issues, reduced original fixtures, documentation and pull requests are welcome. Lorran Hippolyte reviews releases and merges, with development and maintenance by LuminaSoft.
4
+
5
+ ## Development
6
+
7
+ Use Node 24 LTS (minimum supported: 22.14).
8
+
9
+ ```sh
10
+ npm ci
11
+ node bin/cli.mjs browser install
12
+ npm run check
13
+ ```
14
+
15
+ `check` runs ESLint, JSDoc type checks, ESM syntax checks, tests and a real packed-package consumer test. Browser tests use local servers and original fixtures. Dependency/browser installation can access the network; no extraction test targets a third-party website.
16
+
17
+ - `npm run test:unit`: fast boundary tests.
18
+ - `npm test`: unit and browser tests, four-viewports capture/validation, source runtime omission and failure paths.
19
+ - `npm run test:package`: inspect the tarball and install it outside the checkout without devDependencies, then run CLI capture and validation.
20
+ - `tools/create-test-font.py`: optional regeneration of our original geometric test font; requires Python fonttools, never needed to run tests.
21
+
22
+ Read [architecture](docs/architecture.md) and [support](docs/support.md). Keep fixes bounded and add a regression test for behavior that can fail. Avoid tests that only mirror implementation text.
23
+
24
+ ## Pull requests
25
+
26
+ Branch from main. Explain the observed problem, changed behavior and verification. Do not commit captured customer pages, credentials, sessions, node_modules, generated capture output or personal data. Reproduce bugs with original local fixtures; links to public sites are optional context, not CI dependencies.
27
+
28
+ Report supported/unsupported behavior honestly. A screenshot match does not prove a working interaction. Preserve original observed effects; do not silently substitute invented animation.
29
+
30
+ Contributions are accepted under the repository MIT license. No CLA is required for 0.1. Follow the [code of conduct](CODE_OF_CONDUCT.md); report vulnerabilities through [SECURITY.md](SECURITY.md).
package/GOVERNANCE.md ADDED
@@ -0,0 +1,9 @@
1
+ # Governance
2
+
3
+ UIport is created and maintained by Lorran Hippolyte, with development and maintenance by LuminaSoft. It is shared with the AI Coders Academy community; community credit does not imply ownership of this repository or responsibility for releases.
4
+
5
+ Lorran decides project scope, merges, release approvals and moderation. Contributors may propose changes through issues and pull requests. Significant behavior changes should describe compatibility and test evidence before implementation.
6
+
7
+ The project is MIT licensed, accepts external contributions and makes no support SLA commitment. Releases follow semantic versioning; during 0.x, minor releases may contain breaking changes described in the changelog.
8
+
9
+ Publication uses a reviewed commit and a protected release environment. Maintainer approval is required for release. Secrets and personal sessions must never be committed.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lorran Hippolyte
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.
package/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ UIport
2
+ Created and maintained by Lorran Hippolyte.
3
+ Development and maintenance: LuminaSoft.
4
+ Shared with the AI Coders Academy community.
5
+
6
+ The MIT license applies to UIport's original code and examples. It does not
7
+ license material captured from other websites. Use material you own or have
8
+ permission to reuse; preserve any applicable third-party license notices.
9
+ Captured assets may carry different copyright, trademark and usage terms.
10
+
11
+ Runtime dependencies retain their own licenses. UIport does not bundle copied
12
+ third-party websites, browser binaries or proprietary visual runtimes.
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ > Bootstrap package for configuring UIport trusted publishing. This is not the official release. The official version will be 0.1.0, published through GitHub Actions with provenance.
2
+
3
+ # UIport ↗
4
+
5
+ **Bring a web section into your next project.**
6
+
7
+ UIport captures a rendered section as editable HTML, original CSS and local assets. Inspect it, compare it with the source, and make it a starting point for your own work. Runs locally, from your terminal or coding agent. No account, API key or hosted service.
8
+
9
+ [Português brasileiro](README.pt-BR.md) · [Support matrix](docs/support.md) · [Contributing](CONTRIBUTING.md)
10
+
11
+ ![An original responsive section created for UIport](docs/demo.png)
12
+
13
+ ## What you get
14
+
15
+ ```text
16
+ my-section/
17
+ ├── index.html # HTML, styles and supported animation replay
18
+ └── assets/ # Local images, fonts and other referenced resources
19
+ ```
20
+
21
+ UIport keeps original CSS conservatively, including rules outside the selected section. It exports the first viewport's DOM and checks several screen sizes. It does **not** generate React components, crawl an entire site or recover arbitrary JavaScript behavior. Original scripts inside the selected content, inline event handlers and recognized visual library scripts are retained by default, as in the prototype. Use `capture --omit-scripts` to omit them. CSS motion and serializable Web Animations can travel with the section; dependencies and initialization outside it still require manual work.
22
+
23
+ ## Quick start
24
+
25
+ Requires **Node.js 22.14+**; Node 24 LTS recommended. Chromium is installed explicitly, or UIport can use your installed Chrome/Edge. Your existing browser sessions are not imported.
26
+
27
+ Install from npm:
28
+
29
+ ```sh
30
+ npx uiport@0.1.0 browser install
31
+ npx uiport@0.1.0 capture --url "https://your-site.example" --selector "#hero" --out ./my-section
32
+ npx uiport@0.1.0 serve --dir ./my-section
33
+ npx uiport@0.1.0 validate --url "https://your-site.example" --selector "#hero" --dir ./my-section
34
+ ```
35
+
36
+ Choose the selector using your browser's **Inspect element** tool. It must match exactly one container, such as `main`, `section` or a `div`. Use `body` to capture the whole visible page, or `html` to include original head scripts as well. This captures one page, not a multi-page crawl.
37
+
38
+ For repeated use: `npm install -g uiport`, then `uiport --help`. Pin a version for repeatable captures; `npx uiport@latest` follows future releases.
39
+
40
+ ### Try the original example from source
41
+
42
+ ```sh
43
+ git clone https://github.com/LorranHippolyte/uiport.git
44
+ cd uiport
45
+ npm ci
46
+ node bin/cli.mjs browser install
47
+ node bin/cli.mjs serve --dir examples/responsive-hero --port 4173
48
+ ```
49
+
50
+ In another terminal, from the same directory:
51
+
52
+ ```sh
53
+ node bin/cli.mjs capture --url http://127.0.0.1:4173 --selector '#hero' --out ./extractions/hero
54
+ node bin/cli.mjs validate --url http://127.0.0.1:4173 --selector '#hero' --dir ./extractions/hero
55
+ node bin/cli.mjs serve --dir ./extractions/hero --port 4174
56
+ ```
57
+
58
+ Open `http://127.0.0.1:4174`. You can move that output directory and serve it again. The second example, `examples/css-motion`, uses selector `#motion` and includes hover/focus states and CSS animations. Both examples and their illustrations were created for UIport.
59
+
60
+ ## Commands
61
+
62
+ | Command | Purpose |
63
+ |---|---|
64
+ | `capture --url URL --selector CSS --out DIR` | Capture one rendered section |
65
+ | `serve --dir DIR --port 4173` | Preview on loopback; stop with Ctrl+C |
66
+ | `validate --url URL --selector CSS --dir DIR` | Compare screenshots and observe resource errors |
67
+ | `browser install` | Install Chromium matched to the bundled Playwright version |
68
+ | `--help` / `--version` | Inspect the CLI without starting a browser |
69
+
70
+ `capture` and `validate` share `--viewports`, `--wait`, `--timeout`, `--max-scroll-steps`, `--locale`, `--color-scheme` and `--json`. Defaults: four viewports (`1440x900,1024x768,768x1024,375x812`), 1200 ms settle time, 120 s whole-operation deadline and 80 scroll steps. The default locale is `pt-BR`; use the same `--locale` and `--color-scheme` in capture and validation.
71
+
72
+ Capture limits copied resources to 20 MiB each and 100 MiB in total. Override with `--max-resource-mb` and `--max-total-mb`. The capture reuses responses received by its fresh browser context (including resources requiring Referer), then uses HTTP fetch as fallback. Budgets limit retained response bytes and exported downloads, not the browser's complete memory or the temporary buffer materialized by Playwright. Fallback fetching has a 15 s request deadline.
73
+
74
+ Set `UIPORT_BROWSER_PATH` to explicitly choose an executable. Otherwise UIport tries its compatible Chromium, then installed Chrome and Edge, including on macOS.
75
+
76
+ ### Read the result
77
+
78
+ - **Capture exit 0:** artifact produced with no known reported limitations. This is not a guarantee of full behavioral equivalence.
79
+ - **Capture exit 2:** artifact produced, with explicit limitations. Read `limitations` before using it.
80
+ - **Exit 1:** command failed, or validation failed its requested checks.
81
+ - **Validation exit 0:** the observed visual/network checks passed. Behavior remains `not-tested`.
82
+
83
+ `--json` produces one result on stdout for capture/validate/browser; progress goes to stderr. `serve --json` emits one readiness document and stays running until stopped. A script calling capture must handle exit 2, not treat every nonzero exit as “no files”. An existing nonempty output directory is never overwritten. Retained source code is reported as `SOURCE_RUNTIME_UNVERIFIED`: test its interactions; a screenshot match is not proof that all runtime dependencies survived.
84
+
85
+ Validation disables animations for screenshots. It compares pixels with a default 2% difference allowance and up to 5 px height difference; this does not certify hover, clicks, scroll animation or framework state. External requests are **blocked by default** in the exported page, including another localhost port. `--allow-external` opts out of that offline check. Existing prototype exports remain usable with `validate`; its legacy root marker is recognized without rewriting the folder. New exports use UIport markers. Inspect the [support matrix](docs/support.md) before interpreting a passing result.
86
+
87
+ Migration compatibility and intentional command/default changes: [migration notes](docs/migration.md).
88
+
89
+ ## Use with a coding agent
90
+
91
+ Start with [uiport.md](uiport.md). Read [skills/uiport/SKILL.md](skills/uiport/SKILL.md), or copy it into your agent's skill directory. The same file ships with the npm package. The agent should capture, read limitations, inspect supported interactions and validate, without inventing replacement effects. No LLM API is called by UIport itself.
92
+
93
+ ## Contribute
94
+
95
+ Bug reports, reduced test cases, documentation and improvements to resource handling are welcome. Start with [CONTRIBUTING.md](CONTRIBUTING.md) and our [architecture](docs/architecture.md). Use original local fixtures rather than committing captured client websites. Supported development checks are `npm run check` after browser installation.
96
+
97
+ ## People and license
98
+
99
+ Created and maintained by **[Lorran Hippolyte](https://github.com/LorranHippolyte)**, with development and maintenance by **LuminaSoft**. Shared with the **AI Coders Academy** community.
100
+
101
+ UIport's original code and examples are [MIT licensed](LICENSE). Use pages you own or have permission to reuse. The license does not grant rights to third-party captured content; see [NOTICE](NOTICE). [Security reporting](SECURITY.md) · [Governance](GOVERNANCE.md) · [Code of conduct](CODE_OF_CONDUCT.md).
@@ -0,0 +1,97 @@
1
+ # UIport ↗
2
+
3
+ **Da seção no navegador ao ponto de partida no seu projeto.**
4
+
5
+ O UIport captura uma seção renderizada como HTML editável, CSS original e assets locais. Inspecione a implementação, compare com a origem e use como base para continuar seu projeto. Executa localmente, pelo terminal ou pelo seu agente de código, sem conta, chave de IA ou serviço hospedado.
6
+
7
+ [English](README.md) · [Matriz de suporte](docs/support.md) · [Contribuição](CONTRIBUTING.md)
8
+
9
+ ![Seção responsiva autoral criada para o UIport](docs/demo.png)
10
+
11
+ ## O que você recebe
12
+
13
+ ```text
14
+ minha-secao/
15
+ ├── index.html # HTML, estilos e reprodução de animações suportadas
16
+ └── assets/ # Imagens, fontes e outros recursos localizados
17
+ ```
18
+
19
+ O CSS é preservado de forma conservadora, incluindo regras fora da seção escolhida. A saída usa o DOM do primeiro tamanho de tela; a validação compara vários tamanhos. A ferramenta não gera componentes React, não percorre um site inteiro e não recupera qualquer comportamento JavaScript. Scripts dentro do conteúdo selecionado, eventos inline e scripts de bibliotecas visuais reconhecidas são preservados por padrão, como no protótipo. Use `capture --omit-scripts` para omiti-los. CSS e animações Web Animations serializáveis podem ser preservados; dependências e inicialização fora do recorte continuam exigindo análise manual.
20
+
21
+ ## Instalação e uso
22
+
23
+ Requer **Node.js 22.14+**; recomendamos Node 24 LTS. O Chromium é instalado explicitamente, ou a ferramenta usa Chrome/Edge já disponível. Sessões pessoais do navegador não são importadas.
24
+
25
+ Instale pelo npm:
26
+
27
+ ```sh
28
+ npx uiport@0.1.0 browser install
29
+ npx uiport@0.1.0 capture --url "https://seu-site.example" --selector "#hero" --out ./minha-secao
30
+ npx uiport@0.1.0 serve --dir ./minha-secao
31
+ npx uiport@0.1.0 validate --url "https://seu-site.example" --selector "#hero" --dir ./minha-secao
32
+ ```
33
+
34
+ Para escolher o seletor, use **Inspecionar elemento** no navegador. Ele precisa encontrar exatamente um container, como `main`, `section` ou `div`. Use `body` para capturar a página visível completa ou `html` para incluir também scripts originais do head. Isso captura uma página, sem percorrer automaticamente outras URLs do site.
35
+
36
+ Para uso frequente: `npm install -g uiport`, depois `uiport --help`. Fixe uma versão quando precisar reproduzir uma captura; `npx uiport@latest` acompanha versões futuras.
37
+
38
+ ### Experimentar o exemplo autoral pelo repositório
39
+
40
+ ```sh
41
+ git clone https://github.com/LorranHippolyte/uiport.git
42
+ cd uiport
43
+ npm ci
44
+ node bin/cli.mjs browser install
45
+ node bin/cli.mjs serve --dir examples/responsive-hero --port 4173
46
+ ```
47
+
48
+ Em outro terminal, na mesma pasta:
49
+
50
+ ```sh
51
+ node bin/cli.mjs capture --url http://127.0.0.1:4173 --selector '#hero' --out ./extractions/hero
52
+ node bin/cli.mjs validate --url http://127.0.0.1:4173 --selector '#hero' --dir ./extractions/hero
53
+ node bin/cli.mjs serve --dir ./extractions/hero --port 4174
54
+ ```
55
+
56
+ Abra `http://127.0.0.1:4174`. A pasta de saída pode ser movida e servida novamente. O segundo exemplo, `examples/css-motion`, usa o seletor `#motion` e contém hover, foco e animações CSS. Os exemplos e suas ilustrações são autorais do UIport.
57
+
58
+ ## Comandos e opções
59
+
60
+ | Comando | Resultado |
61
+ |---|---|
62
+ | `capture --url URL --selector CSS --out PASTA` | Captura uma seção renderizada |
63
+ | `serve --dir PASTA --port 4173` | Abre servidor local; encerra com Ctrl+C |
64
+ | `validate --url URL --selector CSS --dir PASTA` | Compara imagens e verifica erros de recursos |
65
+ | `browser install` | Instala Chromium compatível com a versão de Playwright do pacote |
66
+ | `--help` / `--version` | Mostra ajuda ou versão sem abrir navegador |
67
+
68
+ Capture e validate aceitam `--viewports`, `--wait`, `--timeout`, `--max-scroll-steps`, `--locale`, `--color-scheme` e `--json`. Padrões: `1440x900,1024x768,768x1024,375x812`, espera de 1200 ms, prazo total de 120 s, 80 passos de rolagem, idioma `pt-BR` e tema `light`. Use o mesmo `--locale` nos dois comandos quando precisar de outro idioma.
69
+
70
+ A captura limita recursos copiados a 20 MiB por arquivo e 100 MiB no total, configuráveis por `--max-resource-mb` e `--max-total-mb`. A captura reaproveita respostas recebidas pelo navegador, incluindo recursos que exigem Referer, e usa fetch HTTP como fallback. Os orçamentos limitam bytes retidos e baixados pela exportação, não a memória completa do navegador nem o buffer temporário materializado pelo Playwright. O fetch de fallback tem prazo de até 15 s.
71
+
72
+ `UIPORT_BROWSER_PATH` define o executável do navegador. Sem override, o UIport tenta Chromium compatível, Chrome e Edge instalados, incluindo macOS.
73
+
74
+ ## Como interpretar o resultado
75
+
76
+ - **Capture retorna 0:** criou o artefato sem limitações conhecidas relatadas. Não certifica equivalência funcional completa.
77
+ - **Capture retorna 2:** criou um artefato parcial. Leia `limitations` antes de usar.
78
+ - **Retorno 1:** falha operacional ou falha das verificações pedidas no validate.
79
+ - **Validate retorna 0:** verificações visuais/de rede passaram nos estados observados. Comportamento continua `not-tested`.
80
+
81
+ `--json` retorna um único resultado no stdout para capture/validate/browser; progresso vai para stderr. `serve --json` emite um único documento de início e permanece ativo até ser encerrado. Automações precisam tratar retorno 2 separadamente. A captura não sobrescreve uma pasta de saída existente com conteúdo. Código de origem preservado gera `SOURCE_RUNTIME_UNVERIFIED`: teste suas interações; igualdade de screenshots não comprova que todas as dependências foram recuperadas.
82
+
83
+ A comparação visual desativa animações, aceita por padrão 2% de diferença de pixels e até 5 px de diferença de altura. Ela não comprova cliques, hover, efeitos de scroll ou estado de framework. Requisições externas da saída são bloqueadas por padrão, inclusive outra porta de localhost. `--allow-external` permite essas requisições e desativa esse teste de funcionamento sem rede externa. O `validate` também reconhece o marcador de extrações do protótipo sem reescrever a pasta; novas extrações usam os marcadores UIport. Consulte os casos suportados em [docs/support.md](docs/support.md).
84
+
85
+ Compatibilidade com o protótipo e mudanças intencionais de comandos/limites: [notas de migração](docs/migration.md).
86
+
87
+ ## Usar com agentes e contribuir
88
+
89
+ Comece por [uiport.md](uiport.md). Leia [skills/uiport/SKILL.md](skills/uiport/SKILL.md) ou copie para a pasta de skills do seu agente. A skill também acompanha o pacote npm. O agente deve capturar, ler limitações, inspecionar interações suportadas e validar, sem inventar efeitos substitutos. O UIport não chama uma API de LLM.
90
+
91
+ Contribuições em recursos, documentação, testes e diagnóstico são bem-vindas. Veja [CONTRIBUTING.md](CONTRIBUTING.md). Use fixtures locais autorais; não envie extrações de clientes. Depois de instalar o browser, `npm run check` executa as verificações de desenvolvimento.
92
+
93
+ ## Autoria e licença
94
+
95
+ Criado e mantido por **[Lorran Hippolyte](https://github.com/LorranHippolyte)**, com desenvolvimento e manutenção da **LuminaSoft**. Compartilhado com a comunidade **AI Coders Academy**.
96
+
97
+ Código e exemplos autorais sob [licença MIT](LICENSE). Use páginas próprias ou cujo uso esteja autorizado. A licença da ferramenta não concede direitos sobre material de terceiros capturado; veja [NOTICE](NOTICE). [Segurança](SECURITY.md) · [Governança](GOVERNANCE.md) · [Conduta](CODE_OF_CONDUCT.md).
package/SECURITY.md ADDED
@@ -0,0 +1,12 @@
1
+ # Security policy
2
+
3
+ The latest 0.1.x release is the supported line once released. Before the first release, report against the current development branch.
4
+
5
+ Please use GitHub's **Report a vulnerability** feature:
6
+ https://github.com/LorranHippolyte/uiport/security/advisories/new
7
+
8
+ Provide version, operating system, a minimal original reproduction and impact. Do not post credentials, captured client HTML or personal data in public issues. There is no paid bug bounty or guaranteed response SLA.
9
+
10
+ UIport runs JavaScript from the source URL in a local browser. It does not import your everyday browser's sessions, but capture is not a hardened sandbox for hostile sites. Source scripts inside the selection, inline event handlers and recognized visual library scripts are retained by default. Review that code before running or redistributing an export. `capture --omit-scripts` omits source execution, but does not make the output a universally sanitized document.
11
+
12
+ The preview server is loopback-only and confines resolved file paths to its root. The export reuses responses from its fresh browser context; no personal browser session is imported. Retained response bytes and fallback downloads have budgets, but Playwright materializes response bodies before their actual size can be checked. These limits do not bound peak source-browser/process memory. Review captured material before redistributing or running it in another context.
package/bin/cli.mjs ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
3
+ import { spawn } from "node:child_process";
4
+ import path from "node:path";
5
+ import { allowed, parseArgs, optionsFor } from "../scripts/options.mjs";
6
+ import { safeErrorMessage } from "../scripts/lib.mjs";
7
+ const require = createRequire(import.meta.url);
8
+ const { version } = require("../package.json");
9
+ const argv = process.argv.slice(2);
10
+ const json = argv.includes("--json");
11
+ const command = argv[0];
12
+ const help = `UIport ${version} — bring a web section into your next project.
13
+
14
+ Usage:
15
+ uiport capture --url URL --selector CSS --out DIRECTORY [options]
16
+ uiport validate --url URL --selector CSS --dir DIRECTORY [options]
17
+ uiport serve --dir DIRECTORY [--port 4173] [--json]
18
+ uiport browser install
19
+
20
+ Capture / validate:
21
+ --viewports 1440x900,1024x768,768x1024,375x812
22
+ --wait 1200 Settle time per navigation (ms, 0–60000)
23
+ --timeout 120000 Whole operation deadline (ms, 1000–600000)
24
+ --max-scroll-steps 80 Bounded lazy-loading scroll (1–1000)
25
+ --locale pt-BR Browser locale
26
+ --color-scheme light light | dark
27
+ --json One JSON result on stdout; progress on stderr
28
+ Capture:
29
+ --omit-scripts Omit source scripts and inline event handlers
30
+ --max-resource-mb 20 Maximum copied resource size (0.001–100 MiB)
31
+ --max-total-mb 100 Total resource download budget (0.001–500 MiB)
32
+ Validate:
33
+ --max-diff-ratio 0.02 Maximum differing pixels (0–1)
34
+ --allow-external Allow remote requests; result is not an offline check
35
+
36
+ Exit codes: capture 0 = complete, 2 = partial, 1 = error.
37
+ Validate 0 = requested visual/network checks passed, 1 = failed.
38
+ Visual checks do not certify behavior. Use pages you own or have permission to reuse.
39
+ Browser installation is explicit. Set UIPORT_BROWSER_PATH to choose an executable.
40
+ --help and --version work without a browser. Documentation: https://github.com/LorranHippolyte/uiport
41
+ `;
42
+ try {
43
+ if (!command || command === "--help")
44
+ console.log(
45
+ json ? JSON.stringify({ command: "help", version, help }) : help,
46
+ );
47
+ else if (command === "--version")
48
+ console.log(json ? JSON.stringify({ version }) : version);
49
+ else {
50
+ if (!Object.hasOwn(allowed, command))
51
+ throw new Error(`Unknown command: ${command}`);
52
+ const args = parseArgs(
53
+ argv.slice(command === "browser" && argv[1] === "install" ? 2 : 1),
54
+ allowed[command],
55
+ );
56
+ if (args.help)
57
+ console.log(args.json ? JSON.stringify({ command, help }) : help);
58
+ else if (args.version)
59
+ console.log(args.json ? JSON.stringify({ version }) : version);
60
+ else if (command === "browser") {
61
+ if (argv[1] !== "install")
62
+ throw new Error("Usage: uiport browser install");
63
+ const child = spawn(
64
+ process.execPath,
65
+ [
66
+ path.join(
67
+ path.dirname(require.resolve("playwright-core/package.json")),
68
+ "cli.js",
69
+ ),
70
+ "install",
71
+ "chromium",
72
+ ],
73
+ { stdio: ["inherit", json ? "pipe" : "inherit", "inherit"] },
74
+ );
75
+ if (json) child.stdout.pipe(process.stderr);
76
+ const stop = () => child.kill("SIGTERM");
77
+ process.once("SIGINT", stop);
78
+ process.once("SIGTERM", stop);
79
+ const code = await new Promise((resolve, reject) => {
80
+ child.once("error", reject);
81
+ child.once("exit", (code) => resolve(code ?? 1));
82
+ });
83
+ process.removeListener("SIGINT", stop);
84
+ process.removeListener("SIGTERM", stop);
85
+ if (json)
86
+ console.log(
87
+ JSON.stringify({
88
+ command: "browser",
89
+ status: code === 0 ? "complete" : "failed",
90
+ }),
91
+ );
92
+ process.exitCode = Number(code);
93
+ } else {
94
+ const options = optionsFor(command, args);
95
+ const { [command]: run } = await import(`../scripts/${command}.mjs`);
96
+ const result = await run(options);
97
+ if (command !== "serve")
98
+ console.log(JSON.stringify(result, null, args.json ? undefined : 2));
99
+ process.exitCode =
100
+ result.status === "partial" ? 2 : result.status === "failed" ? 1 : 0;
101
+ }
102
+ }
103
+ } catch (error) {
104
+ if (json)
105
+ console.log(
106
+ JSON.stringify({
107
+ command: Object.hasOwn(allowed, command) ? command : "help",
108
+ status: "failed",
109
+ error: { code: "OPERATION_FAILED", message: safeErrorMessage(error) },
110
+ }),
111
+ );
112
+ else process.stderr.write(`UIport: ${safeErrorMessage(error)}\n`);
113
+ process.exitCode = 1;
114
+ }
@@ -0,0 +1,32 @@
1
+ # Architecture
2
+
3
+ UIport is one JavaScript ESM package with a CLI. No server backend, database, user accounts, telemetry or LLM provider is involved. The preview HTTP server binds only to loopback.
4
+
5
+ ```mermaid
6
+ flowchart LR
7
+ CLI[CLI and option validation] --> Browser[Playwright source browser]
8
+ Browser --> DOM[Rendered DOM and original styles]
9
+ DOM --> Resources[Bounded asset and CSS processing]
10
+ Resources --> Stage[Temporary output beside destination]
11
+ Stage --> Output[index.html and assets]
12
+ Output --> Preview[Local preview]
13
+ Preview --> Validate[Visual and network comparison]
14
+ ```
15
+
16
+ - `bin/cli.mjs`: dispatch, help, version, structured results, explicit browser install.
17
+ - `scripts/browser-process.mjs` / `browser-host.mjs`: own browser startup in a child process, allowing deadline/cancellation cleanup before Playwright returns a browser handle. Normal shutdown asks Playwright to close through IPC and waits for cleanup. Bounded signal/process-tree termination handles unresponsive browsers; the parent removes its dedicated temporary directory even after forced cancellation.
18
+ - `scripts/options.mjs`: strict arguments, URL/number/viewport validation.
19
+ - `scripts/capture.mjs`: capture orchestration, staged filesystem output, metadata and exact-data WAAPI replay.
20
+ - `scripts/dom.mjs`: browser-side DOM serialization; preserves source scripts/handlers by default (explicit --omit-scripts opt-out), supports section/body/html roots, handles open shadow trees, records styles and animation data.
21
+ - `scripts/resources.mjs`: streamed size/deadline limits, hash-named assets, PostCSS import processing and URL rewriting. Responses from the capture browser are preferred; independent HTTP fetch is a fallback. No personal browser session is imported.
22
+ - `scripts/browser-resources.mjs`: bounded retention of response bodies and redirect aliases from the fresh source context; Playwright body materialization is not a streaming memory limit.
23
+ - `scripts/css-context.mjs`: restores custom-property declarations whose selectors lost structural context, preserving their specificity, order and enclosing conditions instead of freezing computed viewport values.
24
+ - `scripts/validate.mjs`: isolated source/output contexts, screenshot comparison, resource and execution diagnostics. Does not infer behavioral equivalence.
25
+ - `scripts/lib.mjs`: browser discovery, lifecycle cleanup, static server confinement, serialization and staging utilities.
26
+ - `examples/`: original MIT-licensed material for onboarding and repeatable tests.
27
+
28
+ UIport separates browser serialization and pixel comparison into testable modules. CSS is deliberately conservative in 0.1. Complete CSS pruning, framework code generation and generic runtime isolation are not included.
29
+
30
+ The output transaction never overwrites a nonempty directory. Work happens in a sibling temporary folder and is moved only after serialization succeeds; temporary files are cleaned after failures. Concurrent edits to an originally empty destination cause commit to fail instead of replacing the new content.
31
+
32
+ `npm run typecheck` checks JSDoc-annotated argument and resource boundaries. It is not a claim of full static typing of browser-serialized DOM code. Syntax, ESLint and browser integration tests cover the remaining JavaScript. The package needs no transpilation.
package/docs/demo.png ADDED
Binary file
@@ -0,0 +1,29 @@
1
+ # Migration to UIport
2
+
3
+ UIport packages the original local extractor as an installable CLI. The initial release preserves the demonstrated extraction workflow before adding new product capabilities.
4
+
5
+ | Existing behavior | UIport |
6
+ |---|---|
7
+ | Extract one section or a complete page | Use a unique section selector, `body` or `html`. The document contains one html/body pair; `html` also retains original head scripts. |
8
+ | Inline handlers and scripts inside the selection | Preserved by default. Recognized visual library scripts outside the selection are also copied, as in the prototype. `capture --omit-scripts` explicitly omits source execution. |
9
+ | Assets received during navigation | Reuse responses from the fresh capture browser, including redirects and Referer-dependent resources, before independent HTTP fallback. No personal browser profile is imported. |
10
+ | Custom properties whose selector context was outside the section | Preserve original declarations and their conditions for the captured elements; do not freeze all computed variables to the first viewport. |
11
+ | Existing exported folders | `validate` recognizes the previous `data-effect-extractor-root` marker without modifying the files. New exports use `data-uiport-*`. The legacy name in this compatibility path is intentional. |
12
+ | Preview file types | WebAssembly MIME and case-insensitive extensions remain supported. |
13
+ | Default locale | `pt-BR` in both capture and validate; specify `--locale` to change it. |
14
+
15
+ ## Commands and intentional operational changes
16
+
17
+ Install dependencies at the repository root with `npm ci`. Use `node bin/cli.mjs capture`, `serve` and `validate` from source, or the `uiport` command after installation. The old `scripts/` package and its npm scripts are replaced by this entrypoint. Browser installation is explicit. `UIPORT_BROWSER_PATH` is the current executable override.
18
+
19
+ The package retains the release candidate's resource/time budgets, strict option validation, protected output staging and browser cleanup. Defaults are 20 MiB per copied resource, 100 MiB total, 120 seconds and 80 scroll steps. They are configurable; migration does not mean unbounded execution. Viewports and comparisons also have the limits listed in [support](support.md).
20
+
21
+ Capture exit 2 means a partial artifact was created and must be inspected. Original source code is reported as `SOURCE_RUNTIME_UNVERIFIED`, even if a particular click works. Preserving scripts is not generic framework reconstruction: outside initialization, relative JavaScript dependencies, dynamic state and unobserved interactions may need manual integration. The original extractor did not guarantee those either. Screenshots still do not certify behavior.
22
+
23
+ Browser-response budgets limit retained bytes. Playwright materializes a response body before actual-size validation; these budgets do not cap peak browser/process memory. Independent fallback downloads enforce streaming byte limits.
24
+
25
+ ## Evidence
26
+
27
+ `test/migration.test.mjs` exercises full-page/section output, inline and registered clicks, visual library loading, locale, redirect/Referer resources with the source offline, contextual variables (including native CSS nesting) together with media queries and inherited/fluid values, extensionless script execution through browser-response reuse and HTTP fallback, old export validation without mutation, and WebAssembly preview. Existing tests cover `--omit-scripts`, WAAPI replay, staging, deadlines, cleanup and the packaged consumer workflow.
28
+
29
+ This is evidence for these cases, not a promise that every website or application runtime can be exported faithfully. See the [complete agent guide](../uiport.md) for inspection, correction and delivery.