beforeopen 0.0.0-stage → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BeforeOpen contributors
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/README.es.md ADDED
@@ -0,0 +1,135 @@
1
+ <h1 align="center" id="title">BEFOREOPEN</h1>
2
+
3
+ <p align="center"><img src="https://socialify.git.ci/willor16/beforeopen/image?description=1&amp;descriptionEditable=Mira%20qu%C3%A9%20ejecutar%C3%A1%20un%20repositorio%20en%20tu%20m%C3%A1quina%20antes%20de%20abrirlo.&amp;font=Inter&amp;forks=1&amp;issues=1&amp;language=1&amp;name=1&amp;owner=1&amp;pattern=Circuit%20Board&amp;pulls=1&amp;stargazers=1&amp;theme=Dark" alt="imagen del proyecto"></p>
4
+
5
+ <p id="description">Abrir una carpeta puede bastar para ejecutar código ajeno: tareas del editor, hooks de agentes de IA, servidores MCP, scripts de instalación o hooks de git. BeforeOpen lee un repositorio sin ejecutar nada y muestra qué se ejecutaría, cuándo y por qué parece peligroso. No busca malware conocido: dibuja el mapa de lo que se puede ejecutar, así que no depende de haber visto antes un ataque.</p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/willor16/beforeopen"><img src="https://img.shields.io/badge/willor16%2Fbeforeopen-black?style=social&amp;logo=github" alt="repositorio"></a>
9
+ <a href="https://github.com/willor16/beforeopen/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/willor16/beforeopen/ci.yml?branch=main&amp;label=CI" alt="CI"></a>
10
+ <img src="https://img.shields.io/badge/dependencias-0-brightgreen" alt="sin dependencias en ejecución">
11
+ <a href="LICENSE"><img src="https://img.shields.io/badge/licencia-MIT-blue" alt="licencia MIT"></a>
12
+ </p>
13
+
14
+ <p align="center"><a href="README.md">🌎 Read in English</a></p>
15
+
16
+ <h2>📸 Capturas del proyecto:</h2>
17
+
18
+ <p align="center"><img src="docs/demo.es.svg" alt="captura del proyecto" width="800"></p>
19
+
20
+ <h2>🧐 Características</h2>
21
+
22
+ Algunas de las mejores características del proyecto:
23
+
24
+ * Analiza carpetas, repositorios de GitHub y GitLab, y pull requests
25
+ * Sigue cada comando hasta los scripts que ejecuta
26
+ * Avisa en cada pull request con una GitHub Action
27
+ * Reglas en YAML que cualquiera puede ampliar
28
+ * Informes en español e inglés
29
+ * Sin telemetría, sin cuentas y sin scripts de instalación
30
+
31
+ <h2>🛠️ Pasos de instalación:</h2>
32
+
33
+ Necesitas [Node.js](https://nodejs.org) 20 o posterior, y git.
34
+
35
+ <p>1. Clona el repositorio</p>
36
+
37
+ ```sh
38
+ git clone https://github.com/willor16/beforeopen.git
39
+ cd beforeopen
40
+ ```
41
+
42
+ <p>2. Compílalo</p>
43
+
44
+ ```sh
45
+ npm ci --ignore-scripts
46
+ npm run build
47
+ ```
48
+
49
+ <p>3. Instala el comando</p>
50
+
51
+ ```sh
52
+ npm install -g .
53
+ ```
54
+
55
+ <h2>🚀 Uso:</h2>
56
+
57
+ ```sh
58
+ beforeopen owner/repo # un repositorio de GitHub, sin clonarlo
59
+ beforeopen https://github.com/o/r/pull/12 # un pull request
60
+ beforeopen https://gitlab.com/grupo/repo # cualquier servidor git
61
+ beforeopen ~/Downloads/prueba-tecnica # una carpeta
62
+ beforeopen diff main rama # lo que agrega una rama
63
+ ```
64
+
65
+ Agrega `--all` para ver los hallazgos de gravedad baja, o `--json` para otras herramientas. El código de salida es 0 si no encontró nada grave, 1 si encontró algo y 2 si el análisis falló o quedó incompleto.
66
+
67
+ <h2>🤖 GitHub Action:</h2>
68
+
69
+ Informa solo de lo que un pull request agrega o cambia. No necesita token ni secretos.
70
+
71
+ ```yaml
72
+ # .github/workflows/beforeopen.yml
73
+ name: beforeopen
74
+ on: pull_request
75
+ permissions:
76
+ contents: read
77
+ jobs:
78
+ check:
79
+ runs-on: ubuntu-latest
80
+ steps:
81
+ - uses: actions/checkout@v5
82
+ with:
83
+ fetch-depth: 2
84
+ persist-credentials: false
85
+ - uses: willor16/beforeopen@v0 # mejor: fija el hash completo de un commit
86
+ with:
87
+ lang: es
88
+ ```
89
+
90
+ Usa `pull_request`, nunca `pull_request_target`.
91
+
92
+ <h2>🔍 Qué revisa:</h2>
93
+
94
+ | Cuándo | Dónde |
95
+ | --- | --- |
96
+ | 📝 Al abrir en un editor | VS Code, JetBrains, Vim, Emacs, Zed, MSBuild |
97
+ | 🤖 Al abrir con un agente de IA | Claude Code, Cursor, Codex, Gemini CLI, Copilot, Windsurf, Kiro, Opencode, servidores MCP, instrucciones con texto oculto |
98
+ | 📁 Al entrar en la carpeta | direnv, mise, autoenv |
99
+ | 🌿 Al usar git | Hooks, `.git/config`, repositorios ocultos, submódulos, husky, lefthook, pre-commit |
100
+ | 📦 Al abrir en un contenedor | Comandos del contenedor de desarrollo y acceso a tu máquina |
101
+ | ⬇️ Al instalar | npm, pnpm, Yarn, Bun, node-gyp, pip, setup.py, Composer, CocoaPods |
102
+ | 🔨 Al compilar o probar | Cargo, Gradle, Maven, pytest, configuración que es código |
103
+
104
+ <h2>🔒 Cómo se protege:</h2>
105
+
106
+ * Los archivos solo se leen. No se ejecuta, instala ni extrae nada
107
+ * Git nunca usa la configuración del repositorio analizado
108
+ * Un programa `git` plantado en la carpeta se ignora
109
+ * Los trucos con mayúsculas, enlaces, codificaciones y caracteres invisibles no esconden un archivo
110
+ * El informe no puede controlar tu terminal ni tu resumen de GitHub
111
+
112
+ <h2>⚠️ Límites:</h2>
113
+
114
+ * Nunca dice que un repositorio es seguro
115
+ * No analiza tus dependencias, archivos binarios ni código construido al ejecutarse
116
+ * No se ha medido contra una colección de ataques reales
117
+ * En 40 repositorios populares no usados para ajustar las reglas, pudo analizar 39 y 2 tuvieron un hallazgo alto, ambos en scripts legítimos
118
+
119
+ <h2>🍰 Cómo contribuir:</h2>
120
+
121
+ Se agradecen reglas nuevas, falsos positivos y formas de esconderse del analizador, en español o inglés. Mira [CONTRIBUTING.md](CONTRIBUTING.md) y [SECURITY.md](SECURITY.md).
122
+
123
+ <h2>💻 Hecho con</h2>
124
+
125
+ Tecnologías usadas en el proyecto:
126
+
127
+ * TypeScript
128
+ * Node.js
129
+ * Git
130
+ * GitHub Actions
131
+ * YAML
132
+
133
+ <h2>🛡️ Licencia:</h2>
134
+
135
+ Este proyecto usa la [licencia MIT](LICENSE). Incluye [código de terceros](THIRD-PARTY-NOTICES.md).
package/README.md CHANGED
@@ -1,3 +1,133 @@
1
- # Temporary Holding Version
1
+ <h1 align="center" id="title">BEFOREOPEN</h1>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center"><img src="https://socialify.git.ci/willor16/beforeopen/image?description=1&amp;descriptionEditable=See%20what%20a%20repository%20will%20run%20on%20your%20machine%20before%20you%20open%20it.&amp;font=Inter&amp;forks=1&amp;issues=1&amp;language=1&amp;name=1&amp;owner=1&amp;pattern=Circuit%20Board&amp;pulls=1&amp;stargazers=1&amp;theme=Dark" alt="project-image"></p>
4
+
5
+ <p id="description">Opening a folder can be enough to run someone else's code: editor tasks, AI agent hooks, MCP servers, install scripts or git hooks. BeforeOpen reads a repository without executing anything and shows what would run, when, and why it looks dangerous. It does not look for known malware: it maps what can be executed, so it does not depend on having seen an attack before.</p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/willor16/beforeopen"><img src="https://img.shields.io/badge/willor16%2Fbeforeopen-black?style=social&amp;logo=github" alt="repository"></a>
9
+ <a href="https://github.com/willor16/beforeopen/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/willor16/beforeopen/ci.yml?branch=main&amp;label=CI" alt="CI"></a>
10
+ <img src="https://img.shields.io/badge/runtime%20dependencies-0-brightgreen" alt="no runtime dependencies">
11
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
12
+ </p>
13
+
14
+ <p align="center"><a href="README.es.md">🌎 Leer en español</a></p>
15
+
16
+ <h2>📸 Project Screenshots:</h2>
17
+
18
+ <p align="center"><img src="docs/demo.svg" alt="project-screenshot" width="800"></p>
19
+
20
+ <h2>🧐 Features</h2>
21
+
22
+ Some of the project's best features:
23
+
24
+ * Scans folders, GitHub and GitLab repositories and pull requests
25
+ * Follows every command to the scripts it runs
26
+ * Warns in each pull request with a GitHub Action
27
+ * Rules in YAML that anyone can extend
28
+ * Reports in English and Spanish
29
+ * No telemetry, no account and no install scripts
30
+
31
+ <h2>🛠️ Installation Steps:</h2>
32
+
33
+ You need [Node.js](https://nodejs.org) 20 or later, and git.
34
+
35
+ <p>1. Clone the repository</p>
36
+
37
+ ```sh
38
+ git clone https://github.com/willor16/beforeopen.git
39
+ cd beforeopen
40
+ ```
41
+
42
+ <p>2. Build it</p>
43
+
44
+ ```sh
45
+ npm ci --ignore-scripts
46
+ npm run build
47
+ ```
48
+
49
+ <p>3. Install the command</p>
50
+
51
+ ```sh
52
+ npm install -g .
53
+ ```
54
+
55
+ <h2>🚀 Usage:</h2>
56
+
57
+ ```sh
58
+ beforeopen owner/repo # a GitHub repository, without cloning it
59
+ beforeopen https://github.com/o/r/pull/12 # a pull request
60
+ beforeopen https://gitlab.com/group/repo # any git server
61
+ beforeopen ~/Downloads/take-home-test # a folder
62
+ beforeopen diff main feature # what a branch adds
63
+ ```
64
+
65
+ Add `--all` to see low severity findings, or `--json` for other tools. The exit code is 0 when nothing serious was found, 1 when something was, and 2 when the scan failed or was incomplete.
66
+
67
+ <h2>🤖 GitHub Action:</h2>
68
+
69
+ It reports only what a pull request adds or changes. It needs no token and no secrets.
70
+
71
+ ```yaml
72
+ # .github/workflows/beforeopen.yml
73
+ name: beforeopen
74
+ on: pull_request
75
+ permissions:
76
+ contents: read
77
+ jobs:
78
+ check:
79
+ runs-on: ubuntu-latest
80
+ steps:
81
+ - uses: actions/checkout@v5
82
+ with:
83
+ fetch-depth: 2
84
+ persist-credentials: false
85
+ - uses: willor16/beforeopen@v0 # better: pin a full commit hash
86
+ ```
87
+
88
+ Use `pull_request`, never `pull_request_target`.
89
+
90
+ <h2>🔍 What it looks at:</h2>
91
+
92
+ | When | Where |
93
+ | --- | --- |
94
+ | 📝 Opening in an editor | VS Code, JetBrains, Vim, Emacs, Zed, MSBuild |
95
+ | 🤖 Opening with an AI agent | Claude Code, Cursor, Codex, Gemini CLI, Copilot, Windsurf, Kiro, Opencode, MCP servers, instructions with hidden text |
96
+ | 📁 Entering the folder | direnv, mise, autoenv |
97
+ | 🌿 Using git | Hooks, `.git/config`, hidden repositories, submodules, husky, lefthook, pre-commit |
98
+ | 📦 Opening in a container | Dev container commands and access to your machine |
99
+ | ⬇️ Installing | npm, pnpm, Yarn, Bun, node-gyp, pip, setup.py, Composer, CocoaPods |
100
+ | 🔨 Building or testing | Cargo, Gradle, Maven, pytest, configuration that is code |
101
+
102
+ <h2>🔒 How it stays safe:</h2>
103
+
104
+ * Files are only read. Nothing is executed, installed or checked out
105
+ * Git never uses the configuration of the repository being scanned
106
+ * A `git` program planted in the folder is ignored
107
+ * Tricks with case, links, encodings and invisible characters do not hide a file
108
+ * The report cannot control your terminal or your GitHub summary
109
+
110
+ <h2>⚠️ Limits:</h2>
111
+
112
+ * It never says that a repository is safe
113
+ * It does not analyse your dependencies, binary files or code built at run time
114
+ * It has not been measured against a collection of real attacks
115
+ * On 40 popular repositories not used to adjust the rules, 39 could be scanned and 2 had a high finding, both in legitimate scripts
116
+
117
+ <h2>🍰 Contribution Guidelines:</h2>
118
+
119
+ New rules, false positives and ways to hide from the scanner are welcome, in English or Spanish. See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
120
+
121
+ <h2>💻 Built with</h2>
122
+
123
+ Technologies used in the project:
124
+
125
+ * TypeScript
126
+ * Node.js
127
+ * Git
128
+ * GitHub Actions
129
+ * YAML
130
+
131
+ <h2>🛡️ License:</h2>
132
+
133
+ This project is licensed under the [MIT License](LICENSE). It includes [third-party code](THIRD-PARTY-NOTICES.md).
@@ -0,0 +1,43 @@
1
+ # Third-party notices
2
+
3
+ The published files include code from these packages.
4
+
5
+ ## jsonc-parser 3.3.1
6
+
7
+ The MIT License (MIT)
8
+
9
+ Copyright (c) Microsoft
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ ## yaml 2.9.1
30
+
31
+ Copyright Eemeli Aro <eemeli@gmail.com>
32
+
33
+ Permission to use, copy, modify, and/or distribute this software for any purpose
34
+ with or without fee is hereby granted, provided that the above copyright notice
35
+ and this permission notice appear in all copies.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
38
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
39
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
41
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
42
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
43
+ THIS SOFTWARE.