Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds ampx/Amplify Gen 2 commands #2488

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
338 changes: 338 additions & 0 deletions src/ampx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,338 @@
const completionSpec: Fig.Spec = {
name: "ampx",
description: "CLI for Amplify Gen 2",
subcommands: [
{
name: "sandbox",
description: "Deploy to your personal cloud sandbox",
options: [
{
name: "--dir-to-watch",
description: "Directory to watch for file changes",
args: { name: "directory", template: "folders" },
},
{
name: "--exclude",
description: "Paths or glob patterns to ignore",
isRepeatable: true,
args: { name: "pattern" },
},
{
name: "--identifier",
description: "Name to distinguish between sandbox environments",
args: { name: "name" },
},
{
name: "--outputs-out-dir",
description: "Directory where client config file is written",
args: { name: "directory", template: "folders" },
},
{
name: "--outputs-format",
description: "Format of the client config file",
args: { name: "format", suggestions: ["json", "dart"] },
},
{
name: "--outputs-version",
description: "Version of the configuration",
args: { name: "version", suggestions: ["0", "1"] },
},
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
{
name: "--stream-function-logs",
description: "Stream function execution logs",
args: { name: "boolean", suggestions: ["true", "false"] },
},
{
name: "--logs-filter",
description: "Regex pattern to filter logs",
isRepeatable: true,
args: { name: "pattern" },
},
{
name: "--logs-out-file",
description: "File to append streaming logs",
args: { name: "file", template: "filepaths" },
},
],
subcommands: [
{
name: "delete",
description: "Delete your personal cloud sandbox",
options: [
{
name: "--name",
description: "Name to distinguish between sandbox environments",
args: { name: "name" },
},
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
{
name: ["-y", "--yes"],
description: "Do not ask for confirmation before deleting",
},
],
},
{
name: "secret",
description: "Manage backend secrets for your personal cloud sandbox",
subcommands: [
{
name: "set",
description: "Set a secret",
args: { name: "secret_name" },
options: [
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
],
},
{
name: "remove",
description: "Remove a secret",
args: { name: "secret_name" },
options: [
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
],
},
{
name: "list",
description: "List all available secrets",
options: [
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
],
},
{
name: "get",
description: "View details of a secret",
args: { name: "secret_name" },
options: [
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
],
},
],
},
],
},
{
name: "generate",
description: "Generate supplemental information or code",
subcommands: [
{
name: "outputs",
description: "Generate backend outputs file",
options: [
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
{
name: "--format",
description: "Format of the configuration",
args: { name: "format", suggestions: ["json", "dart"] },
},
{
name: "--out-dir",
description: "Directory where config is written",
args: { name: "directory", template: "folders" },
},
{
name: "--outputs-version",
description: "Version of the configuration",
args: { name: "version", suggestions: ["0", "1"] },
},
],
},
{
name: "graphql-client-code",
description: "Generate GraphQL statements and types",
options: [
{
name: "--out",
description: "Directory where config is written",
args: { name: "directory", template: "folders" },
},
{
name: "--format",
description: "Format of the GraphQL client code",
args: {
name: "format",
suggestions: ["modelgen", "graphql-codegen", "introspection"],
},
},
{
name: "--model-target",
description: "Modelgen export target",
args: {
name: "target",
suggestions: [
"java",
"swift",
"javascript",
"typescript",
"dart",
],
},
},
{
name: "--statement-target",
description: "Graphql codegen statement export target",
args: {
name: "target",
suggestions: [
"javascript",
"graphql",
"flow",
"typescript",
"angular",
],
},
},
{
name: "--type-target",
description: "Graphql-codegen type export target",
args: {
name: "target",
suggestions: [
"json",
"swift",
"typescript",
"flow",
"scala",
"flow-modern",
"angular",
],
},
},
{
name: "--all",
description: "Show hidden options",
},
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
{
name: "--debug",
description: "Print debug logs to the console",
},
],
},
{
name: "forms",
description: "Generate React form components",
options: [
{
name: "--out-dir",
description: "Directory where generated forms are written",
args: { name: "directory", template: "folders" },
},
{
name: "--models",
description: "Model names to generate",
isRepeatable: true,
args: { name: "model" },
},
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
],
},
],
options: [
{
name: "--stack",
description: "CloudFormation stack name",
args: { name: "stack_name" },
},
{
name: "--app-id",
description: "Amplify App ID",
args: { name: "app_id" },
},
{
name: "--branch",
description: "Git branch name",
args: { name: "branch_name" },
},
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
],
},
{
name: "info",
description: "Generate system information for troubleshooting",
},
{
name: "pipeline-deploy",
description: "Deploy Amplify project in a CI/CD pipeline",
options: [
{
name: "--branch",
description: "Name of the git branch being deployed",
args: { name: "branch_name" },
},
{
name: "--app-id",
description: "The app id of the target Amplify app",
args: { name: "app_id" },
},
{
name: "--outputs-out-dir",
description: "Directory where client config file is written",
args: { name: "directory", template: "folders" },
},
{
name: "--outputs-version",
description: "Version of the configuration",
args: { name: "version", suggestions: ["0", "1"] },
},
],
},
],
options: [
{
name: "--help",
description: "Display help information",
},
{
name: "--version",
description: "Display version information",
},
{
name: "--profile",
description: "AWS profile name",
args: { name: "profile" },
},
],
};

export default completionSpec;
4 changes: 4 additions & 0 deletions src/npx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ export const npxSuggestions: Fig.Suggestion[] = [
name: "astro",
icon: "https://astro.build/favicon.svg",
},
{
name: "ampx",
icon: "https://raw.githubusercontent.com/aws-amplify/docs/refs/heads/main/public/favicon.ico",
},
];

const completionSpec: Fig.Spec = {
Expand Down