mythik-cli 0.1.0 → 0.1.2
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 +168 -40
- package/dist/cli.js +1 -1
- package/package.json +66 -65
package/README.md
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
# mythik-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The AI-first surface to Mythik. The `mythik` command and its
|
|
4
|
+
programmatic sibling (`mythik-cli/api`) are how an AI agent — or a
|
|
5
|
+
human — reads, validates, patches, versions, and promotes Mythik
|
|
6
|
+
specs.
|
|
7
|
+
|
|
8
|
+
> See [the framework README on GitHub](https://github.com/mldixdev/mythik#readme)
|
|
9
|
+
> for the full Mythik architecture and design philosophy. This file
|
|
10
|
+
> documents what `mythik-cli` gives you and how to use it.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## What Mythik is, briefly
|
|
15
|
+
|
|
16
|
+
Mythik is an **AI-first, spec-driven framework**. Every UI screen and
|
|
17
|
+
API endpoint lives as a JSON spec in a database — not a `.tsx` file
|
|
18
|
+
in a repo. Apps grow by adding rows, not files. The framework
|
|
19
|
+
validates every change atomically, versions everything automatically,
|
|
20
|
+
and promotes between environments (`dev`, `staging`, `production`) by
|
|
21
|
+
atomic pointer move. Your favorite AI agent drives the full workflow
|
|
22
|
+
through this CLI — no GUI in the loop.
|
|
4
23
|
|
|
5
24
|
## Install
|
|
6
25
|
|
|
@@ -14,58 +33,167 @@ The package exposes the `mythik` binary:
|
|
|
14
33
|
npx mythik --help
|
|
15
34
|
```
|
|
16
35
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
## The canonical workflow
|
|
37
|
+
|
|
38
|
+
The Mythik loop is four steps, all served by this package:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
┌──────────────────────────────────────────────────┐
|
|
42
|
+
│ │
|
|
43
|
+
▼ │
|
|
44
|
+
manifest ──▶ elements ──▶ patch ──▶ observe
|
|
45
|
+
(read (read just (RFC 6902 (the
|
|
46
|
+
structure) what you diff; next
|
|
47
|
+
need) atomic manifest)
|
|
48
|
+
validation
|
|
49
|
+
on push)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Each step is one command:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# 1. Read structure
|
|
56
|
+
$ npx mythik manifest task-manager
|
|
57
|
+
|
|
58
|
+
# 2. Read just the elements you need (use --toon for token-efficient output)
|
|
59
|
+
$ npx mythik elements task-manager task-row,new-task-form --json
|
|
60
|
+
|
|
61
|
+
# 3. Apply a patch (validates atomically; rejected if it breaks the contract)
|
|
62
|
+
$ npx mythik patch task-manager --from-file add-due-date.json --author claude
|
|
63
|
+
✓ Patch applied. v3 → v4. 4 elements modified.
|
|
64
|
+
|
|
65
|
+
# 4. Observe — read the new structure
|
|
66
|
+
$ npx mythik manifest task-manager
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
When `patch` fails (the candidate breaks the contract), the gate
|
|
70
|
+
returns structured diagnostics: rule IDs, paths, suggestion text. The
|
|
71
|
+
agent reads the error, refines the patch, and retries. No half-baked
|
|
72
|
+
write ever lands.
|
|
73
|
+
|
|
74
|
+
## Moving across environments
|
|
75
|
+
|
|
76
|
+
`dev`, `staging`, `production` are not deploy targets — they are
|
|
77
|
+
pointers to specific versions of a spec. Move them with `envs`;
|
|
78
|
+
promote across them atomically with `promote`:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Move the dev pointer to the new version
|
|
82
|
+
$ npx mythik envs task-manager --set dev=4 --author claude
|
|
83
|
+
|
|
84
|
+
# Promote dev → production (validates atomically; rejected if inconsistent)
|
|
85
|
+
$ npx mythik promote task-manager --from dev --to production --confirm --author mldix
|
|
86
|
+
✓ Validated against contract.
|
|
87
|
+
✓ Cross-screen consistency check passed.
|
|
88
|
+
✓ Pointer moved: production v3 → v4.
|
|
89
|
+
|
|
90
|
+
# List current environment pointers
|
|
91
|
+
$ npx mythik envs task-manager --json
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Read-only previews
|
|
95
|
+
|
|
96
|
+
For drafts and audits *outside* the canonical loop:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Validate a stored spec (read-only check; no write)
|
|
100
|
+
$ npx mythik validate task-manager
|
|
101
|
+
|
|
102
|
+
# Lint a local file (draft not yet pushed) or a directory
|
|
103
|
+
$ npx mythik lint --from-file draft.json
|
|
104
|
+
$ npx mythik lint --from-dir ./specs
|
|
105
|
+
|
|
106
|
+
# Cross-validate a frontend spec against an ApiSpec (catches drift before deploy)
|
|
107
|
+
$ npx mythik contract --app app-demo --api api-demo
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
All three run the same validators that `patch` and `promote` enforce
|
|
111
|
+
atomically — useful when constructing complex multi-step changes
|
|
112
|
+
locally before committing to a push.
|
|
113
|
+
|
|
114
|
+
## History and rollback
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Show version history with structural diffs
|
|
118
|
+
$ npx mythik history task-manager
|
|
119
|
+
|
|
120
|
+
# Compare two versions or two environments
|
|
121
|
+
$ npx mythik diff task-manager 3 4
|
|
122
|
+
$ npx mythik diff task-manager dev production
|
|
123
|
+
|
|
124
|
+
# Always-forward rollback (creates a new version with old content)
|
|
125
|
+
$ npx mythik rollback task-manager --to 3 --author mldix
|
|
30
126
|
```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Point the AI agent at the printed directory before asking it to create or modify Mythik specs. To copy the docs into a
|
|
43
|
-
project-local folder:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npx mythik docs copy ./mythik-docs
|
|
47
|
-
```
|
|
127
|
+
|
|
128
|
+
Rollback never rewrites history. The new version `v5` will hold the
|
|
129
|
+
content of `v3`. `v4` stays in the history with its own author and
|
|
130
|
+
timestamp.
|
|
131
|
+
|
|
132
|
+
## Output formats
|
|
133
|
+
|
|
134
|
+
| Flag | When to use |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `--json` | Machine-readable output for scripts and IDE integrations |
|
|
137
|
+
| `--toon` (where supported) | Token-efficient agent reads — same shape, fewer tokens, useful for paginating large manifests or element catalogs |
|
|
48
138
|
|
|
49
139
|
## Programmatic API
|
|
50
140
|
|
|
51
|
-
|
|
141
|
+
When a script, IDE integration, or AI agent should avoid shell
|
|
142
|
+
quoting, use `mythik-cli/api`:
|
|
52
143
|
|
|
53
144
|
```ts
|
|
54
|
-
import { runPatch,
|
|
145
|
+
import { runPatch, runValidate, runPromote } from 'mythik-cli/api';
|
|
55
146
|
|
|
56
|
-
await runPatch({
|
|
57
|
-
screen: '
|
|
58
|
-
fromFile: '
|
|
147
|
+
const result = await runPatch({
|
|
148
|
+
screen: 'task-manager',
|
|
149
|
+
fromFile: 'add-due-date.json',
|
|
150
|
+
author: 'claude',
|
|
59
151
|
json: true,
|
|
60
152
|
});
|
|
153
|
+
|
|
154
|
+
if (!result.ok) {
|
|
155
|
+
console.error(result.diagnostics);
|
|
156
|
+
}
|
|
61
157
|
```
|
|
62
158
|
|
|
63
|
-
The programmatic API uses the same implementation path as the
|
|
159
|
+
The programmatic API uses the same implementation path as the binary —
|
|
160
|
+
nothing is special-cased. Whatever the CLI does, the API does
|
|
161
|
+
identically.
|
|
64
162
|
|
|
65
|
-
##
|
|
163
|
+
## Bundled AI documentation
|
|
66
164
|
|
|
67
|
-
|
|
165
|
+
The `mythik` package (peer dependency) ships canonical AI docs at
|
|
166
|
+
`node_modules/mythik/docs/`. Locate or copy them:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
$ npx mythik docs path
|
|
170
|
+
/your-project/node_modules/mythik/docs
|
|
171
|
+
|
|
172
|
+
$ npx mythik docs copy ./mythik-docs
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Point your AI agent at the printed path before asking it to author or
|
|
176
|
+
modify specs. Inside that directory:
|
|
177
|
+
|
|
178
|
+
- `consumer/ai-context.md` — spec-generation primer (rules and traps)
|
|
179
|
+
- `consumer/ai-context-primitives.md` — every primitive's props
|
|
180
|
+
- `consumer/reference-doc.md` — full rule catalog
|
|
181
|
+
- `wiki/compiled/` — atomic per-concept articles (one page per action,
|
|
182
|
+
primitive, rule, expression) optimized for AI lookup
|
|
183
|
+
- `llms.txt` — index for AI tools that read it
|
|
184
|
+
|
|
185
|
+
## Related packages
|
|
186
|
+
|
|
187
|
+
- [`mythik`](https://github.com/mldixdev/mythik/tree/main/packages/core#readme) — the runtime this CLI manipulates
|
|
188
|
+
- [`mythik-react`](https://github.com/mldixdev/mythik/tree/main/packages/react#readme) — render the specs as a React app
|
|
189
|
+
- [`mythik-server`](https://github.com/mldixdev/mythik/tree/main/packages/server#readme) — declarative REST server from an `ApiSpec`
|
|
68
190
|
|
|
69
191
|
## Status
|
|
70
192
|
|
|
71
|
-
v0.1.
|
|
193
|
+
`v0.1.2` public release. The binary name is `mythik`; the npm package
|
|
194
|
+
name is `mythik-cli`. APIs are documented for real-world feedback as
|
|
195
|
+
the framework evolves.
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
Apache-2.0.
|
package/dist/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ const program = new Command();
|
|
|
26
26
|
program
|
|
27
27
|
.name('mythik')
|
|
28
28
|
.description('Mythik CLI — manage specs via SpecEngine')
|
|
29
|
-
.version('0.1.
|
|
29
|
+
.version('0.1.2');
|
|
30
30
|
program
|
|
31
31
|
.command('manifest <screen>')
|
|
32
32
|
.description('Show structural tree of a screen spec')
|
package/package.json
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mythik-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Command-line and programmatic tooling for validating, linting, pushing, patching, and versioning Mythik specs.",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"mythik": "dist/cli.js"
|
|
9
|
-
},
|
|
10
|
-
"main": "dist/cli.js",
|
|
11
|
-
"keywords": [
|
|
12
|
-
"mythik",
|
|
13
|
-
"cli",
|
|
14
|
-
"json",
|
|
15
|
-
"spec-driven",
|
|
16
|
-
"validation",
|
|
17
|
-
"lint",
|
|
18
|
-
"ai"
|
|
19
|
-
],
|
|
20
|
-
"homepage": "https://mythik.dev",
|
|
21
|
-
"bugs": {
|
|
22
|
-
"url": "https://github.com/mldixdev/mythik/issues"
|
|
23
|
-
},
|
|
24
|
-
"repository": {
|
|
25
|
-
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/mldixdev/mythik.git",
|
|
27
|
-
"directory": "packages/cli"
|
|
28
|
-
},
|
|
29
|
-
"files": [
|
|
30
|
-
"dist",
|
|
31
|
-
"LICENSE",
|
|
32
|
-
"NOTICE"
|
|
33
|
-
],
|
|
34
|
-
"exports": {
|
|
35
|
-
".": {
|
|
36
|
-
"types": "./dist/cli.d.ts",
|
|
37
|
-
"default": "./dist/cli.js"
|
|
38
|
-
},
|
|
39
|
-
"./api": {
|
|
40
|
-
"types": "./dist/api.d.ts",
|
|
41
|
-
"default": "./dist/api.js"
|
|
42
|
-
},
|
|
43
|
-
"./package.json": "./package.json"
|
|
44
|
-
},
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mythik-cli",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Command-line and programmatic tooling for validating, linting, pushing, patching, and versioning Mythik specs.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mythik": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/cli.js",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"mythik",
|
|
13
|
+
"cli",
|
|
14
|
+
"json",
|
|
15
|
+
"spec-driven",
|
|
16
|
+
"validation",
|
|
17
|
+
"lint",
|
|
18
|
+
"ai"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://mythik.dev",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/mldixdev/mythik/issues"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/mldixdev/mythik.git",
|
|
27
|
+
"directory": "packages/cli"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"NOTICE"
|
|
33
|
+
],
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/cli.d.ts",
|
|
37
|
+
"default": "./dist/cli.js"
|
|
38
|
+
},
|
|
39
|
+
"./api": {
|
|
40
|
+
"types": "./dist/api.d.ts",
|
|
41
|
+
"default": "./dist/api.js"
|
|
42
|
+
},
|
|
43
|
+
"./package.json": "./package.json"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@inquirer/prompts": "^7.0.0",
|
|
47
|
+
"@toon-format/toon": "^2.1.0",
|
|
48
|
+
"commander": "^13.0.0",
|
|
49
|
+
"mythik": "0.1.2"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^25.5.2"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"typescript": ">=5.0.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"typescript": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "node ../../node_modules/typescript/bin/tsc",
|
|
64
|
+
"typecheck": "node ../../node_modules/typescript/bin/tsc --noEmit"
|
|
65
|
+
}
|
|
66
|
+
}
|