The `accent-cli` package provides a robust command-line interface for seamless interaction with an Accent localization instance. It empowers developers to automate critical localization workflows, including synchronizing translation files, managing project configurations, and executing custom hooks directly from the terminal or within CI/CD pipelines. The current stable version is 0.17.0, and it follows a semantic versioning approach, with updates released to introduce new features, improve stability, and address bug fixes in alignment with the Accent platform's development. A key differentiator is its deep integration with the Accent platform, supporting various localization file formats such as JSON and `.strings`. It offers highly flexible configuration via a dedicated `accent.json` file, which supports powerful glob-pattern matching for file paths, and environment variables for sensitive data like API keys and URLs, providing secure and adaptable deployment options.
npm install accent-cliVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to execute `accent-cli` commands programmatically from a Node.js application using the `child_process.exec` function. It includes the creation of a temporary `accent.json` configuration file and a dummy localization file to simulate a project setup, runs the `accent sync` command, and then cleans up the generated temporary files and directories.
Always check your active environment variables if the configuration specified in `accent.json` appears to be ignored. Explicitly unset environment variables if you intend for `accent.json` values to take effect, or consistently manage configuration through a single source.
Before upgrading `accent-cli`, review the official documentation for any breaking changes related to command arguments or configuration. For automated scripts, consider pinning to a specific minor version (e.g., `^0.17.x`) and thoroughly testing upgrades in a staging environment.
Thoroughly test your glob patterns, especially for complex file structures. Consult the `node-glob` library documentation for advanced pattern matching. Use `accent --help [command]` for command-specific options that might assist in debugging file paths or dry runs if available.
Carefully review all commands defined within the `hooks` section of your `accent.json`. Ensure that any commands are from trusted sources, do not process untrusted user input, and are executed with the minimum necessary permissions. Consider running `accent-cli` in a sandboxed or containerized environment for critical workflows.
Ensure that the `ACCENT_API_KEY` environment variable is set to your valid Accent API key, or add an `"apiKey": "YOUR_API_KEY"` entry to your `accent.json` file.
Verify the command name is spelled correctly. Use `accent --help` to list all available commands and their usage. If the command should exist, ensure you have the latest stable version of `accent-cli` or a version where the command is supported.
Open your `accent.json` file and meticulously review its JSON syntax. Pay close attention to commas between properties, correctly balanced brackets and braces, and properly quoted string values. Utilize a JSON linter or an IDE with JSON validation to quickly identify and correct the syntax error.