@vertesia/memory-cli 0.80.0-dev.20251121 → 0.80.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 +94 -14
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,32 +1,112 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vertesia/memory-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A command-line tool for building and managing Vertesia memory packs. Memory packs are archives containing structured data for LLM context.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
It was designed to fulfil the following main use cases:
|
|
5
|
+
## Features
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* Search through the history of runs to inspect detailed results.
|
|
7
|
+
- **Build Memory Packs**: Create memory archives from recipe scripts
|
|
8
|
+
- **Export Data**: Extract JSON objects from memory packs using mappings
|
|
9
|
+
- **Gzip Compression**: Optionally compress output files
|
|
10
|
+
- **Custom Variables**: Pass variables to recipe scripts via command line
|
|
13
11
|
|
|
14
12
|
## Requirements
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
Node.js version 18 or higher is required.
|
|
17
15
|
|
|
18
16
|
## Installation
|
|
19
17
|
|
|
20
18
|
```bash
|
|
21
|
-
npm -g
|
|
19
|
+
npm install -g @vertesia/memory-cli
|
|
20
|
+
# or
|
|
21
|
+
pnpm add -g @vertesia/memory-cli
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Build a Memory Pack
|
|
27
|
+
|
|
28
|
+
Build a memory pack from a recipe script:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
memo build <recipe>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### Options
|
|
35
|
+
|
|
36
|
+
| Option | Description |
|
|
37
|
+
|--------|-------------|
|
|
38
|
+
| `-o, --out <file>` | Output file (default: `memory.tar`) |
|
|
39
|
+
| `-z, --gzip` | Compress output with gzip |
|
|
40
|
+
| `-i, --indent <spaces>` | JSON indentation (default: 2) |
|
|
41
|
+
| `-q, --quiet` | Suppress console output |
|
|
42
|
+
| `-t, --test` | Test recipe without building |
|
|
43
|
+
|
|
44
|
+
#### Passing Variables
|
|
45
|
+
|
|
46
|
+
Pass custom variables to your recipe script using `--var-<name>`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
memo build recipe.ts --var-version 1.0.0 --var-env production
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Variables are available in your recipe script via the `vars` object.
|
|
53
|
+
|
|
54
|
+
### Export from Memory Pack
|
|
55
|
+
|
|
56
|
+
Export a JSON object from a memory pack using a mapping:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
memo export <pack> --map <mapping>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### Examples
|
|
25
63
|
|
|
26
64
|
```bash
|
|
27
|
-
|
|
65
|
+
# Export with inline JSON mapping
|
|
66
|
+
memo export memory.tar --map '{"title": "$.metadata.title", "content": "$.files[0].content"}'
|
|
67
|
+
|
|
68
|
+
# Export with mapping file
|
|
69
|
+
memo export memory.tar --map @mapping.json
|
|
70
|
+
|
|
71
|
+
# Export with custom indentation
|
|
72
|
+
memo export memory.tar --map @mapping.json --indent 4
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Recipe Scripts
|
|
76
|
+
|
|
77
|
+
Recipe scripts are TypeScript files that define how to build a memory pack. They use the `@vertesia/memory` API to collect and structure data.
|
|
78
|
+
|
|
79
|
+
Example recipe (`recipe.ts`):
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { MemoryBuilder } from '@vertesia/memory';
|
|
83
|
+
|
|
84
|
+
const builder = new MemoryBuilder();
|
|
85
|
+
|
|
86
|
+
// Add files, metadata, and structured data
|
|
87
|
+
builder.addFile('README.md', readFileSync('README.md'));
|
|
88
|
+
builder.setMetadata({ version: vars.version });
|
|
89
|
+
|
|
90
|
+
export default builder;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## API
|
|
94
|
+
|
|
95
|
+
The CLI can also be used programmatically:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { setupMemoCommand } from '@vertesia/memory-cli';
|
|
99
|
+
import { Command } from 'commander';
|
|
100
|
+
|
|
101
|
+
const program = new Command();
|
|
102
|
+
setupMemoCommand(program);
|
|
103
|
+
program.parse();
|
|
28
104
|
```
|
|
29
105
|
|
|
30
106
|
## Documentation
|
|
31
107
|
|
|
32
|
-
See https://docs.
|
|
108
|
+
See [Vertesia Documentation](https://docs.vertesiahq.com)
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/memory-cli",
|
|
3
3
|
"description": "Vertesia memory builder CLI",
|
|
4
|
-
"version": "0.80.0
|
|
4
|
+
"version": "0.80.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"memo": "./bin/memo.js"
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
16
|
"homepage": "https://docs.vertesiahq.com",
|
|
17
17
|
"keywords": [
|
|
18
|
+
"vertesia",
|
|
19
|
+
"memory",
|
|
20
|
+
"cli",
|
|
18
21
|
"llm",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"composable",
|
|
23
|
-
"prompt",
|
|
24
|
-
"ai"
|
|
22
|
+
"ai",
|
|
23
|
+
"context",
|
|
24
|
+
"typescript"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"commander": "^12.1.0",
|
|
28
|
-
"@vertesia/memory": "0.80.0
|
|
29
|
-
"@vertesia/memory-commands": "0.80.0
|
|
28
|
+
"@vertesia/memory": "0.80.0",
|
|
29
|
+
"@vertesia/memory-commands": "0.80.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.5.1",
|