@muverse/core 0.1.4 → 0.1.6
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 +225 -8
- package/dist/services/verse-runner.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,22 +1,239 @@
|
|
|
1
|
-
# @muverse/core
|
|
1
|
+
# @muverse/core - Core Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The core business logic powering μVERSE (Version Engine for Repo Semantic Evolution). This package is completely framework-agnostic and can be integrated into any TypeScript/JavaScript project, CI/CD system, or custom tooling.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
8
|
+
npm install @muverse/core
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { VerseRunner } from '@muverse/core';
|
|
15
|
+
|
|
16
|
+
const runner = new VerseRunner({
|
|
17
|
+
repoRoot: '/path/to/repository',
|
|
18
|
+
adapter: 'gradle', // Optional - auto-detected if not specified
|
|
19
|
+
dryRun: false,
|
|
20
|
+
pushTags: true,
|
|
21
|
+
pushChanges: true,
|
|
22
|
+
generateChangelog: true
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const result = await runner.run();
|
|
26
|
+
|
|
27
|
+
console.log(`Bumped: ${result.bumped}`);
|
|
28
|
+
console.log(`Changed modules:`, result.changedModules);
|
|
29
|
+
console.log(`Created tags:`, result.createdTags);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For detailed pre-release configuration and examples, see [PRERELEASE.md](./PRERELEASE.md).
|
|
33
|
+
|
|
34
|
+
## VerseRunner API
|
|
35
|
+
|
|
36
|
+
### Options
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
interface RunnerOptions {
|
|
40
|
+
repoRoot: string; // Path to repository root
|
|
41
|
+
adapter?: string; // Language adapter (auto-detected if not specified)
|
|
42
|
+
dryRun?: boolean; // Preview changes without writing (default: false)
|
|
43
|
+
pushTags?: boolean; // Push version tags (default: true)
|
|
44
|
+
prereleaseMode?: boolean; // Generate pre-release versions (default: false)
|
|
45
|
+
prereleaseId?: string; // Pre-release identifier: alpha, beta, rc, etc. (default: 'alpha')
|
|
46
|
+
bumpUnchanged?: boolean; // Bump modules with no changes in prerelease mode (default: false)
|
|
47
|
+
addBuildMetadata?: boolean; // Add build metadata with short SHA (default: false)
|
|
48
|
+
timestampVersions?: boolean; // Use timestamp-based prerelease IDs (default: false)
|
|
49
|
+
appendSnapshot?: boolean; // Add -SNAPSHOT suffix (Gradle only) (default: false)
|
|
50
|
+
pushChanges?: boolean; // Commit and push version changes (default: true)
|
|
51
|
+
generateChangelog?: boolean; // Generate changelogs (default: true)
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Result
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
interface RunnerResult {
|
|
59
|
+
bumped: boolean; // Whether any version was updated
|
|
60
|
+
changedModules: Array<{
|
|
61
|
+
name: string; // Module name
|
|
62
|
+
from: string; // Previous version
|
|
63
|
+
to: string; // New version
|
|
64
|
+
}>;
|
|
65
|
+
createdTags: string[]; // Git tags that were created
|
|
66
|
+
changelogPaths: string[]; // Generated changelog file paths
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
μVERSE core uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration loading and [Zod](https://github.com/colinhacks/zod) for validation.
|
|
73
|
+
|
|
74
|
+
### Supported Configuration Files
|
|
75
|
+
|
|
76
|
+
1. `package.json` (in a `"muverse"` property)
|
|
77
|
+
2. `.muverserc.json`
|
|
78
|
+
3. `.muverserc.yaml` / `.muverserc.yml`
|
|
79
|
+
4. `.muverserc.js` or `muverse.config.js` (JavaScript)
|
|
80
|
+
|
|
81
|
+
### Configuration Example
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"defaultBump": "patch",
|
|
86
|
+
"commitTypes": {
|
|
87
|
+
"feat": "minor",
|
|
88
|
+
"fix": "patch",
|
|
89
|
+
"perf": "patch",
|
|
90
|
+
"docs": "ignore"
|
|
91
|
+
},
|
|
92
|
+
"dependencyRules": {
|
|
93
|
+
"onMajorOfDependency": "minor",
|
|
94
|
+
"onMinorOfDependency": "patch",
|
|
95
|
+
"onPatchOfDependency": "none"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Adapters
|
|
101
|
+
|
|
102
|
+
### Gradle Adapter
|
|
103
|
+
|
|
104
|
+
Built-in support for Gradle projects (Groovy & Kotlin DSL).
|
|
105
|
+
|
|
106
|
+
**Features:**
|
|
107
|
+
- Multi-module project detection
|
|
108
|
+
- Version management through root `gradle.properties`
|
|
109
|
+
- Dependency detection
|
|
110
|
+
- Both Groovy and Kotlin DSL support
|
|
111
|
+
|
|
112
|
+
**Version Format:**
|
|
113
|
+
```properties
|
|
114
|
+
# Root module
|
|
115
|
+
version=1.0.0
|
|
116
|
+
|
|
117
|
+
# Submodules
|
|
118
|
+
core.version=2.1.0
|
|
119
|
+
api.version=1.5.0
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Creating Custom Adapters
|
|
123
|
+
|
|
124
|
+
To add support for new project types, implement a language adapter following the pattern in `src/adapters/gradle/`:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import {
|
|
128
|
+
AdapterIdentifier,
|
|
129
|
+
ModuleDetector,
|
|
130
|
+
VersionUpdateStrategy,
|
|
131
|
+
ModuleSystemFactory,
|
|
132
|
+
AdapterMetadata,
|
|
133
|
+
RawProjectInformation,
|
|
134
|
+
ProcessedModuleChange
|
|
135
|
+
} from '@muverse/core';
|
|
136
|
+
|
|
137
|
+
// 1. Adapter identifier for auto-detection
|
|
138
|
+
class MyAdapterIdentifier implements AdapterIdentifier {
|
|
139
|
+
readonly metadata: AdapterMetadata = {
|
|
140
|
+
id: 'my-adapter',
|
|
141
|
+
capabilities: { supportsSnapshots: false }
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
async accept(projectRoot: string): Promise<boolean> {
|
|
145
|
+
// Check for adapter-specific files
|
|
146
|
+
return await fileExists(path.join(projectRoot, 'my-build-file'));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 2. Module detector for discovering project structure
|
|
151
|
+
class MyModuleDetector implements ModuleDetector {
|
|
152
|
+
async detectModules(projectRoot: string): Promise<RawProjectInformation> {
|
|
153
|
+
// Discover and return modules and dependencies
|
|
154
|
+
return {
|
|
155
|
+
modules: [
|
|
156
|
+
{ name: 'root', path: projectRoot, version: '1.0.0' },
|
|
157
|
+
{ name: 'module-a', path: join(projectRoot, 'module-a'), version: '2.0.0' }
|
|
158
|
+
],
|
|
159
|
+
dependencies: [
|
|
160
|
+
{ from: 'module-a', to: 'root' }
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// 3. Version update strategy for applying changes
|
|
167
|
+
class MyVersionUpdateStrategy implements VersionUpdateStrategy {
|
|
168
|
+
async applyVersionUpdates(
|
|
169
|
+
changes: ProcessedModuleChange[],
|
|
170
|
+
projectRoot: string
|
|
171
|
+
): Promise<void> {
|
|
172
|
+
// Apply version changes to build files
|
|
173
|
+
for (const change of changes) {
|
|
174
|
+
// Update version in your project's format
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// 4. Module system factory to tie it all together
|
|
180
|
+
class MyModuleSystemFactory implements ModuleSystemFactory {
|
|
181
|
+
createDetector(): ModuleDetector {
|
|
182
|
+
return new MyModuleDetector();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
createVersionUpdateStrategy(): VersionUpdateStrategy {
|
|
186
|
+
return new MyVersionUpdateStrategy();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Then register your adapter:
|
|
192
|
+
|
|
193
|
+
1. Add to `src/factories/module-system-factory.ts` in the `createModuleSystemFactory` function
|
|
194
|
+
2. Add to `src/services/adapter-identifier-registry.ts` in the registry initialization
|
|
195
|
+
|
|
196
|
+
## Development
|
|
197
|
+
|
|
198
|
+
### Building
|
|
12
199
|
|
|
13
200
|
```bash
|
|
14
|
-
|
|
201
|
+
# From monorepo root
|
|
202
|
+
npm run build
|
|
203
|
+
|
|
204
|
+
# Or from core package
|
|
205
|
+
cd packages/core
|
|
206
|
+
npm run build
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Testing
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# From monorepo root
|
|
213
|
+
npm test
|
|
214
|
+
|
|
215
|
+
# Or from core package
|
|
216
|
+
cd packages/core
|
|
217
|
+
npm test
|
|
218
|
+
npm run test:coverage
|
|
15
219
|
```
|
|
16
220
|
|
|
17
|
-
|
|
221
|
+
### Publishing
|
|
18
222
|
|
|
19
223
|
```bash
|
|
20
|
-
# ensure dist is built
|
|
21
224
|
npm publish --workspace packages/core --access public
|
|
22
225
|
```
|
|
226
|
+
|
|
227
|
+
## Related Packages
|
|
228
|
+
|
|
229
|
+
- **[@muverse/cli](../cli)** - Command-line interface
|
|
230
|
+
- **[@muverse/action](../action)** - GitHub Actions integration
|
|
231
|
+
|
|
232
|
+
## Requirements
|
|
233
|
+
|
|
234
|
+
- **Node.js**: >= 20
|
|
235
|
+
- **TypeScript**: >= 5.0 (if using TypeScript)
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
MIT License - see [LICENSE](../../LICENSE) for details.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verse-runner.d.ts","sourceRoot":"","sources":["../../src/services/verse-run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M,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;CACnC,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,CAAC,mBAAmB,CAAuB;IAClD,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,OAAO,CAAgB;IAG/B,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,yBAAyB,CAA4B;IAC7D,OAAO,CAAC,uBAAuB,CAA0B;gBAE7C,OAAO,EAAE,aAAa;IAyBlC,OAAO,CAAC,cAAc;IAsBtB,OAAO,CAAC,eAAe;IAgCjB,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC;YAYpB,KAAK;CAgIpB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muverse/core",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "Version Engine for Repo Semantic Evolution (Core Library)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"exports": {
|