@elmohq/cli 0.2.10 → 0.2.12

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 (3) hide show
  1. package/README.md +2 -3
  2. package/dist/index.js +16 -58
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -58,9 +58,8 @@ For the full self-hosting walkthrough, see the [Elmo docs](https://www.elmohq.co
58
58
  | Command | Description |
59
59
  | --- | --- |
60
60
  | `elmo init` | Interactive wizard to set up a local Elmo instance |
61
- | `elmo status` | Check the health of running services |
62
- | `elmo compose <args...>` | Run any `docker compose` command against your Elmo project (e.g. `elmo compose up -d`, `elmo compose down`, `elmo compose logs -f`, `elmo compose build`) |
63
- | `elmo edit <env\|compose>` | Open `.env` or `elmo.yaml` in `$VISUAL` / `$EDITOR` (fallback: `nano`) |
61
+ | `elmo compose <args...>` | Run any `docker compose` command against your Elmo project (e.g. `elmo compose up -d`, `elmo compose down`, `elmo compose logs -f`, `elmo compose build`, `elmo compose ps`) |
62
+ | `elmo edit <env\|compose>` | Change API keys, scrape targets, or the Docker Compose YAML |
64
63
 
65
64
  Run `elmo --help` or `elmo <command> --help` for the full list of flags.
66
65
 
package/dist/index.js CHANGED
@@ -64,6 +64,8 @@ async function main() {
64
64
  program
65
65
  .name("elmo")
66
66
  .version(version)
67
+ .option("--dir <path>", "Config directory")
68
+ .configureHelp({ showGlobalOptions: true })
67
69
  .action(() => {
68
70
  printBanner();
69
71
  program.outputHelp();
@@ -72,34 +74,24 @@ async function main() {
72
74
  .command("init")
73
75
  .description("set up local Elmo instance")
74
76
  .option("--dev", "Use local build context (repo only)")
75
- .option("--dir <path>", "Directory to store config files")
76
77
  .option("--docker-dir <path>", "Path to Docker build context (dev mode)")
77
- .action(async (options) => {
78
- await withVersionCheck(version, () => runInit(options, version));
79
- });
80
- program
81
- .command("status")
82
- .description("check Elmo instance health")
83
- .option("--dir <path>", "Config directory")
84
- .action(async (options) => {
85
- await withVersionCheck(version, () => runStatus(options));
78
+ .action(async (_opts, cmd) => {
79
+ await withVersionCheck(version, () => runInit(cmd.optsWithGlobals(), version));
86
80
  });
87
81
  program
88
82
  .command("compose")
89
83
  .description("run Docker Compose commands using your Elmo config")
90
84
  .allowUnknownOption(true)
91
- .option("--dir <path>", "Config directory")
92
85
  .argument("[args...]", "Arguments passed to Docker Compose")
93
- .action(async (args, options) => {
94
- await withVersionCheck(version, () => runCompose(args, options));
86
+ .action(async (args, _opts, cmd) => {
87
+ await withVersionCheck(version, () => runCompose(args, cmd.optsWithGlobals()));
95
88
  });
96
89
  program
97
90
  .command("edit")
98
- .description("open .env or elmo.yaml in $VISUAL / $EDITOR (fallback: nano)")
99
- .argument("<target>", "`env` or `compose`")
100
- .option("--dir <path>", "Config directory")
101
- .action(async (target, options) => {
102
- await runEdit(target, options);
91
+ .description("change API keys, scrape targets, or the Docker Compose YAML")
92
+ .argument("<env|compose>", "which config file to edit")
93
+ .action(async (target, _opts, cmd) => {
94
+ await runEdit(target, cmd.optsWithGlobals());
103
95
  });
104
96
  await program.parseAsync(process.argv);
105
97
  }
@@ -747,30 +739,6 @@ async function doStart(configDir) {
747
739
  console.log(` ${pc.bold("elmo compose ps")}`);
748
740
  console.log(` ${pc.bold("elmo compose down")}`);
749
741
  }
750
- // ── Command: status ──────────────────────────────────────────────────────────
751
- async function runStatus(options) {
752
- const configDir = await resolveConfigDir(options.dir);
753
- assertDockerRunning();
754
- const services = await getComposeServices(configDir);
755
- if (services.length === 0) {
756
- log.warn("No running services found.");
757
- return;
758
- }
759
- let allHealthy = true;
760
- for (const service of services) {
761
- const status = formatServiceStatus(service);
762
- console.log(status);
763
- if (!isServiceReady(service)) {
764
- allHealthy = false;
765
- }
766
- }
767
- if (allHealthy) {
768
- log.success("All services are healthy.");
769
- }
770
- else {
771
- log.warn("Some services are not healthy yet.");
772
- }
773
- }
774
742
  // ── Command: compose ─────────────────────────────────────────────────────────
775
743
  async function runCompose(args, options) {
776
744
  const configDir = await resolveConfigDir(options.dir);
@@ -828,6 +796,7 @@ function buildComposeYaml(options) {
828
796
  dev: options.dev,
829
797
  dockerfilePath,
830
798
  repoRoot: options.repoRoot,
799
+ version: options.version,
831
800
  }));
832
801
  dependsOnWeb.push("db-migrate");
833
802
  dependsOnWorker.push("db-migrate");
@@ -840,6 +809,7 @@ function buildComposeYaml(options) {
840
809
  repoRoot: options.repoRoot,
841
810
  dockerfilePath,
842
811
  port: options.port,
812
+ version: options.version,
843
813
  }));
844
814
  services.push(buildWorkerService({
845
815
  dev: options.dev,
@@ -847,6 +817,7 @@ function buildComposeYaml(options) {
847
817
  dependencyConditions,
848
818
  repoRoot: options.repoRoot,
849
819
  dockerfilePath,
820
+ version: options.version,
850
821
  }));
851
822
  const lines = [renderedByHeader(options.version), "", "name: elmo", "", "services:"];
852
823
  lines.push(...services.map((service) => indentBlock(service, 2)));
@@ -884,7 +855,7 @@ function buildDbMigrateService(options) {
884
855
  lines.push(" build:", ` context: ${options.repoRoot}`, ` dockerfile: ${options.dockerfilePath}`, " target: migrate");
885
856
  }
886
857
  else {
887
- lines.push(" image: elmohq/elmo-db-migrate:latest");
858
+ lines.push(` image: elmohq/elmo-db-migrate:${options.version}`);
888
859
  }
889
860
  lines.push(" environment:", " - DATABASE_URL=postgres://postgres:postgres@postgres:5432/elmo", " depends_on:", " postgres:", " condition: service_healthy");
890
861
  return lines.join("\n");
@@ -895,7 +866,7 @@ function buildWebService(options) {
895
866
  lines.push(" build:", ` context: ${options.repoRoot}`, ` dockerfile: ${options.dockerfilePath}`, " target: web", " args:", " DEPLOYMENT_MODE: local");
896
867
  }
897
868
  else {
898
- lines.push(" image: elmohq/elmo-web:latest");
869
+ lines.push(` image: elmohq/elmo-web:${options.version}`);
899
870
  }
900
871
  lines.push(" env_file:", " - path: .env", " required: true", " ports:", ` - "${options.port}:3000"`);
901
872
  if (options.dependsOn.length > 0) {
@@ -913,7 +884,7 @@ function buildWorkerService(options) {
913
884
  lines.push(" build:", ` context: ${options.repoRoot}`, ` dockerfile: ${options.dockerfilePath}`, " target: worker", " args:", " DEPLOYMENT_MODE: local");
914
885
  }
915
886
  else {
916
- lines.push(" image: elmohq/elmo-worker:latest");
887
+ lines.push(` image: elmohq/elmo-worker:${options.version}`);
917
888
  }
918
889
  lines.push(" env_file:", " - path: .env", " required: true");
919
890
  if (options.dependsOn.length > 0) {
@@ -963,19 +934,6 @@ async function getComposeServices(configDir) {
963
934
  }
964
935
  }
965
936
  }
966
- function formatServiceStatus(service) {
967
- const health = service.Health ?? "unknown";
968
- const state = service.State ?? "unknown";
969
- const label = `${service.Service}`.padEnd(16, " ");
970
- let color = pc.red;
971
- if (isServiceReady(service)) {
972
- color = pc.green;
973
- }
974
- else if (health === "starting" || state.includes("starting")) {
975
- color = pc.yellow;
976
- }
977
- return color(`${label} ${state} ${service.Health ? `(${health})` : ""}`.trim());
978
- }
979
937
  function isServiceReady(service) {
980
938
  if (service.Health) {
981
939
  return service.Health === "healthy";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elmohq/cli",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "marketing",
@@ -28,15 +28,15 @@
28
28
  ],
29
29
  "type": "module",
30
30
  "dependencies": {
31
- "@clack/prompts": "^1.3.0",
32
- "commander": "^14.0.3",
33
- "dotenv": "16.6.1",
31
+ "@clack/prompts": "^1.5.0",
32
+ "commander": "^15.0.0",
33
+ "dotenv": "17.4.2",
34
34
  "picocolors": "^1.1.1",
35
- "posthog-node": "^5.33.0",
36
- "semver": "^7.7.4"
35
+ "posthog-node": "^5.35.6",
36
+ "semver": "^7.8.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/node": "^25.6.0",
39
+ "@types/node": "^25.9.1",
40
40
  "@types/semver": "^7.7.1",
41
41
  "typescript": "^6.0.3"
42
42
  },