@ossy/cli 1.17.7 → 1.17.9
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/README.md +0 -20
- package/package.json +4 -4
- package/src/index.js +0 -18
- package/src/registry/cli.js +0 -16
- package/src/registry/ecr-push-credentials.js +0 -109
package/README.md
CHANGED
|
@@ -37,7 +37,6 @@ The contract for everything the platform can do is the **SDK action POJO** in [`
|
|
|
37
37
|
| Workflow | `app upload` | Read `resourceTemplates` from `src/config.js` and call `workspaces.import-resource-templates` |
|
|
38
38
|
| Workflow | `app publish` | Upload resource templates and `build/` to the CMS (combines `app upload` + `upload-dir`) |
|
|
39
39
|
| Workflow | `upload-dir <dir> <location>` | Recursively mirror a local directory into the CMS (mkdir + upload per file) |
|
|
40
|
-
| Workflow | `registry ecr-push-credentials` | Call `registry.ecr-push-credentials`, format for `docker login` or GitHub Actions |
|
|
41
40
|
|
|
42
41
|
If you need an endpoint that no verb wraps, reach for `ossy call` — it's the universal channel.
|
|
43
42
|
|
|
@@ -271,25 +270,6 @@ ossy upload-dir ./assets /projects/2026/assets
|
|
|
271
270
|
ossy upload-dir ./public /my-folder --api-url http://localhost:3001/api/v0
|
|
272
271
|
```
|
|
273
272
|
|
|
274
|
-
## Registry: ecr-push-credentials
|
|
275
|
-
|
|
276
|
-
Fetch a short-lived ECR password so CI can `docker login` and `docker push` to the workspace's ECR registry.
|
|
277
|
-
|
|
278
|
-
Wraps the SDK action **`registry.ecr-push-credentials`** and adds: response validation, JSON pretty-printing, and a `--format github-actions` mode that writes `registry`/`username`/`password`/`expires_at` to `$GITHUB_OUTPUT` and emits `::add-mask::<password>` so the secret never appears in logs.
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
ossy registry ecr-push-credentials # JSON to stdout
|
|
282
|
-
ossy registry ecr-push-credentials --format github-actions # writes to $GITHUB_OUTPUT
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Auth and workspace are resolved from the usual chain (`-a` flag → `OSSY_API_KEY` → saved credentials; `-w` flag → `OSSY_WORKSPACE_ID` → saved active workspace). The plain dispatcher equivalent is:
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
ossy call registry.ecr-push-credentials
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
…but you lose the GitHub Actions output formatting and the `::add-mask::` line, so prefer the verb in CI.
|
|
292
|
-
|
|
293
273
|
## App: init
|
|
294
274
|
|
|
295
275
|
Scaffold a new Ossy app:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/cli",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ossy-se/packages.git"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/parser": "^7.28.6",
|
|
23
|
-
"@ossy/app": "^1.17.
|
|
24
|
-
"@ossy/sdk": "^1.17.
|
|
23
|
+
"@ossy/app": "^1.17.9",
|
|
24
|
+
"@ossy/sdk": "^1.17.9",
|
|
25
25
|
"arg": "^5.0.2",
|
|
26
26
|
"glob": "^10.3.10"
|
|
27
27
|
},
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"/src",
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "295c9447b738f39dc81a9f250f06acc97efa76b9"
|
|
37
37
|
}
|
package/src/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { fileURLToPath } from 'node:url'
|
|
|
5
5
|
import * as Auth from './auth/cli.js'
|
|
6
6
|
import * as Call from './call/cli.js'
|
|
7
7
|
import * as App from './app/cli.js'
|
|
8
|
-
import * as Registry from './registry/cli.js'
|
|
9
8
|
import * as UploadDir from './upload-dir/cli.js'
|
|
10
9
|
import * as Workspace from './workspace/cli.js'
|
|
11
10
|
|
|
@@ -30,8 +29,6 @@ Action dispatcher (any Ossy SDK action, no per-action wiring needed):
|
|
|
30
29
|
|
|
31
30
|
Workflows (wrap one or more actions with extra ergonomics):
|
|
32
31
|
upload-dir <dir> <loc> Recursively upload a local directory to the CMS
|
|
33
|
-
registry <subcommand> ecr-push-credentials (wraps registry.ecr-push-credentials,
|
|
34
|
-
adds --format github-actions and password masking)
|
|
35
32
|
|
|
36
33
|
Options:
|
|
37
34
|
-h, --help Show this help, or for a command: ossy <command> --help
|
|
@@ -91,17 +88,6 @@ Options:
|
|
|
91
88
|
-a, --authentication Ossy API JWT (or set OSSY_API_KEY, or run \`ossy auth login\`)
|
|
92
89
|
-w, --workspace-id Workspace id (or set OSSY_WORKSPACE_ID, or run \`ossy workspace use\`)
|
|
93
90
|
--api-url Override API base URL
|
|
94
|
-
`,
|
|
95
|
-
registry: `ossy registry <subcommand>
|
|
96
|
-
Subcommands:
|
|
97
|
-
ecr-push-credentials Fetch a short-lived ECR password for docker login
|
|
98
|
-
(wraps the SDK action registry.ecr-push-credentials;
|
|
99
|
-
adds --format github-actions and password masking)
|
|
100
|
-
|
|
101
|
-
Options:
|
|
102
|
-
-a, --authentication Ossy API JWT (or set OSSY_API_KEY, or run \`ossy auth login\`)
|
|
103
|
-
-w, --workspace-id Workspace id (or set OSSY_WORKSPACE_ID, or run \`ossy workspace use\`)
|
|
104
|
-
--format json | github-actions
|
|
105
91
|
`,
|
|
106
92
|
}
|
|
107
93
|
|
|
@@ -142,10 +128,6 @@ const run = async () => {
|
|
|
142
128
|
await UploadDir.handler(restArgs)
|
|
143
129
|
return
|
|
144
130
|
}
|
|
145
|
-
if (command === 'registry') {
|
|
146
|
-
await Registry.handler(restArgs)
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
131
|
if (command === 'app') {
|
|
150
132
|
await App.handler(restArgs)
|
|
151
133
|
return
|
package/src/registry/cli.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ecrPushCredentials } from './ecr-push-credentials.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {string[]} args argv after `registry`
|
|
5
|
-
*/
|
|
6
|
-
export async function handler (args) {
|
|
7
|
-
const [sub, ...rest] = args
|
|
8
|
-
if (sub === 'ecr-push-credentials') {
|
|
9
|
-
await ecrPushCredentials(rest)
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
console.error(
|
|
13
|
-
'[@ossy/cli] registry: unknown subcommand. Usage: registry ecr-push-credentials [--format json|github-actions] ...'
|
|
14
|
-
)
|
|
15
|
-
process.exit(1)
|
|
16
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import arg from 'arg'
|
|
2
|
-
import { appendFileSync } from 'fs'
|
|
3
|
-
import { requireAppAuthentication } from '../app/upload-resource-templates.js'
|
|
4
|
-
import { getAuth, getWorkspaceId } from '../state.js'
|
|
5
|
-
|
|
6
|
-
const DEFAULT_API_URL = 'https://api.ossy.se/api/v0'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* POST /registry/ecr/push-credentials and print docker/registry fields.
|
|
10
|
-
*
|
|
11
|
-
* @param {string[]} options argv after `registry ecr-push-credentials`
|
|
12
|
-
*/
|
|
13
|
-
export async function ecrPushCredentials (options) {
|
|
14
|
-
const parsed = arg(
|
|
15
|
-
{
|
|
16
|
-
'--authentication': String,
|
|
17
|
-
'-a': '--authentication',
|
|
18
|
-
'--workspace-id': String,
|
|
19
|
-
'-w': '--workspace-id',
|
|
20
|
-
'--api-url': String,
|
|
21
|
-
'--format': String,
|
|
22
|
-
},
|
|
23
|
-
{ argv: options }
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
let token
|
|
27
|
-
try {
|
|
28
|
-
token = requireAppAuthentication(
|
|
29
|
-
getAuth({ flag: parsed['--authentication'] }),
|
|
30
|
-
'registry ecr-push-credentials'
|
|
31
|
-
)
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.error(e?.message || '[@ossy/cli] registry ecr-push-credentials: need --authentication (-a), OSSY_API_KEY, or `ossy auth login`')
|
|
34
|
-
process.exit(1)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const workspaceId = getWorkspaceId({ flag: parsed['--workspace-id'] })
|
|
38
|
-
if (!workspaceId) {
|
|
39
|
-
console.error('[@ossy/cli] registry ecr-push-credentials: pass --workspace-id (-w), set OSSY_WORKSPACE_ID, or run `ossy workspace use <id>`')
|
|
40
|
-
process.exit(1)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const apiUrl = (parsed['--api-url'] || process.env.OSSY_API_URL || DEFAULT_API_URL).replace(/\/$/, '')
|
|
44
|
-
const format = parsed['--format'] || 'json'
|
|
45
|
-
|
|
46
|
-
const res = await fetch(`${apiUrl}/registry/ecr/push-credentials`, {
|
|
47
|
-
method: 'POST',
|
|
48
|
-
headers: {
|
|
49
|
-
authorization: token,
|
|
50
|
-
workspaceId,
|
|
51
|
-
'content-type': 'application/json',
|
|
52
|
-
},
|
|
53
|
-
body: '{}',
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const text = await res.text()
|
|
57
|
-
let data
|
|
58
|
-
try {
|
|
59
|
-
data = JSON.parse(text)
|
|
60
|
-
} catch {
|
|
61
|
-
console.error(`[@ossy/cli] registry ecr-push-credentials: non-JSON response (${res.status})`)
|
|
62
|
-
console.error(text)
|
|
63
|
-
process.exit(1)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (!res.ok) {
|
|
67
|
-
console.error(`[@ossy/cli] registry ecr-push-credentials: HTTP ${res.status}`)
|
|
68
|
-
console.error(text)
|
|
69
|
-
process.exit(1)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const { registry, username, password, expiresAt } = data
|
|
73
|
-
if (
|
|
74
|
-
typeof registry !== 'string' ||
|
|
75
|
-
!registry ||
|
|
76
|
-
typeof username !== 'string' ||
|
|
77
|
-
!username ||
|
|
78
|
-
typeof password !== 'string' ||
|
|
79
|
-
!password
|
|
80
|
-
) {
|
|
81
|
-
console.error('[@ossy/cli] registry ecr-push-credentials: invalid response (expected registry, username, password)')
|
|
82
|
-
console.error(JSON.stringify(data))
|
|
83
|
-
process.exit(1)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (format === 'github-actions') {
|
|
87
|
-
const out = process.env.GITHUB_OUTPUT
|
|
88
|
-
if (!out) {
|
|
89
|
-
console.error('[@ossy/cli] registry ecr-push-credentials: --format github-actions requires GITHUB_OUTPUT')
|
|
90
|
-
process.exit(1)
|
|
91
|
-
}
|
|
92
|
-
console.log(`::add-mask::${password}`)
|
|
93
|
-
appendFileSync(out, `registry=${registry}\n`, 'utf8')
|
|
94
|
-
appendFileSync(out, `username=${username}\n`, 'utf8')
|
|
95
|
-
appendFileSync(out, `password=${password}\n`, 'utf8')
|
|
96
|
-
if (expiresAt != null) {
|
|
97
|
-
appendFileSync(out, `expires_at=${String(expiresAt)}\n`, 'utf8')
|
|
98
|
-
}
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (format === 'json') {
|
|
103
|
-
console.log(JSON.stringify({ registry, username, password, expiresAt }, null, 2))
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
console.error(`[@ossy/cli] registry ecr-push-credentials: unknown --format ${format} (use json or github-actions)`)
|
|
108
|
-
process.exit(1)
|
|
109
|
-
}
|