@cognivia/cli 0.1.0 → 0.2.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 CHANGED
@@ -9,8 +9,14 @@ npm i -g @cognivia/cli
9
9
  cognivia diagnose --demo # bundled sample data, no key
10
10
  cognivia diagnose --input answers.json # your export
11
11
  cognivia memory-state <learnerId> # hosted API (needs COGNIVIA_API_KEY)
12
+ cognivia content items --input items.json # item -> misconception maps
13
+ cognivia content prerequisites --input pre.json # concept -> prerequisite maps
12
14
  ```
13
15
 
16
+ `content` maps sharpen `diagnose` on your own items and concepts; they need a
17
+ self-serve live key. `items.json`: `[{ item_ref, distractors: { "wrong option": "misconception" } }]`.
18
+ `pre.json`: `[{ concept, requires: ["prerequisite concept"] }]`.
19
+
14
20
  With `COGNIVIA_API_KEY` set it calls the hosted API; otherwise it computes locally.
15
21
 
16
22
  MIT · Manik Maurya
package/bin/cognivia.mjs CHANGED
@@ -50,9 +50,15 @@ Usage:
50
50
  cognivia diagnose --input answers.json [--json] [--out file]
51
51
  cognivia report --input answers.json [--out report.txt]
52
52
  cognivia memory-state --input answers.json
53
+ cognivia memory-state <learnerId> (hosted; needs a live key)
54
+ cognivia content items --input items.json (upload item -> misconception maps)
55
+ cognivia content prerequisites --input pre.json (upload concept -> prerequisite maps)
56
+ cognivia content items | prerequisites (list what is stored)
53
57
  cognivia --version
54
58
 
55
59
  answers.json: JSON array of { subject, question, answer, correct, latencyMs, confidence(1-5) }
60
+ items.json: JSON array of { item_ref, distractors: { "wrong option": "misconception" } }
61
+ pre.json: JSON array of { concept, requires: ["prerequisite concept", ...] }
56
62
  Diagnostics are computed by @cognivia/core, the same engine behind the API, MCP server, and site.`);
57
63
  }
58
64
 
@@ -86,9 +92,39 @@ switch (cmd) {
86
92
  out(lines.join("\n"));
87
93
  break;
88
94
  }
95
+ case "content": {
96
+ // Owner-scoped content maps that sharpen /v1/diagnose on your own items.
97
+ // cognivia content items --input items.json upload item -> misconception maps
98
+ // cognivia content prerequisites --input pre.json upload concept -> prerequisite maps
99
+ // cognivia content items | prerequisites (no --input) list what is stored
100
+ if (!client.hasKey()) fail("content needs COGNIVIA_API_KEY (a self-serve live key).");
101
+ const kind = args[1];
102
+ const f = opt("--input");
103
+ const isUpload = f && f !== true;
104
+ const readArr = (key) => {
105
+ const data = JSON.parse(readFileSync(f, "utf8"));
106
+ const arr = Array.isArray(data) ? data : data[key];
107
+ if (!Array.isArray(arr) || !arr.length) fail("input must be a non-empty JSON array");
108
+ return arr;
109
+ };
110
+ try {
111
+ if (kind === "items") {
112
+ out(JSON.stringify(isUpload
113
+ ? await client.setItemMisconceptions(readArr("items"))
114
+ : await client.getItemMisconceptions(), null, 2));
115
+ } else if (kind === "prerequisites" || kind === "prereqs") {
116
+ out(JSON.stringify(isUpload
117
+ ? await client.setConceptPrerequisites(readArr("prerequisites"))
118
+ : await client.getConceptPrerequisites(), null, 2));
119
+ } else {
120
+ fail("content <items|prerequisites> [--input file.json]");
121
+ }
122
+ } catch (e) { fail("content: " + e.message); }
123
+ break;
124
+ }
89
125
  case "--version":
90
126
  case "-v":
91
- console.log("cognivia/0.1.0 (core " + "0.1.0" + ")");
127
+ console.log("cognivia/0.2.0 (core " + "0.2.0" + ")");
92
128
  break;
93
129
  case undefined:
94
130
  case "help":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognivia/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Run Cognivia's learning diagnostics from the terminal. Point it at any learning or quiz app's answer export and get back the Learning Genome, per-item diagnosis, and a session report.",
5
5
  "type": "module",
6
6
  "bin": { "cognivia": "bin/cognivia.mjs" },
@@ -9,7 +9,7 @@
9
9
  "homepage": "https://cognivia-platform.vercel.app/intelligence",
10
10
  "repository": { "type": "git", "url": "git+https://github.com/Manik-Maurya/cognivia-platform.git", "directory": "packages/cli" },
11
11
  "engines": { "node": ">=18" },
12
- "dependencies": { "@cognivia/core": "^0.1.0" },
12
+ "dependencies": { "@cognivia/core": "^0.2.0" },
13
13
  "publishConfig": { "access": "public" },
14
14
  "license": "MIT",
15
15
  "author": "Manik Maurya"