@mcp-graph-workflow/agent-graph-flow 0.5.0 → 0.7.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/dist/cli/index.js +181 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -7094,8 +7094,8 @@ var init_implementation_executor = __esm({
|
|
|
7094
7094
|
};
|
|
7095
7095
|
defaultRunner = (command, cwd) => {
|
|
7096
7096
|
try {
|
|
7097
|
-
const
|
|
7098
|
-
return { exitCode: 0, output:
|
|
7097
|
+
const output18 = execSync(command, { cwd, encoding: "utf8", stdio: "pipe" });
|
|
7098
|
+
return { exitCode: 0, output: output18 };
|
|
7099
7099
|
} catch (err) {
|
|
7100
7100
|
const e = err;
|
|
7101
7101
|
return {
|
|
@@ -14578,13 +14578,13 @@ function pruneOrphanWorktrees(options) {
|
|
|
14578
14578
|
}
|
|
14579
14579
|
}
|
|
14580
14580
|
try {
|
|
14581
|
-
const
|
|
14581
|
+
const output18 = execSync("git worktree prune --verbose", execOpts).toString();
|
|
14582
14582
|
if (reapedBranches > 0 || reapedWorktrees > 0) {
|
|
14583
14583
|
log46.info("shadow-branch:prune-ok", { reapedBranches, reapedWorktrees, ttlMs });
|
|
14584
14584
|
} else {
|
|
14585
|
-
log46.debug("shadow-branch:prune-ok", { reapedBranches, reapedWorktrees, output:
|
|
14585
|
+
log46.debug("shadow-branch:prune-ok", { reapedBranches, reapedWorktrees, output: output18 });
|
|
14586
14586
|
}
|
|
14587
|
-
return { pruned: true, reapedBranches, reapedWorktrees, output:
|
|
14587
|
+
return { pruned: true, reapedBranches, reapedWorktrees, output: output18 };
|
|
14588
14588
|
} catch (err) {
|
|
14589
14589
|
const error = String(err);
|
|
14590
14590
|
log46.debug("shadow-branch:prune-failed", { error });
|
|
@@ -14655,6 +14655,181 @@ ${count} skill(s).`);
|
|
|
14655
14655
|
return cmd;
|
|
14656
14656
|
}
|
|
14657
14657
|
|
|
14658
|
+
// src/cli/commands/principles-cmd.ts
|
|
14659
|
+
init_esm_shims();
|
|
14660
|
+
|
|
14661
|
+
// src/core/doctrine/principles.ts
|
|
14662
|
+
init_esm_shims();
|
|
14663
|
+
var PRINCIPLES = Object.freeze([
|
|
14664
|
+
// ── Promessa (o filtro de toda decisão) ──────────────────
|
|
14665
|
+
{
|
|
14666
|
+
id: "three-pillars",
|
|
14667
|
+
title: "Tr\xEAs pilares",
|
|
14668
|
+
category: "promise",
|
|
14669
|
+
statement: "R\xE1pido \xB7 best-practice SWE \xB7 custo de token brutalmente baixo. O que n\xE3o serve aos tr\xEAs, n\xE3o entra.",
|
|
14670
|
+
rationale: "Uma promessa \xFAnica alinha cada decis\xE3o de produto; remove ambiguidade sobre o que merece existir."
|
|
14671
|
+
},
|
|
14672
|
+
// ── TDD ──────────────────────────────────────────────────
|
|
14673
|
+
{
|
|
14674
|
+
id: "tdd-red-green-refactor",
|
|
14675
|
+
title: "TDD Red \u2192 Green \u2192 Refactor",
|
|
14676
|
+
category: "tdd",
|
|
14677
|
+
statement: "Sem teste, sem c\xF3digo. Escreva o teste que falha (Red), fa\xE7a passar (Green), ent\xE3o refatore.",
|
|
14678
|
+
rationale: "O teste primeiro define o contrato e elimina retrabalho \u2014 o anti-vibe-coding por excel\xEAncia."
|
|
14679
|
+
},
|
|
14680
|
+
{
|
|
14681
|
+
id: "ac-as-contract",
|
|
14682
|
+
title: "AC como contrato",
|
|
14683
|
+
category: "tdd",
|
|
14684
|
+
statement: "Crit\xE9rios de aceita\xE7\xE3o Given/When/Then s\xE3o o contrato; o DoD precisa passar antes de `done`.",
|
|
14685
|
+
rationale: "AC test\xE1vel transforma inten\xE7\xE3o em verifica\xE7\xE3o objetiva \u2014 nada \xE9 'pronto' por opini\xE3o."
|
|
14686
|
+
},
|
|
14687
|
+
// ── Clean Code ───────────────────────────────────────────
|
|
14688
|
+
{
|
|
14689
|
+
id: "clean-functions",
|
|
14690
|
+
title: "Fun\xE7\xF5es pequenas e reveladoras",
|
|
14691
|
+
category: "clean-code",
|
|
14692
|
+
statement: "Fun\xE7\xF5es fazem uma coisa, num s\xF3 n\xEDvel de abstra\xE7\xE3o, com nomes que revelam inten\xE7\xE3o.",
|
|
14693
|
+
rationale: "C\xF3digo que se l\xEA como prosa reduz alucina\xE7\xE3o do agente e custo de manuten\xE7\xE3o."
|
|
14694
|
+
},
|
|
14695
|
+
{
|
|
14696
|
+
id: "typed-errors",
|
|
14697
|
+
title: "Erros tipados",
|
|
14698
|
+
category: "clean-code",
|
|
14699
|
+
statement: "Nunca lance string crua; use erros tipados e trate falhas explicitamente.",
|
|
14700
|
+
rationale: "Erros classific\xE1veis permitem retry inteligente e diagn\xF3sticos \u2014 n\xE3o silenciam o sistema."
|
|
14701
|
+
},
|
|
14702
|
+
{
|
|
14703
|
+
id: "no-magic",
|
|
14704
|
+
title: "Sem m\xE1gica, sem `any`",
|
|
14705
|
+
category: "clean-code",
|
|
14706
|
+
statement: "Sem n\xFAmeros m\xE1gicos, sem `any`; tipos estritos e constantes nomeadas.",
|
|
14707
|
+
rationale: "Tipos s\xE3o contexto de m\xE1quina \u2014 elevam o agent-readiness e barram regress\xF5es em compila\xE7\xE3o."
|
|
14708
|
+
},
|
|
14709
|
+
// ── XP ───────────────────────────────────────────────────
|
|
14710
|
+
{
|
|
14711
|
+
id: "atomic-decomposition",
|
|
14712
|
+
title: "Decomposi\xE7\xE3o at\xF4mica",
|
|
14713
|
+
category: "xp",
|
|
14714
|
+
statement: "Cada task \xE9 complet\xE1vel em \u22642h; epics viram tasks at\xF4micas antes de implementar.",
|
|
14715
|
+
rationale: "Pequenos passos verific\xE1veis mant\xEAm o ciclo curto e o custo previs\xEDvel."
|
|
14716
|
+
},
|
|
14717
|
+
{
|
|
14718
|
+
id: "anti-one-shot",
|
|
14719
|
+
title: "Anti-one-shot",
|
|
14720
|
+
category: "xp",
|
|
14721
|
+
statement: "Nunca gere um sistema inteiro num prompt; decomponha e itere.",
|
|
14722
|
+
rationale: "Gera\xE7\xE3o one-shot infla tokens e esconde defeitos \u2014 o oposto da disciplina incremental."
|
|
14723
|
+
},
|
|
14724
|
+
{
|
|
14725
|
+
id: "code-detachment",
|
|
14726
|
+
title: "Code detachment",
|
|
14727
|
+
category: "xp",
|
|
14728
|
+
statement: "Se a IA errou, explique o erro via prompt e regenere \u2014 n\xE3o edite o resultado \xE0 m\xE3o.",
|
|
14729
|
+
rationale: "Mant\xE9m o agente como autor respons\xE1vel e preserva a rastreabilidade no grafo."
|
|
14730
|
+
},
|
|
14731
|
+
// ── Lean / Theory of Constraints ─────────────────────────
|
|
14732
|
+
{
|
|
14733
|
+
id: "wip-one",
|
|
14734
|
+
title: "WIP = 1",
|
|
14735
|
+
category: "lean",
|
|
14736
|
+
statement: "No m\xE1ximo uma task `in_progress` por vez.",
|
|
14737
|
+
rationale: "Lei de Little: cycle_time = WIP / throughput \u2014 menos WIP, menos cycle time."
|
|
14738
|
+
},
|
|
14739
|
+
{
|
|
14740
|
+
id: "pull-not-push",
|
|
14741
|
+
title: "Pull, n\xE3o push",
|
|
14742
|
+
category: "lean",
|
|
14743
|
+
statement: "`next` puxa a pr\xF3xima task desbloqueada; nunca empurre para `in_progress`.",
|
|
14744
|
+
rationale: "Sistema pull respeita o gargalo (TOC) e evita ac\xFAmulo de WIP."
|
|
14745
|
+
},
|
|
14746
|
+
// ── Flow / economia de token (a fórmula do dono no centro) ─
|
|
14747
|
+
{
|
|
14748
|
+
id: "token-economy-lambda-flow",
|
|
14749
|
+
title: "Hipofrontalidade: \u03BB_flow",
|
|
14750
|
+
category: "flow",
|
|
14751
|
+
statement: "\u03BB_flow = \u03BB_base + (\u03B1 \xB7 \u03A6(t)). \u03A6 (\xEDndice de flow, EMA com histerese) governa a agressividade do esquecimento; o decaimento e^{-\u03BB\xB7d} dilui a vizinhan\xE7a do grafo \u2014 cortando tokens de contexto sem perder invariantes.",
|
|
14752
|
+
rationale: "O diferencial do projeto: um controlador determin\xEDstico de esquecimento corta o custo de contexto sem sumariza\xE7\xE3o por LLM."
|
|
14753
|
+
},
|
|
14754
|
+
{
|
|
14755
|
+
id: "repo-map-ranked",
|
|
14756
|
+
title: "Repo-map ranqueado",
|
|
14757
|
+
category: "flow",
|
|
14758
|
+
statement: "Injete s\xEDmbolos ranqueados por PageRank num budget ~1k tokens, focados na task.",
|
|
14759
|
+
rationale: "Contexto de entrada m\xEDnimo e relevante \u2014 corte de token sem perder sinal."
|
|
14760
|
+
},
|
|
14761
|
+
{
|
|
14762
|
+
id: "compact-feedback",
|
|
14763
|
+
title: "Feedback compacto no retry",
|
|
14764
|
+
category: "flow",
|
|
14765
|
+
statement: "No retry, realimente s\xF3 a sa\xEDda de teste que falhou (truncada), pedindo fix incremental.",
|
|
14766
|
+
rationale: "Menos tokens por itera\xE7\xE3o e menos escala\xE7\xF5es que re-geram do zero."
|
|
14767
|
+
}
|
|
14768
|
+
]);
|
|
14769
|
+
function listPrinciples() {
|
|
14770
|
+
return PRINCIPLES;
|
|
14771
|
+
}
|
|
14772
|
+
function getPrinciple(id) {
|
|
14773
|
+
return PRINCIPLES.find((p) => p.id === id);
|
|
14774
|
+
}
|
|
14775
|
+
function principlesByCategory(category) {
|
|
14776
|
+
return PRINCIPLES.filter((p) => p.category === category);
|
|
14777
|
+
}
|
|
14778
|
+
function listCategories() {
|
|
14779
|
+
const seen = [];
|
|
14780
|
+
for (const p of PRINCIPLES) {
|
|
14781
|
+
if (!seen.includes(p.category)) seen.push(p.category);
|
|
14782
|
+
}
|
|
14783
|
+
return seen;
|
|
14784
|
+
}
|
|
14785
|
+
|
|
14786
|
+
// src/cli/commands/principles-cmd.ts
|
|
14787
|
+
function output17(msg) {
|
|
14788
|
+
process.stdout.write(msg + "\n");
|
|
14789
|
+
}
|
|
14790
|
+
var CATEGORY_LABEL = {
|
|
14791
|
+
promise: "Promessa",
|
|
14792
|
+
tdd: "TDD",
|
|
14793
|
+
"clean-code": "Clean Code",
|
|
14794
|
+
xp: "XP",
|
|
14795
|
+
lean: "Lean / TOC",
|
|
14796
|
+
flow: "Flow / economia de token"
|
|
14797
|
+
};
|
|
14798
|
+
function principlesCommand() {
|
|
14799
|
+
const cmd = new Command("principles").description(
|
|
14800
|
+
"O credo de engenharia da CLI: Clean Code \xB7 XP \xB7 TDD \xB7 Lean + \u03BB_flow (economia de token)"
|
|
14801
|
+
);
|
|
14802
|
+
cmd.command("list", { isDefault: true }).description("Lista os princ\xEDpios agrupados por categoria").option("-c, --category <cat>", "Filtra por categoria (promise|tdd|clean-code|xp|lean|flow)").action((opts) => {
|
|
14803
|
+
const cats = opts.category ? [opts.category] : listCategories();
|
|
14804
|
+
for (const cat of cats) {
|
|
14805
|
+
const items = principlesByCategory(cat);
|
|
14806
|
+
if (items.length === 0) {
|
|
14807
|
+
output17(`(categoria desconhecida: ${cat})`);
|
|
14808
|
+
continue;
|
|
14809
|
+
}
|
|
14810
|
+
output17(`
|
|
14811
|
+
${CATEGORY_LABEL[cat] ?? cat}`);
|
|
14812
|
+
for (const p of items) output17(` \u2022 ${p.title.padEnd(28)} ${p.statement}`);
|
|
14813
|
+
}
|
|
14814
|
+
output17(`
|
|
14815
|
+
${listPrinciples().length} princ\xEDpios \xB7 use 'principles show <id>' para detalhes.`);
|
|
14816
|
+
});
|
|
14817
|
+
cmd.command("show <id>").description("Detalha um princ\xEDpio (t\xEDtulo, categoria, statement, rationale)").action((id) => {
|
|
14818
|
+
const p = getPrinciple(id);
|
|
14819
|
+
if (!p) {
|
|
14820
|
+
output17(`Princ\xEDpio desconhecido: ${id}. Tente 'principles list'.`);
|
|
14821
|
+
process.exitCode = 1;
|
|
14822
|
+
return;
|
|
14823
|
+
}
|
|
14824
|
+
output17(`${p.title} [${CATEGORY_LABEL[p.category] ?? p.category}]`);
|
|
14825
|
+
output17(`
|
|
14826
|
+
${p.statement}`);
|
|
14827
|
+
output17(`
|
|
14828
|
+
Por qu\xEA: ${p.rationale}`);
|
|
14829
|
+
});
|
|
14830
|
+
return cmd;
|
|
14831
|
+
}
|
|
14832
|
+
|
|
14658
14833
|
// src/cli/index.ts
|
|
14659
14834
|
var program = new Command();
|
|
14660
14835
|
program.name("agent-graph-flow").description(PROMISE).version(VERSION, "-v, --version");
|
|
@@ -14677,6 +14852,7 @@ program.addCommand(doctorCommand());
|
|
|
14677
14852
|
program.addCommand(gcCommand());
|
|
14678
14853
|
program.addCommand(skillCommand());
|
|
14679
14854
|
program.addCommand(profileCommand());
|
|
14855
|
+
program.addCommand(principlesCommand());
|
|
14680
14856
|
function shouldLaunchTui() {
|
|
14681
14857
|
const noArgs = process.argv.length <= 2;
|
|
14682
14858
|
const isTty = Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-graph-workflow/agent-graph-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Agente SWE autônomo, local-first e token-frugal: PRD → grafo de execução persistente, TDD obrigatório, custo de token brutalmente baixo. AGPL v3.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|