@buildwithharbor/pier 0.1.7 → 0.1.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/dist/index.js +824 -1002
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -57019,6 +57019,143 @@ var dnsContract = {
|
|
|
57019
57019
|
updateRecord: contractBuilder2.mutation().input(dnsRecordMutationInputSchema).output(dnsRecordOutputSchema)
|
|
57020
57020
|
};
|
|
57021
57021
|
|
|
57022
|
+
// ../api-contract/src/env.ts
|
|
57023
|
+
init_zod();
|
|
57024
|
+
var envValueErrors = {
|
|
57025
|
+
NO_APP_TARGETS_FOR_SECRET: {
|
|
57026
|
+
message: "No app targets for secret",
|
|
57027
|
+
status: 400
|
|
57028
|
+
},
|
|
57029
|
+
ENV_VALUE_RECORD_MISSING: {
|
|
57030
|
+
data: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
57031
|
+
message: "Environment value record missing",
|
|
57032
|
+
status: 500
|
|
57033
|
+
},
|
|
57034
|
+
ENV_REPLACE_REQUIRES_FORCE: {
|
|
57035
|
+
data: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
57036
|
+
message: "Environment replacement requires --force",
|
|
57037
|
+
status: 400
|
|
57038
|
+
},
|
|
57039
|
+
ENV_VALUE_NOT_FOUND: {
|
|
57040
|
+
data: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
57041
|
+
message: "Environment value was not found",
|
|
57042
|
+
status: 404
|
|
57043
|
+
}
|
|
57044
|
+
};
|
|
57045
|
+
var listEnvValuesInput = exports_external.object({
|
|
57046
|
+
environment: exports_external.string().optional(),
|
|
57047
|
+
manifest: pierManifestSchema
|
|
57048
|
+
});
|
|
57049
|
+
var envValuesInput = listEnvValuesInput.extend({
|
|
57050
|
+
actor: exports_external.string().optional(),
|
|
57051
|
+
app: exports_external.string().optional()
|
|
57052
|
+
});
|
|
57053
|
+
var getEnvValueInput = envValuesInput.extend({
|
|
57054
|
+
name: exports_external.string()
|
|
57055
|
+
});
|
|
57056
|
+
var envDownloadFormatSchema = exports_external.enum(["env", "json", "shell", "yaml"]);
|
|
57057
|
+
var downloadEnvValuesInput = envValuesInput.extend({
|
|
57058
|
+
format: envDownloadFormatSchema.default("env")
|
|
57059
|
+
});
|
|
57060
|
+
var resolveEnvValuesForRunInput = envValuesInput;
|
|
57061
|
+
var setEnvValueInput = exports_external.object({
|
|
57062
|
+
actor: exports_external.string().optional(),
|
|
57063
|
+
app: exports_external.string().optional(),
|
|
57064
|
+
environment: exports_external.string().optional(),
|
|
57065
|
+
manifest: pierManifestSchema,
|
|
57066
|
+
name: exports_external.string(),
|
|
57067
|
+
source: exports_external.string().optional(),
|
|
57068
|
+
value: exports_external.string()
|
|
57069
|
+
});
|
|
57070
|
+
var uploadEnvValuesInput = envValuesInput.extend({
|
|
57071
|
+
dryRun: exports_external.boolean().optional(),
|
|
57072
|
+
force: exports_external.boolean().optional(),
|
|
57073
|
+
replace: exports_external.boolean().optional(),
|
|
57074
|
+
values: exports_external.record(exports_external.string(), exports_external.string())
|
|
57075
|
+
});
|
|
57076
|
+
var deleteEnvValueInput = setEnvValueInput.omit({ value: true });
|
|
57077
|
+
var envValueListItemSchema = exports_external.object({
|
|
57078
|
+
app: exports_external.string().optional(),
|
|
57079
|
+
environment: exports_external.string(),
|
|
57080
|
+
kind: exports_external.enum(["boolean", "json", "number", "string"]),
|
|
57081
|
+
name: exports_external.string(),
|
|
57082
|
+
projectSlug: exports_external.string(),
|
|
57083
|
+
sensitive: exports_external.boolean(),
|
|
57084
|
+
updatedAt: exports_external.string(),
|
|
57085
|
+
updatedBy: exports_external.string()
|
|
57086
|
+
});
|
|
57087
|
+
var listEnvValuesOutputSchema = exports_external.object({
|
|
57088
|
+
values: exports_external.array(envValueListItemSchema)
|
|
57089
|
+
});
|
|
57090
|
+
var downloadEnvValuesOutputSchema = exports_external.object({
|
|
57091
|
+
count: exports_external.number().int().nonnegative(),
|
|
57092
|
+
environment: exports_external.string(),
|
|
57093
|
+
format: envDownloadFormatSchema,
|
|
57094
|
+
ok: exports_external.literal(true),
|
|
57095
|
+
projectSlug: exports_external.string(),
|
|
57096
|
+
value: exports_external.string()
|
|
57097
|
+
});
|
|
57098
|
+
var resolveEnvValuesForRunOutputSchema = exports_external.object({
|
|
57099
|
+
environment: exports_external.string(),
|
|
57100
|
+
ok: exports_external.literal(true),
|
|
57101
|
+
projectSlug: exports_external.string(),
|
|
57102
|
+
values: exports_external.record(exports_external.string(), exports_external.string())
|
|
57103
|
+
});
|
|
57104
|
+
var getEnvValueOutputSchema = exports_external.object({
|
|
57105
|
+
environment: exports_external.string(),
|
|
57106
|
+
name: exports_external.string(),
|
|
57107
|
+
projectSlug: exports_external.string(),
|
|
57108
|
+
value: exports_external.string()
|
|
57109
|
+
});
|
|
57110
|
+
var setEnvValueOutputSchema = exports_external.object({
|
|
57111
|
+
name: exports_external.string(),
|
|
57112
|
+
ok: exports_external.literal(true),
|
|
57113
|
+
targets: exports_external.array(exports_external.string())
|
|
57114
|
+
});
|
|
57115
|
+
var envValueScopeOutputSchema = exports_external.object({
|
|
57116
|
+
app: exports_external.string().optional(),
|
|
57117
|
+
environment: exports_external.string(),
|
|
57118
|
+
projectSlug: exports_external.string()
|
|
57119
|
+
});
|
|
57120
|
+
var envChangedValueSchema = exports_external.object({
|
|
57121
|
+
action: exports_external.enum(["set", "delete"]),
|
|
57122
|
+
app: exports_external.string().optional(),
|
|
57123
|
+
kind: exports_external.enum(["boolean", "json", "number", "string"]).optional(),
|
|
57124
|
+
name: exports_external.string(),
|
|
57125
|
+
sensitive: exports_external.boolean().optional(),
|
|
57126
|
+
targets: exports_external.array(exports_external.string()).optional()
|
|
57127
|
+
});
|
|
57128
|
+
var envValueWarningSchema = exports_external.object({
|
|
57129
|
+
name: exports_external.string().optional(),
|
|
57130
|
+
reason: exports_external.string()
|
|
57131
|
+
});
|
|
57132
|
+
var uploadEnvValuesOutputSchema = exports_external.object({
|
|
57133
|
+
action: exports_external.literal("upload"),
|
|
57134
|
+
auditPreview: exports_external.array(exports_external.string()),
|
|
57135
|
+
changed: exports_external.array(envChangedValueSchema),
|
|
57136
|
+
dryRun: exports_external.boolean(),
|
|
57137
|
+
ok: exports_external.literal(true),
|
|
57138
|
+
relatedCommands: exports_external.array(exports_external.string()),
|
|
57139
|
+
removed: exports_external.array(envChangedValueSchema),
|
|
57140
|
+
scope: envValueScopeOutputSchema,
|
|
57141
|
+
unchanged: exports_external.array(exports_external.string()),
|
|
57142
|
+
warnings: exports_external.array(envValueWarningSchema)
|
|
57143
|
+
});
|
|
57144
|
+
var deleteEnvValueOutputSchema = exports_external.object({
|
|
57145
|
+
name: exports_external.string(),
|
|
57146
|
+
ok: exports_external.literal(true),
|
|
57147
|
+
targets: exports_external.array(exports_external.string())
|
|
57148
|
+
});
|
|
57149
|
+
var envContract = {
|
|
57150
|
+
delete: contractBuilder2.mutation().input(deleteEnvValueInput).output(deleteEnvValueOutputSchema).errors(envValueErrors),
|
|
57151
|
+
download: contractBuilder2.query().input(downloadEnvValuesInput).output(downloadEnvValuesOutputSchema),
|
|
57152
|
+
get: contractBuilder2.query().input(getEnvValueInput).output(getEnvValueOutputSchema).errors(envValueErrors),
|
|
57153
|
+
list: contractBuilder2.query().input(listEnvValuesInput).output(listEnvValuesOutputSchema),
|
|
57154
|
+
resolveForRun: contractBuilder2.query().input(resolveEnvValuesForRunInput).output(resolveEnvValuesForRunOutputSchema),
|
|
57155
|
+
set: contractBuilder2.mutation().input(setEnvValueInput).output(setEnvValueOutputSchema).errors(envValueErrors),
|
|
57156
|
+
upload: contractBuilder2.mutation().input(uploadEnvValuesInput).output(uploadEnvValuesOutputSchema).errors(envValueErrors)
|
|
57157
|
+
};
|
|
57158
|
+
|
|
57022
57159
|
// ../api-contract/src/environments.ts
|
|
57023
57160
|
init_zod();
|
|
57024
57161
|
var createEnvironmentInput = exports_external.object({
|
|
@@ -57931,7 +58068,14 @@ var projectDeleteInputSchema = exports_external.object({
|
|
|
57931
58068
|
confirmSlug: exports_external.string().min(1),
|
|
57932
58069
|
projectSlug: exports_external.string().min(1)
|
|
57933
58070
|
});
|
|
57934
|
-
var
|
|
58071
|
+
var projectErrors = {
|
|
58072
|
+
PROJECT_ALREADY_EXISTS: {
|
|
58073
|
+
data: exports_external.object({ slug: exports_external.string() }),
|
|
58074
|
+
message: "Project already exists",
|
|
58075
|
+
status: 409
|
|
58076
|
+
}
|
|
58077
|
+
};
|
|
58078
|
+
var projectCreateInputSchema = exports_external.object({
|
|
57935
58079
|
actor: exports_external.string().optional(),
|
|
57936
58080
|
manifest: pierManifestSchema
|
|
57937
58081
|
});
|
|
@@ -57939,14 +58083,14 @@ var projectDeleteOutputSchema = exports_external.object({
|
|
|
57939
58083
|
deletedProject: projectRecordSchema,
|
|
57940
58084
|
ok: exports_external.literal(true)
|
|
57941
58085
|
});
|
|
57942
|
-
var
|
|
58086
|
+
var projectCreateOutputSchema = exports_external.object({
|
|
57943
58087
|
appCount: exports_external.number().int().nonnegative(),
|
|
57944
58088
|
bindingCount: exports_external.number().int().nonnegative(),
|
|
57945
58089
|
project: projectRecordSchema
|
|
57946
58090
|
});
|
|
57947
58091
|
var projectContract = {
|
|
57948
58092
|
delete: contractBuilder2.mutation().input(projectDeleteInputSchema).output(projectDeleteOutputSchema),
|
|
57949
|
-
|
|
58093
|
+
create: contractBuilder2.mutation().input(projectCreateInputSchema).output(projectCreateOutputSchema).errors(projectErrors)
|
|
57950
58094
|
};
|
|
57951
58095
|
|
|
57952
58096
|
// ../api-contract/src/provider.ts
|
|
@@ -58227,148 +58371,6 @@ var providerContract = {
|
|
|
58227
58371
|
cloudflareUsageSummary: contractBuilder2.query().input(cloudflareUsageSummaryInputSchema).output(cloudflareUsageSummaryOutputSchema)
|
|
58228
58372
|
};
|
|
58229
58373
|
|
|
58230
|
-
// ../api-contract/src/secrets.ts
|
|
58231
|
-
init_zod();
|
|
58232
|
-
var secretErrors = {
|
|
58233
|
-
NO_APP_TARGETS_FOR_SECRET: {
|
|
58234
|
-
message: "No app targets for secret",
|
|
58235
|
-
status: 400
|
|
58236
|
-
},
|
|
58237
|
-
SECRET_RECORD_MISSING: {
|
|
58238
|
-
data: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
58239
|
-
message: "Secret record missing",
|
|
58240
|
-
status: 500
|
|
58241
|
-
},
|
|
58242
|
-
SECRET_REPLACE_REQUIRES_FORCE: {
|
|
58243
|
-
data: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
58244
|
-
message: "Secret replacement requires --force",
|
|
58245
|
-
status: 400
|
|
58246
|
-
},
|
|
58247
|
-
SECRET_VALUE_NOT_FOUND: {
|
|
58248
|
-
data: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
58249
|
-
message: "Secret value was not found",
|
|
58250
|
-
status: 404
|
|
58251
|
-
}
|
|
58252
|
-
};
|
|
58253
|
-
var listSecretsInput = exports_external.object({
|
|
58254
|
-
environment: exports_external.string().optional(),
|
|
58255
|
-
manifest: pierManifestSchema
|
|
58256
|
-
});
|
|
58257
|
-
var secretValuesInput = listSecretsInput.extend({
|
|
58258
|
-
actor: exports_external.string().optional(),
|
|
58259
|
-
app: exports_external.string().optional()
|
|
58260
|
-
});
|
|
58261
|
-
var getSecretInput = secretValuesInput.extend({
|
|
58262
|
-
name: exports_external.string()
|
|
58263
|
-
});
|
|
58264
|
-
var secretDownloadFormatSchema = exports_external.enum([
|
|
58265
|
-
"env",
|
|
58266
|
-
"json",
|
|
58267
|
-
"shell",
|
|
58268
|
-
"yaml"
|
|
58269
|
-
]);
|
|
58270
|
-
var downloadSecretsInput = secretValuesInput.extend({
|
|
58271
|
-
format: secretDownloadFormatSchema.default("env")
|
|
58272
|
-
});
|
|
58273
|
-
var resolveSecretsForRunInput = secretValuesInput;
|
|
58274
|
-
var setSecretInput = exports_external.object({
|
|
58275
|
-
actor: exports_external.string().optional(),
|
|
58276
|
-
app: exports_external.string().optional(),
|
|
58277
|
-
environment: exports_external.string().optional(),
|
|
58278
|
-
manifest: pierManifestSchema,
|
|
58279
|
-
name: exports_external.string(),
|
|
58280
|
-
source: exports_external.string().optional(),
|
|
58281
|
-
value: exports_external.string()
|
|
58282
|
-
});
|
|
58283
|
-
var uploadSecretsInput = secretValuesInput.extend({
|
|
58284
|
-
dryRun: exports_external.boolean().optional(),
|
|
58285
|
-
force: exports_external.boolean().optional(),
|
|
58286
|
-
replace: exports_external.boolean().optional(),
|
|
58287
|
-
values: exports_external.record(exports_external.string(), exports_external.string())
|
|
58288
|
-
});
|
|
58289
|
-
var unsetSecretInput = setSecretInput.omit({ value: true });
|
|
58290
|
-
var secretListItemSchema = exports_external.object({
|
|
58291
|
-
app: exports_external.string().optional(),
|
|
58292
|
-
environment: exports_external.string(),
|
|
58293
|
-
kind: exports_external.enum(["boolean", "json", "number", "string"]),
|
|
58294
|
-
name: exports_external.string(),
|
|
58295
|
-
projectSlug: exports_external.string(),
|
|
58296
|
-
sensitive: exports_external.boolean(),
|
|
58297
|
-
updatedAt: exports_external.string(),
|
|
58298
|
-
updatedBy: exports_external.string()
|
|
58299
|
-
});
|
|
58300
|
-
var listSecretsOutputSchema = exports_external.object({
|
|
58301
|
-
values: exports_external.array(secretListItemSchema)
|
|
58302
|
-
});
|
|
58303
|
-
var downloadSecretsOutputSchema = exports_external.object({
|
|
58304
|
-
count: exports_external.number().int().nonnegative(),
|
|
58305
|
-
environment: exports_external.string(),
|
|
58306
|
-
format: secretDownloadFormatSchema,
|
|
58307
|
-
ok: exports_external.literal(true),
|
|
58308
|
-
projectSlug: exports_external.string(),
|
|
58309
|
-
value: exports_external.string()
|
|
58310
|
-
});
|
|
58311
|
-
var resolveSecretsForRunOutputSchema = exports_external.object({
|
|
58312
|
-
environment: exports_external.string(),
|
|
58313
|
-
ok: exports_external.literal(true),
|
|
58314
|
-
projectSlug: exports_external.string(),
|
|
58315
|
-
values: exports_external.record(exports_external.string(), exports_external.string())
|
|
58316
|
-
});
|
|
58317
|
-
var getSecretOutputSchema = exports_external.object({
|
|
58318
|
-
environment: exports_external.string(),
|
|
58319
|
-
name: exports_external.string(),
|
|
58320
|
-
projectSlug: exports_external.string(),
|
|
58321
|
-
value: exports_external.string()
|
|
58322
|
-
});
|
|
58323
|
-
var setSecretOutputSchema = exports_external.object({
|
|
58324
|
-
name: exports_external.string(),
|
|
58325
|
-
ok: exports_external.literal(true),
|
|
58326
|
-
targets: exports_external.array(exports_external.string())
|
|
58327
|
-
});
|
|
58328
|
-
var secretScopeOutputSchema = exports_external.object({
|
|
58329
|
-
app: exports_external.string().optional(),
|
|
58330
|
-
environment: exports_external.string(),
|
|
58331
|
-
projectSlug: exports_external.string()
|
|
58332
|
-
});
|
|
58333
|
-
var secretChangedValueSchema = exports_external.object({
|
|
58334
|
-
action: exports_external.enum(["set", "delete"]),
|
|
58335
|
-
app: exports_external.string().optional(),
|
|
58336
|
-
kind: exports_external.enum(["boolean", "json", "number", "string"]).optional(),
|
|
58337
|
-
name: exports_external.string(),
|
|
58338
|
-
sensitive: exports_external.boolean().optional(),
|
|
58339
|
-
targets: exports_external.array(exports_external.string()).optional()
|
|
58340
|
-
});
|
|
58341
|
-
var secretWarningSchema = exports_external.object({
|
|
58342
|
-
name: exports_external.string().optional(),
|
|
58343
|
-
reason: exports_external.string()
|
|
58344
|
-
});
|
|
58345
|
-
var uploadSecretsOutputSchema = exports_external.object({
|
|
58346
|
-
action: exports_external.literal("upload"),
|
|
58347
|
-
auditPreview: exports_external.array(exports_external.string()),
|
|
58348
|
-
changed: exports_external.array(secretChangedValueSchema),
|
|
58349
|
-
dryRun: exports_external.boolean(),
|
|
58350
|
-
ok: exports_external.literal(true),
|
|
58351
|
-
relatedCommands: exports_external.array(exports_external.string()),
|
|
58352
|
-
removed: exports_external.array(secretChangedValueSchema),
|
|
58353
|
-
scope: secretScopeOutputSchema,
|
|
58354
|
-
unchanged: exports_external.array(exports_external.string()),
|
|
58355
|
-
warnings: exports_external.array(secretWarningSchema)
|
|
58356
|
-
});
|
|
58357
|
-
var unsetSecretOutputSchema = exports_external.object({
|
|
58358
|
-
name: exports_external.string(),
|
|
58359
|
-
ok: exports_external.literal(true),
|
|
58360
|
-
targets: exports_external.array(exports_external.string())
|
|
58361
|
-
});
|
|
58362
|
-
var secretsContract = {
|
|
58363
|
-
download: contractBuilder2.query().input(downloadSecretsInput).output(downloadSecretsOutputSchema),
|
|
58364
|
-
get: contractBuilder2.query().input(getSecretInput).output(getSecretOutputSchema).errors(secretErrors),
|
|
58365
|
-
list: contractBuilder2.query().input(listSecretsInput).output(listSecretsOutputSchema),
|
|
58366
|
-
resolveForRun: contractBuilder2.query().input(resolveSecretsForRunInput).output(resolveSecretsForRunOutputSchema),
|
|
58367
|
-
set: contractBuilder2.mutation().input(setSecretInput).output(setSecretOutputSchema).errors(secretErrors),
|
|
58368
|
-
upload: contractBuilder2.mutation().input(uploadSecretsInput).output(uploadSecretsOutputSchema).errors(secretErrors),
|
|
58369
|
-
unset: contractBuilder2.mutation().input(unsetSecretInput).output(unsetSecretOutputSchema).errors(secretErrors)
|
|
58370
|
-
};
|
|
58371
|
-
|
|
58372
58374
|
// ../api-contract/src/contract.ts
|
|
58373
58375
|
var contractModules = {
|
|
58374
58376
|
account: accountContract,
|
|
@@ -58380,6 +58382,7 @@ var contractModules = {
|
|
|
58380
58382
|
deployments: deploymentsContract,
|
|
58381
58383
|
dns: dnsContract,
|
|
58382
58384
|
domains: domainsContract,
|
|
58385
|
+
env: envContract,
|
|
58383
58386
|
environments: environmentsContract,
|
|
58384
58387
|
integrations: integrationContract,
|
|
58385
58388
|
observability: observabilityContract,
|
|
@@ -58389,7 +58392,6 @@ var contractModules = {
|
|
|
58389
58392
|
planning: planningContract,
|
|
58390
58393
|
provider: providerContract,
|
|
58391
58394
|
projects: projectContract,
|
|
58392
|
-
secrets: secretsContract,
|
|
58393
58395
|
state: stateContract
|
|
58394
58396
|
};
|
|
58395
58397
|
var contract = contractBuilder2.router(contractModules);
|
|
@@ -58627,8 +58629,9 @@ Common commands:
|
|
|
58627
58629
|
pier dev <app-name>
|
|
58628
58630
|
pier deploy all --env prod
|
|
58629
58631
|
pier project status <project-slug>
|
|
58632
|
+
pier project create
|
|
58630
58633
|
pier env types
|
|
58631
|
-
pier
|
|
58634
|
+
pier env upload <dotenv-file> --env <env>
|
|
58632
58635
|
pier logs [search]
|
|
58633
58636
|
pier dns zones
|
|
58634
58637
|
pier connections cloudflare status
|
|
@@ -58638,7 +58641,7 @@ Common commands:
|
|
|
58638
58641
|
pier doctor
|
|
58639
58642
|
|
|
58640
58643
|
Command groups:
|
|
58641
|
-
auth, org, package, project, dev, deploy, env,
|
|
58644
|
+
auth, org, package, project, dev, deploy, env, logs, dns, connections, sync, ops
|
|
58642
58645
|
|
|
58643
58646
|
Run:
|
|
58644
58647
|
pier <command> -h
|
|
@@ -58773,7 +58776,9 @@ var helpPages = {
|
|
|
58773
58776
|
connections: {
|
|
58774
58777
|
title: "Connections",
|
|
58775
58778
|
summary: "Inspect linked provider accounts and organization attachments.",
|
|
58776
|
-
usage: [
|
|
58779
|
+
usage: [
|
|
58780
|
+
"pier connections cloudflare <status|list|inventory|attach> [flags]"
|
|
58781
|
+
],
|
|
58777
58782
|
commands: [
|
|
58778
58783
|
"cloudflare status [--organization-id <id>]",
|
|
58779
58784
|
"cloudflare list [--organization-id <id>]",
|
|
@@ -58919,22 +58924,41 @@ var helpPages = {
|
|
|
58919
58924
|
},
|
|
58920
58925
|
env: {
|
|
58921
58926
|
title: "Environment",
|
|
58922
|
-
summary: "
|
|
58927
|
+
summary: "Manage Pier cloud env values and generate runtime env types.",
|
|
58923
58928
|
usage: ["pier env <command> [args] [flags]"],
|
|
58924
58929
|
commands: [
|
|
58925
|
-
"list [config-path]",
|
|
58930
|
+
"list [config-path] [--env <env>]",
|
|
58931
|
+
"get <name> [config-path] [--env <env>]",
|
|
58932
|
+
"set <NAME=value>... [config-path] [--env <env>]",
|
|
58933
|
+
"delete <name> [config-path] [--env <env>]",
|
|
58934
|
+
"upload <dotenv-file> [config-path] [--env <env>] [--force]",
|
|
58935
|
+
"download [config-path] [--env <env>] [--format <env|json|yaml|shell>]",
|
|
58936
|
+
"run [config-path] [--env <env>] -- <command...>",
|
|
58937
|
+
"environments [config-path]",
|
|
58926
58938
|
"create <name> [config-path]",
|
|
58927
|
-
"values <env> [config-path]",
|
|
58928
58939
|
"types [config-path]"
|
|
58929
58940
|
],
|
|
58930
58941
|
flags: [
|
|
58931
58942
|
"--app <app-name>",
|
|
58932
58943
|
"--api <url|local>",
|
|
58944
|
+
"--config <path>",
|
|
58945
|
+
"--env <env>",
|
|
58946
|
+
"--format <env|json|yaml|shell>",
|
|
58947
|
+
"--force",
|
|
58933
58948
|
"--json",
|
|
58934
|
-
"--
|
|
58949
|
+
"--organization-id <id>",
|
|
58950
|
+
"--output <path>",
|
|
58951
|
+
"--project <slug>"
|
|
58935
58952
|
],
|
|
58936
|
-
examples: [
|
|
58937
|
-
|
|
58953
|
+
examples: [
|
|
58954
|
+
"pier env list",
|
|
58955
|
+
"pier env get PUBLIC_API_URL",
|
|
58956
|
+
"pier env set API_TOKEN=secret --env prod",
|
|
58957
|
+
"pier env delete API_TOKEN --env prod",
|
|
58958
|
+
"pier env upload .env.production --env prod",
|
|
58959
|
+
"pier env run --env dev -- bun test",
|
|
58960
|
+
"pier env types"
|
|
58961
|
+
]
|
|
58938
58962
|
},
|
|
58939
58963
|
export: {
|
|
58940
58964
|
title: "Export",
|
|
@@ -59109,11 +59133,15 @@ var helpPages = {
|
|
|
59109
59133
|
project: {
|
|
59110
59134
|
title: "Project",
|
|
59111
59135
|
summary: "Inspect project readiness, deploy state, URLs, and next commands.",
|
|
59112
|
-
usage: [
|
|
59113
|
-
|
|
59136
|
+
usage: [
|
|
59137
|
+
"pier project status <project-slug> [flags]",
|
|
59138
|
+
"pier project create [config-path] [flags]"
|
|
59139
|
+
],
|
|
59140
|
+
commands: ["status <project-slug> [--env <env>]", "create [config-path]"],
|
|
59114
59141
|
flags: ["--project <slug>", "--env <env>", "--api <url|local>", "--json"],
|
|
59115
59142
|
examples: [
|
|
59116
59143
|
"pier project status pier",
|
|
59144
|
+
"pier project create",
|
|
59117
59145
|
"pier project status pier --env prod --json"
|
|
59118
59146
|
]
|
|
59119
59147
|
},
|
|
@@ -59206,38 +59234,6 @@ var helpPages = {
|
|
|
59206
59234
|
flags: ["--project <slug>", "--env <env>", "--api <url|local>"],
|
|
59207
59235
|
examples: ["pier run -- turbo run build", "pier run -- bun test"]
|
|
59208
59236
|
},
|
|
59209
|
-
secrets: {
|
|
59210
|
-
title: "Secrets",
|
|
59211
|
-
summary: "Manage cloud Pier runtime values declared in platform.config.ts.",
|
|
59212
|
-
usage: ["pier secrets <command> [args] [flags]"],
|
|
59213
|
-
commands: [
|
|
59214
|
-
"list [config-path] [--env <env>]",
|
|
59215
|
-
"get <name> [config-path] [--env <env>]",
|
|
59216
|
-
"set <NAME=value>... [config-path] [--env <env>]",
|
|
59217
|
-
"upload <dotenv-file> [config-path] [--env <env>] [--replace --force]",
|
|
59218
|
-
"download [config-path] [--env <env>] [--format <env|json|yaml|shell>]",
|
|
59219
|
-
"run [config-path] [--env <env>] -- <command...>"
|
|
59220
|
-
],
|
|
59221
|
-
flags: [
|
|
59222
|
-
"--app <app-name>",
|
|
59223
|
-
"--api <url|local>",
|
|
59224
|
-
"--config <path>",
|
|
59225
|
-
"--env <env>",
|
|
59226
|
-
"--format <env|json|yaml|shell>",
|
|
59227
|
-
"--force",
|
|
59228
|
-
"--json",
|
|
59229
|
-
"--output <path>",
|
|
59230
|
-
"--replace"
|
|
59231
|
-
],
|
|
59232
|
-
examples: [
|
|
59233
|
-
"pier secrets list",
|
|
59234
|
-
"pier secrets get PUBLIC_API_URL",
|
|
59235
|
-
"pier secrets list --env prod",
|
|
59236
|
-
"pier secrets set API_TOKEN=secret --env prod",
|
|
59237
|
-
"pier secrets download --env prod --format env --output .env.prod",
|
|
59238
|
-
"pier secrets run --env dev -- bun test"
|
|
59239
|
-
]
|
|
59240
|
-
},
|
|
59241
59237
|
"shared-postgres": {
|
|
59242
59238
|
title: "Shared Postgres",
|
|
59243
59239
|
summary: "Provision shared Postgres schema and role credentials.",
|
|
@@ -61635,7 +61631,7 @@ var formatEnvironmentExplainText = (explain, options = {}) => {
|
|
|
61635
61631
|
].join(`
|
|
61636
61632
|
`);
|
|
61637
61633
|
};
|
|
61638
|
-
var
|
|
61634
|
+
var formatEnvValuesListText = (explain, options = {}) => {
|
|
61639
61635
|
const style = createStyle(options);
|
|
61640
61636
|
const target = [explain.projectSlug, explain.environment, options.app].filter(Boolean).join("/");
|
|
61641
61637
|
return [
|
|
@@ -61780,87 +61776,476 @@ function padVisibleEnd(value, width) {
|
|
|
61780
61776
|
return `${value}${" ".repeat(padding)}`;
|
|
61781
61777
|
}
|
|
61782
61778
|
|
|
61783
|
-
// src/
|
|
61784
|
-
|
|
61785
|
-
const
|
|
61786
|
-
const
|
|
61787
|
-
|
|
61788
|
-
|
|
61789
|
-
|
|
61790
|
-
|
|
61791
|
-
|
|
61792
|
-
|
|
61793
|
-
|
|
61779
|
+
// src/runtime/env-scope.ts
|
|
61780
|
+
function resolveEnvScope(manifest, flags) {
|
|
61781
|
+
const project = resolveProject(manifest, flags);
|
|
61782
|
+
const environment = clean(flags.environment) ?? defaultEnvironment;
|
|
61783
|
+
return {
|
|
61784
|
+
environment,
|
|
61785
|
+
manifest: { ...manifest, project },
|
|
61786
|
+
project
|
|
61787
|
+
};
|
|
61788
|
+
}
|
|
61789
|
+
function resolveProject(manifest, flags) {
|
|
61790
|
+
const explicitProject = clean(flags.project) ?? clean(flags.projectSlug);
|
|
61791
|
+
if (explicitProject) {
|
|
61792
|
+
return {
|
|
61793
|
+
id: explicitProject,
|
|
61794
|
+
organizationId: clean(flags.organizationId) ?? manifest.project?.organizationId ?? "resolved-by-api",
|
|
61795
|
+
slug: explicitProject
|
|
61796
|
+
};
|
|
61794
61797
|
}
|
|
61795
|
-
if (
|
|
61796
|
-
|
|
61797
|
-
|
|
61798
|
-
|
|
61798
|
+
if (manifest.project) {
|
|
61799
|
+
return manifest.project;
|
|
61800
|
+
}
|
|
61801
|
+
const repoProject = clean(manifest.name);
|
|
61802
|
+
if (!repoProject) {
|
|
61803
|
+
throw new Error("Could not resolve a project. Pass --project <slug> or run inside a Pier app repo.");
|
|
61804
|
+
}
|
|
61805
|
+
return {
|
|
61806
|
+
id: repoProject,
|
|
61807
|
+
organizationId: clean(flags.organizationId) ?? "resolved-by-api",
|
|
61808
|
+
slug: repoProject
|
|
61809
|
+
};
|
|
61810
|
+
}
|
|
61811
|
+
function clean(value) {
|
|
61812
|
+
const trimmed = value?.trim();
|
|
61813
|
+
return trimmed ? trimmed : undefined;
|
|
61814
|
+
}
|
|
61815
|
+
|
|
61816
|
+
// src/support/cli-args.ts
|
|
61817
|
+
var valueFlags = new Set([
|
|
61818
|
+
"--api",
|
|
61819
|
+
"--app",
|
|
61820
|
+
"--actor",
|
|
61821
|
+
"--artifact-key",
|
|
61822
|
+
"--actor-type",
|
|
61823
|
+
"--access-key-id",
|
|
61824
|
+
"--account-id",
|
|
61825
|
+
"--alloc-id",
|
|
61826
|
+
"--audit-label",
|
|
61827
|
+
"--api-url",
|
|
61828
|
+
"--before",
|
|
61829
|
+
"--body",
|
|
61830
|
+
"--bucket",
|
|
61831
|
+
"--comment",
|
|
61832
|
+
"--confirm",
|
|
61833
|
+
"--checksum",
|
|
61834
|
+
"--content",
|
|
61835
|
+
"--current-role",
|
|
61836
|
+
"--deployment",
|
|
61837
|
+
"--email",
|
|
61838
|
+
"--endpoint",
|
|
61839
|
+
"--env",
|
|
61840
|
+
"--expires-in-days",
|
|
61841
|
+
"--from-env",
|
|
61842
|
+
"--format",
|
|
61843
|
+
"--id",
|
|
61844
|
+
"--kind",
|
|
61845
|
+
"--key-prefix",
|
|
61846
|
+
"--limit",
|
|
61847
|
+
"--linked-account-id",
|
|
61848
|
+
"--name",
|
|
61849
|
+
"--next-role",
|
|
61850
|
+
"--operation",
|
|
61851
|
+
"--operations",
|
|
61852
|
+
"--organization-id",
|
|
61853
|
+
"--out",
|
|
61854
|
+
"--outpost",
|
|
61855
|
+
"--outpost-id",
|
|
61856
|
+
"--output",
|
|
61857
|
+
"--package",
|
|
61858
|
+
"--package-scope",
|
|
61859
|
+
"--preset",
|
|
61860
|
+
"--project",
|
|
61861
|
+
"--project-id",
|
|
61862
|
+
"--purpose",
|
|
61863
|
+
"--q",
|
|
61864
|
+
"--repo",
|
|
61865
|
+
"--request",
|
|
61866
|
+
"--retention-days",
|
|
61867
|
+
"--r2-presign-url",
|
|
61868
|
+
"--role",
|
|
61869
|
+
"--schema",
|
|
61870
|
+
"--secret-access-key",
|
|
61871
|
+
"--since",
|
|
61872
|
+
"--source",
|
|
61873
|
+
"--state",
|
|
61874
|
+
"--slug",
|
|
61875
|
+
"--tail",
|
|
61876
|
+
"--task",
|
|
61877
|
+
"--ttl",
|
|
61878
|
+
"--ttl-seconds",
|
|
61879
|
+
"--type",
|
|
61880
|
+
"--until",
|
|
61881
|
+
"--web-url",
|
|
61882
|
+
"--zero-url",
|
|
61883
|
+
"--job-id",
|
|
61884
|
+
"--lines",
|
|
61885
|
+
"--stream",
|
|
61886
|
+
"--target-id",
|
|
61887
|
+
"--zone-id",
|
|
61888
|
+
"--record-id"
|
|
61889
|
+
]);
|
|
61890
|
+
function parseCliArgs(tokens) {
|
|
61891
|
+
const flags = new Map;
|
|
61892
|
+
const positionals = [];
|
|
61893
|
+
let command;
|
|
61894
|
+
for (let index = 0;index < tokens.length; index += 1) {
|
|
61895
|
+
const token = tokens[index];
|
|
61896
|
+
if (!token)
|
|
61897
|
+
continue;
|
|
61898
|
+
if (token === "--") {
|
|
61899
|
+
positionals.push(...tokens.slice(index + 1));
|
|
61900
|
+
break;
|
|
61901
|
+
}
|
|
61902
|
+
if (token === "-h") {
|
|
61903
|
+
flags.set("--help", true);
|
|
61904
|
+
continue;
|
|
61905
|
+
}
|
|
61906
|
+
if (token === "-f" || token === "-n" || token === "-q") {
|
|
61907
|
+
flags.set(token === "-q" ? "--quiet" : token, true);
|
|
61908
|
+
continue;
|
|
61909
|
+
}
|
|
61910
|
+
if (token.startsWith("--")) {
|
|
61911
|
+
const [name = token, inlineValue] = token.split("=", 2);
|
|
61912
|
+
if (inlineValue !== undefined) {
|
|
61913
|
+
flags.set(name, inlineValue);
|
|
61914
|
+
continue;
|
|
61915
|
+
}
|
|
61916
|
+
const next = tokens[index + 1];
|
|
61917
|
+
if (next && !next.startsWith("-") && valueFlags.has(name)) {
|
|
61918
|
+
flags.set(name, next);
|
|
61919
|
+
index += 1;
|
|
61920
|
+
continue;
|
|
61921
|
+
}
|
|
61922
|
+
flags.set(name, true);
|
|
61923
|
+
continue;
|
|
61924
|
+
}
|
|
61925
|
+
if (!command) {
|
|
61926
|
+
command = token;
|
|
61927
|
+
continue;
|
|
61928
|
+
}
|
|
61929
|
+
positionals.push(token);
|
|
61930
|
+
}
|
|
61931
|
+
return {
|
|
61932
|
+
...command ? { command } : {},
|
|
61933
|
+
flags,
|
|
61934
|
+
help: flags.has("--help"),
|
|
61935
|
+
positionals
|
|
61936
|
+
};
|
|
61937
|
+
}
|
|
61938
|
+
|
|
61939
|
+
// src/commands/env-values-command.ts
|
|
61940
|
+
var runEnvValuesCommand = async (runtime) => {
|
|
61941
|
+
const action = runtime.positionals[0] ?? "list";
|
|
61942
|
+
const config2 = await runtime.loadConfig(runtime.resolveConfigPath(envValuesConfigPath(action, runtime.positionals, runtime.processArgv)));
|
|
61943
|
+
const manifest = runtime.scopedManifest(config2);
|
|
61944
|
+
const scope = resolveEnvScope(manifest, {
|
|
61945
|
+
environment: runtime.readFlag("--env"),
|
|
61946
|
+
organizationId: runtime.readFlag("--organization-id"),
|
|
61947
|
+
project: runtime.readFlag("--project"),
|
|
61948
|
+
projectSlug: runtime.readFlag("--project-slug")
|
|
61949
|
+
});
|
|
61950
|
+
const explicitApi = runtime.readFlag(apiFlag);
|
|
61951
|
+
const apiUrl = resolveHostedApiTarget({
|
|
61952
|
+
...explicitApi ? { explicitApi } : {}
|
|
61953
|
+
});
|
|
61954
|
+
const { environment } = scope;
|
|
61955
|
+
if (action === "list") {
|
|
61956
|
+
const app = runtime.readFlag("--app");
|
|
61957
|
+
const explanation = await runtime.clientFor(apiUrl).environments.explain({
|
|
61958
|
+
...app ? { app } : {},
|
|
61959
|
+
environment,
|
|
61960
|
+
manifest: scope.manifest
|
|
61961
|
+
});
|
|
61962
|
+
if (runtime.readBooleanFlag("--json")) {
|
|
61963
|
+
runtime.writeData(explanation);
|
|
61964
|
+
} else {
|
|
61965
|
+
runtime.writeText(formatEnvValuesListText(explanation, {
|
|
61966
|
+
app,
|
|
61967
|
+
color: runtime.shouldColorHumanOutput()
|
|
61968
|
+
}));
|
|
61799
61969
|
}
|
|
61800
|
-
runtime.writeData(await environments2.create({
|
|
61801
|
-
actor: runtime.user ?? defaultDeploySource,
|
|
61802
|
-
kind: runtime.environmentKindFor(name, runtime.readFlag("--kind")),
|
|
61803
|
-
manifest: runtime.toManifest(config2),
|
|
61804
|
-
name,
|
|
61805
|
-
source: { id: name, type: "manual" }
|
|
61806
|
-
}));
|
|
61807
61970
|
return;
|
|
61808
61971
|
}
|
|
61809
|
-
if (action === "
|
|
61972
|
+
if (action === "get") {
|
|
61810
61973
|
const name = runtime.positionals[1];
|
|
61811
61974
|
if (!name) {
|
|
61812
|
-
runtime.fail(
|
|
61975
|
+
runtime.fail(`Usage: pier env get <name> [config-path] [--env <env>] [--app <app-name>] [${apiFlag} <url|local>] [--json]`);
|
|
61813
61976
|
}
|
|
61814
|
-
const
|
|
61815
|
-
|
|
61816
|
-
|
|
61977
|
+
const value = await runtime.clientFor(apiUrl).env.get({
|
|
61978
|
+
actor: runtime.user ?? defaultDeploySource,
|
|
61979
|
+
app: runtime.readFlag("--app"),
|
|
61980
|
+
environment,
|
|
61981
|
+
manifest: scope.manifest,
|
|
61982
|
+
name
|
|
61817
61983
|
});
|
|
61818
|
-
|
|
61984
|
+
if (runtime.readBooleanFlag("--json")) {
|
|
61985
|
+
runtime.writeData({ ...value, revealed: true });
|
|
61986
|
+
} else {
|
|
61987
|
+
runtime.writeText(value.value);
|
|
61988
|
+
}
|
|
61819
61989
|
return;
|
|
61820
61990
|
}
|
|
61821
|
-
if (action === "
|
|
61991
|
+
if (action === "set") {
|
|
61992
|
+
const pairs = envSetPairs(runtime.positionals);
|
|
61993
|
+
if (pairs.length === 0) {
|
|
61994
|
+
runtime.fail(`Usage: pier env set <NAME=value>... [config-path] [--env <env>] [--app <app-name>] [${apiFlag} <url|local>]`);
|
|
61995
|
+
}
|
|
61996
|
+
const values = [];
|
|
61997
|
+
for (const [name, value] of pairs) {
|
|
61998
|
+
values.push(await runtime.clientFor(apiUrl).env.set({
|
|
61999
|
+
actor: runtime.user ?? defaultDeploySource,
|
|
62000
|
+
app: runtime.readFlag("--app"),
|
|
62001
|
+
environment,
|
|
62002
|
+
manifest: scope.manifest,
|
|
62003
|
+
name,
|
|
62004
|
+
source: runtime.detectDeploySource(),
|
|
62005
|
+
value
|
|
62006
|
+
}));
|
|
62007
|
+
}
|
|
62008
|
+
writeEnvSetOutput(runtime, { environment, values });
|
|
62009
|
+
return;
|
|
62010
|
+
}
|
|
62011
|
+
if (action === "delete") {
|
|
61822
62012
|
const name = runtime.positionals[1];
|
|
61823
62013
|
if (!name) {
|
|
61824
|
-
runtime.fail(
|
|
62014
|
+
runtime.fail(`Usage: pier env delete <name> [config-path] [--env <env>] [--app <app-name>] [${apiFlag} <url|local>] [--json]`);
|
|
61825
62015
|
}
|
|
61826
|
-
const
|
|
61827
|
-
|
|
61828
|
-
|
|
62016
|
+
const result = await runtime.clientFor(apiUrl).env.delete({
|
|
62017
|
+
actor: runtime.user ?? defaultDeploySource,
|
|
62018
|
+
app: runtime.readFlag("--app"),
|
|
62019
|
+
environment,
|
|
62020
|
+
manifest: scope.manifest,
|
|
62021
|
+
name
|
|
61829
62022
|
});
|
|
61830
62023
|
if (runtime.readBooleanFlag("--json")) {
|
|
61831
|
-
runtime.writeData(
|
|
62024
|
+
runtime.writeData(result);
|
|
61832
62025
|
} else {
|
|
61833
|
-
runtime.writeText(
|
|
62026
|
+
runtime.writeText(`Deleted ${result.name} from ${environment}${result.targets.length ? ` for ${result.targets.join(", ")}` : ""}.`);
|
|
61834
62027
|
}
|
|
61835
|
-
return
|
|
62028
|
+
return;
|
|
61836
62029
|
}
|
|
61837
|
-
if (action === "
|
|
61838
|
-
|
|
62030
|
+
if (action === "upload") {
|
|
62031
|
+
const file2 = runtime.positionals[1];
|
|
62032
|
+
if (!file2) {
|
|
62033
|
+
runtime.fail(`Usage: pier env upload <dotenv-file> [config-path] [--env <env>] [--app <app-name>] [--dry-run] [--force] [${apiFlag} <url|local>]`);
|
|
62034
|
+
}
|
|
62035
|
+
await uploadEnvironmentValues(runtime, {
|
|
62036
|
+
apiUrl,
|
|
62037
|
+
environment,
|
|
62038
|
+
file: file2,
|
|
62039
|
+
manifest: scope.manifest
|
|
62040
|
+
});
|
|
62041
|
+
return;
|
|
62042
|
+
}
|
|
62043
|
+
if (action === "download") {
|
|
62044
|
+
await downloadEnvironmentValues(runtime, {
|
|
62045
|
+
apiUrl,
|
|
62046
|
+
environment,
|
|
62047
|
+
manifest: scope.manifest
|
|
62048
|
+
});
|
|
61839
62049
|
return;
|
|
61840
62050
|
}
|
|
61841
|
-
if (action === "
|
|
61842
|
-
const
|
|
61843
|
-
|
|
61844
|
-
|
|
62051
|
+
if (action === "run") {
|
|
62052
|
+
const separatorIndex = runtime.processArgv.indexOf("--");
|
|
62053
|
+
const commandArgs = separatorIndex === -1 ? [] : runtime.processArgv.slice(separatorIndex + 1);
|
|
62054
|
+
if (commandArgs.length === 0) {
|
|
62055
|
+
runtime.fail(`Usage: pier env run [config-path] [--env <env>] [${apiFlag} <url|local>] -- <command...>`);
|
|
61845
62056
|
}
|
|
61846
|
-
|
|
62057
|
+
await runtime.runCommandWithPierValues({
|
|
62058
|
+
commandArgs,
|
|
62059
|
+
config: config2,
|
|
61847
62060
|
environment,
|
|
61848
|
-
manifest
|
|
62061
|
+
manifest: scope.manifest
|
|
61849
62062
|
});
|
|
61850
|
-
writeFormattedExplanation(runtime, explanation);
|
|
61851
62063
|
return;
|
|
61852
62064
|
}
|
|
61853
|
-
runtime.fail(`Unknown env action: ${action
|
|
62065
|
+
runtime.fail(`Unknown env action: ${action}`);
|
|
61854
62066
|
};
|
|
61855
|
-
var
|
|
61856
|
-
|
|
62067
|
+
var uploadEnvironmentValues = async (runtime, input) => {
|
|
62068
|
+
const values = await runtime.readDotenv(input.file);
|
|
62069
|
+
const app = runtime.readFlag("--app");
|
|
62070
|
+
const result = await runtime.clientFor(input.apiUrl).env.upload({
|
|
62071
|
+
actor: runtime.user ?? defaultDeploySource,
|
|
62072
|
+
...app ? { app } : {},
|
|
62073
|
+
dryRun: runtime.readBooleanFlag("--dry-run"),
|
|
62074
|
+
environment: input.environment,
|
|
62075
|
+
force: runtime.readBooleanFlag("--force"),
|
|
62076
|
+
manifest: input.manifest,
|
|
62077
|
+
replace: true,
|
|
62078
|
+
values
|
|
62079
|
+
});
|
|
62080
|
+
writeEnvUploadOutput(runtime, result, input.file);
|
|
62081
|
+
};
|
|
62082
|
+
var downloadEnvironmentValues = async (runtime, input) => {
|
|
62083
|
+
const output = await runtime.clientFor(input.apiUrl).env.download({
|
|
62084
|
+
actor: runtime.user ?? defaultDeploySource,
|
|
62085
|
+
app: runtime.readFlag("--app"),
|
|
62086
|
+
environment: input.environment,
|
|
62087
|
+
format: envDownloadFormat(runtime),
|
|
62088
|
+
manifest: input.manifest
|
|
62089
|
+
});
|
|
62090
|
+
if (runtime.readBooleanFlag("--json")) {
|
|
62091
|
+
runtime.writeData(output);
|
|
62092
|
+
return;
|
|
62093
|
+
}
|
|
62094
|
+
const outputPath = runtime.readFlag("--output") ?? runtime.readFlag("--out");
|
|
62095
|
+
if (outputPath) {
|
|
62096
|
+
await runtime.writeFile(outputPath, output.value);
|
|
62097
|
+
} else {
|
|
62098
|
+
runtime.writeText(output.value);
|
|
62099
|
+
}
|
|
62100
|
+
};
|
|
62101
|
+
var writeEnvSetOutput = (runtime, input) => {
|
|
62102
|
+
if (runtime.readBooleanFlag("--json")) {
|
|
62103
|
+
runtime.writeData(input);
|
|
62104
|
+
return;
|
|
62105
|
+
}
|
|
62106
|
+
runtime.writeText([
|
|
62107
|
+
`Updated ${input.values.length} value${suffix(input.values.length)} in ${input.environment}.`,
|
|
62108
|
+
...input.values.map((value) => `- ${value.name}${value.targets.length ? ` -> ${value.targets.join(", ")}` : ""}`)
|
|
62109
|
+
].join(`
|
|
62110
|
+
`));
|
|
62111
|
+
};
|
|
62112
|
+
var writeEnvUploadOutput = (runtime, result, file2) => {
|
|
62113
|
+
if (runtime.readBooleanFlag("--json")) {
|
|
62114
|
+
runtime.writeData({ ...result, file: file2 });
|
|
62115
|
+
return;
|
|
62116
|
+
}
|
|
62117
|
+
runtime.writeText([
|
|
62118
|
+
`${result.dryRun ? "Would update" : "Updated"} ${result.changed.length} value${suffix(result.changed.length)} in ${result.scope.projectSlug}/${result.scope.environment}.`,
|
|
62119
|
+
result.removed.length ? `${result.dryRun ? "Would remove" : "Removed"} ${result.removed.length} value${suffix(result.removed.length)}.` : undefined,
|
|
62120
|
+
result.unchanged.length ? `${result.unchanged.length} unchanged.` : undefined,
|
|
62121
|
+
...result.changed.map((value) => `- ${value.name} (${value.sensitive ? "sensitive" : "plain"})`),
|
|
62122
|
+
...result.warnings.map((warning) => warning.name ? `- skipped ${warning.name}: ${warning.reason}` : `- warning: ${warning.reason}`)
|
|
62123
|
+
].filter((line) => Boolean(line)).join(`
|
|
62124
|
+
`));
|
|
62125
|
+
};
|
|
62126
|
+
var envValuesConfigPath = (action, positionals, argv) => {
|
|
62127
|
+
const explicit = readFlagFromPositionals("--config", positionals);
|
|
62128
|
+
if (explicit) {
|
|
62129
|
+
return explicit;
|
|
62130
|
+
}
|
|
62131
|
+
if (action === "get") {
|
|
62132
|
+
return positionals[2];
|
|
62133
|
+
}
|
|
62134
|
+
if (action === "delete") {
|
|
62135
|
+
return positionals[2];
|
|
62136
|
+
}
|
|
62137
|
+
if (action === "upload") {
|
|
62138
|
+
return positionals[2];
|
|
62139
|
+
}
|
|
62140
|
+
if (action === "set") {
|
|
62141
|
+
return positionals.slice(1).find((value) => !value.includes("="));
|
|
62142
|
+
}
|
|
62143
|
+
if (action === "run") {
|
|
62144
|
+
return configPathBeforeSeparator(2, argv);
|
|
62145
|
+
}
|
|
62146
|
+
return positionals[1];
|
|
62147
|
+
};
|
|
62148
|
+
var envSetPairs = (positionals) => positionals.slice(1).flatMap((entry) => {
|
|
62149
|
+
const equalsIndex = entry.indexOf("=");
|
|
62150
|
+
if (equalsIndex <= 0) {
|
|
62151
|
+
return [];
|
|
62152
|
+
}
|
|
62153
|
+
return [[entry.slice(0, equalsIndex), entry.slice(equalsIndex + 1)]];
|
|
62154
|
+
});
|
|
62155
|
+
var readFlagFromPositionals = (name, positionals) => {
|
|
62156
|
+
const index = positionals.indexOf(name);
|
|
62157
|
+
if (index === -1) {
|
|
62158
|
+
return;
|
|
62159
|
+
}
|
|
62160
|
+
return positionals[index + 1];
|
|
62161
|
+
};
|
|
62162
|
+
var configPathBeforeSeparator = (startIndex, argv) => {
|
|
62163
|
+
const separatorIndex = argv.indexOf("--");
|
|
62164
|
+
const beforeSeparator = argv.slice(startIndex, separatorIndex === -1 ? undefined : separatorIndex);
|
|
62165
|
+
return parseCliArgs(beforeSeparator).positionals[0];
|
|
62166
|
+
};
|
|
62167
|
+
var envDownloadFormat = (runtime) => {
|
|
62168
|
+
const format2 = runtime.readFlag("--format") ?? "env";
|
|
62169
|
+
if (format2 === "env" || format2 === "json" || format2 === "yaml" || format2 === "shell") {
|
|
62170
|
+
return format2;
|
|
62171
|
+
}
|
|
62172
|
+
runtime.fail("--format must be one of: env, json, yaml, shell.");
|
|
62173
|
+
};
|
|
62174
|
+
var suffix = (count) => count === 1 ? "" : "s";
|
|
62175
|
+
|
|
62176
|
+
// src/commands/env-command.ts
|
|
62177
|
+
var runEnvCommand = async (runtime) => {
|
|
62178
|
+
const action = runtime.positionals[0];
|
|
62179
|
+
if (action === "get" || action === "list" || action === "set" || action === "delete" || action === "upload" || action === "download" || action === "run") {
|
|
62180
|
+
await runEnvValuesCommand(runtime);
|
|
62181
|
+
return;
|
|
62182
|
+
}
|
|
62183
|
+
const configPath = envConfigPath(action, runtime.positionals);
|
|
62184
|
+
const config2 = await runtime.loadConfig(runtime.resolveConfigPath(configPath));
|
|
62185
|
+
const manifest = runtime.scopedManifest(config2);
|
|
62186
|
+
const apiUrl = runtime.requireApiUrl();
|
|
62187
|
+
const environments2 = runtime.clientFor(apiUrl).environments;
|
|
62188
|
+
if (action === "types") {
|
|
62189
|
+
runtime.writeText(await runtime.writeEnvTypes(config2));
|
|
62190
|
+
return;
|
|
62191
|
+
}
|
|
62192
|
+
if (action === "create") {
|
|
62193
|
+
const name = runtime.positionals[1];
|
|
62194
|
+
if (!name) {
|
|
62195
|
+
runtime.fail("Missing environment name.");
|
|
62196
|
+
}
|
|
62197
|
+
runtime.writeData(await environments2.create({
|
|
62198
|
+
actor: runtime.user ?? defaultDeploySource,
|
|
62199
|
+
kind: runtime.environmentKindFor(name, runtime.readFlag("--kind")),
|
|
62200
|
+
manifest: runtime.toManifest(config2),
|
|
62201
|
+
name,
|
|
62202
|
+
source: { id: name, type: "manual" }
|
|
62203
|
+
}));
|
|
62204
|
+
return;
|
|
62205
|
+
}
|
|
62206
|
+
if (action === "explain") {
|
|
62207
|
+
const name = runtime.positionals[1];
|
|
62208
|
+
if (!name) {
|
|
62209
|
+
runtime.fail("Missing environment name.");
|
|
62210
|
+
}
|
|
62211
|
+
const explanation = await environments2.explain({
|
|
62212
|
+
environment: name,
|
|
62213
|
+
manifest
|
|
62214
|
+
});
|
|
62215
|
+
writeFormattedExplanation(runtime, explanation);
|
|
62216
|
+
return;
|
|
62217
|
+
}
|
|
62218
|
+
if (action === "readiness") {
|
|
62219
|
+
const name = runtime.positionals[1];
|
|
62220
|
+
if (!name) {
|
|
62221
|
+
runtime.fail("Missing environment name.");
|
|
62222
|
+
}
|
|
62223
|
+
const readiness = await environments2.readiness({
|
|
62224
|
+
environment: name,
|
|
62225
|
+
manifest
|
|
62226
|
+
});
|
|
62227
|
+
if (runtime.readBooleanFlag("--json")) {
|
|
62228
|
+
runtime.writeData(readiness);
|
|
62229
|
+
} else {
|
|
62230
|
+
runtime.writeText(formatEnvironmentReadinessText(readiness));
|
|
62231
|
+
}
|
|
62232
|
+
return readiness.ok ? 0 : 1;
|
|
62233
|
+
}
|
|
62234
|
+
if (action === "environments") {
|
|
62235
|
+
runtime.writeData(await environments2.list({ manifest }));
|
|
62236
|
+
return;
|
|
62237
|
+
}
|
|
62238
|
+
runtime.fail(`Unknown env action: ${action ?? ""}`);
|
|
62239
|
+
};
|
|
62240
|
+
var writeFormattedExplanation = (runtime, explanation) => {
|
|
62241
|
+
if (runtime.readBooleanFlag("--json")) {
|
|
61857
62242
|
runtime.writeData(explanation);
|
|
61858
62243
|
} else {
|
|
61859
62244
|
runtime.writeText(formatEnvironmentExplainText(explanation));
|
|
61860
62245
|
}
|
|
61861
62246
|
};
|
|
61862
62247
|
var envConfigPath = (action, positionals) => {
|
|
61863
|
-
if (action === "create" || action === "explain" || action === "readiness"
|
|
62248
|
+
if (action === "create" || action === "explain" || action === "readiness") {
|
|
61864
62249
|
return positionals[2];
|
|
61865
62250
|
}
|
|
61866
62251
|
return positionals[1];
|
|
@@ -62439,11 +62824,11 @@ function parseRequestLine(message) {
|
|
|
62439
62824
|
};
|
|
62440
62825
|
}
|
|
62441
62826
|
function parseLogJson(message) {
|
|
62442
|
-
const
|
|
62443
|
-
if (!
|
|
62827
|
+
const clean2 = stripAnsiText(message).trim();
|
|
62828
|
+
if (!clean2.startsWith("{"))
|
|
62444
62829
|
return null;
|
|
62445
62830
|
try {
|
|
62446
|
-
const parsed = JSON.parse(
|
|
62831
|
+
const parsed = JSON.parse(clean2);
|
|
62447
62832
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
62448
62833
|
} catch {
|
|
62449
62834
|
return null;
|
|
@@ -63137,11 +63522,11 @@ function messageFor(error51) {
|
|
|
63137
63522
|
// src/commands/package-command.ts
|
|
63138
63523
|
var runPackageCommand = async (action, positionals, tokens, runtime) => {
|
|
63139
63524
|
if (action === "add" || action === "install") {
|
|
63140
|
-
const apiKey = await
|
|
63525
|
+
const apiKey = await readPackageApiKey();
|
|
63141
63526
|
if (!apiKey) {
|
|
63142
|
-
runtime.fail("No Pier API key is
|
|
63527
|
+
runtime.fail("No Pier API key is available. Set PIER_API_KEY, run pier login, or run pier config api-key set.");
|
|
63143
63528
|
}
|
|
63144
|
-
await runPackageManagerCommand(action, packageManagerArgs(tokens, action), {
|
|
63529
|
+
await runPackageManagerCommand(action, packageManagerArgs(tokens, action), { PIER_API_KEY: apiKey }, runtime);
|
|
63145
63530
|
return;
|
|
63146
63531
|
}
|
|
63147
63532
|
if (action === "config") {
|
|
@@ -63149,9 +63534,9 @@ var runPackageCommand = async (action, positionals, tokens, runtime) => {
|
|
|
63149
63534
|
const scope = runtime.readFlag("--scope") ?? "@pier";
|
|
63150
63535
|
const registryUrl = registryUrlFor(apiUrl, runtime.localDaemonUrl);
|
|
63151
63536
|
if (runtime.readBooleanFlag("--npmrc")) {
|
|
63152
|
-
const apiKey = await
|
|
63537
|
+
const apiKey = await readPackageApiKey();
|
|
63153
63538
|
if (!apiKey) {
|
|
63154
|
-
runtime.fail("No Pier API key is
|
|
63539
|
+
runtime.fail("No Pier API key is available. Set PIER_API_KEY, run pier login, or run pier config api-key set.");
|
|
63155
63540
|
}
|
|
63156
63541
|
runtime.writeText(npmrcRegistryConfig(scope, registryUrl, apiKey));
|
|
63157
63542
|
return;
|
|
@@ -63169,12 +63554,13 @@ var runPublishCommand = async (packageDirectory, runtime) => {
|
|
|
63169
63554
|
await publishPackageCommand(packageDirectory, "pier publish", runtime);
|
|
63170
63555
|
};
|
|
63171
63556
|
var packageApiUrl = (runtime) => runtime.configuredApiUrl();
|
|
63557
|
+
var readPackageApiKey = async () => process.env.PIER_API_KEY || readStoredPierApiKey();
|
|
63172
63558
|
var registryUrlFor = (apiUrl, localDaemonUrl) => {
|
|
63173
63559
|
const resolved = apiUrl === "local" ? localDaemonUrl() : apiUrl;
|
|
63174
63560
|
return `${resolved.replace(/\/+$/, "")}/npm/`;
|
|
63175
63561
|
};
|
|
63176
63562
|
var bunRegistryConfig = (scope, registryUrl) => `[install.scopes]
|
|
63177
|
-
"${scope}" = { url = "${registryUrl}", token = "$
|
|
63563
|
+
"${scope}" = { url = "${registryUrl}", token = "$PIER_API_KEY" }`;
|
|
63178
63564
|
var packageManagerArgs = (tokens, action) => {
|
|
63179
63565
|
const packageIndex = tokens.indexOf("package");
|
|
63180
63566
|
if (packageIndex === -1) {
|
|
@@ -63186,11 +63572,11 @@ var packageManagerArgs = (tokens, action) => {
|
|
|
63186
63572
|
}
|
|
63187
63573
|
return tokens.slice(actionIndex + 1);
|
|
63188
63574
|
};
|
|
63189
|
-
var runPackageManagerCommand = async (action, args,
|
|
63575
|
+
var runPackageManagerCommand = async (action, args, env2, runtime) => {
|
|
63190
63576
|
const bunArgs = [action, ...args];
|
|
63191
63577
|
await runtime.runCommand(["bun", ...bunArgs], {
|
|
63192
63578
|
...process.env,
|
|
63193
|
-
|
|
63579
|
+
PIER_API_KEY: env2.PIER_API_KEY
|
|
63194
63580
|
});
|
|
63195
63581
|
};
|
|
63196
63582
|
var npmrcRegistryConfig = (scope, registryUrl, apiKey) => {
|
|
@@ -63666,9 +64052,9 @@ var formatProfileText = (profile) => {
|
|
|
63666
64052
|
// src/commands/project-command.ts
|
|
63667
64053
|
var runProjectCommand = async (runtime) => {
|
|
63668
64054
|
const action = runtime.positionals[0] ?? "status";
|
|
63669
|
-
if (action === "
|
|
64055
|
+
if (action === "create") {
|
|
63670
64056
|
const config2 = await runtime.loadConfig(runtime.resolveConfigPath(runtime.positionals[1] ?? runtime.readFlag("--config")));
|
|
63671
|
-
const output2 = await runtime.clientFor(runtime.requireApiUrl()).projects.
|
|
64057
|
+
const output2 = await runtime.clientFor(runtime.requireApiUrl()).projects.create({
|
|
63672
64058
|
actor: runtime.user ?? "unknown",
|
|
63673
64059
|
manifest: runtime.toManifest(config2)
|
|
63674
64060
|
});
|
|
@@ -63676,7 +64062,7 @@ var runProjectCommand = async (runtime) => {
|
|
|
63676
64062
|
runtime.writeData(output2);
|
|
63677
64063
|
} else {
|
|
63678
64064
|
runtime.writeText([
|
|
63679
|
-
`
|
|
64065
|
+
`Created project ${output2.project.name} (${output2.project.slug})`,
|
|
63680
64066
|
`org=${output2.project.organizationId}`,
|
|
63681
64067
|
`apps=${output2.appCount} bindings=${output2.bindingCount}`
|
|
63682
64068
|
].join(`
|
|
@@ -63739,7 +64125,7 @@ var formatProjectStatus = (project, environment) => {
|
|
|
63739
64125
|
var projectUsage = () => [
|
|
63740
64126
|
"Usage:",
|
|
63741
64127
|
` pier project status <project-slug> [--env <env>] [${apiFlag} <url|local>] [--json]`,
|
|
63742
|
-
` pier project
|
|
64128
|
+
` pier project create [config-path] [${apiFlag} <url|local>] [--json]`
|
|
63743
64129
|
].join(`
|
|
63744
64130
|
`);
|
|
63745
64131
|
|
|
@@ -63926,489 +64312,114 @@ var runProviderCommand = async (runtime) => {
|
|
|
63926
64312
|
runtime.writeText(formatCloudflareResourceSnapshotMarkdown(snapshot));
|
|
63927
64313
|
} else {
|
|
63928
64314
|
runtime.writeData(snapshot);
|
|
63929
|
-
}
|
|
63930
|
-
return;
|
|
63931
|
-
}
|
|
63932
|
-
if (provider2 === "cloudflare" && action === "drift") {
|
|
63933
|
-
const output = await client.cloudflareResourceDrift({
|
|
63934
|
-
projectSlug: runtime.readFlag("--project")
|
|
63935
|
-
});
|
|
63936
|
-
if (runtime.readBooleanFlag("--markdown")) {
|
|
63937
|
-
runtime.writeText(formatCloudflareResourceDriftMarkdown(output));
|
|
63938
|
-
} else {
|
|
63939
|
-
runtime.writeData(output);
|
|
63940
|
-
}
|
|
63941
|
-
return;
|
|
63942
|
-
}
|
|
63943
|
-
if (provider2 === "cloudflare" && action === "usage-queries") {
|
|
63944
|
-
const output = await client.cloudflareUsageQueries({
|
|
63945
|
-
datetimeEnd: runtime.readFlag("--until"),
|
|
63946
|
-
datetimeStart: runtime.readFlag("--since"),
|
|
63947
|
-
projectSlug: runtime.readFlag("--project")
|
|
63948
|
-
});
|
|
63949
|
-
if (runtime.readBooleanFlag("--markdown")) {
|
|
63950
|
-
runtime.writeText(formatCloudflareUsageQueriesMarkdown(output));
|
|
63951
|
-
} else {
|
|
63952
|
-
runtime.writeData(output);
|
|
63953
|
-
}
|
|
63954
|
-
return;
|
|
63955
|
-
}
|
|
63956
|
-
runtime.fail("Usage: pier provider cloudflare <plan|connection-plan|drift|resources|usage-queries> [--markdown] [--api <url|local>]");
|
|
63957
|
-
};
|
|
63958
|
-
|
|
63959
|
-
// src/format/restore-format.ts
|
|
63960
|
-
var formatRestorePlanMarkdown = (plan) => {
|
|
63961
|
-
const lines = [
|
|
63962
|
-
"# Pier Restore Plan",
|
|
63963
|
-
"",
|
|
63964
|
-
`Risk: ${plan.risk}`,
|
|
63965
|
-
`Backup: ${plan.backup.checksum}`,
|
|
63966
|
-
`Generated: ${plan.backup.generatedAt}`,
|
|
63967
|
-
"",
|
|
63968
|
-
"## Summary",
|
|
63969
|
-
"",
|
|
63970
|
-
`- Changes: ${plan.summary.changeCount}`,
|
|
63971
|
-
`- Records to restore: ${plan.summary.restoreRecords}`,
|
|
63972
|
-
`- Records to remove: ${plan.summary.removeRecords}`,
|
|
63973
|
-
"",
|
|
63974
|
-
"## Counts",
|
|
63975
|
-
"",
|
|
63976
|
-
`- Projects: ${plan.counts.projects}`,
|
|
63977
|
-
`- Apps: ${plan.counts.apps}`,
|
|
63978
|
-
`- Deployments: ${plan.counts.deployments}`,
|
|
63979
|
-
`- Resources: ${plan.counts.resources}`,
|
|
63980
|
-
`- Artifacts: ${plan.counts.artifacts}`,
|
|
63981
|
-
`- Secrets: ${plan.counts.secrets}`,
|
|
63982
|
-
`- Variables: ${plan.counts.variables}`,
|
|
63983
|
-
"",
|
|
63984
|
-
"## Changes",
|
|
63985
|
-
"",
|
|
63986
|
-
...plan.changes.length ? plan.changes.map((change) => `- ${change}`) : ["- none"],
|
|
63987
|
-
"",
|
|
63988
|
-
"## Warnings",
|
|
63989
|
-
"",
|
|
63990
|
-
...plan.warnings.length ? plan.warnings.map((warning) => `- ${warning}`) : ["- none"]
|
|
63991
|
-
];
|
|
63992
|
-
return lines.join(`
|
|
63993
|
-
`);
|
|
63994
|
-
};
|
|
63995
|
-
|
|
63996
|
-
// src/commands/restore-command.ts
|
|
63997
|
-
var runRestoreCommand = async (runtime) => {
|
|
63998
|
-
const action = runtime.positionals[0];
|
|
63999
|
-
const backupPath = runtime.positionals[1];
|
|
64000
|
-
const apiUrl = runtime.requireApiUrl();
|
|
64001
|
-
const restore = runtime.clientFor(apiUrl).backups.restore;
|
|
64002
|
-
if (action === "plan") {
|
|
64003
|
-
if (!backupPath || backupPath.startsWith("--")) {
|
|
64004
|
-
runtime.fail(`Usage: pier restore plan <backup-json> [${apiFlag} <url|local>]`);
|
|
64005
|
-
}
|
|
64006
|
-
const backup = backupExportSchema.parse(await runtime.readJsonFile(backupPath));
|
|
64007
|
-
const plan = await restore.plan({ backup });
|
|
64008
|
-
if (runtime.readBooleanFlag("--markdown")) {
|
|
64009
|
-
runtime.writeText(formatRestorePlanMarkdown(plan));
|
|
64010
|
-
} else {
|
|
64011
|
-
runtime.writeData(plan);
|
|
64012
|
-
}
|
|
64013
|
-
return;
|
|
64014
|
-
}
|
|
64015
|
-
if (action === "apply") {
|
|
64016
|
-
if (!backupPath || backupPath.startsWith("--")) {
|
|
64017
|
-
runtime.fail(`Usage: pier restore apply <backup-json> --checkpoint <hash> --reason <reason> --confirm <token> [${apiFlag} <url|local>]`);
|
|
64018
|
-
}
|
|
64019
|
-
const checkpointHash = runtime.readFlag("--checkpoint");
|
|
64020
|
-
const reason = runtime.readFlag("--reason");
|
|
64021
|
-
const confirmation = runtime.readFlag("--confirm");
|
|
64022
|
-
if (!checkpointHash || !reason || !confirmation) {
|
|
64023
|
-
runtime.fail("Restore apply requires --checkpoint, --reason, and --confirm.");
|
|
64024
|
-
}
|
|
64025
|
-
const backup = backupExportSchema.parse(await runtime.readJsonFile(backupPath));
|
|
64026
|
-
runtime.writeData(await restore.apply({
|
|
64027
|
-
actor: runtime.user ?? defaultDeploySource,
|
|
64028
|
-
checkpointHash,
|
|
64029
|
-
confirmation,
|
|
64030
|
-
reason,
|
|
64031
|
-
restorePlan: { backup }
|
|
64032
|
-
}));
|
|
64033
|
-
return;
|
|
64034
|
-
}
|
|
64035
|
-
runtime.fail(`Unknown restore action: ${action ?? ""}`);
|
|
64036
|
-
};
|
|
64037
|
-
|
|
64038
|
-
// src/runtime/secrets-scope.ts
|
|
64039
|
-
function resolveSecretsScope(manifest, flags) {
|
|
64040
|
-
const project = resolveProject(manifest, flags);
|
|
64041
|
-
const environment = clean(flags.environment) ?? defaultEnvironment;
|
|
64042
|
-
return {
|
|
64043
|
-
environment,
|
|
64044
|
-
manifest: { ...manifest, project },
|
|
64045
|
-
project
|
|
64046
|
-
};
|
|
64047
|
-
}
|
|
64048
|
-
function resolveProject(manifest, flags) {
|
|
64049
|
-
const explicitProject = clean(flags.project) ?? clean(flags.projectSlug);
|
|
64050
|
-
if (explicitProject) {
|
|
64051
|
-
return {
|
|
64052
|
-
id: explicitProject,
|
|
64053
|
-
organizationId: clean(flags.organizationId) ?? manifest.project?.organizationId ?? "resolved-by-api",
|
|
64054
|
-
slug: explicitProject
|
|
64055
|
-
};
|
|
64056
|
-
}
|
|
64057
|
-
if (manifest.project) {
|
|
64058
|
-
return manifest.project;
|
|
64059
|
-
}
|
|
64060
|
-
const repoProject = clean(manifest.name);
|
|
64061
|
-
if (!repoProject) {
|
|
64062
|
-
throw new Error("Could not resolve a project. Pass --project <slug> or run inside a Pier app repo.");
|
|
64063
|
-
}
|
|
64064
|
-
return {
|
|
64065
|
-
id: repoProject,
|
|
64066
|
-
organizationId: clean(flags.organizationId) ?? "resolved-by-api",
|
|
64067
|
-
slug: repoProject
|
|
64068
|
-
};
|
|
64069
|
-
}
|
|
64070
|
-
function clean(value) {
|
|
64071
|
-
const trimmed = value?.trim();
|
|
64072
|
-
return trimmed ? trimmed : undefined;
|
|
64073
|
-
}
|
|
64074
|
-
|
|
64075
|
-
// src/support/cli-args.ts
|
|
64076
|
-
var valueFlags = new Set([
|
|
64077
|
-
"--api",
|
|
64078
|
-
"--app",
|
|
64079
|
-
"--actor",
|
|
64080
|
-
"--artifact-key",
|
|
64081
|
-
"--actor-type",
|
|
64082
|
-
"--access-key-id",
|
|
64083
|
-
"--account-id",
|
|
64084
|
-
"--alloc-id",
|
|
64085
|
-
"--audit-label",
|
|
64086
|
-
"--api-url",
|
|
64087
|
-
"--before",
|
|
64088
|
-
"--body",
|
|
64089
|
-
"--bucket",
|
|
64090
|
-
"--comment",
|
|
64091
|
-
"--confirm",
|
|
64092
|
-
"--checksum",
|
|
64093
|
-
"--content",
|
|
64094
|
-
"--current-role",
|
|
64095
|
-
"--deployment",
|
|
64096
|
-
"--email",
|
|
64097
|
-
"--endpoint",
|
|
64098
|
-
"--env",
|
|
64099
|
-
"--expires-in-days",
|
|
64100
|
-
"--from-env",
|
|
64101
|
-
"--format",
|
|
64102
|
-
"--id",
|
|
64103
|
-
"--kind",
|
|
64104
|
-
"--key-prefix",
|
|
64105
|
-
"--limit",
|
|
64106
|
-
"--linked-account-id",
|
|
64107
|
-
"--name",
|
|
64108
|
-
"--next-role",
|
|
64109
|
-
"--operation",
|
|
64110
|
-
"--operations",
|
|
64111
|
-
"--organization-id",
|
|
64112
|
-
"--out",
|
|
64113
|
-
"--outpost",
|
|
64114
|
-
"--outpost-id",
|
|
64115
|
-
"--output",
|
|
64116
|
-
"--package",
|
|
64117
|
-
"--package-scope",
|
|
64118
|
-
"--preset",
|
|
64119
|
-
"--project",
|
|
64120
|
-
"--project-id",
|
|
64121
|
-
"--purpose",
|
|
64122
|
-
"--q",
|
|
64123
|
-
"--repo",
|
|
64124
|
-
"--request",
|
|
64125
|
-
"--retention-days",
|
|
64126
|
-
"--r2-presign-url",
|
|
64127
|
-
"--role",
|
|
64128
|
-
"--schema",
|
|
64129
|
-
"--secret-access-key",
|
|
64130
|
-
"--since",
|
|
64131
|
-
"--source",
|
|
64132
|
-
"--state",
|
|
64133
|
-
"--slug",
|
|
64134
|
-
"--tail",
|
|
64135
|
-
"--task",
|
|
64136
|
-
"--ttl",
|
|
64137
|
-
"--ttl-seconds",
|
|
64138
|
-
"--type",
|
|
64139
|
-
"--until",
|
|
64140
|
-
"--web-url",
|
|
64141
|
-
"--zero-url",
|
|
64142
|
-
"--job-id",
|
|
64143
|
-
"--lines",
|
|
64144
|
-
"--stream",
|
|
64145
|
-
"--target-id",
|
|
64146
|
-
"--zone-id",
|
|
64147
|
-
"--record-id"
|
|
64148
|
-
]);
|
|
64149
|
-
function parseCliArgs(tokens) {
|
|
64150
|
-
const flags = new Map;
|
|
64151
|
-
const positionals = [];
|
|
64152
|
-
let command;
|
|
64153
|
-
for (let index = 0;index < tokens.length; index += 1) {
|
|
64154
|
-
const token = tokens[index];
|
|
64155
|
-
if (!token)
|
|
64156
|
-
continue;
|
|
64157
|
-
if (token === "--") {
|
|
64158
|
-
positionals.push(...tokens.slice(index + 1));
|
|
64159
|
-
break;
|
|
64160
|
-
}
|
|
64161
|
-
if (token === "-h") {
|
|
64162
|
-
flags.set("--help", true);
|
|
64163
|
-
continue;
|
|
64164
|
-
}
|
|
64165
|
-
if (token === "-f" || token === "-n" || token === "-q") {
|
|
64166
|
-
flags.set(token === "-q" ? "--quiet" : token, true);
|
|
64167
|
-
continue;
|
|
64168
|
-
}
|
|
64169
|
-
if (token.startsWith("--")) {
|
|
64170
|
-
const [name = token, inlineValue] = token.split("=", 2);
|
|
64171
|
-
if (inlineValue !== undefined) {
|
|
64172
|
-
flags.set(name, inlineValue);
|
|
64173
|
-
continue;
|
|
64174
|
-
}
|
|
64175
|
-
const next = tokens[index + 1];
|
|
64176
|
-
if (next && !next.startsWith("-") && valueFlags.has(name)) {
|
|
64177
|
-
flags.set(name, next);
|
|
64178
|
-
index += 1;
|
|
64179
|
-
continue;
|
|
64180
|
-
}
|
|
64181
|
-
flags.set(name, true);
|
|
64182
|
-
continue;
|
|
64183
|
-
}
|
|
64184
|
-
if (!command) {
|
|
64185
|
-
command = token;
|
|
64186
|
-
continue;
|
|
64187
|
-
}
|
|
64188
|
-
positionals.push(token);
|
|
64189
|
-
}
|
|
64190
|
-
return {
|
|
64191
|
-
...command ? { command } : {},
|
|
64192
|
-
flags,
|
|
64193
|
-
help: flags.has("--help"),
|
|
64194
|
-
positionals
|
|
64195
|
-
};
|
|
64196
|
-
}
|
|
64197
|
-
|
|
64198
|
-
// src/commands/secrets-command.ts
|
|
64199
|
-
var runSecretsCommand = async (runtime) => {
|
|
64200
|
-
const action = runtime.positionals[0] ?? "list";
|
|
64201
|
-
const config2 = await runtime.loadConfig(runtime.resolveConfigPath(secretsConfigPath(action, runtime.positionals, runtime.processArgv)));
|
|
64202
|
-
const manifest = runtime.scopedManifest(config2);
|
|
64203
|
-
const scope = resolveSecretsScope(manifest, {
|
|
64204
|
-
environment: runtime.readFlag("--env"),
|
|
64205
|
-
organizationId: runtime.readFlag("--organization-id"),
|
|
64206
|
-
project: runtime.readFlag("--project"),
|
|
64207
|
-
projectSlug: runtime.readFlag("--project-slug")
|
|
64208
|
-
});
|
|
64209
|
-
const explicitApi = runtime.readFlag(apiFlag);
|
|
64210
|
-
const apiUrl = resolveHostedApiTarget({
|
|
64211
|
-
...explicitApi ? { explicitApi } : {}
|
|
64212
|
-
});
|
|
64213
|
-
const { environment } = scope;
|
|
64214
|
-
if (action === "list") {
|
|
64215
|
-
const app = runtime.readFlag("--app");
|
|
64216
|
-
const explanation = await runtime.clientFor(apiUrl).environments.explain({
|
|
64217
|
-
...app ? { app } : {},
|
|
64218
|
-
environment,
|
|
64219
|
-
manifest: scope.manifest
|
|
64220
|
-
});
|
|
64221
|
-
if (runtime.readBooleanFlag("--json")) {
|
|
64222
|
-
runtime.writeData(explanation);
|
|
64223
|
-
} else {
|
|
64224
|
-
runtime.writeText(formatSecretsListText(explanation, {
|
|
64225
|
-
app,
|
|
64226
|
-
color: runtime.shouldColorHumanOutput()
|
|
64227
|
-
}));
|
|
64228
|
-
}
|
|
64229
|
-
return;
|
|
64230
|
-
}
|
|
64231
|
-
if (action === "get") {
|
|
64232
|
-
const name = runtime.positionals[1];
|
|
64233
|
-
if (!name) {
|
|
64234
|
-
runtime.fail(`Usage: pier secrets get <name> [config-path] [--env <env>] [--app <app-name>] [${apiFlag} <url|local>] [--json]`);
|
|
64235
|
-
}
|
|
64236
|
-
const secret = await runtime.clientFor(apiUrl).secrets.get({
|
|
64237
|
-
actor: runtime.user ?? defaultDeploySource,
|
|
64238
|
-
app: runtime.readFlag("--app"),
|
|
64239
|
-
environment,
|
|
64240
|
-
manifest: scope.manifest,
|
|
64241
|
-
name
|
|
64242
|
-
});
|
|
64243
|
-
if (runtime.readBooleanFlag("--json")) {
|
|
64244
|
-
runtime.writeData({ ...secret, revealed: true });
|
|
64245
|
-
} else {
|
|
64246
|
-
runtime.writeText(secret.value);
|
|
64247
|
-
}
|
|
64248
|
-
return;
|
|
64249
|
-
}
|
|
64250
|
-
if (action === "set") {
|
|
64251
|
-
const pairs = secretsSetPairs(runtime.positionals);
|
|
64252
|
-
if (pairs.length === 0) {
|
|
64253
|
-
runtime.fail(`Usage: pier secrets set <NAME=value>... [config-path] [--env <env>] [--app <app-name>] [${apiFlag} <url|local>]`);
|
|
64254
|
-
}
|
|
64255
|
-
const values = [];
|
|
64256
|
-
for (const [name, value] of pairs) {
|
|
64257
|
-
values.push(await runtime.clientFor(apiUrl).secrets.set({
|
|
64258
|
-
actor: runtime.user ?? defaultDeploySource,
|
|
64259
|
-
app: runtime.readFlag("--app"),
|
|
64260
|
-
environment,
|
|
64261
|
-
manifest: scope.manifest,
|
|
64262
|
-
name,
|
|
64263
|
-
source: runtime.detectDeploySource(),
|
|
64264
|
-
value
|
|
64265
|
-
}));
|
|
64266
|
-
}
|
|
64267
|
-
writeSensitiveValueSetOutput(runtime, { environment, values });
|
|
64268
|
-
return;
|
|
64269
|
-
}
|
|
64270
|
-
if (action === "upload") {
|
|
64271
|
-
const file2 = runtime.positionals[1];
|
|
64272
|
-
if (!file2) {
|
|
64273
|
-
runtime.fail(`Usage: pier secrets upload <dotenv-file> [config-path] [--env <env>] [--app <app-name>] [--dry-run] [--replace --force] [${apiFlag} <url|local>]`);
|
|
64274
|
-
}
|
|
64275
|
-
await uploadEnvironmentValues(runtime, {
|
|
64276
|
-
apiUrl,
|
|
64277
|
-
environment,
|
|
64278
|
-
file: file2,
|
|
64279
|
-
manifest: scope.manifest
|
|
64280
|
-
});
|
|
64281
|
-
return;
|
|
64282
|
-
}
|
|
64283
|
-
if (action === "download") {
|
|
64284
|
-
await downloadEnvironmentValues(runtime, {
|
|
64285
|
-
apiUrl,
|
|
64286
|
-
environment,
|
|
64287
|
-
manifest: scope.manifest
|
|
64288
|
-
});
|
|
64289
|
-
return;
|
|
64290
|
-
}
|
|
64291
|
-
if (action === "run") {
|
|
64292
|
-
const separatorIndex = runtime.processArgv.indexOf("--");
|
|
64293
|
-
const commandArgs = separatorIndex === -1 ? [] : runtime.processArgv.slice(separatorIndex + 1);
|
|
64294
|
-
if (commandArgs.length === 0) {
|
|
64295
|
-
runtime.fail(`Usage: pier secrets run [config-path] [--env <env>] [${apiFlag} <url|local>] -- <command...>`);
|
|
64296
|
-
}
|
|
64297
|
-
await runtime.runCommandWithPierValues({
|
|
64298
|
-
commandArgs,
|
|
64299
|
-
config: config2,
|
|
64300
|
-
environment,
|
|
64301
|
-
manifest: scope.manifest
|
|
64302
|
-
});
|
|
64303
|
-
return;
|
|
64304
|
-
}
|
|
64305
|
-
runtime.fail(`Unknown secrets action: ${action}`);
|
|
64306
|
-
};
|
|
64307
|
-
var uploadEnvironmentValues = async (runtime, input) => {
|
|
64308
|
-
const values = await runtime.readDotenv(input.file);
|
|
64309
|
-
const app = runtime.readFlag("--app");
|
|
64310
|
-
const result = await runtime.clientFor(input.apiUrl).secrets.upload({
|
|
64311
|
-
actor: runtime.user ?? defaultDeploySource,
|
|
64312
|
-
...app ? { app } : {},
|
|
64313
|
-
dryRun: runtime.readBooleanFlag("--dry-run"),
|
|
64314
|
-
environment: input.environment,
|
|
64315
|
-
force: runtime.readBooleanFlag("--force"),
|
|
64316
|
-
manifest: input.manifest,
|
|
64317
|
-
replace: runtime.readBooleanFlag("--replace"),
|
|
64318
|
-
values
|
|
64319
|
-
});
|
|
64320
|
-
writeSecretsUploadOutput(runtime, result, input.file);
|
|
64321
|
-
};
|
|
64322
|
-
var downloadEnvironmentValues = async (runtime, input) => {
|
|
64323
|
-
const output = await runtime.clientFor(input.apiUrl).secrets.download({
|
|
64324
|
-
actor: runtime.user ?? defaultDeploySource,
|
|
64325
|
-
app: runtime.readFlag("--app"),
|
|
64326
|
-
environment: input.environment,
|
|
64327
|
-
format: secretDownloadFormat(runtime),
|
|
64328
|
-
manifest: input.manifest
|
|
64329
|
-
});
|
|
64330
|
-
if (runtime.readBooleanFlag("--json")) {
|
|
64331
|
-
runtime.writeData(output);
|
|
64332
|
-
return;
|
|
64333
|
-
}
|
|
64334
|
-
const outputPath = runtime.readFlag("--output") ?? runtime.readFlag("--out");
|
|
64335
|
-
if (outputPath) {
|
|
64336
|
-
await runtime.writeFile(outputPath, output.value);
|
|
64337
|
-
} else {
|
|
64338
|
-
runtime.writeText(output.value);
|
|
64339
|
-
}
|
|
64340
|
-
};
|
|
64341
|
-
var writeSensitiveValueSetOutput = (runtime, input) => {
|
|
64342
|
-
if (runtime.readBooleanFlag("--json")) {
|
|
64343
|
-
runtime.writeData(input);
|
|
64344
|
-
return;
|
|
64345
|
-
}
|
|
64346
|
-
runtime.writeText([
|
|
64347
|
-
`Updated ${input.values.length} value${suffix(input.values.length)} in ${input.environment}.`,
|
|
64348
|
-
...input.values.map((value) => `- ${value.name}${value.targets.length ? ` -> ${value.targets.join(", ")}` : ""}`)
|
|
64349
|
-
].join(`
|
|
64350
|
-
`));
|
|
64351
|
-
};
|
|
64352
|
-
var writeSecretsUploadOutput = (runtime, result, file2) => {
|
|
64353
|
-
if (runtime.readBooleanFlag("--json")) {
|
|
64354
|
-
runtime.writeData({ ...result, file: file2 });
|
|
64355
|
-
return;
|
|
64356
|
-
}
|
|
64357
|
-
runtime.writeText([
|
|
64358
|
-
`${result.dryRun ? "Would update" : "Updated"} ${result.changed.length} value${suffix(result.changed.length)} in ${result.scope.projectSlug}/${result.scope.environment}.`,
|
|
64359
|
-
result.removed.length ? `${result.dryRun ? "Would remove" : "Removed"} ${result.removed.length} value${suffix(result.removed.length)}.` : undefined,
|
|
64360
|
-
result.unchanged.length ? `${result.unchanged.length} unchanged.` : undefined,
|
|
64361
|
-
...result.changed.map((value) => `- ${value.name} (${value.sensitive ? "sensitive" : "plain"})`),
|
|
64362
|
-
...result.warnings.map((warning) => warning.name ? `- skipped ${warning.name}: ${warning.reason}` : `- warning: ${warning.reason}`)
|
|
64363
|
-
].filter((line) => Boolean(line)).join(`
|
|
64364
|
-
`));
|
|
64365
|
-
};
|
|
64366
|
-
var secretsConfigPath = (action, positionals, argv) => {
|
|
64367
|
-
const explicit = readFlagFromPositionals("--config", positionals);
|
|
64368
|
-
if (explicit) {
|
|
64369
|
-
return explicit;
|
|
64370
|
-
}
|
|
64371
|
-
if (action === "get") {
|
|
64372
|
-
return positionals[2];
|
|
64373
|
-
}
|
|
64374
|
-
if (action === "upload") {
|
|
64375
|
-
return positionals[2];
|
|
64376
|
-
}
|
|
64377
|
-
if (action === "set") {
|
|
64378
|
-
return positionals.slice(1).find((value) => !value.includes("="));
|
|
64379
|
-
}
|
|
64380
|
-
if (action === "run") {
|
|
64381
|
-
return configPathBeforeSeparator(3, argv);
|
|
64315
|
+
}
|
|
64316
|
+
return;
|
|
64382
64317
|
}
|
|
64383
|
-
|
|
64384
|
-
|
|
64385
|
-
|
|
64386
|
-
|
|
64387
|
-
|
|
64388
|
-
|
|
64318
|
+
if (provider2 === "cloudflare" && action === "drift") {
|
|
64319
|
+
const output = await client.cloudflareResourceDrift({
|
|
64320
|
+
projectSlug: runtime.readFlag("--project")
|
|
64321
|
+
});
|
|
64322
|
+
if (runtime.readBooleanFlag("--markdown")) {
|
|
64323
|
+
runtime.writeText(formatCloudflareResourceDriftMarkdown(output));
|
|
64324
|
+
} else {
|
|
64325
|
+
runtime.writeData(output);
|
|
64326
|
+
}
|
|
64327
|
+
return;
|
|
64389
64328
|
}
|
|
64390
|
-
|
|
64391
|
-
|
|
64392
|
-
|
|
64393
|
-
|
|
64394
|
-
|
|
64329
|
+
if (provider2 === "cloudflare" && action === "usage-queries") {
|
|
64330
|
+
const output = await client.cloudflareUsageQueries({
|
|
64331
|
+
datetimeEnd: runtime.readFlag("--until"),
|
|
64332
|
+
datetimeStart: runtime.readFlag("--since"),
|
|
64333
|
+
projectSlug: runtime.readFlag("--project")
|
|
64334
|
+
});
|
|
64335
|
+
if (runtime.readBooleanFlag("--markdown")) {
|
|
64336
|
+
runtime.writeText(formatCloudflareUsageQueriesMarkdown(output));
|
|
64337
|
+
} else {
|
|
64338
|
+
runtime.writeData(output);
|
|
64339
|
+
}
|
|
64395
64340
|
return;
|
|
64396
64341
|
}
|
|
64397
|
-
|
|
64342
|
+
runtime.fail("Usage: pier provider cloudflare <plan|connection-plan|drift|resources|usage-queries> [--markdown] [--api <url|local>]");
|
|
64398
64343
|
};
|
|
64399
|
-
|
|
64400
|
-
|
|
64401
|
-
|
|
64402
|
-
|
|
64344
|
+
|
|
64345
|
+
// src/format/restore-format.ts
|
|
64346
|
+
var formatRestorePlanMarkdown = (plan) => {
|
|
64347
|
+
const lines = [
|
|
64348
|
+
"# Pier Restore Plan",
|
|
64349
|
+
"",
|
|
64350
|
+
`Risk: ${plan.risk}`,
|
|
64351
|
+
`Backup: ${plan.backup.checksum}`,
|
|
64352
|
+
`Generated: ${plan.backup.generatedAt}`,
|
|
64353
|
+
"",
|
|
64354
|
+
"## Summary",
|
|
64355
|
+
"",
|
|
64356
|
+
`- Changes: ${plan.summary.changeCount}`,
|
|
64357
|
+
`- Records to restore: ${plan.summary.restoreRecords}`,
|
|
64358
|
+
`- Records to remove: ${plan.summary.removeRecords}`,
|
|
64359
|
+
"",
|
|
64360
|
+
"## Counts",
|
|
64361
|
+
"",
|
|
64362
|
+
`- Projects: ${plan.counts.projects}`,
|
|
64363
|
+
`- Apps: ${plan.counts.apps}`,
|
|
64364
|
+
`- Deployments: ${plan.counts.deployments}`,
|
|
64365
|
+
`- Resources: ${plan.counts.resources}`,
|
|
64366
|
+
`- Artifacts: ${plan.counts.artifacts}`,
|
|
64367
|
+
`- Secrets: ${plan.counts.secrets}`,
|
|
64368
|
+
`- Variables: ${plan.counts.variables}`,
|
|
64369
|
+
"",
|
|
64370
|
+
"## Changes",
|
|
64371
|
+
"",
|
|
64372
|
+
...plan.changes.length ? plan.changes.map((change) => `- ${change}`) : ["- none"],
|
|
64373
|
+
"",
|
|
64374
|
+
"## Warnings",
|
|
64375
|
+
"",
|
|
64376
|
+
...plan.warnings.length ? plan.warnings.map((warning) => `- ${warning}`) : ["- none"]
|
|
64377
|
+
];
|
|
64378
|
+
return lines.join(`
|
|
64379
|
+
`);
|
|
64403
64380
|
};
|
|
64404
|
-
|
|
64405
|
-
|
|
64406
|
-
|
|
64407
|
-
|
|
64381
|
+
|
|
64382
|
+
// src/commands/restore-command.ts
|
|
64383
|
+
var runRestoreCommand = async (runtime) => {
|
|
64384
|
+
const action = runtime.positionals[0];
|
|
64385
|
+
const backupPath = runtime.positionals[1];
|
|
64386
|
+
const apiUrl = runtime.requireApiUrl();
|
|
64387
|
+
const restore = runtime.clientFor(apiUrl).backups.restore;
|
|
64388
|
+
if (action === "plan") {
|
|
64389
|
+
if (!backupPath || backupPath.startsWith("--")) {
|
|
64390
|
+
runtime.fail(`Usage: pier restore plan <backup-json> [${apiFlag} <url|local>]`);
|
|
64391
|
+
}
|
|
64392
|
+
const backup = backupExportSchema.parse(await runtime.readJsonFile(backupPath));
|
|
64393
|
+
const plan = await restore.plan({ backup });
|
|
64394
|
+
if (runtime.readBooleanFlag("--markdown")) {
|
|
64395
|
+
runtime.writeText(formatRestorePlanMarkdown(plan));
|
|
64396
|
+
} else {
|
|
64397
|
+
runtime.writeData(plan);
|
|
64398
|
+
}
|
|
64399
|
+
return;
|
|
64408
64400
|
}
|
|
64409
|
-
|
|
64401
|
+
if (action === "apply") {
|
|
64402
|
+
if (!backupPath || backupPath.startsWith("--")) {
|
|
64403
|
+
runtime.fail(`Usage: pier restore apply <backup-json> --checkpoint <hash> --reason <reason> --confirm <token> [${apiFlag} <url|local>]`);
|
|
64404
|
+
}
|
|
64405
|
+
const checkpointHash = runtime.readFlag("--checkpoint");
|
|
64406
|
+
const reason = runtime.readFlag("--reason");
|
|
64407
|
+
const confirmation = runtime.readFlag("--confirm");
|
|
64408
|
+
if (!checkpointHash || !reason || !confirmation) {
|
|
64409
|
+
runtime.fail("Restore apply requires --checkpoint, --reason, and --confirm.");
|
|
64410
|
+
}
|
|
64411
|
+
const backup = backupExportSchema.parse(await runtime.readJsonFile(backupPath));
|
|
64412
|
+
runtime.writeData(await restore.apply({
|
|
64413
|
+
actor: runtime.user ?? defaultDeploySource,
|
|
64414
|
+
checkpointHash,
|
|
64415
|
+
confirmation,
|
|
64416
|
+
reason,
|
|
64417
|
+
restorePlan: { backup }
|
|
64418
|
+
}));
|
|
64419
|
+
return;
|
|
64420
|
+
}
|
|
64421
|
+
runtime.fail(`Unknown restore action: ${action ?? ""}`);
|
|
64410
64422
|
};
|
|
64411
|
-
var suffix = (count) => count === 1 ? "" : "s";
|
|
64412
64423
|
|
|
64413
64424
|
// src/format/agent-format.ts
|
|
64414
64425
|
function formatAgentNextActionsMarkdown(summary) {
|
|
@@ -64886,7 +64897,7 @@ function stripOuterQuotes(value) {
|
|
|
64886
64897
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
64887
64898
|
import { homedir as homedir2 } from "os";
|
|
64888
64899
|
import { dirname as dirname3, resolve as resolve2 } from "path";
|
|
64889
|
-
var pierConfigPath = (
|
|
64900
|
+
var pierConfigPath = (env2) => env2.PIER_CONFIG ?? resolve2(env2.XDG_CONFIG_HOME ?? resolve2(homedir2(), ".config"), "pier/config.toml");
|
|
64890
64901
|
var pierConfigTemplate = `# Pier CLI config
|
|
64891
64902
|
#
|
|
64892
64903
|
# Path:
|
|
@@ -64908,16 +64919,16 @@ url = "https://api.pier.dev.dawson.gg"
|
|
|
64908
64919
|
[api.profiles.prod]
|
|
64909
64920
|
url = "${hostedApiUrl}"
|
|
64910
64921
|
`;
|
|
64911
|
-
var readPierCliConfig = (
|
|
64912
|
-
const path2 = pierConfigPath(
|
|
64922
|
+
var readPierCliConfig = (env2 = process.env) => {
|
|
64923
|
+
const path2 = pierConfigPath(env2);
|
|
64913
64924
|
if (!existsSync(path2)) {
|
|
64914
64925
|
return {};
|
|
64915
64926
|
}
|
|
64916
64927
|
const parsed = Bun.TOML.parse(readFileSync2(path2, "utf8"));
|
|
64917
64928
|
return normalizePierCliConfig(parsed);
|
|
64918
64929
|
};
|
|
64919
|
-
var writePierCliConfigTemplate = (
|
|
64920
|
-
const path2 = pierConfigPath(
|
|
64930
|
+
var writePierCliConfigTemplate = (env2 = process.env, options = {}) => {
|
|
64931
|
+
const path2 = pierConfigPath(env2);
|
|
64921
64932
|
if (existsSync(path2) && !options.force) {
|
|
64922
64933
|
return { created: false, path: path2 };
|
|
64923
64934
|
}
|
|
@@ -65222,10 +65233,10 @@ var runDoctorReport = (input) => {
|
|
|
65222
65233
|
requiredVariables
|
|
65223
65234
|
};
|
|
65224
65235
|
};
|
|
65225
|
-
var requiredVariableStatuses = (vars,
|
|
65236
|
+
var requiredVariableStatuses = (vars, env2) => Object.entries(vars).filter(([, definition]) => !definition.isOptional).map(([name, definition]) => ({
|
|
65226
65237
|
kind: definition.kind,
|
|
65227
65238
|
name,
|
|
65228
|
-
present: Boolean(
|
|
65239
|
+
present: Boolean(env2[name]),
|
|
65229
65240
|
...definition.isSensitive ? { sensitive: true } : {}
|
|
65230
65241
|
}));
|
|
65231
65242
|
var doctorFindings = (input, requiredVariables) => {
|
|
@@ -65378,8 +65389,8 @@ function generateVariableValue(definition) {
|
|
|
65378
65389
|
function dotenvValue(value) {
|
|
65379
65390
|
return /^[A-Za-z0-9_./:@-]+$/.test(value) ? value : JSON.stringify(value);
|
|
65380
65391
|
}
|
|
65381
|
-
function applyEnv(
|
|
65382
|
-
for (const [name, value] of Object.entries(
|
|
65392
|
+
function applyEnv(env2) {
|
|
65393
|
+
for (const [name, value] of Object.entries(env2)) {
|
|
65383
65394
|
process.env[name] = value;
|
|
65384
65395
|
}
|
|
65385
65396
|
}
|
|
@@ -67269,7 +67280,7 @@ function Postgres(a, b2) {
|
|
|
67269
67280
|
function parseOptions(a, b2) {
|
|
67270
67281
|
if (a && a.shared)
|
|
67271
67282
|
return a;
|
|
67272
|
-
const
|
|
67283
|
+
const env2 = process.env, o = (!a || typeof a === "string" ? b2 : a) || {}, { url: url2, multihost } = parseUrl(a), query = [...url2.searchParams].reduce((a2, [b3, c]) => (a2[b3] = c, a2), {}), host = o.hostname || o.host || multihost || url2.hostname || env2.PGHOST || "localhost", port = o.port || url2.port || env2.PGPORT || 5432, user = o.user || o.username || url2.username || env2.PGUSERNAME || env2.PGUSER || osUsername();
|
|
67273
67284
|
o.no_prepare && (o.prepare = false);
|
|
67274
67285
|
query.sslmode && (query.ssl = query.sslmode, delete query.sslmode);
|
|
67275
67286
|
"timeout" in o && (console.log("The timeout option is deprecated, use idle_timeout instead"), o.idle_timeout = o.timeout);
|
|
@@ -67295,21 +67306,21 @@ function parseOptions(a, b2) {
|
|
|
67295
67306
|
host: Array.isArray(host) ? host : host.split(",").map((x) => x.split(":")[0]),
|
|
67296
67307
|
port: Array.isArray(port) ? port : host.split(",").map((x) => parseInt(x.split(":")[1] || port)),
|
|
67297
67308
|
path: o.path || host.indexOf("/") > -1 && host + "/.s.PGSQL." + port,
|
|
67298
|
-
database: o.database || o.db || (url2.pathname || "").slice(1) ||
|
|
67309
|
+
database: o.database || o.db || (url2.pathname || "").slice(1) || env2.PGDATABASE || user,
|
|
67299
67310
|
user,
|
|
67300
|
-
pass: o.pass || o.password || url2.password ||
|
|
67311
|
+
pass: o.pass || o.password || url2.password || env2.PGPASSWORD || "",
|
|
67301
67312
|
...Object.entries(defaults2).reduce((acc, [k, d]) => {
|
|
67302
|
-
const value = k in o ? o[k] : (k in query) ? query[k] === "disable" || query[k] === "false" ? false : query[k] :
|
|
67313
|
+
const value = k in o ? o[k] : (k in query) ? query[k] === "disable" || query[k] === "false" ? false : query[k] : env2["PG" + k.toUpperCase()] || d;
|
|
67303
67314
|
acc[k] = typeof value === "string" && ints.includes(k) ? +value : value;
|
|
67304
67315
|
return acc;
|
|
67305
67316
|
}, {}),
|
|
67306
67317
|
connection: {
|
|
67307
|
-
application_name:
|
|
67318
|
+
application_name: env2.PGAPPNAME || "postgres.js",
|
|
67308
67319
|
...o.connection,
|
|
67309
67320
|
...Object.entries(query).reduce((acc, [k, v]) => ((k in defaults2) || (acc[k] = v), acc), {})
|
|
67310
67321
|
},
|
|
67311
67322
|
types: o.types || {},
|
|
67312
|
-
target_session_attrs: tsa(o, url2,
|
|
67323
|
+
target_session_attrs: tsa(o, url2, env2),
|
|
67313
67324
|
onnotice: o.onnotice,
|
|
67314
67325
|
onnotify: o.onnotify,
|
|
67315
67326
|
onclose: o.onclose,
|
|
@@ -67321,8 +67332,8 @@ function parseOptions(a, b2) {
|
|
|
67321
67332
|
...mergeUserTypes(o.types)
|
|
67322
67333
|
};
|
|
67323
67334
|
}
|
|
67324
|
-
function tsa(o, url2,
|
|
67325
|
-
const x = o.target_session_attrs || url2.searchParams.get("target_session_attrs") ||
|
|
67335
|
+
function tsa(o, url2, env2) {
|
|
67336
|
+
const x = o.target_session_attrs || url2.searchParams.get("target_session_attrs") || env2.PGTARGETSESSIONATTRS;
|
|
67326
67337
|
if (!x || ["read-write", "read-only", "primary", "standby", "prefer-standby"].includes(x))
|
|
67327
67338
|
return x;
|
|
67328
67339
|
throw new Error("target_session_attrs " + x + " is not supported");
|
|
@@ -67923,45 +67934,29 @@ async function runPierCommand(tokens) {
|
|
|
67923
67934
|
}
|
|
67924
67935
|
if (command === "env") {
|
|
67925
67936
|
const exitCode = await runEnvCommand({
|
|
67926
|
-
clientFor,
|
|
67927
|
-
environmentKindFor,
|
|
67928
|
-
fail,
|
|
67929
|
-
loadConfig,
|
|
67930
|
-
positionals: cli.positionals,
|
|
67931
|
-
readBooleanFlag,
|
|
67932
|
-
readFlag,
|
|
67933
|
-
requireApiUrl,
|
|
67934
|
-
resolveConfigPath,
|
|
67935
|
-
scopedManifest,
|
|
67936
|
-
toManifest,
|
|
67937
|
-
user: process.env.USER,
|
|
67938
|
-
writeData,
|
|
67939
|
-
writeEnvTypes,
|
|
67940
|
-
writeText
|
|
67941
|
-
});
|
|
67942
|
-
process.exit(exitCode ?? 0);
|
|
67943
|
-
}
|
|
67944
|
-
if (command === "secrets") {
|
|
67945
|
-
await runSecretsCommand({
|
|
67946
67937
|
clientFor,
|
|
67947
67938
|
detectDeploySource,
|
|
67939
|
+
environmentKindFor,
|
|
67948
67940
|
fail,
|
|
67949
67941
|
loadConfig,
|
|
67950
67942
|
positionals: cli.positionals,
|
|
67951
|
-
processArgv:
|
|
67943
|
+
processArgv: cliTokens,
|
|
67952
67944
|
readBooleanFlag,
|
|
67953
67945
|
readDotenv,
|
|
67954
67946
|
readFlag,
|
|
67947
|
+
requireApiUrl,
|
|
67955
67948
|
resolveConfigPath,
|
|
67956
67949
|
runCommandWithPierValues,
|
|
67957
67950
|
scopedManifest,
|
|
67958
67951
|
shouldColorHumanOutput,
|
|
67952
|
+
toManifest,
|
|
67959
67953
|
user: process.env.USER,
|
|
67960
67954
|
writeData,
|
|
67955
|
+
writeEnvTypes,
|
|
67961
67956
|
writeFile: writeFile5,
|
|
67962
67957
|
writeText
|
|
67963
67958
|
});
|
|
67964
|
-
process.exit(0);
|
|
67959
|
+
process.exit(exitCode ?? 0);
|
|
67965
67960
|
}
|
|
67966
67961
|
if (command === "domains") {
|
|
67967
67962
|
await runDomainsCommand({
|
|
@@ -68299,18 +68294,18 @@ async function runCommandWithPierValues(input) {
|
|
|
68299
68294
|
environment: input.environment,
|
|
68300
68295
|
manifest: input.manifest
|
|
68301
68296
|
});
|
|
68302
|
-
const
|
|
68297
|
+
const env2 = {
|
|
68303
68298
|
...runtimeEnv,
|
|
68304
68299
|
...values2.values
|
|
68305
68300
|
};
|
|
68306
|
-
const missing = missingRequiredRunValues(input.manifest,
|
|
68301
|
+
const missing = missingRequiredRunValues(input.manifest, env2);
|
|
68307
68302
|
if (missing.length) {
|
|
68308
68303
|
fail(`Missing required values for ${input.environment}: ${missing.join(", ")}`);
|
|
68309
68304
|
}
|
|
68310
|
-
await runCommand2([...input.commandArgs], devEnvForChild(
|
|
68305
|
+
await runCommand2([...input.commandArgs], devEnvForChild(env2));
|
|
68311
68306
|
}
|
|
68312
68307
|
async function resolvePierRunValues(input) {
|
|
68313
|
-
const client = clientFor(input.apiUrl).
|
|
68308
|
+
const client = clientFor(input.apiUrl).env;
|
|
68314
68309
|
if (input.app) {
|
|
68315
68310
|
return client.resolveForRun({
|
|
68316
68311
|
actor: input.actor,
|
|
@@ -68343,8 +68338,8 @@ async function resolvePierRunValues(input) {
|
|
|
68343
68338
|
})
|
|
68344
68339
|
};
|
|
68345
68340
|
}
|
|
68346
|
-
function missingRequiredRunValues(manifest,
|
|
68347
|
-
return manifest.vars.filter((definition) => !definition.optional).map((definition) => definition.name).filter((name) => !
|
|
68341
|
+
function missingRequiredRunValues(manifest, env2) {
|
|
68342
|
+
return manifest.vars.filter((definition) => !definition.optional).map((definition) => definition.name).filter((name) => !env2[name]).toSorted();
|
|
68348
68343
|
}
|
|
68349
68344
|
function configuredApiUrl() {
|
|
68350
68345
|
const explicitApi = readFlag(apiFlag);
|
|
@@ -68507,9 +68502,9 @@ async function recordLocalDaemonResourceStatus(input) {
|
|
|
68507
68502
|
projectSlug: input.projectSlug
|
|
68508
68503
|
});
|
|
68509
68504
|
}
|
|
68510
|
-
async function runDevCommand(args,
|
|
68505
|
+
async function runDevCommand(args, env2, config2, appName) {
|
|
68511
68506
|
const child = Bun.spawn(args, {
|
|
68512
|
-
env,
|
|
68507
|
+
env: env2,
|
|
68513
68508
|
stderr: "pipe",
|
|
68514
68509
|
stdin: "inherit",
|
|
68515
68510
|
stdout: "pipe"
|
|
@@ -68525,9 +68520,9 @@ async function runDevCommand(args, env, config2, appName) {
|
|
|
68525
68520
|
await recordDevSessionExit(config2, appName, exitCode);
|
|
68526
68521
|
process.exit(exitCode);
|
|
68527
68522
|
}
|
|
68528
|
-
async function runDevWorkerCommand(runtime,
|
|
68523
|
+
async function runDevWorkerCommand(runtime, env2, config2, appName) {
|
|
68529
68524
|
const child = Bun.spawn(["node", runtime.entrypoint, runtime.configPath], {
|
|
68530
|
-
env,
|
|
68525
|
+
env: env2,
|
|
68531
68526
|
stderr: "pipe",
|
|
68532
68527
|
stdin: "inherit",
|
|
68533
68528
|
stdout: "pipe"
|
|
@@ -68625,18 +68620,18 @@ function ignoredWatchPath(path2) {
|
|
|
68625
68620
|
const normalized = path2.replaceAll("\\", "/");
|
|
68626
68621
|
return normalized === ".pier" || normalized.startsWith(".pier/") || normalized.includes("/.pier/") || normalized === "node_modules" || normalized.startsWith("node_modules/") || normalized.includes("/node_modules/") || normalized.endsWith(".map") || normalized.endsWith("~");
|
|
68627
68622
|
}
|
|
68628
|
-
function devEnvForChild(
|
|
68629
|
-
if (!shouldForceColor(
|
|
68630
|
-
return
|
|
68623
|
+
function devEnvForChild(env2) {
|
|
68624
|
+
if (!shouldForceColor(env2)) {
|
|
68625
|
+
return env2;
|
|
68631
68626
|
}
|
|
68632
68627
|
return {
|
|
68633
|
-
...
|
|
68634
|
-
CLICOLOR_FORCE:
|
|
68635
|
-
FORCE_COLOR:
|
|
68628
|
+
...env2,
|
|
68629
|
+
CLICOLOR_FORCE: env2.CLICOLOR_FORCE ?? "1",
|
|
68630
|
+
FORCE_COLOR: env2.FORCE_COLOR ?? "1"
|
|
68636
68631
|
};
|
|
68637
68632
|
}
|
|
68638
|
-
function shouldForceColor(
|
|
68639
|
-
if (
|
|
68633
|
+
function shouldForceColor(env2) {
|
|
68634
|
+
if (env2.NO_COLOR) {
|
|
68640
68635
|
return false;
|
|
68641
68636
|
}
|
|
68642
68637
|
return process.stdout.isTTY || process.stderr.isTTY;
|
|
@@ -68970,10 +68965,10 @@ async function deploySingleApp(config2, appName, options, deploymentGroup) {
|
|
|
68970
68965
|
}
|
|
68971
68966
|
stage = "env";
|
|
68972
68967
|
writeStatus(formatDeployAppProgress(appName, "env"));
|
|
68973
|
-
const
|
|
68968
|
+
const env2 = await loadCliEnv(config2, { environment: options.environment });
|
|
68974
68969
|
stage = "artifact";
|
|
68975
68970
|
writeStatus(formatDeployAppProgress(appName, "artifact"));
|
|
68976
|
-
const artifact = deploymentArtifactSchema.parse(await buildDeploymentArtifact({ appName, config: config2, env }));
|
|
68971
|
+
const artifact = deploymentArtifactSchema.parse(await buildDeploymentArtifact({ appName, config: config2, env: env2 }));
|
|
68977
68972
|
writeStatus(formatDeploymentArtifactSummary(appName, artifact));
|
|
68978
68973
|
stage = "variables";
|
|
68979
68974
|
writeStatus(formatDeployAppProgress(appName, "variables"));
|
|
@@ -69048,14 +69043,14 @@ async function directDeployApp(config2, appName, options) {
|
|
|
69048
69043
|
if (!isWorkerAppSlotKind2(app.kind) && app.kind !== "tanstack-start-app" && app.kind !== "astro-site") {
|
|
69049
69044
|
fail(`Direct deploy is not implemented for app kind: ${app.kind}`);
|
|
69050
69045
|
}
|
|
69051
|
-
const
|
|
69052
|
-
const accountId =
|
|
69053
|
-
const apiToken =
|
|
69046
|
+
const env2 = await loadCliEnv(config2, { environment: options.environment });
|
|
69047
|
+
const accountId = env2.CLOUDFLARE_ACCOUNT_ID;
|
|
69048
|
+
const apiToken = env2.CLOUDFLARE_API_TOKEN;
|
|
69054
69049
|
if (!accountId || !apiToken) {
|
|
69055
69050
|
fail("Direct deploy requires CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN.");
|
|
69056
69051
|
}
|
|
69057
69052
|
const cloudflare2 = createCloudflareApi({ accountId, apiToken });
|
|
69058
|
-
const artifact = await buildDeploymentArtifact({ appName, config: config2, env });
|
|
69053
|
+
const artifact = await buildDeploymentArtifact({ appName, config: config2, env: env2 });
|
|
69059
69054
|
const variables = await collectDeploymentVars(config2, appName, {
|
|
69060
69055
|
environment: options.environment
|
|
69061
69056
|
});
|
|
@@ -69143,8 +69138,8 @@ async function exportCloudflareApp(config2, appName, options) {
|
|
|
69143
69138
|
if (!isWorkerAppSlotKind2(app.kind) && app.kind !== "tanstack-start-app" && app.kind !== "astro-site") {
|
|
69144
69139
|
fail(`Cloudflare export is not implemented for app kind: ${app.kind}`);
|
|
69145
69140
|
}
|
|
69146
|
-
const
|
|
69147
|
-
const artifact = await buildDeploymentArtifact({ appName, config: config2, env });
|
|
69141
|
+
const env2 = await loadCliEnv(config2, { environment: options.environment });
|
|
69142
|
+
const artifact = await buildDeploymentArtifact({ appName, config: config2, env: env2 });
|
|
69148
69143
|
const variables = await collectDeploymentVars(config2, appName, {
|
|
69149
69144
|
environment: options.environment
|
|
69150
69145
|
});
|
|
@@ -69279,13 +69274,13 @@ async function collectDeploymentVars(config2, appName, options = {}) {
|
|
|
69279
69274
|
fail(`Unknown app: ${appName}`);
|
|
69280
69275
|
}
|
|
69281
69276
|
const names = app.vars ?? Object.keys(config2.vars ?? {});
|
|
69282
|
-
const
|
|
69277
|
+
const env2 = await loadCliEnv(config2, options);
|
|
69283
69278
|
return names.flatMap((name) => {
|
|
69284
69279
|
const definition = config2.vars?.[name];
|
|
69285
69280
|
if (!definition) {
|
|
69286
69281
|
fail(`App "${appName}" references unknown var "${name}".`);
|
|
69287
69282
|
}
|
|
69288
|
-
const value = deploymentVariableValue(definition,
|
|
69283
|
+
const value = deploymentVariableValue(definition, env2[name]);
|
|
69289
69284
|
if (value === undefined || value === "") {
|
|
69290
69285
|
return [];
|
|
69291
69286
|
}
|
|
@@ -69352,31 +69347,31 @@ function deploymentVariableValue(definition, value) {
|
|
|
69352
69347
|
return;
|
|
69353
69348
|
}
|
|
69354
69349
|
async function loadCliEnv(config2, options = {}) {
|
|
69355
|
-
const
|
|
69350
|
+
const env2 = { ...process.env };
|
|
69356
69351
|
for (const path2 of cliEnvFiles(options.environment)) {
|
|
69357
69352
|
const values2 = await readDotenv(path2);
|
|
69358
69353
|
for (const [name, value] of Object.entries(values2)) {
|
|
69359
|
-
if (!
|
|
69360
|
-
|
|
69354
|
+
if (!env2[name]) {
|
|
69355
|
+
env2[name] = value;
|
|
69361
69356
|
}
|
|
69362
69357
|
}
|
|
69363
69358
|
}
|
|
69364
|
-
|
|
69359
|
+
env2.PIER_ENV = options.environment ?? env2.PIER_ENV ?? defaultEnvironment;
|
|
69365
69360
|
if (config2) {
|
|
69366
|
-
await materializeGeneratedEnv(config2,
|
|
69367
|
-
applyDefaultEnvValues(config2,
|
|
69368
|
-
expandPublicEnvAliases(config2,
|
|
69361
|
+
await materializeGeneratedEnv(config2, env2);
|
|
69362
|
+
applyDefaultEnvValues(config2, env2);
|
|
69363
|
+
expandPublicEnvAliases(config2, env2);
|
|
69369
69364
|
}
|
|
69370
|
-
return
|
|
69365
|
+
return env2;
|
|
69371
69366
|
}
|
|
69372
|
-
function applyDefaultEnvValues(config2,
|
|
69367
|
+
function applyDefaultEnvValues(config2, env2) {
|
|
69373
69368
|
for (const [name, definition] of Object.entries(config2.vars ?? {})) {
|
|
69374
|
-
if (
|
|
69369
|
+
if (env2[name] || !definition.hasDefault) {
|
|
69375
69370
|
continue;
|
|
69376
69371
|
}
|
|
69377
69372
|
const value = deploymentVariableValue(definition, undefined);
|
|
69378
69373
|
if (value !== undefined && value !== "") {
|
|
69379
|
-
|
|
69374
|
+
env2[name] = serializeDeploymentVariable(definition, value);
|
|
69380
69375
|
}
|
|
69381
69376
|
}
|
|
69382
69377
|
}
|
|
@@ -69386,8 +69381,8 @@ function cliEnvFiles(environment) {
|
|
|
69386
69381
|
}
|
|
69387
69382
|
return [".env", ".env.dev", "apps/api/.env"];
|
|
69388
69383
|
}
|
|
69389
|
-
function expandPublicEnvAliases(config2,
|
|
69390
|
-
const output =
|
|
69384
|
+
function expandPublicEnvAliases(config2, env2) {
|
|
69385
|
+
const output = env2;
|
|
69391
69386
|
for (const [name, definition] of Object.entries(config2.vars ?? {})) {
|
|
69392
69387
|
if (!definition.isPublic) {
|
|
69393
69388
|
continue;
|
|
@@ -69402,11 +69397,11 @@ function expandPublicEnvAliases(config2, env) {
|
|
|
69402
69397
|
output[alias] = value;
|
|
69403
69398
|
}
|
|
69404
69399
|
}
|
|
69405
|
-
return
|
|
69400
|
+
return env2;
|
|
69406
69401
|
}
|
|
69407
|
-
async function materializeGeneratedEnv(config2,
|
|
69402
|
+
async function materializeGeneratedEnv(config2, env2) {
|
|
69408
69403
|
const generated = Object.entries(config2.vars ?? {}).flatMap(([name, definition]) => {
|
|
69409
|
-
if (!definition.generator ||
|
|
69404
|
+
if (!definition.generator || env2[name]) {
|
|
69410
69405
|
return [];
|
|
69411
69406
|
}
|
|
69412
69407
|
return [[name, generateVariableValue(definition)]];
|
|
@@ -69423,7 +69418,7 @@ async function materializeGeneratedEnv(config2, env) {
|
|
|
69423
69418
|
${lines}
|
|
69424
69419
|
`);
|
|
69425
69420
|
for (const [name, value] of generated) {
|
|
69426
|
-
|
|
69421
|
+
env2[name] = value;
|
|
69427
69422
|
}
|
|
69428
69423
|
}
|
|
69429
69424
|
function detectDeploySource() {
|
|
@@ -70066,12 +70061,12 @@ function resolveServiceBindings(config2, bindingNames) {
|
|
|
70066
70061
|
service: workerName2(config2, binding.target ?? name.toLowerCase())
|
|
70067
70062
|
}));
|
|
70068
70063
|
}
|
|
70069
|
-
function resolveVars(config2, bindingNames, port,
|
|
70064
|
+
function resolveVars(config2, bindingNames, port, env2 = process.env) {
|
|
70070
70065
|
const values2 = {};
|
|
70071
70066
|
const vars = config2.vars ?? {};
|
|
70072
70067
|
for (const [name, definition] of Object.entries(vars)) {
|
|
70073
|
-
if (
|
|
70074
|
-
values2[name] =
|
|
70068
|
+
if (env2[name]) {
|
|
70069
|
+
values2[name] = env2[name];
|
|
70075
70070
|
continue;
|
|
70076
70071
|
}
|
|
70077
70072
|
if (definition.hasDefault) {
|
|
@@ -70111,7 +70106,7 @@ function runAppFromContext(config2) {
|
|
|
70111
70106
|
const appNames = Object.keys(config2.apps ?? {});
|
|
70112
70107
|
return appNames.length === 1 ? appNames[0] : undefined;
|
|
70113
70108
|
}
|
|
70114
|
-
async function runCommand2(args,
|
|
70109
|
+
async function runCommand2(args, env2, options = {}) {
|
|
70115
70110
|
if (args.length === 0) {
|
|
70116
70111
|
fail("Missing command.");
|
|
70117
70112
|
}
|
|
@@ -70119,7 +70114,7 @@ async function runCommand2(args, env, options = {}) {
|
|
|
70119
70114
|
const exitCode = await new Promise((resolve5, reject) => {
|
|
70120
70115
|
const child = nodeSpawn(command2, commandArgs, {
|
|
70121
70116
|
...options.cwd ? { cwd: options.cwd } : {},
|
|
70122
|
-
env,
|
|
70117
|
+
env: env2,
|
|
70123
70118
|
stdio: "inherit"
|
|
70124
70119
|
});
|
|
70125
70120
|
child.on("error", reject);
|
|
@@ -71006,10 +71001,13 @@ async function withApiAuth(init2) {
|
|
|
71006
71001
|
};
|
|
71007
71002
|
}
|
|
71008
71003
|
async function optionalPierApiKey() {
|
|
71009
|
-
const envApiKey = process.env.
|
|
71004
|
+
const envApiKey = process.env.PIER_API_KEY;
|
|
71010
71005
|
if (envApiKey) {
|
|
71011
71006
|
return envApiKey;
|
|
71012
71007
|
}
|
|
71008
|
+
if (process.env.PIER_DISABLE_STORED_API_KEY === "1") {
|
|
71009
|
+
return;
|
|
71010
|
+
}
|
|
71013
71011
|
return readStoredPierApiKey().catch(() => {
|
|
71014
71012
|
return;
|
|
71015
71013
|
});
|
|
@@ -71185,169 +71183,6 @@ class HelpCommand2 extends Command {
|
|
|
71185
71183
|
}
|
|
71186
71184
|
}
|
|
71187
71185
|
|
|
71188
|
-
class SecretsListCommand extends Command {
|
|
71189
|
-
static paths = [["secrets"], ["secrets", "list"]];
|
|
71190
|
-
static usage = Command.Usage({
|
|
71191
|
-
description: "List Pier cloud runtime values declared by platform.config.ts.",
|
|
71192
|
-
examples: [
|
|
71193
|
-
["List dev values", "$0 secrets list"],
|
|
71194
|
-
["List prod values", "$0 secrets list --env prod"]
|
|
71195
|
-
]
|
|
71196
|
-
});
|
|
71197
|
-
config = exports_options.String({ name: "config", required: false });
|
|
71198
|
-
env = exports_options.String("--env");
|
|
71199
|
-
app = exports_options.String("--app");
|
|
71200
|
-
api = exports_options.String("--api");
|
|
71201
|
-
organizationId = exports_options.String("--organization-id");
|
|
71202
|
-
project = exports_options.String("--project");
|
|
71203
|
-
json = exports_options.Boolean("--json", false);
|
|
71204
|
-
quiet = exports_options.Boolean("--quiet", false);
|
|
71205
|
-
async execute() {
|
|
71206
|
-
await this.context.runPierCommand([
|
|
71207
|
-
"secrets",
|
|
71208
|
-
"list",
|
|
71209
|
-
...optional2(this.config),
|
|
71210
|
-
...commonSecretFlags(this),
|
|
71211
|
-
...booleanFlag("--json", this.json),
|
|
71212
|
-
...booleanFlag("--quiet", this.quiet)
|
|
71213
|
-
]);
|
|
71214
|
-
}
|
|
71215
|
-
}
|
|
71216
|
-
|
|
71217
|
-
class SecretsGetCommand extends Command {
|
|
71218
|
-
static paths = [["secrets", "get"]];
|
|
71219
|
-
static usage = Command.Usage({
|
|
71220
|
-
description: "Print one Pier cloud runtime value.",
|
|
71221
|
-
examples: [
|
|
71222
|
-
["Read a dev value", "$0 secrets get API_URL"],
|
|
71223
|
-
["Read a prod app value", "$0 secrets get API_URL --env prod --app api"]
|
|
71224
|
-
]
|
|
71225
|
-
});
|
|
71226
|
-
name = exports_options.String({ name: "name" });
|
|
71227
|
-
config = exports_options.String({ name: "config", required: false });
|
|
71228
|
-
env = exports_options.String("--env");
|
|
71229
|
-
app = exports_options.String("--app");
|
|
71230
|
-
api = exports_options.String("--api");
|
|
71231
|
-
organizationId = exports_options.String("--organization-id");
|
|
71232
|
-
project = exports_options.String("--project");
|
|
71233
|
-
json = exports_options.Boolean("--json", false);
|
|
71234
|
-
quiet = exports_options.Boolean("--quiet", false);
|
|
71235
|
-
async execute() {
|
|
71236
|
-
await this.context.runPierCommand([
|
|
71237
|
-
"secrets",
|
|
71238
|
-
"get",
|
|
71239
|
-
this.name,
|
|
71240
|
-
...optional2(this.config),
|
|
71241
|
-
...commonSecretFlags(this),
|
|
71242
|
-
...booleanFlag("--json", this.json),
|
|
71243
|
-
...booleanFlag("--quiet", this.quiet)
|
|
71244
|
-
]);
|
|
71245
|
-
}
|
|
71246
|
-
}
|
|
71247
|
-
|
|
71248
|
-
class SecretsSetCommand extends Command {
|
|
71249
|
-
static paths = [["secrets", "set"]];
|
|
71250
|
-
static usage = Command.Usage({
|
|
71251
|
-
description: "Set one or more Pier cloud runtime values.",
|
|
71252
|
-
examples: [
|
|
71253
|
-
["Set a prod secret", "$0 secrets set API_TOKEN=secret --env prod"]
|
|
71254
|
-
]
|
|
71255
|
-
});
|
|
71256
|
-
pairs = exports_options.Rest({ name: "NAME=value", required: 1 });
|
|
71257
|
-
env = exports_options.String("--env");
|
|
71258
|
-
app = exports_options.String("--app");
|
|
71259
|
-
api = exports_options.String("--api");
|
|
71260
|
-
organizationId = exports_options.String("--organization-id");
|
|
71261
|
-
project = exports_options.String("--project");
|
|
71262
|
-
json = exports_options.Boolean("--json", false);
|
|
71263
|
-
quiet = exports_options.Boolean("--quiet", false);
|
|
71264
|
-
async execute() {
|
|
71265
|
-
await this.context.runPierCommand([
|
|
71266
|
-
"secrets",
|
|
71267
|
-
"set",
|
|
71268
|
-
...this.pairs,
|
|
71269
|
-
...commonSecretFlags(this),
|
|
71270
|
-
...booleanFlag("--json", this.json),
|
|
71271
|
-
...booleanFlag("--quiet", this.quiet)
|
|
71272
|
-
]);
|
|
71273
|
-
}
|
|
71274
|
-
}
|
|
71275
|
-
|
|
71276
|
-
class SecretsUploadCommand extends Command {
|
|
71277
|
-
static paths = [["secrets", "upload"]];
|
|
71278
|
-
static usage = Command.Usage({
|
|
71279
|
-
description: "Upload Pier cloud runtime values from a dotenv file.",
|
|
71280
|
-
examples: [
|
|
71281
|
-
["Preview an upload", "$0 secrets upload .env.prod --env prod --dry-run"],
|
|
71282
|
-
["Upload prod values", "$0 secrets upload .env.prod --env prod"]
|
|
71283
|
-
]
|
|
71284
|
-
});
|
|
71285
|
-
file = exports_options.String({ name: "dotenv-file" });
|
|
71286
|
-
config = exports_options.String({ name: "config", required: false });
|
|
71287
|
-
env = exports_options.String("--env");
|
|
71288
|
-
app = exports_options.String("--app");
|
|
71289
|
-
api = exports_options.String("--api");
|
|
71290
|
-
organizationId = exports_options.String("--organization-id");
|
|
71291
|
-
project = exports_options.String("--project");
|
|
71292
|
-
dryRun = exports_options.Boolean("--dry-run", false);
|
|
71293
|
-
force = exports_options.Boolean("-f,--force", false);
|
|
71294
|
-
replace = exports_options.Boolean("--replace", false);
|
|
71295
|
-
json = exports_options.Boolean("--json", false);
|
|
71296
|
-
quiet = exports_options.Boolean("--quiet", false);
|
|
71297
|
-
async execute() {
|
|
71298
|
-
await this.context.runPierCommand([
|
|
71299
|
-
"secrets",
|
|
71300
|
-
"upload",
|
|
71301
|
-
this.file,
|
|
71302
|
-
...optional2(this.config),
|
|
71303
|
-
...commonSecretFlags(this),
|
|
71304
|
-
...booleanFlag("--dry-run", this.dryRun),
|
|
71305
|
-
...booleanFlag("--replace", this.replace),
|
|
71306
|
-
...booleanFlag("--force", this.force),
|
|
71307
|
-
...booleanFlag("--json", this.json),
|
|
71308
|
-
...booleanFlag("--quiet", this.quiet)
|
|
71309
|
-
]);
|
|
71310
|
-
}
|
|
71311
|
-
}
|
|
71312
|
-
|
|
71313
|
-
class SecretsDownloadCommand extends Command {
|
|
71314
|
-
static paths = [["secrets", "download"]];
|
|
71315
|
-
static usage = Command.Usage({
|
|
71316
|
-
description: "Download Pier cloud runtime values.",
|
|
71317
|
-
examples: [
|
|
71318
|
-
["Print prod dotenv", "$0 secrets download --env prod"],
|
|
71319
|
-
[
|
|
71320
|
-
"Write prod dotenv",
|
|
71321
|
-
"$0 secrets download --env prod --output .env.prod"
|
|
71322
|
-
]
|
|
71323
|
-
]
|
|
71324
|
-
});
|
|
71325
|
-
config = exports_options.String({ name: "config", required: false });
|
|
71326
|
-
env = exports_options.String("--env");
|
|
71327
|
-
app = exports_options.String("--app");
|
|
71328
|
-
api = exports_options.String("--api");
|
|
71329
|
-
organizationId = exports_options.String("--organization-id");
|
|
71330
|
-
project = exports_options.String("--project");
|
|
71331
|
-
format = exports_options.String("--format", "env");
|
|
71332
|
-
output = exports_options.String("--output");
|
|
71333
|
-
out = exports_options.String("--out");
|
|
71334
|
-
json = exports_options.Boolean("--json", false);
|
|
71335
|
-
quiet = exports_options.Boolean("--quiet", false);
|
|
71336
|
-
async execute() {
|
|
71337
|
-
await this.context.runPierCommand([
|
|
71338
|
-
"secrets",
|
|
71339
|
-
"download",
|
|
71340
|
-
...optional2(this.config),
|
|
71341
|
-
...commonSecretFlags(this),
|
|
71342
|
-
"--format",
|
|
71343
|
-
this.format,
|
|
71344
|
-
...optionalFlag("--output", this.output ?? this.out),
|
|
71345
|
-
...booleanFlag("--json", this.json),
|
|
71346
|
-
...booleanFlag("--quiet", this.quiet)
|
|
71347
|
-
]);
|
|
71348
|
-
}
|
|
71349
|
-
}
|
|
71350
|
-
|
|
71351
71186
|
class DeployCommand extends Command {
|
|
71352
71187
|
static paths = [["deploy"]];
|
|
71353
71188
|
static usage = Command.Usage({
|
|
@@ -71383,7 +71218,7 @@ class EnvCommand extends Command {
|
|
|
71383
71218
|
description: "Inspect, generate, and sync Pier runtime environment values.",
|
|
71384
71219
|
examples: [
|
|
71385
71220
|
["Generate env types", "$0 env types"],
|
|
71386
|
-
["List prod API values", "$0 env
|
|
71221
|
+
["List prod API values", "$0 env list --env prod --app api"]
|
|
71387
71222
|
]
|
|
71388
71223
|
});
|
|
71389
71224
|
args = exports_options.Rest({ name: "args" });
|
|
@@ -71393,12 +71228,16 @@ class EnvCommand extends Command {
|
|
|
71393
71228
|
env = exports_options.String("--env");
|
|
71394
71229
|
format = exports_options.String("--format");
|
|
71395
71230
|
kind = exports_options.String("--kind");
|
|
71231
|
+
organizationId = exports_options.String("--organization-id");
|
|
71396
71232
|
out = exports_options.String("--out");
|
|
71397
71233
|
output = exports_options.String("--output");
|
|
71234
|
+
project = exports_options.String("--project");
|
|
71235
|
+
force = exports_options.Boolean("-f,--force", false);
|
|
71398
71236
|
dryRun = exports_options.Boolean("--dry-run", false);
|
|
71399
71237
|
json = exports_options.Boolean("--json", false);
|
|
71238
|
+
quiet = exports_options.Boolean("--quiet", false);
|
|
71400
71239
|
async execute() {
|
|
71401
|
-
const args = this.args.length ? this.args : this.kind && ["list", "types"
|
|
71240
|
+
const args = this.args.length ? this.args : this.kind && ["list", "types"].includes(this.kind) ? [this.kind] : [];
|
|
71402
71241
|
await this.context.runPierCommand([
|
|
71403
71242
|
"env",
|
|
71404
71243
|
...args,
|
|
@@ -71561,11 +71400,6 @@ var createPierCli = () => {
|
|
|
71561
71400
|
});
|
|
71562
71401
|
cli2.register(RootCommand);
|
|
71563
71402
|
cli2.register(HelpCommand2);
|
|
71564
|
-
cli2.register(SecretsListCommand);
|
|
71565
|
-
cli2.register(SecretsGetCommand);
|
|
71566
|
-
cli2.register(SecretsSetCommand);
|
|
71567
|
-
cli2.register(SecretsUploadCommand);
|
|
71568
|
-
cli2.register(SecretsDownloadCommand);
|
|
71569
71403
|
cli2.register(DeployCommand);
|
|
71570
71404
|
cli2.register(EnvCommand);
|
|
71571
71405
|
cli2.register(DomainsCommand);
|
|
@@ -71587,18 +71421,6 @@ var executePierCli = async (argv = process.argv.slice(2)) => {
|
|
|
71587
71421
|
runPierCommand
|
|
71588
71422
|
});
|
|
71589
71423
|
};
|
|
71590
|
-
function commonSecretFlags(input) {
|
|
71591
|
-
return [
|
|
71592
|
-
...optionalFlag("--env", input.env),
|
|
71593
|
-
...optionalFlag("--app", input.app),
|
|
71594
|
-
...optionalFlag("--api", input.api),
|
|
71595
|
-
...optionalFlag("--organization-id", input.organizationId),
|
|
71596
|
-
...optionalFlag("--project", input.project)
|
|
71597
|
-
];
|
|
71598
|
-
}
|
|
71599
|
-
function optional2(value) {
|
|
71600
|
-
return value ? [value] : [];
|
|
71601
|
-
}
|
|
71602
71424
|
function optionalFlag(name, value) {
|
|
71603
71425
|
return value ? [name, value] : [];
|
|
71604
71426
|
}
|
|
@@ -71630,7 +71452,7 @@ var allowedFlagsByCommand = {
|
|
|
71630
71452
|
doctor: flags("api"),
|
|
71631
71453
|
domains: flags("api", "markdown"),
|
|
71632
71454
|
dns: flags("api", "comment", "content", "id", "json", "name", "organizationId", "priority", "proxied", "recordId", "ttl", "type", "zoneId"),
|
|
71633
|
-
env: flags("api", "app", "dryRun", "env", "format", "json", "kind", "out", "output"),
|
|
71455
|
+
env: flags("api", "app", "dryRun", "env", "force", "format", "json", "kind", "organizationId", "out", "output", "project", "quiet"),
|
|
71634
71456
|
export: flags("env", "out"),
|
|
71635
71457
|
inspect: flags("json"),
|
|
71636
71458
|
lifecycle: flags("api", "env", "markdown", "project"),
|