fg-tracker-mcp 0.4.0 → 0.6.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/CHANGELOG.md +13 -0
- package/README.md +2 -0
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +12 -1
- package/dist/docs.js.map +1 -1
- package/dist/infra/aws.d.ts +97 -0
- package/dist/infra/aws.js +557 -0
- package/dist/infra/aws.js.map +1 -0
- package/dist/infra/diff.d.ts +15 -0
- package/dist/infra/diff.js +108 -0
- package/dist/infra/diff.js.map +1 -0
- package/dist/infra/files.d.ts +16 -0
- package/dist/infra/files.js +115 -0
- package/dist/infra/files.js.map +1 -0
- package/dist/infra/handover.d.ts +47 -0
- package/dist/infra/handover.js +437 -0
- package/dist/infra/handover.js.map +1 -0
- package/dist/infra/iac.d.ts +56 -0
- package/dist/infra/iac.js +378 -0
- package/dist/infra/iac.js.map +1 -0
- package/dist/infra/instrument.d.ts +6 -0
- package/dist/infra/instrument.js +140 -0
- package/dist/infra/instrument.js.map +1 -0
- package/dist/infra/tools.d.ts +10 -0
- package/dist/infra/tools.js +700 -0
- package/dist/infra/tools.js.map +1 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +5 -1
- package/dist/server.js.map +1 -1
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog — fg-tracker-mcp
|
|
2
2
|
|
|
3
|
+
## 0.6.0 — 2026-09-15
|
|
4
|
+
|
|
5
|
+
- Tool `infra_detect_environments { profiles?, includeRegions? }` (local, somente leitura): lê os perfis de `~/.aws/config`/`~/.aws/credentials` (+ `AWS_PROFILE` e cadeia padrão), `sts:GetCallerIdentity` por perfil (até 10), deduplica por conta, classifica o ambiente pelo nome do perfil/ARN e detecta as regiões em uso (índices do Resource Explorer ou sondagem com `ListStacks` + `GetResources`).
|
|
6
|
+
- `infra_connect_account`: `environment`, `regions` e `name` opcionais e novo `profile`; sem `regions`, detecta as regiões do perfil. Salva `./fg-tracker-connection-<ambiente>.json` e devolve o comando exato `aws cloudformation deploy ... --profile <perfil> --region <região>`, a ser rodado só com confirmação do usuário.
|
|
7
|
+
- Prompt `connect-infrastructure` reescrito: o agente lê projeto/nível/nome da mensagem, detecta os ambientes, cria uma conexão por ambiente (`<nome> · <Ambiente>`), pede confirmação antes do stack, verifica e descobre; argumentos novos `level` e `name`.
|
|
8
|
+
- API: `regions` opcional na criação da conexão (default `["us-east-1"]`) e `connectionId` em cada nó do grafo.
|
|
9
|
+
|
|
10
|
+
## 0.5.0 — 2026-09-15
|
|
11
|
+
|
|
12
|
+
- **Infraestrutura AWS** (CONTRATO.md §27.9): tools `infra_connect_account`, `infra_verify_connection`, `infra_discover` (inventário com credenciais locais, somente leitura → snapshot), `infra_analyze_iac` (CDK/SAM/Serverless/Terraform/CI), `infra_assign_resources`, `infra_instrument`, `infra_validate`, `infra_get_diagram`, `infra_plan_handover`, `infra_open_handover_pr` (lock, guard do CI, patch e comandos git/gh — nunca executa push) e `infra_complete_handover`.
|
|
13
|
+
- Prompt `connect-infrastructure` com o roteiro e as regras de segurança (nenhuma mudança na AWS pelo agente; aprovação humana no FG Tracker).
|
|
14
|
+
- Quickstart ganha a seção "Infraestrutura (AWS)". Dependências `@aws-sdk/client-*` e `@aws-sdk/credential-providers`.
|
|
15
|
+
|
|
3
16
|
## 0.4.0 — 2026-09-15
|
|
4
17
|
|
|
5
18
|
- **Renomeado de `stread-track-mcp` — nomes antigos continuam funcionando e serão removidos na 1.0.** Veja "Migração de stread-track-mcp" no README.
|
package/README.md
CHANGED
|
@@ -47,6 +47,8 @@ Os nomes antigos `STREAD_TRACK_*` continuam lidos quando o nome novo está ausen
|
|
|
47
47
|
|
|
48
48
|
Tools `track_*` (nomes inalterados), prompt `instrument-project` e resource `fg-tracker://docs/quickstart`.
|
|
49
49
|
|
|
50
|
+
Infraestrutura AWS (0.6.0): tools `infra_*` e prompt `connect-infrastructure` — detectar contas/ambientes/regiões nas credenciais locais, conectar cada ambiente, descobrir recursos com credenciais locais (somente leitura), analisar o IaC, instrumentar, validar e gerar o PR de transferência de controle. Nenhuma tool altera recursos na AWS. Detalhes em `docs/mcp.md` → Infraestrutura.
|
|
51
|
+
|
|
50
52
|
## Migração de stread-track-mcp
|
|
51
53
|
|
|
52
54
|
O pacote foi renomeado de `stread-track-mcp` (última versão no npm: 0.2.0) para `fg-tracker-mcp` (0.4.0). Nomes antigos continuam funcionando e serão removidos na 1.0.
|
package/dist/docs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Conteúdo estático: resource `fg-tracker://docs/quickstart` e o prompt
|
|
3
|
-
* `instrument-project
|
|
3
|
+
* `instrument-project` (o prompt `connect-infrastructure` fica em `infra/tools.ts`).
|
|
4
4
|
*/
|
|
5
5
|
export declare const QUICKSTART_URI = "fg-tracker://docs/quickstart";
|
|
6
6
|
/** @deprecated URI do `stread-track-mcp` ≤ 0.3; ainda registrada como alias, removida na 1.0. */
|
package/dist/docs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Conteúdo estático: resource `fg-tracker://docs/quickstart` e o prompt
|
|
3
|
-
* `instrument-project
|
|
3
|
+
* `instrument-project` (o prompt `connect-infrastructure` fica em `infra/tools.ts`).
|
|
4
4
|
*/
|
|
5
5
|
export const QUICKSTART_URI = 'fg-tracker://docs/quickstart';
|
|
6
6
|
/** @deprecated URI do `stread-track-mcp` ≤ 0.3; ainda registrada como alias, removida na 1.0. */
|
|
@@ -79,6 +79,17 @@ Kinds de span: \`http.server\` (raiz por request), \`db.query\` (nome = SQL norm
|
|
|
79
79
|
| SLOW_ENDPOINT | raiz \`http.server\` com \`durationMs > slowThresholdMs\` (default 1000) |
|
|
80
80
|
| ERROR | raiz com status ≥ 500 ou \`error != null\` |
|
|
81
81
|
|
|
82
|
+
## 7. Infraestrutura (AWS)
|
|
83
|
+
Prompt \`connect-infrastructure\` guia o fluxo completo: o agente detecta sozinho contas, ambientes e regiões. Nenhuma tool altera recursos na AWS; a única mudança é o stack de conexão, criado com o comando devolvido e só com confirmação do usuário. Mudanças de infra só pelo FG Tracker, com aprovação humana.
|
|
84
|
+
0. \`infra_detect_environments { profiles?, includeRegions? }\` — perfis do \`~/.aws\` → conta (STS), ambiente sugerido e regiões em uso (local, somente leitura).
|
|
85
|
+
1. Por ambiente: \`infra_connect_account { projectId, level: 'read'|'operate', environment?, regions?, name?, profile? }\` → template \`./fg-tracker-connection-<ambiente>.json\` + \`aws cloudformation deploy ... --profile --region\` (confirmar com o usuário antes) → \`infra_verify_connection { projectId, connectionId, profile }\`.
|
|
86
|
+
2. \`infra_discover { projectId, regions?, profile? }\` — inventário com credenciais locais (Resource Explorer/Tagging API + CloudFormation) enviado como snapshot.
|
|
87
|
+
3. \`infra_analyze_iac { path? }\` — apps CDK, stacks, assets, SAM/Serverless/Terraform e deploys do CI, com viabilidade de handover.
|
|
88
|
+
4. \`infra_assign_resources { projectId, include, exclude? }\` — confirma o que é do projeto.
|
|
89
|
+
5. \`infra_instrument { projectId, path? }\` — plano: \`instrumentAws\`, \`instrumentPgPool\`, \`startInfraReporter({ ecs: true })\`, camada da extensão nas Lambdas, \`wrapLambda\`.
|
|
90
|
+
6. \`infra_validate { projectId }\` (notas dos 4 pilares) e \`infra_get_diagram { projectId }\` (grafo em texto).
|
|
91
|
+
7. \`infra_plan_handover { projectId, stackNames }\` → \`infra_open_handover_pr\` (gera \`infra/fg-tracker.lock.json\`, guard do CI, patch e comandos git/gh) → após o merge \`infra_complete_handover { projectId, stackNames, prUrl }\`.
|
|
92
|
+
|
|
82
93
|
Ranges aceitos: \`15m|1h|6h|24h|7d|30d\`.
|
|
83
94
|
`;
|
|
84
95
|
}
|
package/dist/docs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../src/docs.ts"],"names":[],"mappings":"AA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AY,QAAQ;;0GAE3H,CAAC;AAC3G,CAAC;AAED,8EAA8E"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export interface SnapshotResource {
|
|
2
|
+
arn: string;
|
|
3
|
+
resourceType: string | null;
|
|
4
|
+
region: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
tags?: Record<string, string>;
|
|
7
|
+
stackName?: string;
|
|
8
|
+
stackLogicalId?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DiscoveryResult {
|
|
11
|
+
accountId: string;
|
|
12
|
+
callerArn: string;
|
|
13
|
+
regions: string[];
|
|
14
|
+
resources: SnapshotResource[];
|
|
15
|
+
sources: Record<string, 'resource-explorer' | 'tagging-api' | 'resource-explorer+tagging-api' | 'error'>;
|
|
16
|
+
stacks: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
region: string;
|
|
19
|
+
status: string;
|
|
20
|
+
resources: number;
|
|
21
|
+
mapped: number;
|
|
22
|
+
stackId: string;
|
|
23
|
+
}>;
|
|
24
|
+
warnings: string[];
|
|
25
|
+
}
|
|
26
|
+
/** Mensagem amigável para erros do AWS SDK (credenciais ausentes/expiradas, acesso negado). */
|
|
27
|
+
export declare function describeAwsError(err: unknown): string;
|
|
28
|
+
export interface ParsedArn {
|
|
29
|
+
partition: string;
|
|
30
|
+
service: string;
|
|
31
|
+
region: string;
|
|
32
|
+
account: string;
|
|
33
|
+
resource: string;
|
|
34
|
+
resourceType: string;
|
|
35
|
+
resourceId: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function parseArn(arn: string): ParsedArn | null;
|
|
38
|
+
/** ARN → tipo CloudFormation (melhor esforço; null quando desconhecido). */
|
|
39
|
+
export declare function arnToResourceType(arn: string): string | null;
|
|
40
|
+
/** Nome legível a partir do ARN. */
|
|
41
|
+
export declare function nameFromArn(arn: string): string;
|
|
42
|
+
/** Serviço amigável (`lambda`, `ecs.service`…) só para o resumo. */
|
|
43
|
+
export declare function serviceLabel(resourceType: string | null, arn: string): string;
|
|
44
|
+
export interface DiscoverOptions {
|
|
45
|
+
regions: string[];
|
|
46
|
+
profile?: string;
|
|
47
|
+
onProgress?: (message: string) => void;
|
|
48
|
+
}
|
|
49
|
+
export declare function discoverAws(options: DiscoverOptions): Promise<DiscoveryResult>;
|
|
50
|
+
/** Lê os outputs de um stack (DescribeStacks, somente leitura). */
|
|
51
|
+
export declare function readStackOutputs(stackName: string, region: string, profile?: string): Promise<Record<string, string>>;
|
|
52
|
+
export type DetectedEnvironment = 'production' | 'staging' | 'development';
|
|
53
|
+
export declare const CANDIDATE_REGIONS: string[];
|
|
54
|
+
/** Perfis de ~/.aws/config e ~/.aws/credentials (respeita AWS_CONFIG_FILE / AWS_SHARED_CREDENTIALS_FILE) + AWS_PROFILE. */
|
|
55
|
+
export declare function listAwsProfiles(env?: NodeJS.ProcessEnv): Promise<string[]>;
|
|
56
|
+
/** Classifica o ambiente por dicas no nome do perfil/ARN; null = perguntar ao usuário. */
|
|
57
|
+
export declare function classifyEnvironment(...hints: Array<string | null | undefined>): DetectedEnvironment | null;
|
|
58
|
+
export declare const ENVIRONMENT_LABEL: Record<DetectedEnvironment, string>;
|
|
59
|
+
export interface RegionDetection {
|
|
60
|
+
regionsInUse: string[];
|
|
61
|
+
stacksPerRegion: Record<string, number>;
|
|
62
|
+
source: 'resource-explorer' | 'probe';
|
|
63
|
+
warnings: string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Regiões em uso na conta: índices do Resource Explorer (ListIndexes) quando existem; senão sonda
|
|
67
|
+
* as regiões candidatas com CloudFormation ListStacks (1ª página) e Tagging GetResources (1 recurso).
|
|
68
|
+
*/
|
|
69
|
+
export declare function detectRegionsInUse(options: {
|
|
70
|
+
profile?: string;
|
|
71
|
+
includeRegions?: string[];
|
|
72
|
+
}): Promise<RegionDetection>;
|
|
73
|
+
export interface DetectedAccount {
|
|
74
|
+
profile: string | null;
|
|
75
|
+
otherProfiles: string[];
|
|
76
|
+
accountId: string;
|
|
77
|
+
arn: string;
|
|
78
|
+
environment: DetectedEnvironment | null;
|
|
79
|
+
regionsInUse: string[];
|
|
80
|
+
stacksPerRegion: Record<string, number>;
|
|
81
|
+
regionSource: RegionDetection['source'];
|
|
82
|
+
suggestedConnectionName: string;
|
|
83
|
+
warnings: string[];
|
|
84
|
+
}
|
|
85
|
+
export interface EnvironmentDetection {
|
|
86
|
+
accounts: DetectedAccount[];
|
|
87
|
+
skipped: Array<{
|
|
88
|
+
profile: string | null;
|
|
89
|
+
reason: string;
|
|
90
|
+
}>;
|
|
91
|
+
profilesFound: string[];
|
|
92
|
+
}
|
|
93
|
+
/** GetCallerIdentity por perfil (até 10), deduplica por conta, classifica ambiente e detecta regiões. */
|
|
94
|
+
export declare function detectEnvironments(options: {
|
|
95
|
+
profiles?: string[];
|
|
96
|
+
includeRegions?: string[];
|
|
97
|
+
}): Promise<EnvironmentDetection>;
|