mindsim 0.1.0 → 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/README.md +138 -5
- package/dist/cli.js +360 -4
- package/dist/cli.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +3 -3
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/cli.ts +369 -5
- package/src/version.ts +3 -5
- package/tests/version.test.ts +1 -3
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<br/>
|
|
2
2
|
<br/>
|
|
3
3
|
<div align="center">
|
|
4
|
-
|
|
4
|
+
<a href="https://mindsim.com/">
|
|
5
|
+
<img style="display: block; width: 250px;" src="assets/mindsim-logo.svg"/>
|
|
6
|
+
</a>
|
|
5
7
|
</div>
|
|
6
8
|
<br/>
|
|
7
9
|
<br/>
|
|
@@ -21,7 +23,7 @@ Pre-requisites before installation
|
|
|
21
23
|
|
|
22
24
|
### Install with NPM
|
|
23
25
|
```
|
|
24
|
-
npm install -g
|
|
26
|
+
npm install -g mindsim
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
|
|
@@ -66,7 +68,7 @@ const mindsim = MindSim(apiKey);
|
|
|
66
68
|
The following example shows how you can use the mindsim SDK to create a mind:
|
|
67
69
|
|
|
68
70
|
```typescript
|
|
69
|
-
import { MindSim } from "
|
|
71
|
+
import { MindSim } from "mindsim";
|
|
70
72
|
import fs from "node:fs";
|
|
71
73
|
import path from "node:path";
|
|
72
74
|
|
|
@@ -128,7 +130,7 @@ main();
|
|
|
128
130
|
When MindSim has finished building your mind, you can run simulations on your mind:
|
|
129
131
|
|
|
130
132
|
```typescript
|
|
131
|
-
import { MindSim } from "
|
|
133
|
+
import { MindSim } from "mindsim";
|
|
132
134
|
|
|
133
135
|
const main = async () => {
|
|
134
136
|
const mindsim = new MindSim(process.env.MINDSIM_API_KEY);
|
|
@@ -742,7 +744,138 @@ To get the best simulation results, the following best practices are recommended
|
|
|
742
744
|
- Business constraints
|
|
743
745
|
- Historical context
|
|
744
746
|
|
|
747
|
+
|
|
748
|
+
## 💻 CLI Usage
|
|
749
|
+
|
|
750
|
+
The MindSim CLI allows you to manage resources directly from your terminal without writing code. This is useful for administrative tasks, testing, and quick lookups.
|
|
751
|
+
|
|
752
|
+
Ensure you are authenticated via `mindsim auth` or have `MINDSIM_API_KEY` set in your environment before running these commands.
|
|
753
|
+
|
|
754
|
+
### Minds
|
|
755
|
+
|
|
756
|
+
Manage the digital minds (profiles).
|
|
757
|
+
|
|
758
|
+
**List Minds**
|
|
759
|
+
```bash
|
|
760
|
+
# List all minds
|
|
761
|
+
mindsim minds list
|
|
762
|
+
|
|
763
|
+
# List minds filtered by tags
|
|
764
|
+
mindsim minds list --tags developer,leader
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
**Create a Mind**
|
|
768
|
+
```bash
|
|
769
|
+
mindsim minds create -n "Bobby Tables" -e "bobby@example.com" --tags developer
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
**Get Mind Details**
|
|
773
|
+
```bash
|
|
774
|
+
mindsim minds get <mind-id>
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
**Search Minds**
|
|
778
|
+
```bash
|
|
779
|
+
mindsim minds search "bobby@example.com"
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
**Update a Mind**
|
|
783
|
+
```bash
|
|
784
|
+
mindsim minds update <mind-id> --name "Robert Tables" --tags senior-dev
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
**Set Tags (Replace)**
|
|
788
|
+
```bash
|
|
789
|
+
# Replaces all existing tags with the new list
|
|
790
|
+
mindsim minds set-tags <mind-id> --tags hero,survivor
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
**Delete a Mind**
|
|
794
|
+
```bash
|
|
795
|
+
mindsim minds delete <mind-id>
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
### Snapshots
|
|
799
|
+
|
|
800
|
+
Upload training data and check processing status.
|
|
801
|
+
|
|
802
|
+
**List Snapshots**
|
|
803
|
+
```bash
|
|
804
|
+
mindsim snapshots list <mind-id>
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
**Create Snapshot (Upload File)**
|
|
808
|
+
```bash
|
|
809
|
+
# Upload a transcript or document
|
|
810
|
+
mindsim snapshots create <mind-id> --file ./data/transcript.vtt --date 2023-11-01
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
**Check Status**
|
|
814
|
+
```bash
|
|
815
|
+
mindsim snapshots status <mind-id> <snapshot-id>
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
### Simulations
|
|
819
|
+
|
|
820
|
+
Run simulations and view history.
|
|
821
|
+
|
|
822
|
+
**Run Simulation**
|
|
823
|
+
```bash
|
|
824
|
+
# Run and wait for response
|
|
825
|
+
mindsim simulations run <mind-id> --message "How would you handle a production outage?"
|
|
826
|
+
|
|
827
|
+
# Run in background (returns immediately)
|
|
828
|
+
mindsim simulations run <mind-id> --message "Analyze this text" --background
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
**List History**
|
|
832
|
+
```bash
|
|
833
|
+
mindsim simulations list --limit 10 --offset 0
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
**Get Simulation Details**
|
|
837
|
+
```bash
|
|
838
|
+
mindsim simulations get <simulation-id>
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
**Delete Simulation**
|
|
842
|
+
```bash
|
|
843
|
+
mindsim simulations delete <simulation-id>
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
### Tags
|
|
847
|
+
|
|
848
|
+
Manage categorization tags used to organize minds.
|
|
849
|
+
|
|
850
|
+
**List Tags**
|
|
851
|
+
```bash
|
|
852
|
+
mindsim tags list
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
**Update a Tag**
|
|
856
|
+
```bash
|
|
857
|
+
mindsim tags update <tag-id> --name "new-tag-name"
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
**Delete a Tag**
|
|
861
|
+
```bash
|
|
862
|
+
mindsim tags delete <tag-id>
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
### Psychometrics
|
|
866
|
+
|
|
867
|
+
Retrieve personality analysis and dimensional data derived from a specific snapshot.
|
|
868
|
+
|
|
869
|
+
**Get Psychometrics**
|
|
870
|
+
```bash
|
|
871
|
+
mindsim psychometrics get <snapshot-id>
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
|
|
745
875
|
<br>
|
|
746
876
|
<div align="center">
|
|
747
|
-
<
|
|
877
|
+
<a href="https://mindsim.com/">
|
|
878
|
+
<img style="display: block; margin: auto;" src="assets/mindsim-logo.svg"/>
|
|
879
|
+
</a>
|
|
748
880
|
</div>
|
|
881
|
+
|
package/dist/cli.js
CHANGED
|
@@ -1,21 +1,61 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
4
9
|
const commander_1 = require("commander");
|
|
5
10
|
const auth_1 = require("./auth");
|
|
11
|
+
const index_1 = require("./index");
|
|
6
12
|
const version_1 = require("./version");
|
|
7
13
|
const program = new commander_1.Command();
|
|
14
|
+
/**
|
|
15
|
+
* Helper to instantiate the SDK or fail gracefully if not authenticated
|
|
16
|
+
*/
|
|
17
|
+
const getSDK = () => {
|
|
18
|
+
try {
|
|
19
|
+
return new index_1.MindSim();
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error("❌ Authentication required.");
|
|
23
|
+
console.error("Please run 'mindsim auth' or set MINDSIM_API_KEY environment variable.");
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Helper to print JSON output
|
|
29
|
+
*/
|
|
30
|
+
const printOutput = (data) => {
|
|
31
|
+
console.log(JSON.stringify(data, null, 2));
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Helper to handle errors uniformly
|
|
35
|
+
*/
|
|
36
|
+
const handleError = (error) => {
|
|
37
|
+
if (error.response) {
|
|
38
|
+
// Axios error
|
|
39
|
+
console.error(`❌ API Error (${error.response.status}):`);
|
|
40
|
+
console.error(JSON.stringify(error.response.data, null, 2));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
console.error("❌ Error:", error.message || error);
|
|
44
|
+
}
|
|
45
|
+
process.exit(1);
|
|
46
|
+
};
|
|
8
47
|
const main = async () => {
|
|
9
|
-
program.name("mindsim").description("CLI for Mindsim SDK").version((0, version_1.getPackageVersion)());
|
|
48
|
+
program.name("mindsim").description("CLI for Mindsim SDK").version((0, version_1.getPackageVersion)());
|
|
49
|
+
// ==========================================
|
|
50
|
+
// CORE COMMANDS
|
|
51
|
+
// ==========================================
|
|
10
52
|
program
|
|
11
53
|
.command("version")
|
|
12
54
|
.description("Output your current MindSim CLI version and check for updates")
|
|
13
55
|
.action(async () => {
|
|
14
|
-
// When explicitly asking for version, be verbose about update status
|
|
15
56
|
console.log((0, version_1.getPackageVersion)());
|
|
16
57
|
await (0, version_1.checkForUpdates)(true);
|
|
17
58
|
});
|
|
18
|
-
// The Auth Command
|
|
19
59
|
program
|
|
20
60
|
.command("auth")
|
|
21
61
|
.description("Login to Mindsim via browser")
|
|
@@ -23,13 +63,329 @@ const main = async () => {
|
|
|
23
63
|
await (0, version_1.checkForUpdates)(false);
|
|
24
64
|
await (0, auth_1.login)();
|
|
25
65
|
});
|
|
26
|
-
// NEW: The Update Command
|
|
27
66
|
program
|
|
28
67
|
.command("update")
|
|
29
68
|
.description("Auto-update the MindSim SDK to the latest version")
|
|
30
69
|
.action(async () => {
|
|
31
70
|
await (0, version_1.updateSdk)();
|
|
32
71
|
});
|
|
72
|
+
// ==========================================
|
|
73
|
+
// MINDS RESOURCES
|
|
74
|
+
// ==========================================
|
|
75
|
+
const minds = program.command("minds").description("Manage digital minds");
|
|
76
|
+
minds
|
|
77
|
+
.command("list")
|
|
78
|
+
.description("List all minds")
|
|
79
|
+
.option("-t, --tags <tags>", "Comma-separated list of tags to filter by")
|
|
80
|
+
.action(async (options) => {
|
|
81
|
+
try {
|
|
82
|
+
const client = getSDK();
|
|
83
|
+
const tagList = options.tags ? options.tags.split(",") : undefined;
|
|
84
|
+
const result = await client.minds.list({ tags: tagList });
|
|
85
|
+
printOutput(result);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
handleError(err);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
minds
|
|
92
|
+
.command("get")
|
|
93
|
+
.description("Get details of a specific mind")
|
|
94
|
+
.argument("<mindId>", "ID of the mind")
|
|
95
|
+
.action(async (mindId) => {
|
|
96
|
+
try {
|
|
97
|
+
const client = getSDK();
|
|
98
|
+
const result = await client.minds.get(mindId);
|
|
99
|
+
printOutput(result);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
handleError(err);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
minds
|
|
106
|
+
.command("create")
|
|
107
|
+
.description("Create a new mind")
|
|
108
|
+
.requiredOption("-n, --name <name>", "Name of the mind")
|
|
109
|
+
.option("-e, --email <email>", "Email associated with the mind")
|
|
110
|
+
.option("-t, --tags <tags>", "Comma-separated list of tags")
|
|
111
|
+
.action(async (options) => {
|
|
112
|
+
try {
|
|
113
|
+
const client = getSDK();
|
|
114
|
+
const tagList = options.tags ? options.tags.split(",") : undefined;
|
|
115
|
+
const result = await client.minds.create({
|
|
116
|
+
name: options.name,
|
|
117
|
+
email: options.email,
|
|
118
|
+
tags: tagList,
|
|
119
|
+
});
|
|
120
|
+
printOutput(result);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
handleError(err);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
minds
|
|
127
|
+
.command("update")
|
|
128
|
+
.description("Update an existing mind")
|
|
129
|
+
.argument("<mindId>", "ID of the mind to update")
|
|
130
|
+
.option("-n, --name <name>", "New name")
|
|
131
|
+
.option("-e, --email <email>", "New email")
|
|
132
|
+
.option("-t, --tags <tags>", "New comma-separated list of tags (replaces existing)")
|
|
133
|
+
.action(async (mindId, options) => {
|
|
134
|
+
try {
|
|
135
|
+
const client = getSDK();
|
|
136
|
+
const tagList = options.tags ? options.tags.split(",") : undefined;
|
|
137
|
+
const result = await client.minds.update(mindId, {
|
|
138
|
+
name: options.name,
|
|
139
|
+
email: options.email,
|
|
140
|
+
tags: tagList,
|
|
141
|
+
});
|
|
142
|
+
printOutput(result);
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
handleError(err);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
minds
|
|
149
|
+
.command("delete")
|
|
150
|
+
.description("Delete a mind")
|
|
151
|
+
.argument("<mindId>", "ID of the mind to delete")
|
|
152
|
+
.action(async (mindId) => {
|
|
153
|
+
try {
|
|
154
|
+
const client = getSDK();
|
|
155
|
+
const result = await client.minds.delete(mindId);
|
|
156
|
+
printOutput(result);
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
handleError(err);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
minds
|
|
163
|
+
.command("search")
|
|
164
|
+
.description("Search for minds by query string")
|
|
165
|
+
.argument("<query>", "Search query (e.g., email or name)")
|
|
166
|
+
.action(async (query) => {
|
|
167
|
+
try {
|
|
168
|
+
const client = getSDK();
|
|
169
|
+
const result = await client.minds.search({ query });
|
|
170
|
+
printOutput(result);
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
handleError(err);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
minds
|
|
177
|
+
.command("set-tags")
|
|
178
|
+
.description("Replace tags for a specific mind")
|
|
179
|
+
.argument("<mindId>", "ID of the mind")
|
|
180
|
+
.requiredOption("-t, --tags <tags>", "Comma-separated list of tags")
|
|
181
|
+
.action(async (mindId, options) => {
|
|
182
|
+
try {
|
|
183
|
+
const client = getSDK();
|
|
184
|
+
const tagList = options.tags ? options.tags.split(",") : [];
|
|
185
|
+
const result = await client.minds.setTags(mindId, { tags: tagList });
|
|
186
|
+
printOutput(result);
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
handleError(err);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
// ==========================================
|
|
193
|
+
// SNAPSHOTS RESOURCES
|
|
194
|
+
// ==========================================
|
|
195
|
+
const snapshots = program.command("snapshots").description("Manage mind snapshots/training data");
|
|
196
|
+
snapshots
|
|
197
|
+
.command("list")
|
|
198
|
+
.description("List snapshots for a specific mind")
|
|
199
|
+
.argument("<mindId>", "ID of the mind")
|
|
200
|
+
.action(async (mindId) => {
|
|
201
|
+
try {
|
|
202
|
+
const client = getSDK();
|
|
203
|
+
const result = await client.snapshots.list(mindId);
|
|
204
|
+
printOutput(result);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
handleError(err);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
snapshots
|
|
211
|
+
.command("create")
|
|
212
|
+
.description("Upload a file to create a snapshot")
|
|
213
|
+
.argument("<mindId>", "ID of the mind")
|
|
214
|
+
.requiredOption("-f, --file <path>", "Path to the file (pdf, vtt, txt, etc.)")
|
|
215
|
+
.option("-d, --date <date>", "Mindset date (YYYY-MM-DD)")
|
|
216
|
+
.action(async (mindId, options) => {
|
|
217
|
+
try {
|
|
218
|
+
const client = getSDK();
|
|
219
|
+
const filePath = node_path_1.default.resolve(options.file);
|
|
220
|
+
if (!node_fs_1.default.existsSync(filePath)) {
|
|
221
|
+
throw new Error(`File not found: ${filePath}`);
|
|
222
|
+
}
|
|
223
|
+
const fileName = node_path_1.default.basename(filePath);
|
|
224
|
+
const fileBuffer = node_fs_1.default.readFileSync(filePath);
|
|
225
|
+
console.log(`Uploading ${fileName}...`);
|
|
226
|
+
const result = await client.snapshots.create(mindId, {
|
|
227
|
+
file: fileBuffer,
|
|
228
|
+
fileName: fileName,
|
|
229
|
+
mindsetDate: options.date,
|
|
230
|
+
contentType: "", // Let SDK infer from fileName extension
|
|
231
|
+
});
|
|
232
|
+
printOutput(result);
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
handleError(err);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
snapshots
|
|
239
|
+
.command("status")
|
|
240
|
+
.description("Check the processing status of a snapshot")
|
|
241
|
+
.argument("<mindId>", "ID of the mind")
|
|
242
|
+
.argument("<snapshotId>", "ID of the snapshot (mindAssessmentId)")
|
|
243
|
+
.action(async (mindId, snapshotId) => {
|
|
244
|
+
try {
|
|
245
|
+
const client = getSDK();
|
|
246
|
+
const result = await client.snapshots.getStatus(mindId, snapshotId);
|
|
247
|
+
printOutput(result);
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
handleError(err);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
// ==========================================
|
|
254
|
+
// SIMULATIONS RESOURCES
|
|
255
|
+
// ==========================================
|
|
256
|
+
const simulations = program.command("simulations").description("Run and manage simulations");
|
|
257
|
+
simulations
|
|
258
|
+
.command("run")
|
|
259
|
+
.description("Run a simulation against a mind")
|
|
260
|
+
.argument("<mindId>", "ID of the mind")
|
|
261
|
+
.requiredOption("-m, --message <message>", "The scenario/prompt message")
|
|
262
|
+
.option("-b, --background", "Run in background (async)", false)
|
|
263
|
+
.action(async (mindId, options) => {
|
|
264
|
+
try {
|
|
265
|
+
const client = getSDK();
|
|
266
|
+
const result = await client.simulations.run({
|
|
267
|
+
mindId,
|
|
268
|
+
scenario: {
|
|
269
|
+
message: options.message,
|
|
270
|
+
},
|
|
271
|
+
runInBackground: options.background,
|
|
272
|
+
});
|
|
273
|
+
printOutput(result);
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
handleError(err);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
simulations
|
|
280
|
+
.command("list")
|
|
281
|
+
.description("List simulation history")
|
|
282
|
+
.option("-l, --limit <number>", "Number of items to return", "20")
|
|
283
|
+
.option("-o, --offset <number>", "Pagination offset", "0")
|
|
284
|
+
.action(async (options) => {
|
|
285
|
+
try {
|
|
286
|
+
const client = getSDK();
|
|
287
|
+
const result = await client.simulations.list({
|
|
288
|
+
limit: Number.parseInt(options.limit, 10),
|
|
289
|
+
offset: Number.parseInt(options.offset, 10),
|
|
290
|
+
});
|
|
291
|
+
printOutput(result);
|
|
292
|
+
}
|
|
293
|
+
catch (err) {
|
|
294
|
+
handleError(err);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
simulations
|
|
298
|
+
.command("get")
|
|
299
|
+
.description("Get full details of a simulation")
|
|
300
|
+
.argument("<simulationId>", "ID of the simulation")
|
|
301
|
+
.action(async (simulationId) => {
|
|
302
|
+
try {
|
|
303
|
+
const client = getSDK();
|
|
304
|
+
const result = await client.simulations.get(simulationId);
|
|
305
|
+
printOutput(result);
|
|
306
|
+
}
|
|
307
|
+
catch (err) {
|
|
308
|
+
handleError(err);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
simulations
|
|
312
|
+
.command("delete")
|
|
313
|
+
.description("Delete a simulation record")
|
|
314
|
+
.argument("<simulationId>", "ID of the simulation")
|
|
315
|
+
.action(async (simulationId) => {
|
|
316
|
+
try {
|
|
317
|
+
const client = getSDK();
|
|
318
|
+
const result = await client.simulations.delete(simulationId);
|
|
319
|
+
printOutput(result);
|
|
320
|
+
}
|
|
321
|
+
catch (err) {
|
|
322
|
+
handleError(err);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
// ==========================================
|
|
326
|
+
// TAGS RESOURCES
|
|
327
|
+
// ==========================================
|
|
328
|
+
const tags = program.command("tags").description("Manage tags");
|
|
329
|
+
tags
|
|
330
|
+
.command("list")
|
|
331
|
+
.description("List all available tags")
|
|
332
|
+
.action(async () => {
|
|
333
|
+
try {
|
|
334
|
+
const client = getSDK();
|
|
335
|
+
const result = await client.tags.list();
|
|
336
|
+
printOutput(result);
|
|
337
|
+
}
|
|
338
|
+
catch (err) {
|
|
339
|
+
handleError(err);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
tags
|
|
343
|
+
.command("update")
|
|
344
|
+
.description("Update a tag name")
|
|
345
|
+
.argument("<tagId>", "ID of the tag")
|
|
346
|
+
.requiredOption("-n, --name <name>", "New name for the tag")
|
|
347
|
+
.action(async (tagId, options) => {
|
|
348
|
+
try {
|
|
349
|
+
const client = getSDK();
|
|
350
|
+
const result = await client.tags.update(tagId, { name: options.name });
|
|
351
|
+
printOutput(result);
|
|
352
|
+
}
|
|
353
|
+
catch (err) {
|
|
354
|
+
handleError(err);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
tags
|
|
358
|
+
.command("delete")
|
|
359
|
+
.description("Delete a tag")
|
|
360
|
+
.argument("<tagId>", "ID of the tag")
|
|
361
|
+
.action(async (tagId) => {
|
|
362
|
+
try {
|
|
363
|
+
const client = getSDK();
|
|
364
|
+
const result = await client.tags.delete(tagId);
|
|
365
|
+
printOutput(result);
|
|
366
|
+
}
|
|
367
|
+
catch (err) {
|
|
368
|
+
handleError(err);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
// ==========================================
|
|
372
|
+
// PSYCHOMETRICS RESOURCES
|
|
373
|
+
// ==========================================
|
|
374
|
+
const psychometrics = program.command("psychometrics").description("Retrieve psychometric data");
|
|
375
|
+
psychometrics
|
|
376
|
+
.command("get")
|
|
377
|
+
.description("Get psychometrics for a specific snapshot")
|
|
378
|
+
.argument("<snapshotId>", "ID of the snapshot")
|
|
379
|
+
.action(async (snapshotId) => {
|
|
380
|
+
try {
|
|
381
|
+
const client = getSDK();
|
|
382
|
+
const result = await client.psychometrics.get(snapshotId);
|
|
383
|
+
printOutput(result);
|
|
384
|
+
}
|
|
385
|
+
catch (err) {
|
|
386
|
+
handleError(err);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
33
389
|
program.parse(process.argv);
|
|
34
390
|
};
|
|
35
391
|
main();
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,iCAA+B;AAC/B,uCAA0E;AAE1E,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,IAAA,2BAAiB,GAAE,CAAC,CAAC,CAAC,6BAA6B;IAEtH,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,+DAA+D,CAAC;SAC5E,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,qEAAqE;QACrE,OAAO,CAAC,GAAG,CAAC,IAAA,2BAAiB,GAAE,CAAC,CAAC;QACjC,MAAM,IAAA,yBAAe,EAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEL,mBAAmB;IACnB,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,8BAA8B,CAAC;SAC3C,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,IAAA,yBAAe,EAAC,KAAK,CAAC,CAAC;QAC7B,MAAM,IAAA,YAAK,GAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEL,0BAA0B;IAC1B,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,mDAAm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,WAAW,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC"}
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAU,iBAAe,KAAG,OAAO,CAAC,IAAI,CAiCnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,QAAa,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAU,iBAAe,KAAG,OAAO,CAAC,IAAI,CAiCnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,QAAa,OAAO,CAAC,IAAI,CA2B9C,CAAC"}
|
package/dist/version.js
CHANGED
|
@@ -11,7 +11,7 @@ const node_util_1 = require("node:util");
|
|
|
11
11
|
const axios_1 = __importDefault(require("axios"));
|
|
12
12
|
const semver_1 = __importDefault(require("semver"));
|
|
13
13
|
const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
14
|
-
const PACKAGE_NAME = "
|
|
14
|
+
const PACKAGE_NAME = "mindsim";
|
|
15
15
|
const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}`;
|
|
16
16
|
/**
|
|
17
17
|
* REUSABLE VERSION EXTRACTOR
|
|
@@ -53,7 +53,7 @@ const checkForUpdates = async (verbose = false) => {
|
|
|
53
53
|
if (semver_1.default.gt(latestVersion, currentVersion)) {
|
|
54
54
|
const changelogUrl = `https://www.npmjs.com/package/${PACKAGE_NAME}/v/${latestVersion}`;
|
|
55
55
|
console.warn("\n" + "=".repeat(60));
|
|
56
|
-
console.warn(`⚠️ UPDATE AVAILABLE:
|
|
56
|
+
console.warn(`⚠️ UPDATE AVAILABLE: mindsim`);
|
|
57
57
|
console.warn("=".repeat(60));
|
|
58
58
|
console.warn(` Current Version: ${currentVersion}`);
|
|
59
59
|
console.warn(` Latest Version: ${latestVersion}`);
|
|
@@ -98,7 +98,7 @@ const updateSdk = async () => {
|
|
|
98
98
|
if (error instanceof Error) {
|
|
99
99
|
console.error(error.message);
|
|
100
100
|
}
|
|
101
|
-
console.error("Please try running manually: npm install
|
|
101
|
+
console.error("Please try running manually: npm install mindsim@latest");
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
exports.updateSdk = updateSdk;
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA0C;AAC1C,sDAAyB;AACzB,0DAA6B;AAC7B,yCAAsC;AACtC,kDAA0B;AAC1B,oDAA4B;AAE5B,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,yBAAI,CAAC,CAAC;AAElC,MAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA0C;AAC1C,sDAAyB;AACzB,0DAA6B;AAC7B,yCAAsC;AACtC,kDAA0B;AAC1B,oDAA4B;AAE5B,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,yBAAI,CAAC,CAAC;AAElC,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,YAAY,GAAG,8BAA8B,YA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": "The official MindSim typescript SDK allows you to programmatically create digital minds, populate them with conversational data, and run powerful simulations to get an accurate preview of how the person will think, feel, say, and act in any scenario.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -52,4 +52,4 @@
|
|
|
52
52
|
"open": "^11.0.0",
|
|
53
53
|
"semver": "^7.6.0"
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
package/src/cli.ts
CHANGED
|
@@ -1,24 +1,63 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { Command, Option } from "commander";
|
|
4
6
|
import { login } from "./auth";
|
|
7
|
+
import { MindSim } from "./index";
|
|
5
8
|
import { checkForUpdates, getPackageVersion, updateSdk } from "./version";
|
|
6
9
|
|
|
7
10
|
const program = new Command();
|
|
8
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Helper to instantiate the SDK or fail gracefully if not authenticated
|
|
14
|
+
*/
|
|
15
|
+
const getSDK = () => {
|
|
16
|
+
try {
|
|
17
|
+
return new MindSim();
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error("❌ Authentication required.");
|
|
20
|
+
console.error("Please run 'mindsim auth' or set MINDSIM_API_KEY environment variable.");
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Helper to print JSON output
|
|
27
|
+
*/
|
|
28
|
+
const printOutput = (data: any) => {
|
|
29
|
+
console.log(JSON.stringify(data, null, 2));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Helper to handle errors uniformly
|
|
34
|
+
*/
|
|
35
|
+
const handleError = (error: any) => {
|
|
36
|
+
if (error.response) {
|
|
37
|
+
// Axios error
|
|
38
|
+
console.error(`❌ API Error (${error.response.status}):`);
|
|
39
|
+
console.error(JSON.stringify(error.response.data, null, 2));
|
|
40
|
+
} else {
|
|
41
|
+
console.error("❌ Error:", error.message || error);
|
|
42
|
+
}
|
|
43
|
+
process.exit(1);
|
|
44
|
+
};
|
|
45
|
+
|
|
9
46
|
const main = async () => {
|
|
10
|
-
program.name("mindsim").description("CLI for Mindsim SDK").version(getPackageVersion());
|
|
47
|
+
program.name("mindsim").description("CLI for Mindsim SDK").version(getPackageVersion());
|
|
48
|
+
|
|
49
|
+
// ==========================================
|
|
50
|
+
// CORE COMMANDS
|
|
51
|
+
// ==========================================
|
|
11
52
|
|
|
12
53
|
program
|
|
13
54
|
.command("version")
|
|
14
55
|
.description("Output your current MindSim CLI version and check for updates")
|
|
15
56
|
.action(async () => {
|
|
16
|
-
// When explicitly asking for version, be verbose about update status
|
|
17
57
|
console.log(getPackageVersion());
|
|
18
58
|
await checkForUpdates(true);
|
|
19
59
|
});
|
|
20
60
|
|
|
21
|
-
// The Auth Command
|
|
22
61
|
program
|
|
23
62
|
.command("auth")
|
|
24
63
|
.description("Login to Mindsim via browser")
|
|
@@ -27,7 +66,6 @@ const main = async () => {
|
|
|
27
66
|
await login();
|
|
28
67
|
});
|
|
29
68
|
|
|
30
|
-
// NEW: The Update Command
|
|
31
69
|
program
|
|
32
70
|
.command("update")
|
|
33
71
|
.description("Auto-update the MindSim SDK to the latest version")
|
|
@@ -35,6 +73,332 @@ const main = async () => {
|
|
|
35
73
|
await updateSdk();
|
|
36
74
|
});
|
|
37
75
|
|
|
76
|
+
// ==========================================
|
|
77
|
+
// MINDS RESOURCES
|
|
78
|
+
// ==========================================
|
|
79
|
+
const minds = program.command("minds").description("Manage digital minds");
|
|
80
|
+
|
|
81
|
+
minds
|
|
82
|
+
.command("list")
|
|
83
|
+
.description("List all minds")
|
|
84
|
+
.option("-t, --tags <tags>", "Comma-separated list of tags to filter by")
|
|
85
|
+
.action(async (options) => {
|
|
86
|
+
try {
|
|
87
|
+
const client = getSDK();
|
|
88
|
+
const tagList = options.tags ? options.tags.split(",") : undefined;
|
|
89
|
+
const result = await client.minds.list({ tags: tagList });
|
|
90
|
+
printOutput(result);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
handleError(err);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
minds
|
|
97
|
+
.command("get")
|
|
98
|
+
.description("Get details of a specific mind")
|
|
99
|
+
.argument("<mindId>", "ID of the mind")
|
|
100
|
+
.action(async (mindId) => {
|
|
101
|
+
try {
|
|
102
|
+
const client = getSDK();
|
|
103
|
+
const result = await client.minds.get(mindId);
|
|
104
|
+
printOutput(result);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
handleError(err);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
minds
|
|
111
|
+
.command("create")
|
|
112
|
+
.description("Create a new mind")
|
|
113
|
+
.requiredOption("-n, --name <name>", "Name of the mind")
|
|
114
|
+
.option("-e, --email <email>", "Email associated with the mind")
|
|
115
|
+
.option("-t, --tags <tags>", "Comma-separated list of tags")
|
|
116
|
+
.action(async (options) => {
|
|
117
|
+
try {
|
|
118
|
+
const client = getSDK();
|
|
119
|
+
const tagList = options.tags ? options.tags.split(",") : undefined;
|
|
120
|
+
const result = await client.minds.create({
|
|
121
|
+
name: options.name,
|
|
122
|
+
email: options.email,
|
|
123
|
+
tags: tagList,
|
|
124
|
+
});
|
|
125
|
+
printOutput(result);
|
|
126
|
+
} catch (err) {
|
|
127
|
+
handleError(err);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
minds
|
|
132
|
+
.command("update")
|
|
133
|
+
.description("Update an existing mind")
|
|
134
|
+
.argument("<mindId>", "ID of the mind to update")
|
|
135
|
+
.option("-n, --name <name>", "New name")
|
|
136
|
+
.option("-e, --email <email>", "New email")
|
|
137
|
+
.option("-t, --tags <tags>", "New comma-separated list of tags (replaces existing)")
|
|
138
|
+
.action(async (mindId, options) => {
|
|
139
|
+
try {
|
|
140
|
+
const client = getSDK();
|
|
141
|
+
const tagList = options.tags ? options.tags.split(",") : undefined;
|
|
142
|
+
const result = await client.minds.update(mindId, {
|
|
143
|
+
name: options.name,
|
|
144
|
+
email: options.email,
|
|
145
|
+
tags: tagList,
|
|
146
|
+
});
|
|
147
|
+
printOutput(result);
|
|
148
|
+
} catch (err) {
|
|
149
|
+
handleError(err);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
minds
|
|
154
|
+
.command("delete")
|
|
155
|
+
.description("Delete a mind")
|
|
156
|
+
.argument("<mindId>", "ID of the mind to delete")
|
|
157
|
+
.action(async (mindId) => {
|
|
158
|
+
try {
|
|
159
|
+
const client = getSDK();
|
|
160
|
+
const result = await client.minds.delete(mindId);
|
|
161
|
+
printOutput(result);
|
|
162
|
+
} catch (err) {
|
|
163
|
+
handleError(err);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
minds
|
|
168
|
+
.command("search")
|
|
169
|
+
.description("Search for minds by query string")
|
|
170
|
+
.argument("<query>", "Search query (e.g., email or name)")
|
|
171
|
+
.action(async (query) => {
|
|
172
|
+
try {
|
|
173
|
+
const client = getSDK();
|
|
174
|
+
const result = await client.minds.search({ query });
|
|
175
|
+
printOutput(result);
|
|
176
|
+
} catch (err) {
|
|
177
|
+
handleError(err);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
minds
|
|
182
|
+
.command("set-tags")
|
|
183
|
+
.description("Replace tags for a specific mind")
|
|
184
|
+
.argument("<mindId>", "ID of the mind")
|
|
185
|
+
.requiredOption("-t, --tags <tags>", "Comma-separated list of tags")
|
|
186
|
+
.action(async (mindId, options) => {
|
|
187
|
+
try {
|
|
188
|
+
const client = getSDK();
|
|
189
|
+
const tagList = options.tags ? options.tags.split(",") : [];
|
|
190
|
+
const result = await client.minds.setTags(mindId, { tags: tagList });
|
|
191
|
+
printOutput(result);
|
|
192
|
+
} catch (err) {
|
|
193
|
+
handleError(err);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// ==========================================
|
|
198
|
+
// SNAPSHOTS RESOURCES
|
|
199
|
+
// ==========================================
|
|
200
|
+
const snapshots = program.command("snapshots").description("Manage mind snapshots/training data");
|
|
201
|
+
|
|
202
|
+
snapshots
|
|
203
|
+
.command("list")
|
|
204
|
+
.description("List snapshots for a specific mind")
|
|
205
|
+
.argument("<mindId>", "ID of the mind")
|
|
206
|
+
.action(async (mindId) => {
|
|
207
|
+
try {
|
|
208
|
+
const client = getSDK();
|
|
209
|
+
const result = await client.snapshots.list(mindId);
|
|
210
|
+
printOutput(result);
|
|
211
|
+
} catch (err) {
|
|
212
|
+
handleError(err);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
snapshots
|
|
217
|
+
.command("create")
|
|
218
|
+
.description("Upload a file to create a snapshot")
|
|
219
|
+
.argument("<mindId>", "ID of the mind")
|
|
220
|
+
.requiredOption("-f, --file <path>", "Path to the file (pdf, vtt, txt, etc.)")
|
|
221
|
+
.option("-d, --date <date>", "Mindset date (YYYY-MM-DD)")
|
|
222
|
+
.action(async (mindId, options) => {
|
|
223
|
+
try {
|
|
224
|
+
const client = getSDK();
|
|
225
|
+
const filePath = path.resolve(options.file);
|
|
226
|
+
|
|
227
|
+
if (!fs.existsSync(filePath)) {
|
|
228
|
+
throw new Error(`File not found: ${filePath}`);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const fileName = path.basename(filePath);
|
|
232
|
+
const fileBuffer = fs.readFileSync(filePath);
|
|
233
|
+
|
|
234
|
+
console.log(`Uploading ${fileName}...`);
|
|
235
|
+
|
|
236
|
+
const result = await client.snapshots.create(mindId, {
|
|
237
|
+
file: fileBuffer,
|
|
238
|
+
fileName: fileName,
|
|
239
|
+
mindsetDate: options.date,
|
|
240
|
+
contentType: "", // Let SDK infer from fileName extension
|
|
241
|
+
});
|
|
242
|
+
printOutput(result);
|
|
243
|
+
} catch (err) {
|
|
244
|
+
handleError(err);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
snapshots
|
|
249
|
+
.command("status")
|
|
250
|
+
.description("Check the processing status of a snapshot")
|
|
251
|
+
.argument("<mindId>", "ID of the mind")
|
|
252
|
+
.argument("<snapshotId>", "ID of the snapshot (mindAssessmentId)")
|
|
253
|
+
.action(async (mindId, snapshotId) => {
|
|
254
|
+
try {
|
|
255
|
+
const client = getSDK();
|
|
256
|
+
const result = await client.snapshots.getStatus(mindId, snapshotId);
|
|
257
|
+
printOutput(result);
|
|
258
|
+
} catch (err) {
|
|
259
|
+
handleError(err);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// ==========================================
|
|
264
|
+
// SIMULATIONS RESOURCES
|
|
265
|
+
// ==========================================
|
|
266
|
+
const simulations = program.command("simulations").description("Run and manage simulations");
|
|
267
|
+
|
|
268
|
+
simulations
|
|
269
|
+
.command("run")
|
|
270
|
+
.description("Run a simulation against a mind")
|
|
271
|
+
.argument("<mindId>", "ID of the mind")
|
|
272
|
+
.requiredOption("-m, --message <message>", "The scenario/prompt message")
|
|
273
|
+
.option("-b, --background", "Run in background (async)", false)
|
|
274
|
+
.action(async (mindId, options) => {
|
|
275
|
+
try {
|
|
276
|
+
const client = getSDK();
|
|
277
|
+
const result = await client.simulations.run({
|
|
278
|
+
mindId,
|
|
279
|
+
scenario: {
|
|
280
|
+
message: options.message,
|
|
281
|
+
},
|
|
282
|
+
runInBackground: options.background,
|
|
283
|
+
});
|
|
284
|
+
printOutput(result);
|
|
285
|
+
} catch (err) {
|
|
286
|
+
handleError(err);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
simulations
|
|
291
|
+
.command("list")
|
|
292
|
+
.description("List simulation history")
|
|
293
|
+
.option("-l, --limit <number>", "Number of items to return", "20")
|
|
294
|
+
.option("-o, --offset <number>", "Pagination offset", "0")
|
|
295
|
+
.action(async (options) => {
|
|
296
|
+
try {
|
|
297
|
+
const client = getSDK();
|
|
298
|
+
const result = await client.simulations.list({
|
|
299
|
+
limit: Number.parseInt(options.limit, 10),
|
|
300
|
+
offset: Number.parseInt(options.offset, 10),
|
|
301
|
+
});
|
|
302
|
+
printOutput(result);
|
|
303
|
+
} catch (err) {
|
|
304
|
+
handleError(err);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
simulations
|
|
309
|
+
.command("get")
|
|
310
|
+
.description("Get full details of a simulation")
|
|
311
|
+
.argument("<simulationId>", "ID of the simulation")
|
|
312
|
+
.action(async (simulationId) => {
|
|
313
|
+
try {
|
|
314
|
+
const client = getSDK();
|
|
315
|
+
const result = await client.simulations.get(simulationId);
|
|
316
|
+
printOutput(result);
|
|
317
|
+
} catch (err) {
|
|
318
|
+
handleError(err);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
simulations
|
|
323
|
+
.command("delete")
|
|
324
|
+
.description("Delete a simulation record")
|
|
325
|
+
.argument("<simulationId>", "ID of the simulation")
|
|
326
|
+
.action(async (simulationId) => {
|
|
327
|
+
try {
|
|
328
|
+
const client = getSDK();
|
|
329
|
+
const result = await client.simulations.delete(simulationId);
|
|
330
|
+
printOutput(result);
|
|
331
|
+
} catch (err) {
|
|
332
|
+
handleError(err);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// ==========================================
|
|
337
|
+
// TAGS RESOURCES
|
|
338
|
+
// ==========================================
|
|
339
|
+
const tags = program.command("tags").description("Manage tags");
|
|
340
|
+
|
|
341
|
+
tags
|
|
342
|
+
.command("list")
|
|
343
|
+
.description("List all available tags")
|
|
344
|
+
.action(async () => {
|
|
345
|
+
try {
|
|
346
|
+
const client = getSDK();
|
|
347
|
+
const result = await client.tags.list();
|
|
348
|
+
printOutput(result);
|
|
349
|
+
} catch (err) {
|
|
350
|
+
handleError(err);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
tags
|
|
355
|
+
.command("update")
|
|
356
|
+
.description("Update a tag name")
|
|
357
|
+
.argument("<tagId>", "ID of the tag")
|
|
358
|
+
.requiredOption("-n, --name <name>", "New name for the tag")
|
|
359
|
+
.action(async (tagId, options) => {
|
|
360
|
+
try {
|
|
361
|
+
const client = getSDK();
|
|
362
|
+
const result = await client.tags.update(tagId, { name: options.name });
|
|
363
|
+
printOutput(result);
|
|
364
|
+
} catch (err) {
|
|
365
|
+
handleError(err);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
tags
|
|
370
|
+
.command("delete")
|
|
371
|
+
.description("Delete a tag")
|
|
372
|
+
.argument("<tagId>", "ID of the tag")
|
|
373
|
+
.action(async (tagId) => {
|
|
374
|
+
try {
|
|
375
|
+
const client = getSDK();
|
|
376
|
+
const result = await client.tags.delete(tagId);
|
|
377
|
+
printOutput(result);
|
|
378
|
+
} catch (err) {
|
|
379
|
+
handleError(err);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
// ==========================================
|
|
384
|
+
// PSYCHOMETRICS RESOURCES
|
|
385
|
+
// ==========================================
|
|
386
|
+
const psychometrics = program.command("psychometrics").description("Retrieve psychometric data");
|
|
387
|
+
|
|
388
|
+
psychometrics
|
|
389
|
+
.command("get")
|
|
390
|
+
.description("Get psychometrics for a specific snapshot")
|
|
391
|
+
.argument("<snapshotId>", "ID of the snapshot")
|
|
392
|
+
.action(async (snapshotId) => {
|
|
393
|
+
try {
|
|
394
|
+
const client = getSDK();
|
|
395
|
+
const result = await client.psychometrics.get(snapshotId);
|
|
396
|
+
printOutput(result);
|
|
397
|
+
} catch (err) {
|
|
398
|
+
handleError(err);
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
|
|
38
402
|
program.parse(process.argv);
|
|
39
403
|
};
|
|
40
404
|
|
package/src/version.ts
CHANGED
|
@@ -7,7 +7,7 @@ import semver from "semver";
|
|
|
7
7
|
|
|
8
8
|
const execAsync = promisify(exec);
|
|
9
9
|
|
|
10
|
-
const PACKAGE_NAME = "
|
|
10
|
+
const PACKAGE_NAME = "mindsim";
|
|
11
11
|
const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}`;
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -54,7 +54,7 @@ export const checkForUpdates = async (verbose = false): Promise<void> => {
|
|
|
54
54
|
const changelogUrl = `https://www.npmjs.com/package/${PACKAGE_NAME}/v/${latestVersion}`;
|
|
55
55
|
|
|
56
56
|
console.warn("\n" + "=".repeat(60));
|
|
57
|
-
console.warn(`⚠️ UPDATE AVAILABLE:
|
|
57
|
+
console.warn(`⚠️ UPDATE AVAILABLE: mindsim`);
|
|
58
58
|
console.warn("=".repeat(60));
|
|
59
59
|
console.warn(` Current Version: ${currentVersion}`);
|
|
60
60
|
console.warn(` Latest Version: ${latestVersion}`);
|
|
@@ -104,8 +104,6 @@ export const updateSdk = async (): Promise<void> => {
|
|
|
104
104
|
if (error instanceof Error) {
|
|
105
105
|
console.error(error.message);
|
|
106
106
|
}
|
|
107
|
-
console.error(
|
|
108
|
-
"Please try running manually: npm install @mindsim/mindsim-sdk-typescript@latest",
|
|
109
|
-
);
|
|
107
|
+
console.error("Please try running manually: npm install mindsim@latest");
|
|
110
108
|
}
|
|
111
109
|
};
|
package/tests/version.test.ts
CHANGED
|
@@ -182,9 +182,7 @@ describe("Version Module", () => {
|
|
|
182
182
|
|
|
183
183
|
await updateSdk();
|
|
184
184
|
|
|
185
|
-
expect(mockExecAsync).toHaveBeenCalledWith(
|
|
186
|
-
"npm install @mindsim/mindsim-sdk-typescript@latest --save",
|
|
187
|
-
);
|
|
185
|
+
expect(mockExecAsync).toHaveBeenCalledWith("npm install mindsim@latest --save");
|
|
188
186
|
expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining("Update complete"));
|
|
189
187
|
});
|
|
190
188
|
|