@coresource/hz 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hz.mjs +6 -7
- package/package.json +1 -1
package/dist/hz.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { readFileSync } from "fs";
|
|
5
|
-
import path7 from "path";
|
|
4
|
+
import { readFileSync, realpathSync } from "fs";
|
|
6
5
|
import { fileURLToPath } from "url";
|
|
7
6
|
import { Command, CommanderError as CommanderError3 } from "commander";
|
|
8
7
|
|
|
@@ -74,7 +73,7 @@ function resolveConfigPath(options = {}) {
|
|
|
74
73
|
if (options.configPath) {
|
|
75
74
|
return options.configPath;
|
|
76
75
|
}
|
|
77
|
-
return path.join(resolveHomeDir(options), ".
|
|
76
|
+
return path.join(resolveHomeDir(options), ".hz", "config.json");
|
|
78
77
|
}
|
|
79
78
|
async function readConfig(options = {}) {
|
|
80
79
|
const configPath = resolveConfigPath(options);
|
|
@@ -423,7 +422,7 @@ async function resolveOrganizationName(apiKey, endpoint, tenantId) {
|
|
|
423
422
|
}
|
|
424
423
|
function registerAuthCommands(program, context) {
|
|
425
424
|
const auth = program.command("auth").description("Manage authentication");
|
|
426
|
-
auth.command("login").description("Store an API key in ~/.
|
|
425
|
+
auth.command("login").description("Store an API key in ~/.hz/config.json").option("--endpoint <url>", "API endpoint to use").option("--key <apiKey>", "API key to store locally").action(async (options) => {
|
|
427
426
|
const existing = await readConfig({
|
|
428
427
|
env: context.env,
|
|
429
428
|
homeDir: context.homeDir
|
|
@@ -812,7 +811,7 @@ function resolveHomeDir2(options = {}) {
|
|
|
812
811
|
return options.homeDir ?? process.env.HOME ?? os2.homedir();
|
|
813
812
|
}
|
|
814
813
|
function resolveLaunchesDir(options = {}) {
|
|
815
|
-
return path2.join(resolveHomeDir2(options), ".
|
|
814
|
+
return path2.join(resolveHomeDir2(options), ".hz", "cloud-launches");
|
|
816
815
|
}
|
|
817
816
|
function normalizeTask(task) {
|
|
818
817
|
const normalized = task.trim();
|
|
@@ -2699,7 +2698,7 @@ function resolveLifecycleHomeDir(context) {
|
|
|
2699
2698
|
});
|
|
2700
2699
|
}
|
|
2701
2700
|
async function findMostRecentMissionId(homeDir) {
|
|
2702
|
-
const launchesDir = path3.join(homeDir, ".
|
|
2701
|
+
const launchesDir = path3.join(homeDir, ".hz", "cloud-launches");
|
|
2703
2702
|
let entries;
|
|
2704
2703
|
try {
|
|
2705
2704
|
entries = await readdir2(launchesDir, { withFileTypes: true });
|
|
@@ -4718,7 +4717,7 @@ function isEntrypoint() {
|
|
|
4718
4717
|
if (!entryPath) {
|
|
4719
4718
|
return false;
|
|
4720
4719
|
}
|
|
4721
|
-
return
|
|
4720
|
+
return realpathSync(entryPath) === fileURLToPath(import.meta.url);
|
|
4722
4721
|
}
|
|
4723
4722
|
function writeError(stream, message) {
|
|
4724
4723
|
writeLine(stream, `Error: ${message}`);
|