@envmanager-cli/cli 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/bin/envmanager.js +14 -9
- package/dist/bin/envmanager.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,7 @@ envmanager diff
|
|
|
44
44
|
| `template` | Manage .env templates |
|
|
45
45
|
| `validate` | Validate against schema |
|
|
46
46
|
| `completion` | Generate shell completion script |
|
|
47
|
+
| `debug` | Collect diagnostic info for troubleshooting |
|
|
47
48
|
|
|
48
49
|
## Shell Completion
|
|
49
50
|
|
|
@@ -91,9 +92,19 @@ envmanager pull --project 1 --environment development
|
|
|
91
92
|
envmanager pull --project my-api --environment production
|
|
92
93
|
```
|
|
93
94
|
|
|
95
|
+
### Default Environment
|
|
96
|
+
|
|
97
|
+
When `-e` / `--environment` is omitted, it defaults to `development`. You can override the default in `envmanager.json`:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"environment": "staging"
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
94
105
|
### Multiple Organizations
|
|
95
106
|
|
|
96
|
-
If you belong to multiple organizations,
|
|
107
|
+
If you belong to multiple organizations, the CLI auto-detects the organization from your project when possible. Use `--org` to specify explicitly if needed:
|
|
97
108
|
|
|
98
109
|
```bash
|
|
99
110
|
envmanager pull --org "My Company" --project 1 --environment staging
|
package/dist/bin/envmanager.js
CHANGED
|
@@ -1287,7 +1287,7 @@ var diffCommand = new Command6("diff").description("Show differences between loc
|
|
|
1287
1287
|
import { Command as Command7 } from "commander";
|
|
1288
1288
|
import chalk8 from "chalk";
|
|
1289
1289
|
import ora6 from "ora";
|
|
1290
|
-
var listCommand = new Command7("list").description("List projects, environments, or variables").argument("[resource]", "Resource to list: projects, environments, variables", "projects").option("--org <name>", "Organization name (required if you belong to multiple)").option("-p, --project <name-or-id>", "Project name or ID (for environments/variables)").option("-e, --environment <name>",
|
|
1290
|
+
var listCommand = new Command7("list").description("List projects, environments, or variables").argument("[resource]", "Resource to list: projects, environments, variables", "projects").option("--org <name>", "Organization name (required if you belong to multiple)").option("-p, --project <name-or-id>", "Project name or ID (for environments/variables)").option("-e, --environment <name>", 'Environment name (default: "development")').option("-v, --verbose", "Show IDs").action(async (resource, options) => {
|
|
1291
1291
|
const spinner = ora6("Connecting...").start();
|
|
1292
1292
|
try {
|
|
1293
1293
|
const config = loadConfig();
|
|
@@ -1479,7 +1479,9 @@ async function subscribeToVariableChanges(environmentId, onEvent, onStatus) {
|
|
|
1479
1479
|
table: "variables"
|
|
1480
1480
|
},
|
|
1481
1481
|
(payload) => {
|
|
1482
|
-
const
|
|
1482
|
+
const newRecord = payload.new;
|
|
1483
|
+
const oldRecord = payload.old;
|
|
1484
|
+
const record = newRecord && Object.keys(newRecord).length > 0 ? newRecord : oldRecord;
|
|
1483
1485
|
if (!record) return;
|
|
1484
1486
|
const recordEnvId = record.environment_id;
|
|
1485
1487
|
if (recordEnvId !== environmentId) {
|
|
@@ -1493,8 +1495,7 @@ async function subscribeToVariableChanges(environmentId, onEvent, onStatus) {
|
|
|
1493
1495
|
is_secret: record.is_secret,
|
|
1494
1496
|
timestamp: Date.now() / 1e3
|
|
1495
1497
|
};
|
|
1496
|
-
if (payload.eventType === "UPDATE" &&
|
|
1497
|
-
const oldRecord = payload.old;
|
|
1498
|
+
if (payload.eventType === "UPDATE" && oldRecord) {
|
|
1498
1499
|
if (oldRecord.key !== record.key) {
|
|
1499
1500
|
event.old_key = oldRecord.key;
|
|
1500
1501
|
}
|
|
@@ -1664,9 +1665,12 @@ function mergeWithRemote(local, remoteVariables, strategy) {
|
|
|
1664
1665
|
result.set(key, value);
|
|
1665
1666
|
}
|
|
1666
1667
|
break;
|
|
1667
|
-
case "remote_wins":
|
|
1668
|
+
case "remote_wins": {
|
|
1669
|
+
const remoteKeys = new Set(remoteVariables.map((v) => v.key));
|
|
1668
1670
|
for (const [key, value] of local) {
|
|
1669
|
-
|
|
1671
|
+
if (remoteKeys.has(key)) {
|
|
1672
|
+
result.set(key, value);
|
|
1673
|
+
}
|
|
1670
1674
|
}
|
|
1671
1675
|
for (const v of remoteVariables) {
|
|
1672
1676
|
if (v.value !== null) {
|
|
@@ -1674,6 +1678,7 @@ function mergeWithRemote(local, remoteVariables, strategy) {
|
|
|
1674
1678
|
}
|
|
1675
1679
|
}
|
|
1676
1680
|
break;
|
|
1681
|
+
}
|
|
1677
1682
|
case "merge_new":
|
|
1678
1683
|
for (const [key, value] of local) {
|
|
1679
1684
|
result.set(key, value);
|
|
@@ -2234,7 +2239,7 @@ import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, existsS
|
|
|
2234
2239
|
import { resolve as resolve6 } from "path";
|
|
2235
2240
|
import { parse as parseDotenv4 } from "dotenv";
|
|
2236
2241
|
var templateCommand = new Command11("template").description("Manage environment templates");
|
|
2237
|
-
templateCommand.command("generate").description("Generate .env file from template and EnvManager values").option("-t, --template <file>", "Template file (default: .env.template or .env.template.yaml)").option("-o, --output <file>", "Output file (default: .env)").option("-e, --environment <name>",
|
|
2242
|
+
templateCommand.command("generate").description("Generate .env file from template and EnvManager values").option("-t, --template <file>", "Template file (default: .env.template or .env.template.yaml)").option("-o, --output <file>", "Output file (default: .env)").option("-e, --environment <name>", 'Environment name (default: "development")').option("-p, --project <id>", "Project ID (default: from config)").option("-f, --force", "Overwrite existing output file").action(async (options) => {
|
|
2238
2243
|
const spinner = ora9("Generating .env from template...").start();
|
|
2239
2244
|
try {
|
|
2240
2245
|
const config = loadConfig();
|
|
@@ -2336,7 +2341,7 @@ File ${outputPath} already exists. Use --force to overwrite.`));
|
|
|
2336
2341
|
process.exit(1);
|
|
2337
2342
|
}
|
|
2338
2343
|
});
|
|
2339
|
-
templateCommand.command("sync").description("Compare template with EnvManager and report differences").option("-t, --template <file>", "Template file (default: .env.template or .env.template.yaml)").option("-e, --environment <name>",
|
|
2344
|
+
templateCommand.command("sync").description("Compare template with EnvManager and report differences").option("-t, --template <file>", "Template file (default: .env.template or .env.template.yaml)").option("-e, --environment <name>", 'Environment name (default: "development")').option("-p, --project <id>", "Project ID (default: from config)").action(async (options) => {
|
|
2340
2345
|
const spinner = ora9("Comparing template with EnvManager...").start();
|
|
2341
2346
|
try {
|
|
2342
2347
|
const config = loadConfig();
|
|
@@ -2652,7 +2657,7 @@ function jsonToSchema(json) {
|
|
|
2652
2657
|
}
|
|
2653
2658
|
|
|
2654
2659
|
// src/commands/validate.ts
|
|
2655
|
-
var validateCommand = new Command12("validate").description("Validate local .env file against schema from EnvManager or local file").option("-e, --environment <name>",
|
|
2660
|
+
var validateCommand = new Command12("validate").description("Validate local .env file against schema from EnvManager or local file").option("-e, --environment <name>", 'Environment name (default: "development")').option("-p, --project <id>", "Project ID (default: from config)").option("--org <name>", "Organization name (required if you belong to multiple)").option("-i, --input <file>", "Input .env file (default: .env)").option("-s, --schema <file>", "Local schema JSON file (skip fetching from EnvManager)").option("--strict", "Fail on warnings (extra variables not in schema)").action(async (options) => {
|
|
2656
2661
|
const spinner = ora10("Validating environment...").start();
|
|
2657
2662
|
try {
|
|
2658
2663
|
const config = loadConfig();
|