@kitsy/cnos-cli 1.8.2 → 1.8.4
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/dist/index.js +27 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -802,7 +802,10 @@ async function defineValue(namespace, configPath, rawValue, options = {}) {
|
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
804
|
async function setSecret(configPath, rawValue, options = {}) {
|
|
805
|
-
const runtime = await createRuntimeService(
|
|
805
|
+
const runtime = await createRuntimeService({
|
|
806
|
+
...options,
|
|
807
|
+
secretResolution: "lazy"
|
|
808
|
+
});
|
|
806
809
|
const workspaceRoot = getSelectedWorkspaceRoot(options, runtime);
|
|
807
810
|
const profile = options.profile ?? runtime.graph.profile;
|
|
808
811
|
const filePath = resolveConfigDocumentPath(workspaceRoot, "secret", configPath, profile);
|
|
@@ -843,7 +846,10 @@ async function setSecret(configPath, rawValue, options = {}) {
|
|
|
843
846
|
}
|
|
844
847
|
async function deleteSecret(configPath, options = {}) {
|
|
845
848
|
await assertWritableConfigRoot(`delete secret.${configPath}`, options);
|
|
846
|
-
const runtime = await createRuntimeService(
|
|
849
|
+
const runtime = await createRuntimeService({
|
|
850
|
+
...options,
|
|
851
|
+
secretResolution: "lazy"
|
|
852
|
+
});
|
|
847
853
|
const workspaceRoot = getSelectedWorkspaceRoot(options, runtime);
|
|
848
854
|
const profile = options.profile ?? runtime.graph.profile;
|
|
849
855
|
const filePath = resolveConfigDocumentPath(workspaceRoot, "secret", configPath, profile);
|
|
@@ -2914,7 +2920,10 @@ function toStoredEntry(namespace, entry, filter = {}) {
|
|
|
2914
2920
|
};
|
|
2915
2921
|
}
|
|
2916
2922
|
async function listStoredNamespace(namespace, options) {
|
|
2917
|
-
const runtime = await createRuntimeService(
|
|
2923
|
+
const runtime = await createRuntimeService({
|
|
2924
|
+
...options,
|
|
2925
|
+
...namespace === "secret" ? { secretResolution: "lazy" } : {}
|
|
2926
|
+
});
|
|
2918
2927
|
return Array.from(runtime.graph.entries.values()).filter((entry) => entry.namespace === namespace).map((entry) => {
|
|
2919
2928
|
const stored = toStoredEntry(namespace, entry, options);
|
|
2920
2929
|
if (!stored) {
|
|
@@ -4012,21 +4021,21 @@ async function authenticateVault(name, options = {}) {
|
|
|
4012
4021
|
const auth = await resolveVaultAuth2(vault, definition, options.processEnv ?? process.env);
|
|
4013
4022
|
const storeRoot = resolveSecretStoreRoot2(options.processEnv);
|
|
4014
4023
|
if (definition.provider === "local") {
|
|
4015
|
-
if (!auth.passphrase) {
|
|
4016
|
-
throw new Error(`Vault "${vault}" requires passphrase-based authentication.`);
|
|
4017
|
-
}
|
|
4018
4024
|
const metadata = await readVaultMetadata(storeRoot, vault);
|
|
4019
4025
|
if (!metadata) {
|
|
4020
4026
|
throw new Error(
|
|
4021
4027
|
`Vault "${vault}" has not been initialized yet. Run cnos vault create ${vault} first.`
|
|
4022
4028
|
);
|
|
4023
4029
|
}
|
|
4024
|
-
const derivedKey = deriveVaultKey(auth.passphrase, Buffer.from(metadata.salt, "base64"), metadata.iterations);
|
|
4030
|
+
const derivedKey = auth.derivedKey ?? (auth.passphrase ? deriveVaultKey(auth.passphrase, Buffer.from(metadata.salt, "base64"), metadata.iterations) : void 0);
|
|
4031
|
+
if (!derivedKey) {
|
|
4032
|
+
throw new Error(`Vault "${vault}" requires passphrase-based authentication.`);
|
|
4033
|
+
}
|
|
4025
4034
|
await listLocalSecrets(
|
|
4026
4035
|
storeRoot,
|
|
4027
4036
|
{
|
|
4028
4037
|
derivedKey,
|
|
4029
|
-
method: auth.method,
|
|
4038
|
+
method: auth.derivedKey ? auth.method : "passphrase",
|
|
4030
4039
|
...definition.auth?.config ? { config: definition.auth.config } : {}
|
|
4031
4040
|
},
|
|
4032
4041
|
vault
|
|
@@ -4191,7 +4200,10 @@ async function runSecret(argsOrPath, options = {}) {
|
|
|
4191
4200
|
return runVault(["create", tail[0] ?? "default"], options);
|
|
4192
4201
|
}
|
|
4193
4202
|
if (action === "list") {
|
|
4194
|
-
const runtime2 = await createRuntimeService(
|
|
4203
|
+
const runtime2 = await createRuntimeService({
|
|
4204
|
+
...options,
|
|
4205
|
+
secretResolution: "lazy"
|
|
4206
|
+
});
|
|
4195
4207
|
const prefix = consumeOption(cliArgs, "--prefix");
|
|
4196
4208
|
const vault = consumeOption(cliArgs, "--vault");
|
|
4197
4209
|
const provider = consumeOption(cliArgs, "--provider");
|
|
@@ -4254,12 +4266,16 @@ async function runSecret(argsOrPath, options = {}) {
|
|
|
4254
4266
|
}
|
|
4255
4267
|
return result.deleted ? `deleted secret.${secretPath2} from ${displayPath(result.filePath, root)}` : `no secret.${secretPath2} found in ${displayPath(result.filePath, root)}`;
|
|
4256
4268
|
}
|
|
4257
|
-
const runtime = await createRuntimeService(
|
|
4269
|
+
const runtime = await createRuntimeService({
|
|
4270
|
+
...options,
|
|
4271
|
+
secretResolution: "lazy"
|
|
4272
|
+
});
|
|
4258
4273
|
const secretPath = tail[0] ?? "app.token";
|
|
4259
4274
|
const expectedVault = consumeOption(cliArgs, "--vault");
|
|
4260
4275
|
const reveal = consumeFlag(cliArgs, "--reveal");
|
|
4261
4276
|
const entry = runtime.graph.entries.get(`secret.${secretPath}`);
|
|
4262
4277
|
const secretRef = entry?.winner.metadata?.secretRef;
|
|
4278
|
+
await runtime.refreshSecret(`secret.${secretPath}`);
|
|
4263
4279
|
const value = runtime.secret(secretPath);
|
|
4264
4280
|
if (value === void 0) {
|
|
4265
4281
|
throw new Error(`Missing CNOS secret path: ${secretPath}`);
|
|
@@ -4318,7 +4334,7 @@ async function runValidate(options = {}) {
|
|
|
4318
4334
|
// package.json
|
|
4319
4335
|
var package_default = {
|
|
4320
4336
|
name: "@kitsy/cnos-cli",
|
|
4321
|
-
version: "1.8.
|
|
4337
|
+
version: "1.8.4",
|
|
4322
4338
|
description: "CLI entry point and developer tooling for CNOS.",
|
|
4323
4339
|
type: "module",
|
|
4324
4340
|
main: "./dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitsy/cnos-cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "CLI entry point and developer tooling for CNOS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"smol-toml": "^1.4.2",
|
|
40
|
-
"@kitsy/cnos": "1.8.
|
|
40
|
+
"@kitsy/cnos": "1.8.4"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsup src/index.ts --format esm --dts",
|