@rse/ase 0.0.6 → 0.0.8

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.
@@ -7,37 +7,28 @@
7
7
  export const createAgentCommandModule = (category, description, subCommands) => {
8
8
  /* create sub-command handler */
9
9
  const createSubCommandHandler = (subCommand) => {
10
- return (argv) => {
11
- if (argv.debug)
10
+ return (_opts, cmd) => {
11
+ const opts = cmd.optsWithGlobals();
12
+ if (opts.debug)
12
13
  console.log(`DEBUG: agent ${category} ${subCommand} command`);
13
- if (argv.verbose)
14
+ if (opts.verbose)
14
15
  console.log(`VERBOSE: executing agent ${category} ${subCommand}...`);
15
16
  console.log(`Executing agent ${category} ${subCommand}...`);
16
17
  /* TODO: implement agent ${category} sub-command logic */
17
18
  };
18
19
  };
19
- return {
20
- command: `${category} <subcommand>`,
21
- describe: `Execute ${description} agent operations`,
22
- builder: (yargs) => {
23
- let builder = yargs
24
- .option("verbose", {
25
- alias: "v",
26
- type: "boolean",
27
- describe: "Enable verbose output",
28
- default: false
29
- })
30
- .demandCommand(1, `You need to specify a ${category} subcommand`);
31
- /* register all sub-commands */
32
- for (const subCmd of subCommands) {
33
- builder = builder.command(subCmd, `Execute agent ${category} ${subCmd} operation`, () => { }, createSubCommandHandler(subCmd));
34
- }
35
- return builder;
36
- },
37
- handler: (argv) => {
38
- /* this handler is not called when sub-commands are used */
39
- if (argv.debug)
40
- console.log(`DEBUG: agent ${category} command (no subcommand)`);
20
+ return (parent) => {
21
+ const agent = parent
22
+ .command(`${category}`)
23
+ .description(`Execute ${description} agent operations`)
24
+ .option("-v, --verbose", "Enable verbose output", false);
25
+ /* register all sub-commands */
26
+ for (const subCmd of subCommands) {
27
+ agent
28
+ .command(subCmd)
29
+ .description(`Execute agent ${category} ${subCmd} operation`)
30
+ .action(createSubCommandHandler(subCmd));
41
31
  }
32
+ return agent;
42
33
  };
43
34
  };
@@ -12,38 +12,29 @@ const bizSubCommands = [
12
12
  ];
13
13
  /* create sub-command handler */
14
14
  const createSubCommandHandler = (subCommand) => {
15
- return (argv) => {
16
- if (argv.debug)
15
+ return (_opts, cmd) => {
16
+ const opts = cmd.optsWithGlobals();
17
+ if (opts.debug)
17
18
  console.log(`DEBUG: agent biz ${subCommand} command`);
18
- if (argv.verbose)
19
+ if (opts.verbose)
19
20
  console.log(`VERBOSE: executing agent biz ${subCommand}...`);
20
21
  console.log(`Executing agent biz ${subCommand}...`);
21
22
  /* TODO: implement agent biz sub-command logic */
22
23
  };
23
24
  };
24
- /* create and export biz command module */
25
- const bizCommand = {
26
- command: "biz <subcommand>",
27
- describe: "Execute business agent operations",
28
- builder: (yargs) => {
29
- let builder = yargs
30
- .option("verbose", {
31
- alias: "v",
32
- type: "boolean",
33
- describe: "Enable verbose output",
34
- default: false
35
- })
36
- .demandCommand(1, "You need to specify a biz subcommand");
37
- /* register all sub-commands */
38
- for (const subCmd of bizSubCommands) {
39
- builder = builder.command(subCmd, `Execute agent biz ${subCmd} operation`, () => { }, createSubCommandHandler(subCmd));
40
- }
41
- return builder;
42
- },
43
- handler: (argv) => {
44
- /* this handler is not called when sub-commands are used */
45
- if (argv.debug)
46
- console.log("DEBUG: agent biz command (no subcommand)");
25
+ /* register biz command on the given parent */
26
+ const registerBizCommand = (parent) => {
27
+ const biz = parent
28
+ .command("biz")
29
+ .description("Execute business agent operations")
30
+ .option("-v, --verbose", "Enable verbose output", false);
31
+ /* register all sub-commands */
32
+ for (const subCmd of bizSubCommands) {
33
+ biz
34
+ .command(subCmd)
35
+ .description(`Execute agent biz ${subCmd} operation`)
36
+ .action(createSubCommandHandler(subCmd));
47
37
  }
38
+ return biz;
48
39
  };
49
- export default bizCommand;
40
+ export default registerBizCommand;
@@ -12,38 +12,29 @@ const devSubCommands = [
12
12
  ];
13
13
  /* create sub-command handler */
14
14
  const createSubCommandHandler = (subCommand) => {
15
- return (argv) => {
16
- if (argv.debug)
15
+ return (_opts, cmd) => {
16
+ const opts = cmd.optsWithGlobals();
17
+ if (opts.debug)
17
18
  console.log(`DEBUG: agent dev ${subCommand} command`);
18
- if (argv.verbose)
19
+ if (opts.verbose)
19
20
  console.log(`VERBOSE: executing agent dev ${subCommand}...`);
20
21
  console.log(`Executing agent dev ${subCommand}...`);
21
22
  /* TODO: implement agent dev sub-command logic */
22
23
  };
23
24
  };
24
- /* create and export dev command module */
25
- const devCommand = {
26
- command: "dev <subcommand>",
27
- describe: "Execute development agent operations",
28
- builder: (yargs) => {
29
- let builder = yargs
30
- .option("verbose", {
31
- alias: "v",
32
- type: "boolean",
33
- describe: "Enable verbose output",
34
- default: false
35
- })
36
- .demandCommand(1, "You need to specify a dev subcommand");
37
- /* register all sub-commands */
38
- for (const subCmd of devSubCommands) {
39
- builder = builder.command(subCmd, `Execute agent dev ${subCmd} operation`, () => { }, createSubCommandHandler(subCmd));
40
- }
41
- return builder;
42
- },
43
- handler: (argv) => {
44
- /* this handler is not called when sub-commands are used */
45
- if (argv.debug)
46
- console.log("DEBUG: agent dev command (no subcommand)");
25
+ /* register dev command on the given parent */
26
+ const registerDevCommand = (parent) => {
27
+ const dev = parent
28
+ .command("dev")
29
+ .description("Execute development agent operations")
30
+ .option("-v, --verbose", "Enable verbose output", false);
31
+ /* register all sub-commands */
32
+ for (const subCmd of devSubCommands) {
33
+ dev
34
+ .command(subCmd)
35
+ .description(`Execute agent dev ${subCmd} operation`)
36
+ .action(createSubCommandHandler(subCmd));
47
37
  }
38
+ return dev;
48
39
  };
49
- export default devCommand;
40
+ export default registerDevCommand;
@@ -12,38 +12,29 @@ const opsSubCommands = [
12
12
  ];
13
13
  /* create sub-command handler */
14
14
  const createSubCommandHandler = (subCommand) => {
15
- return (argv) => {
16
- if (argv.debug)
15
+ return (_opts, cmd) => {
16
+ const opts = cmd.optsWithGlobals();
17
+ if (opts.debug)
17
18
  console.log(`DEBUG: agent ops ${subCommand} command`);
18
- if (argv.verbose)
19
+ if (opts.verbose)
19
20
  console.log(`VERBOSE: executing agent ops ${subCommand}...`);
20
21
  console.log(`Executing agent ops ${subCommand}...`);
21
22
  /* TODO: implement agent ops sub-command logic */
22
23
  };
23
24
  };
24
- /* create and export ops command module */
25
- const opsCommand = {
26
- command: "ops <subcommand>",
27
- describe: "Execute operations agent operations",
28
- builder: (yargs) => {
29
- let builder = yargs
30
- .option("verbose", {
31
- alias: "v",
32
- type: "boolean",
33
- describe: "Enable verbose output",
34
- default: false
35
- })
36
- .demandCommand(1, "You need to specify an ops subcommand");
37
- /* register all sub-commands */
38
- for (const subCmd of opsSubCommands) {
39
- builder = builder.command(subCmd, `Execute agent ops ${subCmd} operation`, () => { }, createSubCommandHandler(subCmd));
40
- }
41
- return builder;
42
- },
43
- handler: (argv) => {
44
- /* this handler is not called when sub-commands are used */
45
- if (argv.debug)
46
- console.log("DEBUG: agent ops command (no subcommand)");
25
+ /* register ops command on the given parent */
26
+ const registerOpsCommand = (parent) => {
27
+ const ops = parent
28
+ .command("ops")
29
+ .description("Execute operations agent operations")
30
+ .option("-v, --verbose", "Enable verbose output", false);
31
+ /* register all sub-commands */
32
+ for (const subCmd of opsSubCommands) {
33
+ ops
34
+ .command(subCmd)
35
+ .description(`Execute agent ops ${subCmd} operation`)
36
+ .action(createSubCommandHandler(subCmd));
47
37
  }
38
+ return ops;
48
39
  };
49
- export default opsCommand;
40
+ export default registerOpsCommand;
@@ -12,38 +12,29 @@ const prdSubCommands = [
12
12
  ];
13
13
  /* create sub-command handler */
14
14
  const createSubCommandHandler = (subCommand) => {
15
- return (argv) => {
16
- if (argv.debug)
15
+ return (_opts, cmd) => {
16
+ const opts = cmd.optsWithGlobals();
17
+ if (opts.debug)
17
18
  console.log(`DEBUG: agent prd ${subCommand} command`);
18
- if (argv.verbose)
19
+ if (opts.verbose)
19
20
  console.log(`VERBOSE: executing agent prd ${subCommand}...`);
20
21
  console.log(`Executing agent prd ${subCommand}...`);
21
22
  /* TODO: implement agent prd sub-command logic */
22
23
  };
23
24
  };
24
- /* create and export prd command module */
25
- const prdCommand = {
26
- command: "prd <subcommand>",
27
- describe: "Execute production agent operations",
28
- builder: (yargs) => {
29
- let builder = yargs
30
- .option("verbose", {
31
- alias: "v",
32
- type: "boolean",
33
- describe: "Enable verbose output",
34
- default: false
35
- })
36
- .demandCommand(1, "You need to specify a prd subcommand");
37
- /* register all sub-commands */
38
- for (const subCmd of prdSubCommands) {
39
- builder = builder.command(subCmd, `Execute agent prd ${subCmd} operation`, () => { }, createSubCommandHandler(subCmd));
40
- }
41
- return builder;
42
- },
43
- handler: (argv) => {
44
- /* this handler is not called when sub-commands are used */
45
- if (argv.debug)
46
- console.log("DEBUG: agent prd command (no subcommand)");
25
+ /* register prd command on the given parent */
26
+ const registerPrdCommand = (parent) => {
27
+ const prd = parent
28
+ .command("prd")
29
+ .description("Execute production agent operations")
30
+ .option("-v, --verbose", "Enable verbose output", false);
31
+ /* register all sub-commands */
32
+ for (const subCmd of prdSubCommands) {
33
+ prd
34
+ .command(subCmd)
35
+ .description(`Execute agent prd ${subCmd} operation`)
36
+ .action(createSubCommandHandler(subCmd));
47
37
  }
38
+ return prd;
48
39
  };
49
- export default prdCommand;
40
+ export default registerPrdCommand;
@@ -12,38 +12,29 @@ const prjSubCommands = [
12
12
  ];
13
13
  /* create sub-command handler */
14
14
  const createSubCommandHandler = (subCommand) => {
15
- return (argv) => {
16
- if (argv.debug)
15
+ return (_opts, cmd) => {
16
+ const opts = cmd.optsWithGlobals();
17
+ if (opts.debug)
17
18
  console.log(`DEBUG: agent prj ${subCommand} command`);
18
- if (argv.verbose)
19
+ if (opts.verbose)
19
20
  console.log(`VERBOSE: executing agent prj ${subCommand}...`);
20
21
  console.log(`Executing agent prj ${subCommand}...`);
21
22
  /* TODO: implement agent prj sub-command logic */
22
23
  };
23
24
  };
24
- /* create and export prj command module */
25
- const prjCommand = {
26
- command: "prj <subcommand>",
27
- describe: "Execute project agent operations",
28
- builder: (yargs) => {
29
- let builder = yargs
30
- .option("verbose", {
31
- alias: "v",
32
- type: "boolean",
33
- describe: "Enable verbose output",
34
- default: false
35
- })
36
- .demandCommand(1, "You need to specify a prj subcommand");
37
- /* register all sub-commands */
38
- for (const subCmd of prjSubCommands) {
39
- builder = builder.command(subCmd, `Execute agent prj ${subCmd} operation`, () => { }, createSubCommandHandler(subCmd));
40
- }
41
- return builder;
42
- },
43
- handler: (argv) => {
44
- /* this handler is not called when sub-commands are used */
45
- if (argv.debug)
46
- console.log("DEBUG: agent prj command (no subcommand)");
25
+ /* register prj command on the given parent */
26
+ const registerPrjCommand = (parent) => {
27
+ const prj = parent
28
+ .command("prj")
29
+ .description("Execute project agent operations")
30
+ .option("-v, --verbose", "Enable verbose output", false);
31
+ /* register all sub-commands */
32
+ for (const subCmd of prjSubCommands) {
33
+ prj
34
+ .command(subCmd)
35
+ .description(`Execute agent prj ${subCmd} operation`)
36
+ .action(createSubCommandHandler(subCmd));
47
37
  }
38
+ return prj;
48
39
  };
49
- export default prjCommand;
40
+ export default registerPrjCommand;
package/dst/ase-agent.js CHANGED
@@ -3,33 +3,23 @@
3
3
  ** Copyright (c) 2025-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
5
5
  */
6
- import bizCommand from "./ase-agent-biz.js";
7
- import devCommand from "./ase-agent-dev.js";
8
- import opsCommand from "./ase-agent-ops.js";
9
- import prdCommand from "./ase-agent-prd.js";
10
- import prjCommand from "./ase-agent-prj.js";
11
- const agentCommand = {
12
- command: "agent <subcommand>",
13
- describe: "Execute agent operations",
14
- builder: (yargs) => {
15
- return yargs
16
- .option("verbose", {
17
- alias: "v",
18
- type: "boolean",
19
- describe: "Enable verbose output",
20
- default: false
21
- })
22
- .command(bizCommand)
23
- .command(devCommand)
24
- .command(opsCommand)
25
- .command(prdCommand)
26
- .command(prjCommand)
27
- .demandCommand(1, "You need to specify an agent subcommand");
28
- },
29
- handler: (argv) => {
30
- /* this handler is not called when sub-commands are used */
31
- if (argv.debug)
32
- console.log("DEBUG: agent command (no subcommand)");
33
- }
6
+ import registerBizCommand from "./ase-agent-biz.js";
7
+ import registerDevCommand from "./ase-agent-dev.js";
8
+ import registerOpsCommand from "./ase-agent-ops.js";
9
+ import registerPrdCommand from "./ase-agent-prd.js";
10
+ import registerPrjCommand from "./ase-agent-prj.js";
11
+ /* register agent command on the given program */
12
+ const registerAgentCommand = (program) => {
13
+ const agent = program
14
+ .command("agent")
15
+ .description("Execute agent operations")
16
+ .option("-v, --verbose", "Enable verbose output", false);
17
+ /* register all agent sub-commands */
18
+ registerBizCommand(agent);
19
+ registerDevCommand(agent);
20
+ registerOpsCommand(agent);
21
+ registerPrdCommand(agent);
22
+ registerPrjCommand(agent);
23
+ return agent;
34
24
  };
35
- export default agentCommand;
25
+ export default registerAgentCommand;