Registry / aws / amplify-cli-core

amplify-cli-core

JSON →
library4.0.4jsnpmunverified

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.

npm install amplify-cli-core
INSTALL
IMPORT
SIG · AMPLIFY-CLI-CORE
A
amplify-cli-core
awsjavascriptv4.0.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

$TSContext
import { $TSContext } from 'amplify-cli-core'
import { $TSContext } from 'aws-amplify'
This is the main context type passed through all Amplify CLI plugin commands.
JSONUtilities
import { JSONUtilities } from 'amplify-cli-core'
import { JSONUtilities } from 'amplify-cli'
Utility for JSON parsing/writing with Amplify-specific handling.
PathManager
import { PathManager } from 'amplify-cli-core'
Manages file paths for Amplify project structure. Commonly used for accessing backend-config, team-provider-info, etc.
stateManager
import { stateManager } from 'amplify-cli-core'
Singleton for reading and writing Amplify CLI state files (e.g., local-env-info.json, backend-config.json).

Demonstrates importing core types and utilities to read Amplify project's backend configuration.

import { $TSContext, stateManager, JSONUtilities, PathManager } from 'amplify-cli-core'; async function getBackendConfig(context: $TSContext) { const backendConfigPath = PathManager.getBackendConfigFilePath(); const backendConfig = stateManager.getBackendConfig(undefined, { throwIfNotExist: false, }); if (!backendConfig) { context.print.warning('No backend config found.'); return null; } return JSONUtilities.parse(JSON.stringify(backendConfig)) as Record<string, any>; }
Debug
Known issues
breakingThe $TSContext type changed significantly between v3 and v4. The 'amplify' property now has a different shape.
fix
Update your plugin code to use new context properties: context.amplify.getCategoryPluginInfo vs context.pluginPlatform.
affects: >=4.0.0
deprecatedstateManager.getResourceStatus() deprecated in v4. Use stateManager.getCurrentResourceStatus() instead.
fix
Replace stateManager.getResourceStatus() with stateManager.getCurrentResourceStatus() — the new method returns a different object structure.
affects: >=4.0.0
gotchaJSONUtilities.parse can throw on malformed JSON — always wrap in try/catch unless you're certain of input.
fix
Wrap JSONUtilities.parse calls in try/catch or use the safeParse option available in v4+.
affects: *
Errors
Common errors & fixes
Cannot find module 'amplify-cli-core'
The package is internal and not published to npm separately from the Amplify CLI monorepo.
fix
Install the entire Amplify CLI: npm install -g @aws-amplify/cli. The core package is bundled and not meant for direct external consumption.
TypeError: stateManager.getBackendConfig is not a function
stateManager was not properly initialized; typically occurs when called outside an Amplify CLI plugin context.
fix
Ensure you have an active Amplify project and are running within a plugin command that receives $TSContext. Do not import stateManager standalone.
Property 'amplify' does not exist on type '$TSContext'
Using a newer version of the CLI (v4+) with old typescript definitions from v3.
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.
Upgrade
Version history
4.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
44 hits · last 30 days
node
38
OpenAI (training)
1
Resources
amplify-cli-core — npm install amplify-cli-core · libregistry