Skip to content

Commit

Permalink
chore(cli): allow triggering specific enhancement for domains
Browse files Browse the repository at this point in the history
  • Loading branch information
sneko committed Feb 23, 2024
1 parent 39affc3 commit 28da457
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions src/cli/program.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { Command } from '@commander-js/extra-typings';

import { enhanceDomainsIntoDatabase, formatDomainsIntoDatabase, saveDomainCsvFile } from '@etabli/src/features/domain';
import { Command, Option } from '@commander-js/extra-typings';

import {
enhanceDomainsIntoDatabase,
formatDomainsIntoDatabase,
matchDomains,
saveDomainCsvFile,
updateRobotsTxtOnDomains,
updateWebsiteDataOnDomains,
updateWildcardCertificateOnDomains,
} from '@etabli/src/features/domain';
import { feedInitiativesFromDatabase, inferInitiativesFromDatabase, runInitiativeAssistant } from '@etabli/src/features/initiative';
import { cleanLlmSystem, ingestInitiativeListToLlmSystem, ingestToolListToLlmSystem, initLlmSystem } from '@etabli/src/features/llm';
import { enhanceRepositoriesIntoDatabase, formatRepositoriesIntoDatabase, saveRepositoryListFile } from '@etabli/src/features/repository';
Expand Down Expand Up @@ -34,8 +42,32 @@ domain
domain
.command('enhance')
.description('do extra work to bring domain information that needs a third-party')
.action(async () => {
await enhanceDomainsIntoDatabase();
.addOption(
new Option(
'-t, --type <type...>',
'type of metadata to enhance (locally you may need to use "npm run cli --- -t certificate" for example)'
).choices(['indexing', 'certificate', 'content', 'matching'] as const)
)
.action(async (options) => {
if (!!options.type) {
if (options.type.includes('indexing')) {
await updateRobotsTxtOnDomains();
}

if (options.type.includes('certificate')) {
await updateWildcardCertificateOnDomains();
}

if (options.type.includes('content')) {
await updateWebsiteDataOnDomains();
}

if (options.type.includes('matching')) {
await matchDomains();
}
} else {
await enhanceDomainsIntoDatabase();
}
});

domain
Expand Down

0 comments on commit 28da457

Please sign in to comment.