commandsIn

tcmts.cli.suites.commandsIn · #2mhe2vwz · term · runs on the server

uses tcmts.cli.manifests.packagesIn, which uses tcmts.cli.config.configValue, which uses node:path

The codebase's commands (its packages' bins), as the environment variables suites find them in: name → its runner.

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { absolute, packagesIn } from "#codebase/tcmts/cli/manifests";
import { binVariable } from "#codebase/tcmts/cli/suites";
import { writeRunner } from "#codebase/tcmts/loader";

export function commandsIn(cb: Codebase): Record<string, string> {
  const out: Record<string, string> = {};
  for (const pkg of packagesIn(cb, cb.store.names())) {
    for (const [cmd, target] of Object.entries(pkg.manifest.bin)) {
      const h = cb.store.hashesAt(absolute(pkg.namespace, target)).find((x) => cb.store.getDef(x)?.kind !== "type");
      if (h) out[binVariable(cmd)] = writeRunner(h, cb.source(), cb.lay);
    }
  }
  return out;
}

uses

used by