{"id":18105,"library":"amplify-cli-core","title":"Amplify CLI Core","description":"Core library for AWS Amplify CLI, providing shared utilities, configuration management, and API abstractions used by all Amplify CLI plugins. Current stable version is 4.0.4. Part of the Amplify CLI monorepo which releases roughly weekly. Key differentiators: provides centralized error handling, feature flags, and path management for the CLI ecosystem. Unlike @aws-amplify/cli which is the CLI entry point, this package is the internal toolkit for plugin authors and extension developers.","status":"active","version":"4.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/aws-amplify/amplify-cli","tags":["javascript","graphql","appsync","aws","typescript"],"install":[{"cmd":"npm install amplify-cli-core","lang":"bash","label":"npm"},{"cmd":"yarn add amplify-cli-core","lang":"bash","label":"yarn"},{"cmd":"pnpm add amplify-cli-core","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This is the main context type passed through all Amplify CLI plugin commands.","wrong":"import { $TSContext } from 'aws-amplify'","symbol":"$TSContext","correct":"import { $TSContext } from 'amplify-cli-core'"},{"note":"Utility for JSON parsing/writing with Amplify-specific handling.","wrong":"import { JSONUtilities } from 'amplify-cli'","symbol":"JSONUtilities","correct":"import { JSONUtilities } from 'amplify-cli-core'"},{"note":"Manages file paths for Amplify project structure. Commonly used for accessing backend-config, team-provider-info, etc.","symbol":"PathManager","correct":"import { PathManager } from 'amplify-cli-core'"},{"note":"Singleton for reading and writing Amplify CLI state files (e.g., local-env-info.json, backend-config.json).","symbol":"stateManager","correct":"import { stateManager } from 'amplify-cli-core'"}],"quickstart":{"code":"import { $TSContext, stateManager, JSONUtilities, PathManager } from 'amplify-cli-core';\n\nasync function getBackendConfig(context: $TSContext) {\n  const backendConfigPath = PathManager.getBackendConfigFilePath();\n  const backendConfig = stateManager.getBackendConfig(undefined, {\n    throwIfNotExist: false,\n  });\n  if (!backendConfig) {\n    context.print.warning('No backend config found.');\n    return null;\n  }\n  return JSONUtilities.parse(JSON.stringify(backendConfig)) as Record<string, any>;\n}","lang":"typescript","description":"Demonstrates importing core types and utilities to read Amplify project's backend configuration."},"warnings":[{"fix":"Update your plugin code to use new context properties: context.amplify.getCategoryPluginInfo vs context.pluginPlatform.","message":"The $TSContext type changed significantly between v3 and v4. The 'amplify' property now has a different shape.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Replace stateManager.getResourceStatus() with stateManager.getCurrentResourceStatus() — the new method returns a different object structure.","message":"stateManager.getResourceStatus() deprecated in v4. Use stateManager.getCurrentResourceStatus() instead.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Wrap JSONUtilities.parse calls in try/catch or use the safeParse option available in v4+.","message":"JSONUtilities.parse can throw on malformed JSON — always wrap in try/catch unless you're certain of input.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install the entire Amplify CLI: npm install -g @aws-amplify/cli. The core package is bundled and not meant for direct external consumption.","cause":"The package is internal and not published to npm separately from the Amplify CLI monorepo.","error":"Cannot find module 'amplify-cli-core'"},{"fix":"Ensure you have an active Amplify project and are running within a plugin command that receives $TSContext. Do not import stateManager standalone.","cause":"stateManager was not properly initialized; typically occurs when called outside an Amplify CLI plugin context.","error":"TypeError: stateManager.getBackendConfig is not a function"},{"fix":"Update amplify-cli-core to v4 and regenerate TypeScript types. Also update peer imports: context.amplify is now context.amplify (still valid) but its methods have changed.","cause":"Using a newer version of the CLI (v4+) with old typescript definitions from v3.","error":"Property 'amplify' does not exist on type '$TSContext'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}