@ggailabs/cli-context 0.5.5 → 1.0.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.
Potentially problematic release.
This version of @ggailabs/cli-context might be problematic. Click here for more details.
- package/dist/.context/docs/GENESIS_SYSTEM_PROMPT.md +62 -0
- package/dist/.context/eng/agents/architect.md +15 -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_reviewer.md +313 -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/qa_specialist.md +1234 -0
- package/dist/.context/eng/agents/security_reviewer.md +382 -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 +15 -0
- package/dist/.context/eng/docs/GG_METHODOLOGY.md +48 -0
- package/dist/.context/eng/docs/OPERATIONS_LOG.md +30 -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.md +18 -0
- package/dist/.context/eng/skills/brainstorming.md +227 -0
- package/dist/.context/eng/skills/exploring_codebase.md +1217 -0
- package/dist/.context/eng/skills/patterns/compliance_check.md +246 -0
- package/dist/.context/eng/skills/patterns/coverage_table.md +401 -0
- package/dist/.context/eng/skills/patterns/exit_criteria.md +31 -0
- package/dist/.context/eng/skills/patterns/failure_recovery.md +74 -0
- package/dist/.context/eng/skills/patterns/quality_gate.md +295 -0
- package/dist/.context/eng/skills/patterns/standards_workflow.md +391 -0
- package/dist/.context/eng/skills/patterns/state_tracking.md +30 -0
- package/dist/.context/eng/skills/patterns/task_tracking.md +38 -0
- package/dist/.context/eng/skills/previce.md +45 -0
- package/dist/.context/eng/skills/tdd.md +421 -0
- package/dist/.context/eng/skills/writing_plans.md +105 -0
- package/dist/.context/plans/.gitkeep +0 -0
- package/dist/.context/pt-br/agents/architect.md +69 -0
- package/dist/.context/pt-br/agents/backend_typescript.md +1000 -0
- package/dist/.context/pt-br/agents/bug_hunter.md +49 -0
- package/dist/.context/pt-br/agents/code_reviewer.md +313 -0
- package/dist/.context/pt-br/agents/devops_specialist.md +718 -0
- package/dist/.context/pt-br/agents/frontend_specialist.md +1027 -0
- package/dist/.context/pt-br/agents/qa_specialist.md +1234 -0
- package/dist/.context/pt-br/agents/security_reviewer.md +382 -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 +30 -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.md +36 -0
- package/dist/.context/pt-br/skills/brainstorming.md +227 -0
- package/dist/.context/pt-br/skills/exploring_codebase.md +1217 -0
- package/dist/.context/pt-br/skills/patterns/compliance_check.md +246 -0
- package/dist/.context/pt-br/skills/patterns/coverage_table.md +401 -0
- package/dist/.context/pt-br/skills/patterns/exit_criteria.md +31 -0
- package/dist/.context/pt-br/skills/patterns/failure_recovery.md +74 -0
- package/dist/.context/pt-br/skills/patterns/quality_gate.md +295 -0
- package/dist/.context/pt-br/skills/patterns/standards_workflow.md +391 -0
- package/dist/.context/pt-br/skills/patterns/state_tracking.md +30 -0
- package/dist/.context/pt-br/skills/patterns/task_tracking.md +38 -0
- package/dist/.context/pt-br/skills/previce.md +45 -0
- package/dist/.context/pt-br/skills/tdd.md +421 -0
- package/dist/.context/pt-br/skills/writing_plans.md +105 -0
- package/dist/.context/workflow/.gitkeep +0 -0
- package/dist/commands/init.js +140 -0
- package/dist/commands/monitor.js +34 -0
- package/dist/index.js +20 -568
- package/dist/services/monitor-service.js +340 -0
- package/dist/services/scaffolder.js +164 -0
- package/package.json +16 -58
- package/LICENSE +0 -21
- package/README.md +0 -197
- 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,340 @@
|
|
|
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 (Zenith v6.1)
|
|
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('Zenith v6.1')} ${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('/details')} ${isPT ? 'Liga/Desliga Métricas Zenith/FinOps' : 'Toggle Zenith/FinOps metrics'}\n`);
|
|
279
|
+
process.stdout.write(` ${chalk.cyan('/help')} ${isPT ? 'Mostra esta ajuda' : 'Show this help menu'}\n`);
|
|
280
|
+
process.stdout.write(` ${chalk.gray('\n Dica: Use ')}${chalk.cyan('ggai init')}${chalk.gray(' para profunda orquestração interativa.')}\n`);
|
|
281
|
+
}
|
|
282
|
+
// 9. FOOTER
|
|
283
|
+
const width = process.stdout.columns || 80;
|
|
284
|
+
const cwd = process.cwd();
|
|
285
|
+
const verStr = `Zenith Protocol v6.1`;
|
|
286
|
+
const padding = width - cwd.length - verStr.length - 8;
|
|
287
|
+
process.stdout.write('\n'.repeat(Math.max(0, (process.stdout.rows || 25) - 25)));
|
|
288
|
+
process.stdout.write(chalk.gray(`\n ${cwd}${' '.repeat(Math.max(0, padding))}${verStr} \n`));
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
console.error('Render error:', error);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async getUniversalSyncStatus() {
|
|
295
|
+
return {
|
|
296
|
+
cursor: await fs.pathExists(path.join(process.cwd(), '.cursor/rules/agent-handoff.md')),
|
|
297
|
+
gemini: await fs.pathExists(path.join(process.cwd(), '.gemini/GEMINI.md')),
|
|
298
|
+
windsurf: await fs.pathExists(path.join(process.cwd(), '.windsurf/AGENTS.md')),
|
|
299
|
+
codex: await fs.pathExists(path.join(process.cwd(), '.codex/AGENTS.md'))
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
async getSkillsCount() {
|
|
303
|
+
try {
|
|
304
|
+
const skillsDir = path.join(process.cwd(), '.agent/skills');
|
|
305
|
+
if (await fs.pathExists(skillsDir)) {
|
|
306
|
+
const files = await fs.readdir(skillsDir);
|
|
307
|
+
return files.filter(f => f.endsWith('.md')).length;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
catch (e) { }
|
|
311
|
+
return 0;
|
|
312
|
+
}
|
|
313
|
+
parseStats(content) {
|
|
314
|
+
const timeMatch = content.match(/Execution Time \(IA\)\*\* \| (.*?) \|/) ||
|
|
315
|
+
content.match(/Tempo de Execução \(IA\)\*\* \| (.*?) \|/);
|
|
316
|
+
const costMatch = content.match(/Cumulative Cost\*\* \| (.*?) \|/) ||
|
|
317
|
+
content.match(/Custo Acumulado\*\* \| (.*?) \|/);
|
|
318
|
+
const tasksMatch = content.match(/Tasks Completed\*\* \| (.*?) \|/) ||
|
|
319
|
+
content.match(/Tarefas Concluídas\*\* \| (.*?) \|/);
|
|
320
|
+
return {
|
|
321
|
+
time: timeMatch ? timeMatch[1].trim() : '00h 00m',
|
|
322
|
+
cost: costMatch ? costMatch[1].trim() : '$0.00',
|
|
323
|
+
tasks: tasksMatch ? parseInt(tasksMatch[1].trim()) : 0
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
parseLogs(content, limit) {
|
|
327
|
+
const rows = content.split('\n').filter(line => line.startsWith('| 202'));
|
|
328
|
+
const logs = rows.map(row => {
|
|
329
|
+
const parts = row.split('|').map(p => p.trim()).filter(p => p !== '');
|
|
330
|
+
return {
|
|
331
|
+
date: parts[0],
|
|
332
|
+
agent: parts[1],
|
|
333
|
+
action: parts[2],
|
|
334
|
+
duration: parts[3],
|
|
335
|
+
cost: parts[4]
|
|
336
|
+
};
|
|
337
|
+
});
|
|
338
|
+
return logs.reverse().slice(0, limit);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
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 (Zenith v6.1)
|
|
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 (v6.1 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 v6.1)
|
|
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 (Zenith v6.1)
|
|
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 Zenith v6.1 para PROJECT_MAP
|
|
46
|
+
let mapContent = `# 🗺 Genesis Grid Project Map (Zenith v6.1)\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
|
+
// 1. Definição de Sincronização Agmóstica (Zenith v6.1)
|
|
66
|
+
const handoffSource = 'docs/AGENT_HANDOFF_PROMPT.md';
|
|
67
|
+
const methodSource = 'docs/GG_METHODOLOGY.md';
|
|
68
|
+
const dsSource = 'docs/GENESIS_DESIGN_SYSTEM.md';
|
|
69
|
+
const syncMap = [
|
|
70
|
+
// Cursor Rules
|
|
71
|
+
{ src: methodSource, dest: '.cursor/rules/methodology.md' },
|
|
72
|
+
{ src: dsSource, dest: '.cursor/rules/design-system.md' },
|
|
73
|
+
{ src: handoffSource, dest: '.cursor/rules/agent-handoff.md' },
|
|
74
|
+
// Gemini Antigravity (Rules)
|
|
75
|
+
{ src: handoffSource, dest: '.gemini/GEMINI.md' },
|
|
76
|
+
// Windsurf & Codex (Instructions)
|
|
77
|
+
{ src: handoffSource, dest: '.windsurf/AGENTS.md' },
|
|
78
|
+
{ src: handoffSource, dest: '.codex/AGENTS.md' }
|
|
79
|
+
];
|
|
80
|
+
for (const item of syncMap) {
|
|
81
|
+
const srcPath = path.resolve(process.cwd(), contextDir, item.src);
|
|
82
|
+
const destPath = path.resolve(process.cwd(), item.dest);
|
|
83
|
+
try {
|
|
84
|
+
if (await fs.pathExists(srcPath)) {
|
|
85
|
+
await fs.ensureDir(path.dirname(destPath));
|
|
86
|
+
// Copiar conteúdo para garantir leitura em todos os agentes
|
|
87
|
+
// No futuro, podemos concatenar Method e Handoff se necessário
|
|
88
|
+
await fs.copy(srcPath, destPath, { overwrite: true });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
// Ignore silent copy errors
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// 2. Mapeamento Universal de Skills (agentskills.io)
|
|
96
|
+
const skillsSrc = path.resolve(process.cwd(), contextDir, 'skills');
|
|
97
|
+
const universalSkillsDest = path.resolve(process.cwd(), '.agent/skills');
|
|
98
|
+
if (await fs.pathExists(skillsSrc)) {
|
|
99
|
+
try {
|
|
100
|
+
await fs.ensureDir(universalSkillsDest);
|
|
101
|
+
await fs.copy(skillsSrc, universalSkillsDest, { overwrite: true });
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
// Ignore error
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async createRootReadme() {
|
|
109
|
+
const isPT = this.config.language === 'pt-br';
|
|
110
|
+
const content = isPT
|
|
111
|
+
? `# 💎 ${this.config.projectName} (Zenith v6.1)\n\nProjeto orquestrado pelo **Genesis Grid Framework** sob o rigor do **Protocolo Zenith v6.1**.\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`
|
|
112
|
+
: `# 💎 ${this.config.projectName} (Zenith v6.1)\n\nProject orchestrated by **Genesis Grid Framework** under the rigor of **Zenith Protocol v6.1**.\n\nAccess the hidden \`.context/\` directory to see the project's intelligence and sovereignty.\n\n### ⌨️ Quick Commands\n- \`ggai monitor\`: Context Hub & Health`;
|
|
113
|
+
await fs.writeFile(path.join(process.cwd(), 'README.md'), content);
|
|
114
|
+
}
|
|
115
|
+
async injectTemplates(contextDir) {
|
|
116
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
117
|
+
const __dirname = path.dirname(__filename);
|
|
118
|
+
const baseContext = path.resolve(__dirname, '..', '.context');
|
|
119
|
+
const sourceContext = path.join(baseContext, this.config.language);
|
|
120
|
+
// 1. Copiar pastas base e específicas
|
|
121
|
+
const dirsToCopy = ['agents', 'docs', 'skills', 'plans', 'workflow'];
|
|
122
|
+
for (const dir of dirsToCopy) {
|
|
123
|
+
const srcDir = path.join(sourceContext, dir);
|
|
124
|
+
const baseSrcDir = path.join(baseContext, dir);
|
|
125
|
+
const destDir = path.join(contextDir, dir);
|
|
126
|
+
// Tentar do idioma primeiro, depois do base
|
|
127
|
+
if (await fs.pathExists(srcDir)) {
|
|
128
|
+
await fs.copy(srcDir, destDir, { overwrite: true });
|
|
129
|
+
}
|
|
130
|
+
else if (await fs.pathExists(baseSrcDir)) {
|
|
131
|
+
await fs.copy(baseSrcDir, destDir, { overwrite: true });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Gerar README do Contexto baseando-se no idioma (Zenith v6.1)
|
|
135
|
+
const isPT = this.config.language === 'pt-br';
|
|
136
|
+
const readmeContent = isPT
|
|
137
|
+
? `# Genesis Grid AI Labs - GG-Methodology (Zenith v6.1)\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 Zenith v6.1**.\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
|
|
138
|
+
Para sincronizar este contexto com sua IDE, utilize links simbólicos ou o comando hub:
|
|
139
|
+
\`\`\`bash
|
|
140
|
+
ggai monitor
|
|
141
|
+
\`\`\`
|
|
142
|
+
\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.`
|
|
143
|
+
: `# Genesis Grid AI Labs - GG-Methodology (Zenith v6.1)\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 v6.1**.\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.`;
|
|
144
|
+
await fs.writeFile(path.join(contextDir, 'README.md'), readmeContent);
|
|
145
|
+
}
|
|
146
|
+
async runZenithDiscovery(contextDir) {
|
|
147
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
148
|
+
const __dirname = path.dirname(__filename);
|
|
149
|
+
const baseContext = path.resolve(__dirname, '..', '.context');
|
|
150
|
+
const sourceContext = path.join(baseContext, this.config.language);
|
|
151
|
+
const sourceMap = path.join(sourceContext, 'docs/PROJECT_MAP.md');
|
|
152
|
+
const sourceLog = path.join(sourceContext, 'docs/OPERATIONS_LOG.md');
|
|
153
|
+
const sourceHandoff = path.join(sourceContext, 'docs/AGENT_HANDOFF_PROMPT.md');
|
|
154
|
+
if (await fs.pathExists(sourceMap)) {
|
|
155
|
+
await fs.copy(sourceMap, path.join(contextDir, 'docs/PROJECT_MAP.md'), { overwrite: false });
|
|
156
|
+
}
|
|
157
|
+
if (await fs.pathExists(sourceLog)) {
|
|
158
|
+
await fs.copy(sourceLog, path.join(contextDir, 'docs/OPERATIONS_LOG.md'), { overwrite: false });
|
|
159
|
+
}
|
|
160
|
+
if (await fs.pathExists(sourceHandoff)) {
|
|
161
|
+
await fs.copy(sourceHandoff, path.join(contextDir, 'docs/AGENT_HANDOFF_PROMPT.md'), { overwrite: false });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
package/package.json
CHANGED
|
@@ -1,76 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggailabs/cli-context",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.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.
|