the-crew 0.1.0 → 0.3.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/README.md +141 -58
- package/core/agents/README.md +1 -1
- package/core/agents/desenvolve/frontend-dev.md +4 -3
- package/core/agents/planeja/ux-ui-design.md +2 -1
- package/core/skills/crew-gates/SKILL.md +1 -1
- package/core/skills/crew-obsidian/SKILL.md +2 -2
- package/core/skills/db-organizer/SKILL.md +1 -1
- package/core/skills/manifest.json +791 -0
- package/core/skills/new-project/SKILL.md +27 -0
- package/core/skills/po-backlog/SKILL.md +1 -1
- package/core/skills/projects/SKILL.md +10 -0
- package/dist/src/cli/commands/exec.js +1 -1
- package/dist/src/cli/commands/install.js +300 -0
- package/dist/src/cli/commands/new-project.js +86 -0
- package/dist/src/cli/commands/projects.js +24 -0
- package/dist/src/cli/commands/uninstall.js +308 -0
- package/dist/src/cli/commands/validate.js +6 -5
- package/dist/src/cli/index.js +26 -21
- package/dist/src/cli/lib/args.js +99 -41
- package/dist/src/cli/lib/common.js +120 -0
- package/dist/src/cli/lib/credentials.js +26 -0
- package/dist/src/cli/lib/github.js +36 -0
- package/dist/src/cli/lib/install-record.js +39 -0
- package/dist/src/cli/lib/legacy.js +230 -0
- package/dist/src/cli/lib/plans.js +251 -0
- package/dist/src/cli/lib/registry.js +21 -0
- package/dist/src/cli/lib/skills.js +186 -0
- package/dist/src/cli/lib/writer.js +13 -2
- package/package.json +10 -3
- package/templates/obsidian/{00 Painel.md → project/00 Painel.md } +4 -6
- package/templates/obsidian/team/00 Time.md +20 -0
- package/templates/office/AGENTS.md +12 -0
- package/templates/office/README.md +15 -0
- package/templates/project/AGENTS.md +5 -0
- package/templates/project/PROJECT.md +31 -0
- package/templates/rules/team.md +14 -0
- package/core/skills/catalog.json +0 -30
- package/dist/src/cli/commands/init.js +0 -185
- package/dist/src/cli/lib/plan.js +0 -300
- package/templates/docs/PROJECT.md +0 -36
- package/templates/entrypoints/crew-block.md +0 -28
- package/templates/entrypoints/cursor.mdc +0 -6
- package/templates/entrypoints/obsidian-rules.md +0 -18
- package/templates/entrypoints/windsurf.md +0 -5
- package/templates/workflows/crew-integrity.yml +0 -24
- /package/templates/obsidian/{_templates → team/_templates}/ADR.md +0 -0
- /package/templates/obsidian/{_templates → team/_templates}/Achado de seguranca.md +0 -0
- /package/templates/obsidian/{_templates → team/_templates}/Bug.md +0 -0
- /package/templates/obsidian/{_templates → team/_templates}/Handoff.md +0 -0
- /package/templates/obsidian/{_templates → team/_templates}/Historia.md +0 -0
- /package/templates/obsidian/{_templates → team/_templates}/Release.md +0 -0
- /package/templates/obsidian/{_templates → team/_templates}/Run.md +0 -0
package/core/skills/catalog.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Catálogo de skills do the-crew. 'bundled' são instaladas pelo CLI. 'external' são recomendações de terceiros: o CLI só lista, não instala código de terceiros automaticamente. Vereditos vêm da seção 7 de cada spec (core/agents/README.md, seção 6).",
|
|
3
|
-
"bundled": [
|
|
4
|
-
{ "name": "crew-handoff", "agents": ["orchestrator", "frontend-dev", "backend-dev", "database-organizer", "code-reviewer", "frontend-tester", "backend-tester"] },
|
|
5
|
-
{ "name": "crew-gates", "agents": ["orchestrator", "code-reviewer", "qa", "secops", "product-owner", "infra-release", "devops"] },
|
|
6
|
-
{ "name": "crew-obsidian", "agents": ["*"] },
|
|
7
|
-
{ "name": "po-backlog", "agents": ["product-owner"] },
|
|
8
|
-
{ "name": "db-organizer", "agents": ["database-organizer"] }
|
|
9
|
-
],
|
|
10
|
-
"external": [
|
|
11
|
-
{ "name": "superpowers", "agents": ["tech-lead", "product-owner", "backend-dev"], "verdict": "Adequada", "note": "Dono do workflow recomendado (writing-plans, TDD, debugging, worktrees). Não instalar junto com get-shit-done." },
|
|
12
|
-
{ "name": "Trail of Bits Security Skills", "agents": ["secops", "code-reviewer"], "verdict": "Adequada", "note": "static-analysis, differential-review, supply-chain-risk-auditor, insecure-defaults." },
|
|
13
|
-
{ "name": "impeccable", "agents": ["ux-ui-design"], "verdict": "Adequada", "note": "critique, audit, detect; sem modo live." },
|
|
14
|
-
{ "name": "web-design-guidelines (Vercel)", "agents": ["ux-ui-design", "frontend-dev"], "verdict": "Adequada", "note": "Auto-revisão de UI antes do PR." },
|
|
15
|
-
{ "name": "ponytail", "agents": ["frontend-dev", "backend-dev"], "verdict": "Adequada", "note": "Instalar só da origem oficial." },
|
|
16
|
-
{ "name": "webapp-testing", "agents": ["qa"], "verdict": "Adequada (leve)", "note": "Exploração; suíte permanente em @playwright/test." },
|
|
17
|
-
{ "name": "playwright-skill", "agents": ["frontend-tester"], "verdict": "Adequada", "note": "Núcleo do papel: Vitest + Testing Library + MSW." },
|
|
18
|
-
{ "name": "context-mode", "agents": ["devops"], "verdict": "Adequada", "note": "Hooks globais afetam todos os agentes." },
|
|
19
|
-
{ "name": "railway (plugin oficial)", "agents": ["devops", "infra-release"], "verdict": "Adequada", "note": "use-railway + railway mcp." },
|
|
20
|
-
{ "name": "docker/skills", "agents": ["infra-release"], "verdict": "Adequada", "note": "Empacotamento." },
|
|
21
|
-
{ "name": "Product Management (anthropics/knowledge-work-plugins)", "agents": ["product-manager"], "verdict": "Recomendada", "note": "Substitui career-ops (inadequada)." },
|
|
22
|
-
{ "name": "Understand-Anything", "agents": ["architect"], "verdict": "Adequada", "note": "Cuidado com custo de tokens e com commitar .ua/." },
|
|
23
|
-
{ "name": "ECC", "agents": ["code-reviewer"], "verdict": "Adequada, pesada", "note": "Instalação seletiva; coding-standards.md prevalece." }
|
|
24
|
-
],
|
|
25
|
-
"mcp": [
|
|
26
|
-
{ "id": "github", "label": "GitHub MCP (oficial, remoto)", "agents": ["*"], "needsToken": true },
|
|
27
|
-
{ "id": "context7", "label": "Context7 (docs atualizadas de bibliotecas)", "agents": ["tech-lead", "frontend-dev", "backend-dev"] },
|
|
28
|
-
{ "id": "playwright", "label": "Playwright MCP (navegador para QA e testers)", "agents": ["qa", "frontend-tester"] }
|
|
29
|
-
]
|
|
30
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, statSync } from 'node:fs';
|
|
3
|
-
import { basename, join, resolve } from 'node:path';
|
|
4
|
-
import { homedir } from 'node:os';
|
|
5
|
-
import { loadTopology } from '../../validate/topology.js';
|
|
6
|
-
import { maskToken, readCredentials, saveGithubToken, tokenKind, verifyGithubToken, } from '../lib/credentials.js';
|
|
7
|
-
import { packageRoot, packageVersion } from '../lib/paths.js';
|
|
8
|
-
import { IDE_OPTIONS, MCP_OPTIONS, planProject, planVault } from '../lib/plan.js';
|
|
9
|
-
import { SafeWriter, summarize } from '../lib/writer.js';
|
|
10
|
-
function expandHome(p) {
|
|
11
|
-
return p === '~' || p.startsWith('~/') || p.startsWith('~\\') ? join(homedir(), p.slice(1)) : p;
|
|
12
|
-
}
|
|
13
|
-
function isDir(p) {
|
|
14
|
-
try {
|
|
15
|
-
return statSync(p).isDirectory();
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async function askVault(flags, deps) {
|
|
22
|
-
const { prompter, log } = deps;
|
|
23
|
-
if (flags.vault === false)
|
|
24
|
-
return undefined;
|
|
25
|
-
let candidate = typeof flags.vault === 'string' ? flags.vault : undefined;
|
|
26
|
-
if (candidate === undefined) {
|
|
27
|
-
if (!prompter.interactive)
|
|
28
|
-
return undefined;
|
|
29
|
-
if (!(await prompter.confirm('Integrar com um vault do Obsidian?', true)))
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
for (let attempt = 0; attempt < 3; attempt++) {
|
|
33
|
-
if (candidate === undefined || candidate === '') {
|
|
34
|
-
candidate = (await prompter.text('Cole o caminho do vault do Obsidian')).replace(/^["']|["']$/g, '');
|
|
35
|
-
if (candidate === '')
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
const abs = resolve(expandHome(candidate));
|
|
39
|
-
if (!isDir(abs)) {
|
|
40
|
-
log(` ✗ ${abs} não existe ou não é uma pasta.`);
|
|
41
|
-
if (!prompter.interactive)
|
|
42
|
-
throw new Error(`Vault do Obsidian não encontrado: ${abs}`);
|
|
43
|
-
candidate = undefined;
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
if (!existsSync(join(abs, '.obsidian'))) {
|
|
47
|
-
log(` ! ${abs} não tem a pasta .obsidian, então talvez não seja um vault.`);
|
|
48
|
-
if (prompter.interactive && !(await prompter.confirm('Usar essa pasta mesmo assim?', false))) {
|
|
49
|
-
candidate = undefined;
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return abs;
|
|
54
|
-
}
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
async function askGithub(flags, deps) {
|
|
58
|
-
const { prompter, log, env } = deps;
|
|
59
|
-
if (!flags.github)
|
|
60
|
-
return undefined;
|
|
61
|
-
// Sem TTY: o token só entra por variável de ambiente, nunca por argumento de linha de comando.
|
|
62
|
-
let token = env.THE_CREW_GITHUB_TOKEN?.trim() ?? '';
|
|
63
|
-
const stored = readCredentials(env).github;
|
|
64
|
-
if (!token && stored && prompter.interactive) {
|
|
65
|
-
if (await prompter.confirm(`Já existe um token salvo para @${stored.login}. Usar esse?`, true))
|
|
66
|
-
return stored.login;
|
|
67
|
-
}
|
|
68
|
-
if (!token) {
|
|
69
|
-
if (!prompter.interactive)
|
|
70
|
-
return stored?.login;
|
|
71
|
-
if (!(await prompter.confirm('Configurar o GitHub (fine-grained token para commits, PRs e deploys)?', true)))
|
|
72
|
-
return undefined;
|
|
73
|
-
log([
|
|
74
|
-
' Crie um fine-grained token em https://github.com/settings/personal-access-tokens/new',
|
|
75
|
-
' Repositórios: só os deste projeto. Permissões mínimas sugeridas:',
|
|
76
|
-
' Contents (read/write), Pull requests (read/write), Issues (read/write),',
|
|
77
|
-
' Actions (read), Workflows (read/write, se os agentes forem editar CI), Metadata (read).',
|
|
78
|
-
' O token fica salvo fora do repositório e nunca é exibido.',
|
|
79
|
-
].join('\n'));
|
|
80
|
-
}
|
|
81
|
-
for (let attempt = 0; attempt < 3; attempt++) {
|
|
82
|
-
if (!token)
|
|
83
|
-
token = await prompter.secret('Cole o token (não aparece na tela)');
|
|
84
|
-
if (!token)
|
|
85
|
-
return undefined;
|
|
86
|
-
const kind = tokenKind(token);
|
|
87
|
-
if (kind === 'classic')
|
|
88
|
-
log(' ! Este é um token clássico. Prefira um fine-grained, com escopo só nos repositórios do projeto.');
|
|
89
|
-
if (kind === 'unknown')
|
|
90
|
-
log(' ! O formato não parece um token do GitHub (esperado: github_pat_…).');
|
|
91
|
-
const check = await verifyGithubToken(token, deps.fetchImpl);
|
|
92
|
-
if (check.ok) {
|
|
93
|
-
const where = saveGithubToken(token, check.login, env);
|
|
94
|
-
log(` ✓ Token ${maskToken(token)} válido para @${check.login}. Salvo em ${where} (fora do repo).`);
|
|
95
|
-
return check.login;
|
|
96
|
-
}
|
|
97
|
-
log(` ✗ Não consegui validar o token: ${check.reason}.`);
|
|
98
|
-
if (!prompter.interactive)
|
|
99
|
-
throw new Error(`Token do GitHub inválido: ${check.reason}`);
|
|
100
|
-
token = '';
|
|
101
|
-
}
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
function ensureGit(target, deps, dryRun) {
|
|
105
|
-
if (existsSync(join(target, '.git')))
|
|
106
|
-
return;
|
|
107
|
-
if (dryRun) {
|
|
108
|
-
deps.log(' (dry-run) git init seria executado.');
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
let r = spawnSync('git', ['init', '-b', 'main'], { cwd: target, stdio: 'ignore' });
|
|
112
|
-
if (r.status !== 0)
|
|
113
|
-
r = spawnSync('git', ['init'], { cwd: target, stdio: 'ignore' });
|
|
114
|
-
if (r.status === 0)
|
|
115
|
-
deps.log(' ✓ Repositório git inicializado.');
|
|
116
|
-
else
|
|
117
|
-
deps.log(' ! git não encontrado; inicialize o repositório depois com `git init`.');
|
|
118
|
-
}
|
|
119
|
-
/** Garante que o token não foi parar em nenhum arquivo gravado (defesa em profundidade). */
|
|
120
|
-
function assertNoTokenLeak(results, token) {
|
|
121
|
-
if (!token)
|
|
122
|
-
return;
|
|
123
|
-
for (const r of results) {
|
|
124
|
-
if (existsSync(r.path) && readFileSync(r.path, 'utf8').includes(token)) {
|
|
125
|
-
throw new Error(`Falha de segurança: o token apareceu em ${r.path}. Apague o arquivo e revogue o token.`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
export async function runInit(flags, deps) {
|
|
130
|
-
const { prompter, log } = deps;
|
|
131
|
-
const pkgRoot = packageRoot();
|
|
132
|
-
const version = packageVersion();
|
|
133
|
-
log(`\nthe-crew v${version}: instalando o escritório de 17 agentes\n`);
|
|
134
|
-
const target = resolve(expandHome(flags.dir ?? (await prompter.text('Pasta do projeto', process.cwd()))));
|
|
135
|
-
if (existsSync(target) && !isDir(target))
|
|
136
|
-
throw new Error(`${target} existe e não é uma pasta.`);
|
|
137
|
-
if (!existsSync(target)) {
|
|
138
|
-
if (prompter.interactive && !(await prompter.confirm(`${target} não existe. Criar?`, true)))
|
|
139
|
-
return 1;
|
|
140
|
-
if (!flags.dryRun)
|
|
141
|
-
mkdirSync(target, { recursive: true });
|
|
142
|
-
}
|
|
143
|
-
const projectName = flags.projectName ?? (await prompter.text('Nome do projeto', basename(target)));
|
|
144
|
-
const ides = flags.ides ?? (await prompter.multiselect('Quais IDEs/assistentes você usa?', IDE_OPTIONS, ['claude-code']));
|
|
145
|
-
const mcp = flags.mcp ?? (await prompter.multiselect('Quais MCPs recomendados configurar?', MCP_OPTIONS, ['github', 'context7']));
|
|
146
|
-
const vaultPath = await askVault(flags, deps);
|
|
147
|
-
const githubLogin = await askGithub(flags, deps);
|
|
148
|
-
const ciWorkflow = flags.ci ?? (await prompter.confirm('Adicionar o workflow de CI que valida os contratos dos agentes?', true));
|
|
149
|
-
const answers = { projectName, ides, mcp, ciWorkflow, vaultPath, githubLogin };
|
|
150
|
-
const ctx = {
|
|
151
|
-
pkgRoot,
|
|
152
|
-
target,
|
|
153
|
-
version,
|
|
154
|
-
topology: loadTopology(join(pkgRoot, 'core', 'contracts', 'topology.json')),
|
|
155
|
-
answers,
|
|
156
|
-
date: new Date().toISOString().slice(0, 10),
|
|
157
|
-
};
|
|
158
|
-
if (flags.gitInit && existsSync(target))
|
|
159
|
-
ensureGit(target, deps, flags.dryRun);
|
|
160
|
-
const writer = new SafeWriter({ prompter, force: flags.force, dryRun: flags.dryRun, displayRoot: target });
|
|
161
|
-
await writer.apply(planProject(ctx));
|
|
162
|
-
const projectResults = [...writer.results];
|
|
163
|
-
log(`\n${flags.dryRun ? '(dry-run) ' : ''}Projeto em ${target}:`);
|
|
164
|
-
log(summarize(projectResults, target));
|
|
165
|
-
if (vaultPath) {
|
|
166
|
-
const vw = new SafeWriter({ prompter, force: flags.force, dryRun: flags.dryRun, displayRoot: vaultPath });
|
|
167
|
-
await vw.apply(planVault(ctx));
|
|
168
|
-
log(`\n${flags.dryRun ? '(dry-run) ' : ''}Vault do Obsidian em ${vaultPath}:`);
|
|
169
|
-
log(summarize(vw.results, vaultPath));
|
|
170
|
-
projectResults.push(...vw.results);
|
|
171
|
-
}
|
|
172
|
-
assertNoTokenLeak(projectResults, githubLogin ? readCredentials(deps.env).github?.token : undefined);
|
|
173
|
-
log([
|
|
174
|
-
'',
|
|
175
|
-
'Pronto. Próximos passos:',
|
|
176
|
-
' 1. Descreva o projeto em PROJECT.md.',
|
|
177
|
-
githubLogin
|
|
178
|
-
? ' 2. Abra o assistente com o token injetado só nessa sessão: npx the-crew exec -- claude'
|
|
179
|
-
: ' 2. Abra seu assistente na pasta do projeto.',
|
|
180
|
-
' 3. Peça: "Product Owner, leia o PROJECT.md e comece o planejamento."',
|
|
181
|
-
'',
|
|
182
|
-
'Skills de terceiros recomendadas por agente: .the-crew/skills/catalog.json (não instaladas automaticamente).',
|
|
183
|
-
].join('\n'));
|
|
184
|
-
return 0;
|
|
185
|
-
}
|
package/dist/src/cli/lib/plan.js
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
-
import { join, relative, sep } from 'node:path';
|
|
3
|
-
export const IDE_OPTIONS = [
|
|
4
|
-
{ value: 'claude-code', label: 'Claude Code (CLAUDE.md, subagentes e skills em .claude/)' },
|
|
5
|
-
{ value: 'cursor', label: 'Cursor (.cursor/rules e .cursor/mcp.json)' },
|
|
6
|
-
{ value: 'windsurf', label: 'Windsurf (.windsurf/rules)' },
|
|
7
|
-
{ value: 'other', label: 'Outro (Codex, Gemini CLI, Copilot…: só AGENTS.md)' },
|
|
8
|
-
];
|
|
9
|
-
export const MCP_OPTIONS = [
|
|
10
|
-
{ value: 'github', label: 'GitHub MCP (oficial, remoto; usa o token)' },
|
|
11
|
-
{ value: 'context7', label: 'Context7 (documentação atualizada de bibliotecas)' },
|
|
12
|
-
{ value: 'playwright', label: 'Playwright MCP (navegador para QA e testers)' },
|
|
13
|
-
];
|
|
14
|
-
export function render(template, vars) {
|
|
15
|
-
return template.replace(/\{\{(\w+)\}\}/g, (m, k) => (k in vars ? vars[k] : m));
|
|
16
|
-
}
|
|
17
|
-
export function slugify(s) {
|
|
18
|
-
return (s
|
|
19
|
-
.normalize('NFD')
|
|
20
|
-
.replace(/[̀-ͯ]/g, '')
|
|
21
|
-
.toLowerCase()
|
|
22
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
23
|
-
.replace(/^-+|-+$/g, '') || 'projeto');
|
|
24
|
-
}
|
|
25
|
-
/** Nome de nota do Obsidian: sem caracteres proibidos em nomes de arquivo (/ \ : * ? " < > |). */
|
|
26
|
-
export function noteName(name) {
|
|
27
|
-
return name.replace(/[\\/:*?"<>|]/g, '-').trim();
|
|
28
|
-
}
|
|
29
|
-
/** Missão (linha da tabela de identificação) de uma spec. */
|
|
30
|
-
export function specMission(spec) {
|
|
31
|
-
const m = /^\|\s*Missão\s*\|\s*(.+?)\s*\|\s*$/m.exec(spec);
|
|
32
|
-
return m?.[1] ?? '';
|
|
33
|
-
}
|
|
34
|
-
/** Seção 11 (versão compacta) de uma spec, sem o título. */
|
|
35
|
-
export function specCompact(spec) {
|
|
36
|
-
const m = /^## 11\. Versão compacta[^\n]*\n([\s\S]*?)(?=^## |$(?![\s\S]))/m.exec(spec);
|
|
37
|
-
return (m?.[1] ?? '').trim();
|
|
38
|
-
}
|
|
39
|
-
function listFiles(dir) {
|
|
40
|
-
const out = [];
|
|
41
|
-
for (const name of readdirSync(dir)) {
|
|
42
|
-
const p = join(dir, name);
|
|
43
|
-
if (statSync(p).isDirectory())
|
|
44
|
-
out.push(...listFiles(p));
|
|
45
|
-
else
|
|
46
|
-
out.push(p);
|
|
47
|
-
}
|
|
48
|
-
return out.sort();
|
|
49
|
-
}
|
|
50
|
-
function toPosix(p) {
|
|
51
|
-
return p.split(sep).join('/');
|
|
52
|
-
}
|
|
53
|
-
function yamlString(s) {
|
|
54
|
-
return `"${s.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
55
|
-
}
|
|
56
|
-
function agentById(t) {
|
|
57
|
-
return new Map(t.agents.map((a) => [a.id, a]));
|
|
58
|
-
}
|
|
59
|
-
function teamName(t, id) {
|
|
60
|
-
return t.teams.find((x) => x.id === id)?.name ?? id;
|
|
61
|
-
}
|
|
62
|
-
function owned(t, agentId) {
|
|
63
|
-
return t.artifacts.filter((a) => a.owner === agentId);
|
|
64
|
-
}
|
|
65
|
-
function written(t, agentId) {
|
|
66
|
-
return t.artifacts.filter((a) => (a.writers ?? []).includes(agentId));
|
|
67
|
-
}
|
|
68
|
-
function agentTable(t) {
|
|
69
|
-
const rows = t.agents.map((a) => `| ${teamName(t, a.team)} | ${a.name}${a.entrypoint ? ' **(entrada)**' : ''} | \`.the-crew/agents/${a.team}/${a.id}.md\` |`);
|
|
70
|
-
return ['| Time | Agente | Spec |', '|---|---|---|', ...rows].join('\n');
|
|
71
|
-
}
|
|
72
|
-
/** Topologia instalada: os caminhos das specs passam a apontar para .the-crew/agents. */
|
|
73
|
-
export function installedTopology(t) {
|
|
74
|
-
return {
|
|
75
|
-
...t,
|
|
76
|
-
agents: t.agents.map((a) => ({ ...a, spec: a.spec.replace(/^core\/agents\//, '.the-crew/agents/') })),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function crewBlock(ctx) {
|
|
80
|
-
const tpl = readFileSync(join(ctx.pkgRoot, 'templates', 'entrypoints', 'crew-block.md'), 'utf8');
|
|
81
|
-
const obsidian = ctx.answers.vaultPath
|
|
82
|
-
? readFileSync(join(ctx.pkgRoot, 'templates', 'entrypoints', 'obsidian-rules.md'), 'utf8')
|
|
83
|
-
: '';
|
|
84
|
-
return render(tpl, {
|
|
85
|
-
version: `v${ctx.version}`,
|
|
86
|
-
agentTable: agentTable(ctx.topology),
|
|
87
|
-
obsidianRules: obsidian,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function claudeSubagent(ctx, a, spec) {
|
|
91
|
-
const t = ctx.topology;
|
|
92
|
-
const byId = agentById(t);
|
|
93
|
-
const talks = a.talksTo.map((id) => byId.get(id)?.name ?? id).join(', ');
|
|
94
|
-
const own = owned(t, a.id).flatMap((x) => x.paths).map((p) => `\`${p}\``).join(', ');
|
|
95
|
-
const wr = written(t, a.id).map((x) => `\`${x.paths[0]}\` (só a própria seção)`).join(', ');
|
|
96
|
-
const mission = specMission(spec);
|
|
97
|
-
return [
|
|
98
|
-
'---',
|
|
99
|
-
`name: crew-${a.id}`,
|
|
100
|
-
`description: ${yamlString(`${a.name} do the-crew (${teamName(t, a.team)}). ${mission}`)}`,
|
|
101
|
-
'---',
|
|
102
|
-
'',
|
|
103
|
-
`Você é o **${a.name}** do the-crew (${teamName(t, a.team)}).`,
|
|
104
|
-
'',
|
|
105
|
-
`Antes de agir, leia sua spec completa em \`.the-crew/agents/${a.team}/${a.id}.md\`. As regras comuns do time estão em \`AGENTS.md\`, e os contratos em \`.the-crew/contracts/topology.json\`.`,
|
|
106
|
-
'',
|
|
107
|
-
'## Resumo',
|
|
108
|
-
'',
|
|
109
|
-
specCompact(spec),
|
|
110
|
-
'',
|
|
111
|
-
'## Contratos',
|
|
112
|
-
'',
|
|
113
|
-
`- Conversa com: ${talks}.`,
|
|
114
|
-
`- Dono de: ${own || 'nenhum arquivo'}.`,
|
|
115
|
-
...(wr ? [`- Também escreve em: ${wr}.`] : []),
|
|
116
|
-
'- Escale ao humano antes de deploy em produção, migração destrutiva, mudança de escopo ou aceite de risco Critical/High.',
|
|
117
|
-
'',
|
|
118
|
-
].join('\n');
|
|
119
|
-
}
|
|
120
|
-
function mcpServers(ide, mcp) {
|
|
121
|
-
const tokenRef = ide === 'cursor' ? '${env:GITHUB_PERSONAL_ACCESS_TOKEN}' : '${GITHUB_PERSONAL_ACCESS_TOKEN}';
|
|
122
|
-
const all = {
|
|
123
|
-
github: {
|
|
124
|
-
type: 'http',
|
|
125
|
-
url: 'https://api.githubcopilot.com/mcp/',
|
|
126
|
-
headers: { Authorization: `Bearer ${tokenRef}` },
|
|
127
|
-
},
|
|
128
|
-
context7: { command: 'npx', args: ['-y', '@upstash/context7-mcp@latest'] },
|
|
129
|
-
playwright: { command: 'npx', args: ['-y', '@playwright/mcp@latest'] },
|
|
130
|
-
};
|
|
131
|
-
return Object.fromEntries(mcp.map((id) => [id, all[id]]));
|
|
132
|
-
}
|
|
133
|
-
/** Arquivos a gravar dentro do projeto alvo. */
|
|
134
|
-
export function planProject(ctx) {
|
|
135
|
-
const { pkgRoot, target, answers } = ctx;
|
|
136
|
-
const t = ctx.topology;
|
|
137
|
-
const plan = [];
|
|
138
|
-
const file = (rel, content) => plan.push({ kind: 'file', path: join(target, rel), content });
|
|
139
|
-
// 1. Specs completas, contratos e skills em .the-crew/
|
|
140
|
-
for (const f of listFiles(join(pkgRoot, 'core', 'agents'))) {
|
|
141
|
-
file(join('.the-crew', 'agents', relative(join(pkgRoot, 'core', 'agents'), f)), readFileSync(f, 'utf8'));
|
|
142
|
-
}
|
|
143
|
-
file(join('.the-crew', 'contracts', 'topology.json'), JSON.stringify(installedTopology(t), null, 2) + '\n');
|
|
144
|
-
for (const f of listFiles(join(pkgRoot, 'core', 'skills'))) {
|
|
145
|
-
file(join('.the-crew', 'skills', relative(join(pkgRoot, 'core', 'skills'), f)), readFileSync(f, 'utf8'));
|
|
146
|
-
}
|
|
147
|
-
file(join('.the-crew', 'config.json'), JSON.stringify({
|
|
148
|
-
version: ctx.version,
|
|
149
|
-
projectName: answers.projectName,
|
|
150
|
-
ides: answers.ides,
|
|
151
|
-
mcp: answers.mcp,
|
|
152
|
-
integrations: { obsidian: Boolean(answers.vaultPath), github: Boolean(answers.githubLogin) },
|
|
153
|
-
}, null, 2) + '\n');
|
|
154
|
-
// 2. Estrutura de execução do Orchestrator
|
|
155
|
-
for (const d of ['plan', 'runs', 'handoffs'])
|
|
156
|
-
file(join('.agents', d, '.gitkeep'), '');
|
|
157
|
-
// 3. PROJECT.md e entrypoints
|
|
158
|
-
file('PROJECT.md', render(readFileSync(join(pkgRoot, 'templates', 'docs', 'PROJECT.md'), 'utf8'), { projectName: answers.projectName }));
|
|
159
|
-
const block = crewBlock(ctx);
|
|
160
|
-
plan.push({ kind: 'block', path: join(target, 'AGENTS.md'), content: block, comment: 'html' });
|
|
161
|
-
if (answers.ides.includes('claude-code')) {
|
|
162
|
-
plan.push({
|
|
163
|
-
kind: 'block',
|
|
164
|
-
path: join(target, 'CLAUDE.md'),
|
|
165
|
-
comment: 'html',
|
|
166
|
-
content: [
|
|
167
|
-
'# the-crew',
|
|
168
|
-
'',
|
|
169
|
-
'@AGENTS.md',
|
|
170
|
-
'',
|
|
171
|
-
'No Claude Code, cada agente é um subagente em `.claude/agents/crew-<id>.md` e as skills do time ficam em `.claude/skills/`. Delegue ao subagente do papel (por exemplo `crew-product-owner`, `crew-orchestrator`) em vez de fazer o trabalho de outro papel na conversa principal.',
|
|
172
|
-
].join('\n'),
|
|
173
|
-
});
|
|
174
|
-
for (const a of t.agents) {
|
|
175
|
-
const spec = readFileSync(join(pkgRoot, a.spec), 'utf8');
|
|
176
|
-
file(join('.claude', 'agents', `crew-${a.id}.md`), claudeSubagent(ctx, a, spec));
|
|
177
|
-
}
|
|
178
|
-
for (const f of listFiles(join(pkgRoot, 'core', 'skills')).filter((f) => f.endsWith('SKILL.md'))) {
|
|
179
|
-
file(join('.claude', 'skills', relative(join(pkgRoot, 'core', 'skills'), f)), readFileSync(f, 'utf8'));
|
|
180
|
-
}
|
|
181
|
-
if (answers.mcp.length > 0) {
|
|
182
|
-
plan.push({ kind: 'json-merge', path: join(target, '.mcp.json'), key: 'mcpServers', entries: mcpServers('claude-code', answers.mcp) });
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (answers.ides.includes('cursor')) {
|
|
186
|
-
const tpl = readFileSync(join(pkgRoot, 'templates', 'entrypoints', 'cursor.mdc'), 'utf8');
|
|
187
|
-
file(join('.cursor', 'rules', 'the-crew.mdc'), render(tpl, { block }));
|
|
188
|
-
if (answers.mcp.length > 0) {
|
|
189
|
-
plan.push({ kind: 'json-merge', path: join(target, '.cursor', 'mcp.json'), key: 'mcpServers', entries: mcpServers('cursor', answers.mcp) });
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (answers.ides.includes('windsurf')) {
|
|
193
|
-
const tpl = readFileSync(join(pkgRoot, 'templates', 'entrypoints', 'windsurf.md'), 'utf8');
|
|
194
|
-
file(join('.windsurf', 'rules', 'the-crew.md'), render(tpl, { block }));
|
|
195
|
-
}
|
|
196
|
-
// 4. CI de integridade dos contratos
|
|
197
|
-
if (answers.ciWorkflow) {
|
|
198
|
-
const tpl = readFileSync(join(pkgRoot, 'templates', 'workflows', 'crew-integrity.yml'), 'utf8');
|
|
199
|
-
file(join('.github', 'workflows', 'crew-integrity.yml'), render(tpl, { version: ctx.version }));
|
|
200
|
-
}
|
|
201
|
-
// 5. .gitignore: segredos e arquivos locais nunca entram no git
|
|
202
|
-
plan.push({
|
|
203
|
-
kind: 'block',
|
|
204
|
-
path: join(target, '.gitignore'),
|
|
205
|
-
comment: 'hash',
|
|
206
|
-
content: [
|
|
207
|
-
'# Arquivo local do the-crew (caminho do vault, login); o token fica fora do repo',
|
|
208
|
-
'.the-crew/local.json',
|
|
209
|
-
'*.crew-new',
|
|
210
|
-
'# Segredos',
|
|
211
|
-
'.env',
|
|
212
|
-
'.env.*',
|
|
213
|
-
'!.env.example',
|
|
214
|
-
'*.pem',
|
|
215
|
-
'*.key',
|
|
216
|
-
].join('\n'),
|
|
217
|
-
});
|
|
218
|
-
// 6. Configuração local (fora do git)
|
|
219
|
-
file(join('.the-crew', 'local.json'), JSON.stringify({
|
|
220
|
-
vaultPath: answers.vaultPath ?? null,
|
|
221
|
-
vaultProjectDir: answers.vaultPath ? vaultProjectDir(answers.vaultPath, answers.projectName) : null,
|
|
222
|
-
githubLogin: answers.githubLogin ?? null,
|
|
223
|
-
}, null, 2) + '\n');
|
|
224
|
-
return plan;
|
|
225
|
-
}
|
|
226
|
-
export const VAULT_FOLDERS = [
|
|
227
|
-
'01 Produto',
|
|
228
|
-
'02 Backlog',
|
|
229
|
-
'03 Decisões',
|
|
230
|
-
'04 Handoffs',
|
|
231
|
-
'05 Gates',
|
|
232
|
-
'06 Releases',
|
|
233
|
-
'07 Runs',
|
|
234
|
-
];
|
|
235
|
-
export function vaultProjectDir(vault, projectName) {
|
|
236
|
-
return join(vault, 'the-crew', slugify(projectName));
|
|
237
|
-
}
|
|
238
|
-
function agentNote(t, a, mission) {
|
|
239
|
-
const byId = agentById(t);
|
|
240
|
-
const link = (id) => `[[${noteName(byId.get(id)?.name ?? id)}]]`;
|
|
241
|
-
const readsFrom = t.artifacts
|
|
242
|
-
.filter((x) => a.inputs.includes(x.id))
|
|
243
|
-
.map((x) => `- \`${x.paths[0]}\` (de ${link(x.owner)})`);
|
|
244
|
-
return [
|
|
245
|
-
'---',
|
|
246
|
-
`tags: [agente, ${a.team}]`,
|
|
247
|
-
`id: ${a.id}`,
|
|
248
|
-
`time: ${yamlString(teamName(t, a.team))}`,
|
|
249
|
-
`entrada: ${a.entrypoint ? 'true' : 'false'}`,
|
|
250
|
-
`spec: .the-crew/agents/${a.team}/${a.id}.md`,
|
|
251
|
-
'---',
|
|
252
|
-
'',
|
|
253
|
-
`# ${a.name}`,
|
|
254
|
-
'',
|
|
255
|
-
mission,
|
|
256
|
-
'',
|
|
257
|
-
'## Conversa com',
|
|
258
|
-
'',
|
|
259
|
-
...a.talksTo.map((id) => `- ${link(id)}`),
|
|
260
|
-
'',
|
|
261
|
-
'## Dono de',
|
|
262
|
-
'',
|
|
263
|
-
...owned(t, a.id).map((x) => `- \`${x.paths.join('`, `')}\``),
|
|
264
|
-
...(written(t, a.id).length ? ['', '## Escreve também (só a própria seção)', '', ...written(t, a.id).map((x) => `- \`${x.paths[0]}\` (de ${link(x.owner)})`)] : []),
|
|
265
|
-
'',
|
|
266
|
-
'## Lê',
|
|
267
|
-
'',
|
|
268
|
-
...readsFrom,
|
|
269
|
-
'',
|
|
270
|
-
].join('\n');
|
|
271
|
-
}
|
|
272
|
-
/** Estrutura do vault do Obsidian, conforme a lógica de comunicação dos agentes. */
|
|
273
|
-
export function planVault(ctx) {
|
|
274
|
-
const vault = ctx.answers.vaultPath;
|
|
275
|
-
if (!vault)
|
|
276
|
-
return [];
|
|
277
|
-
const t = ctx.topology;
|
|
278
|
-
const base = vaultProjectDir(vault, ctx.answers.projectName);
|
|
279
|
-
const plan = [];
|
|
280
|
-
const file = (rel, content) => plan.push({ kind: 'file', path: join(base, rel), content });
|
|
281
|
-
const teamLinks = t.teams
|
|
282
|
-
.map((team) => {
|
|
283
|
-
const names = t.agents.filter((a) => a.team === team.id).map((a) => `[[${noteName(a.name)}]]`);
|
|
284
|
-
return `- **${team.name}:** ${names.join(' · ')}`;
|
|
285
|
-
})
|
|
286
|
-
.join('\n');
|
|
287
|
-
const painel = readFileSync(join(ctx.pkgRoot, 'templates', 'obsidian', '00 Painel.md'), 'utf8');
|
|
288
|
-
file('00 Painel.md', render(painel, { projectName: ctx.answers.projectName, projectDir: toPosix(ctx.target), date: ctx.date, teamLinks }));
|
|
289
|
-
for (const d of VAULT_FOLDERS)
|
|
290
|
-
file(join(d, '.gitkeep'), '');
|
|
291
|
-
// Os modelos usam {{date}} do plugin Templates do Obsidian: são copiados sem renderizar.
|
|
292
|
-
const tplDir = join(ctx.pkgRoot, 'templates', 'obsidian', '_templates');
|
|
293
|
-
for (const f of listFiles(tplDir))
|
|
294
|
-
file(join('_templates', relative(tplDir, f)), readFileSync(f, 'utf8'));
|
|
295
|
-
for (const a of t.agents) {
|
|
296
|
-
const spec = readFileSync(join(ctx.pkgRoot, a.spec), 'utf8');
|
|
297
|
-
file(join('Agentes', noteName(teamName(t, a.team)), `${noteName(a.name)}.md`), agentNote(t, a, specMission(spec)));
|
|
298
|
-
}
|
|
299
|
-
return plan;
|
|
300
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
> Descreva o projeto com suas palavras. O **Product Owner** lê este arquivo primeiro, aponta lacunas num `gap-report.md` e transforma o resultado em escopo de MVP, épicos e histórias. Não precisa estar completo: o que faltar vira pergunta.
|
|
4
|
-
|
|
5
|
-
## Problema
|
|
6
|
-
|
|
7
|
-
Que dor existe hoje, para quem, e como ela é resolvida (mal) atualmente?
|
|
8
|
-
|
|
9
|
-
## Usuários
|
|
10
|
-
|
|
11
|
-
Quem usa? Quais papéis existem (ex.: cliente, admin)?
|
|
12
|
-
|
|
13
|
-
## O que o produto precisa fazer
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
## Fora do escopo (por enquanto)
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
## Restrições
|
|
23
|
-
|
|
24
|
-
Prazo, orçamento, compliance (LGPD etc.), integrações obrigatórias.
|
|
25
|
-
|
|
26
|
-
## Preferências técnicas
|
|
27
|
-
|
|
28
|
-
Stack desejada, banco, hospedagem (padrão do time: GitHub + Docker + Railway).
|
|
29
|
-
|
|
30
|
-
## Como saber que deu certo
|
|
31
|
-
|
|
32
|
-
Uma métrica principal e o que não pode piorar.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
**Próximo passo:** peça ao seu assistente: _"Product Owner, leia o PROJECT.md e comece o planejamento."_
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# the-crew: time de agentes deste repositório
|
|
2
|
-
|
|
3
|
-
Este repositório usa o **the-crew** {{version}}: 17 agentes especializados em quatro times (Planeja, Desenvolve, Testa, Deploy). O humano é a autoridade final.
|
|
4
|
-
|
|
5
|
-
## Por onde começar
|
|
6
|
-
|
|
7
|
-
1. Leia `PROJECT.md`. É a descrição do projeto escrita pelo humano.
|
|
8
|
-
2. **Product Owner** é a porta de entrada para escopo: ideias novas, mudanças de escopo, backlog, épicos, histórias e critérios de aceite. Spec: `.the-crew/agents/planeja/product-owner.md`.
|
|
9
|
-
3. **Orchestrator** é a porta de entrada para execução: histórias com `status:ready`, planos de tarefa, despacho, gates e aceite. Spec: `.the-crew/agents/desenvolve/orchestrator.md`.
|
|
10
|
-
4. Para qualquer outro papel, leia a spec completa em `.the-crew/agents/<time>/<agente>.md` antes de agir. O mapa de quem fala com quem, quem é dono de cada artefato e a ordem dos gates está em `.the-crew/contracts/topology.json`.
|
|
11
|
-
|
|
12
|
-
{{agentTable}}
|
|
13
|
-
|
|
14
|
-
## Regras do time
|
|
15
|
-
|
|
16
|
-
- Cada agente escreve só nos artefatos de que é dono ou writer (`topology.json` → `artifacts`). Para mudar o artefato de outro agente, abra um pedido via handoff ou PR.
|
|
17
|
-
- Handoffs por tarefa ficam em `.agents/handoffs/TASK-xx.y.n.md`. Cada agente escreve só a própria seção (`Resultado`, `Review`, `TEST-HANDOFF`, `DESIGN-Q/A`). O plano está em `.agents/plan/dag.json` e o log em `.agents/runs/<run-id>.jsonl`.
|
|
18
|
-
- Ordem canônica dos gates:
|
|
19
|
-
- **TASK:** CI verde → Code Reviewer (+ SecOps se label `security-review`; + Database Organizer se toca `db/`; + design review do UX/UI se é UI) e testes da camada → merge.
|
|
20
|
-
- **História:** QA E2E em staging → matriz de AC pelo Orchestrator → aceite do PO.
|
|
21
|
-
- **Release:** veredito de release do QA + parecer do SecOps → go/no-go do Infra & Release → aprovação humana → deploy do DevOps.
|
|
22
|
-
- Escale ao humano, e espere, antes de: deploy em produção, migração destrutiva, mudança de escopo e aceite de risco Critical/High.
|
|
23
|
-
- Commits seguem Conventional Commits (`feat:`, `fix:`, `docs:`, `chore:`…). Branch por tarefa: `task/TASK-xx.y.n-slug`.
|
|
24
|
-
{{obsidianRules}}
|
|
25
|
-
## Segredos
|
|
26
|
-
|
|
27
|
-
- O token do GitHub fica fora do repositório, no diretório de configuração do usuário. Ele chega aos agentes só pela variável `GITHUB_PERSONAL_ACCESS_TOKEN` quando a sessão é aberta com `npx the-crew exec -- <comando>`.
|
|
28
|
-
- Nunca imprima, registre, commite nem cole o valor de um token ou segredo em arquivos, issues, PRs ou notas do Obsidian.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
## Obsidian (memória legível do time)
|
|
3
|
-
|
|
4
|
-
O vault do Obsidian é o caderno do time, e o repositório continua sendo a fonte de verdade. Pasta do projeto no vault: veja `vaultProjectDir` em `.the-crew/local.json` (arquivo local, fora do git).
|
|
5
|
-
|
|
6
|
-
- Ao criar ou mudar um artefato no repo, crie ou atualize uma nota-resumo na pasta do vault indicada abaixo, com link para o caminho no repo e os IDs (`US-xx.y`, `ADR-####`, `TASK-xx.y.n`…). Não copie o arquivo inteiro.
|
|
7
|
-
- Use os modelos de `_templates/` do vault. Nomeie a nota pelo ID: `TASK-01.2.3.md`, `ADR-0004 Cache.md`.
|
|
8
|
-
- Ligue notas com `[[wikilinks]]` para o agente autor (`[[Orchestrator]]`) e para os IDs relacionados. O grafo do Obsidian passa a mostrar o fluxo real do time.
|
|
9
|
-
|
|
10
|
-
| Artefato no repo | Pasta no vault |
|
|
11
|
-
|---|---|
|
|
12
|
-
| `docs/product/` (visão, PRD, MVP, `decisions-log.md`) | `01 Produto/` |
|
|
13
|
-
| `docs/product/backlog/EP-xx.md`, `US-xx.y.md` | `02 Backlog/` |
|
|
14
|
-
| `docs/architecture/adr/` e decisões | `03 Decisões/` |
|
|
15
|
-
| `.agents/handoffs/TASK-xx.y.n.md` | `04 Handoffs/` |
|
|
16
|
-
| `tests/reports/*-verdict.md`, review de PR, `SEC-###` | `05 Gates/` |
|
|
17
|
-
| `docs/releases/REL-x.y.z.md` | `06 Releases/` |
|
|
18
|
-
| `.agents/runs/<run-id>.jsonl` (resumo do dia) | `07 Runs/` |
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
name: crew-integrity
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
paths:
|
|
6
|
-
- ".the-crew/**"
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
validate:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
timeout-minutes: 5
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
with:
|
|
19
|
-
persist-credentials: false
|
|
20
|
-
- uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: 22
|
|
23
|
-
- name: Validar a simetria dos contratos dos agentes
|
|
24
|
-
run: npx --yes the-crew@{{version}} validate .
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|