kordexa 0.4.2 → 0.4.4
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/bin/kordexa.js +8 -2
- package/package.json +1 -1
- package/src/cli.js +210 -54
- package/src/email.js +68 -0
- package/src/prompts.js +433 -49
- package/src/research.js +12 -5
- package/src/setup-answers.js +282 -0
- package/src/terminal-view.js +308 -0
- package/src/workflow.js +3 -0
- package/tests/node/guided-setup.test.js +366 -0
- package/tests/node/resend.test.js +177 -0
- package/tests/node/terminal-view.test.js +106 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
import { generate30DayPlan } from "../../src/planner.js";
|
|
10
|
+
import { SetupCancelled, askEmailDelivery, collectOnboarding } from "../../src/prompts.js";
|
|
11
|
+
import {
|
|
12
|
+
ROLE_OPTIONS,
|
|
13
|
+
cleanText,
|
|
14
|
+
parseCurrentLearning,
|
|
15
|
+
parseEmail,
|
|
16
|
+
parseEmailTime,
|
|
17
|
+
parseGmailAppPassword,
|
|
18
|
+
parseName,
|
|
19
|
+
parsePlanDays,
|
|
20
|
+
parseRole,
|
|
21
|
+
parseSkill,
|
|
22
|
+
parseSmtpHost,
|
|
23
|
+
parseSmtpPort,
|
|
24
|
+
parseStage,
|
|
25
|
+
parseTimezone,
|
|
26
|
+
parseWeeklyHours,
|
|
27
|
+
skillSuggestions
|
|
28
|
+
} from "../../src/setup-answers.js";
|
|
29
|
+
|
|
30
|
+
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
31
|
+
const CLI = path.join(repoRoot, "bin/kordexa.js");
|
|
32
|
+
|
|
33
|
+
function accepts(parse, cases) {
|
|
34
|
+
for (const [input, expected] of cases) {
|
|
35
|
+
const result = parse(input);
|
|
36
|
+
assert.equal(result.ok, true, `should accept ${JSON.stringify(input)}: ${result.error}`);
|
|
37
|
+
assert.equal(result.value, expected, JSON.stringify(input));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function rejects(parse, inputs) {
|
|
42
|
+
for (const input of inputs) {
|
|
43
|
+
const result = parse(input);
|
|
44
|
+
assert.equal(result.ok, false, `should reject ${JSON.stringify(input)}`);
|
|
45
|
+
assert.ok(result.error.length > 10, "gives a helpful message");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Plays scripted answers and records everything shown to the learner.
|
|
50
|
+
function scriptedIO(answers) {
|
|
51
|
+
const queue = [...answers];
|
|
52
|
+
const shown = [];
|
|
53
|
+
const next = (label) => {
|
|
54
|
+
shown.push(label);
|
|
55
|
+
if (!queue.length) throw new SetupCancelled();
|
|
56
|
+
return Promise.resolve(queue.shift());
|
|
57
|
+
};
|
|
58
|
+
return { say: (text = "") => shown.push(text), ask: next, askHidden: next, shown, remaining: queue };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function runCli(args, { input = "", cwd, env = {} } = {}) {
|
|
62
|
+
return spawnSync(process.execPath, [CLI, ...args], {
|
|
63
|
+
cwd,
|
|
64
|
+
input,
|
|
65
|
+
encoding: "utf8",
|
|
66
|
+
env: { ...process.env, KORDEXA_OFFLINE: "1", ...env }
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function withTempDir(fn) {
|
|
71
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "kordexa-guided-"));
|
|
72
|
+
try {
|
|
73
|
+
return fn(dir);
|
|
74
|
+
} finally {
|
|
75
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const GOOD_ANSWERS = ["Asha", "asha@gmail.com", "1", "", "", "1", "10", "30", "20:00", "IST", "", ""];
|
|
80
|
+
|
|
81
|
+
test("text cleaning removes arrow keys, control characters, quotes and extra spaces", () => {
|
|
82
|
+
assert.equal(cleanText(" Asha Rao \t"), "Asha Rao");
|
|
83
|
+
assert.equal(cleanText("\u001b[AAsha\u001b[D"), "Asha");
|
|
84
|
+
assert.equal(cleanText('"Asha"'), "Asha");
|
|
85
|
+
assert.equal(cleanText(undefined), "");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("name accepts real names and rejects empty or meaningless answers", () => {
|
|
89
|
+
accepts(parseName, [["cibi", "cibi"], [" Asha Rao ", "Asha Rao"], ["சிபி", "சிபி"], ["O'Neil", "O'Neil"]]);
|
|
90
|
+
rejects(parseName, ["", " ", "no", "none", "N/A", "idk", "123", "!!!", "x".repeat(61)]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("email rejects bad formats, common typos and placeholders", () => {
|
|
94
|
+
accepts(parseEmail, [["name@gmail.com", "name@gmail.com"], ["a.b+c@mail.example.co.in", "a.b+c@mail.example.co.in"]]);
|
|
95
|
+
rejects(parseEmail, ["", "no", "name", "name@", "@gmail.com", "name@gmail", "a b@gmail.com", "a@@gmail.com", "name@gmail..com"]);
|
|
96
|
+
assert.match(parseEmail("name@gmial.com").error, /name@gmail\.com/);
|
|
97
|
+
assert.equal(parseEmail("you@example.com", { allowPlaceholder: false }).ok, false);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("role accepts menu numbers and job titles", () => {
|
|
101
|
+
accepts(parseRole, [["1", ROLE_OPTIONS[0]], ["4", ROLE_OPTIONS[3]], ["data scientist", "Data Scientist"], ["ML Engineer", "ML Engineer"], ["no", ROLE_OPTIONS[0]], ["", ROLE_OPTIONS[0]]]);
|
|
102
|
+
rejects(parseRole, ["0", "5", "99", "!!!", "x", "y".repeat(81)]);
|
|
103
|
+
assert.match(parseRole("Product Designer").note, /no dedicated plan/);
|
|
104
|
+
assert.match(parseRole("ML Engineer").note, /Data Scientist plan/);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("current learning treats no-style answers as not started", () => {
|
|
108
|
+
for (const input of ["", "no", "No.", "nope", "none", "nothing", "n/a", "not yet", "Not started yet", "idk", "I don't know", "-"]) {
|
|
109
|
+
assert.equal(parseCurrentLearning(input).value, "not started yet", input);
|
|
110
|
+
}
|
|
111
|
+
accepts(parseCurrentLearning, [["Python basics", "Python basics"]]);
|
|
112
|
+
rejects(parseCurrentLearning, ["???", "x".repeat(121)]);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test("skill recommends a choice when the learner is unsure", () => {
|
|
116
|
+
for (const input of ["", "no", "idk", "not sure", "skip"]) {
|
|
117
|
+
assert.equal(parseSkill(input, "Data Scientist").value, "pandas", input);
|
|
118
|
+
}
|
|
119
|
+
accepts((raw) => parseSkill(raw, "Cybersecurity Analyst"), [["1", "SIEM"], ["4", "Phishing"], ["log analysis", "log analysis"]]);
|
|
120
|
+
rejects((raw) => parseSkill(raw, "Data Scientist"), ["0", "5", "123456", "!!!"]);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("every suggested skill matches real topics in its role's plan", () => {
|
|
124
|
+
for (const role of ROLE_OPTIONS) {
|
|
125
|
+
for (const focusSkill of skillSuggestions(role)) {
|
|
126
|
+
const plan = generate30DayPlan({ targetRole: role, focusSkill, planDays: 30 });
|
|
127
|
+
assert.doesNotMatch(plan.days[1].title, /^Primary skill focus/, `${role}: ${focusSkill}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test("stage accepts numbers and words and rejects anything else", () => {
|
|
133
|
+
accepts(parseStage, [["1", "beginner"], ["2", "intermediate"], ["3", "advanced"], ["Beginner", "beginner"], ["INTER", "intermediate"], ["expert", "advanced"], ["fresher", "beginner"], ["", "beginner"], ["no", "beginner"]]);
|
|
134
|
+
rejects(parseStage, ["0", "4", "banana", "-1"]);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("weekly hours accepts natural answers and rejects impossible ones", () => {
|
|
138
|
+
accepts(parseWeeklyHours, [["10", 10], ["10 hours", 10], ["8h", 8], ["7.5", 8], ["10 hours per week", 10], ["80", 80]]);
|
|
139
|
+
rejects(parseWeeklyHours, ["", "abc", "0", "-5", "81", "1000", "ten", "no"]);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test("plan length enforces the 30-day minimum and a maximum", () => {
|
|
143
|
+
accepts(parsePlanDays, [["30", 30], ["45 days", 45], ["10", 30], ["1", 30], ["0", 30], ["6 weeks", 42], ["2 months", 60], ["365", 365]]);
|
|
144
|
+
assert.match(parsePlanDays("10").note, /start at 30 days/);
|
|
145
|
+
rejects(parsePlanDays, ["", "abc", "-30", "366", "99999", "4.5", "no"]);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test("email time understands common formats and rejects impossible times", () => {
|
|
149
|
+
accepts(parseEmailTime, [["20:00", "20:00"], ["8:30", "08:30"], ["8", "08:00"], ["8pm", "20:00"], ["8 PM", "20:00"], ["8:30 pm", "20:30"], ["12am", "00:00"], ["12pm", "12:00"], ["20.15", "20:15"], ["2000", "20:00"], ["noon", "12:00"], ["midnight", "00:00"]]);
|
|
150
|
+
rejects(parseEmailTime, ["", "abc", "24:00", "99:99", "13pm", "0pm", "8:60", "-1", "no"]);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test("timezone understands codes, cities and full names", () => {
|
|
154
|
+
accepts(parseTimezone, [["IST", "Asia/Kolkata"], ["ist", "Asia/Kolkata"], ["India", "Asia/Kolkata"], ["Chennai", "Asia/Kolkata"], ["Asia/Calcutta", "Asia/Kolkata"], ["Asia/Kolkata", "Asia/Kolkata"], ["UTC", "UTC"], ["GMT", "UTC"], ["London", "Europe/London"], ["new york", "America/New_York"], ["PST", "America/Los_Angeles"], ["UTC+5:30", "Asia/Kolkata"]]);
|
|
155
|
+
rejects(parseTimezone, ["", "abc", "Mars/Base", "no", "123", "XYZ"]);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("mail settings reject invalid values", () => {
|
|
159
|
+
accepts(parseSmtpHost, [["smtp.zoho.com", "smtp.zoho.com"], ["SMTP.Gmail.com", "smtp.gmail.com"], ["smtp://smtp.zoho.com", "smtp.zoho.com"]]);
|
|
160
|
+
rejects(parseSmtpHost, ["", "no", "localhost", "smtp zoho com", "me@gmail.com"]);
|
|
161
|
+
accepts(parseSmtpPort, [["587", 587], ["465", 465]]);
|
|
162
|
+
rejects(parseSmtpPort, ["", "0", "70000", "abc", "-1"]);
|
|
163
|
+
accepts(parseGmailAppPassword, [["abcd efgh ijkl mnop", "abcdefghijklmnop"]]);
|
|
164
|
+
rejects(parseGmailAppPassword, ["", "short", "my-normal-password", "abcd1234abcd1234"]);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test("guided setup completes with simple answers and skips email by default", async () => {
|
|
168
|
+
const io = scriptedIO(GOOD_ANSWERS);
|
|
169
|
+
const answers = await collectOnboarding({ io });
|
|
170
|
+
assert.equal(answers.learner.name, "Asha");
|
|
171
|
+
assert.equal(answers.learner.targetRole, ROLE_OPTIONS[0]);
|
|
172
|
+
assert.equal(answers.learner.currentLearning, "not started yet");
|
|
173
|
+
assert.equal(answers.learner.focusSkill, "RAG");
|
|
174
|
+
assert.equal(answers.learner.weeklyHours, 10);
|
|
175
|
+
assert.equal(answers.schedule.timezone, "Asia/Kolkata");
|
|
176
|
+
assert.equal(answers.emailConnected, false);
|
|
177
|
+
assert.equal(io.remaining.length, 0);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test("guided setup never mentions SMTP unless the learner chooses another provider", async () => {
|
|
181
|
+
const io = scriptedIO(GOOD_ANSWERS);
|
|
182
|
+
await collectOnboarding({ io });
|
|
183
|
+
assert.doesNotMatch(io.shown.join("\n"), /SMTP/i);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test("pressing Enter on required questions asks again with a clear message", async () => {
|
|
187
|
+
const io = scriptedIO(["", " ", "Asha", "", "asha@gmail.com", ...GOOD_ANSWERS.slice(2)]);
|
|
188
|
+
const answers = await collectOnboarding({ io });
|
|
189
|
+
assert.equal(answers.learner.name, "Asha");
|
|
190
|
+
assert.equal(io.shown.filter((line) => /Please enter your name/.test(line)).length, 2);
|
|
191
|
+
assert.ok(io.shown.some((line) => /Please enter your email/.test(line)));
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test("pressing Enter on every optional question uses safe defaults", async () => {
|
|
195
|
+
const io = scriptedIO(["Asha", "asha@gmail.com", "", "", "", "", "", "", "", "", "", ""]);
|
|
196
|
+
const answers = await collectOnboarding({ io });
|
|
197
|
+
assert.equal(answers.learner.targetRole, ROLE_OPTIONS[0]);
|
|
198
|
+
assert.equal(answers.learner.focusSkill, "RAG");
|
|
199
|
+
assert.equal(answers.learner.currentStage, "beginner");
|
|
200
|
+
assert.equal(answers.learner.weeklyHours, 8);
|
|
201
|
+
assert.equal(answers.learner.planDays, 30);
|
|
202
|
+
assert.equal(answers.schedule.dailyEmailTime, "08:00");
|
|
203
|
+
assert.ok(parseTimezone(answers.schedule.timezone).ok);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test("wrong answers are explained and asked again at every question", async () => {
|
|
207
|
+
const io = scriptedIO([
|
|
208
|
+
"no", "Asha",
|
|
209
|
+
"notanemail", "asha@gmail.com",
|
|
210
|
+
"9", "1",
|
|
211
|
+
"???", "Python",
|
|
212
|
+
"99", "RAG",
|
|
213
|
+
"banana", "2",
|
|
214
|
+
"abc", "12",
|
|
215
|
+
"9999", "45",
|
|
216
|
+
"25:00", "8pm",
|
|
217
|
+
"Mars", "Chennai",
|
|
218
|
+
"7", "3",
|
|
219
|
+
"99", ""
|
|
220
|
+
]);
|
|
221
|
+
const answers = await collectOnboarding({ io });
|
|
222
|
+
assert.equal(answers.learner.currentStage, "intermediate");
|
|
223
|
+
assert.equal(answers.learner.planDays, 45);
|
|
224
|
+
assert.equal(answers.schedule.dailyEmailTime, "20:00");
|
|
225
|
+
assert.equal(io.shown.filter((line) => /^ {2}! /.test(line)).length, 12);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
test("review step can change an answer before saving", async () => {
|
|
229
|
+
const io = scriptedIO([...GOOD_ANSWERS.slice(0, -1), "1", "Asha Rao", ""]);
|
|
230
|
+
assert.equal((await collectOnboarding({ io })).learner.name, "Asha Rao");
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
test("changing the role in review asks for a matching first skill", async () => {
|
|
234
|
+
const io = scriptedIO([...GOOD_ANSWERS.slice(0, -1), "3", "4", "", ""]);
|
|
235
|
+
const answers = await collectOnboarding({ io });
|
|
236
|
+
assert.equal(answers.learner.targetRole, "Data Scientist");
|
|
237
|
+
assert.equal(answers.learner.focusSkill, "pandas");
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test("quit stops setup at any question", async () => {
|
|
241
|
+
await assert.rejects(collectOnboarding({ io: scriptedIO(["Asha", "quit"]) }), SetupCancelled);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test("Gmail setup asks only for an app password and retries a normal password", async () => {
|
|
245
|
+
const io = scriptedIO(["1", "my-normal-password", "abcd efgh ijkl mnop"]);
|
|
246
|
+
const email = await askEmailDelivery(io, { email: "asha@gmail.com" });
|
|
247
|
+
assert.deepEqual(email, { smtpHost: "smtp.gmail.com", smtpPort: 465, smtpUser: "asha@gmail.com", smtpPass: "abcdefghijklmnop", smtpFrom: "asha@gmail.com" });
|
|
248
|
+
assert.doesNotMatch(io.shown.join("\n"), /abcd efgh|my-normal-password/);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test("pressing Enter at any email login step skips email safely", async () => {
|
|
252
|
+
assert.deepEqual(await askEmailDelivery(scriptedIO(["1", ""]), { email: "asha@gmail.com" }), {});
|
|
253
|
+
assert.deepEqual(await askEmailDelivery(scriptedIO(["2", ""]), { email: "asha@gmail.com" }), {});
|
|
254
|
+
assert.deepEqual(await askEmailDelivery(scriptedIO(["2", "smtp.zoho.com", "", "", ""]), { email: "asha@zoho.com" }), {});
|
|
255
|
+
assert.deepEqual(await askEmailDelivery(scriptedIO([""]), { email: "asha@gmail.com" }), {});
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test("another provider validates its settings", async () => {
|
|
259
|
+
const io = scriptedIO(["2", "not a server", "smtp.zoho.com", "abc", "587", "", "app-secret"]);
|
|
260
|
+
const email = await askEmailDelivery(io, { email: "asha@zoho.com" });
|
|
261
|
+
assert.deepEqual(email, { smtpHost: "smtp.zoho.com", smtpPort: 587, smtpUser: "asha@zoho.com", smtpPass: "app-secret", smtpFrom: "asha@zoho.com" });
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
test("a saved email login is kept by pressing Enter and never shown", async () => {
|
|
265
|
+
const io = scriptedIO([""]);
|
|
266
|
+
assert.deepEqual(await askEmailDelivery(io, { email: "a@gmail.com", smtpUser: "a@gmail.com", smtpPass: "saved-secret" }), {});
|
|
267
|
+
assert.doesNotMatch(io.shown.join("\n"), /saved-secret/);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
test("non-interactive setup rejects every invalid option and writes nothing", () => {
|
|
271
|
+
withTempDir((dir) => {
|
|
272
|
+
const result = runCli(["--yes", "--offline", "--name", "123", "--email", "bad", "--stage", "banana", "--weekly-hours", "abc", "--days", "xyz", "--time", "99:99", "--timezone", "Mars"], { cwd: dir });
|
|
273
|
+
assert.equal(result.status, 1);
|
|
274
|
+
for (const flag of ["--name", "--email", "--stage", "--weekly-hours", "--days", "--time", "--timezone"]) {
|
|
275
|
+
assert.ok(result.stderr.includes(flag), flag);
|
|
276
|
+
}
|
|
277
|
+
assert.deepEqual(fs.readdirSync(dir), []);
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
test("unknown options and missing values are explained", () => {
|
|
282
|
+
withTempDir((dir) => {
|
|
283
|
+
assert.match(runCli(["--yes", "--emial", "a@gmail.com"], { cwd: dir }).stderr, /Unknown option "--emial"/);
|
|
284
|
+
assert.match(runCli(["--yes", "--email"], { cwd: dir }).stderr, /add a value after --email/);
|
|
285
|
+
assert.deepEqual(fs.readdirSync(dir), []);
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
test("a mistyped command suggests the right one instead of starting setup", () => {
|
|
290
|
+
withTempDir((dir) => {
|
|
291
|
+
const result = runCli(["stauts"], { cwd: dir });
|
|
292
|
+
assert.equal(result.status, 1);
|
|
293
|
+
assert.match(result.stderr, /Unknown command "stauts"\. Did you mean "status"\?/);
|
|
294
|
+
assert.deepEqual(fs.readdirSync(dir), []);
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
test("commands explain when setup has not run yet", () => {
|
|
299
|
+
withTempDir((dir) => {
|
|
300
|
+
const result = runCli(["status"], { cwd: dir });
|
|
301
|
+
assert.equal(result.status, 1);
|
|
302
|
+
assert.match(result.stderr, /Run npx kordexa first/);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
test("guided setup works through piped answers and saves the result", () => {
|
|
307
|
+
withTempDir((dir) => {
|
|
308
|
+
const result = runCli(["--offline"], { cwd: dir, input: `${GOOD_ANSWERS.join("\n")}\n` });
|
|
309
|
+
assert.equal(result.status, 0, result.stderr);
|
|
310
|
+
assert.match(result.stdout, /You're all set, Asha\./);
|
|
311
|
+
assert.match(result.stdout, /npx kordexa setup-email/);
|
|
312
|
+
const config = JSON.parse(fs.readFileSync(path.join(dir, "kordexa.config.json"), "utf8"));
|
|
313
|
+
assert.equal(config.schedule.timezone, "Asia/Kolkata");
|
|
314
|
+
assert.match(fs.readFileSync(path.join(dir, ".github/workflows/kordexa-daily.yml"), "utf8"), /cron: "30 14 \* \* \*"/);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
test("input ending early stops setup and saves nothing", () => {
|
|
319
|
+
withTempDir((dir) => {
|
|
320
|
+
const result = runCli(["--offline"], { cwd: dir, input: "Asha\n" });
|
|
321
|
+
assert.equal(result.status, 130);
|
|
322
|
+
assert.match(result.stdout, /Nothing was saved/);
|
|
323
|
+
assert.deepEqual(fs.readdirSync(dir), []);
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("setup protects the home folder unless the learner confirms", () => {
|
|
328
|
+
withTempDir((dir) => {
|
|
329
|
+
const env = { HOME: dir };
|
|
330
|
+
assert.equal(runCli(["--offline"], { cwd: dir, env, input: "\n" }).status, 130);
|
|
331
|
+
assert.deepEqual(fs.readdirSync(dir), []);
|
|
332
|
+
|
|
333
|
+
const scripted = runCli(["--yes", "--offline"], { cwd: dir, env });
|
|
334
|
+
assert.equal(scripted.status, 1);
|
|
335
|
+
assert.match(scripted.stderr, /home folder/);
|
|
336
|
+
assert.deepEqual(fs.readdirSync(dir), []);
|
|
337
|
+
|
|
338
|
+
assert.equal(runCli(["--yes", "--offline", "--allow-home"], { cwd: dir, env }).status, 0);
|
|
339
|
+
assert.equal(fs.existsSync(path.join(dir, "kordexa.config.json")), true);
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
test("daily commands reject invalid numbers with clear messages", () => {
|
|
344
|
+
withTempDir((dir) => {
|
|
345
|
+
assert.equal(runCli(["--yes", "--offline", "--role", "Data Scientist"], { cwd: dir }).status, 0);
|
|
346
|
+
const cases = [
|
|
347
|
+
[["research", "--day", "abc", "--offline"], /--day must be a whole number from 1 to 30/],
|
|
348
|
+
[["research", "--day", "99", "--offline"], /outside this 30-day plan/],
|
|
349
|
+
[["links", "--day", "0", "--offline"], /--day must be a whole number/],
|
|
350
|
+
[["log-progress", "--day", "1"], /what you finished/],
|
|
351
|
+
[["log-progress", "--day", "abc", "--completed", "x", "--evidence", "y"], /--day must be/],
|
|
352
|
+
[["log-progress", "--day", "1", "--completed", "x", "--evidence", "y", "--confidence", "9"], /--confidence must be/],
|
|
353
|
+
[["log-progress", "--day", "1", "--completed", "x", "--evidence", "y", "--minutes", "-5"], /--minutes must be/],
|
|
354
|
+
[["weekly-summary", "--week", "abc"], /--week must be/],
|
|
355
|
+
[["weekly-summary", "--week", "99"], /--week must be/],
|
|
356
|
+
[["plan", "--days", "abc"], /number of days/],
|
|
357
|
+
[["send-today", "--dry-run", "--day", "abc", "--offline"], /--day must be/]
|
|
358
|
+
];
|
|
359
|
+
for (const [args, message] of cases) {
|
|
360
|
+
const result = runCli(args, { cwd: dir });
|
|
361
|
+
assert.equal(result.status, 1, args.join(" "));
|
|
362
|
+
assert.match(result.stderr, message, args.join(" "));
|
|
363
|
+
}
|
|
364
|
+
assert.equal(fs.existsSync(path.join(dir, "data/progress-log.json")), false);
|
|
365
|
+
});
|
|
366
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
|
|
7
|
+
import { main } from "../../src/cli.js";
|
|
8
|
+
import { dailyEmailKey, resendConfigFromEnv, sendWithResend } from "../../src/email.js";
|
|
9
|
+
|
|
10
|
+
process.env.KORDEXA_OFFLINE = "1";
|
|
11
|
+
|
|
12
|
+
const TEST_KEY = "re_test_value_not_real";
|
|
13
|
+
const resend = { apiKey: TEST_KEY, from: "Kordexa <onboarding@resend.dev>" };
|
|
14
|
+
const message = { to: "learner@gmail.com", subject: "Day 1", html: "<p>Plan</p>", text: "Plan" };
|
|
15
|
+
const noWait = async () => {};
|
|
16
|
+
|
|
17
|
+
function reply(status, body, headers = {}) {
|
|
18
|
+
return { ok: status < 400, status, headers: { get: (name) => headers[name] ?? null }, json: async () => body };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function withFetch(replies, fn) {
|
|
22
|
+
const original = global.fetch;
|
|
23
|
+
const calls = [];
|
|
24
|
+
global.fetch = async (url, init) => {
|
|
25
|
+
calls.push({ url: String(url), init });
|
|
26
|
+
const next = replies.shift();
|
|
27
|
+
if (next instanceof Error) throw next;
|
|
28
|
+
return next;
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
return await fn(calls);
|
|
32
|
+
} finally {
|
|
33
|
+
global.fetch = original;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function inProject(fn) {
|
|
38
|
+
const oldCwd = process.cwd();
|
|
39
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "kordexa-resend-"));
|
|
40
|
+
const log = console.log;
|
|
41
|
+
const printed = [];
|
|
42
|
+
console.log = (line) => printed.push(String(line));
|
|
43
|
+
process.chdir(dir);
|
|
44
|
+
try {
|
|
45
|
+
await main(["--yes", "--offline", "--name", "Asha", "--email", "learner@gmail.com", "--role", "Data Scientist"]);
|
|
46
|
+
fs.appendFileSync(path.join(dir, ".env.local"), `RESEND_API_KEY=${TEST_KEY}\n`);
|
|
47
|
+
return await fn(dir, printed);
|
|
48
|
+
} finally {
|
|
49
|
+
console.log = log;
|
|
50
|
+
process.chdir(oldCwd);
|
|
51
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
test("Resend is used only when an API key is configured", () => {
|
|
56
|
+
assert.equal(resendConfigFromEnv({}), null);
|
|
57
|
+
assert.deepEqual(resendConfigFromEnv({ RESEND_API_KEY: TEST_KEY }), resend);
|
|
58
|
+
assert.equal(resendConfigFromEnv({ RESEND_API_KEY: TEST_KEY, RESEND_FROM: "Plans <a@b.co>" }).from, "Plans <a@b.co>");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("daily email key is stable, private and specific to each plan day", () => {
|
|
62
|
+
const key = dailyEmailKey("Learner@Gmail.com", "2026-11-18", 3);
|
|
63
|
+
assert.equal(key, dailyEmailKey("learner@gmail.com", "2026-11-18", 3));
|
|
64
|
+
assert.notEqual(key, dailyEmailKey("learner@gmail.com", "2026-11-18", 4));
|
|
65
|
+
assert.doesNotMatch(key, /gmail|learner/i);
|
|
66
|
+
assert.ok(key.length <= 256);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("an email is sent with the required Resend request format", async () => {
|
|
70
|
+
await withFetch([reply(200, { id: "email_1" })], async (calls) => {
|
|
71
|
+
const result = await sendWithResend({ resend, message, idempotencyKey: "day-1" });
|
|
72
|
+
assert.deepEqual(result, { sent: true, to: message.to, subject: "Day 1", transport: "resend", id: "email_1" });
|
|
73
|
+
assert.equal(calls[0].url, "https://api.resend.com/emails");
|
|
74
|
+
assert.equal(calls[0].init.headers.authorization, `Bearer ${TEST_KEY}`);
|
|
75
|
+
assert.equal(calls[0].init.headers["idempotency-key"], "day-1");
|
|
76
|
+
assert.ok(calls[0].init.headers["user-agent"]);
|
|
77
|
+
assert.deepEqual(JSON.parse(calls[0].init.body), { from: resend.from, to: [message.to], subject: "Day 1", html: "<p>Plan</p>", text: "Plan" });
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("temporary failures retry with the same key so no duplicate is sent", async () => {
|
|
82
|
+
await withFetch([reply(429, {}, { "retry-after": "1" }), new Error("network down"), reply(200, { id: "email_2" })], async (calls) => {
|
|
83
|
+
const result = await sendWithResend({ resend, message, idempotencyKey: "day-2", wait: noWait });
|
|
84
|
+
assert.equal(result.id, "email_2");
|
|
85
|
+
assert.equal(calls.length, 3);
|
|
86
|
+
assert.deepEqual(calls.map((call) => call.init.headers["idempotency-key"]), ["day-2", "day-2", "day-2"]);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test("permanent failures stop immediately with a clear message", async () => {
|
|
91
|
+
const cases = [
|
|
92
|
+
[401, { message: "API key is invalid" }, /didn't accept the API key/],
|
|
93
|
+
[403, { message: "You can only send testing emails to your own email address. Please verify a domain." }, /can only email the address on your Resend account/],
|
|
94
|
+
[422, { message: "Invalid to field" }, /error 422.*Invalid to field/]
|
|
95
|
+
];
|
|
96
|
+
for (const [status, body, expected] of cases) {
|
|
97
|
+
await withFetch([reply(status, body)], async (calls) => {
|
|
98
|
+
await assert.rejects(sendWithResend({ resend, message, wait: noWait }), (error) => {
|
|
99
|
+
assert.match(error.message, expected);
|
|
100
|
+
assert.doesNotMatch(error.message, new RegExp(TEST_KEY));
|
|
101
|
+
return true;
|
|
102
|
+
});
|
|
103
|
+
assert.equal(calls.length, 1);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("repeated outages end with a helpful error", async () => {
|
|
109
|
+
await withFetch([new Error("down"), new Error("down"), new Error("down")], async (calls) => {
|
|
110
|
+
await assert.rejects(sendWithResend({ resend, message, wait: noWait }), /Couldn't reach Resend/);
|
|
111
|
+
assert.equal(calls.length, 3);
|
|
112
|
+
});
|
|
113
|
+
await withFetch([reply(500, {}), reply(503, {}), reply(500, { message: "Server error" })], async (calls) => {
|
|
114
|
+
await assert.rejects(sendWithResend({ resend, message, wait: noWait }), /error 500/);
|
|
115
|
+
assert.equal(calls.length, 3);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test("send-today delivers through Resend and keeps the key out of saved results", async () => {
|
|
120
|
+
await inProject(async (dir, printed) => {
|
|
121
|
+
await withFetch([reply(200, { id: "email_3" })], async (calls) => {
|
|
122
|
+
await main(["send-today", "--day", "1", "--offline"]);
|
|
123
|
+
assert.equal(calls.length, 1);
|
|
124
|
+
assert.match(calls[0].init.headers["idempotency-key"], /-day-1$/);
|
|
125
|
+
});
|
|
126
|
+
const latest = fs.readFileSync(path.join(dir, "data/latest-email.json"), "utf8");
|
|
127
|
+
assert.equal(JSON.parse(latest).transport, "resend");
|
|
128
|
+
assert.doesNotMatch(latest + printed.join("\n"), new RegExp(TEST_KEY));
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test("a dry run never contacts Resend", async () => {
|
|
133
|
+
await inProject(async () => {
|
|
134
|
+
await withFetch([], async (calls) => {
|
|
135
|
+
await main(["send-today", "--dry-run", "--day", "1", "--offline"]);
|
|
136
|
+
assert.equal(calls.length, 0);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("the scheduled workflow passes Resend settings from GitHub secrets", async () => {
|
|
142
|
+
await inProject(async (dir) => {
|
|
143
|
+
const workflow = fs.readFileSync(path.join(dir, ".github/workflows/kordexa-daily.yml"), "utf8");
|
|
144
|
+
assert.match(workflow, /RESEND_API_KEY: \$\{\{ secrets\.RESEND_API_KEY \}\}/);
|
|
145
|
+
assert.match(workflow, /RESEND_FROM: \$\{\{ secrets\.RESEND_FROM \}\}/);
|
|
146
|
+
assert.doesNotMatch(workflow, new RegExp(TEST_KEY));
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test("setup upgrades the earlier generated workflow to include Resend", async () => {
|
|
151
|
+
await inProject(async (dir) => {
|
|
152
|
+
const file = path.join(dir, ".github/workflows/kordexa-daily.yml");
|
|
153
|
+
const earlier = fs.readFileSync(file, "utf8").replace(/ {10}RESEND_API_KEY: .*\n {10}RESEND_FROM: .*\n/, "");
|
|
154
|
+
fs.writeFileSync(file, earlier);
|
|
155
|
+
assert.equal((await main(["doctor"])).status, "needs-upgrade");
|
|
156
|
+
await main(["--yes", "--offline"]);
|
|
157
|
+
assert.match(fs.readFileSync(file, "utf8"), /RESEND_API_KEY/);
|
|
158
|
+
assert.equal((await main(["doctor"])).status, "ready");
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test("setup-secrets asks for the Resend key without printing it", async () => {
|
|
163
|
+
await inProject(async () => {
|
|
164
|
+
const result = await main(["setup-secrets"]);
|
|
165
|
+
assert.deepEqual(result.commands, ["gh secret set RESEND_API_KEY"]);
|
|
166
|
+
assert.doesNotMatch(JSON.stringify(result), new RegExp(TEST_KEY));
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
test("doctor counts a Resend key as connected email", async () => {
|
|
171
|
+
await inProject(async () => {
|
|
172
|
+
const result = await main(["doctor"]);
|
|
173
|
+
assert.equal(result.checks.localEmail, true);
|
|
174
|
+
assert.equal(result.status, "ready");
|
|
175
|
+
assert.doesNotMatch(JSON.stringify(result), new RegExp(TEST_KEY));
|
|
176
|
+
});
|
|
177
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
import { generate30DayPlan } from "../../src/planner.js";
|
|
10
|
+
import { renderView, terminalSupportsColor } from "../../src/terminal-view.js";
|
|
11
|
+
|
|
12
|
+
const CLI = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../bin/kordexa.js");
|
|
13
|
+
const plan = generate30DayPlan({ targetRole: "Data Scientist", focusSkill: "pandas", planDays: 30 });
|
|
14
|
+
const review = { momentum: "not-started", completedDays: 0, activeDay: 1, nextAction: "Analyze a small CSV." };
|
|
15
|
+
const digest = {
|
|
16
|
+
day: 1,
|
|
17
|
+
topic: "pandas basics",
|
|
18
|
+
topVideo: { title: "pandas tutorial", url: "https://www.youtube.com/watch?v=abc12345678" },
|
|
19
|
+
topRepo: { title: "pandas-dev/pandas", url: "https://github.com/pandas-dev/pandas" },
|
|
20
|
+
topDoc: { title: "pandas docs", url: "https://pandas.pydata.org/docs/" }
|
|
21
|
+
};
|
|
22
|
+
const preview = {
|
|
23
|
+
dryRun: true,
|
|
24
|
+
message: { to: "asha@gmail.com", subject: "Kordexa Day 1: Setup", text: "plain", html: "<!doctype html><html></html>" }
|
|
25
|
+
};
|
|
26
|
+
const context = { day: plan.days[0], digest, review, totalDays: 30, completedDays: 0, previewPath: "data/email-preview.html", emailConnected: false };
|
|
27
|
+
|
|
28
|
+
test("email preview is readable and hides raw JSON and HTML", () => {
|
|
29
|
+
const output = renderView("email", preview, context);
|
|
30
|
+
assert.match(output, /Preview only\. No email was sent\./);
|
|
31
|
+
assert.match(output, /Kordexa Day 1: Setup/);
|
|
32
|
+
assert.match(output, /Today's task/);
|
|
33
|
+
assert.match(output, /Learn 35m · Build 45m · Review 15m/);
|
|
34
|
+
assert.match(output, /https:\/\/github\.com\/pandas-dev\/pandas/);
|
|
35
|
+
assert.match(output, /(open|start|xdg-open) data\/email-preview\.html/);
|
|
36
|
+
assert.match(output, /npx kordexa setup-email/);
|
|
37
|
+
assert.doesNotMatch(output, /<html|<!doctype|"dryRun"|\\n/);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("a sent email confirms delivery without preview steps", () => {
|
|
41
|
+
const output = renderView("email", { sent: true, to: "asha@gmail.com", subject: "Kordexa Day 1: Setup" }, { ...context, emailConnected: true });
|
|
42
|
+
assert.match(output, /Email sent to asha@gmail\.com/);
|
|
43
|
+
assert.doesNotMatch(output, /Preview only|email-preview/);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("every command has a readable view", () => {
|
|
47
|
+
const card = { role: "Data Scientist", skill: "pandas", completedDays: 1, totalDays: 30, activeDay: 2, activeTopic: "SQL", grid: ["01-07 # > . . . . ."] };
|
|
48
|
+
const views = {
|
|
49
|
+
skipped: [{ recommendation: { recommendedNextSkill: "model evaluation" } }],
|
|
50
|
+
plan: [{ days: 30 }, { plan }],
|
|
51
|
+
status: [{ learner: "Asha", targetRole: "Data Scientist", primarySkill: "pandas", completedDays: 1, daysPlanned: 30, activeDay: 2, momentum: "strong", emailTime: "20:00 UTC", nextAction: "Build", latestEvidence: "repo", risk: "No active blocker logged." }],
|
|
52
|
+
research: [{ path: "data/r.json", digest }],
|
|
53
|
+
links: [{ path: "data/links.json", day: 1, topic: "pandas", ...digest }],
|
|
54
|
+
harness: [{ jsonPath: "data/h.json", harness: { activeDay: { day: 1, title: "Setup", task: "Build" } } }],
|
|
55
|
+
courses: [{ markdownPath: "data/l.md", learningSources: { targetRole: "Data Scientist", recommendedSources: [{ title: "Kaggle", url: "https://kaggle.com" }], newsletters: [{ title: "Blog", url: "https://example.com" }] } }],
|
|
56
|
+
logged: [{ entry: { day: 1, completed: "Built", evidence: "repo" }, review }],
|
|
57
|
+
weekly: [{ week: 1, range: "1-7", summary: "Good work.", completed: [{ day: 1, completed: "Built" }], nextWeekFocus: "SQL" }],
|
|
58
|
+
recommendation: [{ recommendedNextSkill: "SQL", reason: "Useful.", completedDays: 1, requiredDays: 30, canAdvance: false }],
|
|
59
|
+
card: [{ card, markdownPath: "data/c.md", terminalSvgPath: "data/c.svg" }],
|
|
60
|
+
terminalCard: [{ terminalSvgPath: "data/c.svg" }],
|
|
61
|
+
secrets: [{ commands: ["gh secret set RESEND_API_KEY"] }],
|
|
62
|
+
doctor: [{ status: "needs-email-setup", checks: { config: true, localEmail: false }, nextSteps: ["Connect email."] }]
|
|
63
|
+
};
|
|
64
|
+
for (const [kind, [payload, viewContext]] of Object.entries(views)) {
|
|
65
|
+
const output = renderView(kind, payload, viewContext);
|
|
66
|
+
assert.ok(output.trim().length > 10, kind);
|
|
67
|
+
assert.doesNotMatch(output.trimStart(), /^[{[]"?/, kind);
|
|
68
|
+
assert.doesNotMatch(output, /undefined|\[object Object\]|NaN/, kind);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("long text wraps to the terminal width", () => {
|
|
73
|
+
const long = { learner: "Asha", targetRole: "Data Scientist", primarySkill: "pandas", completedDays: 0, daysPlanned: 30, activeDay: 1, momentum: "steady", emailTime: "20:00", risk: "", nextAction: "word ".repeat(40) };
|
|
74
|
+
const lines = renderView("status", long, {}, { width: 50 }).split("\n");
|
|
75
|
+
assert.ok(lines.every((line) => line.length <= 56), lines.join("\n"));
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("colors appear only when enabled and external text cannot inject terminal codes", () => {
|
|
79
|
+
const unsafe = { ...digest, topVideo: { title: "Safe\u001b[31m title\u0007", url: "https://youtube.com/watch?v=1" } };
|
|
80
|
+
const plain = renderView("research", { path: "data/r.json", digest: unsafe });
|
|
81
|
+
assert.doesNotMatch(plain, /\u001b|\u0007/);
|
|
82
|
+
assert.match(plain, /Safe title/);
|
|
83
|
+
assert.match(renderView("research", { path: "data/r.json", digest }, {}, { color: true }), /\u001b\[/);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("color follows the terminal and NO_COLOR", () => {
|
|
87
|
+
assert.equal(terminalSupportsColor({ isTTY: true }, {}), true);
|
|
88
|
+
assert.equal(terminalSupportsColor({ isTTY: false }, {}), false);
|
|
89
|
+
assert.equal(terminalSupportsColor({ isTTY: true }, { NO_COLOR: "1" }), false);
|
|
90
|
+
assert.equal(terminalSupportsColor({ isTTY: true }, { TERM: "dumb" }), false);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("agents and scripts still receive complete JSON", () => {
|
|
94
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "kordexa-view-"));
|
|
95
|
+
try {
|
|
96
|
+
const run = (...args) => spawnSync(process.execPath, [CLI, ...args], { cwd: dir, encoding: "utf8", env: { ...process.env, KORDEXA_OFFLINE: "1" } });
|
|
97
|
+
assert.equal(run("--yes", "--offline", "--name", "Asha", "--email", "asha@gmail.com", "--role", "Data Scientist").status, 0);
|
|
98
|
+
const result = JSON.parse(run("send-today", "--dry-run", "--offline").stdout);
|
|
99
|
+
assert.equal(result.dryRun, true);
|
|
100
|
+
assert.match(result.message.html, /<html/);
|
|
101
|
+
assert.match(fs.readFileSync(path.join(dir, "data/email-preview.html"), "utf8"), /<html/);
|
|
102
|
+
assert.equal(JSON.parse(run("status", "--json").stdout).learner, "Asha");
|
|
103
|
+
} finally {
|
|
104
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
105
|
+
}
|
|
106
|
+
});
|