@absolutejs/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +93 -0
- package/README.md +136 -0
- package/bin/absolutejs.js +3 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.js +660 -0
- package/dist/cli.js.map +15 -0
- package/dist/commands/deploy.d.ts +20 -0
- package/dist/commands/env.d.ts +20 -0
- package/dist/commands/secrets.d.ts +21 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +10 -0
- package/dist/loadConfig.d.ts +12 -0
- package/dist/utils/output.d.ts +10 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
**Licensor:** Alex Kahn
|
|
4
|
+
|
|
5
|
+
**Licensed Work:** @absolutejs/cli (https://github.com/absolutejs/cli)
|
|
6
|
+
|
|
7
|
+
**Change Date:** May 31, 2030
|
|
8
|
+
|
|
9
|
+
**Change License:** Apache License, Version 2.0
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Terms
|
|
14
|
+
|
|
15
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
16
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
17
|
+
Licensor may make an Additional Use Grant, permitting limited production use.
|
|
18
|
+
|
|
19
|
+
### Additional Use Grant
|
|
20
|
+
|
|
21
|
+
You may use the Licensed Work in production, provided your use does not include
|
|
22
|
+
any of the following:
|
|
23
|
+
|
|
24
|
+
1. **Offering a Competing Service.** You may not offer the Licensed Work, or
|
|
25
|
+
any derivative or substantial portion of it, to third parties as a hosted or
|
|
26
|
+
managed Platform-as-a-Service (PaaS) control plane that competes with a
|
|
27
|
+
hosted PaaS CLI / control-plane surface (including, but not limited to,
|
|
28
|
+
Vercel CLI, Railway CLI, Fly CLI, Render CLI, Heroku CLI, Cloudflare
|
|
29
|
+
Workers CLI, Supabase CLI, AWS Amplify CLI, Convex CLI, or any similar
|
|
30
|
+
hosted offering whose primary value to its users is deploy orchestration,
|
|
31
|
+
secrets propagation, environment-variable management, or rollback over a
|
|
32
|
+
managed PaaS). This includes any product whose primary value to its users
|
|
33
|
+
is the functionality the Licensed Work provides.
|
|
34
|
+
|
|
35
|
+
2. **Resale or Redistribution as a Standalone Product.** You may not sell,
|
|
36
|
+
license, or distribute the Licensed Work, or any derivative or fork of it,
|
|
37
|
+
as a standalone commercial product.
|
|
38
|
+
|
|
39
|
+
3. **Removal of Attribution.** Any derivative work, fork, or redistribution of
|
|
40
|
+
the Licensed Work must prominently credit AbsoluteJS and include a link to
|
|
41
|
+
the original project repository (https://github.com/absolutejs/cli).
|
|
42
|
+
|
|
43
|
+
For clarity, the following uses are expressly permitted:
|
|
44
|
+
|
|
45
|
+
- Using the Licensed Work to operate your own infrastructure or your own
|
|
46
|
+
customers' deployments (whether commercial or non-commercial), so long as
|
|
47
|
+
the Licensed Work itself is not the primary product you are selling.
|
|
48
|
+
- Using the Licensed Work as a dependency in commercial software you build and
|
|
49
|
+
sell, as long as the software is not itself a competing managed PaaS of the
|
|
50
|
+
kind described in clause 1.
|
|
51
|
+
- Providing consulting, development, or professional services to clients using
|
|
52
|
+
the Licensed Work.
|
|
53
|
+
- Forking and modifying the Licensed Work for your own internal use, provided
|
|
54
|
+
attribution is maintained.
|
|
55
|
+
|
|
56
|
+
### Change Date and Change License
|
|
57
|
+
|
|
58
|
+
On the Change Date specified above, or on such other date as the Licensor may
|
|
59
|
+
specify by written notice, the Licensed Work will be made available under the
|
|
60
|
+
Change License (Apache License, Version 2.0). Until the Change Date, the terms
|
|
61
|
+
of this Business Source License 1.1 apply.
|
|
62
|
+
|
|
63
|
+
### Trademark
|
|
64
|
+
|
|
65
|
+
This license does not grant you any rights to use the "AbsoluteJS" or
|
|
66
|
+
"@absolutejs" name, logo, or any related trademarks. Forks and derivative works
|
|
67
|
+
must not be named or branded in a manner that suggests endorsement by or
|
|
68
|
+
affiliation with AbsoluteJS or the Licensor.
|
|
69
|
+
|
|
70
|
+
### Notices
|
|
71
|
+
|
|
72
|
+
You must not remove or obscure any licensing, copyright, or other notices
|
|
73
|
+
included in the Licensed Work.
|
|
74
|
+
|
|
75
|
+
### No Warranty
|
|
76
|
+
|
|
77
|
+
THE LICENSED WORK IS PROVIDED "AS IS". THE LICENSOR HEREBY DISCLAIMS ALL
|
|
78
|
+
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
|
79
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO
|
|
80
|
+
EVENT SHALL THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY,
|
|
81
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR
|
|
82
|
+
IN CONNECTION WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE
|
|
83
|
+
LICENSED WORK.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Contact
|
|
88
|
+
|
|
89
|
+
For commercial licensing inquiries or additional permissions, contact:
|
|
90
|
+
|
|
91
|
+
- **Alex Kahn**
|
|
92
|
+
- alexkahndev@gmail.com
|
|
93
|
+
- alexkahndev.github.io
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# @absolutejs/cli
|
|
2
|
+
|
|
3
|
+
Substrate CLI for the AbsoluteJS PaaS. Verbs over
|
|
4
|
+
[`@absolutejs/secrets`](https://github.com/absolutejs/secrets) and
|
|
5
|
+
[`@absolutejs/deploy`](https://github.com/absolutejs/deploy):
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
absolutejs secrets list list secret names + fingerprints
|
|
9
|
+
absolutejs secrets rotate STRIPE_KEY generate + persist a new value
|
|
10
|
+
absolutejs env push prod push resolved env file to a stage
|
|
11
|
+
absolutejs env diff prod see what `env push` would change
|
|
12
|
+
absolutejs deploy rollback prod roll back to the previous release
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Sibling to [`@absolutejs/absolute`](https://github.com/absolutejs/absolute)
|
|
16
|
+
(framework CLI: `dev`, `start`, `compile`, etc.). They're complementary —
|
|
17
|
+
`absolute` is `dev/build/codegen`, `absolutejs` is `secrets/env/deploy`.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bun add -d @absolutejs/cli
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The `absolutejs` binary lands in `node_modules/.bin/`. Run via `bunx
|
|
26
|
+
absolutejs`, `npx absolutejs`, or alias it in your shell.
|
|
27
|
+
|
|
28
|
+
## Config — `absolutejs.config.ts`
|
|
29
|
+
|
|
30
|
+
Drop one in your project root. The CLI walks up from the cwd to find it.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { defineConfig } from '@absolutejs/cli';
|
|
34
|
+
import {
|
|
35
|
+
createSecretBroker,
|
|
36
|
+
encryptedFileAdapter,
|
|
37
|
+
} from '@absolutejs/secrets';
|
|
38
|
+
import { hetznerTarget } from '@absolutejs/deploy/hetzner';
|
|
39
|
+
import { createDeployer } from '@absolutejs/deploy';
|
|
40
|
+
|
|
41
|
+
const adapter = encryptedFileAdapter({
|
|
42
|
+
path: './.secrets.enc.json',
|
|
43
|
+
key: {
|
|
44
|
+
type: 'passphrase',
|
|
45
|
+
passphrase: process.env.SECRETS_MASTER!,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const broker = createSecretBroker({ adapter });
|
|
50
|
+
|
|
51
|
+
const prodTarget = () =>
|
|
52
|
+
hetznerTarget({
|
|
53
|
+
token: process.env.HETZNER_TOKEN!,
|
|
54
|
+
name: 'api-prod-1',
|
|
55
|
+
region: 'nbg1',
|
|
56
|
+
serverType: 'cx22',
|
|
57
|
+
image: 'ubuntu-22.04',
|
|
58
|
+
sshKeys: [process.env.HETZNER_KEY_FINGERPRINT!],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export default defineConfig({
|
|
62
|
+
secrets: broker,
|
|
63
|
+
secretAdapter: adapter,
|
|
64
|
+
deployments: [
|
|
65
|
+
{
|
|
66
|
+
name: 'prod',
|
|
67
|
+
target: prodTarget,
|
|
68
|
+
remotePath: '/etc/api.env',
|
|
69
|
+
secretNames: ['DATABASE_URL', 'STRIPE_KEY'],
|
|
70
|
+
extras: { NODE_ENV: 'production' },
|
|
71
|
+
reload: 'systemctl reload api',
|
|
72
|
+
deployer: async () =>
|
|
73
|
+
createDeployer({
|
|
74
|
+
appName: 'api',
|
|
75
|
+
target: await prodTarget(),
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The `target` and `deployer` fields are LAZY (`() => …`). Verbs that
|
|
83
|
+
don't touch a remote (`secrets list`, `secrets set`) never invoke
|
|
84
|
+
them — `absolutejs secrets list` won't accidentally provision a
|
|
85
|
+
Hetzner box.
|
|
86
|
+
|
|
87
|
+
## Commands
|
|
88
|
+
|
|
89
|
+
### `secrets`
|
|
90
|
+
|
|
91
|
+
| Verb | Description |
|
|
92
|
+
| --- | --- |
|
|
93
|
+
| `list` | Print every name + fingerprint from the adapter. Plaintext never appears. |
|
|
94
|
+
| `get <name> [--show]` | Resolve one secret. Default prints `fingerprint=` only; `--show` prints plaintext. |
|
|
95
|
+
| `set <NAME>=<value>` | Put a value via the configured adapter. |
|
|
96
|
+
| `rotate <name>` | Call `broker.rotate(name)` — generates a new value, persists, fires `onRotate` listeners. |
|
|
97
|
+
|
|
98
|
+
### `env`
|
|
99
|
+
|
|
100
|
+
| Verb | Description |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| `push <stage>` | Resolve `secretNames` + `extras` for the stage, atomic-write the remote env file, run `reload`. |
|
|
103
|
+
| `pull <stage>` | Read the remote env file as-is. |
|
|
104
|
+
| `diff <stage> [--all]` | Show added/changed/removed keys between what `push` would write and what's currently on the remote. `--all` also lists unchanged keys. |
|
|
105
|
+
|
|
106
|
+
### `deploy`
|
|
107
|
+
|
|
108
|
+
| Verb | Description |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| `releases <stage>` | List release history for a stage. |
|
|
111
|
+
| `status <stage>` | Current release id + recent history. |
|
|
112
|
+
| `rollback <stage> [--to <id>]` | Roll back to `--to` or the previous release. |
|
|
113
|
+
|
|
114
|
+
### Global flags
|
|
115
|
+
|
|
116
|
+
- `--json` — machine-readable output.
|
|
117
|
+
- `--help` — top-level banner.
|
|
118
|
+
|
|
119
|
+
## Composition with the rotation loop
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Rotate STRIPE_KEY in the broker.
|
|
123
|
+
absolutejs secrets rotate STRIPE_KEY
|
|
124
|
+
|
|
125
|
+
# Push to every deployment that uses it.
|
|
126
|
+
absolutejs env push prod
|
|
127
|
+
absolutejs env push staging
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
`broker.rotate` fires the in-process `onRotate` listeners (long-lived
|
|
131
|
+
DB clients swap creds in place); `env push` propagates to the remote
|
|
132
|
+
boxes and reloads the services.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
BSL-1.1 with named carveout. Change date: 2030-05-31 (Apache 2.0).
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `absolutejs` binary entry. Parses argv, loads
|
|
3
|
+
* `absolutejs.config.ts`, dispatches to a verb handler.
|
|
4
|
+
*
|
|
5
|
+
* Hand-rolled arg parser — no commander/yargs dep, keeping with the
|
|
6
|
+
* substrate's zero-peer-dep posture.
|
|
7
|
+
*/
|
|
8
|
+
export type ParsedArgs = {
|
|
9
|
+
command: string | undefined;
|
|
10
|
+
verb: string | undefined;
|
|
11
|
+
positional: string[];
|
|
12
|
+
flags: Record<string, string | boolean>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Parse `argv` into command + verb + positional + flags.
|
|
16
|
+
*
|
|
17
|
+
* Conventions:
|
|
18
|
+
* absolutejs <command> <verb> <pos...> [--flag] [--flag=value] [--flag value]
|
|
19
|
+
*
|
|
20
|
+
* Bare `--flag` becomes `{flag: true}`. `--flag=value` and `--flag value`
|
|
21
|
+
* both become `{flag: value}`. Positional args don't start with `-`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const parseArgs: (argv: string[]) => ParsedArgs;
|
|
24
|
+
export declare const main: (argv: string[]) => Promise<number>;
|