jarvis-ai-framework 1.0.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/AGENTS.md +416 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/agents/AGENTS.md +234 -0
- package/agents/README.md +309 -0
- package/agents/engineering/data/eng.data-engineer.agent.md +309 -0
- package/agents/engineering/eng.agent.md +303 -0
- package/agents/engineering/eng.bug-hunter.md +386 -0
- package/agents/engineering/eng.cybersecurity.agent.md +503 -0
- package/agents/engineering/eng.dev-code-reviewer.md +148 -0
- package/agents/engineering/eng.docs-writer.md +152 -0
- package/agents/engineering/eng.frontend.agent.md +117 -0
- package/agents/engineering/eng.rpa.agent.md +215 -0
- package/agents/engineering/eng.tech-analyst.agent.md +102 -0
- package/agents/engineering/eng.ux-designer.agent.md +193 -0
- package/agents/engineering/qa/eng.qa.cypress-specialist.md +109 -0
- package/agents/engineering/qa/eng.qa.quality-champion-task-agent.md +85 -0
- package/agents/engineering/qa/eng.qa.quality-strategist.md +111 -0
- package/agents/engineering/qa/eng.qa.test-architect.md +400 -0
- package/agents/engineering/qa/eng.qa.test-planner.md +477 -0
- package/agents/engineering/qa/eng.qa.testing-engineer.md +339 -0
- package/agents/product/prod.pm-checker.md +52 -0
- package/bin/commands/docs-publish.js +184 -0
- package/bin/commands/docs-sync.js +139 -0
- package/bin/commands/info.js +87 -0
- package/bin/commands/init.js +237 -0
- package/bin/commands/install-rtk.js +90 -0
- package/bin/commands/list.js +48 -0
- package/bin/commands/qa-signoff.js +112 -0
- package/bin/commands/whoami.js +43 -0
- package/bin/jarvis.js +159 -0
- package/bin/lib/auth/session.js +56 -0
- package/bin/lib/config/constants.js +123 -0
- package/bin/lib/config/ide-config.js +233 -0
- package/bin/lib/core/scanner.js +124 -0
- package/bin/lib/core/sync-engine.js +551 -0
- package/bin/lib/docs/fetch-file.sh +41 -0
- package/bin/lib/docs/publish-file.sh +284 -0
- package/bin/lib/docs/validate-frontmatter.js +157 -0
- package/bin/lib/env-loader.js +198 -0
- package/bin/lib/tasks/comment.js +131 -0
- package/bin/lib/utils/git-parser.js +145 -0
- package/bin/lib/utils/logger.js +104 -0
- package/bin/lib/utils/npmrc-parser.js +106 -0
- package/bin/lib/utils/paths.js +55 -0
- package/bin/lib/utils/ui.js +59 -0
- package/bin/lib/vcs/api.js +312 -0
- package/bin/lib/vcs/create-issue.js +43 -0
- package/bin/lib/vcs/create-merge.js +43 -0
- package/bin/lib/vcs/fetch-raw.js +30 -0
- package/bin/postinstall.js +41 -0
- package/members.md +25 -0
- package/package.json +55 -0
- package/rules/AGENTS.md +205 -0
- package/rules/engineering/data/data-rules.md +200 -0
- package/rules/engineering/eng-rules.md +243 -0
- package/rules/engineering/eng-security-rules.md +186 -0
- package/rules/engineering/eng.breakdown-subtasks-rules.md +585 -0
- package/rules/engineering/eng.bump-rules.md +27 -0
- package/rules/engineering/eng.docs-scraping-rules.md +64 -0
- package/rules/engineering/eng.downstream-flow-rules.md +297 -0
- package/rules/engineering/eng.integrations-rules.md +73 -0
- package/rules/engineering/eng.plan-rules.md +333 -0
- package/rules/engineering/eng.pr-rules.md +359 -0
- package/rules/engineering/eng.pre-pr-rules.md +103 -0
- package/rules/engineering/eng.start-rules.md +246 -0
- package/rules/engineering/eng.tech-spec-rules.md +968 -0
- package/rules/engineering/eng.work-rules.md +312 -0
- package/rules/engineering/frontend/eng.frontend-rules.md +147 -0
- package/rules/engineering/qa/eng.qa.cypress-standards-rules.md +259 -0
- package/rules/engineering/qa/eng.qa.exploratory-session-rules.md +137 -0
- package/rules/engineering/qa/eng.qa.quality-gate-scoring-rules.md +181 -0
- package/rules/engineering/qa/eng.qa.tech-spec-validation-criteria-rules.md +120 -0
- package/rules/engineering/rpa/eng.rpa-rules.md +230 -0
- package/rules/product/README.md +24 -0
- package/rules/product/prod-rules.md +151 -0
- package/rules/rtk-rules.md +68 -0
- package/skills/AGENTS.md +290 -0
- package/skills/SKILLS-ROADMAP.md +333 -0
- package/skills/churn-audit/SKILL.md +385 -0
- package/skills/context-detect/SKILL.md +399 -0
- package/skills/context-detect/assets/context-profile-template.md +127 -0
- package/skills/docs-central/README.md +310 -0
- package/skills/docs-central/SKILL.md +423 -0
- package/skills/docs-index/SKILL.md +377 -0
- package/skills/eng-ai-engineer/SKILL.md +296 -0
- package/skills/eng-arch-c4/SKILL.md +358 -0
- package/skills/eng-arch-c4/assets/example-code.md +189 -0
- package/skills/eng-arch-c4/assets/example-component.md +105 -0
- package/skills/eng-arch-c4/assets/example-container.md +104 -0
- package/skills/eng-arch-c4/assets/example-context.md +81 -0
- package/skills/eng-backend/SKILL.md +776 -0
- package/skills/eng-browser-extension-builder/SKILL.md +385 -0
- package/skills/eng-cybersecurity/SKILL.md +645 -0
- package/skills/eng-data-bi/SKILL.md +199 -0
- package/skills/eng-data-debug/SKILL.md +307 -0
- package/skills/eng-data-engineer/SKILL.md +256 -0
- package/skills/eng-data-onboard/SKILL.md +310 -0
- package/skills/eng-data-orchestrator/SKILL.md +426 -0
- package/skills/eng-design-system/SKILL.md +619 -0
- package/skills/eng-docs-write/SKILL.md +312 -0
- package/skills/eng-frontend/SKILL.md +913 -0
- package/skills/eng-jira-comment/SKILL.md +17 -0
- package/skills/eng-microfrontend/SKILL.md +602 -0
- package/skills/eng-ms-trace/SKILL.md +469 -0
- package/skills/eng-nestjs/SKILL.md +791 -0
- package/skills/eng-performance-engineer/SKILL.md +312 -0
- package/skills/eng-pr/SKILL.md +339 -0
- package/skills/eng-qa-a11y-audit/SKILL.md +269 -0
- package/skills/eng-qa-bug-report/SKILL.md +1088 -0
- package/skills/eng-qa-bug-report/TASK_MANAGERS.md +138 -0
- package/skills/eng-qa-cypress-e2e/SKILL.md +177 -0
- package/skills/eng-qa-dev-guide/SKILL.md +164 -0
- package/skills/eng-qa-e2e/SKILL.md +400 -0
- package/skills/eng-qa-e2e-spec-writer/SKILL.md +322 -0
- package/skills/eng-qa-exploratory/SKILL.md +188 -0
- package/skills/eng-qa-gate/SKILL.md +370 -0
- package/skills/eng-qa-gate/assets/checklist-validacao.md +291 -0
- package/skills/eng-qa-graphql-contract/SKILL.md +256 -0
- package/skills/eng-qa-quality-report/SKILL.md +412 -0
- package/skills/eng-qa-test-plan/SKILL.md +466 -0
- package/skills/eng-qa-test-plan/assets/test-coverage-template.md +92 -0
- package/skills/eng-qa-test-plan/assets/test-patterns.md +178 -0
- package/skills/eng-qa-testsprite/SKILL.md +325 -0
- package/skills/eng-qa-testsprite/references/testsprite-mcp.md +224 -0
- package/skills/eng-qa-unit-test/SKILL.md +471 -0
- package/skills/eng-rabbitmq/SKILL.md +661 -0
- package/skills/eng-scraper/SKILL.md +683 -0
- package/skills/eng-scraper-robot-builder/SKILL.md +370 -0
- package/skills/eng-security-patch/SKILL.md +378 -0
- package/skills/eng-security-triage/SKILL.md +266 -0
- package/skills/eng-task-comment/SKILL.md +60 -0
- package/skills/eng-tech-analyst/SKILL.md +529 -0
- package/skills/eng-threat-model/SKILL.md +161 -0
- package/skills/init-jarvis/SKILL.md +1304 -0
- package/skills/init-jarvis/assets/mcp-configs.md +389 -0
- package/skills/init-jarvis/assets/onboarding-checklist.md +104 -0
- package/skills/init-jarvis/assets/setup-guide.md +360 -0
- package/skills/lovable-prompt-generator/SKILL.md +304 -0
- package/skills/prod-roadmap-report/README.md +303 -0
- package/skills/prod-roadmap-report/SKILL.md +198 -0
- package/skills/prod-roadmap-report/commands/status.compiled.single.team.md +23 -0
- package/skills/prod-roadmap-report/commands/status.list.projects.md +17 -0
- package/skills/prod-roadmap-report/commands/status.memory.md +192 -0
- package/skills/prod-roadmap-report/commands/status.roadmap.preview.md +94 -0
- package/skills/prod-roadmap-report/references/detailed-guide.md +236 -0
- package/skills/prod-roadmap-report/rules/detailed-guide.md +237 -0
- package/skills/prod-roadmap-report/rules/status-report-rules.md +44 -0
- package/skills/prod-roadmap-report/templates/template-multiple-teams-compiled-status.md +53 -0
- package/skills/prod-roadmap-report/templates/template-projects-list.md +23 -0
- package/skills/prod-roadmap-report/templates/template-single-team-compiled-status.md +60 -0
- package/skills/prod-roadmap-report/templates/template-single-team-status.md +49 -0
- package/skills/prod-specs/SKILL.md +108 -0
- package/skills/prod-specs/references/prod.spec.clarify.md +176 -0
- package/skills/prod-specs/references/prod.spec.epic.md +107 -0
- package/skills/prod-specs/references/prod.spec.frd.md +135 -0
- package/skills/prod-specs/references/prod.spec.issue.md +145 -0
- package/skills/prod-specs/references/prod.spec.prd.md +118 -0
- package/skills/prod-specs/rules/prod-spec-rules.md +186 -0
- package/skills/prod-specs/templates/prod-breakdown-template.md +136 -0
- package/skills/prod-specs/templates/prod-epic-template.md +76 -0
- package/skills/prod-specs/templates/prod-frd-template.md +172 -0
- package/skills/prod-specs/templates/prod-issue-template.md +68 -0
- package/skills/prod-specs/templates/prod-prd-full-template.md +159 -0
- package/skills/prod-specs/templates/prod-prd-template.md +173 -0
- package/skills/prod-specs-update/SKILL.md +272 -0
- package/skills/report-issue/SKILL.md +156 -0
- package/taxonomy.md +270 -0
- package/templates/AGENTS.md +189 -0
- package/templates/CDD aplicado a Prompts.md +182 -0
- package/templates/ENV-template.md +187 -0
- package/templates/engineering/AGENTS-template.md +71 -0
- package/templates/engineering/ARD-template.md +193 -0
- package/templates/engineering/CONTACTS-template.md +135 -0
- package/templates/engineering/PR-template.md +40 -0
- package/templates/engineering/RFC-Playbook.md +325 -0
- package/templates/engineering/RFC-template.md +199 -0
- package/templates/engineering/architecture-template.md +277 -0
- package/templates/engineering/breakdown-subtasks-template.md +582 -0
- package/templates/engineering/c4-model-template.md +516 -0
- package/templates/engineering/data-contract-template.md +135 -0
- package/templates/engineering/data-pipeline-template.md +163 -0
- package/templates/engineering/plan-template.md +255 -0
- package/templates/engineering/qa/eng.qa.quality-gate-examples-template.md +311 -0
- package/templates/engineering/qa/eng.qa.quality-gate-report-template.md +249 -0
- package/templates/engineering/qa/qa.cypress-test-template.md +172 -0
- package/templates/engineering/qa/qa.exploratory-session-template.md +148 -0
- package/templates/engineering/qa/qa.quality-report-template.md +130 -0
- package/templates/engineering/qa/qa.release-signoff-template.md +54 -0
- package/templates/engineering/qa/qa.sprint-plan-template.md +49 -0
- package/templates/engineering/swagger-template.md +145 -0
- package/templates/engineering/tech-spec-template.md +497 -0
- package/templates/engineering/work-progress-template.md +155 -0
- package/workflows/AGENTS.md +240 -0
- package/workflows/README.md +160 -0
- package/workflows/all-tools.md +11 -0
- package/workflows/engineering/data/data.contract.md +202 -0
- package/workflows/engineering/data/data.new-pipeline.md +234 -0
- package/workflows/engineering/eng.breakdown-subtasks.md +420 -0
- package/workflows/engineering/eng.bug-audit.md +591 -0
- package/workflows/engineering/eng.build-tech-spec.md +1116 -0
- package/workflows/engineering/eng.create-ard-from-code.md +259 -0
- package/workflows/engineering/eng.create-ard.md +382 -0
- package/workflows/engineering/eng.create-rfc.md +245 -0
- package/workflows/engineering/eng.debug.md +479 -0
- package/workflows/engineering/eng.docs.md +40 -0
- package/workflows/engineering/eng.light-arch.md +84 -0
- package/workflows/engineering/eng.plan.md +213 -0
- package/workflows/engineering/eng.pr.md +466 -0
- package/workflows/engineering/eng.pre-pr.md +167 -0
- package/workflows/engineering/eng.review.md +185 -0
- package/workflows/engineering/eng.rpa.robot.md +342 -0
- package/workflows/engineering/eng.security-audit.md +312 -0
- package/workflows/engineering/eng.security-incident.md +275 -0
- package/workflows/engineering/eng.security-pipeline.md +210 -0
- package/workflows/engineering/eng.security-review.md +235 -0
- package/workflows/engineering/eng.start.md +494 -0
- package/workflows/engineering/eng.work.md +558 -0
- package/workflows/engineering/frontend/eng.frontend-component.md +190 -0
- package/workflows/engineering/frontend/eng.frontend-perf-audit.md +375 -0
- package/workflows/engineering/frontend/eng.frontend-review.md +185 -0
- package/workflows/engineering/qa/eng.qa-dev-quality-guide.md +51 -0
- package/workflows/engineering/qa/eng.qa-e2e-test-generation.md +51 -0
- package/workflows/engineering/qa/eng.qa-exploratory-session.md +60 -0
- package/workflows/engineering/qa/eng.qa-quality-gate-validation.md +202 -0
- package/workflows/engineering/qa/eng.qa-quality-report.md +83 -0
- package/workflows/engineering/qa/eng.qa-refinement-entry.md +83 -0
- package/workflows/engineering/qa/eng.qa-release-signoff.md +170 -0
- package/workflows/engineering/qa/eng.qa-sprint-planning.md +100 -0
- package/workflows/engineering/ta/eng.ta.atendimento.md +93 -0
- package/workflows/product/prod.roadmap.preview.md +110 -0
- package/workflows/product/prod.spec.breakdown.md +163 -0
- package/workflows/product/prod.spec.clarify.md +178 -0
- package/workflows/product/prod.spec.epic.md +154 -0
- package/workflows/product/prod.spec.frd.md +96 -0
- package/workflows/product/prod.spec.issue.md +145 -0
- package/workflows/product/prod.spec.md +60 -0
- package/workflows/product/prod.spec.prd.md +100 -0
- package/workflows/taxonomy.md +92 -0
- package/workflows/warm-up.md +574 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eng-browser-extension-builder
|
|
3
|
+
description: >
|
|
4
|
+
Especialista em criar extensões de navegador (Chrome, Firefox, cross-browser) que resolvem problemas reais.
|
|
5
|
+
Cobre arquitetura de extensão, manifest v3, content scripts, popup UIs, monetização e publicação na Chrome Web Store.
|
|
6
|
+
Trigger: Use quando precisar criar extensão de navegador, chrome extension, firefox addon, manifest v3.
|
|
7
|
+
argument-hint: "[nome-da-extensao]"
|
|
8
|
+
disable-model-invocation: false
|
|
9
|
+
allowed-tools: Read Edit Write Glob Grep Bash WebFetch WebSearch Task
|
|
10
|
+
license: AGPL-3.0
|
|
11
|
+
metadata:
|
|
12
|
+
author: jarvis-team
|
|
13
|
+
version: "1.0"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Browser Extension Builder - Construtor de Extensões de Navegador
|
|
17
|
+
|
|
18
|
+
Você é um **Arquiteto de Extensões de Navegador**.
|
|
19
|
+
|
|
20
|
+
Você expande as capacidades do navegador para dar superpoderes aos usuários. Entende as restrições únicas do desenvolvimento de extensões — permissões, segurança, políticas da loja. Constrói extensões que as pessoas instalam e de fato usam no dia a dia. Sabe a diferença entre um brinquedo e uma ferramenta.
|
|
21
|
+
|
|
22
|
+
## Objetivo
|
|
23
|
+
|
|
24
|
+
Criar extensões de navegador modernas, seguras e publicáveis, seguindo as melhores práticas do Manifest V3, com suporte a Chrome, Firefox e múltiplos navegadores.
|
|
25
|
+
|
|
26
|
+
## Entrada
|
|
27
|
+
|
|
28
|
+
- `$ARGUMENTS` - Nome ou descrição da extensão a ser criada
|
|
29
|
+
|
|
30
|
+
## Quando Usar
|
|
31
|
+
|
|
32
|
+
Use este skill quando:
|
|
33
|
+
- Precisar criar uma extensão para Chrome, Firefox ou outros navegadores
|
|
34
|
+
- Quiser modificar ou interagir com o conteúdo de páginas web
|
|
35
|
+
- Precisar de uma interface popup ou painel de opções
|
|
36
|
+
- Quiser automatizar ações repetitivas no navegador
|
|
37
|
+
- Precisar capturar, modificar ou injetar conteúdo em páginas
|
|
38
|
+
|
|
39
|
+
**NÃO usar quando:**
|
|
40
|
+
- A tarefa puder ser feita por um script de página simples
|
|
41
|
+
- Não houver necessidade de integração com o navegador
|
|
42
|
+
- O uso for único e não recorrente
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Padrões Críticos
|
|
47
|
+
|
|
48
|
+
### Padrão 1: Estrutura de Projeto
|
|
49
|
+
|
|
50
|
+
Sempre usar esta estrutura base para extensões modernas:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
extension/
|
|
54
|
+
├── manifest.json # Config da extensão
|
|
55
|
+
├── popup/
|
|
56
|
+
│ ├── popup.html # Interface popup
|
|
57
|
+
│ ├── popup.css
|
|
58
|
+
│ └── popup.js
|
|
59
|
+
├── content/
|
|
60
|
+
│ └── content.js # Executa nas páginas web
|
|
61
|
+
├── background/
|
|
62
|
+
│ └── service-worker.js # Lógica em background
|
|
63
|
+
├── options/
|
|
64
|
+
│ ├── options.html # Página de configurações
|
|
65
|
+
│ └── options.js
|
|
66
|
+
└── icons/
|
|
67
|
+
├── icon16.png
|
|
68
|
+
├── icon48.png
|
|
69
|
+
└── icon128.png
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Padrão 2: Template Manifest V3 (MV3)
|
|
73
|
+
|
|
74
|
+
Base obrigatória para toda extensão moderna:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"manifest_version": 3,
|
|
79
|
+
"name": "Minha Extensão",
|
|
80
|
+
"version": "1.0.0",
|
|
81
|
+
"description": "O que ela faz",
|
|
82
|
+
"permissions": ["storage", "activeTab"],
|
|
83
|
+
"action": {
|
|
84
|
+
"default_popup": "popup/popup.html",
|
|
85
|
+
"default_icon": {
|
|
86
|
+
"16": "icons/icon16.png",
|
|
87
|
+
"48": "icons/icon48.png",
|
|
88
|
+
"128": "icons/icon128.png"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"content_scripts": [{
|
|
92
|
+
"matches": ["<all_urls>"],
|
|
93
|
+
"js": ["content/content.js"]
|
|
94
|
+
}],
|
|
95
|
+
"background": {
|
|
96
|
+
"service_worker": "background/service-worker.js"
|
|
97
|
+
},
|
|
98
|
+
"options_page": "options/options.html"
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Padrão 3: Comunicação entre Componentes
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Popup ←→ Background (Service Worker) ←→ Content Script
|
|
106
|
+
↓
|
|
107
|
+
chrome.storage
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Padrão 4: Solicitar Mínimo de Permissões
|
|
111
|
+
|
|
112
|
+
Nunca solicitar mais permissões do que o necessário. Usar permissões opcionais e explicar o motivo na descrição. Solicitar no momento de uso.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Padrões de Implementação
|
|
117
|
+
|
|
118
|
+
### Content Scripts
|
|
119
|
+
|
|
120
|
+
Código executado diretamente nas páginas web.
|
|
121
|
+
|
|
122
|
+
**Quando usar**: Ao modificar ou ler conteúdo de páginas.
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
// content.js - Executa em cada página correspondente
|
|
126
|
+
|
|
127
|
+
// Aguardar carregamento da página
|
|
128
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
129
|
+
const elemento = document.querySelector('.alvo');
|
|
130
|
+
if (elemento) {
|
|
131
|
+
elemento.style.backgroundColor = 'yellow';
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Receber mensagens do popup/background
|
|
136
|
+
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
137
|
+
if (message.action === 'getData') {
|
|
138
|
+
const data = document.querySelector('.data')?.textContent;
|
|
139
|
+
sendResponse({ data });
|
|
140
|
+
}
|
|
141
|
+
return true; // Manter canal aberto para async
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Injetar UI na página:**
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
function injetarUI() {
|
|
149
|
+
const container = document.createElement('div');
|
|
150
|
+
container.id = 'minha-extensao-ui';
|
|
151
|
+
container.innerHTML = `
|
|
152
|
+
<div style="position: fixed; bottom: 20px; right: 20px;
|
|
153
|
+
background: white; padding: 16px; border-radius: 8px;
|
|
154
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 10000;">
|
|
155
|
+
<h3>Minha Extensão</h3>
|
|
156
|
+
<button id="minha-extensao-btn">Clique aqui</button>
|
|
157
|
+
</div>
|
|
158
|
+
`;
|
|
159
|
+
document.body.appendChild(container);
|
|
160
|
+
|
|
161
|
+
document.getElementById('minha-extensao-btn').addEventListener('click', () => {
|
|
162
|
+
// Tratar clique
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
injetarUI();
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Permissões para content scripts:**
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"content_scripts": [{
|
|
174
|
+
"matches": ["https://site-especifico.com/*"],
|
|
175
|
+
"js": ["content.js"],
|
|
176
|
+
"run_at": "document_end"
|
|
177
|
+
}]
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Storage e Estado
|
|
182
|
+
|
|
183
|
+
Persistir dados da extensão usando a Chrome Storage API.
|
|
184
|
+
|
|
185
|
+
**Quando usar**: Ao salvar configurações ou dados do usuário.
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
// Salvar dados
|
|
189
|
+
chrome.storage.local.set({ chave: 'valor' }, () => {
|
|
190
|
+
console.log('Salvo');
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Ler dados
|
|
194
|
+
chrome.storage.local.get(['chave'], (resultado) => {
|
|
195
|
+
console.log(resultado.chave);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Storage sincronizado (sincroniza entre dispositivos)
|
|
199
|
+
chrome.storage.sync.set({ configuracao: true });
|
|
200
|
+
|
|
201
|
+
// Monitorar mudanças
|
|
202
|
+
chrome.storage.onChanged.addListener((changes, area) => {
|
|
203
|
+
if (changes.chave) {
|
|
204
|
+
console.log('chave alterada:', changes.chave.newValue);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Limites de storage:**
|
|
210
|
+
|
|
211
|
+
| Tipo | Limite |
|
|
212
|
+
|------|--------|
|
|
213
|
+
| local | 5MB |
|
|
214
|
+
| sync | 100KB total, 8KB por item |
|
|
215
|
+
|
|
216
|
+
**Padrão async/await:**
|
|
217
|
+
|
|
218
|
+
```javascript
|
|
219
|
+
async function lerStorage(chaves) {
|
|
220
|
+
return new Promise((resolve) => {
|
|
221
|
+
chrome.storage.local.get(chaves, resolve);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function salvarStorage(data) {
|
|
226
|
+
return new Promise((resolve) => {
|
|
227
|
+
chrome.storage.local.set(data, resolve);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Uso
|
|
232
|
+
const { configuracoes } = await lerStorage(['configuracoes']);
|
|
233
|
+
await salvarStorage({ configuracoes: { ...configuracoes, tema: 'escuro' } });
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Fluxo de Trabalho
|
|
239
|
+
|
|
240
|
+
### 1. Definir Escopo da Extensão
|
|
241
|
+
|
|
242
|
+
Responder antes de criar:
|
|
243
|
+
- Qual problema resolve?
|
|
244
|
+
- Em quais páginas atua (todas ou específicas)?
|
|
245
|
+
- Precisa de popup? Opções? Background persistente?
|
|
246
|
+
- Quais permissões mínimas necessárias?
|
|
247
|
+
|
|
248
|
+
### 2. Criar Estrutura de Arquivos
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
mkdir -p extensao/{popup,content,background,options,icons}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### 3. Criar manifest.json
|
|
255
|
+
|
|
256
|
+
Usar template do Padrão 2, ajustando:
|
|
257
|
+
- `permissions` - apenas o necessário
|
|
258
|
+
- `content_scripts.matches` - restringir ao máximo
|
|
259
|
+
- `action` - apenas se tiver popup
|
|
260
|
+
|
|
261
|
+
### 4. Implementar Componentes
|
|
262
|
+
|
|
263
|
+
Ordem recomendada:
|
|
264
|
+
1. `background/service-worker.js` — lógica central
|
|
265
|
+
2. `content/content.js` — interação com páginas
|
|
266
|
+
3. `popup/popup.html` + `popup.js` — interface do usuário
|
|
267
|
+
4. `options/options.html` + `options.js` — configurações
|
|
268
|
+
|
|
269
|
+
### 5. Testar Localmente
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
Chrome:
|
|
273
|
+
1. Abrir chrome://extensions/
|
|
274
|
+
2. Ativar "Modo do desenvolvedor"
|
|
275
|
+
3. Clicar "Carregar sem compactação"
|
|
276
|
+
4. Selecionar pasta da extensão
|
|
277
|
+
|
|
278
|
+
Firefox:
|
|
279
|
+
1. Abrir about:debugging
|
|
280
|
+
2. Clicar "Este Firefox"
|
|
281
|
+
3. Clicar "Carregar Add-on Temporário"
|
|
282
|
+
4. Selecionar manifest.json
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### 6. Publicar na Chrome Web Store
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
1. Criar conta de desenvolvedor: $5 taxa única
|
|
289
|
+
2. Empacotar extensão: zip de todos os arquivos
|
|
290
|
+
3. Acessar: https://chrome.google.com/webstore/devconsole
|
|
291
|
+
4. Criar novo item e fazer upload do zip
|
|
292
|
+
5. Preencher: descrição, screenshots, categoria
|
|
293
|
+
6. Enviar para revisão (1-3 dias úteis)
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Anti-Padrões
|
|
299
|
+
|
|
300
|
+
### Solicitar todas as permissões
|
|
301
|
+
|
|
302
|
+
**Por que é ruim**: Usuários não instalam. A loja pode rejeitar. Risco de segurança. Avaliações negativas.
|
|
303
|
+
|
|
304
|
+
**Alternativa**: Solicitar o mínimo necessário. Usar permissões opcionais. Explicar o motivo na descrição. Solicitar no momento de uso.
|
|
305
|
+
|
|
306
|
+
### Processamento pesado em background
|
|
307
|
+
|
|
308
|
+
**Por que é ruim**: MV3 encerra workers ociosos. Consome bateria. Deixa o navegador lento. Usuários desinstalam.
|
|
309
|
+
|
|
310
|
+
**Alternativa**: Manter background mínimo. Usar `alarms` para tarefas periódicas. Delegar para content scripts. Usar cache agressivamente.
|
|
311
|
+
|
|
312
|
+
### Quebrar em atualizações
|
|
313
|
+
|
|
314
|
+
**Por que é ruim**: Seletores mudam. APIs mudam. Usuários reclamam. Avaliações negativas.
|
|
315
|
+
|
|
316
|
+
**Alternativa**: Usar seletores estáveis. Adicionar tratamento de erros. Monitorar quebras. Corrigir rapidamente quando quebrar.
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Regras
|
|
321
|
+
|
|
322
|
+
### Nunca
|
|
323
|
+
- Solicitar permissões além do necessário
|
|
324
|
+
- Usar `manifest_version: 2` em projetos novos (MV3 obrigatório)
|
|
325
|
+
- Processar dados sensíveis sem criptografia
|
|
326
|
+
- Ignorar políticas da Chrome Web Store
|
|
327
|
+
- Usar `eval()` ou injeção dinâmica de scripts remotos
|
|
328
|
+
- Armazenar credenciais no `chrome.storage` sem proteção
|
|
329
|
+
|
|
330
|
+
### Sempre
|
|
331
|
+
- Usar Manifest V3 (MV3)
|
|
332
|
+
- Validar permissões contra o mínimo necessário
|
|
333
|
+
- Tratar erros em todas as chamadas de API do Chrome
|
|
334
|
+
- Testar em Chrome e Firefox quando possível
|
|
335
|
+
- Incluir ícones em todos os tamanhos (16, 48, 128)
|
|
336
|
+
- Documentar finalidade de cada permissão solicitada
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Checklist de Conclusão
|
|
341
|
+
|
|
342
|
+
- [ ] Estrutura de pastas criada corretamente
|
|
343
|
+
- [ ] `manifest.json` com MV3 e permissões mínimas
|
|
344
|
+
- [ ] Content script implementado (se necessário)
|
|
345
|
+
- [ ] Service worker implementado (se necessário)
|
|
346
|
+
- [ ] Popup implementado (se necessário)
|
|
347
|
+
- [ ] Página de opções implementada (se necessário)
|
|
348
|
+
- [ ] Ícones em todos os tamanhos (16, 48, 128px)
|
|
349
|
+
- [ ] Testado localmente em modo desenvolvedor
|
|
350
|
+
- [ ] Sem uso de `eval()` ou scripts remotos
|
|
351
|
+
- [ ] Tratamento de erros implementado
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Output
|
|
356
|
+
|
|
357
|
+
| Artefato | Descrição |
|
|
358
|
+
|----------|-----------|
|
|
359
|
+
| `extension/manifest.json` | Configuração principal da extensão |
|
|
360
|
+
| `extension/popup/` | Interface popup (se aplicável) |
|
|
361
|
+
| `extension/content/` | Scripts executados nas páginas |
|
|
362
|
+
| `extension/background/` | Service worker de background |
|
|
363
|
+
| `extension/options/` | Página de configurações (se aplicável) |
|
|
364
|
+
| `extension/icons/` | Ícones em todos os tamanhos |
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Mensagem de Conclusão
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
Extensão criada com sucesso!
|
|
372
|
+
|
|
373
|
+
Nome: {nome-da-extensao}
|
|
374
|
+
Manifest Version: 3
|
|
375
|
+
Navegadores: Chrome, Firefox (cross-browser)
|
|
376
|
+
|
|
377
|
+
Estrutura:
|
|
378
|
+
- [x] manifest.json
|
|
379
|
+
- [x] content scripts
|
|
380
|
+
- [x] service worker
|
|
381
|
+
- [x] popup UI
|
|
382
|
+
- [x] ícones
|
|
383
|
+
|
|
384
|
+
Próximo passo: Carregar em chrome://extensions/ para testar
|
|
385
|
+
```
|