@orkastery/cli 0.2.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/LICENSE +21 -0
- package/README.md +87 -0
- package/adapters/README.md +22 -0
- package/adapters/claude-code/.claude-plugin/marketplace.json +15 -0
- package/adapters/claude-code/.claude-plugin/plugin.json +31 -0
- package/adapters/claude-code/README.md +102 -0
- package/adapters/claude-code/agents/ork-check.md +32 -0
- package/adapters/claude-code/agents/ork-go.md +32 -0
- package/adapters/claude-code/agents/ork-goal.md +33 -0
- package/adapters/claude-code/agents/ork-master.md +32 -0
- package/adapters/claude-code/agents/ork-plan.md +32 -0
- package/adapters/claude-code/agents/ork-ship.md +32 -0
- package/adapters/claude-code/commands/check.md +45 -0
- package/adapters/claude-code/commands/go.md +46 -0
- package/adapters/claude-code/commands/goal.md +54 -0
- package/adapters/claude-code/commands/master.md +42 -0
- package/adapters/claude-code/commands/ork.md +37 -0
- package/adapters/claude-code/commands/plan.md +47 -0
- package/adapters/claude-code/commands/ship.md +45 -0
- package/adapters/claude-code/hooks/hooks.json +17 -0
- package/adapters/claude-code/hooks/ork-guard.js +130 -0
- package/adapters/hermes/README.md +45 -0
- package/adapters/hermes/bin/ork-abrir-thread.sh +25 -0
- package/adapters/hermes/hermes.plugin.json +21 -0
- package/adapters/hermes/skills/orkastery-devmaster/SKILL.md +116 -0
- package/adapters/openclaw/README.md +63 -0
- package/adapters/openclaw/bin/ork-abrir-thread.sh +24 -0
- package/adapters/openclaw/openclaw.plugin.json +138 -0
- package/dist/adapters/claude-bg.js +308 -0
- package/dist/auditoria.js +848 -0
- package/dist/auditrun.js +976 -0
- package/dist/board.js +314 -0
- package/dist/canarios.js +271 -0
- package/dist/catalogo.js +124 -0
- package/dist/ciclos.js +156 -0
- package/dist/claims.js +226 -0
- package/dist/divida.js +374 -0
- package/dist/doctor.js +246 -0
- package/dist/evalrunner.js +458 -0
- package/dist/fix.js +450 -0
- package/dist/gates.js +92 -0
- package/dist/handoff.js +521 -0
- package/dist/hosts.js +331 -0
- package/dist/index.js +1910 -0
- package/dist/init.js +231 -0
- package/dist/leases.js +508 -0
- package/dist/ledger.js +138 -0
- package/dist/manifest.js +255 -0
- package/dist/master.js +453 -0
- package/dist/memoria.js +773 -0
- package/dist/modos.js +220 -0
- package/dist/orkmind.js +487 -0
- package/dist/orquestracao.js +559 -0
- package/dist/phase.js +572 -0
- package/dist/policies.js +176 -0
- package/dist/prompts.js +406 -0
- package/dist/ratelimit.js +179 -0
- package/dist/recall.js +252 -0
- package/dist/retry.js +917 -0
- package/dist/sandbox.js +94 -0
- package/dist/sessoes.js +104 -0
- package/dist/ship.js +551 -0
- package/dist/slug.js +100 -0
- package/dist/superficie.js +1347 -0
- package/dist/thread.js +333 -0
- package/dist/tokens.js +228 -0
- package/dist/types.js +20 -0
- package/dist/util.js +156 -0
- package/dist/verify.js +262 -0
- package/dist/worktree.js +576 -0
- package/dist/yaml.js +112 -0
- package/eval/README.md +85 -0
- package/eval/casos/check-quality.json +103 -0
- package/eval/casos/code-reviewer.json +102 -0
- package/eval/casos/decision-triage.json +103 -0
- package/eval/casos/go-implementation.json +103 -0
- package/eval/casos/goal-definition.json +103 -0
- package/eval/casos/master-metrics.json +103 -0
- package/eval/casos/narrative-guardian.json +163 -0
- package/eval/casos/orkastery-bootstrap.json +102 -0
- package/eval/casos/plan-specification.json +102 -0
- package/eval/casos/roadmap-keeper.json +103 -0
- package/eval/casos/scope-check-capability-map.json +83 -0
- package/eval/casos/security-auditor.json +102 -0
- package/eval/casos/ship-release.json +122 -0
- package/eval/casos/test-engineer.json +122 -0
- package/eval/casos/thread-state.json +82 -0
- package/eval/casos/thread-tracing.json +83 -0
- package/eval/casos/web-performance-auditor.json +102 -0
- package/eval/fixtures/b0-slug-e-modos/caso.json +56 -0
- package/eval/fixtures/b2-master-log/caso.json +91 -0
- package/eval/fixtures/fx-concurrency/caso.json +15 -0
- package/eval/fixtures/fx-hallucination/caso.json +12 -0
- package/eval/fixtures/fx-happy/caso.json +16 -0
- package/eval/fixtures/fx-schema-drift/caso.json +15 -0
- package/eval/fixtures/fx-stale-base/caso.json +12 -0
- package/eval/fixtures/fx-wiki-destroy/caso.json +16 -0
- package/eval/fixtures/superficie-de-rede/README.md +22 -0
- package/eval/fixtures/superficie-de-rede/api-express.js +30 -0
- package/eval/fixtures/superficie-de-rede/api_fastapi.py +17 -0
- package/eval/fixtures/superficie-de-rede/api_gin.go +18 -0
- package/package.json +56 -0
- package/references/README.md +25 -0
- package/references/code-review-axes.md +82 -0
- package/references/definition-of-done.md +74 -0
- package/references/performance-checklist.md +53 -0
- package/references/security-checklist.md +101 -0
- package/references/testing-patterns.md +51 -0
- package/skills/README.md +43 -0
- package/skills/core/orkastery-bootstrap/SKILL.md +89 -0
- package/skills/core/thread-state/SKILL.md +86 -0
- package/skills/governance/decision-triage/SKILL.md +65 -0
- package/skills/governance/narrative-guardian/SKILL.md +66 -0
- package/skills/governance/roadmap-keeper/SKILL.md +60 -0
- package/skills/governance/scope-check-capability-map/SKILL.md +61 -0
- package/skills/observability/thread-tracing/SKILL.md +63 -0
- package/skills/phases/check-quality/SKILL.md +87 -0
- package/skills/phases/go-implementation/SKILL.md +70 -0
- package/skills/phases/goal-definition/SKILL.md +69 -0
- package/skills/phases/master-metrics/SKILL.md +65 -0
- package/skills/phases/plan-specification/SKILL.md +67 -0
- package/skills/phases/ship-release/SKILL.md +68 -0
- package/skills/reviewers/code-reviewer/SKILL.md +61 -0
- package/skills/reviewers/security-auditor/SKILL.md +68 -0
- package/skills/reviewers/test-engineer/SKILL.md +66 -0
- package/skills/reviewers/web-performance-auditor/SKILL.md +63 -0
package/dist/init.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `ork init`: gera o `orkastery.yaml` do repositorio.
|
|
4
|
+
*
|
|
5
|
+
* O wizard detecta em vez de perguntar (gerenciador de pacotes, branch base, scripts de
|
|
6
|
+
* verificacao) e nunca sobrescreve um manifesto existente sem `--force`.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.raizDoRepo = raizDoRepo;
|
|
43
|
+
exports.nomeDetectado = nomeDetectado;
|
|
44
|
+
exports.baseBranchDetectada = baseBranchDetectada;
|
|
45
|
+
exports.verifyDetectado = verifyDetectado;
|
|
46
|
+
exports.detectar = detectar;
|
|
47
|
+
exports.manifestoYaml = manifestoYaml;
|
|
48
|
+
exports.init = init;
|
|
49
|
+
const fs = __importStar(require("node:fs"));
|
|
50
|
+
const path = __importStar(require("node:path"));
|
|
51
|
+
const manifest_1 = require("./manifest");
|
|
52
|
+
const slug_1 = require("./slug");
|
|
53
|
+
const util_1 = require("./util");
|
|
54
|
+
/** Raiz do repositorio git, resolvendo tambem o caso de worktree. */
|
|
55
|
+
function raizDoRepo(dirInicial) {
|
|
56
|
+
const r = (0, util_1.exec)('git', ['rev-parse', '--show-toplevel'], dirInicial);
|
|
57
|
+
return r.ok ? r.stdout.trim() : path.resolve(dirInicial);
|
|
58
|
+
}
|
|
59
|
+
/** Nome canonico do produto a partir do diretorio principal do repositorio. */
|
|
60
|
+
function nomeDetectado(dirInicial) {
|
|
61
|
+
const comum = (0, util_1.exec)('git', ['rev-parse', '--path-format=absolute', '--git-common-dir'], dirInicial);
|
|
62
|
+
const base = comum.ok
|
|
63
|
+
? path.basename(path.dirname(comum.stdout.trim()))
|
|
64
|
+
: path.basename(raizDoRepo(dirInicial));
|
|
65
|
+
return base.replace(/-(novo|new|old|repo|main)$/i, '').toLowerCase();
|
|
66
|
+
}
|
|
67
|
+
/** Branch base do repositorio: origin/HEAD, senao main, senao master, senao a atual. */
|
|
68
|
+
function baseBranchDetectada(raiz) {
|
|
69
|
+
const origem = (0, util_1.exec)('git', ['symbolic-ref', '--quiet', 'refs/remotes/origin/HEAD'], raiz);
|
|
70
|
+
if (origem.ok && origem.stdout.trim()) {
|
|
71
|
+
return origem.stdout.trim().replace('refs/remotes/origin/', '');
|
|
72
|
+
}
|
|
73
|
+
for (const candidata of ['main', 'master']) {
|
|
74
|
+
if ((0, util_1.exec)('git', ['show-ref', '--verify', '--quiet', `refs/heads/${candidata}`], raiz).ok) {
|
|
75
|
+
return candidata;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const atual = (0, util_1.exec)('git', ['rev-parse', '--abbrev-ref', 'HEAD'], raiz);
|
|
79
|
+
return atual.ok ? atual.stdout.trim() : 'main';
|
|
80
|
+
}
|
|
81
|
+
function gerenciadorDetectado(dir) {
|
|
82
|
+
if (fs.existsSync(path.join(dir, 'pnpm-lock.yaml')))
|
|
83
|
+
return 'pnpm';
|
|
84
|
+
if (fs.existsSync(path.join(dir, 'yarn.lock')))
|
|
85
|
+
return 'yarn';
|
|
86
|
+
if (fs.existsSync(path.join(dir, 'bun.lockb')))
|
|
87
|
+
return 'bun';
|
|
88
|
+
return 'npm';
|
|
89
|
+
}
|
|
90
|
+
/** Procura o package.json do projeto na raiz e nos subdiretorios convencionais. */
|
|
91
|
+
function acharPacote(raiz) {
|
|
92
|
+
const candidatos = ['', 'core', 'app', 'src'];
|
|
93
|
+
for (const sub of candidatos) {
|
|
94
|
+
const dir = path.join(raiz, sub);
|
|
95
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) {
|
|
96
|
+
return { dir, prefixo: sub };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
/** Detecta os comandos de verificacao a partir dos scripts do package.json. */
|
|
102
|
+
function verifyDetectado(raiz) {
|
|
103
|
+
const pacote = acharPacote(raiz);
|
|
104
|
+
if (!pacote)
|
|
105
|
+
return {};
|
|
106
|
+
let scripts = {};
|
|
107
|
+
try {
|
|
108
|
+
const json = JSON.parse(fs.readFileSync(path.join(pacote.dir, 'package.json'), 'utf8'));
|
|
109
|
+
scripts = (json.scripts ?? {});
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
114
|
+
const gerenciador = gerenciadorDetectado(pacote.dir === raiz ? raiz : pacote.dir);
|
|
115
|
+
const prefixo = pacote.prefixo ? `${gerenciador} --prefix ${pacote.prefixo}` : gerenciador;
|
|
116
|
+
const verify = {};
|
|
117
|
+
if (scripts.build)
|
|
118
|
+
verify.build = `${prefixo} run build`;
|
|
119
|
+
if (scripts.test)
|
|
120
|
+
verify.test = `${prefixo} test`;
|
|
121
|
+
if (scripts.typecheck)
|
|
122
|
+
verify.typecheck = `${prefixo} run typecheck`;
|
|
123
|
+
return verify;
|
|
124
|
+
}
|
|
125
|
+
/** Roda a deteccao completa do repositorio. */
|
|
126
|
+
function detectar(dirInicial, nomeForcado, abbrevForcada) {
|
|
127
|
+
const raiz = raizDoRepo(dirInicial);
|
|
128
|
+
const nome = nomeForcado ?? nomeDetectado(dirInicial);
|
|
129
|
+
return {
|
|
130
|
+
raiz,
|
|
131
|
+
nome,
|
|
132
|
+
abbrev: (0, slug_1.normalizarAbbrev)(abbrevForcada ?? nome),
|
|
133
|
+
baseBranch: baseBranchDetectada(raiz),
|
|
134
|
+
gerenciador: gerenciadorDetectado(raiz),
|
|
135
|
+
verify: verifyDetectado(raiz),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** Serializa o manifesto v1 a partir da deteccao. */
|
|
139
|
+
function manifestoYaml(d) {
|
|
140
|
+
const linhaVerify = (chave, valor) => valor ? ` ${chave}: "${valor}"` : ` # ${chave}: nao detectado`;
|
|
141
|
+
return `# Manifesto do Orkastery (v1, bloco B0)
|
|
142
|
+
# Gerado por \`ork init\`. Fonte unica da configuracao do projeto.
|
|
143
|
+
# Limite duro de 16 KB: prosa longa vai para a memoria com tag, nao para este arquivo.
|
|
144
|
+
|
|
145
|
+
project:
|
|
146
|
+
name: "${d.nome}"
|
|
147
|
+
# abbrev: ate 3 caracteres [a-z0-9], parte 1 do slug de sessao, unica no workspace
|
|
148
|
+
abbrev: "${d.abbrev}"
|
|
149
|
+
stage: nascente
|
|
150
|
+
|
|
151
|
+
board:
|
|
152
|
+
adapter: hermes-kanban
|
|
153
|
+
default: default
|
|
154
|
+
|
|
155
|
+
runtime:
|
|
156
|
+
# claude-bg despacha \`claude --bg\` (sessao visivel no app e em \`claude agents\`)
|
|
157
|
+
adapter: claude-bg
|
|
158
|
+
model: opus
|
|
159
|
+
effort: high
|
|
160
|
+
# subscription-only: proibido despachar por provider pago (licao dos US$ 16)
|
|
161
|
+
provider_policy: subscription-only
|
|
162
|
+
|
|
163
|
+
conduction:
|
|
164
|
+
# modo usado quando o pedido do builder nao traz #TAG
|
|
165
|
+
default_mode: classic
|
|
166
|
+
allowed_modes: [look, ork, classic, maestro, auto]
|
|
167
|
+
|
|
168
|
+
worktree:
|
|
169
|
+
base_branch: "${d.baseBranch}"
|
|
170
|
+
dir: ".claude/worktrees"
|
|
171
|
+
por_thread: true
|
|
172
|
+
|
|
173
|
+
verify:
|
|
174
|
+
${linhaVerify('build', d.verify.build)}
|
|
175
|
+
${linhaVerify('test', d.verify.test)}
|
|
176
|
+
${linhaVerify('typecheck', d.verify.typecheck)}
|
|
177
|
+
|
|
178
|
+
concurrency:
|
|
179
|
+
max_parallel_threads: 3
|
|
180
|
+
|
|
181
|
+
handoff:
|
|
182
|
+
# gate de tokens (bloco B1): rotaciona a sessao acima destas ocupacoes de janela
|
|
183
|
+
rotate_above: 0.70
|
|
184
|
+
force_rotate_above: 0.85
|
|
185
|
+
|
|
186
|
+
retry:
|
|
187
|
+
# autonomia do bloco B3: retry tipado por motivo de gate e fila duravel de rate limit
|
|
188
|
+
# max_tentativas e o LIMITE DE ESCALACAO: estourado, pausa qualquer modo, ate #Auto
|
|
189
|
+
max_tentativas: 3
|
|
190
|
+
# janela usada so quando o runtime diz "rate limit" e NAO diz a hora do reset
|
|
191
|
+
# (fica marcada como estimativa na fila; o ork nunca inventa horario medido)
|
|
192
|
+
janela_padrao_min: 60
|
|
193
|
+
escalar_esforco: true
|
|
194
|
+
|
|
195
|
+
memory:
|
|
196
|
+
# files = fallback honesto sem OrkMind (handoff por arquivos, ponteiro path#ancora)
|
|
197
|
+
# orkmind = camada semantica do bloco B6 por cima, com degradacao honesta para files
|
|
198
|
+
mode: files
|
|
199
|
+
# NOME da variavel de ambiente com a DSN da base PROPRIA deste tenant, nunca a DSN.
|
|
200
|
+
# Vazio = o regime orkmind nao liga (o ork nao adivinha base: base alheia e pior que
|
|
201
|
+
# base nenhuma, precedente do incidente memory-orkmind).
|
|
202
|
+
database_url_env: ""
|
|
203
|
+
cli: orkmind
|
|
204
|
+
timeout_ms: 15000
|
|
205
|
+
|
|
206
|
+
audit:
|
|
207
|
+
# governanca de custo dos auditores periodicos (bloco B5)
|
|
208
|
+
# janela ociosa da assinatura: fora dela a rodada so anda com --agora <quem>
|
|
209
|
+
janela_ociosa: "22:00-06:00"
|
|
210
|
+
effort: eco
|
|
211
|
+
since_padrao: 7d
|
|
212
|
+
graphify: auto
|
|
213
|
+
|
|
214
|
+
policies:
|
|
215
|
+
provider: block
|
|
216
|
+
segredo_em_prompt: block
|
|
217
|
+
push_direto_na_base: block
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
220
|
+
/** Gera o manifesto e o esqueleto de `.orkastery/`. Nao sobrescreve sem `force`. */
|
|
221
|
+
function init(dirInicial, opcoes = {}) {
|
|
222
|
+
const deteccao = detectar(dirInicial, opcoes.nome, opcoes.abbrev);
|
|
223
|
+
const caminho = path.join(deteccao.raiz, manifest_1.NOME_MANIFESTO);
|
|
224
|
+
const existe = fs.existsSync(caminho);
|
|
225
|
+
if (existe && !opcoes.force) {
|
|
226
|
+
return { caminho, criado: false, deteccao };
|
|
227
|
+
}
|
|
228
|
+
(0, util_1.gravar)(caminho, manifestoYaml(deteccao));
|
|
229
|
+
fs.mkdirSync(path.join(deteccao.raiz, manifest_1.DIR_ESTADO, 'threads'), { recursive: true });
|
|
230
|
+
return { caminho, criado: true, deteccao };
|
|
231
|
+
}
|