AutoHotkey is a powerful tool for scripting automations on Windows,
but managing dependencies for your scripts is painful.
ahkpm
brings modern package management to AutoHotkey,
making it easier than ever to automate away the drudgery.
Full documentation can be found at ahkpm.dev
Usage:
ahkpm [flags]
ahkpm [command]
Available Commands:
cache Manipulates the packages cache
help Help about any command
init Interactively create an ahkpm.json file in the current directory
install Installs specified package(s). If none, reinstalls all packages in ahkpm.json.
list List all installed packages and their versions
update Update package(s) to the latest version allowed by ahkpm.json
version Bumps the version in ahkpm.json.
Flags:
-h, --help help for ahkpm
-v, --version Display the version of ahkpm and AutoHotkey
To install ahkpm:
- Go to the releases page and find the most recent version.
- Download the
ahkpm-{version}.msi
file. - Open it on your Windows machine to launch the ahkpm installer.
- Open the command line and navigate to the directory which will contain your AutoHotkey script.
- Run
ahkpm init
and answer the prompts to create anahkpm.json
file - Run
ahkpm install <package>@<version>
- The package can be any github repository in the form:
github.com/user/repo
, or a shorthand in the formgh:user/repo
- The version can be any of the following:
- A valid semantic version such as
1.0.0
- A valid semantic version range such as
2.x.x
- The prefix
tag:
followed by the name of a tag in the package's repository, such astag:beta2
- The prefix
branch:
followed by the name of a branch in the package's repository, such asbranch:main
- The prefix
commit:
followed by the hash of a commit in the package's repository, such ascommit:badcce14f8e828cda4d8ac404a12448700de1441
- Omitting the version is not yet supported
- A valid semantic version such as
- The package can be any github repository in the form:
- Add
#Include, %A_ScriptDir%
to the top of your script to set the current directory as the context for subsequent includes - Add
#Include, ahkpm-modules\github.com\user\repo\main-file.ahk
to your script - You can now use the package's functionality within your AutoHotkey script!
ahkpm is being actively developed, but it is still a young project. As a result it has the following limitations.
- It only supports hosting and downloading of packages on GitHub, though other git hosts will be supported in the future.
- It does not (yet) handle problems with conflicting versions of transitive dependencies
If you'd like to help remedy these limitations, consider contributing!
See the contribution guidelines
This file is where the user of ahkpm declares their dependencies and other package data.
{
"version": "0.0.1",
"description": "A brief description of what the package does",
// URL for the package's git repository
"repository": "github.com/user/my-project",
// URL for the package's main website
"website": "example.com",
// The SPDX License identifier for the package's software license
"license": "MIT",
// URL for users to file bugs/issues for the package
"issueTracker": "github.com/user/my-project/issues",
// The primary file which users of the package should "Include" to use it in their scripts
"include": "example.ahk",
// Information about the primary author of the package
"author": {
"name": "joshuacc",
"email": "",
"website": "joshuaclanton.dev"
},
// Lists all dependencies along with the required version
"dependencies": {
"github.com/user/repo1": "1.0.0",
"github.com/user/repo2": "tag:beta2",
"github.com/user/repo3": "branch:main",
"github.com/user/repo4": "commit:badcce14f8e828cda4d8ac404a12448700de1441"
}
}
This file is automatically generated by ahkpm and should not be edited.
{
"lockfileVersion": 1,
// This should exactly match ahkpm.json unless ahkpm.json has been manually edited
"dependencies": {
"github.com/joshuacc/mock-ahkpm-package-a": "branch:main",
},
"resolved": [
{
"name": "github.com/joshuacc/mock-ahkpm-package-a",
"version": "branch:main",
"sha": "c5b8f8d0d0d1e5c9a5f7f8b8b5c9a5f7f8b8b5c9a",
"installPath": "ahkpm-modules/github.com/joshuacc/mock-ahkpm-package-a",
"dependencies": {
"github.com/joshuacc/mock-ahkpm-package-b": "^1.0.0"
}
},
{
"name": "github.com/joshuacc/mock-ahkpm-package-b",
"version": "1.0.2",
"installPath": "ahkpm-modules/github.com/joshuacc/mock-ahkpm-package-a/ahkpm-modules/github.com/joshuacc/mock-ahkpm-package-b",
"sha": "c5b8f8d0d0d1e5c9a5f7f8b8b5c9a5f7f8b8b5c9a",
"dependencies": {}
}
]
}