@muverse/cli 0.1.0

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.
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # @muverse/cli
2
+
3
+ Command-line interface for `@muverse/core`.
4
+
5
+ Build
6
+
7
+ ```bash
8
+ npm run -w packages/cli build
9
+ ```
10
+
11
+ Run
12
+
13
+ ```bash
14
+ # after build
15
+ node dist/index.js version --dry-run
16
+ ```
17
+
18
+ Publish to npm
19
+
20
+ ```bash
21
+ npm publish --workspace packages/cli --access public
22
+ ```
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({dir: import.meta.url})
@@ -0,0 +1,25 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class Version extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ repositoryRoot: import("@oclif/core/interfaces").Arg<string, {
7
+ exists?: boolean;
8
+ }>;
9
+ };
10
+ static flags: {
11
+ "dry-run": import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ adapter: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ "push-tags": import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ "prerelease-mode": import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ "prerelease-id": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
+ "bump-unchanged": import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ "add-build-metadata": import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
+ "timestamp-versions": import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
+ "append-snapshot": import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
+ "push-changes": import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ "generate-changelog": import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ };
23
+ run(): Promise<void>;
24
+ }
25
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAS,MAAM,aAAa,CAAC;AAInD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAC1C,OAAgB,WAAW,SAAkD;IAE7E,OAAgB,QAAQ,WAKtB;IAEF,MAAM,CAAC,IAAI;;;;MAKT;IAEF,OAAgB,KAAK;;;;;;;;;;;;MAiDnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA6B3B"}
@@ -0,0 +1,90 @@
1
+ import { Args, Command, Flags } from "@oclif/core";
2
+ import { VerseRunner, initLogger } from "@muverse/core";
3
+ import { OclifLogger } from "../logger.js";
4
+ export default class Version extends Command {
5
+ static description = "Calculate and apply semantic version changes";
6
+ static examples = [
7
+ "<%= config.bin %> <%= command.id %>",
8
+ "<%= config.bin %> <%= command.id %> --adapter gradle",
9
+ "<%= config.bin %> <%= command.id %> --dry-run",
10
+ "<%= config.bin %> <%= command.id %> --prerelease-mode --prerelease-id alpha",
11
+ ];
12
+ static args = {
13
+ repositoryRoot: Args.directory({
14
+ required: true,
15
+ description: "Path to the repository root",
16
+ }),
17
+ };
18
+ static flags = {
19
+ "dry-run": Flags.boolean({
20
+ description: "Run without writing or pushing changes",
21
+ default: false,
22
+ }),
23
+ adapter: Flags.string({
24
+ description: "Language adapter (e.g., gradle). Auto-detected if not provided",
25
+ required: false,
26
+ }),
27
+ "push-tags": Flags.boolean({
28
+ description: "Push tags to origin",
29
+ default: true,
30
+ }),
31
+ "prerelease-mode": Flags.boolean({
32
+ description: "Generate pre-release versions instead of final versions",
33
+ default: false,
34
+ }),
35
+ "prerelease-id": Flags.string({
36
+ description: "Pre-release identifier (e.g., alpha, beta, rc)",
37
+ default: "alpha",
38
+ }),
39
+ "bump-unchanged": Flags.boolean({
40
+ description: "In prerelease mode, bump modules even when no changes are detected",
41
+ default: false,
42
+ }),
43
+ "add-build-metadata": Flags.boolean({
44
+ description: "Add build metadata with short SHA to all versions",
45
+ default: false,
46
+ }),
47
+ "timestamp-versions": Flags.boolean({
48
+ description: "Use timestamp-based prerelease identifiers (requires prerelease-mode)",
49
+ default: false,
50
+ }),
51
+ "append-snapshot": Flags.boolean({
52
+ description: "Add -SNAPSHOT suffix to all versions if supported by adapter",
53
+ default: false,
54
+ }),
55
+ "push-changes": Flags.boolean({
56
+ description: "Commit and push version changes and changelogs to remote",
57
+ default: true,
58
+ }),
59
+ "generate-changelog": Flags.boolean({
60
+ description: "Generate or update changelog files for changed modules",
61
+ default: true,
62
+ }),
63
+ };
64
+ async run() {
65
+ const { flags, args } = await this.parse(Version);
66
+ initLogger(new OclifLogger(this));
67
+ try {
68
+ const options = {
69
+ repoRoot: args.repositoryRoot,
70
+ adapter: flags.adapter,
71
+ dryRun: flags["dry-run"],
72
+ pushTags: flags["push-tags"],
73
+ prereleaseMode: flags["prerelease-mode"],
74
+ prereleaseId: flags["prerelease-id"],
75
+ bumpUnchanged: flags["bump-unchanged"],
76
+ addBuildMetadata: flags["add-build-metadata"],
77
+ timestampVersions: flags["timestamp-versions"],
78
+ appendSnapshot: flags["append-snapshot"],
79
+ pushChanges: flags["push-changes"],
80
+ generateChangelog: flags["generate-changelog"],
81
+ };
82
+ const runner = new VerseRunner(options);
83
+ await runner.run();
84
+ }
85
+ catch (error) {
86
+ const errorMessage = error instanceof Error ? error.message : String(error);
87
+ this.error(`❌ Command failed: ${errorMessage}`);
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { run } from '@oclif/core';
3
+ run().catch((err) => {
4
+ console.error(err);
5
+ process.exit(1);
6
+ });
@@ -0,0 +1,11 @@
1
+ import { Command } from '@oclif/core';
2
+ import type { Logger } from '@muverse/core';
3
+ export declare class OclifLogger implements Logger {
4
+ private readonly cmd;
5
+ constructor(cmd: Command);
6
+ info(message: string): void;
7
+ warning(message: string | Error): void;
8
+ error(message: string | Error, context?: Record<string, unknown>): void;
9
+ debug(message: string): void;
10
+ }
11
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,qBAAa,WAAY,YAAW,MAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,OAAO;IACzC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAG3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IAGtC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAGvE,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG/B"}
package/dist/logger.js ADDED
@@ -0,0 +1,20 @@
1
+ import Debug from 'debug';
2
+ const debug = Debug('muverse');
3
+ export class OclifLogger {
4
+ cmd;
5
+ constructor(cmd) {
6
+ this.cmd = cmd;
7
+ }
8
+ info(message) {
9
+ this.cmd.log(message);
10
+ }
11
+ warning(message) {
12
+ this.cmd.warn(message);
13
+ }
14
+ error(message, context) {
15
+ this.cmd.error(message, context);
16
+ }
17
+ debug(message) {
18
+ debug(message);
19
+ }
20
+ }
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@muverse/cli",
3
+ "version": "0.1.0",
4
+ "description": "μVERSE CLI - Command-line interface for μVERSE semantic versioning engine",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "muverse": "./bin/run.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc --project tsconfig.json --outDir dist",
12
+ "test": "vitest",
13
+ "test:coverage": "vitest --coverage",
14
+ "lint": "eslint src/**/*.ts",
15
+ "format": "prettier --write src/**/*.ts"
16
+ },
17
+ "keywords": [
18
+ "muverse",
19
+ "cli",
20
+ "semantic-versioning",
21
+ "conventional-commits",
22
+ "version-engine",
23
+ "monorepo"
24
+ ],
25
+ "author": "tvcsantos",
26
+ "license": "MIT",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/tvcsantos/muverse.git"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/tvcsantos/muverse/issues"
33
+ },
34
+ "homepage": "https://github.com/tvcsantos/muverse#readme",
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "types": "dist/index.d.ts",
39
+ "dependencies": {
40
+ "@oclif/core": "^4.8.0",
41
+ "@muverse/core": "^0.1.0",
42
+ "oclif": "^4.14.0"
43
+ },
44
+ "devDependencies": {
45
+ "@oclif/dev-cli": "^1.26.10",
46
+ "@types/debug": "^4.1.12",
47
+ "@types/node": "^20.19.23",
48
+ "@typescript-eslint/eslint-plugin": "^6.15.0",
49
+ "@typescript-eslint/parser": "^6.15.0",
50
+ "eslint": "^8.56.0",
51
+ "prettier": "^3.1.1",
52
+ "ts-node": "^10.9.2",
53
+ "ts-node-dev": "^2.0.0",
54
+ "typescript": "^5.3.3",
55
+ "vitest": "^1.1.0"
56
+ },
57
+ "engines": {
58
+ "node": ">=20"
59
+ },
60
+ "oclif": {
61
+ "bin": "muverse",
62
+ "commands": "./dist/commands",
63
+ "dirname": "muverse",
64
+ "topicSeparator": " ",
65
+ "plugins": []
66
+ }
67
+ }