@mmmnt/cli 0.0.1 → 0.1.1
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/LICENSE.md +113 -0
- package/README.md +276 -1
- package/dist/moment.mjs +58829 -0
- package/dist/moment.mjs.map +7 -0
- package/package.json +54 -7
package/LICENSE.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, Apache 2.0 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 mmmnt
|
|
10
|
+
|
|
11
|
+
## License Details
|
|
12
|
+
|
|
13
|
+
- Licensor: mmmnt
|
|
14
|
+
- Software: Moment
|
|
15
|
+
- License: FSL-1.1-Apache-2.0
|
|
16
|
+
- Change Date: Two years from the date of the first published version of the Software (to be set upon 0.1.0 publish)
|
|
17
|
+
- Change License: Apache License, Version 2.0
|
|
18
|
+
|
|
19
|
+
## Terms and Conditions
|
|
20
|
+
|
|
21
|
+
### Licensor ("We")
|
|
22
|
+
|
|
23
|
+
The party offering the Software under these Terms and Conditions.
|
|
24
|
+
|
|
25
|
+
### The Software
|
|
26
|
+
|
|
27
|
+
The "Software" is each version of the software that we make available under
|
|
28
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
29
|
+
Conditions with the Software.
|
|
30
|
+
|
|
31
|
+
### License Grant
|
|
32
|
+
|
|
33
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
34
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
35
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
36
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
37
|
+
|
|
38
|
+
### Permitted Purpose
|
|
39
|
+
|
|
40
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
41
|
+
means making the Software available to others in a commercial product or
|
|
42
|
+
service that:
|
|
43
|
+
|
|
44
|
+
1. substitutes for the Software;
|
|
45
|
+
|
|
46
|
+
2. substitutes for any other product or service we offer using the Software
|
|
47
|
+
that exists as of the date we make the Software available; or
|
|
48
|
+
|
|
49
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
50
|
+
|
|
51
|
+
Permitted Purposes specifically include using the Software:
|
|
52
|
+
|
|
53
|
+
1. for your internal use and access;
|
|
54
|
+
|
|
55
|
+
2. for non-commercial education;
|
|
56
|
+
|
|
57
|
+
3. for non-commercial research; and
|
|
58
|
+
|
|
59
|
+
4. in connection with professional services that you provide to a licensee
|
|
60
|
+
using the Software in accordance with these Terms and Conditions.
|
|
61
|
+
|
|
62
|
+
### Patents
|
|
63
|
+
|
|
64
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
65
|
+
patents, the license grant above includes a license under our patents. If you
|
|
66
|
+
make a claim against any party that the Software infringes or contributes to
|
|
67
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
68
|
+
immediately.
|
|
69
|
+
|
|
70
|
+
### Redistribution
|
|
71
|
+
|
|
72
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
73
|
+
the Software.
|
|
74
|
+
|
|
75
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
76
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
77
|
+
remove any copyright notices provided in or with the Software.
|
|
78
|
+
|
|
79
|
+
### Disclaimer
|
|
80
|
+
|
|
81
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
82
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
83
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
84
|
+
|
|
85
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
86
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
87
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
88
|
+
|
|
89
|
+
### Trademarks
|
|
90
|
+
|
|
91
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
92
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
93
|
+
trademarks, trade names, service marks or product names.
|
|
94
|
+
|
|
95
|
+
## Grant of Future License
|
|
96
|
+
|
|
97
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
98
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
99
|
+
the date we make the Software available. On or after that date, you may use the
|
|
100
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
101
|
+
will apply:
|
|
102
|
+
|
|
103
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
104
|
+
this file except in compliance with the License.
|
|
105
|
+
|
|
106
|
+
You may obtain a copy of the License at
|
|
107
|
+
|
|
108
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
109
|
+
|
|
110
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
111
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
112
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
113
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,278 @@
|
|
|
1
1
|
# @mmmnt/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Command-line interface for the Moment domain specification language and implementation toolchain.
|
|
4
|
+
|
|
5
|
+
[](../../LICENSE.md)
|
|
6
|
+
[](https://www.npmjs.com/package/@mmmnt/cli)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
`@mmmnt/cli` provides the `moment` command, which is the primary way most developers interact with the Moment toolchain. It wraps every package in the `@mmmnt` ecosystem behind a consistent, discoverable command-line interface with 20+ commands covering the full specification-to-implementation workflow.
|
|
11
|
+
|
|
12
|
+
From initializing a new project to parsing specifications, deriving test topologies, generating TypeScript code and BDD scenarios, running conformance tests, detecting implementation drift, and managing schema lifecycles -- every operation is available as a single CLI command. The CLI handles file I/O, output formatting, error reporting, and watch mode so that the underlying library packages remain focused on their core logic.
|
|
13
|
+
|
|
14
|
+
The CLI is designed for both interactive development and CI/CD pipeline integration. All commands produce structured output suitable for scripting, and exit codes follow standard conventions for use in automated workflows. The `--format json` flag is available on most commands for machine-readable output, and `--verbose` enables detailed logging for debugging.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install globally
|
|
20
|
+
npm install -g @mmmnt/cli
|
|
21
|
+
|
|
22
|
+
# Or run directly without installing
|
|
23
|
+
npx @mmmnt/cli
|
|
24
|
+
|
|
25
|
+
# Or install as a project dev dependency
|
|
26
|
+
npm install --save-dev @mmmnt/cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or with other package managers:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm add -g @mmmnt/cli
|
|
33
|
+
yarn global add @mmmnt/cli
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Initialize a new Moment project
|
|
40
|
+
moment init my-service
|
|
41
|
+
|
|
42
|
+
# Parse and validate a .moment specification
|
|
43
|
+
moment parse specs/my-service.moment
|
|
44
|
+
|
|
45
|
+
# Derive test topologies and scenarios
|
|
46
|
+
moment derive specs/my-service.moment
|
|
47
|
+
|
|
48
|
+
# Generate TypeScript types and test scaffolds
|
|
49
|
+
moment emit-ts specs/my-service.moment
|
|
50
|
+
|
|
51
|
+
# Generate Gherkin BDD scenarios
|
|
52
|
+
moment generate specs/my-service.moment
|
|
53
|
+
|
|
54
|
+
# Run specification conformance tests
|
|
55
|
+
moment test specs/my-service.moment
|
|
56
|
+
|
|
57
|
+
# Watch for spec changes and regenerate automatically
|
|
58
|
+
moment watch specs/
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Key Features
|
|
62
|
+
|
|
63
|
+
- **Unified entry point** -- a single `moment` binary that wraps all `@mmmnt` packages, so you do not need to import or configure individual libraries.
|
|
64
|
+
- **20+ commands** -- covers the full lifecycle from project initialization through specification, derivation, generation, testing, synchronization, and governance.
|
|
65
|
+
- **Watch mode** -- monitors `.moment` files and automatically re-parses and regenerates artifacts on save.
|
|
66
|
+
- **Structured output** -- all commands support `--format json` for machine-readable output in CI/CD pipelines.
|
|
67
|
+
- **Standard exit codes** -- non-zero exit on validation failures, drift detection, or test failures for pipeline gating.
|
|
68
|
+
- **Subcommand structure** -- complex operations like `sync` and `schema` use subcommands (`sync status`, `sync propose`, `sync accept`, `schema status`) for organized workflows.
|
|
69
|
+
- **Authentication support** -- `moment auth` subcommands manage credentials for Moment cloud services when applicable.
|
|
70
|
+
- **Verbose mode** -- `--verbose` enables detailed logging for debugging specification issues or generation failures.
|
|
71
|
+
|
|
72
|
+
## Commands
|
|
73
|
+
|
|
74
|
+
### Project Initialization
|
|
75
|
+
|
|
76
|
+
| Command | Description |
|
|
77
|
+
|---------|-------------|
|
|
78
|
+
| `moment init <name>` | Initialize a new Moment project with directory structure, `moment.manifest.json`, and a starter `.moment` specification file. |
|
|
79
|
+
|
|
80
|
+
### Specification
|
|
81
|
+
|
|
82
|
+
| Command | Description |
|
|
83
|
+
|---------|-------------|
|
|
84
|
+
| `moment parse <file>` | Parse and validate a `.moment` specification file. Reports syntax errors and semantic diagnostics with line numbers and column positions. |
|
|
85
|
+
| `moment watch <dir>` | Watch a directory for `.moment` file changes and automatically re-parse and regenerate artifacts. Runs until interrupted. |
|
|
86
|
+
|
|
87
|
+
### Derivation
|
|
88
|
+
|
|
89
|
+
| Command | Description |
|
|
90
|
+
|---------|-------------|
|
|
91
|
+
| `moment derive <file>` | Derive test topologies, simulation scenarios, event catalogs, impact analysis, and saga state machines from a specification. |
|
|
92
|
+
| `moment simulate <file>` | Run simulation scenarios against the specification and report event flow traces. |
|
|
93
|
+
|
|
94
|
+
### Code Generation
|
|
95
|
+
|
|
96
|
+
| Command | Description |
|
|
97
|
+
|---------|-------------|
|
|
98
|
+
| `moment emit-ts <file>` | Generate TypeScript interfaces, aggregate root classes, discriminated event union types, and test scaffold files from the specification. |
|
|
99
|
+
| `moment generate <file>` | Generate Gherkin `.feature` files, a `specification.md` document with Mermaid diagrams, and an `asyncapi.yaml` specification. |
|
|
100
|
+
|
|
101
|
+
### Testing
|
|
102
|
+
|
|
103
|
+
| Command | Description |
|
|
104
|
+
|---------|-------------|
|
|
105
|
+
| `moment test <file>` | Execute derived tests against your domain implementation and report conformance results. Non-zero exit code on failures. |
|
|
106
|
+
|
|
107
|
+
### Visualization
|
|
108
|
+
|
|
109
|
+
| Command | Description |
|
|
110
|
+
|---------|-------------|
|
|
111
|
+
| `moment viz <file>` | Generate visualization data (context maps, flow timelines) as a JSON `VizDataEnvelope`. Output can be piped to files or visualization tools. |
|
|
112
|
+
|
|
113
|
+
### Synchronization
|
|
114
|
+
|
|
115
|
+
| Command | Description |
|
|
116
|
+
|---------|-------------|
|
|
117
|
+
| `moment sync status <file>` | Detect drift between the specification and implementation by comparing generated and actual TypeScript files. Non-zero exit code on drift. |
|
|
118
|
+
| `moment sync propose <file>` | Generate change proposals to reconcile detected drift between specification and implementation. |
|
|
119
|
+
| `moment sync accept <file>` | Accept proposed changes and apply them to the implementation. |
|
|
120
|
+
| `moment reconcile <file>` | Run cascade reconciliation to classify and resolve drift. Supports `--mode local` and `--mode event` for different reconciliation sources. |
|
|
121
|
+
| `moment status <file>` | Display unified project status: parse validity, sync drift, schema lifecycle, and upstream fingerprint. |
|
|
122
|
+
|
|
123
|
+
### Schema Governance
|
|
124
|
+
|
|
125
|
+
| Command | Description |
|
|
126
|
+
|---------|-------------|
|
|
127
|
+
| `moment schema status <file>` | Display schema lifecycle status for all events and commands in the specification, grouped by phase. |
|
|
128
|
+
| `moment lint <file>` | Run codex governance rules against the specification and report policy violations. Supports `--format json` for CI integration. |
|
|
129
|
+
|
|
130
|
+
### Import
|
|
131
|
+
|
|
132
|
+
| Command | Description |
|
|
133
|
+
|---------|-------------|
|
|
134
|
+
| `moment import --from-sift <dir>` | Import Sift JSONL event streams from a `.domain/` directory into `.moment` specification files. Writes upstream fingerprint for drift tracking. |
|
|
135
|
+
|
|
136
|
+
### Authentication
|
|
137
|
+
|
|
138
|
+
| Command | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| `moment auth login` | Authenticate with Moment cloud services. Initiates an interactive login flow. |
|
|
141
|
+
| `moment auth status` | Display current authentication status and account information. |
|
|
142
|
+
| `moment auth logout` | Clear stored authentication credentials. |
|
|
143
|
+
|
|
144
|
+
## Global Options
|
|
145
|
+
|
|
146
|
+
| Option | Description |
|
|
147
|
+
|--------|-------------|
|
|
148
|
+
| `--help` | Display help for any command. |
|
|
149
|
+
| `--version` | Display the installed CLI version. |
|
|
150
|
+
| `--output <dir>` | Override the default output directory for generated artifacts. |
|
|
151
|
+
| `--format <fmt>` | Output format: `text` (default), `json`, or `silent`. |
|
|
152
|
+
| `--verbose` | Enable verbose logging for debugging. |
|
|
153
|
+
|
|
154
|
+
## Examples
|
|
155
|
+
|
|
156
|
+
### New Project Setup
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Scaffold a new project
|
|
160
|
+
moment init my-service
|
|
161
|
+
cd my-service
|
|
162
|
+
|
|
163
|
+
# Write your .moment specification, then generate everything
|
|
164
|
+
moment derive specs/my-service.moment
|
|
165
|
+
moment emit-ts specs/my-service.moment
|
|
166
|
+
moment generate specs/my-service.moment
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Continuous Development
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Watch mode regenerates on every save
|
|
173
|
+
moment watch specs/
|
|
174
|
+
|
|
175
|
+
# After implementing domain logic, run conformance tests
|
|
176
|
+
moment test specs/my-service.moment
|
|
177
|
+
|
|
178
|
+
# Check for drift
|
|
179
|
+
moment status specs/my-service.moment
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Upstream Specification Import
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Import from Sift event streams
|
|
186
|
+
moment import --from-sift .domain/
|
|
187
|
+
|
|
188
|
+
# Review the generated .moment files, then derive and generate
|
|
189
|
+
moment derive specs/my-service.moment
|
|
190
|
+
moment emit-ts specs/my-service.moment
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### CI/CD Pipeline
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
#!/bin/bash
|
|
197
|
+
set -e
|
|
198
|
+
|
|
199
|
+
# Validate specification
|
|
200
|
+
moment parse specs/my-service.moment
|
|
201
|
+
|
|
202
|
+
# Check for drift (non-zero exit code on drift)
|
|
203
|
+
moment sync status specs/my-service.moment
|
|
204
|
+
|
|
205
|
+
# Run conformance tests
|
|
206
|
+
moment test specs/my-service.moment
|
|
207
|
+
|
|
208
|
+
# Lint governance rules
|
|
209
|
+
moment lint specs/my-service.moment --format json
|
|
210
|
+
|
|
211
|
+
# Generate documentation artifacts
|
|
212
|
+
moment generate specs/my-service.moment
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Drift Detection and Reconciliation
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Check sync status
|
|
219
|
+
moment sync status specs/my-service.moment
|
|
220
|
+
|
|
221
|
+
# Generate proposals for detected drift
|
|
222
|
+
moment sync propose specs/my-service.moment
|
|
223
|
+
|
|
224
|
+
# Review proposals, then accept
|
|
225
|
+
moment sync accept specs/my-service.moment
|
|
226
|
+
|
|
227
|
+
# Or run full cascade reconciliation
|
|
228
|
+
moment reconcile specs/my-service.moment
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Schema Governance Audit
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# View schema lifecycle status
|
|
235
|
+
moment schema status specs/my-service.moment
|
|
236
|
+
|
|
237
|
+
# Run governance rules
|
|
238
|
+
moment lint specs/my-service.moment
|
|
239
|
+
|
|
240
|
+
# Machine-readable output for dashboards
|
|
241
|
+
moment schema status specs/my-service.moment --format json
|
|
242
|
+
moment lint specs/my-service.moment --format json
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Integration
|
|
246
|
+
|
|
247
|
+
`@mmmnt/cli` is the consumer-facing interface to the entire Moment toolchain. It depends on all library packages:
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
@mmmnt/cli
|
|
251
|
+
|
|
|
252
|
+
+-- @mmmnt/core (parsing and IR generation)
|
|
253
|
+
+-- @mmmnt/derive (test topology and scenario derivation)
|
|
254
|
+
+-- @mmmnt/emit-ts (TypeScript code generation)
|
|
255
|
+
+-- @mmmnt/generate (Gherkin, specification documents, AsyncAPI)
|
|
256
|
+
+-- @mmmnt/harness (test execution)
|
|
257
|
+
+-- @mmmnt/schema (schema lifecycle governance)
|
|
258
|
+
+-- @mmmnt/sync (drift detection and reconciliation)
|
|
259
|
+
+-- @mmmnt/viz (visualization data generation)
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
For programmatic integration or AI agent workflows, see [@mmmnt/mcp](../mcp/README.md) which exposes the same capabilities over the Model Context Protocol.
|
|
263
|
+
|
|
264
|
+
## Contributing
|
|
265
|
+
|
|
266
|
+
This package is part of the [mmmnt monorepo](https://github.com/mmmnt/mmmnt). See the repository root for contribution guidelines, development setup, and the code of conduct.
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
git clone https://github.com/mmmnt/mmmnt.git
|
|
270
|
+
cd mmmnt
|
|
271
|
+
pnpm install
|
|
272
|
+
pnpm turbo build --filter=@mmmnt/cli
|
|
273
|
+
pnpm --filter @mmmnt/cli test
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## License
|
|
277
|
+
|
|
278
|
+
[FSL-1.1-Apache-2.0](../../LICENSE.md)
|