@vizualmodel/vmblu-cli 0.3.1 → 0.3.3
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 +2 -3
- package/commands/init/index.js +4 -2
- package/commands/init/init-project.js +10 -5
- package/commands/profile/profile.bundle.js +637 -384
- package/package.json +3 -2
- package/templates/0.8.3/profile.schema.json +74 -0
- package/templates/0.8.3/seed.md +17 -0
- package/templates/0.8.3/vmblu.annex.md +136 -0
- package/templates/0.8.3/vmblu.schema.json +268 -0
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# CLI for vmblu
|
|
2
2
|
This folder contains the CLI commands that are available for vmblu.
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
## Folder layout
|
|
6
5
|
|
|
7
6
|
```txt
|
|
@@ -12,7 +11,7 @@ vmblu/
|
|
|
12
11
|
profile/
|
|
13
12
|
migrate/
|
|
14
13
|
templates/
|
|
15
|
-
|
|
14
|
+
x.y.z/ # a directory per version x.y.z
|
|
16
15
|
vmblu.schema.json
|
|
17
16
|
vmblu.annex.md
|
|
18
17
|
seed.md
|
|
@@ -25,7 +24,7 @@ vmblu/
|
|
|
25
24
|
|
|
26
25
|
## Add more commands
|
|
27
26
|
|
|
28
|
-
Create commands/migrate/index.js with the same export shape { command, describe, builder, handler }. The router auto-discovers it
|
|
27
|
+
Create commands/migrate/index.js with the same export shape { command, describe, builder, handler }. The router auto-discovers it.
|
|
29
28
|
|
|
30
29
|
## Dev/test workflow
|
|
31
30
|
|
package/commands/init/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { initProject } from './init-project.js';
|
|
5
|
+
import pckg from '../../package.json' assert { type: 'json' };
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
9
|
|
|
@@ -9,7 +11,7 @@ export const command = 'init <folder name>';
|
|
|
9
11
|
export const describe = 'Scaffold an empty vmblu project';
|
|
10
12
|
export const builder = [
|
|
11
13
|
{ flag: '--name <project>', desc: 'Project name (default: folder name)' },
|
|
12
|
-
{ flag: '--schema <ver>', desc: 'Schema version (default:
|
|
14
|
+
{ flag: '--schema <ver>', desc: 'Schema version (default: latest version)' },
|
|
13
15
|
{ flag: '--force', desc: 'Overwrite existing files' },
|
|
14
16
|
{ flag: '--dry-run', desc: 'Show actions without writing' }
|
|
15
17
|
];
|
|
@@ -28,7 +30,7 @@ export const handler = async (argv) => {
|
|
|
28
30
|
|
|
29
31
|
const targetDir = path.resolve(args._[0] || '.');
|
|
30
32
|
const projectName = args.name || path.basename(targetDir);
|
|
31
|
-
const schemaVersion = args.schema ||
|
|
33
|
+
const schemaVersion = args.schema || pckg.schemaVersion;
|
|
32
34
|
|
|
33
35
|
await initProject({
|
|
34
36
|
targetDir,
|
|
@@ -6,6 +6,11 @@ import path from 'path';
|
|
|
6
6
|
//import crypto from 'crypto';
|
|
7
7
|
import { makePackageJson } from './make-package-json.js';
|
|
8
8
|
|
|
9
|
+
// Get the versions
|
|
10
|
+
import pckg from '../../package.json' assert { type: 'json' };
|
|
11
|
+
const SCHEMA_VERSION = pckg.schemaVersion
|
|
12
|
+
const CLI_VERSION = pckg.version
|
|
13
|
+
|
|
9
14
|
function rel(from, to) {
|
|
10
15
|
return path.posix.join(...path.relative(from, to).split(path.sep));
|
|
11
16
|
}
|
|
@@ -50,7 +55,7 @@ function defaultModel(projectName) {
|
|
|
50
55
|
const now = new Date().toISOString();
|
|
51
56
|
return JSON.stringify({
|
|
52
57
|
header: {
|
|
53
|
-
version:
|
|
58
|
+
version: SCHEMA_VERSION,
|
|
54
59
|
created: now,
|
|
55
60
|
saved: now,
|
|
56
61
|
utc: now,
|
|
@@ -73,7 +78,7 @@ function defaultModel(projectName) {
|
|
|
73
78
|
function defaultDoc(projectName) {
|
|
74
79
|
const now = new Date().toISOString();
|
|
75
80
|
return JSON.stringify({
|
|
76
|
-
version:
|
|
81
|
+
version: CLI_VERSION,
|
|
77
82
|
generatedAt: now,
|
|
78
83
|
entries: {}
|
|
79
84
|
}, null, 2);
|
|
@@ -145,7 +150,7 @@ async function initProject(opts) {
|
|
|
145
150
|
const {
|
|
146
151
|
targetDir,
|
|
147
152
|
projectName = path.basename(opts.targetDir),
|
|
148
|
-
schemaVersion =
|
|
153
|
+
schemaVersion = SCHEMA_VERSION,
|
|
149
154
|
force = false,
|
|
150
155
|
dryRun = false,
|
|
151
156
|
templatesDir = path.join(__dirname, '..', 'templates'),
|
|
@@ -160,7 +165,7 @@ async function initProject(opts) {
|
|
|
160
165
|
|
|
161
166
|
const absTarget = path.resolve(targetDir);
|
|
162
167
|
const modelFile = path.join(absTarget, `${projectName}.vmblu`);
|
|
163
|
-
const docFile = path.join(absTarget, `${projectName}
|
|
168
|
+
const docFile = path.join(absTarget, `${projectName}.prf.json`);
|
|
164
169
|
|
|
165
170
|
const llmDir = path.join(absTarget, 'llm');
|
|
166
171
|
const sessionDir = path.join(llmDir, 'session');
|
|
@@ -246,7 +251,7 @@ async function initProject(opts) {
|
|
|
246
251
|
}
|
|
247
252
|
|
|
248
253
|
// 5) Make the package file
|
|
249
|
-
makePackageJson({ absTarget, projectName, force, dryRun, addCliDep: true, cliVersion: "^
|
|
254
|
+
makePackageJson({ absTarget, projectName, force, dryRun, addCliDep: true, cliVersion: "^" + CLI_VERSION }, ui);
|
|
250
255
|
|
|
251
256
|
// 6) Final tree hint
|
|
252
257
|
ui.info(`\nScaffold complete${dryRun ? ' (dry run)' : ''}:\n` +
|