{
  "meta": {
    "pkg": "@<redacted:npm-scope>/flightdeck",
    "version": "1.0.0",
    "sourceFiles": 46,
    "sourceLines": 2877,
    "configFiles": 15,
    "sdkCallSites": 37,
    "distinctCommands": 27,
    "promptCallSites": 25,
    "distinctPromptStrings": 23,
    "confirmCallSites": 13,
    "menuCommands": 7,
    "unguardedCommands": 5,
    "versionControlled": false,
    "tests": 0,
    "typechecks": true
  },
  "redactions": [
    {
      "cls": "AWS account id",
      "count": 6,
      "token": "<redacted:aws-account-id>"
    },
    {
      "cls": "npm package scope",
      "count": 3,
      "token": "<redacted:npm-scope>"
    },
    {
      "cls": "SSO profile name",
      "count": 2,
      "token": "<redacted:aws-profile>"
    },
    {
      "cls": "SSO start URL",
      "count": 1,
      "token": "<redacted:sso-start-url>"
    },
    {
      "cls": "IAM service role ARN",
      "count": 3,
      "token": "<redacted:iam-role-arn>"
    },
    {
      "cls": "Cognito import role ARN",
      "count": 2,
      "token": "<redacted:service-role-arn>"
    },
    {
      "cls": "Company domain",
      "count": 7,
      "token": "<redacted:company-domain>"
    },
    {
      "cls": "Tenant directory domain",
      "count": 3,
      "token": "<redacted:tenant-domain>"
    },
    {
      "cls": "Bitbucket workspace",
      "count": 4,
      "token": "<redacted:bitbucket-workspace>"
    },
    {
      "cls": "Repository slug",
      "count": 4,
      "token": "<redacted:repo>"
    },
    {
      "cls": "Amplify app-name template",
      "count": 2,
      "token": "<redacted:app-name>"
    },
    {
      "cls": "Hardcoded SSM parameter path",
      "count": 2,
      "token": "<redacted:ssm-app-path>"
    },
    {
      "cls": "Amplify resource logical ids",
      "count": 2,
      "token": "<redacted:resource-id>"
    },
    {
      "cls": "PreSignup allow-list parameter",
      "count": 2,
      "token": "<redacted:presignup-parameter>"
    },
    {
      "cls": "Container registry image",
      "count": 3,
      "token": "<redacted:container-image>"
    },
    {
      "cls": "Auto-branch creation patterns",
      "count": 4,
      "token": "<redacted:branch-pattern>"
    },
    {
      "cls": "Third-party vendor names",
      "count": 44,
      "token": "described, never named"
    },
    {
      "cls": "Long-lived AWS access key pair",
      "count": 2,
      "token": "never read, never copied"
    },
    {
      "cls": "Third-party API keys and secrets",
      "count": 4,
      "token": "never read, never copied"
    },
    {
      "cls": "Analytics container id",
      "count": 1,
      "token": "never read, never copied"
    }
  ],
  "commands": [
    {
      "key": "createNewApp",
      "name": "Create New Amplify App",
      "description": "Create a new Amplify App",
      "file": "src/commands/create-new-app.ts",
      "guards": 6,
      "guardNote": "six on the ordinary path, eight if a build limit sends it through JobCheckAndWait",
      "production": "if you pick it",
      "writes": true
    },
    {
      "key": "createAmplifyEnvironment",
      "name": "Create New Amplify Environment",
      "description": "Create a new Amplify Environment",
      "file": "src/commands/create-amplify-environment.ts",
      "guards": 4,
      "guardNote": "four on the clone path, one if you answer no to the first",
      "production": "if you pick it",
      "writes": true
    },
    {
      "key": "createNewCustomerEnvironment",
      "name": "Create New Customer Environment",
      "description": "Create a new customer environment",
      "file": "src/commands/create-new-customer.ts",
      "guards": 0,
      "guardNote": "no yes/no question anywhere on its path",
      "production": "always, and it never asks",
      "writes": true
    },
    {
      "key": "copyEnvDB",
      "name": "Copy Environment DB",
      "description": "Copy the Environment Database",
      "file": "src/commands/copy-env-db.ts",
      "guards": 0,
      "guardNote": "no yes/no question anywhere on its path",
      "production": "if you pick it",
      "writes": true
    },
    {
      "key": "copyEnvVar",
      "name": "Copy Environment Variables to SSM",
      "description": "Copy the Environment variables",
      "file": "src/commands/copy-environment-variables-to-ssm.ts",
      "guards": 0,
      "guardNote": "no yes/no question, and no prompt of any kind",
      "production": "every app eu-west-2 lists back, at once",
      "writes": true
    },
    {
      "key": "copyCognitoPoolUsers",
      "name": "Copy cognito users between pools",
      "description": "Copy the cognito pool users",
      "file": "src/commands/copy-cognito-pool-users.ts",
      "guards": 0,
      "guardNote": "no yes/no question anywhere on its path",
      "production": "whatever pool id you type",
      "writes": true
    },
    {
      "key": "copyCognitoUsers",
      "name": "Copy Cognito Users to Another Environment",
      "description": "Copy Cognito Users to another Environment",
      "file": "src/commands/copy-amplify-users.ts",
      "guards": 0,
      "guardNote": "no yes/no question anywhere on its path",
      "production": "if you pick it",
      "writes": true
    }
  ],
  "effects": {
    "local.configRewrite": {
      "svc": "local file",
      "cmd": "fs.writeFile(~/.aws/config)",
      "file": "src/aws/login.ts",
      "line": 71,
      "cls": "overwrites",
      "plain": "Reads your whole AWS config file, replaces the profile block a regex matched and writes the whole file back.",
      "note": "This runs before the menu is drawn, on every start."
    },
    "shell.callerIdentity": {
      "svc": "shell",
      "cmd": "aws sts get-caller-identity",
      "file": "src/aws/login.ts",
      "line": 80,
      "cls": "reads",
      "plain": "Shells out through execSync to see whether the cached SSO session still answers."
    },
    "shell.ssoLogin": {
      "svc": "shell",
      "cmd": "aws sso login",
      "file": "src/aws/login.ts",
      "line": 90,
      "cls": "reads",
      "plain": "Shells out to open the single sign-on flow when the identity check fails."
    },
    "amplify.listApps.region": {
      "svc": "Amplify",
      "cmd": "ListAppsCommand",
      "file": "src/helpers/amplify-fetch-region-apps.ts",
      "line": 8,
      "cls": "reads",
      "plain": "Lists the Amplify apps in one region to fill the app picker.",
      "note": "Sends ListAppsCommand({}) and never follows nextToken, so only the first page is ever offered."
    },
    "amplify.listApps.full": {
      "svc": "Amplify",
      "cmd": "ListAppsCommand",
      "file": "src/helpers/amplify-fetch-region-apps.ts",
      "line": 16,
      "cls": "reads",
      "plain": "Lists the apps as full records, each carrying its app-level environment variables.",
      "note": "This one is unpaginated too, unlike listAllApps in the same codebase which does follow nextToken."
    },
    "amplify.listApps.all": {
      "svc": "Amplify",
      "cmd": "ListAppsCommand",
      "file": "src/helpers/amplify-list-all-apps.ts",
      "line": 14,
      "cls": "reads",
      "plain": "Lists every app in the region, following nextToken until there is none left."
    },
    "amplify.listApps.nameCheck": {
      "svc": "Amplify",
      "cmd": "ListAppsCommand",
      "file": "src/helpers/amplify-create-environment-name.ts",
      "line": 41,
      "cls": "reads",
      "plain": "Lists apps so the generated environment name can be checked for a collision."
    },
    "amplify.listBackendEnvs.select": {
      "svc": "Amplify",
      "cmd": "ListBackendEnvironmentsCommand",
      "file": "src/helpers/amplify-select-environment.ts",
      "line": 15,
      "cls": "reads",
      "plain": "Lists the backend environments of the chosen app, paginated, to fill the environment picker."
    },
    "amplify.listBackendEnvs.all": {
      "svc": "Amplify",
      "cmd": "ListBackendEnvironmentsCommand",
      "file": "src/helpers/amplify-list-all-backend-environments.ts",
      "line": 16,
      "cls": "reads",
      "plain": "Lists every backend environment of one app, paginated."
    },
    "amplify.listBackendEnvs.nameCheck": {
      "svc": "Amplify",
      "cmd": "ListBackendEnvironmentsCommand",
      "file": "src/helpers/amplify-create-environment-name.ts",
      "line": 55,
      "cls": "reads",
      "plain": "Walks the environments of every app in the region looking for the name it just generated."
    },
    "amplify.createApp": {
      "svc": "Amplify",
      "cmd": "CreateAppCommand",
      "file": "src/helpers/amplify-create-app.ts",
      "line": 9,
      "cls": "creates",
      "plain": "Creates the Amplify app, spreading the whole config file into the request and passing the Bitbucket token."
    },
    "amplify.updateApp": {
      "svc": "Amplify",
      "cmd": "UpdateAppCommand",
      "file": "src/helpers/amplify-update-app.ts",
      "line": 10,
      "cls": "overwrites",
      "plain": "Pushes the config file over an app that already exists, build spec and environment variables included."
    },
    "amplify.createBackendEnv": {
      "svc": "Amplify",
      "cmd": "CreateBackendEnvironmentCommand",
      "file": "src/helpers/amplify-create-backend-environment.ts",
      "line": 9,
      "cls": "creates",
      "plain": "Creates the shared backend environment the branch will be pinned to."
    },
    "amplify.createBackendEnv.env": {
      "svc": "Amplify",
      "cmd": "CreateBackendEnvironmentCommand",
      "file": "src/helpers/amplify-create-environment.ts",
      "line": 14,
      "cls": "creates",
      "plain": "Creates the named backend environment."
    },
    "amplify.createBranch": {
      "svc": "Amplify",
      "cmd": "CreateBranchCommand",
      "file": "src/helpers/amplify-create-branch.ts",
      "line": 9,
      "cls": "creates",
      "plain": "Creates the Amplify branch from the branch config file, pinned to the backend environment ARN."
    },
    "amplify.createBranch.customer": {
      "svc": "Amplify",
      "cmd": "CreateBranchCommand",
      "file": "src/commands/create-new-customer.ts",
      "line": 165,
      "cls": "creates",
      "plain": "Creates the customer branch in Amplify, which starts a build against the new environment."
    },
    "amplify.updateBranch": {
      "svc": "Amplify",
      "cmd": "UpdateBranchCommand",
      "file": "src/helpers/amplify-update-branch.ts",
      "line": 9,
      "cls": "overwrites",
      "plain": "Falls back to updating the branch when creating it comes back BadRequestException."
    },
    "amplify.updateBranch.envvars": {
      "svc": "Amplify",
      "cmd": "UpdateBranchCommand",
      "file": "src/commands/create-new-app.ts",
      "line": 260,
      "cls": "overwrites",
      "plain": "Replaces the branch environment variables with everything the SSM read returned.",
      "note": "environmentVariables is a whole-map replacement, so anything already on the branch and not in that map is gone."
    },
    "amplify.getDomain": {
      "svc": "Amplify",
      "cmd": "GetDomainAssociationCommand",
      "file": "src/helpers/amplify-handle-domain-association.ts",
      "line": 37,
      "cls": "reads",
      "plain": "Checks whether the domain is already associated with this app.",
      "note": "Its catch returns false for every error that is not NotFoundException, so a throttle reads as \"does not exist\"."
    },
    "amplify.createDomain": {
      "svc": "Amplify",
      "cmd": "CreateDomainAssociationCommand",
      "file": "src/helpers/amplify-handle-domain-association.ts",
      "line": 58,
      "cls": "creates",
      "plain": "Associates the domain and its subdomain prefix with the app."
    },
    "amplify.startJob": {
      "svc": "Amplify",
      "cmd": "StartJobCommand",
      "file": "src/commands/create-new-app.ts",
      "line": 62,
      "cls": "creates",
      "plain": "Starts a RELEASE build on the branch."
    },
    "amplify.getJob": {
      "svc": "Amplify",
      "cmd": "GetJobCommand",
      "file": "src/helpers/amplify-wait-for-job.ts",
      "line": 13,
      "cls": "reads",
      "plain": "Polls the build every five seconds.",
      "note": "The loop only ends on COMPLETED or FAILED while its caller only continues on SUCCEED, so the two never agree on one string."
    },
    "amplify.listJobs": {
      "svc": "Amplify",
      "cmd": "ListJobsCommand",
      "file": "src/helpers/amplify-job-check-and-wait.ts",
      "line": 17,
      "cls": "reads",
      "plain": "Lists the hosting jobs on the branch after a build limit is hit."
    },
    "amplify.getBackendEnv": {
      "svc": "Amplify",
      "cmd": "GetBackendEnvironmentCommand",
      "file": "src/helpers/amplify-get-env-dynamodb-suffix.ts",
      "line": 17,
      "cls": "reads",
      "plain": "Reads the environment to get the name of its CloudFormation stack."
    },
    "amplify.listBranches": {
      "svc": "Amplify",
      "cmd": "ListBranchesCommand",
      "file": "src/commands/copy-environment-variables-to-ssm.ts",
      "line": 18,
      "cls": "reads",
      "plain": "Lists the branches of one app so their environment variables can be copied out."
    },
    "backend.cloneBackend": {
      "svc": "AmplifyBackend",
      "cmd": "CloneBackendCommand",
      "file": "src/helpers/amplify-clone-envrionment.ts",
      "line": 21,
      "cls": "creates",
      "plain": "Clones the whole backend of one environment into a new one."
    },
    "backend.getBackendJob": {
      "svc": "AmplifyBackend",
      "cmd": "GetBackendJobCommand",
      "file": "src/helpers/amplify-backend-wait-for-job.ts",
      "line": 12,
      "cls": "reads",
      "plain": "Polls the clone every five seconds.",
      "note": "No timeout and no attempt cap, so an unknown status loops for as long as the terminal is open."
    },
    "backend.listBackendJobs": {
      "svc": "AmplifyBackend",
      "cmd": "ListBackendJobsCommand",
      "file": "src/helpers/amplify-job-check-and-wait.ts",
      "line": 51,
      "cls": "reads",
      "plain": "Lists the backend jobs on the environment."
    },
    "backend.getBackend": {
      "svc": "AmplifyBackend",
      "cmd": "GetBackendCommand",
      "file": "src/helpers/amplify-get-default-cognito-user-pool-id.ts",
      "line": 13,
      "cls": "reads",
      "plain": "Reads the environment metadata and digs the Cognito user pool id out of the parsed JSON."
    },
    "cfn.describeStackResources": {
      "svc": "CloudFormation",
      "cmd": "DescribeStackResourcesCommand",
      "file": "src/helpers/amplify-get-env-dynamodb-suffix.ts",
      "line": 25,
      "cls": "reads",
      "plain": "Finds the API resource in the stack by its LogicalResourceId."
    },
    "cfn.describeStacks": {
      "svc": "CloudFormation",
      "cmd": "DescribeStacksCommand",
      "file": "src/helpers/amplify-get-env-dynamodb-suffix.ts",
      "line": 43,
      "cls": "reads",
      "plain": "Reads the GraphQLAPIIdOutput output and the env parameter, which together make the table suffix."
    },
    "ddb.listTables": {
      "svc": "DynamoDB",
      "cmd": "ListTablesCommand",
      "file": "src/helpers/dynamodb-transfer.ts",
      "line": 34,
      "cls": "reads",
      "plain": "Lists every table in the account and keeps the ones whose name ends with the suffix."
    },
    "ddb.scan": {
      "svc": "DynamoDB",
      "cmd": "ScanCommand",
      "file": "src/helpers/dynamodb-transfer.ts",
      "line": 123,
      "cls": "reads",
      "plain": "Scans the source table whole, in twenty parallel segments by default."
    },
    "ddb.describeTable": {
      "svc": "DynamoDB",
      "cmd": "DescribeTableCommand",
      "file": "src/helpers/dynamodb-transfer.ts",
      "line": 49,
      "cls": "reads",
      "plain": "Reads the destination table to find its global secondary index key attributes."
    },
    "ddb.batchWrite": {
      "svc": "DynamoDB",
      "cmd": "BatchWriteItemCommand",
      "file": "src/helpers/dynamodb-transfer.ts",
      "line": 86,
      "cls": "overwrites",
      "plain": "Writes the scanned items into the destination table twenty-five at a time as PutRequest items.",
      "note": "A PutRequest replaces any item already sitting on that key, and nothing is deleted or copied first."
    },
    "ssm.getParameter.bitbucket": {
      "svc": "SSM",
      "cmd": "GetParameterCommand",
      "file": "src/helpers/bitbucket-get-oauth-token.ts",
      "line": 15,
      "cls": "reads",
      "plain": "Reads the Bitbucket client id and secret out of one SSM parameter, decrypted."
    },
    "ssm.getParametersByPath": {
      "svc": "SSM",
      "cmd": "GetParametersByPathCommand",
      "file": "src/commands/create-new-app.ts",
      "line": 213,
      "cls": "reads",
      "plain": "Reads the whole default parameter path with WithDecryption set, so every secret comes back in clear."
    },
    "ssm.putParameter.domain": {
      "svc": "SSM",
      "cmd": "PutParameterCommand",
      "file": "src/helpers/amplify-update-domain-ssm-param.ts",
      "line": 10,
      "cls": "overwrites",
      "plain": "Writes a parameter with Overwrite: true, so whatever was there is gone with no copy kept."
    },
    "ssm.putParameter.value": {
      "svc": "SSM",
      "cmd": "PutParameterCommand",
      "file": "src/helpers/amplify-update-domain-ssm-param.ts",
      "line": 40,
      "cls": "overwrites",
      "plain": "Writes a parameter with Overwrite: true, as SecureString when the key contains \"secret\" or \"private\".",
      "note": "Keys beginning AMPLIFY_ or _ are skipped and everything else is written wherever it lands."
    },
    "bb.token": {
      "svc": "Bitbucket",
      "cmd": "POST oauth2/access_token",
      "file": "src/helpers/bitbucket-get-oauth-token.ts",
      "line": 37,
      "cls": "reads",
      "plain": "Exchanges the client credentials for an OAuth token over a hand-rolled https request.",
      "note": "secureHttpsRequest resolves on the body without ever reading the status code and sets no timeout."
    },
    "bb.getBranch": {
      "svc": "Bitbucket",
      "cmd": "refs.getBranch",
      "file": "src/commands/create-new-customer.ts",
      "line": 128,
      "cls": "reads",
      "plain": "Checks whether the customer branch already exists in the repository."
    },
    "bb.getProdBranch": {
      "svc": "Bitbucket",
      "cmd": "refs.getBranch(production)",
      "file": "src/commands/create-new-customer.ts",
      "line": 135,
      "cls": "reads",
      "plain": "Reads the head commit of the production branch."
    },
    "bb.createBranch": {
      "svc": "Bitbucket",
      "cmd": "refs.createBranch",
      "file": "src/commands/create-new-customer.ts",
      "line": 148,
      "cls": "creates",
      "plain": "Creates the customer branch in the repository, pointed at the production head."
    },
    "vendor.redirectUri": {
      "svc": "email API",
      "cmd": "POST /applications/redirect-uris",
      "file": "src/commands/create-new-app.ts",
      "line": 174,
      "cls": "creates",
      "plain": "Posts a redirect URI to a third-party email API, authenticated with that vendor’s own key read back out of SSM.",
      "note": "Called at line 257 without await, so a failure lands as an unhandled rejection after the CLI has moved on."
    },
    "cognito.export": {
      "svc": "Cognito",
      "cmd": "cognito-export · ListUsers",
      "file": "src/helpers/cognito-migrate-users.ts",
      "line": 18,
      "cls": "reads",
      "plain": "Exports the source pool through a third-party package.",
      "note": "flightdeck passes no limit and the library reads options.limit ?? 1000, so a larger pool is truncated at a thousand."
    },
    "cognito.rewrite": {
      "svc": "local",
      "cmd": "users.forEach(…)",
      "file": "src/helpers/cognito-migrate-users.ts",
      "line": 24,
      "cls": "overwrites",
      "plain": "Rewrites every exported record so cognito:username becomes the user’s email address before import."
    },
    "cognito.import": {
      "svc": "Cognito",
      "cmd": "cognito-import · CreateUserImportJob + StartUserImportJob",
      "file": "src/helpers/cognito-migrate-users.ts",
      "line": 30,
      "cls": "creates",
      "plain": "Creates a user import job with a hardcoded role ARN, PUTs the CSV to the job’s presigned URL and starts it.",
      "note": "Both call sites pass the same hardcoded ARN under the same comment: // FIXME: This should be a parameter from SSM."
    }
  },
  "nodes": {
    "root": {
      "id": "root",
      "kind": "select",
      "cmd": null,
      "message": "Select a command to execute",
      "src": "src/index.ts:69",
      "listSrc": "src/index.ts:12",
      "def": 0,
      "choices": [
        {
          "sep": "Amplify"
        },
        {
          "name": "Create New Amplify App",
          "description": "Create a new Amplify App",
          "next": "app.type"
        },
        {
          "name": "Create New Amplify Environment",
          "description": "Create a new Amplify Environment",
          "next": "env.clone"
        },
        {
          "name": "Create New Customer Environment",
          "description": "Create a new customer environment",
          "next": "cust.domain"
        },
        {
          "sep": "Administration"
        },
        {
          "name": "Copy Environment DB",
          "description": "Copy the Environment Database",
          "next": "db.src.type"
        },
        {
          "name": "Copy Environment Variables to SSM",
          "description": "Copy the Environment variables",
          "next": "ssm.run"
        },
        {
          "name": "Copy cognito users between pools",
          "description": "Copy the cognito pool users",
          "next": "pool.src"
        },
        {
          "name": "Copy Cognito Users to Another Environment",
          "description": "Copy Cognito Users to another Environment",
          "next": "cog.src.type"
        },
        {
          "name": "Exit",
          "description": "Exit the application",
          "next": "exit"
        }
      ]
    },
    "exit": {
      "id": "exit",
      "kind": "end",
      "cmd": "exit",
      "emit": [
        {
          "k": "log",
          "t": "Exiting..."
        }
      ],
      "verdict": "exit",
      "closing": "Exit is the one entry on the menu that issues no AWS call of its own, and the gauge still reads one overwrite. Your ~/.aws/config was rewritten before the menu was ever drawn, because runCLI calls Login() first and Login rewrites the profile block whether or not you go on to do anything."
    },
    "app.region": {
      "id": "app.region",
      "kind": "select",
      "cmd": "createNewApp",
      "message": "Select your region: ",
      "src": "src/helpers/amplify-select-environment.ts:80",
      "listSrc": "src/helpers/types.ts:46",
      "def": 2,
      "pre": [],
      "choices": [
        {
          "name": "Canada",
          "short": "ca",
          "next": "app.createApp",
          "fx": [
            "ssm.getParameter.bitbucket",
            "bb.token",
            "amplify.listApps.all"
          ]
        },
        {
          "name": "US East",
          "short": "us",
          "next": "app.createApp",
          "fx": [
            "ssm.getParameter.bitbucket",
            "bb.token",
            "amplify.listApps.all"
          ]
        },
        {
          "name": "London",
          "short": "gb",
          "next": "app.createApp",
          "fx": [
            "ssm.getParameter.bitbucket",
            "bb.token",
            "amplify.listApps.all"
          ]
        },
        {
          "name": "Dublin",
          "short": "ie",
          "next": "app.createApp",
          "fx": [
            "ssm.getParameter.bitbucket",
            "bb.token",
            "amplify.listApps.all"
          ]
        },
        {
          "name": "Paris",
          "short": "fr",
          "next": "app.createApp",
          "fx": [
            "ssm.getParameter.bitbucket",
            "bb.token",
            "amplify.listApps.all"
          ]
        }
      ]
    },
    "app.type": {
      "id": "app.type",
      "kind": "select",
      "cmd": "createNewApp",
      "message": "Enter the number of the environment type: ",
      "src": "src/helpers/amplify-select-environment.ts:65",
      "listSrc": "src/helpers/types.ts:16",
      "def": 0,
      "pre": [],
      "choices": [
        {
          "name": "Development",
          "short": "dv",
          "next": "app.region"
        },
        {
          "name": "Demo",
          "short": "dm",
          "next": "app.region"
        },
        {
          "name": "Production",
          "short": "pd",
          "next": "app.region"
        }
      ]
    },
    "app.createApp": {
      "id": "app.createApp",
      "kind": "confirm",
      "cmd": "createNewApp",
      "def": true,
      "message": "The app does not exist in Amplify. Would you like to create it? ",
      "src": "src/helpers/amplify-get-or-create-app.ts:25",
      "yes": {
        "fx": [
          "amplify.createApp"
        ],
        "emit": [
          {
            "k": "log",
            "t": "App created: {"
          },
          {
            "k": "sim",
            "t": "  appId: '{{d1alpha0000001}}',"
          },
          {
            "k": "sim",
            "t": "  name: '<redacted:app-name>-development-gb',"
          },
          {
            "k": "sim",
            "t": "  platform: 'WEB_COMPUTE',"
          },
          {
            "k": "sim",
            "t": "  repository: 'https://bitbucket.org/<redacted:bitbucket-workspace>/<redacted:repo>'"
          },
          {
            "k": "sim",
            "t": "}"
          }
        ],
        "next": "app.createEnv"
      },
      "no": {
        "emit": [
          {
            "k": "log",
            "t": "An error occurred: Error: Failed to get or create app"
          }
        ],
        "next": "app.abort"
      }
    },
    "app.abort": {
      "id": "app.abort",
      "kind": "end",
      "cmd": "createNewApp",
      "emit": [],
      "verdict": "caught",
      "closing": "Saying no throws inside getOrCreateApp, the .catch in setupApp rewrites it as Failed to get or create app (src/commands/create-new-app.ts:116) and the try/catch around CreateNewApp prints it. This is the one way out of Create New Amplify App that leaves the AWS account exactly as it was, although your ~/.aws/config had already been rewritten before the menu was drawn."
    },
    "app.createEnv": {
      "id": "app.createEnv",
      "kind": "confirm",
      "cmd": "createNewApp",
      "def": true,
      "message": "The shrdgbdv environment does not exist in Amplify. Would you like to create it?",
      "src": "src/helpers/amplify-get-or-create-environment.ts:15",
      "msgNote": "shrdgbdv is assembled at runtime from SHARED_PREFIX plus the region and environment codes.",
      "fxPre": [
        "amplify.listBackendEnvs.all"
      ],
      "yes": {
        "fx": [
          "amplify.createBackendEnv"
        ],
        "next": "app.branch"
      },
      "no": {
        "emit": [
          {
            "k": "log",
            "t": "An error occurred: Error: User chose not to create the environment. Exiting..."
          }
        ],
        "next": "app.abort"
      }
    },
    "app.branch": {
      "id": "app.branch",
      "kind": "confirm",
      "cmd": "createNewApp",
      "def": true,
      "message": "Do you want to create/update the dev branch? ",
      "src": "src/commands/create-new-app.ts:36",
      "msgNote": "The branch name comes from src/config/branch.default.development.json, which reads { \"branchName\": \"dev\", \"stage\": \"PRODUCTION\" }.",
      "yes": {
        "fx": [
          "amplify.createBranch"
        ],
        "next": "app.domain"
      },
      "no": {
        "next": "app.domain"
      }
    },
    "app.domain": {
      "id": "app.domain",
      "kind": "confirm",
      "cmd": "createNewApp",
      "def": true,
      "message": "Do you want to create/update the domain association? ",
      "src": "src/commands/create-new-app.ts:296",
      "yes": {
        "fx": [
          "amplify.getDomain",
          "amplify.createDomain"
        ],
        "emit": [
          {
            "k": "log",
            "t": "Creating domain with the config:  {"
          },
          {
            "k": "sim",
            "t": "  domainName: '<redacted:company-domain>',"
          },
          {
            "k": "sim",
            "t": "  enableAutoSubDomain: true,"
          },
          {
            "k": "sim",
            "t": "  subDomainSettings: [ { prefix: 'devgbdv', branchName: 'dev' } ],"
          },
          {
            "k": "sim",
            "t": "  autoSubDomainCreationPatterns: [ '*' ],"
          },
          {
            "k": "sim",
            "t": "  appId: '{{d1alpha0000001}}'"
          },
          {
            "k": "sim",
            "t": "}"
          },
          {
            "k": "log",
            "t": "Domain association for <redacted:company-domain> created successfully."
          }
        ],
        "next": "app.vars"
      },
      "no": {
        "next": "app.vars"
      }
    },
    "app.vars": {
      "id": "app.vars",
      "kind": "confirm",
      "cmd": "createNewApp",
      "def": true,
      "pre": [
        {
          "k": "log",
          "t": "Setting up default environment variables..."
        },
        {
          "k": "log",
          "t": "Getting default environment variables..."
        },
        {
          "k": "log",
          "t": "Got default environment variables: ["
        },
        {
          "k": "sim",
          "t": "  { Name: '/amplify/<redacted:ssm-app-path>/default/PRIVATE_AWS_ACCESS_KEY_ID', Type: 'SecureString', Value: '{{\"██████████\"}}' },"
        },
        {
          "k": "sim",
          "t": "  { Name: '/amplify/<redacted:ssm-app-path>/default/PRIVATE_<redacted:vendor>_API_KEY', Type: 'SecureString', Value: '{{\"██████████\"}}' },"
        },
        {
          "k": "sim",
          "t": "  … {{19 more}}"
        },
        {
          "k": "sim",
          "t": "]"
        },
        {
          "k": "log",
          "t": "Next token: undefined"
        }
      ],
      "fxPre": [
        "ssm.getParametersByPath",
        "ssm.putParameter.domain",
        "vendor.redirectUri",
        "amplify.updateBranch.envvars",
        "ssm.putParameter.domain"
      ],
      "message": "Would you like to run a build? ",
      "src": "src/commands/create-new-app.ts:60",
      "yes": {
        "fx": [
          "amplify.startJob"
        ],
        "emit": [
          {
            "k": "log",
            "t": "Build started successfully."
          }
        ],
        "next": "app.db"
      },
      "no": {
        "emit": [
          {
            "k": "log",
            "t": "An error occurred: Error: Invalid build response"
          }
        ],
        "next": "app.abortBuild"
      }
    },
    "app.db": {
      "id": "app.db",
      "kind": "confirm",
      "cmd": "createNewApp",
      "def": true,
      "message": "Do you want to clone the database from another environment (you will need to wait until the build is complete)?",
      "src": "src/commands/create-new-app.ts:333",
      "yes": {
        "fx": [
          "amplify.getJob",
          "amplify.getJob",
          "amplify.getJob"
        ],
        "emit": [
          {
            "k": "log",
            "t": "Job status: {{RUNNING}}"
          },
          {
            "k": "log",
            "t": "Job status: {{RUNNING}}"
          },
          {
            "k": "log",
            "t": "Job completed"
          },
          {
            "k": "log",
            "t": "An error occurred: Error: Build failed or did not complete successfully"
          }
        ],
        "next": "app.mismatch"
      },
      "no": {
        "emit": [
          {
            "k": "log",
            "t": "Amplify environment setup completed successfully."
          }
        ],
        "next": "app.done"
      }
    },
    "app.mismatch": {
      "id": "app.mismatch",
      "kind": "end",
      "cmd": "createNewApp",
      "verdict": "caught",
      "emit": [],
      "closing": "AmplifyWaitForJob returns as soon as the status reads COMPLETED (src/helpers/amplify-wait-for-job.ts:29) and the caller then tests that same job for SUCCEED (src/commands/create-new-app.ts:346). The two functions are checking different strings, so whichever value the service returns, one of them is wrong and the database clone never runs."
    },
    "app.done": {
      "id": "app.done",
      "kind": "end",
      "cmd": "createNewApp",
      "verdict": "ok",
      "emit": [],
      "closing": "By the time this question arrives the app, the backend environment, the branch, the domain association and the default environment variables have all been written, and the sign-up allow-list was overwritten with a pair of email domains hardcoded at src/commands/create-new-app.ts:393 without appearing in a single prompt. Six yes/no questions sit on this route and every one of them is built with default: true."
    },
    "env.clone": {
      "id": "env.clone",
      "kind": "confirm",
      "cmd": "createAmplifyEnvironment",
      "def": true,
      "pre": [
        {
          "k": "log",
          "t": "Creating a new Amplify environment"
        }
      ],
      "message": "Do you want to clone an existing backend?",
      "src": "src/commands/create-amplify-environment.ts:10",
      "yes": {
        "next": "envc.type"
      },
      "no": {
        "next": "envn.name"
      }
    },
    "envc.env": {
      "id": "envc.env",
      "kind": "select",
      "cmd": "createAmplifyEnvironment",
      "message": "Choose your environment:",
      "src": "src/helpers/amplify-select-environment.ts:112",
      "listSrc": "src/helpers/amplify-select-environment.ts:8",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listBackendEnvs.select"
      ],
      "choices": [
        {
          "name": "{{shrdgbdv}}",
          "next": "envc.name"
        },
        {
          "name": "{{gbdvfoxtrot}}",
          "next": "envc.name"
        },
        {
          "name": "{{gbdvjuliet}}",
          "next": "envc.name"
        }
      ]
    },
    "envc.app": {
      "id": "envc.app",
      "kind": "select",
      "cmd": "createAmplifyEnvironment",
      "message": "Select your app: ",
      "src": "src/helpers/amplify-select-environment.ts:101",
      "listSrc": "src/helpers/amplify-fetch-region-apps.ts:5",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listApps.region"
      ],
      "choices": [
        {
          "name": "{{app-alpha-development-gb}}",
          "next": "envc.env"
        },
        {
          "name": "{{app-bravo-demo-gb}}",
          "next": "envc.env"
        },
        {
          "name": "{{app-charlie-production-gb}}",
          "next": "envc.env"
        }
      ]
    },
    "envc.region": {
      "id": "envc.region",
      "kind": "select",
      "cmd": "createAmplifyEnvironment",
      "message": "Select your region: ",
      "src": "src/helpers/amplify-select-environment.ts:80",
      "listSrc": "src/helpers/types.ts:46",
      "def": 2,
      "pre": [],
      "choices": [
        {
          "name": "Canada",
          "short": "ca",
          "next": "envc.app"
        },
        {
          "name": "US East",
          "short": "us",
          "next": "envc.app"
        },
        {
          "name": "London",
          "short": "gb",
          "next": "envc.app"
        },
        {
          "name": "Dublin",
          "short": "ie",
          "next": "envc.app"
        },
        {
          "name": "Paris",
          "short": "fr",
          "next": "envc.app"
        }
      ]
    },
    "envc.type": {
      "id": "envc.type",
      "kind": "select",
      "cmd": "createAmplifyEnvironment",
      "message": "Enter the number of the environment type: ",
      "src": "src/helpers/amplify-select-environment.ts:65",
      "listSrc": "src/helpers/types.ts:16",
      "def": 0,
      "pre": [],
      "choices": [
        {
          "name": "Development",
          "short": "dv",
          "next": "envc.region"
        },
        {
          "name": "Demo",
          "short": "dm",
          "next": "envc.region"
        },
        {
          "name": "Production",
          "short": "pd",
          "next": "envc.region"
        }
      ]
    },
    "envc.name": {
      "id": "envc.name",
      "kind": "input",
      "cmd": "createAmplifyEnvironment",
      "message": "Enter the name for the new environment: ",
      "src": "src/commands/create-amplify-environment.ts:16",
      "placeholder": "gbdvkilo",
      "submit": {
        "fx": [
          "backend.cloneBackend"
        ],
        "next": "envc.wait"
      }
    },
    "envc.wait": {
      "id": "envc.wait",
      "kind": "confirm",
      "cmd": "createAmplifyEnvironment",
      "def": true,
      "message": "Do you want to wait for the clone to complete (you can run a db transfer on completion)? ",
      "src": "src/helpers/amplify-clone-envrionment.ts:30",
      "yes": {
        "fx": [
          "backend.getBackendJob",
          "backend.getBackendJob"
        ],
        "emit": [
          {
            "k": "log",
            "t": "Cloning environment..."
          },
          {
            "k": "log",
            "t": "Status: {{PENDING}}"
          },
          {
            "k": "log",
            "t": "Status: {{COMPLETED}}"
          }
        ],
        "next": "envc.db"
      },
      "no": {
        "emit": [
          {
            "k": "log",
            "t": "New environment '$ANSWER:envc.name' is being cloned."
          }
        ],
        "next": "envc.doneCloning"
      }
    },
    "envc.doneCloning": {
      "id": "envc.doneCloning",
      "kind": "end",
      "cmd": "createAmplifyEnvironment",
      "verdict": "ok",
      "emit": [],
      "closing": "CloneBackendCommand goes out at src/helpers/amplify-clone-envrionment.ts:28 and the first question comes two lines later, so every no available from here declines to watch rather than declines to act, and the new backend environment exists either way."
    },
    "envc.db": {
      "id": "envc.db",
      "kind": "confirm",
      "cmd": "createAmplifyEnvironment",
      "def": true,
      "message": "Do you want to clone the sourceDB?",
      "src": "src/helpers/amplify-clone-envrionment.ts:64",
      "yes": {
        "fx": [
          "amplify.getBackendEnv",
          "cfn.describeStackResources",
          "cfn.describeStacks",
          "amplify.getBackendEnv",
          "cfn.describeStackResources",
          "cfn.describeStacks"
        ],
        "emit": [
          {
            "k": "log",
            "t": "Transferring from {{-a1b1c1d1e1-gbdvfoxtrot}} to {{-a1b1c1d1e1-$ANSWER:envc.name}}"
          }
        ],
        "next": "envc.transfer"
      },
      "no": {
        "emit": [
          {
            "k": "log",
            "t": "Cloning environment completed."
          },
          {
            "k": "log",
            "t": "New environment '$ANSWER:envc.name' created successfully."
          }
        ],
        "next": "envc.doneCloning"
      }
    },
    "envc.transfer": {
      "id": "envc.transfer",
      "kind": "confirm",
      "cmd": "createAmplifyEnvironment",
      "def": true,
      "message": "Do you want to clone from \"{{-a1b1c1d1e1-gbdvfoxtrot}}\" to \"{{-a1b1c1d1e1-$ANSWER:envc.name}}\" ?",
      "src": "src/helpers/amplify-clone-envrionment.ts:81",
      "yes": {
        "fx": [
          "ddb.listTables",
          "ddb.listTables",
          "ddb.scan",
          "ddb.describeTable",
          "ddb.batchWrite"
        ],
        "emit": [
          {
            "k": "log",
            "t": "Tables with suffix {{-a1b1c1d1e1-gbdvfoxtrot}}: ["
          },
          {
            "k": "sim",
            "t": "  '{{Alpha-a1b1c1d1e1-gbdvfoxtrot}}', '{{Bravo-a1b1c1d1e1-gbdvfoxtrot}}', '{{Charlie-a1b1c1d1e1-gbdvfoxtrot}}', … {{15 more}}"
          },
          {
            "k": "sim",
            "t": "]"
          },
          {
            "k": "log",
            "t": "Copying data from {{Alpha-a1b1c1d1e1-gbdvfoxtrot}} to {{Alpha-a1b1c1d1e1-$ANSWER:envc.name}}"
          }
        ],
        "next": "envc.done"
      },
      "no": {
        "next": "envc.doneCloning"
      }
    },
    "envc.done": {
      "id": "envc.done",
      "kind": "end",
      "cmd": "createAmplifyEnvironment",
      "verdict": "wrote",
      "emit": [],
      "closing": "This transfer is awaited (src/helpers/amplify-clone-envrionment.ts:86), unlike the one at the end of Copy Environment DB, so this route can at least see its own failures. It then returns environmentResult at line 101, above both of the lines that would have told you the clone was finished, which is why a run that worked ends without printing anything to say so."
    },
    "envn.name": {
      "id": "envn.name",
      "kind": "input",
      "cmd": "createAmplifyEnvironment",
      "message": "Enter the name for the new environment: ",
      "src": "src/commands/create-amplify-environment.ts:27",
      "placeholder": "gbdvlima",
      "submit": {
        "next": "envn.type"
      }
    },
    "envn.app": {
      "id": "envn.app",
      "kind": "select",
      "cmd": "createAmplifyEnvironment",
      "message": "Select your app: ",
      "src": "src/helpers/amplify-select-environment.ts:101",
      "listSrc": "src/helpers/amplify-fetch-region-apps.ts:5",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listApps.region"
      ],
      "choices": [
        {
          "name": "{{app-alpha-development-gb}}",
          "next": "envn.done",
          "emit": [
            {
              "k": "log",
              "t": "New environment '$ANSWER:envn.name' created successfully."
            }
          ],
          "fx": [
            "amplify.createBackendEnv.env",
            "ssm.putParameter.domain"
          ]
        },
        {
          "name": "{{app-bravo-demo-gb}}",
          "next": "envn.done",
          "emit": [
            {
              "k": "log",
              "t": "New environment '$ANSWER:envn.name' created successfully."
            }
          ],
          "fx": [
            "amplify.createBackendEnv.env",
            "ssm.putParameter.domain"
          ]
        },
        {
          "name": "{{app-charlie-production-gb}}",
          "next": "envn.done",
          "emit": [
            {
              "k": "log",
              "t": "New environment '$ANSWER:envn.name' created successfully."
            }
          ],
          "fx": [
            "amplify.createBackendEnv.env",
            "ssm.putParameter.domain"
          ]
        }
      ]
    },
    "envn.region": {
      "id": "envn.region",
      "kind": "select",
      "cmd": "createAmplifyEnvironment",
      "message": "Select your region: ",
      "src": "src/helpers/amplify-select-environment.ts:80",
      "listSrc": "src/helpers/types.ts:46",
      "def": 2,
      "pre": [],
      "choices": [
        {
          "name": "Canada",
          "short": "ca",
          "next": "envn.app"
        },
        {
          "name": "US East",
          "short": "us",
          "next": "envn.app"
        },
        {
          "name": "London",
          "short": "gb",
          "next": "envn.app"
        },
        {
          "name": "Dublin",
          "short": "ie",
          "next": "envn.app"
        },
        {
          "name": "Paris",
          "short": "fr",
          "next": "envn.app"
        }
      ]
    },
    "envn.type": {
      "id": "envn.type",
      "kind": "select",
      "cmd": "createAmplifyEnvironment",
      "message": "Enter the number of the environment type: ",
      "src": "src/helpers/amplify-select-environment.ts:65",
      "listSrc": "src/helpers/types.ts:16",
      "def": 0,
      "pre": [],
      "choices": [
        {
          "name": "Development",
          "short": "dv",
          "next": "envn.region"
        },
        {
          "name": "Demo",
          "short": "dm",
          "next": "envn.region"
        },
        {
          "name": "Production",
          "short": "pd",
          "next": "envn.region"
        }
      ]
    },
    "envn.done": {
      "id": "envn.done",
      "kind": "end",
      "cmd": "createAmplifyEnvironment",
      "verdict": "wrote",
      "emit": [],
      "closing": "CreateEnvironment writes the sign-up allow-list straight after creating the environment, as one PutParameter with Overwrite: true carrying the string \"<redacted:company-domain>,<redacted:tenant-domain>\" (src/commands/create-amplify-environment.ts:30). That parameter decides which email domains may register."
    },
    "cust.domain": {
      "id": "cust.domain",
      "kind": "input",
      "cmd": "createNewCustomerEnvironment",
      "pre": [
        {
          "k": "log",
          "t": "Starting CreateNewCustomerEnvironment"
        },
        {
          "k": "log",
          "t": "Got AWS client provider"
        }
      ],
      "message": "Enter the customer email domain (i.e. <redacted:company-domain>): ",
      "src": "src/commands/create-new-customer.ts:55",
      "placeholder": "northwind-freight.example",
      "derive": "customerEnv",
      "submit": {
        "emit": [
          {
            "k": "log",
            "t": "Customer domain: $ANSWER"
          },
          {
            "k": "log",
            "t": "Creating a new Amplify environment for the customer with domain:  $ANSWER"
          }
        ],
        "next": "cust.region"
      }
    },
    "cust.app": {
      "id": "cust.app",
      "kind": "select",
      "cmd": "createNewCustomerEnvironment",
      "message": "Select your app: ",
      "src": "src/helpers/amplify-select-environment.ts:101",
      "listSrc": "src/helpers/amplify-fetch-region-apps.ts:5",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listApps.region"
      ],
      "choices": [
        {
          "name": "{{app-alpha-development-gb}}",
          "next": "cust.done",
          "emit": [
            {
              "k": "log",
              "t": "Final env name is: $DERIVED"
            },
            {
              "k": "log",
              "t": "Checking if environment name is taken: $DERIVED"
            },
            {
              "k": "log",
              "t": "Apps: {{ { apps: [ … ], $metadata: { httpStatusCode: 200 } } }}"
            },
            {
              "k": "log",
              "t": "Creating environment with name:  $DERIVED"
            },
            {
              "k": "log",
              "t": "New environment '$DERIVED' created successfully."
            },
            {
              "k": "log",
              "t": "Generated branch name: $BRANCH"
            },
            {
              "k": "log",
              "t": "Creating branch"
            },
            {
              "k": "log",
              "t": "Branch $BRANCH created successfully: {"
            },
            {
              "k": "sim",
              "t": "  name: '$BRANCH',"
            },
            {
              "k": "sim",
              "t": "  target: { hash: '{{9f2c41ab7e30}}' }"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": "Branch created successfully"
            },
            {
              "k": "log",
              "t": "CreateNewCustomerEnvironment completed"
            }
          ],
          "fx": [
            "amplify.listApps.nameCheck",
            "amplify.listBackendEnvs.nameCheck",
            "amplify.createBackendEnv.env",
            "ssm.putParameter.domain",
            "amplify.listBackendEnvs.all",
            "ssm.getParameter.bitbucket",
            "bb.token",
            "bb.getBranch",
            "bb.getProdBranch",
            "bb.createBranch",
            "amplify.createBranch.customer"
          ]
        },
        {
          "name": "{{app-bravo-demo-gb}}",
          "next": "cust.done",
          "emit": [
            {
              "k": "log",
              "t": "Final env name is: $DERIVED"
            },
            {
              "k": "log",
              "t": "Checking if environment name is taken: $DERIVED"
            },
            {
              "k": "log",
              "t": "Apps: {{ { apps: [ … ], $metadata: { httpStatusCode: 200 } } }}"
            },
            {
              "k": "log",
              "t": "Creating environment with name:  $DERIVED"
            },
            {
              "k": "log",
              "t": "New environment '$DERIVED' created successfully."
            },
            {
              "k": "log",
              "t": "Generated branch name: $BRANCH"
            },
            {
              "k": "log",
              "t": "Creating branch"
            },
            {
              "k": "log",
              "t": "Branch $BRANCH created successfully: {"
            },
            {
              "k": "sim",
              "t": "  name: '$BRANCH',"
            },
            {
              "k": "sim",
              "t": "  target: { hash: '{{9f2c41ab7e30}}' }"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": "Branch created successfully"
            },
            {
              "k": "log",
              "t": "CreateNewCustomerEnvironment completed"
            }
          ],
          "fx": [
            "amplify.listApps.nameCheck",
            "amplify.listBackendEnvs.nameCheck",
            "amplify.createBackendEnv.env",
            "ssm.putParameter.domain",
            "amplify.listBackendEnvs.all",
            "ssm.getParameter.bitbucket",
            "bb.token",
            "bb.getBranch",
            "bb.getProdBranch",
            "bb.createBranch",
            "amplify.createBranch.customer"
          ]
        },
        {
          "name": "{{app-charlie-production-gb}}",
          "next": "cust.done",
          "emit": [
            {
              "k": "log",
              "t": "Final env name is: $DERIVED"
            },
            {
              "k": "log",
              "t": "Checking if environment name is taken: $DERIVED"
            },
            {
              "k": "log",
              "t": "Apps: {{ { apps: [ … ], $metadata: { httpStatusCode: 200 } } }}"
            },
            {
              "k": "log",
              "t": "Creating environment with name:  $DERIVED"
            },
            {
              "k": "log",
              "t": "New environment '$DERIVED' created successfully."
            },
            {
              "k": "log",
              "t": "Generated branch name: $BRANCH"
            },
            {
              "k": "log",
              "t": "Creating branch"
            },
            {
              "k": "log",
              "t": "Branch $BRANCH created successfully: {"
            },
            {
              "k": "sim",
              "t": "  name: '$BRANCH',"
            },
            {
              "k": "sim",
              "t": "  target: { hash: '{{9f2c41ab7e30}}' }"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": "Branch created successfully"
            },
            {
              "k": "log",
              "t": "CreateNewCustomerEnvironment completed"
            }
          ],
          "fx": [
            "amplify.listApps.nameCheck",
            "amplify.listBackendEnvs.nameCheck",
            "amplify.createBackendEnv.env",
            "ssm.putParameter.domain",
            "amplify.listBackendEnvs.all",
            "ssm.getParameter.bitbucket",
            "bb.token",
            "bb.getBranch",
            "bb.getProdBranch",
            "bb.createBranch",
            "amplify.createBranch.customer"
          ]
        }
      ]
    },
    "cust.region": {
      "id": "cust.region",
      "kind": "select",
      "cmd": "createNewCustomerEnvironment",
      "message": "Select your region: ",
      "src": "src/helpers/amplify-select-environment.ts:80",
      "listSrc": "src/helpers/types.ts:46",
      "def": 2,
      "pre": [],
      "choices": [
        {
          "name": "Canada",
          "short": "ca",
          "next": "cust.app"
        },
        {
          "name": "US East",
          "short": "us",
          "next": "cust.app"
        },
        {
          "name": "London",
          "short": "gb",
          "next": "cust.app"
        },
        {
          "name": "Dublin",
          "short": "ie",
          "next": "cust.app"
        },
        {
          "name": "Paris",
          "short": "fr",
          "next": "cust.app"
        }
      ]
    },
    "cust.done": {
      "id": "cust.done",
      "kind": "end",
      "cmd": "createNewCustomerEnvironment",
      "verdict": "wrote",
      "emit": [],
      "closing": "The one command that provisions for a paying customer hardcodes preSelectedEnvironmentType: EnvironmentType.PRODUCTION with skipEnvironmentType: true (src/commands/create-new-customer.ts:20), so it can only ever be pointed at production and it never says so. Between the domain you typed and a live branch built from the head of production there is no yes-or-no question at all."
    },
    "db.src.env": {
      "id": "db.src.env",
      "kind": "select",
      "cmd": "copyEnvDB",
      "message": "Choose your environment:",
      "src": "src/helpers/amplify-select-environment.ts:112",
      "listSrc": "src/helpers/amplify-select-environment.ts:8",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listBackendEnvs.select"
      ],
      "choices": [
        {
          "name": "{{shrdgbdv}}",
          "next": "db.dst.type",
          "emit": [
            {
              "k": "log",
              "t": "Source environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvfoxtrot}}'"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": ""
            },
            {
              "k": "log",
              "t": "Select destination environment:"
            }
          ]
        },
        {
          "name": "{{gbdvfoxtrot}}",
          "next": "db.dst.type",
          "emit": [
            {
              "k": "log",
              "t": "Source environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvfoxtrot}}'"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": ""
            },
            {
              "k": "log",
              "t": "Select destination environment:"
            }
          ]
        },
        {
          "name": "{{gbdvjuliet}}",
          "next": "db.dst.type",
          "emit": [
            {
              "k": "log",
              "t": "Source environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvfoxtrot}}'"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": ""
            },
            {
              "k": "log",
              "t": "Select destination environment:"
            }
          ]
        }
      ]
    },
    "db.src.app": {
      "id": "db.src.app",
      "kind": "select",
      "cmd": "copyEnvDB",
      "message": "Select your app: ",
      "src": "src/helpers/amplify-select-environment.ts:101",
      "listSrc": "src/helpers/amplify-fetch-region-apps.ts:5",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listApps.region"
      ],
      "choices": [
        {
          "name": "{{app-alpha-development-gb}}",
          "next": "db.src.env"
        },
        {
          "name": "{{app-bravo-demo-gb}}",
          "next": "db.src.env"
        },
        {
          "name": "{{app-charlie-production-gb}}",
          "next": "db.src.env"
        }
      ]
    },
    "db.src.region": {
      "id": "db.src.region",
      "kind": "select",
      "cmd": "copyEnvDB",
      "message": "Select your region: ",
      "src": "src/helpers/amplify-select-environment.ts:80",
      "listSrc": "src/helpers/types.ts:46",
      "def": 2,
      "pre": [],
      "choices": [
        {
          "name": "Canada",
          "short": "ca",
          "next": "db.src.app"
        },
        {
          "name": "US East",
          "short": "us",
          "next": "db.src.app"
        },
        {
          "name": "London",
          "short": "gb",
          "next": "db.src.app"
        },
        {
          "name": "Dublin",
          "short": "ie",
          "next": "db.src.app"
        },
        {
          "name": "Paris",
          "short": "fr",
          "next": "db.src.app"
        }
      ]
    },
    "db.src.type": {
      "id": "db.src.type",
      "kind": "select",
      "cmd": "copyEnvDB",
      "message": "Enter the number of the environment type: ",
      "src": "src/helpers/amplify-select-environment.ts:65",
      "listSrc": "src/helpers/types.ts:16",
      "def": 0,
      "pre": [
        {
          "k": "log",
          "t": "Select source environment:"
        }
      ],
      "choices": [
        {
          "name": "Development",
          "short": "dv",
          "next": "db.src.region"
        },
        {
          "name": "Demo",
          "short": "dm",
          "next": "db.src.region"
        },
        {
          "name": "Production",
          "short": "pd",
          "next": "db.src.region"
        }
      ]
    },
    "db.dst.env": {
      "id": "db.dst.env",
      "kind": "select",
      "cmd": "copyEnvDB",
      "message": "Choose your environment:",
      "src": "src/helpers/amplify-select-environment.ts:112",
      "listSrc": "src/helpers/amplify-select-environment.ts:8",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listBackendEnvs.select"
      ],
      "choices": [
        {
          "name": "{{shrdgbdv}}",
          "next": "db.run",
          "emit": [
            {
              "k": "log",
              "t": "Destination environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvjuliet}}'"
            },
            {
              "k": "sim",
              "t": "}"
            }
          ]
        },
        {
          "name": "{{gbdvfoxtrot}}",
          "next": "db.run",
          "emit": [
            {
              "k": "log",
              "t": "Destination environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvjuliet}}'"
            },
            {
              "k": "sim",
              "t": "}"
            }
          ]
        },
        {
          "name": "{{gbdvjuliet}}",
          "next": "db.run",
          "emit": [
            {
              "k": "log",
              "t": "Destination environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvjuliet}}'"
            },
            {
              "k": "sim",
              "t": "}"
            }
          ]
        }
      ]
    },
    "db.dst.app": {
      "id": "db.dst.app",
      "kind": "select",
      "cmd": "copyEnvDB",
      "message": "Select your app: ",
      "src": "src/helpers/amplify-select-environment.ts:101",
      "listSrc": "src/helpers/amplify-fetch-region-apps.ts:5",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listApps.region"
      ],
      "choices": [
        {
          "name": "{{app-alpha-development-gb}}",
          "next": "db.dst.env"
        },
        {
          "name": "{{app-bravo-demo-gb}}",
          "next": "db.dst.env"
        },
        {
          "name": "{{app-charlie-production-gb}}",
          "next": "db.dst.env"
        }
      ]
    },
    "db.dst.region": {
      "id": "db.dst.region",
      "kind": "select",
      "cmd": "copyEnvDB",
      "message": "Select your region: ",
      "src": "src/helpers/amplify-select-environment.ts:80",
      "listSrc": "src/helpers/types.ts:46",
      "def": 2,
      "pre": [],
      "choices": [
        {
          "name": "Canada",
          "short": "ca",
          "next": "db.dst.app"
        },
        {
          "name": "US East",
          "short": "us",
          "next": "db.dst.app"
        },
        {
          "name": "London",
          "short": "gb",
          "next": "db.dst.app"
        },
        {
          "name": "Dublin",
          "short": "ie",
          "next": "db.dst.app"
        },
        {
          "name": "Paris",
          "short": "fr",
          "next": "db.dst.app"
        }
      ]
    },
    "db.dst.type": {
      "id": "db.dst.type",
      "kind": "select",
      "cmd": "copyEnvDB",
      "message": "Enter the number of the environment type: ",
      "src": "src/helpers/amplify-select-environment.ts:65",
      "listSrc": "src/helpers/types.ts:16",
      "def": 0,
      "pre": [],
      "choices": [
        {
          "name": "Development",
          "short": "dv",
          "next": "db.dst.region"
        },
        {
          "name": "Demo",
          "short": "dm",
          "next": "db.dst.region"
        },
        {
          "name": "Production",
          "short": "pd",
          "next": "db.dst.region"
        }
      ]
    },
    "db.run": {
      "id": "db.run",
      "kind": "end",
      "cmd": "copyEnvDB",
      "verdict": "wrote",
      "fxPre": [
        "amplify.getBackendEnv",
        "cfn.describeStackResources",
        "cfn.describeStacks",
        "amplify.getBackendEnv",
        "cfn.describeStackResources",
        "cfn.describeStacks",
        "ddb.listTables",
        "ddb.listTables",
        "ddb.scan",
        "ddb.describeTable",
        "ddb.batchWrite",
        "amplify.getBackendEnv",
        "cfn.describeStackResources",
        "cfn.describeStacks",
        "amplify.getBackendEnv",
        "cfn.describeStackResources",
        "cfn.describeStacks",
        "ddb.listTables",
        "ddb.listTables",
        "ddb.scan",
        "ddb.describeTable",
        "ddb.batchWrite"
      ],
      "emit": [
        {
          "k": "log",
          "t": "Transferring from {{-a1b1c1d1e1-gbdvfoxtrot}} to {{-a1b1c1d1e1-gbdvjuliet}}"
        },
        {
          "k": "log",
          "t": "Tables with suffix {{-a1b1c1d1e1-gbdvfoxtrot}}: ["
        },
        {
          "k": "sim",
          "t": "  '{{Alpha-a1b1c1d1e1-gbdvfoxtrot}}', '{{Bravo-a1b1c1d1e1-gbdvfoxtrot}}', '{{Charlie-a1b1c1d1e1-gbdvfoxtrot}}', … {{15 more}}"
        },
        {
          "k": "sim",
          "t": "]"
        },
        {
          "k": "log",
          "t": "Tables with suffix {{-a1b1c1d1e1-gbdvjuliet}}: ["
        },
        {
          "k": "sim",
          "t": "  '{{Alpha-a1b1c1d1e1-gbdvjuliet}}', '{{Bravo-a1b1c1d1e1-gbdvjuliet}}', '{{Charlie-a1b1c1d1e1-gbdvjuliet}}', … {{15 more}}"
        },
        {
          "k": "sim",
          "t": "]"
        },
        {
          "k": "log",
          "t": "Copying data from {{Alpha-a1b1c1d1e1-gbdvfoxtrot}} to {{Alpha-a1b1c1d1e1-gbdvjuliet}}"
        },
        {
          "k": "log",
          "t": "Deleted empty index attribute {{owner}} from {{\"01H9Q4K2ZC\"}}"
        },
        {
          "k": "log",
          "t": "Copying data from {{Bravo-a1b1c1d1e1-gbdvfoxtrot}} to {{Bravo-a1b1c1d1e1-gbdvjuliet}}"
        },
        {
          "k": "log",
          "t": ""
        },
        {
          "k": "log",
          "t": "Source DynamoDB suffix: {{-a1b1c1d1e1-gbdvfoxtrot}}"
        },
        {
          "k": "log",
          "t": "Destination DynamoDB suffix: {{-a1b1c1d1e1-gbdvjuliet}}"
        },
        {
          "k": "log",
          "t": ""
        },
        {
          "k": "log",
          "t": "Ready to transfer data from [object Object]{{-a1b1c1d1e1-gbdvfoxtrot}} to [object Object]{{-a1b1c1d1e1-gbdvjuliet}}"
        },
        {
          "k": "log",
          "t": "Tables with suffix {{-a1b1c1d1e1-gbdvfoxtrot}}: ["
        },
        {
          "k": "sim",
          "t": "  '{{Alpha-a1b1c1d1e1-gbdvfoxtrot}}', '{{Bravo-a1b1c1d1e1-gbdvfoxtrot}}', '{{Charlie-a1b1c1d1e1-gbdvfoxtrot}}', … {{15 more}}"
        },
        {
          "k": "sim",
          "t": "]"
        },
        {
          "k": "log",
          "t": "Copying data from {{Alpha-a1b1c1d1e1-gbdvfoxtrot}} to {{Alpha-a1b1c1d1e1-gbdvjuliet}}"
        }
      ],
      "closing": "The whole copy runs twice. amplifyCopyDatabase does the entire transfer at src/commands/copy-env-db.ts:22, then the command recomputes both suffixes and calls DynamodbTransfer again at line 42 without await, so the second pass is fired into the background where the surrounding try/catch cannot see it fail. The line that reads [object Object] is the source template interpolating a RegionInfo instance."
    },
    "ssm.run": {
      "id": "ssm.run",
      "kind": "end",
      "cmd": "copyEnvVar",
      "verdict": "wrote",
      "fxPre": [
        "amplify.listApps.full",
        "ssm.putParameter.value",
        "ssm.putParameter.value",
        "amplify.listBranches",
        "ssm.putParameter.value",
        "ssm.putParameter.value"
      ],
      "emit": [
        {
          "k": "log",
          "t": "null"
        },
        {
          "k": "log",
          "t": "null"
        },
        {
          "k": "log",
          "t": "null"
        }
      ],
      "closing": "This command takes no input at all: no environment type, no region, no confirmation and no prompt of any kind, so choosing it from the menu is the whole interaction and it goes straight to listing the Amplify apps in eu-west-2 and writing their variables into SSM with Overwrite: true. That listing is one unpaginated ListAppsCommand({}) (src/helpers/amplify-fetch-region-apps.ts:16), so an app that fell off the first page is simply never touched. The only thing it prints is console.log(nextToken) at src/commands/copy-environment-variables-to-ssm.ts:76, once per app. The app-level write passes a hardcoded parameter path rather than app.appId (line 29), so every app it did reach writes its variables to the same place and the last one through wins."
    },
    "pool.src": {
      "id": "pool.src",
      "kind": "input",
      "cmd": "copyCognitoPoolUsers",
      "pre": [
        {
          "k": "log",
          "t": "Using profile: <redacted:aws-profile>"
        }
      ],
      "message": "Enter the source Cognito User Pool ID:",
      "src": "src/commands/copy-cognito-pool-users.ts:12",
      "placeholder": "eu-west-2_A1phaP001",
      "submit": {
        "next": "pool.dst"
      }
    },
    "pool.dst": {
      "id": "pool.dst",
      "kind": "input",
      "cmd": "copyCognitoPoolUsers",
      "message": "Enter the destination Cognito User Pool ID:",
      "src": "src/commands/copy-cognito-pool-users.ts:13",
      "placeholder": "eu-west-2_Br4voP002",
      "submit": {
        "fx": [
          "cognito.export",
          "cognito.rewrite",
          "cognito.import"
        ],
        "emit": [
          {
            "k": "log",
            "t": "Exporting users from: $ANSWER:pool.src"
          },
          {
            "k": "log",
            "t": "Exporting users to: $ANSWER"
          },
          {
            "k": "log",
            "t": "Migration job response: {"
          },
          {
            "k": "sim",
            "t": "  job: {"
          },
          {
            "k": "sim",
            "t": "    JobName: '{{import-000001}}',"
          },
          {
            "k": "sim",
            "t": "    JobId: '{{import-a1b2c3d4}}',"
          },
          {
            "k": "sim",
            "t": "    UserPoolId: '$ANSWER',"
          },
          {
            "k": "sim",
            "t": "    Status: '{{Created}}',"
          },
          {
            "k": "sim",
            "t": "    CloudWatchLogsRoleArn: '<redacted:service-role-arn>'"
          },
          {
            "k": "sim",
            "t": "  },"
          },
          {
            "k": "sim",
            "t": "  users: [ {{1000 records}} ]"
          },
          {
            "k": "sim",
            "t": "}"
          }
        ],
        "next": "pool.done"
      }
    },
    "pool.done": {
      "id": "pool.done",
      "kind": "end",
      "cmd": "copyCognitoPoolUsers",
      "verdict": "wrote",
      "emit": [],
      "closing": "Both pool ids are taken as raw typed text with no validation, no lookup and no confirmation, and the ARN handed to the import job is hardcoded in the file under the comment // FIXME: This should be a parameter from SSM. Between the second Enter and a running import job there is nothing."
    },
    "cog.src.env": {
      "id": "cog.src.env",
      "kind": "select",
      "cmd": "copyCognitoUsers",
      "message": "Choose your environment:",
      "src": "src/helpers/amplify-select-environment.ts:112",
      "listSrc": "src/helpers/amplify-select-environment.ts:8",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listBackendEnvs.select"
      ],
      "choices": [
        {
          "name": "{{shrdgbdv}}",
          "next": "cog.dst.type",
          "emit": [
            {
              "k": "log",
              "t": "Source environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvfoxtrot}}'"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": ""
            },
            {
              "k": "log",
              "t": "Select destination environment:"
            }
          ]
        },
        {
          "name": "{{gbdvfoxtrot}}",
          "next": "cog.dst.type",
          "emit": [
            {
              "k": "log",
              "t": "Source environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvfoxtrot}}'"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": ""
            },
            {
              "k": "log",
              "t": "Select destination environment:"
            }
          ]
        },
        {
          "name": "{{gbdvjuliet}}",
          "next": "cog.dst.type",
          "emit": [
            {
              "k": "log",
              "t": "Source environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvfoxtrot}}'"
            },
            {
              "k": "sim",
              "t": "}"
            },
            {
              "k": "log",
              "t": ""
            },
            {
              "k": "log",
              "t": "Select destination environment:"
            }
          ]
        }
      ]
    },
    "cog.src.app": {
      "id": "cog.src.app",
      "kind": "select",
      "cmd": "copyCognitoUsers",
      "message": "Select your app: ",
      "src": "src/helpers/amplify-select-environment.ts:101",
      "listSrc": "src/helpers/amplify-fetch-region-apps.ts:5",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listApps.region"
      ],
      "choices": [
        {
          "name": "{{app-alpha-development-gb}}",
          "next": "cog.src.env"
        },
        {
          "name": "{{app-bravo-demo-gb}}",
          "next": "cog.src.env"
        },
        {
          "name": "{{app-charlie-production-gb}}",
          "next": "cog.src.env"
        }
      ]
    },
    "cog.src.region": {
      "id": "cog.src.region",
      "kind": "select",
      "cmd": "copyCognitoUsers",
      "message": "Select your region: ",
      "src": "src/helpers/amplify-select-environment.ts:80",
      "listSrc": "src/helpers/types.ts:46",
      "def": 2,
      "pre": [],
      "choices": [
        {
          "name": "Canada",
          "short": "ca",
          "next": "cog.src.app"
        },
        {
          "name": "US East",
          "short": "us",
          "next": "cog.src.app"
        },
        {
          "name": "London",
          "short": "gb",
          "next": "cog.src.app"
        },
        {
          "name": "Dublin",
          "short": "ie",
          "next": "cog.src.app"
        },
        {
          "name": "Paris",
          "short": "fr",
          "next": "cog.src.app"
        }
      ]
    },
    "cog.src.type": {
      "id": "cog.src.type",
      "kind": "select",
      "cmd": "copyCognitoUsers",
      "message": "Enter the number of the environment type: ",
      "src": "src/helpers/amplify-select-environment.ts:65",
      "listSrc": "src/helpers/types.ts:16",
      "def": 0,
      "pre": [
        {
          "k": "log",
          "t": "Select source environment:"
        }
      ],
      "choices": [
        {
          "name": "Development",
          "short": "dv",
          "next": "cog.src.region"
        },
        {
          "name": "Demo",
          "short": "dm",
          "next": "cog.src.region"
        },
        {
          "name": "Production",
          "short": "pd",
          "next": "cog.src.region"
        }
      ]
    },
    "cog.dst.env": {
      "id": "cog.dst.env",
      "kind": "select",
      "cmd": "copyCognitoUsers",
      "message": "Choose your environment:",
      "src": "src/helpers/amplify-select-environment.ts:112",
      "listSrc": "src/helpers/amplify-select-environment.ts:8",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listBackendEnvs.select"
      ],
      "choices": [
        {
          "name": "{{shrdgbdv}}",
          "next": "cog.run",
          "emit": [
            {
              "k": "log",
              "t": "Destination environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvjuliet}}'"
            },
            {
              "k": "sim",
              "t": "}"
            }
          ]
        },
        {
          "name": "{{gbdvfoxtrot}}",
          "next": "cog.run",
          "emit": [
            {
              "k": "log",
              "t": "Destination environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvjuliet}}'"
            },
            {
              "k": "sim",
              "t": "}"
            }
          ]
        },
        {
          "name": "{{gbdvjuliet}}",
          "next": "cog.run",
          "emit": [
            {
              "k": "log",
              "t": "Destination environment details: {"
            },
            {
              "k": "sim",
              "t": "  environmentType: EnvironmentType {"
            },
            {
              "k": "sim",
              "t": "    name: 'Development',"
            },
            {
              "k": "sim",
              "t": "    shortCode: 'dv',"
            },
            {
              "k": "sim",
              "t": "    value: 'dev',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  region: RegionInfo {"
            },
            {
              "k": "sim",
              "t": "    name: 'London',"
            },
            {
              "k": "sim",
              "t": "    code: 'gb',"
            },
            {
              "k": "sim",
              "t": "    awsRegion: 'eu-west-2',"
            },
            {
              "k": "sim",
              "t": "    isDefault: true"
            },
            {
              "k": "sim",
              "t": "  },"
            },
            {
              "k": "sim",
              "t": "  sharedEnvName: 'shrdgbdv',"
            },
            {
              "k": "sim",
              "t": "  app: { name: '{{app-alpha-development-gb}}', id: '{{d1alpha0000001}}' },"
            },
            {
              "k": "sim",
              "t": "  selectedEnvironmentName: '{{gbdvjuliet}}'"
            },
            {
              "k": "sim",
              "t": "}"
            }
          ]
        }
      ]
    },
    "cog.dst.app": {
      "id": "cog.dst.app",
      "kind": "select",
      "cmd": "copyCognitoUsers",
      "message": "Select your app: ",
      "src": "src/helpers/amplify-select-environment.ts:101",
      "listSrc": "src/helpers/amplify-fetch-region-apps.ts:5",
      "def": 0,
      "pre": [],
      "fxPre": [
        "amplify.listApps.region"
      ],
      "choices": [
        {
          "name": "{{app-alpha-development-gb}}",
          "next": "cog.dst.env"
        },
        {
          "name": "{{app-bravo-demo-gb}}",
          "next": "cog.dst.env"
        },
        {
          "name": "{{app-charlie-production-gb}}",
          "next": "cog.dst.env"
        }
      ]
    },
    "cog.dst.region": {
      "id": "cog.dst.region",
      "kind": "select",
      "cmd": "copyCognitoUsers",
      "message": "Select your region: ",
      "src": "src/helpers/amplify-select-environment.ts:80",
      "listSrc": "src/helpers/types.ts:46",
      "def": 2,
      "pre": [],
      "choices": [
        {
          "name": "Canada",
          "short": "ca",
          "next": "cog.dst.app"
        },
        {
          "name": "US East",
          "short": "us",
          "next": "cog.dst.app"
        },
        {
          "name": "London",
          "short": "gb",
          "next": "cog.dst.app"
        },
        {
          "name": "Dublin",
          "short": "ie",
          "next": "cog.dst.app"
        },
        {
          "name": "Paris",
          "short": "fr",
          "next": "cog.dst.app"
        }
      ]
    },
    "cog.dst.type": {
      "id": "cog.dst.type",
      "kind": "select",
      "cmd": "copyCognitoUsers",
      "message": "Enter the number of the environment type: ",
      "src": "src/helpers/amplify-select-environment.ts:65",
      "listSrc": "src/helpers/types.ts:16",
      "def": 0,
      "pre": [],
      "choices": [
        {
          "name": "Development",
          "short": "dv",
          "next": "cog.dst.region"
        },
        {
          "name": "Demo",
          "short": "dm",
          "next": "cog.dst.region"
        },
        {
          "name": "Production",
          "short": "pd",
          "next": "cog.dst.region"
        }
      ]
    },
    "cog.run": {
      "id": "cog.run",
      "kind": "end",
      "cmd": "copyCognitoUsers",
      "verdict": "wrote",
      "fxPre": [
        "backend.getBackend",
        "backend.getBackend",
        "cognito.export",
        "cognito.rewrite",
        "cognito.import"
      ],
      "emit": [
        {
          "k": "log",
          "t": "Using profile: <redacted:aws-profile>"
        },
        {
          "k": "log",
          "t": "Exporting users from: {{eu-west-2_A1phaP001}}"
        },
        {
          "k": "log",
          "t": "Exporting users to: {{eu-west-2_Br4voP002}}"
        }
      ],
      "closing": "amplifyCopyEnvUsers is called at src/commands/copy-amplify-users.ts:24 without await, so the command returns while the migration is still running and the try/catch wrapped around it cannot catch anything the migration throws. Every record is rewritten before import, with cognito:username set to the user’s email address (src/helpers/cognito-migrate-users.ts:24)."
    },
    "app.abortBuild": {
      "id": "app.abortBuild",
      "kind": "end",
      "cmd": "createNewApp",
      "emit": [],
      "verdict": "caught",
      "closing": "Answering no to the build does not back the command out. runBuild returns undefined when you decline (src/commands/create-new-app.ts:60), the caller then tests that undefined for a job id and throws Invalid build response two lines later at 330, so the command lands in its own catch with the app, the environment, the branch, the domain and the allow-list already written, and the only thing yes would have changed is whether a build ran on top of them."
    }
  },
  "configMatrix": {
    "keys": [
      {
        "k": "AMPLIFY_DESTRUCTIVE_UPDATES",
        "where": "app.default.*.json · environmentVariables",
        "v": [
          "\"true\"",
          "\"true\"",
          "\"false\""
        ]
      },
      {
        "k": "AMPLIFY_ENABLE_DEBUG_OUTPUT",
        "where": "app.default.*.json · environmentVariables",
        "v": [
          "\"false\"",
          "\"false\"",
          "\"false\""
        ]
      },
      {
        "k": "BUILD_ID",
        "where": "app.default.*.json · environmentVariables",
        "v": [
          "\"0.1.0\"",
          "\"0.1.0\"",
          "not set"
        ]
      },
      {
        "k": "enableBranchAutoBuild",
        "where": "app.default.*.json",
        "v": [
          "true",
          "true",
          "true"
        ]
      },
      {
        "k": "enableBranchAutoDeletion",
        "where": "app.default.*.json",
        "v": [
          "true",
          "false",
          "false"
        ]
      },
      {
        "k": "autoBranchCreationPatterns",
        "where": "app.default.*.json",
        "v": [
          "<redacted:branch-pattern> × 4",
          "[\"BRANCH_CREATION_PATTERNS\"]",
          "[\"BRANCH_CREATION_PATTERNS\"]"
        ]
      },
      {
        "k": "autoBranchCreationConfig.stage",
        "where": "app.default.*.json",
        "v": [
          "\"DEVELOPMENT\"",
          "\"DEVELOPMENT\"",
          "\"PRODUCTION\""
        ]
      },
      {
        "k": "branchName",
        "where": "branch.default.*.json",
        "v": [
          "\"dev\"",
          "\"demo\"",
          "\"stage\""
        ]
      },
      {
        "k": "stage",
        "where": "branch.default.*.json",
        "v": [
          "\"PRODUCTION\"",
          "\"PRODUCTION\"",
          "\"PRODUCTION\""
        ]
      },
      {
        "k": "subDomainSettings[0].branchName",
        "where": "domain.default.*.json",
        "v": [
          "\"dev\"",
          "\"demo\"",
          "\"stage\""
        ]
      },
      {
        "k": "the whole file",
        "where": "environment.default.*.json",
        "v": [
          "{}",
          "{}",
          "{}"
        ]
      }
    ],
    "cols": [
      "development",
      "demo",
      "production"
    ]
  },
  "findings": [
    {
      "t": "The first thing it does is rewrite your AWS config",
      "f": "src/aws/login.ts:45",
      "c": "Before the menu appears, updateProfileInConfig reads ~/.aws/config, matches the profile block with new RegExp(`\\\\[profile ${AWS_PROFILE}\\\\][\\\\s\\\\S]*?(?=\\\\[|$)`, 'g') and writes the whole file back. Anything of yours that the regex swallowed is gone."
    },
    {
      "t": "The role is always the widest one",
      "f": "src/index.ts:59",
      "c": "Login has a narrower default parameter, and runCLI calls Login('AdministratorAccess'), so the role written into the profile is administrator every time."
    },
    {
      "t": "Every yes/no question is pre-answered yes",
      "f": "src/helpers/command-line-inputs.ts:14",
      "c": "All thirteen confirmations go through one function: confirm({ message: query, default: true }). Inquirer renders that as (Y/n) and a bare Enter answers yes."
    },
    {
      "t": "The DynamoDB copy runs twice",
      "f": "src/commands/copy-env-db.ts:42",
      "c": "amplifyCopyDatabase performs the whole transfer at line 22. The command then recomputes both suffixes and calls DynamodbTransfer again at line 42 with no await, so the second pass runs outside the try/catch."
    },
    {
      "t": "A log line says deleted where the code writes the word null",
      "f": "src/helpers/dynamodb-transfer.ts:60",
      "c": "clearEmptyIndexes sets a missing or empty index attribute to the literal string 'null' and then logs \"Deleted empty index attribute …\". Nothing is deleted and the destination now holds the four characters n-u-l-l."
    },
    {
      "t": "The suffix is discovered rather than configured",
      "f": "src/helpers/amplify-get-env-dynamodb-suffix.ts:56",
      "c": "GetBackendEnvironment gives the stack name, DescribeStackResources finds the API resource, the physical id is regex-stripped back to a stack name, DescribeStacks reads GraphQLAPIIdOutput and the env parameter, and the suffix comes back as `-${graphqlId}-${envName}`. Every table whose name ends with that string is in scope."
    },
    {
      "t": "The environment name is truncated and never padded",
      "f": "src/helpers/amplify-create-environment-name.ts:23",
      "c": "The name is built as region code plus environment short code plus the cleaned customer name, then cut with .slice(0, 10). A comment says \"If the name is shorter than 2 characters, pad it with x\" and the padding was never written."
    },
    {
      "t": "The app list is only ever one page",
      "f": "src/helpers/amplify-fetch-region-apps.ts:8",
      "c": "Both fetchers send ListAppsCommand({}) and never follow nextToken, while listAllApps in the same codebase does paginate. Whichever apps fell off the first page do not exist as far as these commands are concerned."
    },
    {
      "t": "A secret string is cached under itself",
      "f": "src/helpers/secure-request.ts:20",
      "c": "SecureString encrypts the Bitbucket credential pair with AES-256-GCM and PBKDF2 at 100,000 iterations, then caches the instance in a Map keyed by the plaintext, so the plaintext stays resident for the life of the process."
    },
    {
      "t": "An HTTP error page parses as a token response",
      "f": "src/helpers/secure-request.ts:78",
      "c": "secureHttpsRequest resolves on the response body without ever reading the status code and sets no timeout."
    },
    {
      "t": "Three calls are never awaited",
      "f": "src/commands/copy-amplify-users.ts:24",
      "c": "The user migration, the second database transfer and the third-party redirect-URI POST are all fired without await, so each one escapes the try/catch that was written to contain it."
    },
    {
      "t": "Two functions disagree about one string",
      "f": "src/helpers/amplify-wait-for-job.ts:35",
      "c": "AmplifyWaitForJob only ends its loop on COMPLETED or FAILED and its caller only proceeds on SUCCEED (src/commands/create-new-app.ts:346), so the database clone at the end of Create New Amplify App cannot be reached."
    },
    {
      "t": "The compiled binary reads its config from the source folder",
      "f": "src/helpers/read-json-file.ts:3",
      "c": "Config paths are built with path.join(path.resolve(), 'src/config/…'), so dist/index.js looks for src/config relative to whatever directory you happen to be standing in."
    },
    {
      "t": "Two filenames are misspelled and imported that way",
      "f": "src/helpers/",
      "c": "The files are called ampify-create-env-with-branch.ts and amplify-clone-envrionment.ts, and both are imported under those spellings, so both work."
    },
    {
      "t": "There is no history and no tests",
      "f": "package.json",
      "c": "npm test is echo \"Error: no test specified\" && exit 1. There is no .git directory, no README and no documentation, and all 46 source files carry the same modification timestamp. It does type-check clean under strict."
    },
    {
      "t": "Two entry points nothing imports",
      "f": "src/headless/",
      "c": "There is a HeadlessCreateDevelopmentEnvironment and a second copy of CloneEnvironment with the prompts stripped out, and nothing in the repository imports either of them. The first also passes region.code where every other call site passes region.awsRegion."
    },
    {
      "t": "One dependency is never used and one used dependency is never declared",
      "f": "package.json",
      "c": "zx is a declared dependency and is imported nowhere. @aws-sdk/credential-provider-sso is imported by the client provider and is not in the dependency list, so it resolves only as a transitive install."
    },
    {
      "t": "A client that is built and never called",
      "f": "src/aws/aws-client-provider.ts:52",
      "c": "The provider builds six AWS clients and caches them per ClassName-region, and getSecretsManagerClient is defined but called from nowhere."
    }
  ]
}
