@decohere/cli 0.0.1-dev.128 → 0.0.1-dev.130

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.
@@ -12,6 +12,8 @@ const configIndex = process.argv.indexOf("--config-file");
12
12
  const configFile = configIndex !== -1 ? process.argv[configIndex + 1] : undefined;
13
13
  const logLevelIndex = process.argv.indexOf("--log-level");
14
14
  const logLevel = logLevelIndex !== -1 ? process.argv[logLevelIndex + 1] : undefined;
15
+ const rootDirIndex = process.argv.indexOf("--root-dir");
16
+ const rootDir = rootDirIndex !== -1 ? process.argv[rootDirIndex + 1] : undefined;
15
17
  _scribe.scribe.withPinoPretty({
16
18
  logLevel: (0, _loglevel.cliLogLevel)(logLevel),
17
19
  when: "always"
@@ -21,7 +23,8 @@ const app = await _rootmodule.RootModule.create([
21
23
  _flux.FluxModule
22
24
  ], {
23
25
  configFile,
24
- logLevel
26
+ logLevel,
27
+ rootDir
25
28
  });
26
29
  try {
27
30
  // Route directly to the flux module — users invoke as `flux serve`, not `flux flux serve`
@@ -12,6 +12,8 @@ const configIndex = process.argv.indexOf("--config-file");
12
12
  const configFile = configIndex !== -1 ? process.argv[configIndex + 1] : undefined;
13
13
  const logLevelIndex = process.argv.indexOf("--log-level");
14
14
  const logLevel = logLevelIndex !== -1 ? process.argv[logLevelIndex + 1] : undefined;
15
+ const rootDirIndex = process.argv.indexOf("--root-dir");
16
+ const rootDir = rootDirIndex !== -1 ? process.argv[rootDirIndex + 1] : undefined;
15
17
  _scribe.scribe.withPinoPretty({
16
18
  logLevel: (0, _loglevel.cliLogLevel)(logLevel),
17
19
  when: "always"
@@ -21,7 +23,8 @@ const app = await _rootmodule.RootModule.create([
21
23
  _forge.ForgeModule
22
24
  ], {
23
25
  configFile,
24
- logLevel
26
+ logLevel,
27
+ rootDir
25
28
  });
26
29
  let exitCode = 0;
27
30
  try {
@@ -13,10 +13,13 @@ const _cli = require("@decohere/devkit/cli");
13
13
  const _commander = require("commander");
14
14
  class RootCommand extends _cli.DecohereCommand {
15
15
  #configFile;
16
- constructor(modules, configFile){
16
+ #rootDir;
17
+ constructor(modules, configFile, rootDir){
17
18
  super();
18
19
  this.#configFile = configFile;
20
+ this.#rootDir = rootDir;
19
21
  this.addOption(new _cli.ConfigFileOption());
22
+ this.addOption(new _cli.RootDirOption());
20
23
  this.addOption(new _cli.LogLevelOption());
21
24
  this.addOption(new _cli.EnvFileOption());
22
25
  this.addOption(new _cli.EnvFileIfExistsOption());
@@ -33,7 +36,8 @@ class RootCommand extends _cli.DecohereCommand {
33
36
  async parseAsync(argv, options) {
34
37
  if (argv?.includes("--version") || argv?.includes("-V")) {
35
38
  const workspace = await _workspace.WorkspaceFactory.create({
36
- configFile: this.#configFile
39
+ configFile: this.#configFile,
40
+ rootDir: this.#rootDir
37
41
  });
38
42
  const version = await workspace.getVersion() ?? "unknown";
39
43
  process.stdout.write(`${version}\n`);
@@ -8,12 +8,18 @@ Object.defineProperty(exports, "RootModule", {
8
8
  return RootModule;
9
9
  }
10
10
  });
11
+ const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
11
12
  const _workspace = require("@decohere/workspace");
12
13
  const _cli = require("@decohere/devkit/cli");
13
14
  const _diagnostics = require("@decohere/devkit/diagnostics");
14
15
  const _commander = require("commander");
15
16
  const _modulefactory = require("./module.factory.js");
16
17
  const _rootcommand = require("./root.command.js");
18
+ function _interop_require_default(obj) {
19
+ return obj && obj.__esModule ? obj : {
20
+ default: obj
21
+ };
22
+ }
17
23
  function _ts_decorate(decorators, target, key, desc) {
18
24
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
25
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -25,10 +31,12 @@ function _ts_metadata(k, v) {
25
31
  }
26
32
  class RootModule {
27
33
  static async create(moduleTypes, options) {
28
- const userConfig = await _workspace.UserConfigFactory.getUserConfig(options?.configFile);
34
+ // With --root-dir, the root's .decohere.js, not the current folder's.
35
+ const configFile = options?.configFile ?? (options?.rootDir ? _nodepath.default.join(options.rootDir, _workspace.WORKSPACE_CONFIG) : undefined);
36
+ const userConfig = await _workspace.UserConfigFactory.getUserConfig(configFile);
29
37
  return new RootModule(moduleTypes, {
30
38
  ...userConfig,
31
- configFile: options?.configFile,
39
+ configFile,
32
40
  rootDir: options?.rootDir
33
41
  });
34
42
  }
@@ -42,7 +50,7 @@ class RootModule {
42
50
  return _modulefactory.ModuleFactory.create(manifest, this.onResponse, config);
43
51
  });
44
52
  this.#modules = modules;
45
- this.#command = new _rootcommand.RootCommand(modules, config.configFile);
53
+ this.#command = new _rootcommand.RootCommand(modules, config.configFile, config.rootDir);
46
54
  // Before the command runs, not after it returns: a stop signal while `flux serve` boots
47
55
  // (`docker stop` during start-up) is held for the shutdown below instead of killing the
48
56
  // process before anything is disposed.
package/es6/src/flux.js CHANGED
@@ -8,6 +8,8 @@ const configIndex = process.argv.indexOf("--config-file");
8
8
  const configFile = configIndex !== -1 ? process.argv[configIndex + 1] : undefined;
9
9
  const logLevelIndex = process.argv.indexOf("--log-level");
10
10
  const logLevel = logLevelIndex !== -1 ? process.argv[logLevelIndex + 1] : undefined;
11
+ const rootDirIndex = process.argv.indexOf("--root-dir");
12
+ const rootDir = rootDirIndex !== -1 ? process.argv[rootDirIndex + 1] : undefined;
11
13
  scribe.withPinoPretty({
12
14
  logLevel: cliLogLevel(logLevel),
13
15
  when: "always"
@@ -17,7 +19,8 @@ const app = await RootModule.create([
17
19
  FluxModule
18
20
  ], {
19
21
  configFile,
20
- logLevel
22
+ logLevel,
23
+ rootDir
21
24
  });
22
25
  try {
23
26
  // Route directly to the flux module — users invoke as `flux serve`, not `flux flux serve`
package/es6/src/forge.js CHANGED
@@ -8,6 +8,8 @@ const configIndex = process.argv.indexOf("--config-file");
8
8
  const configFile = configIndex !== -1 ? process.argv[configIndex + 1] : undefined;
9
9
  const logLevelIndex = process.argv.indexOf("--log-level");
10
10
  const logLevel = logLevelIndex !== -1 ? process.argv[logLevelIndex + 1] : undefined;
11
+ const rootDirIndex = process.argv.indexOf("--root-dir");
12
+ const rootDir = rootDirIndex !== -1 ? process.argv[rootDirIndex + 1] : undefined;
11
13
  scribe.withPinoPretty({
12
14
  logLevel: cliLogLevel(logLevel),
13
15
  when: "always"
@@ -17,7 +19,8 @@ const app = await RootModule.create([
17
19
  ForgeModule
18
20
  ], {
19
21
  configFile,
20
- logLevel
22
+ logLevel,
23
+ rootDir
21
24
  });
22
25
  let exitCode = 0;
23
26
  try {
@@ -1,12 +1,15 @@
1
1
  import { WorkspaceFactory } from "@decohere/workspace";
2
- import { ConfigFileOption, DecohereCommand, EnvFileIfExistsOption, EnvFileOption, LogLevelOption } from "@decohere/devkit/cli";
2
+ import { ConfigFileOption, DecohereCommand, EnvFileIfExistsOption, EnvFileOption, LogLevelOption, RootDirOption } from "@decohere/devkit/cli";
3
3
  import { CommanderError } from "commander";
4
4
  export class RootCommand extends DecohereCommand {
5
5
  #configFile;
6
- constructor(modules, configFile){
6
+ #rootDir;
7
+ constructor(modules, configFile, rootDir){
7
8
  super();
8
9
  this.#configFile = configFile;
10
+ this.#rootDir = rootDir;
9
11
  this.addOption(new ConfigFileOption());
12
+ this.addOption(new RootDirOption());
10
13
  this.addOption(new LogLevelOption());
11
14
  this.addOption(new EnvFileOption());
12
15
  this.addOption(new EnvFileIfExistsOption());
@@ -23,7 +26,8 @@ export class RootCommand extends DecohereCommand {
23
26
  async parseAsync(argv, options) {
24
27
  if (argv?.includes("--version") || argv?.includes("-V")) {
25
28
  const workspace = await WorkspaceFactory.create({
26
- configFile: this.#configFile
29
+ configFile: this.#configFile,
30
+ rootDir: this.#rootDir
27
31
  });
28
32
  const version = await workspace.getVersion() ?? "unknown";
29
33
  process.stdout.write(`${version}\n`);
@@ -7,7 +7,8 @@ function _ts_decorate(decorators, target, key, desc) {
7
7
  function _ts_metadata(k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  }
10
- import { UserConfigFactory } from "@decohere/workspace";
10
+ import path from "node:path";
11
+ import { UserConfigFactory, WORKSPACE_CONFIG } from "@decohere/workspace";
11
12
  import { CommandResponse, DecohereCommand } from "@decohere/devkit/cli";
12
13
  import { Trace } from "@decohere/devkit/diagnostics";
13
14
  import { CommanderError } from "commander";
@@ -15,10 +16,12 @@ import { ModuleFactory } from "./module.factory.js";
15
16
  import { RootCommand } from "./root.command.js";
16
17
  export class RootModule {
17
18
  static async create(moduleTypes, options) {
18
- const userConfig = await UserConfigFactory.getUserConfig(options?.configFile);
19
+ // With --root-dir, the root's .decohere.js, not the current folder's.
20
+ const configFile = options?.configFile ?? (options?.rootDir ? path.join(options.rootDir, WORKSPACE_CONFIG) : undefined);
21
+ const userConfig = await UserConfigFactory.getUserConfig(configFile);
19
22
  return new RootModule(moduleTypes, {
20
23
  ...userConfig,
21
- configFile: options?.configFile,
24
+ configFile,
22
25
  rootDir: options?.rootDir
23
26
  });
24
27
  }
@@ -32,7 +35,7 @@ export class RootModule {
32
35
  return ModuleFactory.create(manifest, this.onResponse, config);
33
36
  });
34
37
  this.#modules = modules;
35
- this.#command = new RootCommand(modules, config.configFile);
38
+ this.#command = new RootCommand(modules, config.configFile, config.rootDir);
36
39
  // Before the command runs, not after it returns: a stop signal while `flux serve` boots
37
40
  // (`docker stop` during start-up) is held for the shutdown below instead of killing the
38
41
  // process before anything is disposed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decohere/cli",
3
- "version": "0.0.1-dev.128",
3
+ "version": "0.0.1-dev.130",
4
4
  "description": "CLI for the Decohere toolchain — build, serve, publish, and manage TypeScript monorepos",
5
5
  "keywords": [
6
6
  "typescript",
@@ -37,16 +37,16 @@
37
37
  "test": "echo \"Error: no test specified\" && exit 1"
38
38
  },
39
39
  "dependencies": {
40
- "@decohere/core": "0.0.1-dev.128",
41
- "@decohere/create": "0.0.1-dev.128",
42
- "@decohere/crucible": "0.0.1-dev.128",
43
- "@decohere/devkit": "0.0.1-dev.128",
44
- "@decohere/flux": "0.0.1-dev.128",
45
- "@decohere/forge": "0.0.1-dev.128",
46
- "@decohere/scaffold": "0.0.1-dev.128",
47
- "@decohere/scribe": "0.0.1-dev.128",
48
- "@decohere/scribe-pino": "0.0.1-dev.128",
49
- "@decohere/workspace": "0.0.1-dev.128",
40
+ "@decohere/core": "0.0.1-dev.130",
41
+ "@decohere/create": "0.0.1-dev.130",
42
+ "@decohere/crucible": "0.0.1-dev.130",
43
+ "@decohere/devkit": "0.0.1-dev.130",
44
+ "@decohere/flux": "0.0.1-dev.130",
45
+ "@decohere/forge": "0.0.1-dev.130",
46
+ "@decohere/scaffold": "0.0.1-dev.130",
47
+ "@decohere/scribe": "0.0.1-dev.130",
48
+ "@decohere/scribe-pino": "0.0.1-dev.130",
49
+ "@decohere/workspace": "0.0.1-dev.130",
50
50
  "commander": "^13.1.0",
51
51
  "pino-pretty": "^13.1.3"
52
52
  },
@@ -2,6 +2,6 @@ import { type ApplicationModule, DecohereCommand } from "@decohere/devkit/cli";
2
2
  import { type ParseOptions } from "commander";
3
3
  export declare class RootCommand extends DecohereCommand {
4
4
  #private;
5
- constructor(modules: ApplicationModule[], configFile?: string);
5
+ constructor(modules: ApplicationModule[], configFile?: string, rootDir?: string);
6
6
  parseAsync(argv?: readonly string[], options?: ParseOptions): Promise<this>;
7
7
  }