publishAgent method
Implementation
Future<void> publishAgent(bool isTest) async {
wtLog.startSpinner('Fetching agent configuration...');
final projectDirectory = PathUtils.currentPath;
try {
final pubSpecData = await PubspecParser.forPath(projectDirectory);
final agentJson = await IsolateFunction.getAgentJson(projectDirectory);
final agentName = pubSpecData.packageName;
final agentDescription = pubSpecData.packageDescription;
final agentVersion = pubSpecData.packageVersion;
agentJson['name'] = agentName;
agentJson['description'] = agentDescription;
agentJson['version'] = agentVersion;
agentJson['testing'] = isTest;
wtLog.log('✔︎ Agent configuration fetched');
wtLog.updateSpinnerMessage('Publishing agent...');
final status = await _agentRepository.publishAgent(agentJson);
wtLog.log('✔︎ Published agent');
wtLog.stopSpinner();
wtLog.info(status);
return;
} catch (error) {
wtLog.stopSpinner();
wtLog.error(error.toString());
return;
}
}