@ggailabs/cli-context 0.5.6 → 1.1.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 +25 -181
- package/dist/.context/docs/GENESIS_SYSTEM_PROMPT.md +61 -0
- package/dist/.context/eng/agents/architect.md +68 -0
- package/dist/.context/eng/agents/backend_typescript.md +1000 -0
- package/dist/.context/eng/agents/bug_hunter.md +49 -0
- package/dist/.context/eng/agents/code_archaeologist.md +83 -0
- package/dist/.context/eng/agents/code_reviewer.md +90 -0
- package/dist/.context/eng/agents/devops_specialist.md +718 -0
- package/dist/.context/eng/agents/frontend_specialist.md +1027 -0
- package/dist/.context/eng/agents/orchestrator.md +89 -0
- package/dist/.context/eng/agents/penetration_tester.md +59 -0
- package/dist/.context/eng/agents/qa_specialist.md +1234 -0
- package/dist/.context/eng/agents/security_reviewer.md +92 -0
- package/dist/.context/eng/agents/ui_specialist.md +16 -0
- package/dist/.context/eng/docs/AGENT_HANDOFF_PROMPT.md +44 -0
- package/dist/.context/eng/docs/GENESIS_DESIGN_SYSTEM.md +88 -0
- package/dist/.context/eng/docs/GG_METHODOLOGY.md +48 -0
- package/dist/.context/eng/docs/OPERATIONS_LOG.md +31 -0
- package/dist/.context/eng/docs/PROJECT_MAP.md +35 -0
- package/dist/.context/eng/docs/standards/devops.md +0 -0
- package/dist/.context/eng/docs/standards/frontend.md +0 -0
- package/dist/.context/eng/docs/standards/typescript.md +12 -0
- package/dist/.context/eng/skills/agent_logging/SKILL.md +22 -0
- package/dist/.context/eng/skills/brainstorming/SKILL.md +51 -0
- package/dist/.context/eng/skills/documentation_templates/SKILL.md +73 -0
- package/dist/.context/eng/skills/exploring_codebase/SKILL.md +52 -0
- package/dist/.context/eng/skills/mcp_builder/SKILL.md +64 -0
- package/dist/.context/eng/skills/patterns/compliance_check/SKILL.md +37 -0
- package/dist/.context/eng/skills/patterns/coverage_table/SKILL.md +57 -0
- package/dist/.context/eng/skills/patterns/exit_criteria/SKILL.md +35 -0
- package/dist/.context/eng/skills/patterns/failure_recovery/SKILL.md +78 -0
- package/dist/.context/eng/skills/patterns/quality_gate/SKILL.md +43 -0
- package/dist/.context/eng/skills/patterns/standards_workflow/SKILL.md +395 -0
- package/dist/.context/eng/skills/patterns/state_tracking/SKILL.md +34 -0
- package/dist/.context/eng/skills/patterns/task_tracking/SKILL.md +42 -0
- package/dist/.context/eng/skills/performance_profiling/SKILL.md +60 -0
- package/dist/.context/eng/skills/previce/SKILL.md +49 -0
- package/dist/.context/eng/skills/tdd/SKILL.md +59 -0
- package/dist/.context/eng/skills/using_git_worktrees/SKILL.md +45 -0
- package/dist/.context/eng/skills/vulnerability_scanner/SKILL.md +78 -0
- package/dist/.context/eng/skills/writing_plans/SKILL.md +85 -0
- package/dist/.context/plans/.gitkeep +0 -0
- package/dist/.context/pt-br/agents/architect.md +68 -0
- package/dist/.context/pt-br/agents/backend_typescript.md +1002 -0
- package/dist/.context/pt-br/agents/bug_hunter.md +49 -0
- package/dist/.context/pt-br/agents/code_archaeologist.md +82 -0
- package/dist/.context/pt-br/agents/code_reviewer.md +88 -0
- package/dist/.context/pt-br/agents/devops_specialist.md +718 -0
- package/dist/.context/pt-br/agents/frontend_specialist.md +1029 -0
- package/dist/.context/pt-br/agents/orchestrator.md +87 -0
- package/dist/.context/pt-br/agents/penetration_tester.md +59 -0
- package/dist/.context/pt-br/agents/qa_specialist.md +1234 -0
- package/dist/.context/pt-br/agents/security_reviewer.md +92 -0
- package/dist/.context/pt-br/agents/ui_specialist.md +55 -0
- package/dist/.context/pt-br/docs/AGENT_HANDOFF_PROMPT.md +44 -0
- package/dist/.context/pt-br/docs/GENESIS_DESIGN_SYSTEM.md +88 -0
- package/dist/.context/pt-br/docs/GG_METHODOLOGY.md +48 -0
- package/dist/.context/pt-br/docs/OPERATIONS_LOG.md +31 -0
- package/dist/.context/pt-br/docs/PROJECT_MAP.md +37 -0
- package/dist/.context/pt-br/docs/standards/devops.md +707 -0
- package/dist/.context/pt-br/docs/standards/frontend.md +748 -0
- package/dist/.context/pt-br/docs/standards/typescript.md +1150 -0
- package/dist/.context/pt-br/skills/agent_logging/SKILL.md +40 -0
- package/dist/.context/pt-br/skills/brainstorming/SKILL.md +51 -0
- package/dist/.context/pt-br/skills/documentation_templates/SKILL.md +73 -0
- package/dist/.context/pt-br/skills/exploring_codebase/SKILL.md +52 -0
- package/dist/.context/pt-br/skills/mcp_builder/SKILL.md +64 -0
- package/dist/.context/pt-br/skills/patterns/compliance_check/SKILL.md +37 -0
- package/dist/.context/pt-br/skills/patterns/coverage_table/SKILL.md +57 -0
- package/dist/.context/pt-br/skills/patterns/exit_criteria/SKILL.md +38 -0
- package/dist/.context/pt-br/skills/patterns/failure_recovery/SKILL.md +30 -0
- package/dist/.context/pt-br/skills/patterns/quality_gate/SKILL.md +43 -0
- package/dist/.context/pt-br/skills/patterns/standards_workflow/SKILL.md +45 -0
- package/dist/.context/pt-br/skills/patterns/state_tracking/SKILL.md +31 -0
- package/dist/.context/pt-br/skills/patterns/task_tracking/SKILL.md +27 -0
- package/dist/.context/pt-br/skills/performance_profiling/SKILL.md +60 -0
- package/dist/.context/pt-br/skills/previce/SKILL.md +51 -0
- package/dist/.context/pt-br/skills/tdd/SKILL.md +59 -0
- package/dist/.context/pt-br/skills/using_git_worktrees/SKILL.md +45 -0
- package/dist/.context/pt-br/skills/vulnerability_scanner/SKILL.md +78 -0
- package/dist/.context/pt-br/skills/writing_plans/SKILL.md +85 -0
- package/dist/.context/workflow/.gitkeep +0 -0
- package/dist/commands/init.js +159 -0
- package/dist/commands/monitor.js +34 -0
- package/dist/index.js +20 -568
- package/dist/services/monitor-service.js +342 -0
- package/dist/services/scaffolder.js +177 -0
- package/package.json +16 -58
- package/LICENSE +0 -21
- package/dist/generators/agents/agentConfig.d.ts +0 -4
- package/dist/generators/agents/agentConfig.d.ts.map +0 -1
- package/dist/generators/agents/agentConfig.js +0 -180
- package/dist/generators/agents/agentConfig.js.map +0 -1
- package/dist/generators/agents/agentGenerator.d.ts +0 -9
- package/dist/generators/agents/agentGenerator.d.ts.map +0 -1
- package/dist/generators/agents/agentGenerator.js +0 -97
- package/dist/generators/agents/agentGenerator.js.map +0 -1
- package/dist/generators/agents/agentTypes.d.ts +0 -4
- package/dist/generators/agents/agentTypes.d.ts.map +0 -1
- package/dist/generators/agents/agentTypes.js +0 -25
- package/dist/generators/agents/agentTypes.js.map +0 -1
- package/dist/generators/agents/index.d.ts +0 -4
- package/dist/generators/agents/index.d.ts.map +0 -1
- package/dist/generators/agents/index.js +0 -12
- package/dist/generators/agents/index.js.map +0 -1
- package/dist/generators/agents/templates/index.d.ts +0 -4
- package/dist/generators/agents/templates/index.d.ts.map +0 -1
- package/dist/generators/agents/templates/index.js +0 -8
- package/dist/generators/agents/templates/index.js.map +0 -1
- package/dist/generators/agents/templates/indexTemplate.d.ts +0 -3
- package/dist/generators/agents/templates/indexTemplate.d.ts.map +0 -1
- package/dist/generators/agents/templates/indexTemplate.js +0 -36
- package/dist/generators/agents/templates/indexTemplate.js.map +0 -1
- package/dist/generators/agents/templates/playbookTemplate.d.ts +0 -4
- package/dist/generators/agents/templates/playbookTemplate.d.ts.map +0 -1
- package/dist/generators/agents/templates/playbookTemplate.js +0 -99
- package/dist/generators/agents/templates/playbookTemplate.js.map +0 -1
- package/dist/generators/agents/templates/types.d.ts +0 -14
- package/dist/generators/agents/templates/types.d.ts.map +0 -1
- package/dist/generators/agents/templates/types.js +0 -3
- package/dist/generators/agents/templates/types.js.map +0 -1
- package/dist/generators/documentation/documentationGenerator.d.ts +0 -15
- package/dist/generators/documentation/documentationGenerator.d.ts.map +0 -1
- package/dist/generators/documentation/documentationGenerator.js +0 -188
- package/dist/generators/documentation/documentationGenerator.js.map +0 -1
- package/dist/generators/documentation/guideRegistry.d.ts +0 -6
- package/dist/generators/documentation/guideRegistry.d.ts.map +0 -1
- package/dist/generators/documentation/guideRegistry.js +0 -82
- package/dist/generators/documentation/guideRegistry.js.map +0 -1
- package/dist/generators/documentation/index.d.ts +0 -2
- package/dist/generators/documentation/index.d.ts.map +0 -1
- package/dist/generators/documentation/index.js +0 -6
- package/dist/generators/documentation/index.js.map +0 -1
- package/dist/generators/documentation/templates/apiReferenceTemplate.d.ts +0 -2
- package/dist/generators/documentation/templates/apiReferenceTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/apiReferenceTemplate.js +0 -490
- package/dist/generators/documentation/templates/apiReferenceTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/architectureTemplate.d.ts +0 -3
- package/dist/generators/documentation/templates/architectureTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/architectureTemplate.js +0 -66
- package/dist/generators/documentation/templates/architectureTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/common.d.ts +0 -7
- package/dist/generators/documentation/templates/common.d.ts.map +0 -1
- package/dist/generators/documentation/templates/common.js +0 -58
- package/dist/generators/documentation/templates/common.js.map +0 -1
- package/dist/generators/documentation/templates/dataFlowTemplate.d.ts +0 -3
- package/dist/generators/documentation/templates/dataFlowTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/dataFlowTemplate.js +0 -40
- package/dist/generators/documentation/templates/dataFlowTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.d.ts +0 -2
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.js +0 -44
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/glossaryTemplate.d.ts +0 -3
- package/dist/generators/documentation/templates/glossaryTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/glossaryTemplate.js +0 -41
- package/dist/generators/documentation/templates/glossaryTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/index.d.ts +0 -15
- package/dist/generators/documentation/templates/index.d.ts.map +0 -1
- package/dist/generators/documentation/templates/index.js +0 -30
- package/dist/generators/documentation/templates/index.js.map +0 -1
- package/dist/generators/documentation/templates/indexTemplate.d.ts +0 -3
- package/dist/generators/documentation/templates/indexTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/indexTemplate.js +0 -42
- package/dist/generators/documentation/templates/indexTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/migrationTemplate.d.ts +0 -2
- package/dist/generators/documentation/templates/migrationTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/migrationTemplate.js +0 -422
- package/dist/generators/documentation/templates/migrationTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/onboardingTemplate.d.ts +0 -2
- package/dist/generators/documentation/templates/onboardingTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/onboardingTemplate.js +0 -431
- package/dist/generators/documentation/templates/onboardingTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/projectOverviewTemplate.d.ts +0 -3
- package/dist/generators/documentation/templates/projectOverviewTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/projectOverviewTemplate.js +0 -65
- package/dist/generators/documentation/templates/projectOverviewTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/securityTemplate.d.ts +0 -2
- package/dist/generators/documentation/templates/securityTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/securityTemplate.js +0 -39
- package/dist/generators/documentation/templates/securityTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/testingTemplate.d.ts +0 -2
- package/dist/generators/documentation/templates/testingTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/testingTemplate.js +0 -45
- package/dist/generators/documentation/templates/testingTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/toolingTemplate.d.ts +0 -2
- package/dist/generators/documentation/templates/toolingTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/toolingTemplate.js +0 -42
- package/dist/generators/documentation/templates/toolingTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/troubleshootingTemplate.d.ts +0 -2
- package/dist/generators/documentation/templates/troubleshootingTemplate.d.ts.map +0 -1
- package/dist/generators/documentation/templates/troubleshootingTemplate.js +0 -292
- package/dist/generators/documentation/templates/troubleshootingTemplate.js.map +0 -1
- package/dist/generators/documentation/templates/types.d.ts +0 -23
- package/dist/generators/documentation/templates/types.d.ts.map +0 -1
- package/dist/generators/documentation/templates/types.js +0 -3
- package/dist/generators/documentation/templates/types.js.map +0 -1
- package/dist/generators/plans/index.d.ts +0 -2
- package/dist/generators/plans/index.d.ts.map +0 -1
- package/dist/generators/plans/index.js +0 -6
- package/dist/generators/plans/index.js.map +0 -1
- package/dist/generators/plans/planGenerator.d.ts +0 -22
- package/dist/generators/plans/planGenerator.d.ts.map +0 -1
- package/dist/generators/plans/planGenerator.js +0 -109
- package/dist/generators/plans/planGenerator.js.map +0 -1
- package/dist/generators/plans/templates/indexTemplate.d.ts +0 -3
- package/dist/generators/plans/templates/indexTemplate.d.ts.map +0 -1
- package/dist/generators/plans/templates/indexTemplate.js +0 -37
- package/dist/generators/plans/templates/indexTemplate.js.map +0 -1
- package/dist/generators/plans/templates/planTemplate.d.ts +0 -3
- package/dist/generators/plans/templates/planTemplate.d.ts.map +0 -1
- package/dist/generators/plans/templates/planTemplate.js +0 -166
- package/dist/generators/plans/templates/planTemplate.js.map +0 -1
- package/dist/generators/plans/templates/types.d.ts +0 -19
- package/dist/generators/plans/templates/types.d.ts.map +0 -1
- package/dist/generators/plans/templates/types.js +0 -3
- package/dist/generators/plans/templates/types.js.map +0 -1
- package/dist/generators/shared/contextGenerator.d.ts +0 -7
- package/dist/generators/shared/contextGenerator.d.ts.map +0 -1
- package/dist/generators/shared/contextGenerator.js +0 -13
- package/dist/generators/shared/contextGenerator.js.map +0 -1
- package/dist/generators/shared/directoryTemplateHelpers.d.ts +0 -2
- package/dist/generators/shared/directoryTemplateHelpers.d.ts.map +0 -1
- package/dist/generators/shared/directoryTemplateHelpers.js +0 -12
- package/dist/generators/shared/directoryTemplateHelpers.js.map +0 -1
- package/dist/generators/shared/generatorUtils.d.ts +0 -16
- package/dist/generators/shared/generatorUtils.d.ts.map +0 -1
- package/dist/generators/shared/generatorUtils.js +0 -119
- package/dist/generators/shared/generatorUtils.js.map +0 -1
- package/dist/generators/shared/index.d.ts +0 -4
- package/dist/generators/shared/index.d.ts.map +0 -1
- package/dist/generators/shared/index.js +0 -10
- package/dist/generators/shared/index.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/prompts/defaults.d.ts +0 -3
- package/dist/prompts/defaults.d.ts.map +0 -1
- package/dist/prompts/defaults.js +0 -95
- package/dist/prompts/defaults.js.map +0 -1
- package/dist/services/baseLLMClient.d.ts +0 -12
- package/dist/services/baseLLMClient.d.ts.map +0 -1
- package/dist/services/baseLLMClient.js +0 -80
- package/dist/services/baseLLMClient.js.map +0 -1
- package/dist/services/fill/fillService.d.ts +0 -46
- package/dist/services/fill/fillService.d.ts.map +0 -1
- package/dist/services/fill/fillService.js +0 -254
- package/dist/services/fill/fillService.js.map +0 -1
- package/dist/services/init/initService.d.ts +0 -37
- package/dist/services/init/initService.d.ts.map +0 -1
- package/dist/services/init/initService.js +0 -167
- package/dist/services/init/initService.js.map +0 -1
- package/dist/services/llmClientFactory.d.ts +0 -8
- package/dist/services/llmClientFactory.d.ts.map +0 -1
- package/dist/services/llmClientFactory.js +0 -23
- package/dist/services/llmClientFactory.js.map +0 -1
- package/dist/services/openRouterClient.d.ts +0 -9
- package/dist/services/openRouterClient.d.ts.map +0 -1
- package/dist/services/openRouterClient.js +0 -49
- package/dist/services/openRouterClient.js.map +0 -1
- package/dist/services/plan/planService.d.ts +0 -57
- package/dist/services/plan/planService.d.ts.map +0 -1
- package/dist/services/plan/planService.js +0 -334
- package/dist/services/plan/planService.js.map +0 -1
- package/dist/services/shared/llmConfig.d.ts +0 -22
- package/dist/services/shared/llmConfig.d.ts.map +0 -1
- package/dist/services/shared/llmConfig.js +0 -38
- package/dist/services/shared/llmConfig.js.map +0 -1
- package/dist/types.d.ts +0 -65
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/utils/cliUI.d.ts +0 -27
- package/dist/utils/cliUI.d.ts.map +0 -1
- package/dist/utils/cliUI.js +0 -252
- package/dist/utils/cliUI.js.map +0 -1
- package/dist/utils/fileMapper.d.ts +0 -11
- package/dist/utils/fileMapper.d.ts.map +0 -1
- package/dist/utils/fileMapper.js +0 -146
- package/dist/utils/fileMapper.js.map +0 -1
- package/dist/utils/gitService.d.ts +0 -50
- package/dist/utils/gitService.d.ts.map +0 -1
- package/dist/utils/gitService.js +0 -470
- package/dist/utils/gitService.js.map +0 -1
- package/dist/utils/i18n.d.ts +0 -171
- package/dist/utils/i18n.d.ts.map +0 -1
- package/dist/utils/i18n.js +0 -381
- package/dist/utils/i18n.js.map +0 -1
- package/dist/utils/promptLoader.d.ts +0 -12
- package/dist/utils/promptLoader.d.ts.map +0 -1
- package/dist/utils/promptLoader.js +0 -81
- package/dist/utils/promptLoader.js.map +0 -1
- package/dist/utils/versionChecker.d.ts +0 -15
- package/dist/utils/versionChecker.d.ts.map +0 -1
- package/dist/utils/versionChecker.js +0 -49
- package/dist/utils/versionChecker.js.map +0 -1
- package/prompts/update_plan_prompt.md +0 -41
- package/prompts/update_scaffold_prompt.md +0 -47
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import boxen from 'boxen';
|
|
5
|
+
import { clear } from 'console';
|
|
6
|
+
import { Scaffolder } from './scaffolder.js';
|
|
7
|
+
const COMMANDS = ['/details', '/logs', '/agents', '/help', '/exit', '/clear', '/map', '/sync', '/init'];
|
|
8
|
+
export class MonitorService {
|
|
9
|
+
logPath;
|
|
10
|
+
contextPath;
|
|
11
|
+
isRunning = false;
|
|
12
|
+
version = '1.1.0';
|
|
13
|
+
projectName = 'Genesis';
|
|
14
|
+
language;
|
|
15
|
+
commandBuffer = '';
|
|
16
|
+
showDetails = false;
|
|
17
|
+
activeView = 'logs';
|
|
18
|
+
agentsList = [];
|
|
19
|
+
actionStatus = null;
|
|
20
|
+
scaffolder;
|
|
21
|
+
constructor(contextPath, language = 'pt-br') {
|
|
22
|
+
this.contextPath = contextPath;
|
|
23
|
+
this.logPath = path.join(process.cwd(), contextPath, 'docs/OPERATIONS_LOG.md');
|
|
24
|
+
this.language = language;
|
|
25
|
+
// Inicializar orquestrador real
|
|
26
|
+
this.scaffolder = new Scaffolder({
|
|
27
|
+
output: contextPath,
|
|
28
|
+
projectName: 'Genesis Project',
|
|
29
|
+
framework: 'React/GG',
|
|
30
|
+
mode: 'discovery',
|
|
31
|
+
uiMode: 'full',
|
|
32
|
+
language: language
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async start() {
|
|
36
|
+
if (!await fs.pathExists(this.logPath)) {
|
|
37
|
+
throw new Error(`Arquivo de log não encontrado em: ${this.logPath}`);
|
|
38
|
+
}
|
|
39
|
+
await this.loadProjectInfo();
|
|
40
|
+
await this.discoverAgents();
|
|
41
|
+
this.isRunning = true;
|
|
42
|
+
process.stdout.write('\x1b[?1049h');
|
|
43
|
+
this.render();
|
|
44
|
+
fs.watch(this.logPath, () => {
|
|
45
|
+
if (this.isRunning)
|
|
46
|
+
this.render();
|
|
47
|
+
});
|
|
48
|
+
process.stdin.setRawMode(true);
|
|
49
|
+
process.stdin.resume();
|
|
50
|
+
process.stdin.setEncoding('utf8');
|
|
51
|
+
process.stdin.on('data', (data) => {
|
|
52
|
+
const key = data.toString();
|
|
53
|
+
this.handleInput(key);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async loadProjectInfo() {
|
|
57
|
+
try {
|
|
58
|
+
const pkgPath = path.join(process.cwd(), 'package.json');
|
|
59
|
+
if (await fs.pathExists(pkgPath)) {
|
|
60
|
+
const pkg = await fs.readJson(pkgPath);
|
|
61
|
+
this.projectName = pkg.name || 'Genesis';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
this.projectName = 'Genesis';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async discoverAgents() {
|
|
69
|
+
try {
|
|
70
|
+
const agentsDir = path.join(process.cwd(), this.contextPath, 'agents');
|
|
71
|
+
if (await fs.pathExists(agentsDir)) {
|
|
72
|
+
const files = await fs.readdir(agentsDir);
|
|
73
|
+
this.agentsList = files
|
|
74
|
+
.filter(f => f.endsWith('.md'))
|
|
75
|
+
.map(f => f.replace('.md', ''))
|
|
76
|
+
.map(name => name.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' '));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
this.agentsList = ['Architect', 'UI Specialist'];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
handleInput(key) {
|
|
84
|
+
if (key === '\u0003') {
|
|
85
|
+
this.stop();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (key === '\u000c') {
|
|
89
|
+
this.render();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (key === '\u0009') {
|
|
93
|
+
if (this.commandBuffer.startsWith('/')) {
|
|
94
|
+
this.autoComplete();
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.cycleView();
|
|
98
|
+
}
|
|
99
|
+
this.render();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (key === '\u007f' || key === '\b') {
|
|
103
|
+
this.commandBuffer = this.commandBuffer.slice(0, -1);
|
|
104
|
+
this.render();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (key === '\r' || key === '\n') {
|
|
108
|
+
this.executeCommand();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (key === 'q' && this.commandBuffer === '') {
|
|
112
|
+
this.stop();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (key.length === 1 && key >= ' ') {
|
|
116
|
+
this.commandBuffer += key;
|
|
117
|
+
this.render();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
autoComplete() {
|
|
121
|
+
const matches = COMMANDS.filter(cmd => cmd.startsWith(this.commandBuffer));
|
|
122
|
+
if (matches.length === 1) {
|
|
123
|
+
this.commandBuffer = matches[0];
|
|
124
|
+
}
|
|
125
|
+
else if (matches.length > 1) {
|
|
126
|
+
this.commandBuffer = matches[0];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
cycleView() {
|
|
130
|
+
if (this.activeView === 'logs')
|
|
131
|
+
this.activeView = 'agents';
|
|
132
|
+
else if (this.activeView === 'agents')
|
|
133
|
+
this.activeView = 'help';
|
|
134
|
+
else
|
|
135
|
+
this.activeView = 'logs';
|
|
136
|
+
}
|
|
137
|
+
async executeCommand() {
|
|
138
|
+
const cmd = this.commandBuffer.trim().toLowerCase();
|
|
139
|
+
const isPT = this.language === 'pt-br';
|
|
140
|
+
this.actionStatus = isPT ? `Processando ${cmd}...` : `Processing ${cmd}...`;
|
|
141
|
+
this.render();
|
|
142
|
+
switch (cmd) {
|
|
143
|
+
case '/details':
|
|
144
|
+
this.showDetails = !this.showDetails;
|
|
145
|
+
this.actionStatus = null;
|
|
146
|
+
break;
|
|
147
|
+
case '/logs':
|
|
148
|
+
this.activeView = 'logs';
|
|
149
|
+
this.actionStatus = null;
|
|
150
|
+
break;
|
|
151
|
+
case '/agents':
|
|
152
|
+
this.activeView = 'agents';
|
|
153
|
+
this.actionStatus = null;
|
|
154
|
+
break;
|
|
155
|
+
case '/help':
|
|
156
|
+
this.activeView = 'help';
|
|
157
|
+
this.actionStatus = null;
|
|
158
|
+
break;
|
|
159
|
+
case '/map':
|
|
160
|
+
await this.scaffolder.generateMap();
|
|
161
|
+
this.actionStatus = isPT ? 'MAPA ATUALIZADO ✅' : 'MAP UPDATED ✅';
|
|
162
|
+
break;
|
|
163
|
+
case '/sync':
|
|
164
|
+
await this.scaffolder.createSymlinks();
|
|
165
|
+
this.actionStatus = isPT ? 'LINKS SINCRONIZADOS ✅' : 'LINKS SYNCED ✅';
|
|
166
|
+
break;
|
|
167
|
+
case '/init':
|
|
168
|
+
await this.scaffolder.init();
|
|
169
|
+
this.actionStatus = isPT ? 'CONTEXTO ATUALIZADO ✅' : 'CONTEXT UPDATED ✅';
|
|
170
|
+
break;
|
|
171
|
+
case '/exit':
|
|
172
|
+
case '/quit':
|
|
173
|
+
this.stop();
|
|
174
|
+
return;
|
|
175
|
+
case '/clear':
|
|
176
|
+
this.actionStatus = null;
|
|
177
|
+
this.render();
|
|
178
|
+
break;
|
|
179
|
+
default:
|
|
180
|
+
this.actionStatus = isPT ? 'Comando desconhecido' : 'Unknown command';
|
|
181
|
+
}
|
|
182
|
+
this.commandBuffer = '';
|
|
183
|
+
setTimeout(() => {
|
|
184
|
+
this.actionStatus = null;
|
|
185
|
+
this.render();
|
|
186
|
+
}, 2000);
|
|
187
|
+
}
|
|
188
|
+
stop() {
|
|
189
|
+
this.isRunning = false;
|
|
190
|
+
process.stdout.write('\x1b[?1049l');
|
|
191
|
+
process.exit(0);
|
|
192
|
+
}
|
|
193
|
+
async render() {
|
|
194
|
+
try {
|
|
195
|
+
const content = await fs.readFile(this.logPath, 'utf-8');
|
|
196
|
+
const stats = this.parseStats(content);
|
|
197
|
+
const logs = this.parseLogs(content, 10);
|
|
198
|
+
const isPT = this.language === 'pt-br';
|
|
199
|
+
clear();
|
|
200
|
+
// 1. BRANDING LOGO (v1.1.0)
|
|
201
|
+
const logo = `
|
|
202
|
+
${chalk.white(' ██████╗ ██████╗ █████╗ ██╗ ██╗ █████╗ ██████╗ ███████╗')}
|
|
203
|
+
${chalk.gray('██╔════╝ ██╔════╝ ██╔══██╗██║ ██║ ██╔══██╗██╔══██╗██╔════╝')}
|
|
204
|
+
${chalk.white('██║ ███╗██║ ███╗ ███████║██║ ██║ ███████║██████╔╝███████╗')}
|
|
205
|
+
${chalk.gray('██║ ██║██║ ██║ ██╔══██║██║ ██║ ██╔══██║██╔══██╗╚════██║')}
|
|
206
|
+
${chalk.white('╚██████╔╝╚██████╔╝██╗██║ ██║██║ ███████╗██║ ██║██████╔╝███████║')}
|
|
207
|
+
${chalk.gray(' ╚═════╝ ╚═════╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝')}
|
|
208
|
+
`;
|
|
209
|
+
process.stdout.write(logo + '\n');
|
|
210
|
+
// 2. ZENITH STATUS
|
|
211
|
+
process.stdout.write(` ${chalk.magenta('Protocol')} ${chalk.white.bold('v1.1.0')} ${chalk.gray('| Universal Context Hub')}\n\n`);
|
|
212
|
+
// 3. UNIVERSAL SYNC STATUS
|
|
213
|
+
const syncStatus = await this.getUniversalSyncStatus();
|
|
214
|
+
const syncLine = `${chalk.blue('◈')} ${chalk.gray('Cursor:')} ${syncStatus.cursor ? chalk.green('●') : chalk.red('○')} ` +
|
|
215
|
+
`${chalk.cyan('◈')} ${chalk.gray('Gemini:')} ${syncStatus.gemini ? chalk.green('●') : chalk.red('○')} ` +
|
|
216
|
+
`${chalk.white('◈')} ${chalk.gray('Windsurf:')} ${syncStatus.windsurf ? chalk.green('●') : chalk.red('○')} ` +
|
|
217
|
+
`${chalk.gray('◈')} ${chalk.gray('Codex:')} ${syncStatus.codex ? chalk.green('●') : chalk.red('○')}`;
|
|
218
|
+
process.stdout.write(` ${syncLine}\n`);
|
|
219
|
+
// 4. FINOPS METRICS
|
|
220
|
+
if (this.showDetails) {
|
|
221
|
+
const skillsCount = await this.getSkillsCount();
|
|
222
|
+
const metrics = `${chalk.gray(isPT ? 'TEMPO:' : 'TIME:')} ${chalk.white(stats.time)} ` +
|
|
223
|
+
`${chalk.gray(isPT ? 'CUSTO:' : 'COST:')} ${chalk.white(stats.cost)} ` +
|
|
224
|
+
`${chalk.gray(isPT ? 'SKILLS:' : 'SKILLS:')} ${chalk.white(skillsCount.toString())}`;
|
|
225
|
+
process.stdout.write(` ${chalk.cyan('┏')} ${metrics}\n`);
|
|
226
|
+
}
|
|
227
|
+
// 5. ACTION STATUS
|
|
228
|
+
if (this.actionStatus) {
|
|
229
|
+
process.stdout.write(` ${chalk.yellow('⚡')} ${chalk.white.bold(this.actionStatus)}\n`);
|
|
230
|
+
}
|
|
231
|
+
else if (!this.showDetails) {
|
|
232
|
+
process.stdout.write('\n');
|
|
233
|
+
}
|
|
234
|
+
// 6. CENTRAL INPUT BOX
|
|
235
|
+
const hint = isPT ? 'Use /help para lista de comandos...' : 'Use /help for command list...';
|
|
236
|
+
const displayPrompt = this.commandBuffer
|
|
237
|
+
? `${this.commandBuffer}${chalk.white('█')}`
|
|
238
|
+
: chalk.gray(hint);
|
|
239
|
+
const promptContent = `${displayPrompt}\n` +
|
|
240
|
+
`${chalk.magenta('v' + this.version)} ${chalk.white.bold(this.projectName)} ${chalk.gray('Agnostic-Ready')}`;
|
|
241
|
+
const promptBox = boxen(promptContent, {
|
|
242
|
+
padding: { top: 1, bottom: 1, left: 3, right: 3 },
|
|
243
|
+
borderColor: '#6366f1',
|
|
244
|
+
borderStyle: 'round',
|
|
245
|
+
dimBorder: false,
|
|
246
|
+
width: 84,
|
|
247
|
+
textAlignment: 'left',
|
|
248
|
+
margin: { left: 4 }
|
|
249
|
+
});
|
|
250
|
+
process.stdout.write(promptBox + '\n');
|
|
251
|
+
// 7. NAVIGATION HELPERS
|
|
252
|
+
const agentsLabel = this.activeView === 'agents' ? chalk.white.bold(isPT ? 'agentes' : 'agents') : chalk.gray(isPT ? 'agentes' : 'agents');
|
|
253
|
+
const logsLabel = this.activeView === 'logs' ? chalk.white.bold(isPT ? 'logs' : 'logs') : chalk.gray(isPT ? 'logs' : 'logs');
|
|
254
|
+
const helpLabel = this.activeView === 'help' ? chalk.white.bold(isPT ? 'ajuda' : 'help') : chalk.gray(isPT ? 'ajuda' : 'help');
|
|
255
|
+
process.stdout.write(chalk.gray(`\n ${' '.repeat(30)} tab ${chalk.white('cycle')} ctrl+l ${chalk.white('clear')} q ${chalk.white(isPT ? 'sair' : 'exit')}\n`));
|
|
256
|
+
process.stdout.write(chalk.gray(` ${' '.repeat(34)} [ ${logsLabel} ] [ ${agentsLabel} ] [ ${helpLabel} ]\n\n`));
|
|
257
|
+
// 8. VIEW CONTENT
|
|
258
|
+
if (this.activeView === 'logs') {
|
|
259
|
+
const cyclesStr = isPT ? 'ÚLTIMOS CICLOS' : 'LATEST CYCLES';
|
|
260
|
+
process.stdout.write(chalk.gray(` ${chalk.bold(cyclesStr)}\n`));
|
|
261
|
+
logs.slice(0, 5).forEach(l => {
|
|
262
|
+
process.stdout.write(` ${chalk.magenta('→')} ${chalk.gray(l.date)} ${chalk.white(l.agent)}: ${chalk.gray(l.action.substring(0, 50))}\n`);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
else if (this.activeView === 'agents') {
|
|
266
|
+
const agentsHeader = isPT ? 'AGENTES ATIVOS' : 'ACTIVE AGENTS';
|
|
267
|
+
process.stdout.write(chalk.gray(` ${chalk.bold(agentsHeader)}\n`));
|
|
268
|
+
this.agentsList.forEach(agent => {
|
|
269
|
+
process.stdout.write(` ${chalk.magenta('●')} ${chalk.white(agent)}\n`);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
const helpHeader = isPT ? 'CENTRAL DE COMANDOS ZENITH' : 'ZENITH COMMAND HUB';
|
|
274
|
+
process.stdout.write(chalk.gray(` ${chalk.bold(helpHeader)}\n`));
|
|
275
|
+
process.stdout.write(` ${chalk.cyan('/sync')} ${isPT ? 'Sincroniza Contexto (Gemini, Windsurf, Codex, Cursor)' : 'Sync Context (Gemini, Windsurf, Codex, Cursor)'}\n`);
|
|
276
|
+
process.stdout.write(` ${chalk.cyan('/map')} ${isPT ? 'Atualiza Mapa de Projeto (Soberania)' : 'Update Project Map (Sovereignty)'}\n`);
|
|
277
|
+
process.stdout.write(` ${chalk.cyan('/init')} ${isPT ? 'Re-alimenta o Contexto via Scaffolder' : 'Re-feed Context via Scaffolder'}\n`);
|
|
278
|
+
process.stdout.write(` ${chalk.cyan('/worktree')} ${isPT ? 'Cria Worktree isolado para tarefas' : 'Create isolated Worktree for tasks'}\n`);
|
|
279
|
+
process.stdout.write(` ${chalk.cyan('/details')} ${isPT ? 'Liga/Desliga Métricas Zenith/FinOps' : 'Toggle Zenith/FinOps metrics'}\n`);
|
|
280
|
+
process.stdout.write(` ${chalk.cyan('/help')} ${isPT ? 'Mostra esta ajuda' : 'Show this help menu'}\n`);
|
|
281
|
+
process.stdout.write(` ${chalk.gray('\n Dica: Use ')}${chalk.cyan('ggai init')}${chalk.gray(' para profunda orquestração interativa.')}\n`);
|
|
282
|
+
}
|
|
283
|
+
// 9. FOOTER
|
|
284
|
+
const width = process.stdout.columns || 80;
|
|
285
|
+
const cwd = process.cwd();
|
|
286
|
+
const verStr = `Zenith Protocol v1.1.0`;
|
|
287
|
+
const padding = width - cwd.length - verStr.length - 8;
|
|
288
|
+
process.stdout.write('\n'.repeat(Math.max(0, (process.stdout.rows || 25) - 25)));
|
|
289
|
+
process.stdout.write(chalk.gray(`\n ${cwd}${' '.repeat(Math.max(0, padding))}${verStr} \n`));
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
console.error('Render error:', error);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
async getUniversalSyncStatus() {
|
|
296
|
+
return {
|
|
297
|
+
cursor: await fs.pathExists(path.join(process.cwd(), '.cursor/rules/agent-handoff.md')),
|
|
298
|
+
gemini: await fs.pathExists(path.join(process.cwd(), '.gemini/GEMINI.md')),
|
|
299
|
+
windsurf: await fs.pathExists(path.join(process.cwd(), '.windsurf/AGENTS.md')),
|
|
300
|
+
codex: await fs.pathExists(path.join(process.cwd(), '.codex/AGENTS.md'))
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
async getSkillsCount() {
|
|
304
|
+
try {
|
|
305
|
+
const skillsDir = path.join(process.cwd(), '.agent/skills');
|
|
306
|
+
if (await fs.pathExists(skillsDir)) {
|
|
307
|
+
// Contagem recursiva de arquivos SKILL.md (v1.1.0 / Antigravity Style)
|
|
308
|
+
const files = await fs.readdir(skillsDir, { recursive: true });
|
|
309
|
+
return files.filter(f => f.endsWith('SKILL.md')).length;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (e) { }
|
|
313
|
+
return 0;
|
|
314
|
+
}
|
|
315
|
+
parseStats(content) {
|
|
316
|
+
const timeMatch = content.match(/Execution Time \(IA\)\*\* \| (.*?) \|/) ||
|
|
317
|
+
content.match(/Tempo de Execução \(IA\)\*\* \| (.*?) \|/);
|
|
318
|
+
const costMatch = content.match(/Cumulative Cost\*\* \| (.*?) \|/) ||
|
|
319
|
+
content.match(/Custo Acumulado\*\* \| (.*?) \|/);
|
|
320
|
+
const tasksMatch = content.match(/Tasks Completed\*\* \| (.*?) \|/) ||
|
|
321
|
+
content.match(/Tarefas Concluídas\*\* \| (.*?) \|/);
|
|
322
|
+
return {
|
|
323
|
+
time: timeMatch ? timeMatch[1].trim() : '00h 00m',
|
|
324
|
+
cost: costMatch ? costMatch[1].trim() : '$0.00',
|
|
325
|
+
tasks: tasksMatch ? parseInt(tasksMatch[1].trim()) : 0
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
parseLogs(content, limit) {
|
|
329
|
+
const rows = content.split('\n').filter(line => line.startsWith('| 202'));
|
|
330
|
+
const logs = rows.map(row => {
|
|
331
|
+
const parts = row.split('|').map(p => p.trim()).filter(p => p !== '');
|
|
332
|
+
return {
|
|
333
|
+
date: parts[0],
|
|
334
|
+
agent: parts[1],
|
|
335
|
+
action: parts[2],
|
|
336
|
+
duration: parts[3],
|
|
337
|
+
cost: parts[4]
|
|
338
|
+
};
|
|
339
|
+
});
|
|
340
|
+
return logs.reverse().slice(0, limit);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { glob } from 'glob';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
export class Scaffolder {
|
|
6
|
+
config;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
async init() {
|
|
11
|
+
const contextDir = path.resolve(process.cwd(), this.config.output);
|
|
12
|
+
const subDirs = ['docs', 'agents', 'skills', 'plans', 'workflow', 'docs/standards'];
|
|
13
|
+
// 1. Criar estrutura de diretórios estrita (v1.1.0)
|
|
14
|
+
for (const dir of subDirs) {
|
|
15
|
+
await fs.ensureDir(path.join(contextDir, dir));
|
|
16
|
+
}
|
|
17
|
+
// 2. Injetar Playbooks e Standards Padrão
|
|
18
|
+
await this.injectTemplates(contextDir);
|
|
19
|
+
// 3. Gerar Mapa Inicial Automatizado (v1.1.0 Context Sovereignty)
|
|
20
|
+
await this.generateMap();
|
|
21
|
+
// 4. Executar Lógica de Descoberta Interativa se necessário
|
|
22
|
+
if (this.config.mode === 'discovery') {
|
|
23
|
+
await this.runZenithDiscovery(contextDir);
|
|
24
|
+
}
|
|
25
|
+
// 5. Criar README na raiz (Zenith Protocol v1.1.0)
|
|
26
|
+
await this.createRootReadme();
|
|
27
|
+
// 6. Criar Symlinks para IDE se disponíveis
|
|
28
|
+
await this.createSymlinks();
|
|
29
|
+
}
|
|
30
|
+
async generateMap() {
|
|
31
|
+
const contextDir = path.resolve(process.cwd(), this.config.output);
|
|
32
|
+
const mapPath = path.join(contextDir, 'docs/PROJECT_MAP.md');
|
|
33
|
+
// Scan ignore list (v1.1.0)
|
|
34
|
+
const ignore = [
|
|
35
|
+
'node_modules', 'dist', '.git', '.next', '.context',
|
|
36
|
+
'package-lock.json', '.cursor', 'tmp', 'build',
|
|
37
|
+
'**/*.log', '**/*.tmp'
|
|
38
|
+
];
|
|
39
|
+
try {
|
|
40
|
+
const files = await glob('**/*', {
|
|
41
|
+
nodir: false,
|
|
42
|
+
ignore: ignore.map(i => `**/${i}/**`),
|
|
43
|
+
cwd: process.cwd()
|
|
44
|
+
});
|
|
45
|
+
// Template v1.1.0 para PROJECT_MAP
|
|
46
|
+
let mapContent = `# 🗺 Genesis Grid Project Map (v1.1.0)\n\n`;
|
|
47
|
+
mapContent += `Generated on: ${new Date().toISOString()}\n\n`;
|
|
48
|
+
mapContent += `## 🏗 Domain Architecture (Scaffolded)\n\n`;
|
|
49
|
+
// Build a structured tree
|
|
50
|
+
files.sort().forEach(file => {
|
|
51
|
+
const parts = file.split('/');
|
|
52
|
+
const depth = parts.length - 1;
|
|
53
|
+
const indent = ' '.repeat(depth);
|
|
54
|
+
mapContent += `${indent}- ${parts[parts.length - 1]}\n`;
|
|
55
|
+
});
|
|
56
|
+
mapContent += `\n---\n*Genesis Grid AI Labs - Engineering Excellence.*`;
|
|
57
|
+
await fs.writeFile(mapPath, mapContent);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error('Error generating map:', error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async createSymlinks() {
|
|
64
|
+
const contextDir = this.config.output;
|
|
65
|
+
const engines = this.config.targetEngines || ['antigravity', 'cursor', 'windsurf', 'codex', 'claude'];
|
|
66
|
+
// 1. Definição de Sincronização Agmóstica (v1.1.0)
|
|
67
|
+
const handoffSource = 'docs/AGENT_HANDOFF_PROMPT.md';
|
|
68
|
+
const methodSource = 'docs/GG_METHODOLOGY.md';
|
|
69
|
+
const dsSource = 'docs/GENESIS_DESIGN_SYSTEM.md';
|
|
70
|
+
const syncMap = [];
|
|
71
|
+
if (engines.includes('cursor')) {
|
|
72
|
+
syncMap.push({ src: methodSource, dest: '.cursor/rules/methodology.md' }, { src: dsSource, dest: '.cursor/rules/design-system.md' }, { src: handoffSource, dest: '.cursor/rules/agent-handoff.md' });
|
|
73
|
+
}
|
|
74
|
+
if (engines.includes('antigravity')) {
|
|
75
|
+
syncMap.push({ src: handoffSource, dest: '.gemini/GEMINI.md' });
|
|
76
|
+
}
|
|
77
|
+
if (engines.includes('windsurf')) {
|
|
78
|
+
syncMap.push({ src: handoffSource, dest: '.windsurf/AGENTS.md' });
|
|
79
|
+
}
|
|
80
|
+
if (engines.includes('codex')) {
|
|
81
|
+
syncMap.push({ src: handoffSource, dest: '.codex/AGENTS.md' });
|
|
82
|
+
}
|
|
83
|
+
if (engines.includes('claude')) {
|
|
84
|
+
syncMap.push({ src: handoffSource, dest: '.claude/AGENTS.md' });
|
|
85
|
+
}
|
|
86
|
+
for (const item of syncMap) {
|
|
87
|
+
const srcPath = path.resolve(process.cwd(), contextDir, item.src);
|
|
88
|
+
const destPath = path.resolve(process.cwd(), item.dest);
|
|
89
|
+
try {
|
|
90
|
+
if (await fs.pathExists(srcPath)) {
|
|
91
|
+
await fs.ensureDir(path.dirname(destPath));
|
|
92
|
+
await fs.copy(srcPath, destPath, { overwrite: true });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (e) { }
|
|
96
|
+
}
|
|
97
|
+
// 2. Mapeamento Universal de Skills (agentskills.io)
|
|
98
|
+
const skillsSrc = path.resolve(process.cwd(), contextDir, 'skills');
|
|
99
|
+
const skillDests = [];
|
|
100
|
+
if (engines.includes('antigravity'))
|
|
101
|
+
skillDests.push('.agent/skills');
|
|
102
|
+
if (engines.includes('codex'))
|
|
103
|
+
skillDests.push('.codex/skills');
|
|
104
|
+
if (engines.includes('windsurf'))
|
|
105
|
+
skillDests.push('.windsurf/skills');
|
|
106
|
+
if (engines.includes('cursor'))
|
|
107
|
+
skillDests.push('.cursor/skills');
|
|
108
|
+
if (engines.includes('claude'))
|
|
109
|
+
skillDests.push('.claude/skills');
|
|
110
|
+
if (await fs.pathExists(skillsSrc)) {
|
|
111
|
+
for (const dest of skillDests) {
|
|
112
|
+
try {
|
|
113
|
+
const destPath = path.resolve(process.cwd(), dest);
|
|
114
|
+
await fs.ensureDir(destPath);
|
|
115
|
+
await fs.copy(skillsSrc, destPath, { overwrite: true });
|
|
116
|
+
}
|
|
117
|
+
catch (e) { }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async createRootReadme() {
|
|
122
|
+
const isPT = this.config.language === 'pt-br';
|
|
123
|
+
const content = isPT
|
|
124
|
+
? `# 💎 ${this.config.projectName} (v1.1.0)\n\nProjeto orquestrado pelo **Genesis Grid Framework** sob o rigor do **Protocolo v1.1.0**.\n\nAcesse o diretório oculto \`.context/\` para ver a inteligência e soberania do projeto.\n\n### ⌨️ Comandos Rápidos\n- \`ggai monitor\`: Hub de Contexto & Saúde`
|
|
125
|
+
: `# 💎 ${this.config.projectName} (v1.1.0)\n\nProject orchestrated by **Genesis Grid Framework** under the rigor of **Zenith Protocol v1.1.0**.\n\nAccess the hidden \`.context/\` directory to see the project's intelligence and sovereignty.\n\n### ⌨️ Quick Commands\n- \`ggai monitor\`: Context Hub & Health`;
|
|
126
|
+
await fs.writeFile(path.join(process.cwd(), 'README.md'), content);
|
|
127
|
+
}
|
|
128
|
+
async injectTemplates(contextDir) {
|
|
129
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
130
|
+
const __dirname = path.dirname(__filename);
|
|
131
|
+
const baseContext = path.resolve(__dirname, '..', '.context');
|
|
132
|
+
const sourceContext = path.join(baseContext, this.config.language);
|
|
133
|
+
// 1. Copiar pastas base e específicas
|
|
134
|
+
const dirsToCopy = ['agents', 'docs', 'skills', 'plans', 'workflow'];
|
|
135
|
+
for (const dir of dirsToCopy) {
|
|
136
|
+
const srcDir = path.join(sourceContext, dir);
|
|
137
|
+
const baseSrcDir = path.join(baseContext, dir);
|
|
138
|
+
const destDir = path.join(contextDir, dir);
|
|
139
|
+
// Tentar do idioma primeiro, depois do base
|
|
140
|
+
if (await fs.pathExists(srcDir)) {
|
|
141
|
+
await fs.copy(srcDir, destDir, { overwrite: true });
|
|
142
|
+
}
|
|
143
|
+
else if (await fs.pathExists(baseSrcDir)) {
|
|
144
|
+
await fs.copy(baseSrcDir, destDir, { overwrite: true });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// Gerar README do Contexto baseando-se no idioma (v1.1.0)
|
|
148
|
+
const isPT = this.config.language === 'pt-br';
|
|
149
|
+
const readmeContent = isPT
|
|
150
|
+
? `# Genesis Grid AI Labs - GG-Methodology (v1.1.0)\n\nEste diretório contém o cérebro operacional da **Genesis Grid AI Labs** para o projeto **${this.config.projectName}**, operando sob o rigor do **Protocolo v1.1.0**.\n\n### 🛠 Configuração de UI\n**Modo Selecionado:** ${this.config.uiMode.toUpperCase()}\n${this.config.uiMode === 'core' ? '_Este projeto utiliza apenas a metodologia de contexto, sem dependência mandatória do Genesis Design System._' : '_Este projeto segue as diretrizes do Genesis Design System._'}\n\n### 🔗 Portabilidade & Sincronização
|
|
151
|
+
Para sincronizar este contexto com sua IDE, utilize links simbólicos ou o comando hub:
|
|
152
|
+
\`\`\`bash
|
|
153
|
+
ggai monitor
|
|
154
|
+
\`\`\`
|
|
155
|
+
\n\n---\n**Framework Base:** ${this.config.framework}\n**Founder:** Guilherme Giorgi (GG)\n**Strategy:** ${this.config.mode === 'bootstrap' ? 'Bootstrap Engine' : 'Discovery Engine'}\n**Motto:** Engineering Excellence. Visual Perfection. Zero Defects.`
|
|
156
|
+
: `# Genesis Grid AI Labs - GG-Methodology (v1.1.0)\n\nThis directory contains the operational brain of **Genesis Grid AI Labs** for the **${this.config.projectName}** project, operating under the rigor of **Zenith Protocol v1.1.0**.\n\n### 🛠 UI Configuration\n**Selected Mode:** ${this.config.uiMode.toUpperCase()}\n${this.config.uiMode === 'core' ? '_This project uses only the context methodology, without mandatory dependency on the Genesis Design System._' : '_This project follows the Genesis Design System guidelines._'}\n\n### 🔗 Portability & Synchronization\nTo synchronize this context with your IDE, use symbolic links or the command hub:\n\`\`\`bash\nggai monitor\n\`\`\`\n\n---\n**Base Framework:** ${this.config.framework}\n**Founder:** Guilherme Giorgi (GG)\n**Strategy:** ${this.config.mode === 'bootstrap' ? 'Bootstrap Engine' : 'Discovery Engine'}\n**Motto:** Engineering Excellence. Visual Perfection. Zero Defects.`;
|
|
157
|
+
await fs.writeFile(path.join(contextDir, 'README.md'), readmeContent);
|
|
158
|
+
}
|
|
159
|
+
async runZenithDiscovery(contextDir) {
|
|
160
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
161
|
+
const __dirname = path.dirname(__filename);
|
|
162
|
+
const baseContext = path.resolve(__dirname, '..', '.context');
|
|
163
|
+
const sourceContext = path.join(baseContext, this.config.language);
|
|
164
|
+
const sourceMap = path.join(sourceContext, 'docs/PROJECT_MAP.md');
|
|
165
|
+
const sourceLog = path.join(sourceContext, 'docs/OPERATIONS_LOG.md');
|
|
166
|
+
const sourceHandoff = path.join(sourceContext, 'docs/AGENT_HANDOFF_PROMPT.md');
|
|
167
|
+
if (await fs.pathExists(sourceMap)) {
|
|
168
|
+
await fs.copy(sourceMap, path.join(contextDir, 'docs/PROJECT_MAP.md'), { overwrite: false });
|
|
169
|
+
}
|
|
170
|
+
if (await fs.pathExists(sourceLog)) {
|
|
171
|
+
await fs.copy(sourceLog, path.join(contextDir, 'docs/OPERATIONS_LOG.md'), { overwrite: false });
|
|
172
|
+
}
|
|
173
|
+
if (await fs.pathExists(sourceHandoff)) {
|
|
174
|
+
await fs.copy(sourceHandoff, path.join(contextDir, 'docs/AGENT_HANDOFF_PROMPT.md'), { overwrite: false });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
package/package.json
CHANGED
|
@@ -1,76 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggailabs/cli-context",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Genesis Grid AI Framework CLI - The ultimate context & project generator",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"ggai": "dist/index.js"
|
|
8
8
|
},
|
|
9
|
+
"type": "module",
|
|
9
10
|
"files": [
|
|
10
|
-
"dist
|
|
11
|
-
"README.md"
|
|
12
|
-
"LICENSE",
|
|
13
|
-
"prompts/**/*"
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
14
13
|
],
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": ">=20.0.0"
|
|
17
|
-
},
|
|
18
14
|
"scripts": {
|
|
19
|
-
"build": "tsc",
|
|
15
|
+
"build": "tsc && rm -rf dist/.context && cp -r ../.context dist/.context && rm -rf dist/.context/docs/_archives",
|
|
20
16
|
"dev": "tsx src/index.ts",
|
|
21
|
-
"start": "node dist/index.js"
|
|
22
|
-
"test": "jest",
|
|
23
|
-
"prepublishOnly": "npm run build",
|
|
24
|
-
"version": "npm run build",
|
|
25
|
-
"release": "npm version patch && npm publish --access public",
|
|
26
|
-
"release:minor": "npm version minor && npm publish --access public",
|
|
27
|
-
"release:major": "npm version major && npm publish --access public"
|
|
28
|
-
},
|
|
29
|
-
"publishConfig": {
|
|
30
|
-
"access": "public",
|
|
31
|
-
"registry": "https://registry.npmjs.org/"
|
|
32
|
-
},
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/ggailabs/ggailabs-cli-context.git"
|
|
17
|
+
"start": "node dist/index.js"
|
|
36
18
|
},
|
|
37
|
-
"homepage": "https://github.com/ggailabs/ggailabs-cli-context#readme",
|
|
38
|
-
"bugs": {
|
|
39
|
-
"url": "https://github.com/ggailabs/ggailabs-cli-context/issues"
|
|
40
|
-
},
|
|
41
|
-
"keywords": [
|
|
42
|
-
"cli",
|
|
43
|
-
"documentation",
|
|
44
|
-
"agents",
|
|
45
|
-
"scaffold"
|
|
46
|
-
],
|
|
47
|
-
"author": "",
|
|
48
|
-
"license": "MIT",
|
|
49
19
|
"dependencies": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"chalk": "^4.1.2",
|
|
53
|
-
"cli-progress": "^3.12.0",
|
|
20
|
+
"boxen": "^8.0.0",
|
|
21
|
+
"chalk": "^5.4.1",
|
|
54
22
|
"commander": "^14.0.1",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"fs-extra": "^11.3.2",
|
|
58
|
-
"glob": "^10.4.5",
|
|
23
|
+
"fs-extra": "^11.3.0",
|
|
24
|
+
"glob": "^11.0.1",
|
|
59
25
|
"inquirer": "^12.6.3",
|
|
60
|
-
"ora": "^
|
|
61
|
-
"semver": "^7.6.3"
|
|
26
|
+
"ora": "^8.0.0"
|
|
62
27
|
},
|
|
63
28
|
"devDependencies": {
|
|
64
|
-
"@ggailabs/cli-context": "^0.5.0",
|
|
65
|
-
"@types/cli-progress": "^3.11.0",
|
|
66
29
|
"@types/fs-extra": "^11.0.4",
|
|
67
|
-
"@types/inquirer": "^9.0.8",
|
|
68
|
-
"@types/jest": "^30.0.0",
|
|
69
30
|
"@types/node": "^24.5.2",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"ts-jest": "^29.4.4",
|
|
73
|
-
"tsx": "^4.20.6",
|
|
74
|
-
"typescript": "^5.9.2"
|
|
31
|
+
"tsx": "^4.19.2",
|
|
32
|
+
"typescript": "^5.7.3"
|
|
75
33
|
}
|
|
76
|
-
}
|
|
34
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 AI Coders
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentConfig.d.ts","sourceRoot":"","sources":["../../../src/generators/agents/agentConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CA2F9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAmF5D,CAAC"}
|