sinapse-ai 7.7.1 → 7.7.3
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/.claude/CLAUDE.md +1 -0
- package/.claude/hooks/enforce-git-push-authority.sh +34 -2
- package/.claude/rules/safe-collaboration.md +173 -0
- package/.sinapse-ai/constitution.md +33 -1
- package/.sinapse-ai/core/doctor/checks/constitution-consistency.js +1 -0
- package/.sinapse-ai/core/health-check/checks/project/constitution-consistency.js +1 -0
- package/.sinapse-ai/data/entity-registry.yaml +785 -796
- package/.sinapse-ai/data/registry-update-log.jsonl +6 -0
- package/.sinapse-ai/infrastructure/templates/safe-collab/CODEOWNERS.template +16 -0
- package/.sinapse-ai/infrastructure/templates/safe-collab/README.md +66 -0
- package/.sinapse-ai/infrastructure/templates/safe-collab/apply.sh +85 -0
- package/.sinapse-ai/infrastructure/templates/safe-collab/parallel-workflow-guide.md +55 -0
- package/.sinapse-ai/infrastructure/templates/safe-collab/pull_request_template.md +11 -0
- package/.sinapse-ai/infrastructure/templates/safe-collab/safe-collaboration-rule.md +93 -0
- package/.sinapse-ai/install-manifest.yaml +35 -11
- package/.sinapse-ai/product/templates/ide-rules/claude-rules.md +1 -0
- package/docs/ORQX-PLAN.md +3 -2
- package/docs/getting-started.md +2 -2
- package/docs/guides/parallel-workflow.md +104 -0
- package/docs/guides/workflows/xref-phase2-templates.md +1 -1
- package/docs/guides/workflows/xref-phase4-infra.md +0 -1
- package/docs/pt/ide-integration.md +15 -45
- package/package.json +1 -1
- package/packages/installer/src/config/templates/core-config-template.js +1 -1
- package/packages/installer/src/wizard/ide-config-generator.js +2 -96
- package/packages/installer/src/wizard/index.js +0 -32
- package/scripts/ensure-manifest.js +9 -0
package/.claude/CLAUDE.md
CHANGED
|
@@ -23,6 +23,7 @@ O SINAPSE possui uma **Constitution formal** com princípios inegociáveis e gat
|
|
|
23
23
|
| VI | Absolute Imports | SHOULD |
|
|
24
24
|
| VII | Ecosystem Metrics Accuracy | NON-NEGOTIABLE |
|
|
25
25
|
| VIII | Mandatory Delegation | NON-NEGOTIABLE |
|
|
26
|
+
| IX | Safe Collaboration | NON-NEGOTIABLE |
|
|
26
27
|
|
|
27
28
|
**Gates automáticos bloqueiam violações.** Consulte a Constitution para detalhes completos.
|
|
28
29
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
# Only meant to run when agent is NOT @devops
|
|
5
5
|
# Uses node (not jq) for JSON parsing — works on Windows/Git Bash
|
|
6
6
|
# FAIL-CLOSED: if parsing fails, blocks the command (exit 2)
|
|
7
|
+
# Hardened v2: also detects indirect execution via script files and pipes
|
|
7
8
|
|
|
8
9
|
INPUT=$(cat)
|
|
9
10
|
|
|
@@ -23,10 +24,41 @@ if [ $? -ne 0 ]; then
|
|
|
23
24
|
exit 0
|
|
24
25
|
fi
|
|
25
26
|
|
|
26
|
-
#
|
|
27
|
-
|
|
27
|
+
# Helper: deny with message
|
|
28
|
+
deny() {
|
|
28
29
|
echo '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Git push is EXCLUSIVE to @devops agent. Activate @devops for push operations."}}'
|
|
29
30
|
exit 0
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# 1. Direct git push (existing check)
|
|
34
|
+
if echo "$COMMAND" | grep -qiE '\bgit\s+push\b'; then
|
|
35
|
+
deny
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# 2. Indirect: bash/sh/source executing a script file that contains git push
|
|
39
|
+
SCRIPT_FILE=$(echo "$COMMAND" | grep -oP '(?:bash|sh|source|\.)\s+\K[^\s;|&]+' 2>/dev/null | head -1)
|
|
40
|
+
if [ -n "$SCRIPT_FILE" ] && [ -f "$SCRIPT_FILE" ]; then
|
|
41
|
+
if grep -qiE '\bgit\s+push\b' "$SCRIPT_FILE" 2>/dev/null; then
|
|
42
|
+
deny
|
|
43
|
+
fi
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# 3. Pipe-to-shell patterns (cat file | bash, echo cmd | sh)
|
|
47
|
+
if echo "$COMMAND" | grep -qiE '\|\s*(ba)?sh\b'; then
|
|
48
|
+
# Only block if push-related content is likely
|
|
49
|
+
if echo "$COMMAND" | grep -qiE 'push'; then
|
|
50
|
+
deny
|
|
51
|
+
fi
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# 4. eval/exec patterns with push
|
|
55
|
+
if echo "$COMMAND" | grep -qiE '\b(eval|exec)\b.*push'; then
|
|
56
|
+
deny
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# 5. node -e / python -c executing push
|
|
60
|
+
if echo "$COMMAND" | grep -qiE '(node\s+-e|python[3]?\s+-c).*push'; then
|
|
61
|
+
deny
|
|
30
62
|
fi
|
|
31
63
|
|
|
32
64
|
# Allow all other commands
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Safe Collaboration — Git Safety Net (NON-NEGOTIABLE)
|
|
2
|
+
|
|
3
|
+
> **Applies to ALL agents, ALL projects using SINAPSE.**
|
|
4
|
+
> Users are product builders, NOT git experts.
|
|
5
|
+
> Agents MUST handle ALL git complexity automatically and safely.
|
|
6
|
+
|
|
7
|
+
## Golden Rule
|
|
8
|
+
|
|
9
|
+
**Users focus on WHAT to build. Agents handle HOW to save and share it safely.**
|
|
10
|
+
|
|
11
|
+
Users should NEVER need to:
|
|
12
|
+
- Resolve merge conflicts manually
|
|
13
|
+
- Decide which branch to use
|
|
14
|
+
- Remember to pull before working
|
|
15
|
+
- Worry about overwriting each other's code
|
|
16
|
+
- Understand git rebase, cherry-pick, or force-push
|
|
17
|
+
|
|
18
|
+
## Automatic Safety Protocol (every session)
|
|
19
|
+
|
|
20
|
+
### 1. Session Start — Auto-Sync (MANDATORY)
|
|
21
|
+
|
|
22
|
+
Before ANY work begins in a session, the agent MUST:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
1. git fetch origin
|
|
26
|
+
2. Check if local main is behind origin/main
|
|
27
|
+
3. If behind → git pull origin main (fast-forward only)
|
|
28
|
+
4. If diverged → STOP, inform user, resolve safely
|
|
29
|
+
5. Create work branch if not already on one
|
|
30
|
+
6. Verify branch protection is active on main
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**NEVER start work on `main` directly.** Always create a feature branch.
|
|
34
|
+
|
|
35
|
+
### 2. Branch Naming — Automatic
|
|
36
|
+
|
|
37
|
+
The agent creates the branch. The user never needs to name it.
|
|
38
|
+
|
|
39
|
+
| Who | Branch Pattern | Example |
|
|
40
|
+
|-----|---------------|---------|
|
|
41
|
+
| Caio's session | `caio/{type}/{short-desc}` | `caio/feat/installer-ux` |
|
|
42
|
+
| Matheus's session | `soier/{type}/{short-desc}` | `soier/fix/agent-config` |
|
|
43
|
+
| Unknown | `dev/{type}/{short-desc}` | `dev/feat/new-feature` |
|
|
44
|
+
|
|
45
|
+
Types: `feat`, `fix`, `refactor`, `docs`, `chore`, `test`
|
|
46
|
+
|
|
47
|
+
**User Detection (priority order):**
|
|
48
|
+
1. `git config user.name` -> lookup in mapping table (case-insensitive)
|
|
49
|
+
2. `$USERNAME` (Windows) or `$USER` (Unix) -> lookup in mapping table
|
|
50
|
+
3. Fallback: `dev/`
|
|
51
|
+
|
|
52
|
+
**Mapping Table:**
|
|
53
|
+
|
|
54
|
+
| git config / env var contains | Branch prefix |
|
|
55
|
+
|-------------------------------|---------------|
|
|
56
|
+
| caio (case-insensitive) | `caio/` |
|
|
57
|
+
| matheus OR soier | `soier/` |
|
|
58
|
+
| (anything else) | `dev/` |
|
|
59
|
+
|
|
60
|
+
### 3. Before Every Commit — Safety Checks (MANDATORY)
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
1. git status — verify only expected files changed
|
|
64
|
+
2. git diff --stat — show summary to user
|
|
65
|
+
3. SECRET SCAN — reject if ANY of these are staged:
|
|
66
|
+
- .env files (except .env.example with placeholders)
|
|
67
|
+
- Files containing API keys, tokens, passwords in plaintext
|
|
68
|
+
- Private keys (RSA, SSH, PGP)
|
|
69
|
+
- Database connection strings with credentials
|
|
70
|
+
- Webhook URLs with embedded tokens
|
|
71
|
+
4. Commit with conventional message + story reference
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**If secrets detected → BLOCK commit, warn user, remove file from staging.**
|
|
75
|
+
|
|
76
|
+
### 4. Before Push — Conflict Prevention (MANDATORY)
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
1. git fetch origin main
|
|
80
|
+
2. git merge origin/main --no-edit (into feature branch)
|
|
81
|
+
3. If conflicts → AGENT resolves them (not the user)
|
|
82
|
+
- For simple conflicts (whitespace, imports): auto-resolve
|
|
83
|
+
- For complex conflicts: show both versions, ask user which to keep
|
|
84
|
+
4. Run tests after merge
|
|
85
|
+
5. Only then: git push origin {branch}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 5. PR Creation — Automatic
|
|
89
|
+
|
|
90
|
+
After push, the agent MUST:
|
|
91
|
+
```
|
|
92
|
+
1. gh pr create with clear title and description (uses PR template)
|
|
93
|
+
2. Auto-assign the OTHER person as reviewer
|
|
94
|
+
3. Inform the user: "PR criado, {outro} precisa aprovar"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 6. After PR Merge — Cleanup
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
1. git checkout main
|
|
101
|
+
2. git pull origin main
|
|
102
|
+
3. Delete local feature branch
|
|
103
|
+
4. Inform user: "Branch limpa, pronto para proximo trabalho"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Conflict Resolution Rules
|
|
107
|
+
|
|
108
|
+
| Scenario | Agent Action |
|
|
109
|
+
|----------|-------------|
|
|
110
|
+
| Same file, different sections | Auto-merge (git handles) |
|
|
111
|
+
| Same file, same lines | Show diff, ask user which version to keep |
|
|
112
|
+
| Package.json version conflict | Always take higher version |
|
|
113
|
+
| Generated files (lock, build) | Regenerate after merge |
|
|
114
|
+
| Story/doc files | Merge both contents (additive) |
|
|
115
|
+
|
|
116
|
+
**NEVER use `--force` push. Use `--force-with-lease` ONLY as last resort with user confirmation.**
|
|
117
|
+
|
|
118
|
+
## Communication Protocol
|
|
119
|
+
|
|
120
|
+
When working in parallel, agents MUST inform users about:
|
|
121
|
+
|
|
122
|
+
| Event | Message |
|
|
123
|
+
|-------|---------|
|
|
124
|
+
| Session start | "Atualizando seu projeto... X mudancas novas do {outro}." |
|
|
125
|
+
| Branch created | "Criada area segura para trabalhar: `caio/feat/xxx`" |
|
|
126
|
+
| Pre-push conflict found | "{outro} mudou {file}. Resolvendo automaticamente..." |
|
|
127
|
+
| Secret detected | "BLOQUEADO: encontrei {tipo} em {file}. Removendo antes de salvar." |
|
|
128
|
+
| PR created | "Enviei para revisao. {outro} precisa aprovar no GitHub." |
|
|
129
|
+
| PR merged by other | "{outro} aprovou suas mudancas. Atualizando seu projeto..." |
|
|
130
|
+
|
|
131
|
+
## Destructive Operations — BLOCKED BY DEFAULT
|
|
132
|
+
|
|
133
|
+
These operations require EXPLICIT user confirmation before execution:
|
|
134
|
+
|
|
135
|
+
| Operation | Risk | Confirmation Required |
|
|
136
|
+
|-----------|------|----------------------|
|
|
137
|
+
| `git push --force` / `--force-with-lease` | Overwrite remote history | YES + explain risk |
|
|
138
|
+
| `git reset --hard` | Destroy local uncommitted work | YES + explain risk |
|
|
139
|
+
| `git branch -D` | Delete branch with unmerged commits | YES + explain risk |
|
|
140
|
+
| `git clean -f` | Delete untracked files permanently | YES + explain risk |
|
|
141
|
+
| Delete remote branch | Affects other collaborators | YES |
|
|
142
|
+
|
|
143
|
+
## Anti-Patterns (FORBIDDEN)
|
|
144
|
+
|
|
145
|
+
- Letting user work on `main` directly
|
|
146
|
+
- Pushing to `main` without PR (branch protection enforces this)
|
|
147
|
+
- Ignoring `git fetch` at session start
|
|
148
|
+
- Letting conflicts accumulate (merge frequently)
|
|
149
|
+
- Using `git push --force` without explicit user confirmation
|
|
150
|
+
- Assuming the other person isn't working on the same area
|
|
151
|
+
- Committing without checking `git status` first
|
|
152
|
+
- Skipping tests after resolving conflicts
|
|
153
|
+
- Committing files containing secrets or credentials
|
|
154
|
+
- Running destructive git operations without user confirmation
|
|
155
|
+
|
|
156
|
+
## For Projects Using SINAPSE (not just sinapse-ai repo)
|
|
157
|
+
|
|
158
|
+
These same rules apply to ANY project where SINAPSE agents operate:
|
|
159
|
+
1. Auto-branch before work
|
|
160
|
+
2. Auto-sync before starting
|
|
161
|
+
3. Secret scan before every commit
|
|
162
|
+
4. Auto-resolve simple conflicts
|
|
163
|
+
5. Auto-PR with reviewer assignment
|
|
164
|
+
6. User never touches git directly
|
|
165
|
+
|
|
166
|
+
## User Cheat Sheet (the ONLY things users do manually)
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
! git push origin main ← when agent can't push (hook block)
|
|
170
|
+
! npm publish ← when publishing to NPM
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Everything else: **ask the agent to do it.**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SINAPSE Constitution
|
|
2
2
|
|
|
3
|
-
> **Version:** 2.
|
|
3
|
+
> **Version:** 2.1.0 | **Ratified:** 2025-01-30 | **Last Amended:** 2026-04-02
|
|
4
4
|
|
|
5
5
|
Este documento define os princípios fundamentais e inegociáveis do SINAPSE. Todos os agentes, tasks, e workflows DEVEM respeitar estes princípios. Violações são bloqueadas automaticamente via gates.
|
|
6
6
|
|
|
@@ -207,6 +207,38 @@ Orquestradores (sinapse-orqx e todos os *-orqx) NUNCA executam trabalho de domí
|
|
|
207
207
|
|
|
208
208
|
---
|
|
209
209
|
|
|
210
|
+
### IX. Safe Collaboration (NON-NEGOTIABLE)
|
|
211
|
+
|
|
212
|
+
Usuários são product builders, não especialistas em git. Agentes DEVEM gerenciar toda a complexidade de versionamento e colaboração automaticamente, garantindo que nenhum trabalho seja perdido ou sobrescrito.
|
|
213
|
+
|
|
214
|
+
**Regras:**
|
|
215
|
+
- MUST: Agentes DEVEM executar `git fetch` + sync no início de TODA sessão antes de qualquer trabalho
|
|
216
|
+
- MUST: TODO trabalho DEVE acontecer em feature branch — NUNCA diretamente em `main`
|
|
217
|
+
- MUST: Agentes DEVEM criar branches automaticamente com padrão `{user}/{type}/{desc}`
|
|
218
|
+
- MUST: Agentes DEVEM escanear por secrets (tokens, senhas, chaves) antes de CADA commit — BLOQUEAR se encontrado
|
|
219
|
+
- MUST: Antes de push, agentes DEVEM fazer merge de `origin/main` na branch e resolver conflitos
|
|
220
|
+
- MUST: Agentes DEVEM criar PRs automaticamente com reviewer assignment após push
|
|
221
|
+
- MUST: Operações destrutivas (`--force`, `reset --hard`, `branch -D`) requerem confirmação EXPLÍCITA do usuário
|
|
222
|
+
- MUST NOT: Nenhum agente pode fazer push direto para `main` (branch protection + hook)
|
|
223
|
+
- MUST NOT: Nenhum agente pode usar `git push --force` sem confirmação explícita do usuário
|
|
224
|
+
- MUST NOT: Nenhum agente pode commitar arquivos contendo credentials em plaintext
|
|
225
|
+
|
|
226
|
+
**Comunicação com o usuário:**
|
|
227
|
+
- Usar linguagem simples, sem jargão git
|
|
228
|
+
- "Salvei seu trabalho" em vez de "commitei no HEAD"
|
|
229
|
+
- "Enviei para revisão" em vez de "pushei e criei PR"
|
|
230
|
+
- "Atualizei seu projeto" em vez de "fiz fetch + merge de origin/main"
|
|
231
|
+
|
|
232
|
+
**Aplicação:**
|
|
233
|
+
- Aplica-se a TODOS os projetos onde agentes SINAPSE operam
|
|
234
|
+
- Template reutilizável: `.sinapse-ai/infrastructure/templates/safe-collab/`
|
|
235
|
+
|
|
236
|
+
**Gate:** Hook `enforce-git-push-authority.sh` + branch protection no GitHub
|
|
237
|
+
|
|
238
|
+
**Rule file:** `.claude/rules/safe-collaboration.md`
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
210
242
|
## Governance
|
|
211
243
|
|
|
212
244
|
### Amendment Process
|
|
@@ -27,6 +27,7 @@ const EXPECTED_ARTICLES = [
|
|
|
27
27
|
{ number: 'VI', title: 'Absolute Imports', severity: 'SHOULD' },
|
|
28
28
|
{ number: 'VII', title: 'Ecosystem Metrics Accuracy', severity: 'NON-NEGOTIABLE' },
|
|
29
29
|
{ number: 'VIII', title: 'Mandatory Delegation', severity: 'NON-NEGOTIABLE' },
|
|
30
|
+
{ number: 'IX', title: 'Safe Collaboration', severity: 'NON-NEGOTIABLE' },
|
|
30
31
|
];
|
|
31
32
|
|
|
32
33
|
/**
|