-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
117 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Command } from "commander"; | ||
|
||
import { PluginService } from "../services/plugin"; | ||
import { deployedUrl } from "../utils/deployed-url"; | ||
import { validateAndParseOpenApiSpec } from "../utils/openapi"; | ||
import { getHostname, getSpecUrl } from "../utils/url-utils"; | ||
|
||
export const verifyCommand = new Command() | ||
.name("verify") | ||
.description("Request verification of your deployed AI agent plugin") | ||
.requiredOption("-u, --url <url>", "Specify the url of the deployed plugin") | ||
.requiredOption( | ||
"-e, --email <email>", | ||
"Provide an email so we can contact you regarding the verification process", | ||
) | ||
.requiredOption( | ||
"-r, --repo <repoUrl>", | ||
"To verify a plugin we need the url for a public repository containing the plugin's code", | ||
) | ||
.option( | ||
"-v, --version <versionNumber>", | ||
"Specify the version of the plugin in case of an update", | ||
) | ||
.action(async (options) => { | ||
const url = options.url || deployedUrl; | ||
|
||
if (!url) { | ||
console.error("Deployed URL could not be determined."); | ||
return; | ||
} | ||
|
||
const pluginId = getHostname(url); | ||
const specUrl = getSpecUrl(url); | ||
const { isValid, accountId } = await validateAndParseOpenApiSpec(specUrl); | ||
|
||
if (!isValid) { | ||
console.error("OpenAPI specification validation failed."); | ||
return; | ||
} | ||
|
||
if (!accountId) { | ||
console.error("Failed to parse account ID from OpenAPI specification."); | ||
return; | ||
} | ||
|
||
await new PluginService().verify({ | ||
pluginId, | ||
accountId, | ||
email: options.email, | ||
repo: options.repo, | ||
version: options.version, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters