@coresource/hz 0.1.3 → 0.1.5

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.
Files changed (2) hide show
  1. package/dist/hz.mjs +31 -8
  2. package/package.json +1 -1
package/dist/hz.mjs CHANGED
@@ -73,7 +73,7 @@ function resolveConfigPath(options = {}) {
73
73
  if (options.configPath) {
74
74
  return options.configPath;
75
75
  }
76
- return path.join(resolveHomeDir(options), ".factory", "config.json");
76
+ return path.join(resolveHomeDir(options), ".hz", "config.json");
77
77
  }
78
78
  async function readConfig(options = {}) {
79
79
  const configPath = resolveConfigPath(options);
@@ -422,7 +422,7 @@ async function resolveOrganizationName(apiKey, endpoint, tenantId) {
422
422
  }
423
423
  function registerAuthCommands(program, context) {
424
424
  const auth = program.command("auth").description("Manage authentication");
425
- auth.command("login").description("Store an API key in ~/.factory/config.json").option("--endpoint <url>", "API endpoint to use").option("--key <apiKey>", "API key to store locally").action(async (options) => {
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) => {
426
426
  const existing = await readConfig({
427
427
  env: context.env,
428
428
  homeDir: context.homeDir
@@ -642,9 +642,6 @@ function normalizeMissionMilestones(value) {
642
642
  };
643
643
  });
644
644
  }
645
- function truncateMissionId(missionId, limit = 12) {
646
- return missionId.length > limit ? `${missionId.slice(0, limit)}\u2026` : missionId;
647
- }
648
645
  function formatMissionState(state) {
649
646
  switch (state) {
650
647
  case "completed":
@@ -740,7 +737,7 @@ function registerMissionListCommand(mission, context, dependencies = {}) {
740
737
  context.stdout,
741
738
  ["Mission ID", "State", "Created", "Features", "Assertions"],
742
739
  missions.map((missionSummary) => [
743
- plainCell(truncateMissionId(missionSummary.missionId)),
740
+ plainCell(missionSummary.missionId),
744
741
  coloredCell(
745
742
  formatMissionState(missionSummary.state),
746
743
  missionSummary.state
@@ -811,7 +808,7 @@ function resolveHomeDir2(options = {}) {
811
808
  return options.homeDir ?? process.env.HOME ?? os2.homedir();
812
809
  }
813
810
  function resolveLaunchesDir(options = {}) {
814
- return path2.join(resolveHomeDir2(options), ".factory", "cloud-launches");
811
+ return path2.join(resolveHomeDir2(options), ".hz", "cloud-launches");
815
812
  }
816
813
  function normalizeTask(task) {
817
814
  const normalized = task.trim();
@@ -2698,7 +2695,7 @@ function resolveLifecycleHomeDir(context) {
2698
2695
  });
2699
2696
  }
2700
2697
  async function findMostRecentMissionId(homeDir) {
2701
- const launchesDir = path3.join(homeDir, ".factory", "cloud-launches");
2698
+ const launchesDir = path3.join(homeDir, ".hz", "cloud-launches");
2702
2699
  let entries;
2703
2700
  try {
2704
2701
  entries = await readdir2(launchesDir, { withFileTypes: true });
@@ -2918,6 +2915,32 @@ function registerMissionLifecycleCommands(mission, context, dependencies = {}) {
2918
2915
  dependencies
2919
2916
  );
2920
2917
  });
2918
+ mission.command("watch").description("Watch a mission's live progress").argument("[missionId]").action(async (missionId, _options, command) => {
2919
+ const homeDir = resolveLifecycleHomeDir(context);
2920
+ const resolved = await resolveMissionId(missionId, context, command, homeDir);
2921
+ const { apiClient, authConfig } = await createMissionClientContext(
2922
+ context,
2923
+ command,
2924
+ dependencies,
2925
+ homeDir
2926
+ );
2927
+ const monitorResult = await monitorMission({
2928
+ apiClient,
2929
+ apiKey: authConfig.apiKey,
2930
+ createSpinner: dependencies.createSpinner,
2931
+ createWebSocket: dependencies.createWebSocket,
2932
+ endpoint: authConfig.endpoint,
2933
+ missionId: resolved,
2934
+ promptInput: dependencies.promptInput,
2935
+ promptSelect: dependencies.promptSelect,
2936
+ registerSignalHandler: dependencies.registerSignalHandler,
2937
+ sleep: dependencies.sleep,
2938
+ stdout: context.stdout
2939
+ });
2940
+ if (monitorResult.exitCode !== 0) {
2941
+ throw new CommanderError(monitorResult.exitCode, "mission-monitor", "");
2942
+ }
2943
+ });
2921
2944
  }
2922
2945
 
2923
2946
  // src/commands/mission-run.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coresource/hz",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "hz": "dist/hz.mjs"